Logs: freenode/#haskell
| 2020-10-03 05:41:04 | <dsal> | Yeah. |
| 2020-10-03 05:41:25 | ski | . o O ( (`-Wmissing-fields',`-Woverlapping-patterns',)`-Wincomplete-patterns',`-Wincomplete-uni-patterns' ) |
| 2020-10-03 05:41:54 | <dsal> | Same as in go and other languages. That's not the revolutionary benefit of haskell's type system. :) |
| 2020-10-03 05:42:09 | × | frdg quits (47b88ff9@pool-71-184-143-249.bstnma.fios.verizon.net) (Remote host closed the connection) |
| 2020-10-03 05:42:24 | <ski> | > let foo Node{} = () in foo Node{} -- not really fond of such patterns |
| 2020-10-03 05:42:26 | <lambdabot> | () |
| 2020-10-03 05:43:37 | × | snakemasterflex quits (~snakemast@213.100.206.23) (Ping timeout: 258 seconds) |
| 2020-10-03 05:43:38 | → | iqubic joins (~user@2601:602:9500:4870:8a40:95c2:967a:70b4) |
| 2020-10-03 05:45:04 | <p0a> | Why do I get this error? file-library-exe: ./library.database: openFile: does not exist (No such file or directory) |
| 2020-10-03 05:45:48 | <p0a> | https://paste.tomsmeding.com/Um3sNGUr |
| 2020-10-03 05:46:41 | <p0a> | (I know the code is long, but readDatabase and writeDatabase are relevant on Lib.hs |
| 2020-10-03 05:47:04 | <p0a> | tomsmeding: your paste would be nicer if it had line numbers :) I think |
| 2020-10-03 05:47:21 | <dsal> | Does the file exist? |
| 2020-10-03 05:47:29 | <p0a> | No it does not |
| 2020-10-03 05:47:33 | <p0a> | but I use readMaybe |
| 2020-10-03 05:47:52 | <dsal> | That's not what readMaybe does. heh |
| 2020-10-03 05:47:54 | <dsal> | :t readMaybe |
| 2020-10-03 05:47:56 | <lambdabot> | error: Variable not in scope: readMaybe |
| 2020-10-03 05:48:06 | <p0a> | oh wait |
| 2020-10-03 05:48:18 | <p0a> | huh I wonder what it is I used readMaybe for then |
| 2020-10-03 05:48:53 | <dsal> | You're trying to fmap readMaybe into an IO action that is failing. |
| 2020-10-03 05:49:04 | × | taurux quits (~taurux@net-188-152-1-196.cust.vodafonedsl.it) (Ping timeout: 246 seconds) |
| 2020-10-03 05:49:43 | <p0a> | okay I see now |
| 2020-10-03 05:49:54 | <p0a> | I remember what happened |
| 2020-10-03 05:50:04 | <p0a> | There were two issues, I fixed one, and I forgot about the other |
| 2020-10-03 05:50:04 | <p0a> | :) |
| 2020-10-03 05:50:12 | <p0a> | Thank yuo |
| 2020-10-03 05:50:48 | <p0a> | (This is my little project which I hope to improve, but right now trying to get version 0.01) |
| 2020-10-03 05:50:50 | → | taurux joins (~taurux@net-130-25-120-174.cust.vodafonedsl.it) |
| 2020-10-03 05:51:38 | → | polyrain joins (~polyrain@2001:8003:e501:6901:2cc5:6396:e3d8:6b4b) |
| 2020-10-03 05:51:56 | × | isovector1 quits (~isovector@172.103.216.166.cable.tpia.cipherkey.com) (Quit: Leaving) |
| 2020-10-03 05:52:20 | <p0a> | I wanted to move to RIO soon |
| 2020-10-03 05:52:36 | <p0a> | I guess for now I'll leave this bug unfixed and assume the database exists. I think I'd have to use exceptions otherwise |
| 2020-10-03 05:55:39 | → | wroathe joins (~wroathe@c-68-54-25-135.hsd1.mn.comcast.net) |
| 2020-10-03 05:56:12 | → | Sanchayan joins (~Sanchayan@106.200.213.229) |
| 2020-10-03 05:57:41 | × | polyrain quits (~polyrain@2001:8003:e501:6901:2cc5:6396:e3d8:6b4b) (Quit: My MacBook has gone to sleep. ZZZzzz…) |
| 2020-10-03 05:59:52 | → | falafel joins (~falafel@2605:e000:1527:d491:a806:37fa:6971:2798) |
| 2020-10-03 06:00:02 | × | skorgon quits (~skorgon@217.146.82.202) () |
| 2020-10-03 06:00:08 | × | wroathe quits (~wroathe@c-68-54-25-135.hsd1.mn.comcast.net) (Ping timeout: 256 seconds) |
| 2020-10-03 06:03:16 | → | alp joins (~alp@2a01:e0a:58b:4920:bc50:e5de:f1a9:a1da) |
| 2020-10-03 06:03:57 | → | thir joins (~thir@p200300f27f0fc60004d129737887aa72.dip0.t-ipconnect.de) |
| 2020-10-03 06:03:58 | hackage | arch-hs 0.2.0.0 - Distribute hackage packages to archlinux https://hackage.haskell.org/package/arch-hs-0.2.0.0 (berberman) |
| 2020-10-03 06:04:28 | → | snakemasterflex joins (~snakemast@213.100.206.23) |
| 2020-10-03 06:04:32 | × | jb55 quits (~jb55@gateway/tor-sasl/jb55) (Remote host closed the connection) |
| 2020-10-03 06:04:58 | → | jb55 joins (~jb55@gateway/tor-sasl/jb55) |
| 2020-10-03 06:05:25 | × | iqubic quits (~user@2601:602:9500:4870:8a40:95c2:967a:70b4) (Ping timeout: 240 seconds) |
| 2020-10-03 06:08:27 | × | thir quits (~thir@p200300f27f0fc60004d129737887aa72.dip0.t-ipconnect.de) (Ping timeout: 240 seconds) |
| 2020-10-03 06:13:03 | × | alp quits (~alp@2a01:e0a:58b:4920:bc50:e5de:f1a9:a1da) (Ping timeout: 272 seconds) |
| 2020-10-03 06:17:15 | × | mmohammadi98126 quits (~mmohammad@2.178.147.205) (Quit: I quit (╯°□°)╯︵ ┻━┻) |
| 2020-10-03 06:22:55 | → | coot joins (~coot@37.30.49.34.nat.umts.dynamic.t-mobile.pl) |
| 2020-10-03 06:25:05 | → | perdent1 joins (~blah@66.115.157.138) |
| 2020-10-03 06:26:17 | × | tzh quits (~tzh@2601:448:c500:5300::143b) (Quit: zzz) |
| 2020-10-03 06:26:49 | Guest40023 | is now known as lep-delete |
| 2020-10-03 06:26:59 | × | perdent quits (~blah@101.175.84.75) (Ping timeout: 256 seconds) |
| 2020-10-03 06:28:46 | × | heatsink quits (~heatsink@107-136-5-69.lightspeed.sntcca.sbcglobal.net) (Remote host closed the connection) |
| 2020-10-03 06:28:55 | × | jle` quits (~mstksg@unaffiliated/mstksg) (Ping timeout: 240 seconds) |
| 2020-10-03 06:29:17 | <p0a> | if I have a Maybe (IO ()) how am I supposed to act on it? |
| 2020-10-03 06:29:43 | <p0a> | What's the idiomatic way? Sorry, I meant Maybe (IO T) |
| 2020-10-03 06:30:16 | <ski> | `sequence'/`sequenceA' ? |
| 2020-10-03 06:31:24 | → | thir joins (~thir@p200300f27f0fc60004d129737887aa72.dip0.t-ipconnect.de) |
| 2020-10-03 06:31:49 | × | thir quits (~thir@p200300f27f0fc60004d129737887aa72.dip0.t-ipconnect.de) (Read error: Connection reset by peer) |
| 2020-10-03 06:31:57 | <p0a> | so say I have a file I read. It's a Maybe (IO Database) and I'd like to print the entries of the database |
| 2020-10-03 06:31:59 | → | thir joins (~thir@p200300f27f0fc60004d129737887aa72.dip0.t-ipconnect.de) |
| 2020-10-03 06:32:12 | × | Sanchayan quits (~Sanchayan@106.200.213.229) (Quit: leaving) |
| 2020-10-03 06:32:34 | <p0a> | if I had a database I'd just do map putStrLn (contents db) |
| 2020-10-03 06:32:58 | <p0a> | sorry, I meant mapM_ |
| 2020-10-03 06:33:08 | <c_wraith> | It's vastly unlikely something that interacts with the filesystem is going to produce Maybe (IO Database) |
| 2020-10-03 06:33:19 | <p0a> | Is it a mistake c_wraith ? |
| 2020-10-03 06:33:33 | <p0a> | That's how I wrote it. I have a readDatabase that returns a Maybe (IO Database) |
| 2020-10-03 06:33:35 | <c_wraith> | IO (Maybe Database) would make much more sense. |
| 2020-10-03 06:33:48 | <p0a> | Yes, that's what it is, sorry |
| 2020-10-03 06:34:54 | <ski> | that's quite different |
| 2020-10-03 06:35:38 | <ski> | what should happen, if you get `Nothing' ? |
| 2020-10-03 06:35:41 | → | jle` joins (~mstksg@cpe-23-240-75-236.socal.res.rr.com) |
| 2020-10-03 06:35:41 | × | jle` quits (~mstksg@cpe-23-240-75-236.socal.res.rr.com) (Changing host) |
| 2020-10-03 06:35:41 | → | jle` joins (~mstksg@unaffiliated/mstksg) |
| 2020-10-03 06:35:44 | <p0a> | Right |
| 2020-10-03 06:36:32 | <p0a> | I see it's a problem with types. So is there an idiomatic way or do I need to do a conditional? |
| 2020-10-03 06:36:33 | <taurux> | p0a: you can use my_io_maybe_db >>= (maybe what_to_do_when_nothing (\db -> what_to_do_when_db)) |
| 2020-10-03 06:36:57 | × | nineonine quits (~nineonine@216-19-190-182.dyn.novuscom.net) (Read error: Connection reset by peer) |
| 2020-10-03 06:37:35 | → | nineonine joins (~nineonine@216-19-190-182.dyn.novuscom.net) |
| 2020-10-03 06:37:40 | <p0a> | What does -> do? |
| 2020-10-03 06:37:43 | <p0a> | oh it's a lambda |
| 2020-10-03 06:37:46 | <taurux> | it's a lambda |
| 2020-10-03 06:38:09 | <taurux> | what_to_do_when_nothing :: IO something |
| 2020-10-03 06:38:10 | <c_wraith> | p0a: it's not a "problem" with types. It's just types. At most there's a puzzle involved. bind the value so you can use it in an IO block, then deal with the Maybe appropriately |
| 2020-10-03 06:38:12 | <ski> | do you want to catch the failure, and do something else, here ? |
| 2020-10-03 06:38:18 | <ski> | or just propagate the failure ? |
| 2020-10-03 06:38:26 | <p0a> | propagate the failure |
| 2020-10-03 06:38:35 | <taurux> | You should use a Monad transformer |
| 2020-10-03 06:38:36 | <taurux> | MaybeT |
| 2020-10-03 06:38:37 | <p0a> | so that I never deal with it, I'm at top level :P |
| 2020-10-03 06:38:38 | <ski> | use `MaybeT IO', possibly |
| 2020-10-03 06:38:43 | → | heatsink joins (~heatsink@107-136-5-69.lightspeed.sntcca.sbcglobal.net) |
| 2020-10-03 06:39:09 | <ski> | it will short-circuit, if something fails (with `Nothing') |
| 2020-10-03 06:39:24 | <taurux> | monad transformers make semantics of failure propagation much more clear. Take a look at the dedicate chapter in LYAH |
| 2020-10-03 06:39:28 | <taurux> | *dedicated |
| 2020-10-03 06:40:26 | <p0a> | for one thing I realized it's just Maybe Database because I do bind it in a do block |
| 2020-10-03 06:40:32 | <p0a> | I'm just confused as usual |
| 2020-10-03 06:41:47 | <p0a> | ah I know the issue, I actually have a Maybe [String] that I wish to print |
All times are in UTC.