Home freenode/#haskell: Logs Calendar

Logs: freenode/#haskell

←Prev  Next→ 502,152 events total
2021-03-25 11:23:53 <shad0w_> but what is `m a`?
2021-03-25 11:24:00 × romesrf quits (~romesrf@44.190.189.46.rev.vodafone.pt) (Quit: WeeChat 3.1)
2021-03-25 11:24:28 <[exa]> in our previous example with `Either Int String`, `Left 42` is `m a` for `m ~ Either Int` and `a ~ String`
2021-03-25 11:24:38 × heatsink quits (~heatsink@2600:1700:bef1:5e10:10c4:3f41:be04:1f78) (Ping timeout: 264 seconds)
2021-03-25 11:25:00 <shad0w_> i see
2021-03-25 11:25:03 <[exa]> supposing `Left 42` would result from `throwError 42`
2021-03-25 11:25:05 <shad0w_> that helped.
2021-03-25 11:25:59 <[exa]> not sure if the Either instance is there actually, Either is a bit problematic for other reasons
2021-03-25 11:26:04 <[exa]> but it serves nicely as the example
2021-03-25 11:26:11 <shad0w_> yea
2021-03-25 11:26:23 × jacks2 quits (~bc8134e3@217.29.117.252) (Quit: http://www.okay.uz/ (Session timeout))
2021-03-25 11:26:25 <shad0w_> im just trying to grasp the mental model for this thing first
2021-03-25 11:27:03 <[exa]> notably, with IO, you can't technically represent the "result" of the error being thrown, IOErrors may kill the program or cause interrupts etc
2021-03-25 11:27:19 <[exa]> so the `m a` might actually not be there at all
2021-03-25 11:27:35 <shad0w_> i've just started mentally isolated IO anything anyway
2021-03-25 11:27:45 <shad0w_> like whatever i understand, IO would probably break it.
2021-03-25 11:27:52 Alleria joins (~textual@zrcout.mskcc.org)
2021-03-25 11:27:53 <[exa]> yeah
2021-03-25 11:28:13 <[exa]> not sure if there's IO instance either, my knowledge of the library is not very precise
2021-03-25 11:28:16 Alleria is now known as Guest15726
2021-03-25 11:28:21 romesrf joins (~romesrf@44.190.189.46.rev.vodafone.pt)
2021-03-25 11:28:24 <shad0w_> that's not an issue.
2021-03-25 11:28:33 <shad0w_> thanks for the help with this : )
2021-03-25 11:28:36 <[exa]> just saying before someone corrects me. :D
2021-03-25 11:29:02 <shad0w_> are you sitting now ?
2021-03-25 11:29:16 <shad0w_> cause then you'd have to.. stand.. corrected : P
2021-03-25 11:29:22 malumore joins (~malumore@151.62.125.69)
2021-03-25 11:29:22 <shad0w_> *ba dum tuss*
2021-03-25 11:29:33 [exa] gratefully accepts the joke
2021-03-25 11:29:41 <[exa]> anyway, looking at the instances
2021-03-25 11:30:03 __minoru__shirae joins (~shiraeesh@46.34.207.1)
2021-03-25 11:31:21 <[exa]> you can see there's `MonadError () Maybe` bc you can re-make the () for `catch` from nothing, and `MonadError IOException IO` which iirc has no actual tangible representation of what gets out of the `throwError` (there's IO magicks instead)
2021-03-25 11:31:54 <[exa]> also `MonadError e (Either e)` matches the previous example, just says that the monad can carry and shortcircuit with an Int
2021-03-25 11:32:10 <[exa]> (rewrite: short-circuit while carrying an Int)
2021-03-25 11:32:40 <shad0w_> all of that went above my head : p
2021-03-25 11:32:59 <shad0w_> but i can see it flying off tho. so it's not that far
2021-03-25 11:33:12 <[exa]> look at & try the instances
2021-03-25 11:33:13 × is_null_ quits (~jpic@pdpc/supporter/professional/is-null) (Read error: Connection reset by peer)
2021-03-25 11:33:18 <shad0w_> i'd do that.
2021-03-25 11:33:18 <[exa]> that's always the way :D
2021-03-25 11:33:26 Kaiepi joins (~Kaiepi@47.54.252.148)
2021-03-25 11:34:21 tlgl^nix is now known as tlgl^code
2021-03-25 11:34:28 tlgl^code has gone away to hack at some code
2021-03-25 11:34:35 is_null joins (~jpic@pdpc/supporter/professional/is-null)
2021-03-25 11:34:52 tlgl^code is now known as tlgl^nix
2021-03-25 11:35:00 tlgl^nix has returned from breaking programs
2021-03-25 11:35:14 <[exa]> shad0w_: you might wanna see the distinction between MonadThrow and MonadCatch, that's much better in fact
2021-03-25 11:35:33 <[exa]> MonadError is a bit frowned upon too, sometimes
2021-03-25 11:36:45 <[exa]> shad0w_: there, MonadThrow can start the short-circuiting somewhere, with an error `e`, and MonadCatch can additionally bracket the shortcircuited part of the computation, retrieve the `e` and continue with the computation
2021-03-25 11:37:06 × __minoru__shirae quits (~shiraeesh@46.34.207.1) (Quit: Konversation terminated!)
2021-03-25 11:37:29 __minoru__shirae joins (~shiraeesh@46.34.207.1)
2021-03-25 11:38:02 <[exa]> and the instances make much better sense there as well, you can see that MonadThrow is there for [] and Maybe, but there's on point in MonadCatch instances for these.
2021-03-25 11:38:05 × borne quits (~fritjof@2001:638:708:30da:d8ae:9747:a2cd:6345) (Ping timeout: 268 seconds)
2021-03-25 11:38:15 <shad0w_> so i read the doc on MonadThrow and that made much more sense now
2021-03-25 11:38:36 <shad0w_> the monad m is now in the class of types that can now throw errors with throwM
2021-03-25 11:38:55 <shad0w_> that that is thrown, when the monad m is run.
2021-03-25 11:39:00 <shad0w_> does that make sense ?
2021-03-25 11:39:00 × emmanuel_erc quits (~user@2603-7000-9600-01c9-0000-0000-0000-0874.res6.spectrum.com) (Read error: Connection reset by peer)
2021-03-25 11:39:18 emmanuel_erc joins (~user@2603-7000-9600-01c9-0000-0000-0000-0874.res6.spectrum.com)
2021-03-25 11:39:25 <[exa]> yeah
2021-03-25 11:39:50 <shad0w_> and how does monad m know what errors can it throw ?
2021-03-25 11:39:53 <[exa]> notice that there's no MPTCs anymore, the `e` is computed from `m` directly using type families
2021-03-25 11:39:56 <shad0w_> is there another typeclass for that ?
2021-03-25 11:40:01 <[exa]> that was previously encoded in the functional dependency
2021-03-25 11:40:35 <shad0w_> ah i see. no more MPTCs
2021-03-25 11:40:40 <[exa]> (there's some code that says, very roughly, `type instance ExceptionOf (Either Int) = Int`)
2021-03-25 11:40:45 × smerdyakov quits (~dan@5.146.195.159) (Ping timeout: 264 seconds)
2021-03-25 11:41:15 ddellacosta joins (~ddellacos@86.106.143.10)
2021-03-25 11:41:29 <shad0w_> do MPTc's and typefamilies kind of sort of achieve the same things ?
2021-03-25 11:41:58 <[exa]> ah ok taking that back, seems like there's not even the type family
2021-03-25 11:42:04 bahamas joins (~lucian@unaffiliated/bahamas)
2021-03-25 11:42:06 joncol joins (~jco@c188-150-101-195.bredband.comhem.se)
2021-03-25 11:42:28 <[exa]> ah yeah, they can be used to very similar goals, both are basically functions on types, only MPTCs are a bit more prolog-ish
2021-03-25 11:42:47 <joncol> Does Cabal build optimized binaries by default? Or do I have explicitly configure something to get a "release" build?
2021-03-25 11:42:48 <shad0w_> i read the mark p jones paper on them the other day
2021-03-25 11:42:57 <[exa]> no need
2021-03-25 11:42:59 <shad0w_> still confused x.x
2021-03-25 11:43:01 × merijn quits (~merijn@83-160-49-249.ip.xs4all.nl) (Ping timeout: 268 seconds)
2021-03-25 11:43:03 <[exa]> read "Typing the technical interview"
2021-03-25 11:43:09 × is_null quits (~jpic@pdpc/supporter/professional/is-null) (Ping timeout: 264 seconds)
2021-03-25 11:43:11 smerdyakov joins (~dan@5.146.195.159)
2021-03-25 11:43:15 <[exa]> that's the best MPTC programming tutorial ever
2021-03-25 11:43:45 <shad0w_> https://aphyr.com/posts/342-typing-the-technical-interview
2021-03-25 11:43:46 <shad0w_> this ?
2021-03-25 11:43:48 <[exa]> yes
2021-03-25 11:43:52 <dcoutts_> joncol: yes, -O1 is the default, you can change it with -O0 or -O2.
2021-03-25 11:43:54 merijn joins (~merijn@83-160-49-249.ip.xs4all.nl)
2021-03-25 11:44:23 <shad0w_> alright. alexa. add it to the priority read list.
2021-03-25 11:44:29 <joncol> dcoutts_: Thanks.
2021-03-25 11:44:41 <shad0w_> *beep beep* no Read instance found on list
2021-03-25 11:45:15 <[exa]> shad0w_: it's a 3 minute read, I guess it's probably better not to delay it.
2021-03-25 11:45:38 × xff0x quits (~xff0x@2001:1a81:53ea:3700:f4c9:a54a:b343:45e2) (Ping timeout: 264 seconds)
2021-03-25 11:45:43 <shad0w_> fine.
2021-03-25 11:45:43 × emmanuel_erc quits (~user@2603-7000-9600-01c9-0000-0000-0000-0874.res6.spectrum.com) (Read error: Connection reset by peer)
2021-03-25 11:45:49 <shad0w_> alexa, make my tea.
2021-03-25 11:45:53 emmanuel_erc joins (~user@2603-7000-9600-01c9-0000-0000-0000-0874.res6.spectrum.com)
2021-03-25 11:46:05 xff0x joins (~xff0x@2001:1a81:53ea:3700:7b09:c6ef:9691:2f13)
2021-03-25 11:46:08 × ddellacosta quits (~ddellacos@86.106.143.10) (Ping timeout: 256 seconds)
2021-03-25 11:46:13 [exa] offers a broken unicode tea emoji
2021-03-25 11:46:47 <peanut_> 🍵

All times are in UTC.