Logs: freenode/#haskell
| 2020-10-03 07:18:42 | <ski> | (mapM_ . mapM_) (putStrLn . if optPathOnly opts then path else show) (queryStrings nonOptions <$> db) -- is a version that assumes you keep `db <- readDatabase (optDatabase opts)' on the line above |
| 2020-10-03 07:19:01 | → | chappi joins (~swaroop@157.45.76.253) |
| 2020-10-03 07:19:13 | <p0a> | ski: see, what I was trying to do is 'get inside' Maybe only once; but it seems necessary that you do it twice |
| 2020-10-03 07:19:16 | <ski> | (forM_ (queryStrings nonOptions <$> db) . mapM_) (putStrLn . if optPathOnly opts then path else show) -- same thing, just putting the action last |
| 2020-10-03 07:19:21 | × | zacts quits (~zacts@dragora/developer/zacts) (Quit: leaving) |
| 2020-10-03 07:19:24 | → | LKoen joins (~LKoen@lstlambert-657-1-123-43.w92-154.abo.wanadoo.fr) |
| 2020-10-03 07:19:27 | <p0a> | Once to do the transformation Database -> [String] and once to use mapM_ |
| 2020-10-03 07:19:35 | <p0a> | otherwise the types won't match? I think |
| 2020-10-03 07:19:37 | <taurux> | ski: Can't you move the (queryStrings nonOptions) inside the argument of (mapM_ . mapM_)? |
| 2020-10-03 07:19:56 | × | cole-h quits (~cole-h@c-73-48-197-220.hsd1.ca.comcast.net) (Ping timeout: 260 seconds) |
| 2020-10-03 07:20:02 | <taurux> | oh no sorry I didn't think that there are 2 mapM_ |
| 2020-10-03 07:20:30 | × | falafel quits (~falafel@2605:e000:1527:d491:a806:37fa:6971:2798) (Remote host closed the connection) |
| 2020-10-03 07:20:38 | <ski> | one is for `Maybe', the other is for `[]' |
| 2020-10-03 07:21:05 | <p0a> | I guess mapM_ . mapM_ doesn't have a name, right? |
| 2020-10-03 07:21:16 | × | banjiewen quits (sid115913@gateway/web/irccloud.com/x-shqhqasrwahmjagb) (Ping timeout: 244 seconds) |
| 2020-10-03 07:21:16 | → | mahene joins (~mahene@2a02:8109:86c0:8d68:5400:2bfd:d746:732c) |
| 2020-10-03 07:21:24 | <ski> | (mapM_ . (. queryStrings nonOptions) . mapM_) (putStrLn . if optPathOnly opts then path else show) db |
| 2020-10-03 07:21:29 | <ski> | (forM_ db . (. queryStrings nonOptions) . mapM_) (putStrLn . if optPathOnly opts then path else show) |
| 2020-10-03 07:21:53 | <p0a> | oh lol |
| 2020-10-03 07:22:00 | <ski> | i considered those, at first, but figured you might be more confused by `foo . (. bar) . baz' |
| 2020-10-03 07:22:05 | <p0a> | now it's getting too tricky ski |
| 2020-10-03 07:22:46 | → | livvy joins (~livvy@gateway/tor-sasl/livvy) |
| 2020-10-03 07:23:10 | <ski> | `fmap'ping `queryStrings nonOptions' over `db' before getting into the `mapM_' seemed more clear |
| 2020-10-03 07:23:20 | × | constR quits (uid58205@gateway/web/irccloud.com/x-ljcnzijchvmxodjj) (Ping timeout: 244 seconds) |
| 2020-10-03 07:23:20 | → | banjiewen joins (sid115913@gateway/web/irccloud.com/x-mooiusydhgfmcvhk) |
| 2020-10-03 07:23:30 | × | HaskellYogi quits (~vivekrama@49.207.196.239) (Ping timeout: 256 seconds) |
| 2020-10-03 07:24:47 | × | raul782 quits (~raul782@190.237.41.123) () |
| 2020-10-03 07:25:43 | <p0a> | hahah that code is crazy |
| 2020-10-03 07:25:50 | <taurux> | p0a, you will get used to composing things functions like this |
| 2020-10-03 07:25:54 | <taurux> | :t (.) . (.) |
| 2020-10-03 07:25:57 | <lambdabot> | (b -> c) -> (a1 -> a2 -> b) -> a1 -> a2 -> c |
| 2020-10-03 07:26:26 | <ski> | (. Compose) . mapM_ :: (Foldable t,Foldable u,Monad m) => (a -> m b) -> t (u a) -> m () |
| 2020-10-03 07:26:34 | <p0a> | Right so (.) . (.) is what in math is composing a scalar function with a R^2 -> R function |
| 2020-10-03 07:26:52 | → | constR joins (uid58205@gateway/web/irccloud.com/x-euaithvjsiwmyvqd) |
| 2020-10-03 07:27:05 | <taurux> | ski, I think we're just scaring a haskell newcomer |
| 2020-10-03 07:27:10 | <p0a> | e.g. (a, b) -> a + b with doubling the result, so ((.) . (.)) (*2) (\(a, b) -> a + b) |
| 2020-10-03 07:27:23 | → | falafel joins (~falafel@cpe-104-172-194-249.socal.res.rr.com) |
| 2020-10-03 07:27:32 | <ski> | mapM_ (putStrLn . if optPathOnly opts then path else show) (Compose (queryStrings nonOptions <$> db)) |
| 2020-10-03 07:27:37 | <p0a> | taurux: it's cool I've witnessed horrors before, at least I have a math background |
| 2020-10-03 07:27:46 | <ski> | forM_ (Compose (queryStrings nonOptions <$> db)) (putStrLn . if optPathOnly opts then path else show) |
| 2020-10-03 07:28:04 | <p0a> | taurux: but I'm warry about using ski's suggestions because from my (small) experience, dummy-code is better than smarty-code |
| 2020-10-03 07:28:13 | <ski> | using `Data.Functor.Compose' |
| 2020-10-03 07:28:46 | <ski> | i'm not saying you should use any of my suggestions :) |
| 2020-10-03 07:29:00 | <p0a> | yeah I get it, you're "composing" right now :P |
| 2020-10-03 07:29:11 | <ski> | they're more meant as "hm, it is possible to express it like this" |
| 2020-10-03 07:29:26 | <taurux> | p0a, it's a matter of style. I like to use code like ski's (but without that `Compose's, they're too much ahah) because I find it elegant and concise |
| 2020-10-03 07:29:48 | → | heatsink joins (~heatsink@107-136-5-69.lightspeed.sntcca.sbcglobal.net) |
| 2020-10-03 07:29:48 | <ski> | it's a matter of balance, as well |
| 2020-10-03 07:30:14 | <taurux> | yes, you could write an entire program without using do-notation, but it would just be crazy |
| 2020-10-03 07:30:25 | <ski> | too much pointless code, and it becomes inscrutable |
| 2020-10-03 07:30:33 | × | shatriff_ quits (~vitaliish@188.163.30.117) (Remote host closed the connection) |
| 2020-10-03 07:30:55 | × | borne quits (~fritjof@200116b864ada80031152e74c90dd565.dip.versatel-1u1.de) (Ping timeout: 240 seconds) |
| 2020-10-03 07:31:23 | × | Sheilong quits (uid293653@gateway/web/irccloud.com/x-vlspjywaiiubsfqi) (Quit: Connection closed for inactivity) |
| 2020-10-03 07:32:35 | <ski> | i only started playing with this, since you were already pointlessing with `putStrLn . if ...' (and also, i admit, because `\db -> mapM_ (...) $ queryStrings nonOptions db' annoyed me, since it used `$', and seemed to name this `db' unnecessarily) |
| 2020-10-03 07:32:43 | <ski> | you could write |
| 2020-10-03 07:33:14 | × | constR quits (uid58205@gateway/web/irccloud.com/x-euaithvjsiwmyvqd) (Quit: Connection closed for inactivity) |
| 2020-10-03 07:33:29 | <p0a> | ski: I think what I would do to make my code look better is call the first maybeDb and the second would be `db' |
| 2020-10-03 07:34:03 | <ski> | forM_ db $ \db -> forM_ (queryStrings nonOptions db) $ \f -> putStrLn $ |
| 2020-10-03 07:34:05 | × | heatsink quits (~heatsink@107-136-5-69.lightspeed.sntcca.sbcglobal.net) (Ping timeout: 240 seconds) |
| 2020-10-03 07:34:12 | <ski> | if optPathOnly opts |
| 2020-10-03 07:34:16 | <ski> | then path f |
| 2020-10-03 07:34:21 | <ski> | else show f |
| 2020-10-03 07:34:32 | <tomsmeding> | p0a: good line numbers are hard though |
| 2020-10-03 07:34:54 | <ski> | (or you could put each `forM_' on a separate line, the second indented more than the first. these are basically nested loops, anyway) |
| 2020-10-03 07:35:08 | <ski> | forM_ maybeDb $ \db -> |
| 2020-10-03 07:35:13 | <ski> | forM_ (queryStrings nonOptions db) $ \f -> |
| 2020-10-03 07:35:16 | <tomsmeding> | someone opens it on mobile where the font sizes are borked and all is unaligned, or someone puts in a character that the standard font doesn't have and the sizes don't match up, or ... |
| 2020-10-03 07:35:31 | <ski> | putStrLn (if optPathOnly opts |
| 2020-10-03 07:35:42 | <ski> | then path f |
| 2020-10-03 07:35:47 | <ski> | else show f) |
| 2020-10-03 07:35:59 | <p0a> | tomsmeding: Okay fair enough. I figured out that might be the reason why you don't have that feature |
| 2020-10-03 07:36:21 | <ski> | p0a : i was thinking that before, yea. but i didn't want to mention it, while we were considering other things |
| 2020-10-03 07:36:47 | <p0a> | Right I think that forM_ approach is nice |
| 2020-10-03 07:37:03 | <p0a> | ski: how do you keep track of your files in your disk? |
| 2020-10-03 07:37:21 | <p0a> | ski: say if you want to find a pdf file but you dont' remember where you put it. Or does that not happen? |
| 2020-10-03 07:37:37 | <p0a> | (this is unrelated to haskell but it's that my program helps me with) |
| 2020-10-03 07:37:46 | <ski> | sometimes i remember the general area i might've put it in |
| 2020-10-03 07:37:48 | × | ericsagnes quits (~ericsagne@2405:6580:0:5100:f17c:daaf:122b:4823) (Ping timeout: 244 seconds) |
| 2020-10-03 07:38:07 | <ski> | sometimes i remember title or authors or so, enough so i can find it again on the net |
| 2020-10-03 07:38:09 | → | borne joins (~fritjof@200116b864ada80007933c164a08810c.dip.versatel-1u1.de) |
| 2020-10-03 07:38:21 | <p0a> | I feel like I'm managing my 6 disk backups, it's a mess |
| 2020-10-03 07:38:47 | <p0a> | I just want to rm -rf it all lol |
| 2020-10-03 07:39:13 | <taurux> | p0a, fdisk is more satisfying |
| 2020-10-03 07:39:16 | <p0a> | I'm trying to write a tool that lets me track my files and eventually I'd like to use it to back up properly (i.e. have all the files move in some proper hierarchy) |
| 2020-10-03 07:39:20 | <p0a> | ahahah taurux |
| 2020-10-03 07:39:33 | <taurux> | p0a, you could take a look at git-annex. It's written in Haskell! |
| 2020-10-03 07:39:48 | <taurux> | I use it to keep track of my enormous photo library |
| 2020-10-03 07:39:52 | → | heatsink joins (~heatsink@107-136-5-69.lightspeed.sntcca.sbcglobal.net) |
| 2020-10-03 07:40:00 | × | thir quits (~thir@p200300f27f0fc60004d129737887aa72.dip0.t-ipconnect.de) (Remote host closed the connection) |
| 2020-10-03 07:40:14 | → | alp joins (~alp@2a01:e0a:58b:4920:2485:658c:7835:aa11) |
| 2020-10-03 07:40:25 | <p0a> | "With git-annex, Bob has a single directory tree that includes all his files," |
| 2020-10-03 07:40:32 | <taurux> | it can sync between different devices and folders (and also S3 buckets!) and supports tags and revisions |
| 2020-10-03 07:40:43 | <p0a> | Yeah, Bob was careful. p0a wasn't |
| 2020-10-03 07:40:44 | → | jle` joins (~mstksg@cpe-23-240-75-236.socal.res.rr.com) |
| 2020-10-03 07:40:44 | × | jle` quits (~mstksg@cpe-23-240-75-236.socal.res.rr.com) (Changing host) |
| 2020-10-03 07:40:44 | → | jle` joins (~mstksg@unaffiliated/mstksg) |
| 2020-10-03 07:40:44 | × | zebrag quits (~inkbottle@aaubervilliers-654-1-82-122.w86-212.abo.wanadoo.fr) (Quit: Konversation terminated!) |
| 2020-10-03 07:40:48 | → | chaosmasttter joins (~chaosmast@p200300c4a711ea01f472f055cac452c2.dip0.t-ipconnect.de) |
| 2020-10-03 07:41:00 | → | thir joins (~thir@p200300f27f0fc60004d129737887aa72.dip0.t-ipconnect.de) |
| 2020-10-03 07:41:27 | <taurux> | p0a, ahaha I know how much managing files can be boring but it's necessary |
All times are in UTC.