Home freenode/#haskell: Logs Calendar

Logs on 2020-12-16 (freenode/#haskell)

00:01:17 × wonko7 quits (~wonko7@2a01:e35:2ffb:7040:4535:f480:7dff:b3b5) (Ping timeout: 260 seconds)
00:01:44 × softwarm quits (4408f588@ip68-8-245-136.sd.sd.cox.net) (Ping timeout: 245 seconds)
00:01:48 × monadmatt quits (~user@119-17-128-101.771180.mel.nbn.aussiebb.net) (Client Quit)
00:02:13 × christo quits (~chris@81.96.113.213) (Remote host closed the connection)
00:03:13 × hiroaki quits (~hiroaki@ip4d16fa3b.dynamic.kabel-deutschland.de) (Ping timeout: 264 seconds)
00:04:04 nineonin_ joins (~nineonine@50.216.62.2)
00:04:04 × nineonine quits (~nineonine@50.216.62.2) (Remote host closed the connection)
00:06:04 christo joins (~chris@81.96.113.213)
00:07:54 tomku joins (~tomku@unaffiliated/tomku)
00:08:28 sgibber2018 joins (~arch-gibb@208.85.237.137)
00:08:49 codygman joins (~codygman@47-184-107-46.dlls.tx.frontiernet.net)
00:08:49 × gehmehgeh quits (~ircuser1@gateway/tor-sasl/gehmehgeh) (Quit: Leaving)
00:10:33 × matryoshka quits (~matryoshk@2606:6080:1002:8:3285:30e:de43:8809) (Ping timeout: 258 seconds)
00:11:12 × raehik quits (~raehik@cpc95906-rdng25-2-0-cust156.15-3.cable.virginm.net) (Ping timeout: 265 seconds)
00:12:17 cads joins (~cads@ip-64-72-99-232.lasvegas.net)
00:13:40 × fresheyeball quits (~isaac@ec2-35-155-97-88.us-west-2.compute.amazonaws.com) (Ping timeout: 272 seconds)
00:14:57 fresheyeball joins (~isaac@c-71-237-105-37.hsd1.co.comcast.net)
00:15:32 hiroaki joins (~hiroaki@ip4d168e73.dynamic.kabel-deutschland.de)
00:16:18 matryoshka joins (~matryoshk@184.75.223.227)
00:17:08 waddlepon joins (~waddlepon@173-8-188-69-SFBA.hfc.comcastbusiness.net)
00:19:20 mimi_vx joins (~mimi@2a01:490:16:1026:d961:6e73:8fa:323d)
00:21:07 × Gurkenglas quits (~Gurkengla@unaffiliated/gurkenglas) (Ping timeout: 260 seconds)
00:26:58 × solonarv quits (~solonarv@astrasbourg-157-1-27-135.w90-40.abo.wanadoo.fr) (Ping timeout: 256 seconds)
00:27:10 × fuzzypixelz quits (~fuzzypixe@eth-west-pareq2-46-193-4-100.wb.wifirst.net) (Quit: fuzzypixelz)
00:29:02 hexfive joins (~hexfive@50-47-142-195.evrt.wa.frontiernet.net)
00:31:44 merijn joins (~merijn@83-160-49-249.ip.xs4all.nl)
00:37:10 × merijn quits (~merijn@83-160-49-249.ip.xs4all.nl) (Ping timeout: 256 seconds)
00:38:34 da39a3ee5e6b4b0d joins (~da39a3ee5@2403:6200:8876:cecf:a55b:90cf:1ae1:4d7b)
00:43:50 × SomeoneSerge quits (~someone-s@89.187.168.57) (Ping timeout: 264 seconds)
00:49:42 × mputz quits (~Thunderbi@dslb-088-064-063-125.088.064.pools.vodafone-ip.de) (Ping timeout: 260 seconds)
00:50:17 isovector1 joins (~isovector@172.103.216.166.cable.tpia.cipherkey.com)
00:50:31 <isovector1> is there a newtype anywhere that i can derive via to get an applicative num instance?
00:51:06 <isovector1> Data.Monoid.Ap!
00:52:04 <ezzieyguywuf> "Force dependency on ghc-lib-parser even if GHC API in the ghc package is supported" what is the "GHC API", how can I check if my ghc has it?
00:52:49 × hiroaki quits (~hiroaki@ip4d168e73.dynamic.kabel-deutschland.de) (Ping timeout: 272 seconds)
00:53:12 × christo quits (~chris@81.96.113.213) (Remote host closed the connection)
00:53:47 merijn joins (~merijn@83-160-49-249.ip.xs4all.nl)
00:55:03 × jules000 quits (~jules000@217-62-97-211.cable.dynamic.v4.ziggo.nl) (Remote host closed the connection)
00:57:04 jules000_ joins (~jules000@217-62-97-211.cable.dynamic.v4.ziggo.nl)
00:58:04 christo joins (~chris@81.96.113.213)
00:59:00 melosense joins (~melosense@4e69b241.skybroadband.com)
01:00:33 wnbehsklr joins (~wnbehsklr@97.119.189.29)
01:02:16 × christo quits (~chris@81.96.113.213) (Ping timeout: 240 seconds)
01:03:38 × theorbtwo quits (~theorb@cpc81822-swin19-2-0-cust3.3-1.cable.virginm.net) (Remote host closed the connection)
01:03:54 theorbtwo joins (~theorb@cpc81822-swin19-2-0-cust3.3-1.cable.virginm.net)
01:05:06 × waddlepon quits (~waddlepon@173-8-188-69-SFBA.hfc.comcastbusiness.net) (Ping timeout: 256 seconds)
01:05:13 hiroaki joins (~hiroaki@ip4d16fa3b.dynamic.kabel-deutschland.de)
01:05:26 CMCDragonkai2 joins (~Thunderbi@110.175.213.142)
01:07:29 olligobber joins (~olligobbe@unaffiliated/olligobber)
01:09:55 × Tuplanolla quits (~Tuplanoll@91-159-68-239.elisa-laajakaista.fi) (Quit: Leaving.)
01:19:10 × olligobber quits (~olligobbe@unaffiliated/olligobber) (Ping timeout: 246 seconds)
01:21:26 × Entertainment quits (~entertain@104.246.132.210) ()
01:24:30 × jules000_ quits (~jules000@217-62-97-211.cable.dynamic.v4.ziggo.nl) (Remote host closed the connection)
01:26:44 jules000 joins (~jules000@217-62-97-211.cable.dynamic.v4.ziggo.nl)
01:27:12 × cads quits (~cads@ip-64-72-99-232.lasvegas.net) (Ping timeout: 268 seconds)
01:29:25 <hseg> is it possible to use type families to drop a parameter from a function?
01:30:17 × merijn quits (~merijn@83-160-49-249.ip.xs4all.nl) (Ping timeout: 268 seconds)
01:30:42 <hseg> i.e. have type family V t, type instance V S = (), f :: V t -> t -> ..., want to be able to not pass the trivial V S parameter when monomorphised
01:31:26 <hseg> this *is* possible if f is uncurried: type family FParam t, type instance FParam S = S, type instance FParam t = (V t, t)
01:32:01 × jules000 quits (~jules000@217-62-97-211.cable.dynamic.v4.ziggo.nl) (Ping timeout: 264 seconds)
01:32:03 olligobber joins (~olligobbe@unaffiliated/olligobber)
01:32:52 × columbarius quits (~columbari@i5E86B311.versanet.de) (Ping timeout: 256 seconds)
01:34:54 columbarius joins (~columbari@mue-88-130-54-048.dsl.tropolys.de)
01:35:08 × SupaYoshi quits (~supayoshi@213-10-140-13.fixed.kpn.net) (Ping timeout: 256 seconds)
01:37:22 <hseg> nm, was a stupid bit of hammer-induced tunnel vision
01:37:48 <koz_> hseg: I dread to imagine how one induces tunnel vision with a _hammer_.
01:38:24 <hseg> :)
01:38:59 <hseg> well, the resulting pinprick vision made everything appear like a nail, so...
01:39:53 SupaYoshi joins (~supayoshi@213-10-140-13.fixed.kpn.net)
01:39:59 <koz_> Ah, so you meant 'hammer-induced' as in 'caused by _having_ a hammer', as opposed to 'caused by _use_ of a hammer'.
01:40:58 <hseg> oops. yes
01:41:09 <hseg> any pithy way of expressing that?
01:41:13 × troydm quits (~troydm@unaffiliated/troydm) (Ping timeout: 246 seconds)
01:41:16 <koz_> It's OK, English isn't case-marked.
01:41:16 Noldorin joins (~noldorin@unaffiliated/noldorin)
01:41:31 <koz_> (for once, I think I see the appeal of languages with like, over four grammatical cases)
01:41:39 <koz_> (since they make this kind of confusion impossible)
01:42:20 <hseg> yeah. though i wonder how you'd mark it? instrumental vs accusative?
01:42:42 troydm joins (~troydm@unaffiliated/troydm)
01:42:49 × m0rphism quits (~m0rphism@HSI-KBW-085-216-104-059.hsi.kabelbw.de) (Ping timeout: 264 seconds)
01:44:30 <ezzieyguywuf> 😍 wow the same guy that made hlint made ghcid
01:44:37 <ezzieyguywuf> or, at least is listed as the maintainer on hackage
01:44:45 <koz_> hseg: Depends on what cases you have available, but yes?
01:45:01 <koz_> There are some languages which make even finer distinctions, but instrumental case is needed here.
01:45:09 <koz_> ezzieyguywuf: Yes, Neil is a hero.
01:45:24 <ezzieyguywuf> oh yea! and hoogle!
01:45:44 <ezzieyguywuf> is he around here? I want to know why the test directory isn't packaged in the release tarballs
01:45:53 <ezzieyguywuf> I'm packaging hlint for gentoo but can't run tests :(
01:46:19 × CMCDragonkai2 quits (~Thunderbi@110.175.213.142) (Ping timeout: 268 seconds)
01:46:22 <koz_> ezzieyguywuf: You should just leave an issue on the Github for hlint.
01:46:57 royal_screwup21 joins (52254809@gateway/web/cgi-irc/kiwiirc.com/ip.82.37.72.9)
01:48:10 <ezzieyguywuf> koz_: seems like we have a workaround in our packaging system, i.e. just pull from git
01:48:21 <ezzieyguywuf> I dunno if it's really an issue, probably a personal choice
01:48:29 <ezzieyguywuf> "why would you need the test suite after release?!"
01:48:33 <sm[m]> ezzieyguywuf: and shake!
01:48:38 <koz_> ezzieyguywuf: I'd say if you can't run tests from the tarball, they're not very useful tests.
01:48:43 <sm[m]> and cmdargs!
01:48:45 <koz_> (or very useful tarballs, one or the other)
01:48:49 <koz_> sm[m]: And extra. :P
01:48:57 <ezzieyguywuf> sm[m]: !!!!!
01:49:08 <sm[m]> that guy is pretty great 👍🏻
01:49:08 <ezzieyguywuf> never heard of shake
01:49:10 <ezzieyguywuf> yes cmdargs
01:49:22 <ezzieyguywuf> I'll leave an issue, but I'm sort of nervous...lol
01:49:28 <koz_> ezzieyguywuf: Why?
01:49:33 <koz_> Neil's usually great at responding.
01:49:39 <ezzieyguywuf> hah I shouldn't be, I already posted a silly issue a few days ago
01:49:41 <koz_> (I've left a few issues, and they got resolved pretty fast)
01:49:52 <ezzieyguywuf> which is clearly answered in the readme. https://github.com/ndmitchell/hlint/issues/1184
01:50:09 × livvy quits (~livvy@gateway/tor-sasl/livvy) (Remote host closed the connection)
01:50:26 Lord_of_Life_ joins (~Lord@unaffiliated/lord-of-life/x-0885362)
01:50:38 × Lord_of_Life quits (~Lord@unaffiliated/lord-of-life/x-0885362) (Ping timeout: 260 seconds)
01:51:22 × royal_screwup21 quits (52254809@gateway/web/cgi-irc/kiwiirc.com/ip.82.37.72.9) (Ping timeout: 246 seconds)
01:51:46 Lord_of_Life_ is now known as Lord_of_Life
01:52:25 uraniumz parts (x64cmd@gateway/vpn/privateinternetaccess/x64cmd) ("Leaving")
01:55:32 jules000 joins (~jules000@217-62-97-211.cable.dynamic.v4.ziggo.nl)
01:56:02 _deepfire joins (~user@80.92.100.69)
01:57:43 sh9 joins (~sh9@softbank060116136158.bbtec.net)
02:00:04 × jules000 quits (~jules000@217-62-97-211.cable.dynamic.v4.ziggo.nl) (Ping timeout: 256 seconds)
02:00:36 merijn joins (~merijn@83-160-49-249.ip.xs4all.nl)
02:02:06 × dycan quits (~dycan@101-137-14-30.mobile.dynamic.aptg.com.tw) (Quit: dycan)
02:05:48 × merijn quits (~merijn@83-160-49-249.ip.xs4all.nl) (Ping timeout: 260 seconds)
02:05:57 guest1214 joins (~user@49.5.6.87)
02:06:15 SupaYoshii joins (~supayoshi@213-10-140-13.fixed.kpn.net)
02:06:25 × SupaYoshi quits (~supayoshi@213-10-140-13.fixed.kpn.net) (Ping timeout: 246 seconds)
02:07:56 × Varis quits (~Tadas@unaffiliated/varis) (Remote host closed the connection)
02:08:07 × ClaudiusMaximus quits (~claude@unaffiliated/claudiusmaximus) (Read error: Connection reset by peer)
02:10:09 × jb55 quits (~jb55@gateway/tor-sasl/jb55) (Remote host closed the connection)
02:10:32 Varis joins (~Tadas@unaffiliated/varis)
02:11:21 × xff0x quits (~fox@2001:1a81:52fd:2900:1e98:288b:c3f1:f349) (Ping timeout: 272 seconds)
02:12:33 xff0x joins (~fox@2001:1a81:5229:f800:6dc9:367b:8c00:da75)
02:13:09 jules000 joins (~jules000@217-62-97-211.cable.dynamic.v4.ziggo.nl)
02:17:36 christo joins (~chris@81.96.113.213)
02:18:22 × jules000 quits (~jules000@217-62-97-211.cable.dynamic.v4.ziggo.nl) (Ping timeout: 260 seconds)
02:18:56 wroathe joins (~wroathe@c-68-54-25-135.hsd1.mn.comcast.net)
02:19:59 toorevitimirp joins (~tooreviti@117.182.180.221)
02:20:35 Mikagami joins (~MOSCOS@152.32.70.55)
02:23:28 royal_screwup21 joins (52254809@gateway/web/cgi-irc/kiwiirc.com/ip.82.37.72.9)
02:23:52 × MOSCOS quits (~MOSCOS@122.54.107.175) (Ping timeout: 256 seconds)
02:24:27 jules000 joins (~jules000@217-62-97-211.cable.dynamic.v4.ziggo.nl)
02:24:58 MOSCOS joins (~MOSCOS@122.54.107.175)
02:25:13 × xsperry quits (~as@unaffiliated/xsperry) (Remote host closed the connection)
02:25:47 × Mikagami quits (~MOSCOS@152.32.70.55) (Ping timeout: 268 seconds)
02:26:02 × toorevitimirp quits (~tooreviti@117.182.180.221) (Remote host closed the connection)
02:26:15 nbloomf joins (~nbloomf@2600:1700:ad14:3020:c8fd:7d2a:dff7:52e8)
02:26:27 toorevitimirp joins (~tooreviti@117.182.180.221)
02:27:25 × jespada quits (~jespada@90.254.245.49) (Ping timeout: 240 seconds)
02:27:38 × olligobber quits (~olligobbe@unaffiliated/olligobber) (Ping timeout: 268 seconds)
02:29:22 p0a joins (~user@unaffiliated/p0a)
02:29:29 × jules000 quits (~jules000@217-62-97-211.cable.dynamic.v4.ziggo.nl) (Ping timeout: 268 seconds)
02:29:40 × Deide quits (~Deide@217.155.19.23) (Quit: Seeee yaaaa)
02:29:49 jespada joins (~jespada@90.254.245.49)
02:30:21 <p0a> Can I please receive some tips for this code? https://paste.tomsmeding.com/c3Ohgvuf
02:30:48 <p0a> In particular 'createStuff'. It's awkward to use fmap, guard and >> in this manner
02:31:47 monadmatt joins (~user@119-17-128-101.771180.mel.nbn.aussiebb.net)
02:34:31 Deide joins (~Deide@217.155.19.23)
02:36:46 guest1214 is now known as guest1216
02:39:21 × psamim quits (samimpmatr@gateway/shell/matrix.org/x-tnbwcntwhxafximz) (Ping timeout: 268 seconds)
02:39:21 × berberman[T] quits (berberma4@gateway/shell/matrix.org/x-djribkbyuvfvpxal) (Ping timeout: 268 seconds)
02:39:21 × jeffcasavant[m] quits (jeffcasava@gateway/shell/matrix.org/x-cmekccjvauwyyqfu) (Ping timeout: 268 seconds)
02:39:21 × kadoban quits (kadobanmat@gateway/shell/matrix.org/x-kvlzxytjycizhbef) (Ping timeout: 268 seconds)
02:39:21 × aloiscochard[m] quits (aloiscocha@gateway/shell/matrix.org/x-jabkszfxgnkdhvro) (Ping timeout: 268 seconds)
02:39:21 × michaelpj quits (michaelpjm@gateway/shell/matrix.org/x-xwhhblcpkqxivscq) (Ping timeout: 268 seconds)
02:39:45 merijn joins (~merijn@83-160-49-249.ip.xs4all.nl)
02:40:00 aloiscochard[m] joins (aloiscocha@gateway/shell/matrix.org/x-oybvygklfcvredwt)
02:40:18 jeffcasavant[m] joins (jeffcasava@gateway/shell/matrix.org/x-nikrypbvxnsoxboc)
02:40:45 berberman[T] joins (berberma4@gateway/shell/matrix.org/x-hsuypygvacyqzwmq)
02:40:47 olligobber joins (~olligobbe@unaffiliated/olligobber)
02:40:47 × MOSCOS quits (~MOSCOS@122.54.107.175) (Remote host closed the connection)
02:41:11 MOSCOS joins (~MOSCOS@122.54.107.175)
02:42:31 michaelpj joins (michaelpjm@gateway/shell/matrix.org/x-mfdqiskmtojjlmpd)
02:42:58 kadoban joins (kadobanmat@gateway/shell/matrix.org/x-rcjrqnbtkevnhgtr)
02:43:07 psamim joins (samimpmatr@gateway/shell/matrix.org/x-vsfkhpcmdjixlzby)
02:44:32 shatriff_ joins (~vitaliish@176-52-216-242.irishtelecom.com)
02:44:37 <dsal> p0a: there's a lot you can do here.
02:44:42 <dsal> Let's see if I can make that compile.
02:45:31 <dsal> Eh, maybe not, but a few things:
02:45:36 cads joins (~cads@ip-64-72-99-232.lasvegas.net)
02:46:22 × shatriff quits (~vitaliish@176-52-216-242.irishtelecom.com) (Ping timeout: 260 seconds)
02:47:04 <dsal> p0a: I'd start by realizing it can be easier to use. https://www.irccloud.com/pastebin/RxuTND9L/f.hs
02:47:56 <dsal> Or something like this (I can't compile this because I'm missing a piece, so just guessing) https://www.irccloud.com/pastebin/KfZMf1Tg/traverse.hs
02:48:30 jules000 joins (~jules000@217-62-97-211.cable.dynamic.v4.ziggo.nl)
02:48:51 × jules000 quits (~jules000@217-62-97-211.cable.dynamic.v4.ziggo.nl) (Remote host closed the connection)
02:50:27 <dsal> p0a: does this work? https://www.irccloud.com/pastebin/GCB7AnJv/rbind.hs
02:51:30 <dsal> Regarding that fmap guard thing, I think it'd be clearer to express by enclosing the pointer in a Maybe type such that nullPtr is Nothing and then you could just use fmap to create the dealloc wrapper. It'd be a lot easier to read and understand.
02:52:03 × teardown quits (~user@gateway/tor-sasl/mrush) (Ping timeout: 240 seconds)
02:52:27 × vicfred quits (~vicfred@unaffiliated/vicfred) (Quit: Leaving)
02:53:02 <p0a> all the pieces are here: https://paste.tomsmeding.com/zdPVexbe
02:53:25 <p0a> I am going to take a look
02:53:48 vonfry joins (~user@52.247.247.169)
02:54:01 <dsal> Again, can't compile, but maybe something like this: https://www.irccloud.com/pastebin/BU5Mp0WE/maybe.hs
02:54:22 <p0a> Why can't you compile?
02:54:38 <dsal> Didn't have all the parts. Let's try with all the parts!
02:54:46 <p0a> ooh got it, sorry
02:56:00 × shatriff_ quits (~vitaliish@176-52-216-242.irishtelecom.com) (Remote host closed the connection)
02:56:35 shatriff joins (~vitaliish@176-52-216-242.irishtelecom.com)
02:57:03 <p0a> the f comment is on point, lol I should've noticed that myself
02:57:16 <p0a> I'm now reading the traverse comment, trying to understand traverse
02:59:38 teardown joins (~user@gateway/tor-sasl/mrush)
03:00:03 <p0a> ah yeah traverse is quite nice
03:00:21 <dsal> Can't link it...
03:01:04 <p0a> well, if you can't do it, I doubt I can help you :P
03:01:22 <p0a> but I'm willing to try if you care
03:01:34 cads2 joins (~cads@ip-64-72-99-232.lasvegas.net)
03:02:40 <p0a> As for your suggestion for createStuff, you're saying I should have a `Stuff' type right?
03:03:03 <dsal> This doesn't link for me, but it compiles. heh https://www.irccloud.com/pastebin/uckM5m9r/close.hs
03:03:56 × olligobber quits (~olligobbe@unaffiliated/olligobber) (Ping timeout: 240 seconds)
03:03:57 <dsal> I just simplified the things I found confusing without changing any of the types.
03:04:26 <p0a> very nice, did wonders in main
03:04:38 <p0a> createStuff seems to be in need of some abstraction
03:04:58 <dsal> The idea of createStuff here is that it calls the underlying c junk and then wraps that in a `Maybe (Ptr CChar)` such that `nullPtr` becomes `Nothing`. Then it just uses `traverse` to create the newForeignPtr.
03:06:18 <p0a> makes sense
03:06:19 <p0a> nice
03:06:24 <p0a> I'll give it a go
03:06:54 <p0a> I also like the trickery with `n'
03:07:00 <dsal> Argh, I don't know how to use these fancy type tools in the bots, but `traverse` here is basically `Monad m => (a -> m ()) -> Maybe a -> m ()`
03:07:18 <p0a> Yeah I figured traverse out
03:07:26 <p0a> I'm thinking of it as an fmap that switches the two functors
03:07:29 <p0a> in the end
03:07:41 <dsal> Oh yeah, that's a nice way to think about it.
03:08:14 <dsal> I didn't do trickery, just tend to fmap lower-level IO like that if I'm going to do a conversion anyway, and you don't need to specify the type if it can be inferred.
03:08:22 <dsal> (er, didn't mean to do trickery, that is)
03:09:04 <p0a> no it's nice
03:09:34 × hiroaki quits (~hiroaki@ip4d16fa3b.dynamic.kabel-deutschland.de) (Ping timeout: 268 seconds)
03:10:06 hiroaki joins (~hiroaki@ip4d16fa3b.dynamic.kabel-deutschland.de)
03:10:39 × royal_screwup21 quits (52254809@gateway/web/cgi-irc/kiwiirc.com/ip.82.37.72.9) (Quit: Connection closed)
03:11:03 royal_screwup21 joins (52254809@gateway/web/cgi-irc/kiwiirc.com/ip.82.37.72.9)
03:11:40 × seanparsons quits (~sean@cpc145088-gill21-2-0-cust281.20-1.cable.virginm.net) (Read error: Connection reset by peer)
03:11:45 <dsal> @hoogle ForeignPtr a -> Maybe (ForeignPtr a)
03:11:47 <lambdabot> Bound closed :: Traversable f => f a -> Maybe (f b)
03:11:47 <lambdabot> Bound.Term closed :: Traversable f => f a -> Maybe (f b)
03:11:47 <lambdabot> Data.Typeable gcast :: forall a b c . (Typeable a, Typeable b) => c a -> Maybe (c b)
03:12:25 <dsal> Eh, I don't think those results do what they should be doing. I'm surprised that function didn't exist there, but it's easy to write and handy.
03:13:02 geowiesnot joins (~user@i15-les02-ix2-87-89-181-157.sfr.lns.abo.bbox.fr)
03:13:36 × merijn quits (~merijn@83-160-49-249.ip.xs4all.nl) (Ping timeout: 240 seconds)
03:13:37 seanparsons joins (~sean@cpc145088-gill21-2-0-cust281.20-1.cable.virginm.net)
03:13:39 <p0a> I'm not sure how ForeignPtr works, but can it be nullPtr?
03:13:48 <dsal> heh, apparently.
03:13:52 <p0a> @hoogle Ptr a -> Maybe (ForeignPtr a)
03:13:53 <lambdabot> UnliftIO.Foreign newForeignPtr_ :: MonadIO m => Ptr a -> m (ForeignPtr a)
03:13:56 elliott__ joins (~elliott@pool-108-51-101-42.washdc.fios.verizon.net)
03:14:01 <p0a> Do you think that's better? I don't know
03:14:05 <dsal> I can't link that code, but it compiles, so its' clearly correct.
03:14:21 <dsal> That's just UnliftIO -- it's got a version of all the things.
03:14:43 <dsal> In particular, Maybe is not MonadIO
03:14:54 <p0a> hmm I see
03:15:09 drincruz joins (~adriancru@ool-44c748be.dyn.optonline.net)
03:15:44 × royal_screwup21 quits (52254809@gateway/web/cgi-irc/kiwiirc.com/ip.82.37.72.9) (Ping timeout: 268 seconds)
03:15:47 × urodna quits (~urodna@unaffiliated/urodna) (Quit: urodna)
03:16:06 <p0a> what would the type for Maybe (ForeignPtr a) be? Stuff a?
03:16:25 <p0a> where Stuff a = Nothing | Just (ForeignPtr a)?
03:16:47 <p0a> and then I have to make instances of Stuff a for monad?
03:17:18 mirrorbird joins (~psutcliff@2a00:801:447:b1bf:a43d:1573:86a9:1f86)
03:17:25 × guest1216 quits (~user@49.5.6.87) (Read error: Connection reset by peer)
03:17:26 olligobber joins (~olligobbe@unaffiliated/olligobber)
03:17:53 <dminuoso> 04:07:26 p0a | I'm thinking of it as an fmap that switches the two functors
03:18:01 <dminuoso> That's an incorrect way to think about it for several reasons.
03:18:22 <p0a> why dminuoso ?
03:18:33 guest1216 joins (~user@49.5.6.87)
03:19:08 <dminuoso> % :t traverse
03:19:08 <yahb> dminuoso: (Traversable t, Applicative f) => (a -> f b) -> t a -> f (t b)
03:19:23 <guest1216> hello, how I can use Text.Parsec.Combinator functions to split input stream? like get "abc" from "server=abc"?
03:19:29 <dminuoso> Note that `t` is a Traversable, which is not Functor.
03:19:45 × pjb quits (~t@2a01cb06a05a85e2487839f79a84871f.ipv6.abo.wanadoo.fr) (Ping timeout: 272 seconds)
03:19:50 <dminuoso> Traversable is a subclsas of Foldable.
03:20:13 <p0a> dminuoso: that's fair
03:20:27 <p0a> dminuoso: but juggling the code in my head, I think that IO goes inside, outside, beep bop
03:20:37 × theDon quits (~td@94.134.91.212) (Ping timeout: 246 seconds)
03:21:02 <p0a> just a superficial way of understanding it
03:21:05 <guest1216> and also why those type constructor and functions defined in diffrent modules like many1 in Text.Parsec.Combinator, but Parser is in Text.Parsec.String, string in Text.Parsec.Char?
03:21:20 <guest1216> why not just define them all in one module?
03:21:34 <dminuoso> p0a: One possible way to think of Traversable is being able to do the following: Turn the structure into a list, map each element to an action, run each effect, and then fill the list back into the structure.
03:22:32 theDon joins (~td@94.134.91.88)
03:24:05 <p0a> ah I see
03:24:33 × Deide quits (~Deide@217.155.19.23) (Quit: Seeee yaaaa)
03:24:47 lagothrix is now known as Guest78678
03:24:47 xirhtogal joins (~lagothrix@unaffiliated/lagothrix)
03:24:48 × Guest78678 quits (~lagothrix@unaffiliated/lagothrix) (Killed (barjavel.freenode.net (Nickname regained by services)))
03:24:48 xirhtogal is now known as lagothrix
03:25:21 <dminuoso> Now, because you're running the effects, you have this visual "swapping around" because after the structure is re-filled from the (possibly modified) list, it happens under the effect.
03:26:05 <p0a> the effect being the applicative
03:26:10 <dminuoso> Right.
03:26:11 × christo quits (~chris@81.96.113.213) (Remote host closed the connection)
03:26:28 <p0a> so in general you can't have a function f (m a) -> m (f a) ?
03:26:33 <p0a> of that type, that is
03:26:42 <dminuoso> Given what constraints, exactly?
03:26:43 <dminuoso> :)
03:26:48 <p0a> let's say, both applicative?
03:26:53 <p0a> f and m
03:27:08 <iqubic> No, in general, you can't do that.
03:27:14 <iqubic> Closest you can do this:
03:27:15 <p0a> Why not?
03:27:24 <iqubic> :t seqenceA
03:27:24 Stanley00 joins (~stanley00@unaffiliated/stanley00)
03:27:25 <p0a> sorry, go ahead
03:27:26 <lambdabot> error:
03:27:26 <lambdabot> • Variable not in scope: seqenceA
03:27:26 <lambdabot> • Perhaps you meant one of these:
03:27:34 <iqubic> :t sequenceA
03:27:36 <lambdabot> (Traversable t, Applicative f) => t (f a) -> f (t a)
03:27:45 <dminuoso> Note, that this is just `traverse id`
03:28:13 <p0a> so what prevents you from switching two applicatives?
03:29:03 <dminuoso> p0a: It doesnt work in the general case
03:29:07 <p0a> isn't it just a matter of 'doit F (M x) = pure (pure x)' ?
03:29:29 <dminuoso> p0a: Being able to pattern match is not part of the description of Applicative
03:29:38 <dminuoso> That is, there's no general way to "unwrap it". Its just not part of its interface
03:29:51 <iqubic> Imagine one of the applicatives was "IO a" How do you get the value from inside of that?
03:29:52 <p0a> there's no IO constructor?
03:30:11 <dminuoso> p0a: Treat IO as opaque.
03:30:25 <dminuoso> p0a: For what its worth, there *is* a subset of things you are looking for in monad.
03:30:33 <dminuoso> some choices of monad let you do this
03:30:34 <iqubic> Now, imagine one of the Applicatives was ((->) a). You can't pattern match on that.
03:30:51 × sh9 quits (~sh9@softbank060116136158.bbtec.net) (Quit: WeeChat 2.8)
03:31:01 christo joins (~chris@81.96.113.213)
03:31:07 <p0a> dminuoso: right, like Maybe. But you can't do it with IO, right?
03:31:25 <iqubic> Nope.
03:31:32 <p0a> Hm, I just realized that! wow
03:31:45 <p0a> but that makes a lot of sense. It's a nice "closed" system, or opaque, as you put it
03:31:45 <dminuoso> p0a: There's some subtle implications, by the way.
03:31:54 <dminuoso> p0a: Because it doesnt exist in the general case, monads dont freely compose!
03:32:05 winny joins (~winny@fsf/member/winstonw)
03:32:21 <p0a> what do you mean by that?
03:32:49 <iqubic> Nothing in the Applicative typeclass forces you to create a way to retrieve the value.
03:33:33 rook__ joins (~Rook_@76.8.169.17.IMCTV.dynamic.mis.net)
03:33:37 <p0a> what does that have to do with free compose?
03:33:42 <dminuoso> p0a: If you compose two monads, you dont get a monad back
03:33:48 <dminuoso> Or rather, not always.
03:34:05 <p0a> what!
03:34:07 <dminuoso> And it's because we lack a general `swap :: n (m t) -> m (n t)`
03:34:21 <dminuoso> It's the entire reason we have monad transformers in the first place.
03:34:34 <winny> Hello. Is there a standard function that combines foldl with map?
03:34:57 <dminuoso> Or rather the type should be `swap :: (Monad m, Monad n) => n (m t) -> m (n t)`. It doesnt exist
03:35:35 <dminuoso> Interestingly, Applicative however are closed under composition
03:35:38 × christo quits (~chris@81.96.113.213) (Ping timeout: 260 seconds)
03:35:58 <p0a> You're making me venture into faraway places dminuoso
03:36:21 <p0a> and I have the good sense of being leery of such things
03:36:31 <dminuoso> Anyway
03:36:59 <dminuoso> p0a: My point is: traverse/sequence is _not_ about "swapping functor layers"
03:37:15 <p0a> that's a good point, I'm glad you clarified, thank you
03:37:36 × geowiesnot quits (~user@i15-les02-ix2-87-89-181-157.sfr.lns.abo.bbox.fr) (Ping timeout: 240 seconds)
03:37:55 <dminuoso> It's rather about "collapse structure into list, map each element to an effect, sequence these effects, and under the new effect fill the (modified) list back into the structure"
03:38:32 <p0a> I don't mind lying to myself
03:38:33 <dminuoso> In fact, if we had some concept of Unfoldable, then anything that is both Foldable and Unfoldable should automatically be traversable I think
03:38:37 <p0a> when it comes to remembering things
03:39:10 <p0a> I'd rather think of it still as 'switching' the two "functors" (for lack of a better word; "kinds" maybe?)
03:39:26 <p0a> and remembering that it is not a full & accurate description
03:40:11 <dminuoso> p0a: that's the `sequence` viewpoint. but if you look at `traverse`...
03:40:13 <dminuoso> % :t traverse
03:40:13 <yahb> dminuoso: (Traversable t, Applicative f) => (a -> f b) -> t a -> f (t b)
03:40:25 <p0a> yeah right
03:40:26 <monochrom> Unfoldable is an interesting thought. (Down that road is fog, haha.)
03:40:33 <dminuoso> "Give me a function that maps an element to an effect, give me a structure, and Ill give you a new structure back under the effect"
03:40:58 <p0a> right, that sounds good dminuoso
03:41:16 <p0a> winny: can you give an example?
03:42:03 <dminuoso> monochrom: When you say fog.. do you mean the person or the foggy fog? :>
03:42:14 <dminuoso> Because I cant say
03:42:45 shf joins (~sheaf@2a01:cb19:80cc:7e00:ec10:402a:74e0:28d6)
03:44:49 <winny> p0a; something like this, i'm contemplating how to solve a programming challenge: foldWithIntermediate (+) [1] [2..] -> [1,3,6,10,15,..]
03:45:25 <winny> i'm thinking i could use an infinite list and take the nth value I want form the sequence
03:45:28 <p0a> what are the values 1,3,6,10,15?
03:45:38 <p0a> are they 1, 1+2, 1+2+3, etc?
03:45:47 <winny> ah I see your question now
03:46:42 × rook__ quits (~Rook_@76.8.169.17.IMCTV.dynamic.mis.net) (Quit: Leaving)
03:47:06 <dsal> :t foldMap -- winny
03:47:08 <lambdabot> (Foldable t, Monoid m) => (a -> m) -> t a -> m
03:47:36 <winny> in this case yes, though in my use it won't be with a associative function
03:47:53 × hseg quits (~gesh@IGLD-84-228-238-87.inter.net.il) (Quit: WeeChat 2.9)
03:49:44 <iqubic> winny: I think you want a scanl'
03:50:00 merijn joins (~merijn@83-160-49-249.ip.xs4all.nl)
03:50:35 × andi- quits (~andi-@NixOS/user/andi-) (Ping timeout: 258 seconds)
03:51:15 <winny> i did a quick try with foldMap, I don't think I'm understanding how to use it:
03:51:29 <winny> % take 10 $ foldMap (+) [1..]
03:51:29 <yahb> winny: ; <interactive>:11:11: error:; * Couldn't match expected type `[a]' with actual type `a0 -> a0'; * Probable cause: `foldMap' is applied to too few arguments; In the second argument of `($)', namely `foldMap (+) [1 .. ]'; In the expression: take 10 $ foldMap (+) [1 .. ]; In an equation for `it': it = take 10 $ foldMap (+) [1 .. ]; * Relevant bindings include it :: [a] (bound
03:51:35 <sshine> I'm using 'actions/setup-haskell@v1.1.4' on GitHub and I experience a warning that says 'cabal 3.2.0.0 was not found in the cache. It will be downloaded.' -- right now I'm only caching '~/.cabal/store' and 'dist-newstyle' using 'actions/cache@v2', has anyone experienced that they need to add some path to preserve the cabal 3.2.0.0 binary across builds?
03:52:00 <dsal> winny: foldMap is fold and map. You need a monoid. The thing you're doing is a bit different.
03:52:12 <winny> ah, thanks
03:52:20 <sshine> :t foldMap
03:52:22 <lambdabot> (Foldable t, Monoid m) => (a -> m) -> t a -> m
03:52:41 <iqubic> dsal: They wanta scanl'
03:52:45 <dsal> scanl is "fold with intermediate"
03:52:56 <ski> p0a : <https://en.wikipedia.org/wiki/Triangular_number>
03:53:07 <winny> oh yes, scanl is exactly what I want, I believe
03:53:10 <sshine> > foldMap Sum [1..10]
03:53:12 <winny> scanl', rather
03:53:13 <lambdabot> Sum {getSum = 55}
03:53:26 <iqubic> > take 10 $ scanl1 [1..]
03:53:28 <lambdabot> error:
03:53:28 <lambdabot> • Couldn't match expected type ‘[a]’
03:53:28 <lambdabot> with actual type ‘[a0] -> [a0]’
03:53:31 × vonfry quits (~user@52.247.247.169) (Ping timeout: 246 seconds)
03:53:42 <iqubic> > take 10 $ scanl1 (+) [1..]
03:53:44 <lambdabot> [1,3,6,10,15,21,28,36,45,55]
03:53:58 <dsal> The two list thing threw me off.
03:54:11 <iqubic> That's [1,1+2,1+2+3,1+2+3+4,...]
03:54:27 <winny> that's so cool, missed this in plain sight! (the fibonacci wiki page suggested it, but didn't put 2+2 together)
03:54:42 <ski> > scanl1 (+) [0 ..] :: [Expr]
03:54:45 × merijn quits (~merijn@83-160-49-249.ip.xs4all.nl) (Ping timeout: 240 seconds)
03:54:47 <lambdabot> [0,0 + 1,0 + 1 + 2,0 + 1 + 2 + 3,0 + 1 + 2 + 3 + 4,0 + 1 + 2 + 3 + 4 + 5,0 +...
03:55:02 <iqubic> Yeah, that's what it's doing.
03:55:05 × ChaiTRex quits (~ChaiTRex@gateway/tor-sasl/chaitrex) (Quit: ChaiTRex)
03:55:12 <sshine> ski, that's a cool feature. what is Expr made of?
03:55:24 <winny> you can literally typecast to [Expr] to get a sort of weird ast, that's also very amazing
03:55:41 ChaiTRex joins (~ChaiTRex@gateway/tor-sasl/chaitrex)
03:55:44 <ski> @hackage simple-reflect
03:55:45 <lambdabot> https://hackage.haskell.org/package/simple-reflect
03:55:49 <sshine> reminds me of C#'s Expr<> :)
03:56:06 <winny> beautiful, thanks for the hackage link
03:56:09 × shatriff quits (~vitaliish@176-52-216-242.irishtelecom.com) (Remote host closed the connection)
03:56:23 shatriff joins (~vitaliish@176-52-216-242.irishtelecom.com)
03:56:52 <ski> > foldr f z [a,b,c,d]
03:56:54 <lambdabot> f a (f b (f c (f d z)))
03:56:55 justanotheruser joins (~justanoth@unaffiliated/justanotheruser)
03:56:57 <ski> > foldl f z [a,b,c,d]
03:56:59 <lambdabot> f (f (f (f z a) b) c) d
03:57:03 <sshine> :o
03:57:14 <ski> @type a
03:57:16 <lambdabot> Expr
03:57:29 <ski> @type f :: Expr -> Expr -> Expr
03:57:31 <lambdabot> Expr -> Expr -> Expr
03:57:32 <ski> @type f :: Expr -> Expr
03:57:33 <lambdabot> Expr -> Expr
03:57:34 <sshine> Wolfram Alpha can retire now.
03:57:34 <ski> @type f
03:57:36 <lambdabot> FromExpr a => a
03:58:17 <p0a> Expr reminds me of an exercise I did once
03:58:24 <ski> it only applies to numeric expressions
03:58:41 <p0a> you basically reimplement them and change how they are printed right?
03:59:00 × wroathe quits (~wroathe@c-68-54-25-135.hsd1.mn.comcast.net) (Remote host closed the connection)
03:59:20 wroathe joins (~wroathe@c-68-54-25-135.hsd1.mn.comcast.net)
03:59:34 <ski> yes, it's just `instance Num Expr where ...' and so on
03:59:45 <ski> @where stepeval
03:59:45 <lambdabot> <http://www.srcf.ucam.org/~bm380/cgi-bin/stepeval.cgi>,<https://github.com/bmillwood/stepeval>
04:00:23 <ski> e.g. <http://bm380.user.srcf.net/cgi-bin/stepeval.cgi?expr=take+3+%28map+%28%5E2%29+%5B0%2C1%2C2%2C3%2C4%5D%29>
04:03:12 <ski> oh. also see <https://web.archive.org/web/20201021071139/https://twanvl.nl/blog/haskell/simple-reflection-of-expressions> for `Expr'
04:03:33 × shatriff quits (~vitaliish@176-52-216-242.irishtelecom.com) (Remote host closed the connection)
04:03:38 <p0a> how does ForeignPtr set up a finalizer?
04:03:57 <p0a> How do "finalizers" work in Haskell? is it somehow in the type/interface or is it provided by GHC?
04:04:06 shatriff joins (~vitaliish@176-52-216-242.irishtelecom.com)
04:04:41 × bandali quits (znc@fsf/interns/bandali) (Quit: ZNC - https://znc.in)
04:05:24 bandali joins (znc@fsf/interns/bandali)
04:06:17 andi- joins (~andi-@NixOS/user/andi-)
04:07:31 <justsomeguy> Does using the “type” keyword incur a runtime cost?
04:08:30 <ski> p0a : <https://downloads.haskell.org/~ghc/latest/docs/html/libraries/base-4.14.1.0/Foreign-ForeignPtr.html> ?
04:08:33 <ski> justsomeguy : no
04:08:38 <justsomeguy> (I'm confused as to why books keep on mentioning that “newtype” doesn't incur a runtime cost. Why would it? There wasn't any mention of cost when discussing type classes.)
04:09:03 <ski> `type' synonyms are just abbreviations for more complicated type expressions
04:09:28 <dminuoso> justsomeguy: data does incur a runtime cost, even if you write `data Foo = Foo Int`
04:09:37 <ski> the point with `newtype' is that `data New = Mk Old' does incur a run-time cost, while `newtype New = Mk Old' doesn't
04:10:13 <p0a> ski: should I read the source code of it?
04:10:26 <dminuoso> In case of `newtype F = F T`, the runtime representation of `F` is the runtime representation of `T`.
04:11:09 <justsomeguy> Then, why didn't the language designers optimize “data” for that case, instead of inventing a new keyword?
04:11:09 <p0a> how can I make `newtype F = F T' have an instance for all the things T has?
04:11:23 <dminuoso> justsomeguy: Because `data` allows its content to be lazy, for example.
04:11:33 <dminuoso> And data allows to have multiple fields.
04:11:34 wnbehsklr parts (~wnbehsklr@97.119.189.29) ()
04:11:55 <dminuoso> p0a: GeneralizedNewtypeDeriving
04:12:06 <ski> the difference between `newtype New = Mk Old' and `type New = Old' is that in the latter case, `New' and `Old' are synonyms, are the same type (also `New' can't be recursive, `Old' can't refer to / be defined in terms of `New'), while in the former case (just like with `data') `New' is a distinct type from `Old', and you have to explicitly use `Mk' (wrapping with a call to it, or unwrapping with
04:12:11 <dminuoso> You still have to list out the instances, but it will automatically derive their implementation via coerce
04:12:12 <ski> pattern-matching), to convert between `New' and `Old'. (also, with `newtype', `New' can be recursive)
04:12:59 <ski> p0a : i dunno what you're wanting to understand better about it. just how to use it ?
04:13:12 <p0a> ski: I'm curious about setting up my own finalizers
04:13:19 <p0a> ski: is it something the language supports or is it a GHC feature
04:13:33 Mikagami joins (~MOSCOS@152.32.70.55)
04:13:54 <justsomeguy> dminuoso: Oh, true, “data” is more general. “type” communicates some intent that you want the constructor to be unary.
04:13:57 × Noldorin quits (~noldorin@unaffiliated/noldorin) (Quit: Textual IRC Client: www.textualapp.com)
04:14:00 <justsomeguy> (I guess that's kind of like asking "why have “const” when you can just not mutate variables?".)
04:16:47 × MOSCOS quits (~MOSCOS@122.54.107.175) (Ping timeout: 260 seconds)
04:17:11 MOSCOS joins (~MOSCOS@122.54.107.175)
04:18:18 <justsomeguy> If I define a type using “data”, but don't use it in my program at the term-level, does it still incur a cost?
04:18:25 × Mikagami quits (~MOSCOS@152.32.70.55) (Ping timeout: 240 seconds)
04:19:15 <ski> p0a : <https://www.haskell.org/onlinereport/haskell2010/haskellch29.html#x37-28000029>
04:20:41 <justsomeguy> ski: Thanks, that's helpful. I wasn't sure if you could use the aliased type in place of the new name you defined with “type”, but it seems you can. ``newtype`` is different.
04:20:43 <ski> justsomeguy : "Then, why didn't the language designers optimize “data” for that case, instead of inventing a new keyword?" -- replacing `data New = Mk Old' by `newtype New = Mk Old' can change program behaviour, so it can't be a mere optimization
04:21:16 × jmchael_ quits (~jmchael@87.112.46.194) (Ping timeout: 240 seconds)
04:21:28 <p0a> ski: thank you
04:22:06 × p0a quits (~user@unaffiliated/p0a) (Quit: bye)
04:22:09 <ski> they could have specified that using `data' with a single data constructor (with a single component / field / argument / parameter) behaved exactly like `newtype' now works .. but then this case would not fit into the same pattern as how all the other cases work
04:23:08 rdivyanshu joins (uid322626@gateway/web/irccloud.com/x-fzjxsprliudkdzwi)
04:23:29 merijn joins (~merijn@83-160-49-249.ip.xs4all.nl)
04:24:43 <ski> (the reason for the difference is that `data' constructors can be non-strict. if that wasn't the case, then there wouldn't be a difference in behaviour)
04:25:00 <justsomeguy> Ahh
04:25:31 <ski> @let data MyInt = MkMI Int deriving Show
04:25:33 <lambdabot> Defined.
04:25:58 <ski> @let newtype MyInt' = MkMI' Int deriving Show
04:26:00 <lambdabot> Defined.
04:26:31 rekahsoft joins (~rekahsoft@cpe0008a20f982f-cm64777d666260.cpe.net.cable.rogers.com)
04:26:39 <ski> > case undefined of MkMI _ -> ()
04:26:42 <lambdabot> *Exception: Prelude.undefined
04:26:43 <ski> > case undefined of MkMI' _ -> ()
04:26:45 <lambdabot> ()
04:27:32 × bandali quits (znc@fsf/interns/bandali) (Quit: ZNC - https://znc.in)
04:27:56 <ski> wrapping or unwrapping a `newtype' data constructor is a no-op, does nothing at run-time. but matching on the `data' data constructor forces the value
04:28:16 bandali joins (znc@fsf/interns/bandali)
04:29:24 <ski> @let data MyInt'' = MkMI'' !Int deriving Show -- this is a `data' type with a strict data constructor (field). forcing a call to it forces the field/component
04:29:24 × codygman quits (~codygman@47-184-107-46.dlls.tx.frontiernet.net) (Read error: Connection reset by peer)
04:29:26 <lambdabot> Defined.
04:29:57 codygman joins (~codygman@47-184-107-46.dlls.tx.frontiernet.net)
04:30:06 <ski> > case undefined of MkMI'' _ -> () -- matching on behaves the same, as with the non-strict `data' constructor
04:30:10 <lambdabot> *Exception: Prelude.undefined
04:30:26 × rekahsoft quits (~rekahsoft@cpe0008a20f982f-cm64777d666260.cpe.net.cable.rogers.com) (Remote host closed the connection)
04:30:51 rekahsoft joins (~rekahsoft@cpe0008a20f982f-cm64777d666260.cpe.net.cable.rogers.com)
04:31:30 <ski> however, while the data constructor of the first (`data') type is non-strict, the data constructor of the `newtype' is also strict (meaning that if you call it with a bottom value, you'll get a bottom result. so calling it with `undefined', and forcing the result, forces that `undefined' argument)
04:32:06 × bandali quits (znc@fsf/interns/bandali) (Remote host closed the connection)
04:32:29 <ski> > let !_ = MkMI undefined in () -- the usual (non-strict) `data' data constructor is .. non-strict. forcing the result doesn't force the argument
04:32:31 <lambdabot> ()
04:33:10 bandali joins (bandali@fsf/interns/bandali)
04:33:47 <ski> > let !_ = MkMI' undefined in () -- in the `newtype' case, the data constructor is strict, so forcing the result does force the argument. this is because the representation is the same, there is no actual wrapping. so forcing the result forces the argument, since they're effectively the same thing, at run-time
04:33:50 <lambdabot> *Exception: Prelude.undefined
04:35:24 <ski> > let !_ = MkMI'' undefined in () -- in the strict `data' case, the data constructor is also strict, so forcing the result does also force the argument. the representation is *not* the same, but the data constructor is defined to explicitly force its argument (to be "non-lazy"), unlike the usual (non-strict / "lazy") `data' case
04:35:26 <lambdabot> *Exception: Prelude.undefined
04:38:34 × brodie_ quits (~brodie@207.53.253.137) (Quit: brodie_)
04:38:44 <justsomeguy> That was very helpful; Thank you ski :^). (Also, it was a good intro to how to use strictness annotations, which I haven't seen before, except as eBNF.)
04:38:48 <ski> attempt at summary : `newtype' data constructor is strict, like in the strict `data' case (with `!' annotation on component type), but unlike the usual (non-strict) `data' case, so forcing result does force the argument. however, *matching* on `newtype' data constructor (unlike strict `data' case) does not force argument, since the representation is the same, so that calling and matching on `newtype' data
04:38:54 <ski> constructor is a no-op
04:40:07 <ski> (this is somewhat subtle, yes, hence my attempt at highlighting the differences)
04:40:28 <justsomeguy> The subject was way deeper than I expected!
04:41:51 × Sheilong quits (uid293653@gateway/web/irccloud.com/x-ruenqifzengrhwga) ()
04:42:02 <sshine> justsomeguy, this is implied here.
04:42:23 <justsomeguy> I guess I just described the entirety of Haskell, lol.
04:43:42 × bandali quits (bandali@fsf/interns/bandali) (Quit: ZNC - https://znc.in)
04:43:58 <ski> one could have assumed that, a `newtype' data constructor being strict (like in the strict `data' case), means that matching on it, would force the argument. but that is *not* the case ! (due to calling and matching on `newtype' data constructor being no-op). that's the main subtle thing here, that can be easy to trip over / miss, i guess
04:44:47 <dolio> It's not really that matching on it doesn't force the argument. Matching on it doesn't force the value of the newtype.
04:45:13 <dolio> Your examples showed that.
04:46:10 bandali joins (bandali@fsf/interns/bandali)
04:46:17 <ski> yes, that amounts to the same thing. of course, matching on `x' or `_' (as in `case undefined of x -> ()') doesn't force anything. but the subtlety here is that, matching on a `newtype' data constructor *also* doesn't force anything (unlike matching on other data constructors)
04:47:27 <ski> > case undefined of x -> ()
04:47:30 <lambdabot> ()
04:47:44 <dolio> Like, matching on strict data doesn't require forcing the argument, except that it forces the data value as well, which requires forcing the argument.
04:48:04 ski nods
04:48:26 <z0_> is there a more elegant way we can write `uncurry (++) $ (map f &&& map g) [x,y..]` ?
04:49:21 <z0_> other than `join [ [a,b] | a <- f <$> ls , b <- g <$> ls ]`
04:49:21 <dsal> :t (&&&)
04:49:23 <dminuoso> % :t \f g x y -> uncurry (++) $ (map f &&& map g) [x,y..]
04:49:23 <lambdabot> Arrow a => a b c -> a b c' -> a b (c, c')
04:49:23 <yahb> dminuoso: Enum a1 => (a1 -> a2) -> (a1 -> a2) -> a1 -> a1 -> [a2]
04:49:57 argento joins (~argent0@168.227.97.34)
04:50:13 <ski> z0_ : `[h x | h <- [f,g],x <- xs]' ?
04:50:42 × rekahsoft quits (~rekahsoft@cpe0008a20f982f-cm64777d666260.cpe.net.cable.rogers.com) (Ping timeout: 268 seconds)
04:51:02 <glguy> let z = [x,y..] in map f z ++ map g z
04:51:02 <dminuoso> [f,g] <*> xs
04:51:25 <ski> that's nice
04:51:29 <sshine> it is
04:51:34 <dolio> Does the order not matter or something?
04:51:52 <glguy> > [('a':),('b':)] <*> ["one","two"]
04:51:55 <lambdabot> ["aone","atwo","bone","btwo"]
04:52:02 <z0_> nope
04:52:03 × philopsos quits (~caecilius@gateway/tor-sasl/caecilius) (Ping timeout: 240 seconds)
04:52:23 <ski> > ["one","two"] <**> [('a':),('b':)]
04:52:24 <glguy> z0_, day 14?
04:52:26 <lambdabot> ["aone","bone","atwo","btwo"]
04:52:41 <iqubic> :t <**>
04:52:43 <lambdabot> error: parse error on input ‘<**>’
04:52:54 <iqubic> :t (<**>)
04:52:56 <lambdabot> Applicative f => f a -> f (a -> b) -> f b
04:53:02 <ski> (<**>) = liftA2 (flip ($))
04:53:54 <iqubic> <**> = flip (<*>)
04:53:57 <ski> no
04:54:05 z0 joins (~zzz@2001:8a0:de31:6c01:c541:938d:40c2:b010)
04:54:06 <ski> only if the idiom is commutative
04:54:06 <iqubic> No? It's not the same?
04:54:15 z0 is now known as Guest37588
04:54:16 <ski> the ordering of the effects is different
04:54:20 <iqubic> Ah. I see.
04:54:25 <sshine> I would also go with glguy's 'map f xs ++ map g xs' :-D
04:54:34 <ski> (see glguy's and my example above. different results)
04:54:35 <iqubic> Yeah, so would I.
04:55:03 <dolio> I'm saving `[f,g] <*> xs`, though.
04:55:07 <ski> depends on whether `xs' is a larger expression ?
04:55:27 <sshine> dolio, yes, List's Applicative is nice.
04:55:48 × awk quits (~mnrmnaugh@unaffiliated/mnrmnaugh) (Remote host closed the connection)
04:56:11 <glguy> I like that, but I expect my reader will have to ponder to know what order the results will come in
04:56:27 <dminuoso> glguy: the reader has to ponder either way.
04:56:45 <glguy> Either which way?
04:57:14 <dminuoso> glguy: Regardless of whether you wrote `let z = [x,y..] in map f z ++ map g z` or `[f,g] <*> [x,y..]`
04:57:24 <glguy> No, I don't believe those would result in equal confusion
04:57:41 <sshine> as Kierkegaard said: Use <*>, and you will regret it; don't use <*>, you will also regret it; use <*> or don't use <*>, you will regret it either way.
04:57:43 <glguy> but the <*> one is still handy
04:58:06 × merijn quits (~merijn@83-160-49-249.ip.xs4all.nl) (Ping timeout: 268 seconds)
04:58:24 <z0_> glguy: day 14 :)
04:58:36 <dminuoso> It would be nice if we had Applicative on Set so you could be explicit that ordering didn't matter.
04:59:05 <MarcelineVQ> now solve cleverly for (a -> a2) -> (b -> a2) -> a -> b -> [a2]
04:59:54 ski . o O ( `class Applicative i => CommutativeIdiom i' )
05:00:08 <ski> (`AbelianIdiom' ?)
05:00:47 × polyphem quits (~p0lyph3m@2a02:810d:640:776c:76d7:55f6:f85b:c889) (Ping timeout: 260 seconds)
05:02:22 <sshine> dminuoso, wouldn't that be lawless?
05:04:24 × Guest37588 quits (~zzz@2001:8a0:de31:6c01:c541:938d:40c2:b010) (Quit: Guest37588)
05:05:37 × ddellacosta quits (dd@gateway/vpn/mullvad/ddellacosta) (Ping timeout: 264 seconds)
05:08:03 <sshine> dminuoso, as in it'd have to be a Functor then.
05:10:04 bitmagie joins (~Thunderbi@200116b8065b450041174f8fe0224a0b.dip.versatel-1u1.de)
05:10:30 × _linker_ quits (~linker@2a02:a31a:a041:9a80:1c5:249d:af3e:edc4) (Read error: Connection reset by peer)
05:11:36 × drincruz quits (~adriancru@ool-44c748be.dyn.optonline.net) (Ping timeout: 256 seconds)
05:15:40 × MidAutumnHotaru quits (~MidAutumn@154.91.197.93) (Quit: Ping timeout (120 seconds))
05:16:03 MidAutumnHotaru joins (~MidAutumn@154.91.197.93)
05:17:16 × hf69 quits (~haskeller@ip72-205-40-121.dc.dc.cox.net) (Ping timeout: 256 seconds)
05:17:31 × mirrorbird quits (~psutcliff@2a00:801:447:b1bf:a43d:1573:86a9:1f86) (Quit: Leaving)
05:17:49 z0__ joins (~zzz@2001:8a0:de31:6c01:c541:938d:40c2:b010)
05:18:49 × bitmagie quits (~Thunderbi@200116b8065b450041174f8fe0224a0b.dip.versatel-1u1.de) (Quit: bitmagie)
05:19:00 × z0__ quits (~zzz@2001:8a0:de31:6c01:c541:938d:40c2:b010) (Client Quit)
05:21:38 pounce joins (~pounce@ns379743.ip-5-196-70.eu)
05:21:42 brodie_ joins (~brodie@207.53.253.137)
05:23:42 <dminuoso> sshine: If we demanded the functions inside Set to be injective, it should satisfy laws, no?
05:24:37 × elliott__ quits (~elliott@pool-108-51-101-42.washdc.fios.verizon.net) (Ping timeout: 268 seconds)
05:24:43 × machinedgod quits (~machinedg@135-23-192-217.cpe.pppoe.ca) (Ping timeout: 260 seconds)
05:24:59 <sshine> dminuoso, how do we demand that?
05:25:17 <dminuoso> If we take any inspiration from lens... via haddock? :)
05:26:00 <dminuoso> At the end, there's no guarantee any instance is lawful anyway.
05:26:43 <dminuoso> It's how we ended with https://hackage.haskell.org/package/transformers-0.5.6.2/docs/Control-Monad-Trans-List.html#t:ListT
05:27:30 × justsomeguy quits (~justsomeg@unaffiliated/--/x-3805311) ()
05:28:02 merijn joins (~merijn@83-160-49-249.ip.xs4all.nl)
05:28:17 × bitmapper quits (uid464869@gateway/web/irccloud.com/x-rkpypfhwqclqvqju) (Quit: Connection closed for inactivity)
05:29:16 × Tario quits (~Tario@201.192.165.173) (Ping timeout: 240 seconds)
05:33:28 × merijn quits (~merijn@83-160-49-249.ip.xs4all.nl) (Ping timeout: 256 seconds)
05:48:20 zzz joins (~zzz@46.101.134.251)
05:48:44 zzz is now known as Guest7205
05:48:50 Tops2 joins (~Tobias@dyndsl-095-033-090-179.ewe-ip-backbone.de)
05:50:16 × Tops21 quits (~Tobias@dyndsl-095-033-017-085.ewe-ip-backbone.de) (Ping timeout: 240 seconds)
05:52:07 × Guest16204 quits (~zzz@2a03:b0c0:3:d0::3095:3001) (Ping timeout: 260 seconds)
05:56:58 × brodie_ quits (~brodie@207.53.253.137) (Quit: brodie_)
05:57:25 × wroathe quits (~wroathe@c-68-54-25-135.hsd1.mn.comcast.net) (Ping timeout: 246 seconds)
06:01:47 merijn joins (~merijn@83-160-49-249.ip.xs4all.nl)
06:03:32 × Guest7205 quits (~zzz@46.101.134.251) (Remote host closed the connection)
06:07:18 × mounty quits (~mounty@2001:8000:2f59:0:bc37:56:578e:e1d4) (Ping timeout: 260 seconds)
06:07:37 aaa joins (~zzz@2a03:b0c0:3:d0::3095:3001)
06:10:36 vs^ joins (vs@ip98-184-89-2.mc.at.cox.net)
06:11:19 aaa is now known as zzz
06:11:27 ddere joins (uid110888@gateway/web/irccloud.com/x-skgqfoexthrhsgmv)
06:12:02 × argento quits (~argent0@168.227.97.34) (Quit: leaving)
06:16:20 takuan joins (~takuan@178-116-218-225.access.telenet.be)
06:20:10 × olligobber quits (~olligobbe@unaffiliated/olligobber) (Ping timeout: 256 seconds)
06:25:16 <guest1216> what is *> <* <$
06:25:39 <guest1216> related to >> <|>?
06:26:06 <opqdonut> they're for Applicative, related to <$> and <*>
06:26:17 <opqdonut> which are also known as fmap and ap
06:26:30 <opqdonut> :t (<*>)
06:26:31 <lambdabot> Applicative f => f (a -> b) -> f a -> f b
06:26:35 <opqdonut> :t (<*)
06:26:36 <lambdabot> Applicative f => f a -> f b -> f a
06:26:58 <opqdonut> > Just succ <*> Just 1
06:27:00 <lambdabot> Just 2
06:27:09 <opqdonut> > Just succ <*> Nothing
06:27:12 <lambdabot> Nothing
06:27:22 <opqdonut> > Just 7 <* Just 3
06:27:24 <lambdabot> Just 7
06:27:25 × jeremyb quits (~jeremyb@84.39.117.57) (Remote host closed the connection)
06:27:27 <opqdonut> > Just 7 <* Nothing
06:27:30 <lambdabot> Nothing
06:28:20 <opqdonut> I guess *> is the same as >> when both are defined, hadn't thought of it that way
06:34:13 <guest1216> I saw those in Parsec articles
06:34:50 <guest1216> <$>, <*>, <$, <*, *>, <|>, many, >>
06:36:13 × merijn quits (~merijn@83-160-49-249.ip.xs4all.nl) (Ping timeout: 264 seconds)
06:39:13 × fissureman quits (~quassel@c-73-163-84-25.hsd1.dc.comcast.net) (Ping timeout: 264 seconds)
06:39:56 × jespada quits (~jespada@90.254.245.49) (Ping timeout: 240 seconds)
06:40:11 fissureman joins (~quassel@c-73-163-84-25.hsd1.dc.comcast.net)
06:42:16 × phasespace quits (~sar@89-162-33-21.fiber.signal.no) (Ping timeout: 240 seconds)
06:42:49 jespada joins (~jespada@90.254.245.49)
06:43:03 × Foritus quits (~buggery@cpc91316-watf11-2-0-cust68.15-2.cable.virginm.net) (Quit: ლ(ಠ益ಠლ) .:. <Ashley> my porn is hidden in a folder called "BBC Micro Emulator")
06:43:56 Foritus joins (~buggery@cpc91316-watf11-2-0-cust68.15-2.cable.virginm.net)
06:44:39 × cole-h quits (~cole-h@c-73-48-197-220.hsd1.ca.comcast.net) (Ping timeout: 260 seconds)
06:45:39 Barras21 joins (~Barras2@184.75.221.35)
06:54:06 remby joins (~r@2607:fea8:2c40:a3::f1c5)
06:55:28 <sshine> guest1216, combinatory parsers are often written using applicative style.
06:57:39 <guest1216> sshine: (*>) :: f a -> f b -> f b, why Nothing *> Just 1 == Nothing?
06:57:45 nineonine joins (~nineonine@S01061cabc0b095f3.vf.shawcable.net)
06:57:46 <guest1216> should it be Just 1?
06:59:09 <guest1216> > Nothing (*>) Just 1
06:59:11 <lambdabot> error:
06:59:11 <lambdabot> • Couldn't match expected type ‘(f0 a1 -> f0 b0 -> f0 b0)
06:59:11 <lambdabot> -> (a2 -> Maybe a2) -> t0 -> t’
06:59:18 <sshine> > Nothing *> Just 1
06:59:20 <lambdabot> Nothing
06:59:39 <guest1216> > Just 1 *> Just 2
06:59:41 <lambdabot> Just 2
07:00:28 × sqrt2 quits (~ben@unaffiliated/sqrt2) (Quit: ZNC - http://znc.in)
07:00:42 × nineonin_ quits (~nineonine@50.216.62.2) (Ping timeout: 260 seconds)
07:00:56 wroathe joins (~wroathe@c-68-54-25-135.hsd1.mn.comcast.net)
07:01:02 <sshine> guest1216, you can see how the 'instance Applicative Maybe' is defined here: https://hackage.haskell.org/package/base-4.14.1.0/docs/src/GHC.Base.html#line-992
07:01:27 sqrt2 joins (~ben@unaffiliated/sqrt2)
07:03:46 <sshine> > Nothing <|> Just 1
07:03:49 <lambdabot> Just 1
07:04:37 <xerox_> > (+) <$> Just (-1) <*> Just 1
07:04:39 <lambdabot> Just 0
07:04:55 <guest1216> why it doesn't use "and" "or" "nor"?
07:05:11 <guest1216> that should be more plain?
07:05:25 × wroathe quits (~wroathe@c-68-54-25-135.hsd1.mn.comcast.net) (Ping timeout: 240 seconds)
07:05:36 × mapperr quits (~mapperr@vmi389916.contaboserver.net) (Read error: Connection reset by peer)
07:05:36 <guest1216> "not"
07:06:29 <sshine> guest1216, one of the uses of Maybe is to end computation once a Nothing occurs. so if you chain computations, you don't compute beyond the first failure.
07:07:25 × nbloomf quits (~nbloomf@2600:1700:ad14:3020:c8fd:7d2a:dff7:52e8) (Quit: My MacBook has gone to sleep. ZZZzzz…)
07:08:22 jedws joins (~jedws@121.209.189.201)
07:09:14 × dnlkrgr quits (~dnlkrgr@HSI-KBW-46-223-1-192.hsi.kabel-badenwuerttemberg.de) (Ping timeout: 256 seconds)
07:09:29 merijn joins (~merijn@83-160-49-249.ip.xs4all.nl)
07:10:43 <guest1216> sshine: what's the defferent? >> and *>
07:11:24 <sshine> guest1216, >> is defined for Monad, *> is defined for Applicative. they probably do the same.
07:11:41 <sshine> :t (>>)
07:11:43 <lambdabot> Monad m => m a -> m b -> m b
07:11:45 <sshine> :t (*>)
07:11:46 <lambdabot> Applicative f => f a -> f b -> f b
07:12:25 <guest1216> monad has the same kind with applicative?
07:12:30 <ChaiTRex> @src (>>)
07:12:31 <lambdabot> m >> k = m >>= \_ -> k
07:12:35 <ChaiTRex> @src (*>)
07:12:35 <lambdabot> (*>) = liftA2 (const id)
07:12:53 <guest1216> *> is look like const
07:13:12 <iqubic> guest1216: It's not const, because it runs both effects.
07:14:00 <xerox_> 'cept you get the applicative effect
07:14:09 <iqubic> const would A) throw away the second effect, and B) not run any effects.
07:14:47 dnlkrgr joins (~dnlkrgr@HSI-KBW-46-223-1-192.hsi.kabel-badenwuerttemberg.de)
07:14:59 × merijn quits (~merijn@83-160-49-249.ip.xs4all.nl) (Ping timeout: 260 seconds)
07:15:01 remby parts (~r@2607:fea8:2c40:a3::f1c5) ("Konversation terminated!")
07:15:30 <iqubic> (*>) runs both effects it's given, but only returns the result of the first effect.
07:15:57 sord937 joins (~sord937@gateway/tor-sasl/sord937)
07:17:20 <guest1216> iqubic: *> return the second effect?
07:17:25 <iqubic> Yes.
07:17:28 <guest1216> (*>) :: f a -> f b -> f b
07:17:46 <iqubic> That's returning the second effect, but running both of the effects.
07:18:56 × dnlkrgr quits (~dnlkrgr@HSI-KBW-46-223-1-192.hsi.kabel-badenwuerttemberg.de) (Ping timeout: 240 seconds)
07:21:47 × hiroaki quits (~hiroaki@ip4d16fa3b.dynamic.kabel-deutschland.de) (Ping timeout: 268 seconds)
07:22:05 <guest1216> <**> == flip <*>?
07:22:06 phasespace joins (~sar@80-89-47-117.inet.signal.no)
07:22:11 hiroaki joins (~hiroaki@ip4d16fa3b.dynamic.kabel-deutschland.de)
07:22:38 dnlkrgr joins (~dnlkrgr@HSI-KBW-46-223-1-192.hsi.kabel-badenwuerttemberg.de)
07:23:01 <sshine> guest1216, you can find out by hoogling: https://hoogle.haskell.org/?hoogle=(%3C**%3E) -- https://hackage.haskell.org/package/base-4.14.1.0/docs/Control-Applicative.html#v:-60--42--42--62-
07:26:21 <guest1216> I saw https://hackage.haskell.org/package/base-4.14.1.0/docs/src/GHC.Base.html#%3C%7C%3E will <|> run both actions?
07:26:27 rayyyy joins (~nanoz@gateway/tor-sasl/nanoz)
07:26:49 <guest1216> or just run the first action and return?
07:27:14 × dnlkrgr quits (~dnlkrgr@HSI-KBW-46-223-1-192.hsi.kabel-badenwuerttemberg.de) (Ping timeout: 260 seconds)
07:27:33 <sshine> > Just 1 <|> error "we can try"
07:27:36 <lambdabot> Just 1
07:27:39 <iqubic> Ah see, that one's a bit more tricky.
07:28:26 danvet joins (~Daniel@2a02:168:57f4:0:efd0:b9e5:5ae6:c2fa)
07:28:33 <guest1216> how we describe it? run the first successful computation and return?
07:28:51 <sshine> guest1216, we describe it like this: https://hackage.haskell.org/package/base-4.14.1.0/docs/src/GHC.Base.html#line-1046
07:28:59 <guest1216> > Nothing <|> Just 1
07:29:03 <lambdabot> Just 1
07:29:11 dhouthoo joins (~dhouthoo@ptr-eitgbj2w0uu6delkbrh.18120a2.ip6.access.telenet.be)
07:29:38 <iqubic> <|> requires an Alternative instance. Those are Monads that can fail, for some definition of fail. If the first action succeeds, then that action will be returned and the second action will never be run. If the first action fails, then the second action's result will be returned, regardless of if the second action succeeded or faild.
07:29:46 <guest1216> I mean with words...
07:29:59 <iqubic> I did just describe it with words
07:30:16 mapperr joins (~mapperr@vmi389916.contaboserver.net)
07:30:24 <guest1216> sorry, I mean sshine 's link...
07:30:43 <sshine> guest1216, "pick the first one. if it fails, pick the second one"
07:30:50 <guest1216> sshine: right
07:31:10 <iqubic> sshine, that's a good way to phrase it.
07:32:20 <iqubic> guest1216: Because Alternative is a typeclass, what it means to fail and to succeed can and will be different for each Applicative.
07:32:55 <iqubic> For example, Maybe fails when a Nothing value is given. Either fails when a Left value is given.
07:33:09 <guest1216> right
07:33:46 <iqubic> IO fails when an exception is thrown.
07:34:22 <iqubic> But in general, <|> is will pick the first one. If that fails, pick the second one instead.
07:34:35 <guest1216> "<sshine> guest1216, combinatory parsers are often written using applicative style." should Parsec inhence Applicative?
07:34:52 brodie_ joins (~brodie@207.53.253.137)
07:34:52 <guest1216> inherit
07:35:07 christo joins (~chris@81.96.113.213)
07:35:29 × brodie_ quits (~brodie@207.53.253.137) (Client Quit)
07:36:32 <iqubic> https://hackage.haskell.org/package/parsec-3.1.14.0/docs/Text-Parsec.html#t:ParsecT
07:36:39 brodie_ joins (~brodie@207.53.253.137)
07:36:57 <guest1216> getLine <|> (print "failed to input"), if the input is interupt, will it print this?
07:37:17 <iqubic> If you look at the list of instances you'll see "Applicative (ParsecT s u m)" This shows that a parser is an applicative.
07:37:19 <guest1216> IO action getLine failed by C-c
07:37:33 <iqubic> Yes. That's correct.
07:37:52 <iqubic> If you use C-c, then the getLine will fail, causing the other effect to be used.
07:39:07 <guest1216> but I don't see some functions defined in Application are implemented in Parsec, like many, I saw there's many1
07:40:39 merijn joins (~merijn@83-160-49-249.ip.xs4all.nl)
07:40:54 × Barras21 quits (~Barras2@184.75.221.35) (Ping timeout: 268 seconds)
07:41:09 <iqubic> many is defined in Control.Applicative, and will work for all Alternatives. Since a Parsec Parser is an Alternative, it can just use the definition of many as given in Control.Applicative.
07:41:10 <iqubic> https://hackage.haskell.org/package/base-4.14.1.0/docs/Control-Applicative.html#v:many
07:41:51 <guest1216> iqubic: main = getLine <|> (print "interrupt") Expected type: IO String Actual type: IO ()
07:42:13 <iqubic> Right. The issue there is with the type of <|>
07:42:21 <iqubic> :t (<|>)
07:42:23 <lambdabot> Alternative f => f a -> f a -> f a
07:43:17 <guest1216> getLine :: IO String, print "..." :: IO ()
07:43:22 <iqubic> Right.
07:43:27 <guest1216> so how we can fix it?
07:43:32 <iqubic> And those two have different types.
07:43:39 <iqubic> I'm not sure how to fix it.
07:43:44 <guest1216> ...
07:44:28 jonathanx joins (~jonathan@dyn-8-sc.cdg.chalmers.se)
07:45:00 <guest1216> what about main = (getLine >>= print) <|> (print "failed")
07:45:49 <iqubic> That won't work, because you need to give print an argument.
07:46:01 skapazzo joins (~skapazzo@host-80-21-130-163.business.telecomitalia.it)
07:46:01 <iqubic> Other than that, it should work.
07:46:43 <guest1216> iqubic: it worked
07:46:49 <iqubic> :t print
07:46:50 <lambdabot> Show a => a -> IO ()
07:47:56 <guest1216> iqubic: I input ok, and it print ok, I use C-c in terminal, it print "failed"
07:48:07 <iqubic> That's what it should do.
07:48:17 <iqubic> Ah. I see. That's right.
07:48:35 <guest1216> (getLine >>= print) :: IO ()
07:48:42 <guest1216> print "failed" :: IO ()
07:48:44 <iqubic> Right, that's correct.
07:48:59 <Kronic> failed successfully
07:49:29 <guest1216> <|> is wonderful, it can handle IO Exception
07:49:52 <guest1216> what about other Exception like read/write file?
07:50:26 <iqubic> <|> will handle any IO exception.
07:50:27 <guest1216> Exception in other language like python and kotlin, they use try/except to handle
07:50:49 <guest1216> but all runtime exceptions are IO exception?
07:50:53 <iqubic> There are functions that work like try/except in Haskell too.
07:51:14 <iqubic> guest1216: Yes. All runtime exceptions are IO exceptions.
07:51:51 <guest1216> iqubic: wait a sec, must <|> be implement for every application or monad?
07:52:00 <iqubic> No. That's not true.
07:52:09 × heatsink quits (~heatsink@2600:1700:bef1:5e10:2c47:ef5:a455:237) (Remote host closed the connection)
07:52:33 <guest1216> iqubic: that's sad, so we can't use <|> to handle those exceptions if they don't implement it...
07:52:40 × Varis quits (~Tadas@unaffiliated/varis) (Remote host closed the connection)
07:53:25 <idnar> many Applicatives are Alternative, but not all
07:53:50 <guest1216> what is Alternative? related to Monad?
07:54:03 <guest1216> Arrow?
07:54:35 <iqubic> Alternative is the type class that provides the (<|>) operator.
07:54:46 <guest1216> ok
07:54:47 <idnar> :t getLine <|> (print "interrupt")
07:54:49 <lambdabot> error:
07:54:49 <lambdabot> • Couldn't match type ‘()’ with ‘[Char]’
07:54:49 <lambdabot> Expected type: IO String
07:54:49 <iqubic> :t (<|>)
07:54:51 <lambdabot> Alternative f => f a -> f a -> f a
07:55:02 <iqubic> Note the Alternative constraint.
07:55:03 <idnar> :t void getLine <|> print "interrupt"
07:55:07 <lambdabot> IO ()
07:56:21 <idnar> ^ void discards the result making the types match up; not sure if that's what you wanted
07:56:43 × rayyyy quits (~nanoz@gateway/tor-sasl/nanoz) (Ping timeout: 240 seconds)
07:57:57 <idnar> :t void -- basically `fmap (const ())`
07:57:59 <lambdabot> Functor f => f a -> f ()
07:59:26 chele joins (~chele@ip5b416ea2.dynamic.kabel-deutschland.de)
08:02:26 × brodie_ quits (~brodie@207.53.253.137) (Quit: brodie_)
08:05:04 × da39a3ee5e6b4b0d quits (~da39a3ee5@2403:6200:8876:cecf:a55b:90cf:1ae1:4d7b) (Quit: My MacBook has gone to sleep. ZZZzzz…)
08:05:11 Varis joins (~Tadas@unaffiliated/varis)
08:09:48 <guest1216> how you pronounce "<>"?
08:10:10 <guest1216> there're so many symbols, I don't know their name by English
08:10:31 <opqdonut> I think it tries to be "diamond" (from math notation), but I pronounce it mappend (since that's the old name for it :)
08:10:36 × Rudd0 quits (~Rudd0@185.189.115.98) (Ping timeout: 240 seconds)
08:10:36 <guest1216> like <*>, someone call it ap, or apply
08:10:50 × nineonine quits (~nineonine@S01061cabc0b095f3.vf.shawcable.net) (Remote host closed the connection)
08:11:00 <opqdonut> yeah because that's the old name for it :)
08:11:08 <opqdonut> :t ap
08:11:10 <lambdabot> Monad m => m (a -> b) -> m a -> m b
08:11:11 <opqdonut> :t <*>
08:11:13 <lambdabot> error: parse error on input ‘<*>’
08:11:18 <opqdonut> :t (<*>)
08:11:20 <lambdabot> Applicative f => f (a -> b) -> f a -> f b
08:11:22 <opqdonut> (from before Applicative)
08:11:48 <guest1216> but that ap is on monad...
08:11:58 <guest1216> type restri...
08:12:20 <guest1216> restricted
08:13:38 michalz joins (~user@185.246.204.52)
08:14:26 nineonine joins (~nineonine@S01061cabc0b095f3.vf.shawcable.net)
08:14:52 cfricke joins (~cfricke@unaffiliated/cfricke)
08:16:45 × Cthalupa quits (~cthulhu@47.186.47.75) (Ping timeout: 240 seconds)
08:17:23 bitmagie joins (~Thunderbi@200116b8065b450041174f8fe0224a0b.dip.versatel-1u1.de)
08:17:37 <guest1216> https://hackage.haskell.org/package/base-4.14.1.0/docs/src/GHC.Base.html#%3C%2A%2A%3E
08:17:39 Cthalupa joins (~cthulhu@47.186.47.75)
08:17:49 <guest1216> (<**>) = liftA2 (\a f -> f a)
08:18:12 <guest1216> > :t (<**>)
08:18:15 <lambdabot> <hint>:1:1: error: <hint>:1:1: error: parse error on input ‘:’
08:18:33 <iqubic> That's not what <**> does.
08:18:35 × bitmagie quits (~Thunderbi@200116b8065b450041174f8fe0224a0b.dip.versatel-1u1.de) (Client Quit)
08:18:44 <iqubic> @src (<**>)
08:18:44 <lambdabot> (<**>) = liftA2 (flip ($))
08:19:08 × nineonine quits (~nineonine@S01061cabc0b095f3.vf.shawcable.net) (Ping timeout: 268 seconds)
08:19:12 <guest1216> but I saw flip (<*>) has the same type signature with <**>
08:19:29 <guest1216> why not define <**> = flip <*>
08:19:38 <iqubic> Not sure, but that's not what it does.
08:19:49 da39a3ee5e6b4b0d joins (~da39a3ee5@49.228.254.151)
08:20:16 <guest1216> (<**>) :: Applicative f => f a -> f (a -> b) -> f b
08:20:28 <guest1216> flip (<*>) :: Applicative f => f a -> f (a -> b) -> f b
08:21:39 <guest1216> in this link https://hackage.haskell.org/package/base-4.14.1.0/docs/src/GHC.Base.html#%3C%2A%2A%3E , (<**>) = liftA2 (\a f -> f a), -- Don't use $ here, see the note at the top of the page
08:21:47 jackgassett joins (~jackgasse@84.39.117.57)
08:21:51 × howdoi quits (uid224@gateway/web/irccloud.com/x-yfmvmpnsjbxmilas) (Quit: Connection closed for inactivity)
08:22:25 <guest1216> iqubic: so where this (<**>) = liftA2 (flip ($)) come from?
08:22:31 <iqubic> IDK.
08:22:38 <guest1216> ...
08:22:58 <c_wraith> Interestingly, that note will no longer be accurate in the future.
08:23:12 <c_wraith> GHC is adding support for making ($)'s type non-magical
08:23:42 <guest1216> c_wraith: what is non-magical?
08:23:56 <guest1216> or what is $'s magical
08:24:14 <c_wraith> $ has a typing hack to allow impredicative instantiation of its tyvars
08:24:54 <c_wraith> But the ImpredicativeTypes extension is getting reworked to actually allow GHC to express and use that type without having special hacks
08:25:52 × jneira quits (501e6453@gateway/web/cgi-irc/kiwiirc.com/ip.80.30.100.83) (Ping timeout: 260 seconds)
08:25:52 <guest1216> c_wraith: does <**> == flip <*>?
08:26:00 <c_wraith> no
08:26:11 × Sgeo quits (~Sgeo@ool-18b98aa4.dyn.optonline.net) (Read error: Connection reset by peer)
08:26:12 <guest1216> ok
08:27:01 mbomba joins (~mbomba@bras-base-toroon2719w-grc-53-142-114-5-26.dsl.bell.ca)
08:27:06 <idnar> guest1216: the "side effects" are sequenced differently to flip (<*>)
08:28:07 <idnar> guest1216: https://pb.codehash.net/e56814fbe97b42fa98190172239435b2
08:30:58 <c_wraith> > let f = reverse <$ modify (+1) ; a = "hello" <$ modify (*2) in runState (f <*> a) 3
08:31:01 <lambdabot> ("olleh",8)
08:31:09 <c_wraith> > let f = reverse <$ modify (+1) ; a = "hello" <$ modify (*2) in runState (a <**> f) 3
08:31:12 <lambdabot> ("olleh",7)
08:33:38 <idnar> x <*> y = do f <- x; a <- y; pure (f x)
08:33:38 <idnar> x <**> y = do a <- x; f <- y; pure (f x)
08:34:31 <guest1216> idnar: <$ or $> will run the action?
08:34:38 × ddere quits (uid110888@gateway/web/irccloud.com/x-skgqfoexthrhsgmv) (Quit: Connection closed for inactivity)
08:35:41 <guest1216> id <$ print "foo" will print foo and get IO (a -> a)?
08:36:24 <idnar> yeah
08:36:26 <idnar> :t id <$ print "foo"
08:36:28 <lambdabot> IO (a -> a)
08:37:11 <guest1216> I'd like to say put an id function into an IO context... but I don't know if it's properly
08:37:15 × danso quits (~dan@69-165-210-185.cable.teksavvy.com) (Quit: WeeChat 2.9)
08:37:23 <idnar> x <$ a = const x <$> a
08:37:30 <guest1216> because IO id is not existed...
08:37:39 <c_wraith> :t pure id
08:37:41 <lambdabot> Applicative f => f (a -> a)
08:38:11 <guest1216> :t return id
08:38:12 <lambdabot> Monad m => m (a -> a)
08:43:34 <guest1216> idnar: https://hackage.haskell.org/package/base-4.14.1.0/docs/src/GHC.Base.html#%3C%24
08:44:07 <guest1216> <$ = fmap . const
08:44:56 <guest1216> x <$ a = const x <$> a
08:45:31 × isovector1 quits (~isovector@172.103.216.166.cable.tpia.cipherkey.com) (Remote host closed the connection)
08:45:37 <guest1216> I don't understand how this transformed
08:46:23 <guest1216> <$ x = (fmap . const) x
08:46:42 <guest1216> x <$ a = (fmap . const) x a
08:47:54 <joel135> x <$ a
08:47:57 <idnar> \x a -> const x <$> a = \x a -> fmap (const x) a = \x -> fmap (const x) = fmap . const
08:47:58 <joel135> = (fmap . const) x a
08:48:08 <guest1216> (fmap . const) x a == fmap (const x) a?
08:48:25 <joel135> yes
08:49:18 <joel135> x <$ a = (fmap . const) x a = fmap (const x) a = (const x) <$> a
08:51:36 nineonine joins (~nineonine@S01061cabc0b095f3.vf.shawcable.net)
08:51:47 <srk> ezzieyguywuf: how's your cad? :) yesterday I've stumbled on https://wiki.haskell.org/SceneGraph
08:52:23 × cfricke quits (~cfricke@unaffiliated/cfricke) (Quit: WeeChat 3.0)
08:52:34 heatsink joins (~heatsink@2600:1700:bef1:5e10:2c47:ef5:a455:237)
08:52:54 coot joins (~coot@37.30.50.101.nat.umts.dynamic.t-mobile.pl)
08:53:06 <guest1216> it's weird to composte on binary functions
08:53:39 <guest1216> I thought there's a function work on binary, like >=> ?
08:53:41 × nineonine quits (~nineonine@S01061cabc0b095f3.vf.shawcable.net) (Remote host closed the connection)
08:54:18 mounty joins (~mounty@210.1.196.133)
08:54:18 nineonine joins (~nineonine@S01061cabc0b095f3.vf.shawcable.net)
08:54:22 <guest1216> and (sort .) . (<>)
08:54:31 <guest1216> weired (.) usage
08:55:43 <joel135> :t (.).(.).(.)
08:55:44 <lambdabot> (b -> c) -> (a1 -> a2 -> a3 -> b) -> a1 -> a2 -> a3 -> c
08:56:16 <guest1216> wait a sec, is . fmap?
08:56:34 <guest1216> fmap f g == f . g
08:56:37 <guest1216> ?
08:56:42 mputz joins (~Thunderbi@dslb-088-064-063-125.088.064.pools.vodafone-ip.de)
08:56:42 <joel135> not really
08:56:50 cfricke joins (~cfricke@unaffiliated/cfricke)
08:57:22 × heatsink quits (~heatsink@2600:1700:bef1:5e10:2c47:ef5:a455:237) (Ping timeout: 260 seconds)
08:57:27 <joel135> but it is related to the hom functor, so yes
08:58:11 <idnar> :t fmap @((->) r)
08:58:13 <lambdabot> error: parse error on input ‘->’
08:58:29 <idnar> % :t fmap @((->) r)
08:58:30 <yahb> idnar: ; <interactive>:1:13: error: Not in scope: type variable `r'
08:58:55 <idnar> % :t fmap @((->) Int)
08:58:56 <yahb> idnar: (a -> b) -> (Int -> a) -> Int -> b
08:59:00 × nineonine quits (~nineonine@S01061cabc0b095f3.vf.shawcable.net) (Ping timeout: 265 seconds)
08:59:15 <joel135> :t fmap :: (b -> c) -> (a -> b) -> (a -> c)
08:59:17 <lambdabot> (b -> c) -> (a -> b) -> a -> c
09:00:15 brodie_ joins (~brodie@207.53.253.137)
09:00:16 <guest1216> "<joel135> :t (.).(.).(.)" Total Recall 1990?
09:00:36 <joel135> > ((\x -> x^2) <$> (\x -> x + 1)) 5
09:00:40 <lambdabot> 36
09:00:53 × brodie_ quits (~brodie@207.53.253.137) (Client Quit)
09:01:00 <joel135> i just entered something random and observed what happened
09:01:20 m0rphism joins (~m0rphism@HSI-KBW-085-216-104-059.hsi.kabelbw.de)
09:01:23 nyaomin joins (~naomi@cpe-74-75-6-125.maine.res.rr.com)
09:01:47 × nyaomi quits (~naomi@2604:6000:1509:c86e:c878:29ff:fedf:ce89) (Ping timeout: 246 seconds)
09:02:07 × hnOsmium0001 quits (uid453710@gateway/web/irccloud.com/x-pdlgiucbwprtfcne) (Quit: Connection closed for inactivity)
09:02:48 × merijn quits (~merijn@83-160-49-249.ip.xs4all.nl) (Ping timeout: 256 seconds)
09:03:45 <zzz> where can i learn the differences between the various hashmap implementations? i'm kind of getting lost on hackage
09:04:54 <joel135> :t pure :: a -> b -> a
09:04:56 <lambdabot> a -> b -> a
09:09:41 <idnar> zzz: unordered-containers is almost certainly what you want; as for Lazy vs Strict, it depends on how you consume it
09:10:24 olligobber joins (~olligobbe@unaffiliated/olligobber)
09:10:28 <idnar> but probably Strict when in doubt
09:12:29 × quinn quits (~quinn@c-73-223-224-163.hsd1.ca.comcast.net) (Quit: ZNC 1.8.1 - https://znc.in)
09:12:48 thc202 joins (~thc202@unaffiliated/thc202)
09:12:51 <guest1216> this pure looks like const!
09:13:01 <guest1216> :t const
09:13:03 <lambdabot> a -> b -> a
09:14:09 <dminuoso> guest1216: Indeed it is.
09:14:31 <dminuoso> guest1216: The rationale is, under the reader effect a "pure value" is one that doesn't depend on the environmnet. :p
09:15:08 Gurkenglas joins (~Gurkengla@unaffiliated/gurkenglas)
09:16:07 <z0_> :t pure const
09:16:09 <lambdabot> Applicative f => f (a -> b -> a)
09:16:43 <dminuoso> Similar to how under the state environment a pure value is one that neither depends on state nor modifies it.
09:16:49 <dminuoso> *under the state effect
09:17:51 <z0_> :t arr pure
09:17:53 <lambdabot> (Arrow a1, Applicative f) => a1 a2 (f a2)
09:18:50 × christo quits (~chris@81.96.113.213) (Remote host closed the connection)
09:18:58 quinn joins (~quinn@c-73-223-224-163.hsd1.ca.comcast.net)
09:19:23 × mbomba quits (~mbomba@bras-base-toroon2719w-grc-53-142-114-5-26.dsl.bell.ca) (Quit: WeeChat 3.0)
09:20:54 <guest1216> pe :: Parser String
09:21:16 <guest1216> pe = {do; string "server="; x <- many1 $ noneOf ""; return x}
09:21:37 <guest1216> I don't understand why it's many1 $ noneOf?
09:21:59 <guest1216> why there's a simple id function that can return the rest matched ?
09:22:21 <guest1216> parse pe "" "server=abc" == Right "abc"
09:22:58 wonko7 joins (~wonko7@2a01:e35:2ffb:7040:4535:f480:7dff:b3b5)
09:23:04 <guest1216> like pe = { do; string "server="; x <- id; return x}
09:23:30 <guest1216> this pattern matching in do-notation, is really weird to make sence
09:24:29 <dminuoso> 10:21:16 guest1216 | pe = {do; string "server="; x <- many1 $ noneOf ""; return x}
09:24:31 <dminuoso> This is better written as
09:24:44 dnlkrgr joins (~dnlkrgr@200116b82cc2d2006002e86846a6fe82.dip.versatel-1u1.de)
09:25:25 <dminuoso> string "server=" >> anyChar
09:25:43 <dminuoso> First, the do-notation is not useful. Second, `x <- foo; return x` is the same as `foo`
09:25:51 jules000 joins (~jules000@217-62-97-211.cable.dynamic.v4.ziggo.nl)
09:26:00 <dminuoso> Or, `string "server=" >> many1 anyChar
09:26:14 <dminuoso> `noneOf ""` is a really quicky way of saying anyChar
09:27:43 <guest1216> dminuoso: many1 is same to many here?
09:28:09 <guest1216> many in Applicative, and parser is an instance of it
09:28:34 sh9 joins (~sh9@softbank060116136158.bbtec.net)
09:28:56 nineonine joins (~nineonine@S01061cabc0b095f3.vf.shawcable.net)
09:29:16 merijn joins (~merijn@83-160-49-249.ip.xs4all.nl)
09:30:00 raichoo joins (~raichoo@dslb-092-073-197-080.092.073.pools.vodafone-ip.de)
09:30:13 <guest1216> dminuoso: string "server=" >>= anyChar compilation failed...
09:30:36 gehmehgeh joins (~ircuser1@gateway/tor-sasl/gehmehgeh)
09:31:40 <guest1216> it missing something in the do-notation of Parser String, like Reader
09:32:25 <guest1216> you don't need to point the parameter to the function in the do notation
09:33:58 × hiroaki quits (~hiroaki@ip4d16fa3b.dynamic.kabel-deutschland.de) (Ping timeout: 256 seconds)
09:34:05 × nineonine quits (~nineonine@S01061cabc0b095f3.vf.shawcable.net) (Ping timeout: 240 seconds)
09:34:25 <joel135> what do you import to get Parser?
09:34:36 Katarushisu joins (~Katarushi@cpc149726-finc20-2-0-cust203.4-2.cable.virginm.net)
09:36:16 <guest1216> import Text.Parsec Text.Parsec.String Text.Parsec.Char Text.Parsec.Combinator
09:36:24 <joel135> ok
09:36:30 <guest1216> I don't know why they're not in one module...
09:38:15 <guest1216> :i Parser
09:38:38 LKoen joins (~LKoen@29.248.88.92.rev.sfr.net)
09:38:52 rayyyy joins (~nanoz@gateway/tor-sasl/nanoz)
09:40:28 <guest1216> joel135: it seems Parser is defined in Text.Parsec.String
09:40:47 <joel135> import Text.ParserCombinators.Parsec works too
09:40:52 <guest1216> I didn't find it in Text.Parsec neither Text.Parsec.Combinator
09:41:48 × MOSCOS quits (~MOSCOS@122.54.107.175) (Remote host closed the connection)
09:41:55 <joel135> string "server=" >> anyChar works
09:42:11 MOSCOS joins (~MOSCOS@122.54.107.175)
09:42:14 ubert joins (~Thunderbi@p200300ecdf3514a6e6b318fffe838f33.dip0.t-ipconnect.de)
09:42:28 <guest1216> joel135: https://hackage.haskell.org/package/parsec-3.1.14.0/docs/Text-ParserCombinators-Parsec.html
09:42:52 <guest1216> there's no type constructor Parser defined there
09:43:15 <guest1216> Parser is defined with ParserT IIRC
09:43:50 <guest1216> oh, my fault
09:44:13 <guest1216> I thougt it was string "server=" >>= anyChar...
09:46:06 jamm joins (~jamm@unaffiliated/jamm)
09:46:14 × star_cloud quits (~star_clou@ec2-34-220-44-120.us-west-2.compute.amazonaws.com) (Remote host closed the connection)
09:46:32 star_cloud joins (~star_clou@ec2-34-220-44-120.us-west-2.compute.amazonaws.com)
09:46:33 × Katarushisu quits (~Katarushi@cpc149726-finc20-2-0-cust203.4-2.cable.virginm.net) (Quit: The Lounge - https://thelounge.chat)
09:46:44 hiroaki joins (~hiroaki@ip4d168e73.dynamic.kabel-deutschland.de)
09:47:15 Katarushisu joins (~Katarushi@cpc149726-finc20-2-0-cust203.4-2.cable.virginm.net)
09:47:32 × dnlkrgr quits (~dnlkrgr@200116b82cc2d2006002e86846a6fe82.dip.versatel-1u1.de) (Ping timeout: 260 seconds)
09:47:50 dnlkrgr joins (~dnlkrgr@200116b82cc2d200c13fecb4e1cb8dd6.dip.versatel-1u1.de)
09:48:29 <guest1216> parse (string "server=" >> (many1 $ anyChar)) "" "server=abc" == Right "abc"
09:50:53 <joel135> yes
09:50:58 Franciman joins (~francesco@host-82-54-12-32.retail.telecomitalia.it)
09:51:49 <guest1216> joel135: is there any other way to do this?
09:52:04 <guest1216> with parser function
09:52:12 <joel135> no idea, i don't know any practical haskell
09:53:43 heatsink joins (~heatsink@2600:1700:bef1:5e10:d4b7:b7ee:3e4a:413d)
09:56:02 polyrain joins (~polyrain@2001:8003:e501:6901:bd28:67b4:ff35:18e)
09:56:20 × star_cloud quits (~star_clou@ec2-34-220-44-120.us-west-2.compute.amazonaws.com) (Excess Flood)
09:57:23 × Katarushisu quits (~Katarushi@cpc149726-finc20-2-0-cust203.4-2.cable.virginm.net) (Quit: The Lounge - https://thelounge.chat)
09:57:37 star_cloud joins (~star_clou@ec2-34-220-44-120.us-west-2.compute.amazonaws.com)
09:57:39 <guest1216> https://hackage.haskell.org/package/parsec-3.1.14.0/docs/src/Text.Parsec.Prim.html#ParsecT
09:58:14 × heatsink quits (~heatsink@2600:1700:bef1:5e10:d4b7:b7ee:3e4a:413d) (Ping timeout: 264 seconds)
09:58:32 <guest1216> the ParsecT definition is really complex
09:58:36 Katarushisu joins (~Katarushi@cpc149726-finc20-2-0-cust203.4-2.cable.virginm.net)
10:00:35 Rudd0 joins (~Rudd0@185.189.115.103)
10:01:32 <dminuoso> guest1216: It's just a continuation implementation, nothing fancy.
10:02:07 <dminuoso> You can read this as "A parser can be successful and consume stuff (it then uses the first continuation)"
10:02:22 <dminuoso> Or it "can be unsuccessful and have consumed stuff (it then uses the next continuation)"
10:02:24 <guest1216> dminuoso: continuation itself is complex
10:02:38 <dminuoso> It can be hairy to write, but there's not much about them.
10:02:39 <guest1216> and that a bunch of stuff on continuation
10:02:51 <dminuoso> It shouldnt matter to you, as its just an implemnetation detail
10:03:00 <dminuoso> You will never interact with that
10:04:01 <guest1216> continuation passing style, double CPS, callCC, ContT, yoneda lemma, Pierce's law, blablablah
10:04:13 <guest1216> they're all connected
10:04:14 × dnlkrgr quits (~dnlkrgr@200116b82cc2d200c13fecb4e1cb8dd6.dip.versatel-1u1.de) (Ping timeout: 264 seconds)
10:04:23 × rayyyy quits (~nanoz@gateway/tor-sasl/nanoz) (Ping timeout: 240 seconds)
10:10:20 nineonine joins (~nineonine@S01061cabc0b095f3.vf.shawcable.net)
10:12:46 × z0_ quits (~z0@188.251.84.23) (Quit: leaving)
10:14:46 × nineonine quits (~nineonine@S01061cabc0b095f3.vf.shawcable.net) (Ping timeout: 256 seconds)
10:15:58 polyrain_ joins (~polyrain@2001:8003:e501:6901:ed2e:bd10:deae:edc6)
10:17:16 × toorevitimirp quits (~tooreviti@117.182.180.221) (Ping timeout: 240 seconds)
10:17:32 × polyrain quits (~polyrain@2001:8003:e501:6901:bd28:67b4:ff35:18e) (Ping timeout: 268 seconds)
10:19:18 × olligobber quits (~olligobbe@unaffiliated/olligobber) (Ping timeout: 256 seconds)
10:20:22 toorevitimirp joins (~tooreviti@117.182.183.95)
10:21:04 wroathe joins (~wroathe@c-68-54-25-135.hsd1.mn.comcast.net)
10:23:34 × da39a3ee5e6b4b0d quits (~da39a3ee5@49.228.254.151) (Quit: My MacBook has gone to sleep. ZZZzzz…)
10:25:37 dhil joins (~dhil@78.156.97.38)
10:26:06 × wroathe quits (~wroathe@c-68-54-25-135.hsd1.mn.comcast.net) (Ping timeout: 256 seconds)
10:26:35 p-core joins (~Thunderbi@2001:718:1e03:5128:2ab7:7f35:48a1:8515)
10:27:44 wood_ghost joins (1753e0c7@23.83.224.199.16clouds.com)
10:29:29 × wood_ghost quits (1753e0c7@23.83.224.199.16clouds.com) (Remote host closed the connection)
10:30:29 × guest1216 quits (~user@49.5.6.87) (Ping timeout: 268 seconds)
10:34:25 xsperry joins (~as@unaffiliated/xsperry)
10:34:27 × jules000 quits (~jules000@217-62-97-211.cable.dynamic.v4.ziggo.nl) (Remote host closed the connection)
10:34:38 solonarv joins (~solonarv@astrasbourg-157-1-27-135.w90-40.abo.wanadoo.fr)
10:34:53 jules000 joins (~jules000@ip-195-169-220-88.eduvpn.ru.nl)
10:35:57 DavidEichmann joins (~david@62.110.198.146.dyn.plus.net)
10:37:19 dnlkrgr joins (~dnlkrgr@ip-109-42-0-140.web.vodafone.de)
10:39:20 <siraben> Is there a small implementation Parsec for learning how it works?
10:40:38 fendor joins (~fendor@178.165.130.183.wireless.dyn.drei.com)
10:40:45 <siraben> The Parsec paper doesn't have the same s u m a implementation
10:41:02 <srk> siraben: http://dev.stephendiehl.com/fun/002_parsers.html can be helpful
10:41:19 <siraben> srk: thanks
10:41:32 da39a3ee5e6b4b0d joins (~da39a3ee5@2403:6200:8876:cecf:313a:ef0a:c021:651e)
10:45:00 <siraben> I wish he completed that tutorial, would have been enlightening, the best from scratch implementation of a mini Haskell I've seen is https://crypto.stanford.edu/~blynn/compiler/
10:46:31 SomeoneSerge joins (~someone-s@37.120.212.76)
10:48:54 × zar quits (~zar@fw1.ciirc.cvut.cz) (Ping timeout: 272 seconds)
10:48:58 × dnlkrgr quits (~dnlkrgr@ip-109-42-0-140.web.vodafone.de) (Remote host closed the connection)
10:49:33 <xerox_> is there a way to pattern match a singleton Data.Set.Set directly?
10:49:56 <siraben> xerox_: you could use ViewPatterns
10:50:13 <siraben> foo (S.elems -> [x]) = x
10:50:15 <xerox_> but I'd need the author to have given me one right? I couldn't find one in the docs
10:50:22 <xerox_> ah no you mean something else
10:50:56 <xerox_> right, I mean I wonder if they defined one of those things that you can pattern match on and it does the right thing using the internal structure
10:51:01 siraben sent a long message: < https://matrix.org/_matrix/media/r0/download/matrix.org/odsnDYgqSkCJutHETFHHASyK/message.txt >
10:51:06 <siraben> this example compiles
10:51:20 <siraben> ah using the internal structure, I'm not aware
10:51:28 <xerox_> I think Sequence does it?
10:51:44 <xerox_> maybe it doesn't
10:51:54 amerigo joins (uid331857@gateway/web/irccloud.com/x-rgqindfclfxyvhfd)
10:52:00 <siraben> Yeah I was thinking about how sequence does it, checking the docs
10:52:19 <xerox_> I'm thinking of these https://downloads.haskell.org/ghc/latest/docs/html/users_guide/glasgow_exts.html?highlight=pattern#extension-PatternSynonyms
10:52:25 <siraben> xerox_: they use pattern synonyms + viewpatterns
10:52:29 <siraben> https://downloads.haskell.org/~ghc/latest/docs/html/libraries/containers-0.6.2.1/src/Data-Sequence-Internal.html#%7C%3E
10:52:33 <siraben> pattern (:<|) :: a -> Seq a -> Seq a
10:52:35 × rprije quits (~rprije@14-203-203-69.tpgi.com.au) (Ping timeout: 265 seconds)
10:52:48 <merijn> xerox_: You can just have a guard on "S.size == 1"? :p
10:53:12 <xerox_> oh now I remember, there's something like overloaded strings but for [] ?
10:53:48 <xerox_> there we go https://downloads.haskell.org/ghc/latest/docs/html/users_guide/glasgow_exts.html?highlight=overloaded%20lists#extension-OverloadedLists
10:54:17 geowiesnot joins (~user@87-89-181-157.abo.bbox.fr)
10:54:23 heatsink joins (~heatsink@2600:1700:bef1:5e10:69bd:5769:3542:c1a2)
10:54:31 <merijn> xerox_: That doesn't help you
10:54:37 <xerox_> drats!
10:55:04 <xerox_> I thought it did since it desugars with toList and I want to match [x]
10:55:20 <siraben> xerox_: you have to use viewpatterns at least or pattern synonyms if you want to make it prettier
10:56:00 <siraben> reminds me of code I wrote for today's AoC problem
10:56:01 <siraben> (head $ IS.elems $ sols IS.\ solset, (l', sols))
10:56:02 <siraben> lol
10:56:30 <merijn> siraben: IS.minView is both shorter and safer then "head $ IS.elems" :p
10:56:40 <xerox_> yeah it works!
10:56:58 <siraben> merijn: nice!
10:57:06 <xerox_> I had: sieve ((val,[name]):rest) = (val,name) : sieve [ (v,delete name names) | (v,names) <- rest ]
10:57:27 <xerox_> now I can change to S.delete and with OverloadedLists [name] matches the singleton set!
10:57:41 boxscape joins (54a35b08@gateway/web/cgi-irc/kiwiirc.com/ip.84.163.91.8)
10:58:28 __monty__ joins (~toonn@unaffiliated/toonn)
10:59:17 × heatsink quits (~heatsink@2600:1700:bef1:5e10:69bd:5769:3542:c1a2) (Ping timeout: 260 seconds)
10:59:51 × mputz quits (~Thunderbi@dslb-088-064-063-125.088.064.pools.vodafone-ip.de) (Quit: mputz)
11:00:42 × geowiesnot quits (~user@87-89-181-157.abo.bbox.fr) (Ping timeout: 268 seconds)
11:01:15 christo joins (~chris@81.96.113.213)
11:04:55 mputz joins (~Thunderbi@dslb-088-064-063-125.088.064.pools.vodafone-ip.de)
11:05:40 <unclechu> hey, can i see a list of dependency versions that `cabal` uses to build a package?
11:06:18 <tomsmeding> unclechu: `cabal freeze`, then look in cabal.project.freeze ?
11:06:25 <unclechu> it seems `cabal exec -- ghc-pkg list` does show the versions it’s going to use for a build
11:06:32 <unclechu> tomsmeding: i’ll try, thanks
11:06:45 royal_screwup21 joins (52254809@gateway/web/cgi-irc/kiwiirc.com/ip.82.37.72.9)
11:07:08 <tomsmeding> (though note that that freeze file will prevent cabal from choosing a different build plan in the future, so remove it if you don't want that)
11:07:46 <__monty__> This also sounds like something cabal-plan might help with.
11:08:02 livvy joins (~livvy@gateway/tor-sasl/livvy)
11:09:47 <unclechu> tomsmeding: yeah, i realize it. it worked for me, thanks!
11:10:09 <unclechu> __monty__: is it a separate application?
11:10:54 × royal_screwup21 quits (52254809@gateway/web/cgi-irc/kiwiirc.com/ip.82.37.72.9) (Client Quit)
11:11:17 royal_screwup21 joins (52254809@gateway/web/cgi-irc/kiwiirc.com/ip.82.37.72.9)
11:15:31 jmchael_ joins (~jmchael@87.112.46.194)
11:18:33 × royal_screwup21 quits (52254809@gateway/web/cgi-irc/kiwiirc.com/ip.82.37.72.9) (Quit: Connection closed)
11:18:57 royal_screwup21 joins (52254809@gateway/web/cgi-irc/kiwiirc.com/ip.82.37.72.9)
11:22:17 geowiesnot joins (~user@i15-les02-ix2-87-89-181-157.sfr.lns.abo.bbox.fr)
11:23:45 cosimone joins (~cosimone@2001:b07:ae5:db26:d849:743b:370b:b3cd)
11:24:52 × royal_screwup21 quits (52254809@gateway/web/cgi-irc/kiwiirc.com/ip.82.37.72.9) (Quit: Connection closed)
11:25:13 royal_screwup21 joins (52254809@gateway/web/cgi-irc/kiwiirc.com/ip.82.37.72.9)
11:27:17 × xff0x quits (~fox@2001:1a81:5229:f800:6dc9:367b:8c00:da75) (Ping timeout: 260 seconds)
11:27:44 xff0x joins (~fox@2001:1a81:5229:f800:d68d:6553:23c5:e8ae)
11:28:44 × mputz quits (~Thunderbi@dslb-088-064-063-125.088.064.pools.vodafone-ip.de) (Ping timeout: 260 seconds)
11:36:54 × pavonia quits (~user@unaffiliated/siracusa) (Quit: Bye!)
11:40:53 <merijn> unclechu: cabal will store the full plan in plan.json, cabal-plan is a separate application to pretty print/format the data in plan.json, yeah
11:41:06 × DavidEichmann quits (~david@62.110.198.146.dyn.plus.net) (Remote host closed the connection)
11:41:07 <merijn> unclechu: Also lets you generate graphs, etc.
11:41:53 DavidEichmann joins (~david@62.110.198.146.dyn.plus.net)
11:41:58 <unclechu> merijn: interesting, maybe i’ll try it later
11:43:23 mouseghost joins (~draco@87-206-9-185.dynamic.chello.pl)
11:43:23 × mouseghost quits (~draco@87-206-9-185.dynamic.chello.pl) (Changing host)
11:43:23 mouseghost joins (~draco@wikipedia/desperek)
11:43:56 × geowiesnot quits (~user@i15-les02-ix2-87-89-181-157.sfr.lns.abo.bbox.fr) (Ping timeout: 240 seconds)
11:44:14 × royal_screwup21 quits (52254809@gateway/web/cgi-irc/kiwiirc.com/ip.82.37.72.9) (Quit: Connection closed)
11:44:37 royal_screwup21 joins (52254809@gateway/web/cgi-irc/kiwiirc.com/ip.82.37.72.9)
11:45:12 × sh9 quits (~sh9@softbank060116136158.bbtec.net) (Ping timeout: 256 seconds)
11:45:43 × polyrain_ quits (~polyrain@2001:8003:e501:6901:ed2e:bd10:deae:edc6) (Quit: My MacBook has gone to sleep. ZZZzzz…)
11:49:25 × royal_screwup21 quits (52254809@gateway/web/cgi-irc/kiwiirc.com/ip.82.37.72.9) (Ping timeout: 268 seconds)
11:50:06 × LKoen quits (~LKoen@29.248.88.92.rev.sfr.net) (Remote host closed the connection)
11:50:14 jules000_ joins (~jules000@217-62-97-211.cable.dynamic.v4.ziggo.nl)
11:51:16 LKoen joins (~LKoen@29.248.88.92.rev.sfr.net)
11:53:01 × jules000 quits (~jules000@ip-195-169-220-88.eduvpn.ru.nl) (Ping timeout: 246 seconds)
11:54:30 oxide joins (~lambda@unaffiliated/mclaren)
11:55:27 knupfer joins (~Thunderbi@200116b82c3d4400408f76fffeecc229.dip.versatel-1u1.de)
11:55:28 × knupfer quits (~Thunderbi@200116b82c3d4400408f76fffeecc229.dip.versatel-1u1.de) (Client Quit)
11:55:31 heatsink joins (~heatsink@2600:1700:bef1:5e10:a0a8:41ac:e60d:3a06)
11:55:34 × phaul quits (~phaul@ruby/staff/phaul) (Ping timeout: 260 seconds)
11:55:43 knupfer joins (~Thunderbi@i59F7FF55.versanet.de)
11:55:45 Tario joins (~Tario@201.192.165.173)
11:58:02 × cosimone quits (~cosimone@2001:b07:ae5:db26:d849:743b:370b:b3cd) (Remote host closed the connection)
11:58:21 cosimone joins (~cosimone@93-47-228-249.ip115.fastwebnet.it)
12:00:02 × heatsink quits (~heatsink@2600:1700:bef1:5e10:a0a8:41ac:e60d:3a06) (Ping timeout: 264 seconds)
12:03:31 royal_screwup21 joins (52254809@gateway/web/cgi-irc/kiwiirc.com/ip.82.37.72.9)
12:06:34 × knupfer quits (~Thunderbi@i59F7FF55.versanet.de) (Quit: knupfer)
12:07:00 knupfer joins (~Thunderbi@200116b82c3d44009c6b48d981fc5a81.dip.versatel-1u1.de)
12:08:50 ulidtko|k is now known as ulidtko
12:09:46 <Kronic> When you see a ~ in a type signature, e.g (Token s ~ Char) - what is that and how can I read it ?
12:09:59 bitmapper joins (uid464869@gateway/web/irccloud.com/x-zzifphhwbirnbmhh)
12:10:36 <int-e> it's a contraint that asserts type equality
12:10:46 × gxt quits (~gxt@gateway/tor-sasl/gxt) (Remote host closed the connection)
12:11:25 <Kronic> As in real equality, e.g. some instance of a value which is of type (Token s) is equivalent to an instance of a Char?
12:11:39 × Tops2 quits (~Tobias@dyndsl-095-033-090-179.ewe-ip-backbone.de) (Read error: Connection reset by peer)
12:12:09 nineonine joins (~nineonine@S01061cabc0b095f3.vf.shawcable.net)
12:12:12 <Kronic> Also, what is the name of it and where can I read more about it ?
12:12:14 <int-e> Token is a type family, presumably.
12:12:41 <int-e> Producing a Token type for a... hmm... stream maybe? And the assertion is that the token type is Char.
12:13:56 <int-e> Look for "equality constraints"
12:15:14 <[exa]> Kronic: one (not-totally-correct but practical) view at that is to look at Token as on a type function. It says "The token type of stream type `s` unifies with Char"
12:16:22 × nineonine quits (~nineonine@S01061cabc0b095f3.vf.shawcable.net) (Ping timeout: 256 seconds)
12:16:35 <[exa]> notably, specifying/inferring this constraint in a "reverse" direction may be problematic for the function-ish reasons
12:17:38 <Kronic> Seems like I need to read up on 2 sections of type family related stuff before I can read that, thanks.
12:18:20 <boxscape> Kronic equality constraints themselves don't rely on type families (GADTs use them as well, for example), but yeah, type families are one instance where they're necessary and useful
12:19:01 × thc202 quits (~thc202@unaffiliated/thc202) (Ping timeout: 268 seconds)
12:19:10 × solonarv quits (~solonarv@astrasbourg-157-1-27-135.w90-40.abo.wanadoo.fr) (Read error: Connection reset by peer)
12:19:11 <boxscape> you could even use them to just write a type in a shorter way, e.g. `f :: t ~ Maybe (Set String) => t -> t` instead of `f :: Maybe (Set String) -> Maybe (Set String)`
12:19:15 <merijn> Well, technically it's a unification constraint, no? :p
12:19:44 × jules000_ quits (~jules000@217-62-97-211.cable.dynamic.v4.ziggo.nl) (Remote host closed the connection)
12:19:45 × vs^ quits (vs@ip98-184-89-2.mc.at.cox.net) ()
12:20:12 <merijn> Kronic: When you see "type family" just read "type level function" :p
12:20:38 <merijn> Kronic: So 'Token' is a type level function that turns 's' (the stream of your parser) into some type
12:20:41 <boxscape> merijn ghc calls them equality constraints
12:20:45 jules000 joins (~jules000@217-62-97-211.cable.dynamic.v4.ziggo.nl)
12:20:46 <hpc> merijn: it's a constraint describing equal types, compared to say (Num a) which is a constraint describing class membership
12:21:26 <merijn> boxscape: If there's one thing I learned from dependent types its that the word "equal" is a massive can of worms :p
12:21:34 <boxscape> that is true
12:22:07 <boxscape> actually I misread, ghc calls them "equational constraint"
12:22:07 <merijn> hpc: I know what it *means*, my point was that *equality* and *unification* are subtly different and that, afaik, what it does is checking unification
12:22:13 <boxscape> at least in the context I was looking at
12:23:13 <merijn> Kronic: So basically, what the "(Token s ~ Char) =>" is doing is saying that this parser only works for steams whose tokens are Char (consider something like ByteString where the tokens are bytes, not characters)
12:23:48 <merijn> Kronic: With megaparsec "Token String" and "Token Text" both produce Char as a result
12:24:39 <merijn> [exa]: I would argue that seeing Token as a type function is, in fact, totally correct
12:24:48 <Kronic> it half sounds like to me something in the order of dependent typing but I was under the impression nothing like that was in haskell quite yet
12:24:59 <merijn> Kronic: It's not quite dependent typing
12:25:23 <merijn> Kronic: Type families are "types depending on types" (the result of "Token" depends on its input type)
12:25:30 × jules000 quits (~jules000@217-62-97-211.cable.dynamic.v4.ziggo.nl) (Ping timeout: 256 seconds)
12:25:57 <merijn> Kronic: Dependent types refers to "types depending on values" (i.e. values whose type is dependent on the actualy value, consider vectors with lengths at the type level)
12:26:10 <boxscape> Kronic also worth noting that you can emulate dependent types in Haskell with something like the singletons library, it's just a pain to use compared to native dependent types
12:28:10 × da39a3ee5e6b4b0d quits (~da39a3ee5@2403:6200:8876:cecf:313a:ef0a:c021:651e) (Quit: My MacBook has gone to sleep. ZZZzzz…)
12:28:33 solonarv joins (~solonarv@astrasbourg-157-1-27-135.w90-40.abo.wanadoo.fr)
12:28:41 <Kronic> So, the example given on the doc I found was something like this: sumCollects :: (Collects c1, Collects c2, Elem c1 ~ Elem c2) => c1 -> c2 -> c2
12:28:41 <Kronic> which states that Elem c1 and Elem c2 must be the same
12:28:41 × ggVGc quits (~ggVGc@unaffiliated/walt) (Quit: WeeChat 1.9.1)
12:30:45 FreeBirdLjj joins (~freebirdl@101.87.168.174)
12:31:13 <merijn> Kronic: Right
12:31:16 <Kronic> I'm not quite sure I understand why it is done in that particular way - I would have imagined it to bel ike sumCollects :: (... Elem c2, c1 ~ c2)
12:31:38 <merijn> Kronic: Because what if two *different* Collects types have the same element?
12:32:11 <merijn> Kronic: Consider Strict.Text and Lazy.Tex, these are different types so they are not equal, but the Elem of both is Char
12:33:31 <merijn> Kronic: So we write "Elem c1 ~ Elem c2" because we care about c1 and c2 "containing the same thing", not them being the same
12:34:45 <boxscape> Kronic the Elem c2 in your `sumCollects :: (... Elem c2, c1 ~ c2)` would likely result in a kind error, because `Elem c2` is not a constraint, but a type
12:35:01 × FreeBirdLjj quits (~freebirdl@101.87.168.174) (Ping timeout: 246 seconds)
12:36:46 <Kronic> Are Collects and Elem made up purely for this example or is there something that I can look at to see what they are ?
12:38:20 <boxscape> I'm not sure what example you're looking at but I can't seem to find a Collects class anywhere
12:38:34 <Kronic> Hm, I guess I'll try to explain my confusion
12:39:01 <Kronic> I can't imagine a container that contains something of type A, where I would need to further specify that the elements are the same
12:39:24 <Kronic> are of the same type*
12:40:57 <merijn> Kronic: Well, what if I have "Map Int Char" and "Set Char"
12:40:59 × carlomagno quits (~cararell@148.87.23.10) (Remote host closed the connection)
12:41:19 <Kronic> Like for example I would read Num a => ... as "anywhere in this signature I see an A it can be treated as a Num" -- I feel like this reading of constraints is tripping me up a little here
12:41:26 <merijn> Kronic: Both can have "Elem (Map Int Char) = Char" and "Elem (Set Char) = Char"
12:41:51 <boxscape> Kronic to be clear (not sure if this is a point of consfusion) `Collects c1` doesn't state that something is a collection *of* c1, it states that c1 is a collection of something
12:42:11 × cosimone quits (~cosimone@93-47-228-249.ip115.fastwebnet.it) (Read error: Connection reset by peer)
12:42:17 <merijn> Kronic: Well, consider Text
12:42:27 cosimone joins (~cosimone@93-47-228-249.ip115.fastwebnet.it)
12:42:45 <merijn> Kronic: Text "obviously" contains Char values for some sense of contain, but you have no way to talk about that
12:42:57 × royal_screwup21 quits (52254809@gateway/web/cgi-irc/kiwiirc.com/ip.82.37.72.9) (Quit: Connection closed)
12:43:18 <merijn> Kronic: With "Set Char" you can argue just write "sumCollects :: c1 a -> c2 a -> c2 a"
12:43:20 royal_screwup21 joins (52254809@gateway/web/cgi-irc/kiwiirc.com/ip.82.37.72.9)
12:43:30 dnlkrgr joins (~dnlkrgr@200116b82cc2d20030e89e3b838b82d1.dip.versatel-1u1.de)
12:44:00 <merijn> Kronic: The example with Elem addresses the fact that "Text" isn't a type that matches "c1 a" so it can't be used with "sumCollects :: c1 a -> c2 a -> c2 a"
12:45:00 sondr3 joins (~sondr3@cm-84.211.56.132.getinternet.no)
12:46:22 <ski> dminuoso : "sshine: If we demanded the functions inside Set to be injective, it should satisfy laws, no?" -- how do you mean ?
12:46:24 <Kronic> So I get the idea that the containers are potentially different, and that the elements are always the same, I'm just not sure how to apply that to the signature that is given. Stating that c1 must be a collection and then also stating that it must be an Element doesn't make much sense to me
12:46:47 <merijn> Kronic: It doesn't stat that it is an element
12:47:05 <ski> yes, `Monad m => Monad (ListT m)' is bad. it should be `CommutativeMonad m => Monad (ListT m)'
12:47:05 <merijn> Kronic: Elem is a type level function, it takes a type and returns a (possibly new) type
12:47:36 <merijn> Kronic: The constraint is saying "the result type for "Elem c1" must be equal to the result type for "Elem c2""
12:47:38 sh9 joins (~sh9@softbank060116136158.bbtec.net)
12:47:46 <Kronic> ahh
12:48:02 <Kronic> That makes so much more sense. I find that fairly hard to read
12:48:27 <Kronic> How were you able to discern that Elem is a type level function? Purely because of the ~ ?
12:48:37 × royal_screwup21 quits (52254809@gateway/web/cgi-irc/kiwiirc.com/ip.82.37.72.9) (Ping timeout: 268 seconds)
12:48:54 <merijn> Kronic: Well, lets rewind to some (slightly more basic) things. Are you familiar with the term "kind"?
12:49:00 <Kronic> Yes
12:49:11 <ski> `Maybe' is also a type-level function
12:49:18 carlomagno joins (~cararell@148.87.23.8)
12:49:37 <merijn> ski: iff you consider "Just" a function/constructors a subset of all functions ;)
12:49:42 <ski> yes
12:49:53 <merijn> Kronic: Right, so you know that all values have a type with kind *, right?
12:50:01 <Kronic> Yea
12:50:14 <merijn> Int :: *, Maybe :: * -> *, Maybe Int :: *, etc.
12:50:33 <Kronic> Ah wait I get
12:50:35 × Stanley00 quits (~stanley00@unaffiliated/stanley00) ()
12:50:38 <merijn> Kronic: So (in GHC specifically) constraints (i.e. the thing in front of =>) are considered a special kind
12:50:45 <merijn> Kronic: Called "Constraint"
12:50:51 <merijn> % :k Num
12:50:52 <yahb> merijn: * -> Constraint
12:50:55 <merijn> % :k Functor
12:50:56 <yahb> merijn: (* -> *) -> Constraint
12:51:29 <merijn> Kronic: So typeclass are just type functions that take types and turn them into type with kind Constraint
12:51:55 <merijn> Kronic: ~ is a binary operator that takes two types and returns a Constraint that only hold if both sides are equal
12:52:01 <dminuoso> 13:47:04 ski | yes, `Monad m => Monad (ListT m)' is bad. it should be `CommutativeMonad m => Monad (ListT m)'
12:52:19 <dminuoso> That depends on how you look at things. The ListT implementation is just naive and incorrect for that purpose
12:52:33 <ski> `Maybe' "doesn't compute" in the sense that `Maybe Int' will just be `Maybe Int', "nothing more happens". but `Elem' is a "type family", `Elem MyCollection' could "compute" to e.g. `Int'. `Maybe a' is defined the same way, acts the same, regardless of which type `a' actually is. it's "parametric", in a sense. not so with `Elem a', it can pattern-match on what type `a' it's given, and compute to different
12:52:39 <ski> type results, depending
12:52:39 <merijn> Kronic: So we know that "Elem c1" is some type (which arguably could be a constraint too...)
12:53:01 nineonine joins (~nineonine@S01061cabc0b095f3.vf.shawcable.net)
12:53:23 <merijn> Kronic: So there's no real indication that "Elem" is a type level function, but practically that also doesn't matter
12:53:44 jules000 joins (~jules000@217-62-97-211.cable.dynamic.v4.ziggo.nl)
12:54:00 <Kronic> What you're saying makes a good deal of sense
12:54:06 <merijn> Kronic: We know that if "Elem c1" and "Elem c2" are the same type, then constraint from ~ holds. The fact that Elem is a type function that maps containers to what they hold isn't clear, but also not relevant to what it means
12:54:29 × taurux quits (~taurux@net-188-152-78-21.cust.dsl.teletu.it) (Ping timeout: 260 seconds)
12:54:29 <merijn> Kronic: My assumption that Elem is a type function is simply based on "that's the classical example" ;)
12:54:34 <ski> dminuoso : yea, `m [a]' is not that fine-grained. but even with a more incremental variant, you'd still get different results, depending on association, unless `m' is commutative, right ?
12:54:58 <boxscape> I don't think I've ever seen ~ used on constraints either, but I suppose it is technically possible
12:55:16 <boxscape> % () :: Eq Int ~ Eq Int => ()
12:55:17 <yahb> boxscape: ()
12:55:19 <merijn> Kronic: And you can do funky abusive things like writing a type function that requires a type *not* be something: https://gist.github.com/merijn/6130082
12:55:28 <hpc> :k (~)
12:55:30 <lambdabot> k -> k -> Constraint
12:55:57 <hpc> % () :: Eq Int ~ Num Int => ()
12:55:57 <yahb> hpc: ; <interactive>:22:1: error:; * Couldn't match type `Eq Int' with `Num Int' arising from an expression type signature; * In the expression: () :: Eq Int ~ Num Int => (); In an equation for `it': it = () :: Eq Int ~ Num Int => ()
12:56:07 <hpc> neat
12:56:23 <Kronic> I never really paid much attention to types until now
12:56:28 <Kronic> sorry, kinds, not types
12:57:14 <merijn> Kronic: In reality ~ is a bit messier since it's polykinded (i.e. it works for types of *any* kind, not just *, which is why it also works on types of kind Constraint)
12:57:27 <merijn> % () :: Maybe ~ Maybe => ()
12:57:27 <yahb> merijn: ()
12:57:29 <Kronic> But it does explain a lot, I feel like it'll take a while before I really understand everything here. Going back to sum collects, is it also fair to say that Collect is a type level function, meaning there is a class definition for it for :k * -> * ?
12:57:33 <merijn> % () :: Maybe ~ Maybe Int => ()
12:57:33 <yahb> merijn: ; <interactive>:24:15: error:; * Expected kind `* -> *', but `Maybe Int' has kind `*'; * In the second argument of `(~)', namely `Maybe Int'; In an expression type signature: Maybe ~ Maybe Int => (); In the expression: () :: Maybe ~ Maybe Int => ()
12:57:50 nyd joins (~nyd@unaffiliated/elysian)
12:57:52 × nineonine quits (~nineonine@S01061cabc0b095f3.vf.shawcable.net) (Ping timeout: 268 seconds)
12:57:54 <merijn> Kronic: Well, logically "Collects :: * -> Constraint"
12:58:02 <Kronic> Ah, yes, that
12:58:08 <hpc> % () :: True ~ True => ()
12:58:08 <yahb> hpc: ()
12:58:10 <merijn> Kronic: Since everything in front of => must be a constraint, but yes
12:58:10 × skiold quits (~skiold@gateway/tor-sasl/skiold) (Remote host closed the connection)
12:58:25 <boxscape> to be clear, Collect is a class, not a type family
12:58:31 skiold joins (~skiold@gateway/tor-sasl/skiold)
12:58:40 <boxscape> s/Collect/Collects
12:58:41 <merijn> boxscape: "it depends"
12:58:52 <merijn> Just is a constructor, but also a function
12:59:17 <merijn> See ski's remark. If you accept "type function" type constructors are just "type functions that happen to also be type constructors"
12:59:26 <Kronic> This all makes sense, thanks guys :)
12:59:37 <merijn> The same way value constructors can be both constructors and functions
12:59:39 <boxscape> I can see it being argued that "Collects" is a type function but I would say "type family" is specifically things declared with the "type family" syntax
12:59:55 <Kronic> I wasn't even really looking at this I just seen that tilde every time I was using Megaparsec and I wanted to understand it a little
13:00:25 ski would agree with boxscape here ..
13:00:28 <merijn> Kronic: A lot of this stuff is surprisingly sensible and predictable of you look just 1 level deeper :)
13:01:14 <merijn> Kronic: And you can effectively create "custom constraints" using type functions: https://gist.github.com/merijn/39dc86e345e87276c523
13:01:20 <ski> (.. unless perhaps if someone could show how to simulate classes using type families. how would one get access to the methods (and get uniqueness of instance), without type classes themselves ?)
13:01:52 geekosaur joins (ac3a56a4@172.58.86.164)
13:01:58 thc202 joins (~thc202@unaffiliated/thc202)
13:02:03 <merijn> boxscape: There is insufficient context to conclude that Collects *isn't* defined as a type family, though :p
13:02:06 <merijn> boxscape: Checkmate!
13:02:11 <boxscape> that is technically correct
13:02:19 <merijn> The best kind of correct!
13:02:39 <ski> touché :)
13:02:48 <[exa]> ski: save the function as a term to the associated type? :]
13:03:08 <ski> [exa] : but then you lose uniqueness, no ?
13:03:26 <[exa]> anyway, what's the etymology of type _families_? I find type functions and "associated" types quite understandable, and "families" sounds too much container-ish
13:04:12 <merijn> [exa]: Not sure, tbh. The original paper on type families is even called "Fun With Type Functions"
13:04:22 notzmv` joins (~user@201-27-179-147.dsl.telesp.net.br)
13:04:41 <[exa]> interesting
13:04:52 Sheilong joins (uid293653@gateway/web/irccloud.com/x-sqydmizngzbsyouz)
13:05:11 <ski> i'd guess it comes from the math term "family", where you have an "indexed collection", a bunch of individual things, pointed at by some "names" in an index set/type. as opposed to having a uniform/parametric construction, like power set, that "works the same way", regardless of what the parameter is
13:05:15 <boxscape> https://en.wikipedia.org/wiki/Indexed_family
13:05:26 <[exa]> ski: well, quite likely, and I also see not way to do the inference right
13:05:30 <[exa]> aah this
13:05:36 <[exa]> thanks!
13:05:36 notzmv` is now known as notzmv
13:05:54 × notzmv quits (~user@201-27-179-147.dsl.telesp.net.br) (Changing host)
13:05:54 notzmv joins (~user@unaffiliated/zmv)
13:06:12 <dminuoso> ski: I think LogicT is correct without a commutative monad?
13:06:56 <ski> hm, i haven't looked in detail at the internals of `LogicT', how it handles the ordering
13:07:23 <dminuoso> newtype LogicT m a = LogicT { unLogicT :: forall r. (a -> m r -> m r) -> m r -> m r }
13:07:55 <ski> (iirc, it has some facility for interleaving)
13:08:02 <dminuoso> Indeed
13:08:21 <ski> @unmtl ContT () (ContT o m) a
13:08:21 <lambdabot> (a -> (() -> m o) -> m o) -> (() -> m o) -> m o
13:10:18 <ski> so, that looks like the usual success and failure, two-storey, continuation story. (btw, note the similarity with naturals / free monoids)
13:15:57 royal_screwup21 joins (52254809@gateway/web/cgi-irc/kiwiirc.com/ip.82.37.72.9)
13:16:10 <cnmne[m]> I want to use `Text.ParserCombinators.ReadP` to separate by double newlines and then single newlines. when I use `sepBy any $ string "\n\n"`, `any` has to include a newline, but then I only get one contiguous block of text. how do I `sepBy` double newlines but not single newlines (at first)?
13:16:17 da39a3ee5e6b4b0d joins (~da39a3ee5@2403:6200:8876:cecf:313a:ef0a:c021:651e)
13:17:30 × whataday quits (~xxx@2400:8902::f03c:92ff:fe60:98d8) (Remote host closed the connection)
13:18:37 whataday joins (~xxx@2400:8902::f03c:92ff:fe60:98d8)
13:19:31 × whataday quits (~xxx@2400:8902::f03c:92ff:fe60:98d8) (Read error: Connection reset by peer)
13:20:37 whataday joins (~xxx@2400:8902::f03c:92ff:fe60:98d8)
13:20:45 × royal_screwup21 quits (52254809@gateway/web/cgi-irc/kiwiirc.com/ip.82.37.72.9) (Ping timeout: 240 seconds)
13:21:31 × whataday quits (~xxx@2400:8902::f03c:92ff:fe60:98d8) (Read error: Connection reset by peer)
13:22:38 whataday joins (~xxx@2400:8902::f03c:92ff:fe60:98d8)
13:23:03 rayyyy joins (~nanoz@gateway/tor-sasl/nanoz)
13:23:32 × whataday quits (~xxx@2400:8902::f03c:92ff:fe60:98d8) (Read error: Connection reset by peer)
13:24:30 Entertainment joins (~entertain@104.246.132.210)
13:24:38 whataday joins (~xxx@2400:8902::f03c:92ff:fe60:98d8)
13:25:32 × jackgassett quits (~jackgasse@84.39.117.57) (Remote host closed the connection)
13:25:32 × whataday quits (~xxx@2400:8902::f03c:92ff:fe60:98d8) (Read error: Connection reset by peer)
13:26:39 whataday joins (~xxx@2400:8902::f03c:92ff:fe60:98d8)
13:27:33 × whataday quits (~xxx@2400:8902::f03c:92ff:fe60:98d8) (Remote host closed the connection)
13:28:39 whataday joins (~xxx@2400:8902::f03c:92ff:fe60:98d8)
13:29:09 urodna joins (~urodna@unaffiliated/urodna)
13:29:40 × Kronic quits (~Kronic___@84.203.157.119) (Ping timeout: 265 seconds)
13:29:54 Kronic joins (~Kronic___@84.203.96.46)
13:32:21 <Kronic> Thanks for the earlier explanation there merijn boxscape and anyone else who chipped in, I feel like that helped in a big way :)
13:33:15 × jules000 quits (~jules000@217-62-97-211.cable.dynamic.v4.ziggo.nl) (Remote host closed the connection)
13:34:01 × Kaeipi quits (~Kaiepi@47.54.252.148) (Remote host closed the connection)
13:34:21 Kaeipi joins (~Kaiepi@47.54.252.148)
13:34:47 taurux joins (~taurux@net-188-216-19-113.cust.vodafonedsl.it)
13:35:02 × dnlkrgr quits (~dnlkrgr@200116b82cc2d20030e89e3b838b82d1.dip.versatel-1u1.de) (Ping timeout: 260 seconds)
13:35:59 mputz joins (~Thunderbi@dslb-088-064-063-125.088.064.pools.vodafone-ip.de)
13:36:04 × da39a3ee5e6b4b0d quits (~da39a3ee5@2403:6200:8876:cecf:313a:ef0a:c021:651e) (Quit: My MacBook has gone to sleep. ZZZzzz…)
13:36:26 milanj joins (~milan@109-92-112-117.dynamic.isp.telekom.rs)
13:36:30 × p8m quits (p8m@gateway/vpn/protonvpn/p8m) (Read error: Connection reset by peer)
13:36:56 <ezzieyguywuf> srk: CAD progress has been slow, I've side-tracked to other projects, but it's still in the front of my mind
13:37:10 <ezzieyguywuf> srk: I will check out SceneGraph, I think I may have sen that bfore.
13:39:03 × rayyyy quits (~nanoz@gateway/tor-sasl/nanoz) (Ping timeout: 240 seconds)
13:39:17 <[exa]> cnmne[m]: if you don't anything much more complicated, why not something like `groupBy (oneIsNull) . lines` ?
13:39:54 × p-core quits (~Thunderbi@2001:718:1e03:5128:2ab7:7f35:48a1:8515) (Remote host closed the connection)
13:40:00 kuribas joins (~user@ptr-25vy0i85lvzulltbjkf.18120a2.ip6.access.telenet.be)
13:45:01 zclod joins (97436f3c@151.67.111.60)
13:45:27 p8m joins (p8m@gateway/vpn/protonvpn/p8m)
13:45:35 schwuk joins (~schwuk@s91904426.blix.com)
13:48:23 phaul joins (~phaul@ruby/staff/phaul)
13:50:21 jules000 joins (~jules000@217-62-97-211.cable.dynamic.v4.ziggo.nl)
13:52:45 × shatriff quits (~vitaliish@176-52-216-242.irishtelecom.com) (Ping timeout: 268 seconds)
13:53:23 royal_screwup21 joins (52254809@gateway/web/cgi-irc/kiwiirc.com/ip.82.37.72.9)
13:53:28 × schwuk quits (~schwuk@s91904426.blix.com) (Remote host closed the connection)
13:53:49 kupi joins (uid212005@gateway/web/irccloud.com/x-jxedmdsaplwusuum)
13:54:27 <kupi> is this a good name for that function?
13:54:27 <kupi> joinWith f = (>>= (\a -> f a <&> (a,)))
13:56:53 heatsink joins (~heatsink@2600:1700:bef1:5e10:a0a8:41ac:e60d:3a06)
13:57:04 <kuribas> :t \f -> (>>= (\a -> f a <&> (a,)))
13:57:06 <lambdabot> Monad m => (t1 -> m t2) -> m t1 -> m (t1, t2)
13:57:24 <kuribas> liftA2 (,) ?
13:57:34 <kuribas> :t liftA2 (,)
13:57:36 <lambdabot> Applicative f => f a -> f b -> f (a, b)
13:58:17 <zclod> i'm trying to compose a list of list of functions with the applicative instance of the list to have all the combination something like this https://gist.github.com/zclod/cfde3e6e11e15368665ca71bfe9c8de5 but i get a strange instance error
13:58:19 × royal_screwup21 quits (52254809@gateway/web/cgi-irc/kiwiirc.com/ip.82.37.72.9) (Ping timeout: 246 seconds)
13:58:26 hyperisco joins (~hyperisco@d192-186-117-226.static.comm.cgocable.net)
14:00:03 <geekosaur> why do you think a Num (b -> b) instance should exist?
14:00:36 × phaul quits (~phaul@ruby/staff/phaul) (Ping timeout: 240 seconds)
14:00:42 <geekosaur> and it's telling you the reason, you have failed to apply (+) to enough parameters so it's trying to use it as a number
14:01:50 × heatsink quits (~heatsink@2600:1700:bef1:5e10:a0a8:41ac:e60d:3a06) (Ping timeout: 264 seconds)
14:01:55 <zclod> yes but i don't understand how to make it work
14:03:55 <kuribas> kupi: looks arrowish...
14:04:54 <kupi> kuribas: I got used to >>> and <<< from arrow
14:04:59 berberman joins (~berberman@unaffiliated/berberman)
14:05:01 acarrico joins (~acarrico@dhcp-68-142-39-249.greenmountainaccess.net)
14:05:03 × berberman_ quits (~berberman@unaffiliated/berberman) (Ping timeout: 260 seconds)
14:05:20 <kuribas> kupi: I never use them, and I find arrow notation confusing.
14:05:47 rayyyy joins (~nanoz@gateway/tor-sasl/nanoz)
14:05:49 <kupi> what do you recommend as an alternative to >>>?
14:06:03 <kuribas> I just use lambdas
14:06:07 <solonarv> I also find arrow notation confusing, but I do occasionally use a few combinators from Control.Arrow (mainly &&& and ***, specialized to the usual function arrow)
14:06:08 <kupi> i use that a lot because I find right to left composition confusing most times
14:06:09 × raichoo quits (~raichoo@dslb-092-073-197-080.092.073.pools.vodafone-ip.de) (Quit: Lost terminal)
14:06:41 <kuribas> or name things in do notation.
14:07:13 <kuribas> sometimes it looks like haskell programmers don't like naming stuff, and arrows are that premise taken to far...
14:07:15 <geekosaur> zclod, I get something saner if I replace [id] with [0]
14:07:47 <kuribas> I use pointfree as long as it's still readable, lambdas and do notation otherwise.
14:08:20 <geekosaur> and lose everything outside the first set of parens. I'm not sure what you're trying to accomplish there, but your types are very wrong for it
14:09:10 <geekosaur> > foldr (<*>) [0] ([[(+1),(+2)], [(+3)], [(+4)]])
14:09:12 <lambdabot> [8,9]
14:10:21 <xerox_> neat
14:10:25 <zclod> thanks
14:10:49 <geekosaur> using id asserts that the literals 1,2,3,4 must actually have function types, which is wrong (normallly)
14:11:13 <kupi> more general version, but still couldn't came up with a good name
14:11:14 <kupi> joinWith' joiner f = (>>= (\a -> f a <&> joiner a))
14:11:50 <kuribas> :t \joiner f -> (>>= (\a -> f a <&> joiner a))
14:11:51 <lambdabot> Monad m => (t -> a -> b) -> (t -> m a) -> m t -> m b
14:12:45 × nyd quits (~nyd@unaffiliated/elysian) (Quit: nyd)
14:15:41 <zzz> should i use Data.HashTable.ST if I want a fast lookup/insertion map?
14:16:47 <merijn> zzz: Have you already tried and benchmarked regular Map and found it too slow?
14:16:48 <kuribas> zzz: no
14:17:15 <kuribas> Map or HashMap
14:17:19 × esph quits (~weechat@unaffiliated/esph) (Ping timeout: 260 seconds)
14:18:13 <merijn> solonarv: Hot take: The operators from Control.Arrow should be specialised to (->) and be put into Data.Tuple so we can all pretend Arrow doesn't exist
14:18:32 <merijn> As a general rule Map is much faster than most people seem to think it is
14:18:37 <kupi> having a name for this would be enough too: \f getB a -> getB a <&> f a
14:18:48 <zzz> merijn: i'm finding vector too slow
14:19:08 <merijn> There's this weird idea that hashmaps are faster than trees
14:19:38 <merijn> zzz: Vectors aren't maps, so I'm confused why Vector and HashMap are candidates for the same operations?
14:20:50 <solonarv> zzz: immutable vectors are very slow if you want to repeatedly update a single entry, because you have to copy the entire vector each time
14:21:10 <zzz> you're right. i used them "the wrong way" just to see if there would be an improvement in performance
14:23:36 elfets joins (~elfets@ip-37-201-23-96.hsi13.unitymediagroup.de)
14:24:34 <zzz> i'm trying Vector.Unboxed.Mutable
14:25:20 × jamm quits (~jamm@unaffiliated/jamm) (Remote host closed the connection)
14:25:41 jamm joins (~jamm@unaffiliated/jamm)
14:26:18 Ariakenom joins (~Ariakenom@2001:9b1:efb:fc00:e9c0:3eaa:49c0:2faa)
14:26:23 shatriff joins (~vitaliish@176-52-216-242.irishtelecom.com)
14:27:25 × jespada quits (~jespada@90.254.245.49) (Ping timeout: 240 seconds)
14:30:42 jespada joins (~jespada@90.254.245.49)
14:31:26 da39a3ee5e6b4b0d joins (~da39a3ee5@2403:6200:8876:cecf:313a:ef0a:c021:651e)
14:33:50 <merijn> zzz: Yeah, but for what?
14:34:28 <merijn> You have asked "which data structure is faster?" but haven't specified what should be fast or what you plan to do with them
14:37:09 × zclod quits (97436f3c@151.67.111.60) (Ping timeout: 245 seconds)
14:37:12 <solonarv> the fastest data structure is (): every operation on it it O(1) and maximally lazy!
14:37:15 <solonarv> :p
14:38:00 raehik joins (~raehik@cpc95906-rdng25-2-0-cust156.15-3.cable.virginm.net)
14:38:28 eruditass joins (uid248673@gateway/web/irccloud.com/x-xjwjopbsnaxlyzup)
14:40:11 <kuribas> solonarv: Void is faster
14:40:30 × jules000 quits (~jules000@217-62-97-211.cable.dynamic.v4.ziggo.nl) (Remote host closed the connection)
14:40:47 <kuribas> every operation on it is fast, since it has no operations on it :)
14:41:06 <solonarv> heh, even better
14:41:36 <zzz> oh you guys...
14:41:52 <zzz> (i'm doing aoc)
14:42:41 jules000 joins (~jules000@217-62-97-211.cable.dynamic.v4.ziggo.nl)
14:42:48 <solonarv> which task?
14:43:36 <boxscape> % id @Void undefined
14:43:36 <yahb> boxscape: *** Exception: Prelude.undefined; CallStack (from HasCallStack):; error, called at libraries/base/GHC/Err.hs:79:14 in base:GHC.Err; undefined, called at <interactive>:38:10 in interactive:Ghci12
14:43:44 <boxscape> wonder how fast that was
14:43:50 <zzz> 15p2. i've already done it but i'm using the opportunity to optimize as much as i can, since i'm doing this to learn haskell
14:44:00 <merijn> zzz: I find it hard to believe that data structure is the issue for AOC, most of the problems are super small. But that still doesn't tell me the actual operations it's doing :p
14:44:14 <kuribas> % id @Void (let x = x in x)
14:44:19 <yahb> kuribas: [Timed out]
14:44:29 <boxscape> merijn in day15 the challenge is that the problem is big
14:44:30 <merijn> Ah, I'm not at 15p2 yet anyway, stupid work getting in the way :p
14:45:04 kritzefitz joins (~kritzefit@212.86.56.80)
14:45:08 <merijn> boxscape: I haven't done any since day 11 due to work >.>
14:47:32 <solonarv> oh yeah, day 15 does make good use of a fast data structure
14:47:55 <solonarv> I got ~1.5 second time on part 2 using unboxed mutable vector
14:48:47 jkakar joins (~jkakar@178.162.204.214)
14:50:12 <merijn> ok, so that at least means that any speed trouble zzz has aren't related to the data structure, but messing something else up :)
14:50:38 <merijn> zzz: It'll probably help to paste your code at https://paste.tomsmeding.com/
14:50:51 <geekosaur> make sure its up
14:51:15 <merijn> zzz: also, just to be sure: You are 1) compiling (not using ghci) and 2) using -O or -O2, yes?
14:53:18 × ubert quits (~Thunderbi@p200300ecdf3514a6e6b318fffe838f33.dip0.t-ipconnect.de) (Remote host closed the connection)
14:53:28 × knupfer quits (~Thunderbi@200116b82c3d44009c6b48d981fc5a81.dip.versatel-1u1.de) (Ping timeout: 260 seconds)
14:53:35 ubert joins (~Thunderbi@p200300ecdf3514a6e6b318fffe838f33.dip0.t-ipconnect.de)
14:54:05 <boxscape> :t liftA2 fmap
14:54:07 <lambdabot> (Applicative f1, Functor f2) => f1 (a -> b) -> f1 (f2 a) -> f1 (f2 b)
14:54:14 <zzz> yes to both
14:54:17 <boxscape> ^ kupi this is the same as \f getB a -> getB a <&> f a
14:54:21 <boxscape> I think
14:54:22 <zzz> sorry for the delay
14:55:35 <zzz> this is my solution using IntMap which I find way too slow https://pastebin.com/zhPnNGFJ
14:57:35 heatsink joins (~heatsink@2600:1700:bef1:5e10:64b4:1541:658f:e8d8)
14:58:10 milanj_ joins (~milan@178.220.18.116)
14:59:34 × geekosaur quits (ac3a56a4@172.58.86.164) (Remote host closed the connection)
14:59:36 royal_screwup21 joins (52254809@gateway/web/cgi-irc/kiwiirc.com/ip.82.37.72.9)
14:59:47 <zzz> the goal is calculating the nth term of a variant of https://oeis.org/A181391 given an arbitrary seed
15:01:14 <merijn> hmm, "(M.fromList &&& last)" seems like it'd be slow since it has to traverse the list twice and keep it alive all that time
15:01:46 <merijn> It's also unnecessary since IntMap has a direct operation for looking up the key with the maximum value
15:01:49 × milanj quits (~milan@109-92-112-117.dynamic.isp.telekom.rs) (Ping timeout: 268 seconds)
15:02:26 × heatsink quits (~heatsink@2600:1700:bef1:5e10:64b4:1541:658f:e8d8) (Ping timeout: 268 seconds)
15:02:28 <solonarv> :t \f getB a -> getB a <&> f a
15:02:29 <lambdabot> Functor f => (t -> a -> b) -> (t -> f a) -> t -> f b
15:02:36 cr3 joins (~cr3@192-222-143-195.qc.cable.ebox.net)
15:02:36 <kupi> boxscape: I think not
15:02:37 <solonarv> boxscape: clearly not!
15:02:44 <merijn> zzz: There's a bunch of things that come to mind you can try, but rather than listing 20 tiny things to try, let me "lead a horse to water" instead ;)
15:02:46 <boxscape> hmm
15:02:47 <merijn> @where user-guide
15:02:48 <lambdabot> I know nothing about user-guide.
15:02:49 <zzz> merijn: that list has length 4
15:02:50 <merijn> aww
15:02:59 <kupi> a better signature imho: Functor f => (a -> b -> c) -> (a -> f b) -> a -> f c
15:03:06 <merijn> zzz: Oh
15:03:18 <merijn> zzz: Is this strict or lazy IntMap?
15:03:18 <boxscape> they look the same to me, if you treat (a ->) as a functor
15:03:21 <merijn> Try that first
15:03:27 <merijn> @where userguide
15:03:27 <lambdabot> https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/
15:03:33 <zzz> strict
15:03:40 × Ariakenom quits (~Ariakenom@2001:9b1:efb:fc00:e9c0:3eaa:49c0:2faa) (Ping timeout: 268 seconds)
15:03:51 <merijn> zzz: Otherwise the user guide is pretty great and (among other things) has pretty good intro on how to profile Haskell code
15:04:00 <boxscape> :t liftA2 fmap :: Functor f => (a -> b -> c) -> (a -> f b) -> a -> f c -- kupi
15:04:01 <lambdabot> Functor f => (a -> b -> c) -> (a -> f b) -> a -> f c
15:04:03 <boxscape> works just fine
15:04:09 <merijn> zzz: See also: https://mpickering.github.io/posts/2019-11-07-hs-speedscope.html
15:04:15 <ephemient> oh this problem
15:04:33 <merijn> zzz: Step one to making things fast is: Find out what's actually slow :)
15:05:02 <kupi> boxscape: thanks, I still need to practice with the function functor
15:05:05 <ephemient> I have 5 implementations and it easily gets limited by memory bandwidth. it's just a lot of operations to run
15:05:51 hseg joins (~gesh@IGLD-84-228-238-87.inter.net.il)
15:05:55 <merijn> ephemient: I'm optimising blind here, because I don't know the actual AOC problem :p
15:06:37 Sgeo joins (~Sgeo@ool-18b98aa4.dyn.optonline.net)
15:06:40 <zzz> should we avoid spoilers?
15:07:35 <boxscape> zzz you can always go to ##adventofcode-spoilers
15:07:42 <boxscape> lots of haskell people there, too
15:07:58 <zzz> hey thanks
15:08:02 <merijn> I mean, you can just post links with spoiler warnings :p
15:08:14 <merijn> If people don't wanna see spoilers, don't click links with spoiler warnings :p
15:08:15 nbloomf joins (~nbloomf@2600:1700:ad14:3020:b9d7:a8de:e4f7:b9f1)
15:08:36 <zzz> sorry about that
15:08:57 × cosimone quits (~cosimone@93-47-228-249.ip115.fastwebnet.it) (Read error: Connection reset by peer)
15:09:17 cosimone joins (~cosimone@93-47-228-249.ip115.fastwebnet.it)
15:09:21 <merijn> zzz: I don't worry about spoilers, tbh, but I didn't bother looking up the problem so my comments are just based on looking whatever you wrote now
15:09:42 <merijn> So if what you wrote is flawed in some fundamental way I can't see that :p
15:10:02 × nbloomf quits (~nbloomf@2600:1700:ad14:3020:b9d7:a8de:e4f7:b9f1) (Client Quit)
15:10:15 <merijn> Anyway, I highly recommend the profiling section of the user guide (or actually, I highly recommend the entire GHC user guide it's fantastic and most people are barely aware it exists)
15:10:42 ggVGc joins (~ggVGc@a.lowtech.earth)
15:11:33 <whataday> how to filter all spaces with Parsec functions? parse spaces "" "a b c" == Right (), but I was expected Right "abc"
15:11:41 × phasespace quits (~sar@80-89-47-117.inet.signal.no) (Ping timeout: 268 seconds)
15:13:10 × ggVGc quits (~ggVGc@a.lowtech.earth) (Changing host)
15:13:11 ggVGc joins (~ggVGc@unaffiliated/walt)
15:13:23 <merijn> whataday: *Why* where you expecting that?
15:14:18 <merijn> whataday: That expressions parses 0 spaces at the start of "a b c" and returns () with "a b c" as unparsed input
15:14:58 <merijn> It is unclear to me why you would expect "spaces" to randomly remove spaces from the middle of a piece of text
15:15:11 <whataday> what's the right way to get what I want?
15:15:15 <ephemient> whataday: (spaces <* eof) will fail if it doesn't consume all input
15:15:21 <whataday> filter all spaces
15:15:37 <ephemient> ... what do you mean by filter
15:15:40 <ephemient> spaces returns ()
15:15:48 <whataday> yes, remove
15:16:00 <whataday> sorry, my English is not good
15:16:01 <ephemient> that's not what parsec does?
15:16:03 × shutdown_-h_now quits (~arjan@2001:1c06:2d0b:2312:fd44:2741:1ec1:624c) (Ping timeout: 272 seconds)
15:16:24 <xerox_> concat <$> anyChar `sepBy` spaces ?
15:16:48 <xerox_> probably completely wrong
15:16:54 <ephemient> filter (not . isSpace)
15:16:56 <merijn> xerox_: Correct, but probably not helpful when someone seems to have rather big misunderstandings about what parsec *does* :)
15:18:05 × ubert quits (~Thunderbi@p200300ecdf3514a6e6b318fffe838f33.dip0.t-ipconnect.de) (Read error: Connection reset by peer)
15:18:25 ubert joins (~Thunderbi@p200300ecdf3514a6e6b318fffe838f33.dip0.t-ipconnect.de)
15:18:35 × bliminse quits (~bliminse@host109-158-129-129.range109-158.btcentralplus.com) (Quit: leaving)
15:18:46 <Kronic> So you can have something like (char 'a') <|> (char
15:19:00 <Kronic> 'b') to get a parser for the chars a or b
15:19:17 <Kronic> Is there a way to undo this later?
15:19:33 <merijn> Kronic: Define "undo"?
15:19:59 <Kronic> So my goal is I want anySingle, but I want to subtract say, spaceChar from the set which anySingle matches against
15:20:27 <ephemient> anySingleBut ' ' ?
15:20:44 vicfred joins (~vicfred@unaffiliated/vicfred)
15:21:04 <Kronic> Ah, I figured there would be a nice convenience function like that, to be clear though there is no operator that is the inverse of <|> right?
15:21:56 shutdown_-h_now joins (~arjan@2001:1c06:2d0b:2312:b430:7c21:4c6a:15a8)
15:22:21 Ariakenom joins (~Ariakenom@2001:9b1:efb:fc00:f919:1b80:2acc:f96c)
15:22:22 <sm[m]> satisfy (not.isSpace)
15:22:45 <ephemient> still not sure what you mean by inverse of <|> though
15:22:50 salumu joins (~sMuNiX@vlnsm8-montreal02-142-122-8-233.internet.virginmobile.ca)
15:23:02 <merijn> Kronic: "inverse of <|>" makes no real sense?
15:23:21 <merijn> oh!
15:23:23 <Kronic> What I meant was what sm[m] said
15:23:24 <merijn> I see what you mean
15:23:27 <Kronic> I explained it very poorly though
15:23:52 <merijn> Kronic: A more general version would be "p >>= \v -> guard (predicate v)"
15:23:54 <merijn> :t guard
15:23:56 <lambdabot> Alternative f => Bool -> f ()
15:24:04 <merijn> > guard True :: Maybe ()
15:24:07 <lambdabot> Just ()
15:24:11 <merijn> > guard False :: Maybe ()
15:24:14 <lambdabot> Nothing
15:24:41 <merijn> Kronic: Basically "guard False" is equivalent to empty (which is the right and left identity for <|>)
15:25:33 <merijn> (since your *real* question appears to be, "how can I make a parser fail after it succesfully parses some input?")
15:26:09 × sMuNiX quits (~sMuNiX@vlnsm8-montreal02-142-122-8-233.internet.virginmobile.ca) (Ping timeout: 260 seconds)
15:26:15 <merijn> Which would be guard/empty (or, better, one of the special combinators in megaparsec that let you specify an actual error message :p)
15:26:57 nbloomf joins (~nbloomf@2600:1700:ad14:3020:10ca:6681:7c5c:1a7b)
15:27:04 <Kronic> My question is more: If I have a parser in hand which matches against any character in the string "abc", how can create a new parser that matches against just the members of "bc"
15:27:34 <ephemient> oh, with that understanding. I think `notFollowedBy` might be what you're looking for
15:28:01 <ephemient> notFollowedBy (char 'a') *> oneOf "abc"
15:28:08 <ephemient> seems like a backwards way of doing it though...
15:28:19 machinedgod joins (~machinedg@135-23-192-217.cpe.pppoe.ca)
15:28:57 × star_cloud quits (~star_clou@ec2-34-220-44-120.us-west-2.compute.amazonaws.com) (Ping timeout: 268 seconds)
15:29:19 nineonine joins (~nineonine@S01061cabc0b095f3.vf.shawcable.net)
15:29:37 × hiroaki quits (~hiroaki@ip4d168e73.dynamic.kabel-deutschland.de) (Ping timeout: 264 seconds)
15:30:54 <whataday> parse (anyChar sepBy spaces) "" " a = b" == Right "a=b"
15:31:03 <whataday> it removes all spaces
15:31:47 <merijn> Kronic: In general "you don't"
15:32:30 sigkill joins (7c2b797e@124.43.121.126)
15:32:38 <Kronic> Seems like it would be a useful thing if you had a possible set of things to parse against but then you had an optional list to filter out, that's at least my thinking
15:32:52 <merijn> Kronic: That's not how parser combinators work. Effectively parser combinators are just a convenience library for writing recursive descent parsers.
15:33:07 <ephemient> whataday: as written, the space is included
15:33:23 <merijn> Kronic: tbh, I find it difficult to think of a situation where that'd be easier than just "writing the parser you *actually* want"
15:33:31 × nineonine quits (~nineonine@S01061cabc0b095f3.vf.shawcable.net) (Ping timeout: 246 seconds)
15:33:31 phaul joins (~phaul@ruby/staff/phaul)
15:33:52 <whataday> sorry, I don't understand what you mean, please rephrase it
15:35:07 <merijn> Kronic: I mean, you rarely ever deal with parser that return strings, so the entire notion of "optionally filtering something out" becomes entirely weird
15:35:36 <merijn> Kronic: Like, if I have "Parser Expr" which parses an expression, what would it even mean to "optional filter out a list of expressions"?
15:35:55 <ephemient> parse (anyChar sepBy spaces) "" " " == Right " "
15:36:39 × xelxebar quits (~xelxebar@gateway/tor-sasl/xelxebar) (Remote host closed the connection)
15:39:23 × fendor quits (~fendor@178.165.130.183.wireless.dyn.drei.com) (Remote host closed the connection)
15:39:42 Vulfe joins (~vulfe@2600:1702:31b0:34e0:95de:4ebb:b6a2:4942)
15:40:45 polyphem joins (~p0lyph3m@2a02:810d:640:776c:76d7:55f6:f85b:c889)
15:42:48 hiroaki joins (~hiroaki@ip4d16fa3b.dynamic.kabel-deutschland.de)
15:44:12 esph joins (~weechat@unaffiliated/esph)
15:45:31 × mputz quits (~Thunderbi@dslb-088-064-063-125.088.064.pools.vodafone-ip.de) (Quit: mputz)
15:46:24 × milanj_ quits (~milan@178.220.18.116) (Quit: Leaving)
15:46:45 milanj joins (~milan@178.220.18.116)
15:47:35 <whataday> parse ((many $ char ' ') *> (anyChar 'sepBy' spaces)) "" " a= b" ?
15:48:20 fendor joins (~fendor@178.165.130.183.wireless.dyn.drei.com)
15:48:54 wroathe joins (~wroathe@c-68-54-25-135.hsd1.mn.comcast.net)
15:49:51 <ephemient> you might as well use (space *> many (anyChar <* space))
15:54:16 × munsel quits (~munsel@v22018094214772867.hotsrv.de) (Quit: ZNC 1.7.5 - https://znc.in)
15:56:10 <whataday> but that would not handle " a = b "
15:56:59 munsel joins (~munsel@2a03:4000:10:5a0:445c:bbff:fea9:cf8f)
15:57:20 <ephemient> why wouldn't it, space matches any number of space characters
15:57:22 <merijn> I recommend you figure out what exactly the grammar of what you're parsing is
15:57:41 <whataday> spaces matches
15:58:37 <merijn> This seems to be parser writing by writing out random permutations of parsec combinators, that's not going to go anywhere
15:58:48 × hexfive quits (~hexfive@50-47-142-195.evrt.wa.frontiernet.net) (Quit: i must go. my people need me.)
15:59:40 <whataday> I'm trying to read from a config file, and turn its context to a record syntax
16:00:04 × wi[m] quits (w1gzmatrix@gateway/shell/matrix.org/x-vhbfmwpsvmrdtwkw) (Quit: Idle for 30+ days)
16:00:20 × jamm quits (~jamm@unaffiliated/jamm) (Remote host closed the connection)
16:00:20 <whataday> it's simple like "name=john, age=29..."
16:00:56 <whataday> data Config = Config {runName :: String, runAge :: Int}
16:01:31 <whataday> but in the config file, it may be " name= john"
16:02:04 <merijn> The AOC format is rather tricky to parse properly, while also being simple enough that parsing it properly isn't really worth it, tbh
16:02:15 × skapazzo quits (~skapazzo@host-80-21-130-163.business.telecomitalia.it) (Read error: No route to host)
16:02:19 <whataday> "name = john" or "name=john " whatever, so first I need to remove spaces
16:02:35 × sigkill quits (7c2b797e@124.43.121.126) (Ping timeout: 245 seconds)
16:02:45 <ephemient> that seems like the wrong solution, it isn't clear that you want to remove spaces inside of the names as well
16:02:46 × toorevitimirp quits (~tooreviti@117.182.183.95) (Remote host closed the connection)
16:02:53 <whataday> what is AOC format
16:03:28 <whataday> AOC monitor? congresswoman AOC?
16:03:43 hf69 joins (~haskeller@ip72-205-40-121.dc.dc.cox.net)
16:04:03 <ephemient> Text.Megaparsec.Char.Lexer follows the convention that each lexeme consumes the space following it
16:04:10 <pja> whataday: Use the Lexer from Text.MegaParsec ?
16:04:40 <pja> AOC == Advent Of Code?
16:05:03 <whataday> but MegaParsec is available on codewars? sometimes I may do exercises on codewars
16:05:22 <Uniaika> pja: yes
16:05:56 <ephemient> whataday: https://github.com/Codewars/codewars-runner-cli/issues/682 yes
16:06:15 × Rudd0 quits (~Rudd0@185.189.115.103) (Remote host closed the connection)
16:06:28 <merijn> ah, I don't know codewars, looks similar to the advent of code format
16:06:47 Rudd0 joins (~Rudd0@185.189.115.98)
16:06:59 <merijn> Basically, that has you parse in record that can be arbitrarily permutated which is a massive hassle
16:07:22 tlaxkit joins (~kvirc@89.35.63.16)
16:07:34 × mouseghost quits (~draco@wikipedia/desperek) (Quit: mew wew)
16:07:36 <merijn> So much that it's much easier to just parse it first as "Map String String" and then later try and build a datatype from there
16:07:41 <whataday> but some questions on codewars are still using haskell 7...
16:09:25 <whataday> what do you mean "parse it first as "Map String String""?
16:09:27 <ephemient> IIRC somebody was in here last week asking for help with Control.Applicative.Permutations which builds up permutable parsers
16:09:42 × Ariakenom quits (~Ariakenom@2001:9b1:efb:fc00:f919:1b80:2acc:f96c) (Remote host closed the connection)
16:10:08 × phaul quits (~phaul@ruby/staff/phaul) (Ping timeout: 265 seconds)
16:10:08 Ariakenom joins (~Ariakenom@2001:9b1:efb:fc00:f919:1b80:2acc:f96c)
16:10:30 <whataday> and also why there's no <<
16:10:45 <boxscape> haskell 7? I didn't know there were people not even caught up to version 98
16:10:48 <merijn> ephemient: That may have been me (although that was probably 2 weeks ago)
16:11:00 <merijn> ephemient: In the end I didn't bother :p
16:11:15 danso joins (~dan@69-165-210-185.cable.teksavvy.com)
16:11:28 <whataday> codewars using it
16:12:00 × Qudit314159 quits (~user@unaffiliated/qudit314159) (Read error: Connection reset by peer)
16:12:04 <whataday> you even can't use <> to concat String in it
16:12:38 <whataday> have to import Data.semigroup first
16:14:29 × jonathanx quits (~jonathan@dyn-8-sc.cdg.chalmers.se) (Remote host closed the connection)
16:14:58 coot_ joins (~coot@37.30.50.101.nat.umts.dynamic.t-mobile.pl)
16:15:06 <boxscape> ah I guess they mean ghc 7.x
16:15:33 × coot quits (~coot@37.30.50.101.nat.umts.dynamic.t-mobile.pl) (Read error: Connection reset by peer)
16:15:33 coot_ is now known as coot
16:16:14 <whataday> yes, my fault
16:16:35 <boxscape> eh you know they call it Haskell 7 in the ticket as well so it's understandable
16:16:59 mputz joins (~Thunderbi@dslb-088-064-063-125.088.064.pools.vodafone-ip.de)
16:18:13 pengjiz joins (~user@2601:547:901:fab0:4223:43ff:febc:71e1)
16:20:48 × pie_ quits (~pie_bnc]@unaffiliated/pie-/x-0787662) (Quit: No Ping reply in 180 seconds.)
16:20:50 × devalot quits (~ident@mail.pmade.com) (Ping timeout: 256 seconds)
16:21:01 × Vulfe quits (~vulfe@2600:1702:31b0:34e0:95de:4ebb:b6a2:4942) (Remote host closed the connection)
16:21:12 devalot joins (~ident@mail.pmade.com)
16:21:44 pie_ joins (~pie_bnc]@unaffiliated/pie-/x-0787662)
16:21:44 Vulfe joins (~vulfe@2600:1702:31b0:34e0:95de:4ebb:b6a2:4942)
16:23:16 Saukk joins (~Saukk@2001:998:ec:944:a00f:6382:4f0:3e7e)
16:23:57 <dolio> All the revisions before 98 were 1.x, so that'd be a big jump.
16:24:13 nyaomin is now known as nyaomi
16:24:43 zclod joins (97436f3c@151.67.111.60)
16:25:40 × mputz quits (~Thunderbi@dslb-088-064-063-125.088.064.pools.vodafone-ip.de) (Ping timeout: 246 seconds)
16:26:21 × Vulfe quits (~vulfe@2600:1702:31b0:34e0:95de:4ebb:b6a2:4942) (Ping timeout: 272 seconds)
16:26:42 pjb joins (~t@2a01cb04063ec5007460d15e87468757.ipv6.abo.wanadoo.fr)
16:27:10 Vulfe joins (~vulfe@2600:1702:31b0:34e0:e57c:c44c:6e88:a916)
16:27:32 lazyshrk_ joins (~lazyshrk@128.199.58.13)
16:27:44 <boxscape> 98 to 2010 was also a big jump
16:28:38 <dolio> Realistically, I don't think any revisions have been significant enough to take it beyond 1.x in actual version numbers, given the previous numbering.
16:28:47 acro_ joins (~acro@188.166.31.185)
16:28:47 × acro_ quits (~acro@188.166.31.185) (Changing host)
16:28:47 acro_ joins (~acro@unaffiliated/acro)
16:28:52 plutoniix joins (~q@node-uqx.pool-125-24.dynamic.totinternet.net)
16:28:52 <boxscape> mhm
16:29:11 Vulfe_ joins (~vulfe@2600:1702:31b0:34e0:d958:171:8e7f:eb0c)
16:29:14 dredozub- joins (~dredozubo@37.139.21.214)
16:30:23 × hekkaidekapus quits (~tchouri@gateway/tor-sasl/hekkaidekapus) (Ping timeout: 240 seconds)
16:30:46 × dredozubov quits (~dredozubo@37.139.21.214) (Ping timeout: 260 seconds)
16:31:07 × robotmay quits (~beepboop@2001:8b0:7af0:2580:806d:1b3a:2bd5:8efb) (Remote host closed the connection)
16:31:47 × Vulfe quits (~vulfe@2600:1702:31b0:34e0:e57c:c44c:6e88:a916) (Ping timeout: 260 seconds)
16:33:32 × Vulfe_ quits (~vulfe@2600:1702:31b0:34e0:d958:171:8e7f:eb0c) (Ping timeout: 260 seconds)
16:33:42 philopsos joins (~caecilius@gateway/tor-sasl/caecilius)
16:34:01 × da39a3ee5e6b4b0d quits (~da39a3ee5@2403:6200:8876:cecf:313a:ef0a:c021:651e) (Quit: My MacBook has gone to sleep. ZZZzzz…)
16:34:29 robotmay joins (~beepboop@2001:8b0:7af0:2580:a48c:ccf9:aef1:cb86)
16:35:14 <whataday> I wonder how it handle IO before monad enter
16:36:12 × lambdabot quits (~lambdabot@haskell/bot/lambdabot) (Disconnected by services)
16:36:40 <ephemient> very awkwardly
16:36:58 lambdabot joins (~lambdabot@silicon.int-e.eu)
16:36:58 × lambdabot quits (~lambdabot@silicon.int-e.eu) (Changing host)
16:36:58 lambdabot joins (~lambdabot@haskell/bot/lambdabot)
16:38:38 <whataday> there's typeclass in that time?
16:38:54 Vulfe joins (~vulfe@2600:1702:31b0:34e0:d958:171:8e7f:eb0c)
16:39:12 <whataday> higher kind stuff?
16:39:31 <dolio> It had two systems. One was `main :: [Response] -> [Request]`. The other was some wrappers around that using continuation passing, which were essentially the same as monadic IO, but not recognized as a common pattern.
16:39:37 × acro quits (~acro@unaffiliated/acro) (Ping timeout: 272 seconds)
16:39:37 × lazyshrk quits (~lazyshrk@128.199.58.13) (Quit: ZNC 1.8.2 - https://znc.in)
16:39:37 × jkakar quits (~jkakar@178.162.204.214) (Ping timeout: 272 seconds)
16:39:37 acro_ is now known as acro
16:39:38 lazyshrk_ is now known as lazyshrk
16:39:41 phasespace joins (~sar@89-162-33-21.fiber.signal.no)
16:40:02 × mimi_vx quits (~mimi@2a01:490:16:1026:d961:6e73:8fa:323d) (Quit: WeeChat 3.0)
16:40:33 <dolio> Using the lists directly was rather error prone, so I guess most people used the CPS wrapper.
16:41:33 <ephemient> https://www.haskell.org/definition/haskell-report-1.2.ps.gz section 7 goes through the request/response list pattern, 7.5 the continuation-based
16:41:43 hekkaidekapus joins (~tchouri@gateway/tor-sasl/hekkaidekapus)
16:42:10 phaul joins (~phaul@ruby/staff/phaul)
16:42:43 dbmikus joins (~dbmikus@c-174-49-172-14.hsd1.pa.comcast.net)
16:42:47 × boxscape quits (54a35b08@gateway/web/cgi-irc/kiwiirc.com/ip.84.163.91.8) (Quit: Connection closed)
16:42:58 <whataday> aha, CPS is everywhere
16:43:42 <ephemient> and https://www.microsoft.com/en-us/research/publication/tackling-awkward-squad-monadic-inputoutput-concurrency-exceptions-foreign-language-calls-haskell/ is the paper on how IO monad makes our life better
16:43:42 × codygman quits (~codygman@47-184-107-46.dlls.tx.frontiernet.net) (Read error: Connection reset by peer)
16:44:02 × royal_screwup21 quits (52254809@gateway/web/cgi-irc/kiwiirc.com/ip.82.37.72.9) (Quit: Connection closed)
16:44:15 <whataday> but no IO a, what type CPS used?
16:44:27 royal_screwup21 joins (52254809@gateway/web/cgi-irc/kiwiirc.com/ip.82.37.72.9)
16:44:38 codygman joins (~codygman@47-184-107-46.dlls.tx.frontiernet.net)
16:45:02 <whataday> and also we can get value from it right? like get a from IO a
16:45:47 × arahael quits (~arahael@220-245-222-231.tpgi.com.au) (Ping timeout: 260 seconds)
16:46:05 × Kronic quits (~Kronic___@84.203.96.46) (Quit: Leaving)
16:46:15 boxscape joins (54a35b08@gateway/web/cgi-irc/kiwiirc.com/ip.84.163.91.8)
16:46:55 × eruditass quits (uid248673@gateway/web/irccloud.com/x-xjwjopbsnaxlyzup) (Quit: Connection closed for inactivity)
16:46:57 × boxscape quits (54a35b08@gateway/web/cgi-irc/kiwiirc.com/ip.84.163.91.8) (Client Quit)
16:47:06 nineonine joins (~nineonine@S01061cabc0b095f3.vf.shawcable.net)
16:47:44 mimi_vx joins (~mimi@2a01:490:16:1026:d923:3519:de60:eb74)
16:47:46 <int-e> type IO a = Cont ([Response] -> [Request]) a ~= (a -> [Response] -> [Request]) -> ([Response] -> [Request])
16:47:53 boxscape joins (54a35b08@gateway/web/cgi-irc/kiwiirc.com/ip.84.163.91.8)
16:49:16 × royal_screwup21 quits (52254809@gateway/web/cgi-irc/kiwiirc.com/ip.82.37.72.9) (Ping timeout: 272 seconds)
16:49:36 arahael joins (~arahael@194-193-194-178.tpgi.com.au)
16:49:36 × boxscape quits (54a35b08@gateway/web/cgi-irc/kiwiirc.com/ip.84.163.91.8) (Client Quit)
16:50:02 boxscape joins (54a35b08@gateway/web/cgi-irc/kiwiirc.com/ip.84.163.91.8)
16:52:25 × nineonine quits (~nineonine@S01061cabc0b095f3.vf.shawcable.net) (Remote host closed the connection)
16:52:37 nineonine joins (~nineonine@S01061cabc0b095f3.vf.shawcable.net)
16:52:38 <whataday> but type IO a = Word -> (a, Word) is ok now?
16:52:58 <whataday> IO a is an action, and that is a function
16:53:31 kenran joins (~kenran@87.123.205.253)
16:53:41 <whataday> that IO a is not an action
16:53:54 × nbloomf quits (~nbloomf@2600:1700:ad14:3020:10ca:6681:7c5c:1a7b) (Quit: My MacBook has gone to sleep. ZZZzzz…)
16:53:57 × nineonine quits (~nineonine@S01061cabc0b095f3.vf.shawcable.net) (Remote host closed the connection)
16:56:04 Trixar_za joins (~Trixar_za@185.103.96.147)
16:56:11 howdoi joins (uid224@gateway/web/irccloud.com/x-soxuifipgxjanjxg)
16:56:43 nbloomf joins (~nbloomf@2600:1700:ad14:3020:fdbb:443:c29e:a69e)
16:57:22 <int-e> whataday: I was just writing something that would make a monad out of the [Response] -> [Request] model for I/O.
16:57:51 nineonine joins (~nineonine@S01061cabc0b095f3.vf.shawcable.net)
16:58:05 <int-e> In such a way that you can actually implement an IO action that creates a single request, awaits the response, and passes a result on to the remaining computation.
16:58:25 × raehik quits (~raehik@cpc95906-rdng25-2-0-cust156.15-3.cable.virginm.net) (Ping timeout: 264 seconds)
16:58:57 heatsink joins (~heatsink@2600:1700:bef1:5e10:64b4:1541:658f:e8d8)
16:59:11 <whataday> m1 >>= (x.m2 >>= ( y.m3)) = (m1 >>= ( x.m2)) >>= ( y.m3)
16:59:13 Miroboru joins (~myrvoll@78.156.11.206)
16:59:14 <int-e> In practice I recommend treating IO as opaque unless you're writing really low-level code. type IO a = Word -> (a, Word) strikes me as having a really small world, which furthermore can easily be duplicated...
16:59:21 <whataday> from that article
16:59:29 × dbmikus quits (~dbmikus@c-174-49-172-14.hsd1.pa.comcast.net) (Quit: WeeChat 2.9)
16:59:38 <int-e> Word -> (a, Word) ~= State Word a is just a state monad
16:59:43 <whataday> that's not equivalent
16:59:45 <int-e> @unmtl State Word a
16:59:45 <lambdabot> Word -> (a, Word)
17:00:12 dbmikus joins (~dbmikus@c-174-49-172-14.hsd1.pa.comcast.net)
17:00:16 <boxscape> The paper mentions World -> (a, World) so I wonder if there's some confusion between Word and World here
17:00:46 × heatsink quits (~heatsink@2600:1700:bef1:5e10:64b4:1541:658f:e8d8) (Remote host closed the connection)
17:00:49 milanj_ joins (~milan@178-223-144-9.dynamic.isp.telekom.rs)
17:00:55 heatsink joins (~heatsink@2600:1700:bef1:5e10:64b4:1541:658f:e8d8)
17:01:02 <int-e> boxscape: That thought became part of the "small world" idea.
17:01:13 <whataday> f >>= (g >>= h) /= (f >>= g) >>= h
17:01:35 <int-e> whataday: well, that's not the right law
17:01:56 <int-e> f >=> (g >=> h) = (f >=> g) >=> h
17:02:21 <koz_> Yep, fish is associative.
17:02:31 <whataday> but in that paper it used >>= to describe the third law
17:02:37 × nineonine quits (~nineonine@S01061cabc0b095f3.vf.shawcable.net) (Ping timeout: 264 seconds)
17:02:51 <koz_> whataday: Monad laws are usually spelled in terms of bind and return.
17:02:59 <koz_> But they are more easily spelled in terms of fish and return.
17:03:14 <int-e> Unpacking a bit... f x >>= (\y -> g y >= h) = (f x >>= g) >>= h
17:03:26 <int-e> err, that >= should be >>=
17:03:48 geekosaur joins (42d52137@66.213.33.55)
17:03:51 <int-e> The Kleisli version is just so much easier to get right.
17:03:54 × milanj quits (~milan@178.220.18.116) (Ping timeout: 256 seconds)
17:04:41 <boxscape> I like join and pure
17:04:57 <int-e> oh and you can replace my `f x` by just `f` if you prefer that.
17:05:10 × codygman quits (~codygman@47-184-107-46.dlls.tx.frontiernet.net) (Read error: Connection reset by peer)
17:05:19 codygman joins (codygman@gateway/vpn/privateinternetaccess/codygman)
17:05:23 × philopsos quits (~caecilius@gateway/tor-sasl/caecilius) (Ping timeout: 240 seconds)
17:05:24 × codygman quits (codygman@gateway/vpn/privateinternetaccess/codygman) (Client Quit)
17:05:36 <int-e> sure there is join . join = join . fmap join
17:05:37 philopsos joins (~caecilius@gateway/tor-sasl/caecilius)
17:06:06 <int-e> But that's hard to make sense of :P
17:06:37 <boxscape> it's not quite as nice to look at but it's easier for me to think about what join does than what >>= or >=> do
17:06:42 <int-e> (if you think in terms of >>= and pure)
17:07:17 <koz_> boxscape: I think it depends heavily on the Monad instance in question. For some, >>= and >=> can actually be easier.
17:07:25 royal_screwup21 joins (52254809@gateway/web/cgi-irc/kiwiirc.com/ip.82.37.72.9)
17:07:29 <boxscape> hm, fair, that makes sense
17:07:31 <koz_> (and of course, YMMV)
17:07:55 <koz_> Like, for example, list definitely is easier in terms of join, I agree.
17:08:52 <whataday> when bind and >=> work on function, it's always weird
17:08:59 <whataday> I mean Reader
17:09:07 × Xnuk quits (~xnuk@45.76.202.58) (Quit: ZNC - https://znc.in)
17:09:25 Xnuk joins (~xnuk@vultr.xnu.kr)
17:09:28 <ezzieyguywuf> how often do you `hoogle generate`?
17:09:37 <boxscape> @hoogle generate
17:09:37 <lambdabot> Test.QuickCheck generate :: Gen a -> IO a
17:09:37 <lambdabot> Test.QuickCheck.Gen generate :: Gen a -> IO a
17:09:37 <lambdabot> Data.Vector generate :: Int -> (Int -> a) -> Vector a
17:09:55 × phaul quits (~phaul@ruby/staff/phaul) (Remote host closed the connection)
17:10:02 <int-e> hmm, not regularly
17:10:23 <ezzieyguywuf> I'm working on a revbump for the hoogle package and wondering if I should install a cronjob or something
17:10:29 <int-e> for lambdabot, usually when I update the thing, which is once or twice a year
17:10:32 phaul joins (~phaul@ruby/staff/phaul)
17:10:38 <ezzieyguywuf> or even where to tell it to put the db that the system-wide instance would read from...
17:10:42 × dbmikus quits (~dbmikus@c-174-49-172-14.hsd1.pa.comcast.net) (Ping timeout: 256 seconds)
17:10:42 × Varis quits (~Tadas@unaffiliated/varis) (Ping timeout: 268 seconds)
17:11:26 <ezzieyguywuf> gosh darnit neil, another package without all the test stuff bundled in, lol.
17:12:06 <hseg> why is it that unions are privileged in containers? they get the monoid instance, they get their mconcat version, etc etc
17:12:48 <koz_> hseg: Taking set as an example - how do you make a Monoid under intersection?
17:12:59 <koz_> s/set/Set/
17:13:03 <int-e> intersections don't have a law-abiding monoid instance
17:13:05 <hseg> Definitely a semigroup
17:13:13 <koz_> hseg: That's why they're privileged.
17:13:15 <int-e> and symmetric differences are uncommon
17:13:41 <hseg> hrm. and lifted operations?
17:13:53 <koz_> Lifted operations?
17:14:02 <hseg> i guess that's what monoidal-containers is for
17:14:18 <hseg> (<>) = liftA2 (<>)
17:14:21 <int-e> You mean f as bs = [a <> b | a <- as, b <- bs]?
17:14:33 <hseg> yeah
17:14:46 <int-e> too expensive to be the default, I think
17:15:32 bliminse joins (~bliminse@host109-158-129-129.range109-158.btcentralplus.com)
17:15:48 <int-e> that said I don't recall actively using the monoid instance(s) of the containers at all.
17:15:53 <hseg> why? they're both just a merge invocation, albeit with union having guarantees on its combinator's runtime
17:16:20 ransom_ joins (~c4264035@8.48.134.25)
17:16:30 Kronic joins (~Kronic___@84.203.96.46)
17:16:43 × hexo quits (~hexo@gateway/tor-sasl/hexo) (Ping timeout: 240 seconds)
17:16:45 <hseg> i do. basically am using monoidal-containers to simulate monoid-valued functions w/ finite support
17:16:49 <int-e> I'd rather reach for S.union and S.unions
17:16:58 <hseg> in particular, monomials
17:17:19 <int-e> (I'm talking about the default instance)
17:17:20 <merijn> hseg: It's more "why do the monoids suck so bad" :p
17:17:27 <hseg> ?
17:17:43 × srk quits (~sorki@gateway/tor-sasl/sorki) (Ping timeout: 240 seconds)
17:18:01 <merijn> hseg: "instance (Ord k, Semigroup v) => Monoid (Map k v)" is clearly superior to the current nonsense
17:18:02 star_cloud joins (~star_clou@ec2-34-220-44-120.us-west-2.compute.amazonaws.com)
17:18:05 <int-e> in the end, choices have been made that cannot easily be undone.
17:18:16 <hseg> fair
17:18:43 <merijn> There are vague plans on the containers github to possiblye eventually do this
17:18:53 <hseg> nice
17:18:56 <int-e> scary
17:19:28 dbmikus joins (~dbmikus@c-174-49-172-14.hsd1.pa.comcast.net)
17:19:30 <hseg> why didn't we do what we did for numeric types and have monoid instances discharged by newtypes?
17:20:11 × petersen quits (~petersen@redhat/juhp) (Quit: petersen)
17:20:41 <int-e> well, scary... maybe the right thing is to remove the existing monoid instance, keep it that way for a year and then add the new one?
17:20:48 raehik joins (~raehik@cpc95906-rdng25-2-0-cust156.15-3.cable.virginm.net)
17:21:04 <int-e> because changing it directly is a recipe for obscure bugs
17:21:08 <hseg> also, this dive into the containers api has made me hungry for a) a backpackified version to clarify the common parts and b) use th to generate all these precomposed specialisations
17:21:41 <hseg> int-e: of course. would expect this to be a multi-year migration like ftp and bbp
17:22:57 <merijn> int-e: That's one of the proposed paths
17:22:59 <solonarv> hseg: there actually is such a backpackified containers library, I believe, but I don't know how usable it is
17:23:26 <merijn> int-e: One suggestion was adding Data.Map.Semigroup with the right instance, delete the current one and later migrate Data.Map to be Data.Map.Semigroup
17:23:42 <hseg> yeah, picnic. it's demo-level, still needs a lot of work
17:24:12 SomeUser joins (57b0b9ed@p57b0b9ed.dip0.t-ipconnect.de)
17:24:58 SomeUser is now known as SomeOtherUser
17:25:22 steve-chavez joins (~steve-cha@190.43.229.137)
17:25:55 <hseg> hrm. am patching monoidal-containers a bit, am having some coercion issues http://ix.io/2IjP
17:26:00 <int-e> merijn: sounds reasonable
17:26:08 <hseg> basically GHC doesn't know that it can coerce under f
17:26:19 <steve-chavez> Hi there. Has anyone compiled cabal on ARM? Wonder if you could help me with instructions.. (I already have GHC)
17:26:51 boxscape61 joins (54a35b08@gateway/web/cgi-irc/kiwiirc.com/ip.84.163.91.8)
17:26:52 <hseg> but it should be possible by fmap'ing coerce in that parameter
17:27:07 <hseg> but that becomes ugly. any alternatives?
17:27:21 <SomeOtherUser> Hello, if I have: newtype Foo a = Foo a, is there a way to make it an instance of Foldable if, and only if a is Foldable?
17:27:37 <jle`> hm, 'a' can't be Foldable as you have written it
17:27:49 <jle`> since Foldables are always parameterized types (kind * -> *)
17:27:56 <jle`> and 'a' seems to be a kind-* type
17:28:14 <Kronic> I was confused for ages as to why my parser was working when I ran it once, but then broke when I mapped it over a list of inputs. Turns out the residual input was kept around from the previous parse
17:28:44 <SomeOtherUser> eg if i have Foo [Int] i want to fold over one of those Foos without extracting it
17:29:20 <jle`> you mean fold over the Int's in a Foo [Int] ?
17:29:25 <int-e> hseg: ghc can't do that. in the Kmettiverse there's some ugly hacks around this like https://hackage.haskell.org/package/profunctors-5.6/docs/Data-Profunctor-Unsafe.html#v:-35-. ... maybe there's a unary version of that somewhere too?
17:29:58 <SomeOtherUser> yes, jle`
17:30:22 × boxscape quits (54a35b08@gateway/web/cgi-irc/kiwiirc.com/ip.84.163.91.8) (Ping timeout: 256 seconds)
17:30:25 <jle`> hm, there isn't any way of getting around extracting it eventually somewhere
17:30:34 <jle`> but there are some library functions that can automate the extraction
17:30:46 <jle`> probably the cleanest thing to do is to just add a record accessor
17:30:53 <jle`> newtype Foo a = Foo { getFoo :: a }
17:31:02 <jle`> then you can (blah . getFoo)
17:31:09 nineonine joins (~nineonine@S01061cabc0b095f3.vf.shawcable.net)
17:31:18 <hseg> oh well. any performance impacts if i eta-expand so i can explicitly coerce in the right place?
17:31:22 <int-e> hseg: basically you want fmap coerce = coerce, but that may be highly unsound (imagine doing that with a Data.Set and types that have the same representation but different Ord instances)
17:32:07 <koz_> int-e: Set isn't a Functor.
17:32:26 <koz_> The 'fmap coerce = coerce' really _ought_ to be real, but sadly can't be for hysterical raisins.
17:32:36 × jules000 quits (~jules000@217-62-97-211.cable.dynamic.v4.ziggo.nl) (Remote host closed the connection)
17:32:46 <koz_> I think Iceland Jack did a writeup on this topic somewhere...
17:32:48 <SomeOtherUser> I see, I suppose I'll do it that way. Thanks fo rthe help
17:32:48 × nineonine quits (~nineonine@S01061cabc0b095f3.vf.shawcable.net) (Remote host closed the connection)
17:32:54 <SomeOtherUser> jle`
17:33:08 <hseg> ah... so there is no getting around explicitly unwrapping the newtype?
17:33:11 <jle`> SomeOtherUser: hm, another trick you could do is maybe use Data.Functor.Compose
17:33:15 asheshambasta joins (~user@ptr-e1lysaxt4bg7tmaahx1.18120a2.ip6.access.telenet.be)
17:33:21 nineonine joins (~nineonine@S01061cabc0b095f3.vf.shawcable.net)
17:33:38 <jle`> SomeOtherUser: if you wrap your Foo [Int] in Compose, you get `Compose Foo [] Int`
17:33:44 <jle`> and *that* has a Foldable instance
17:33:48 <jle`> that gets all the Ints
17:33:54 × phaul quits (~phaul@ruby/staff/phaul) (Ping timeout: 260 seconds)
17:34:04 <jle`> hseg: unsafeCoerce
17:34:29 <hseg> yeah, no, i'm not pushing that for my very first patch
17:34:31 <jle`> SomeOtherUser: so if you wrap all your Foo's in Compose then you get a Foldable (Compose Foo f) for any Foldable f
17:35:10 <jle`> hseg: oh yeah actually in this case f only needs to be Foldable
17:35:17 <jle`> so unsafeCoerce would definitely break
17:35:25 <jle`> for something like Set, under int-e's example
17:35:29 <merijn> int-e, koz: coerce through functors isn't unsafe
17:35:34 phaul joins (~phaul@ruby/staff/phaul)
17:35:40 <merijn> That why GHC added roles
17:35:56 <merijn> Of course it's unfortunate that GHC defaults to unsafe defaults for roles, but still
17:36:16 mputz joins (~Thunderbi@dslb-088-064-063-125.088.064.pools.vodafone-ip.de)
17:36:17 Ariakenom_ joins (~Ariakenom@2001:9b1:efb:fc00:3541:7c48:4826:58c0)
17:36:28 <merijn> And you can definitely coerce stuff like "Map Int Int" to "Map Int (Sum Int)" directly
17:36:42 <hseg> yeah, but you can't blithely coerce at a polymorphic type constructor without knowing the role
17:36:44 <merijn> Hell, being able to do that is exactly why Coercible got invented
17:37:11 <int-e> it's too subtle that type families basically can't be functors
17:37:28 <koz_> Yeah, type families require some care around a whole bunch of things.
17:37:50 × nineonine quits (~nineonine@S01061cabc0b095f3.vf.shawcable.net) (Ping timeout: 268 seconds)
17:38:11 hexo joins (~hexo@gateway/tor-sasl/hexo)
17:38:17 srk joins (~sorki@gateway/tor-sasl/sorki)
17:39:14 <int-e> And, of course, you can insist on a nominal role for a type parameter of something that also has a Functor instance.
17:40:00 <int-e> In which case fmap coerce will be allowed but replacing it by coerce should be rejected.
17:40:13 p-core joins (~Thunderbi@2001:718:1e03:5128:2ab7:7f35:48a1:8515)
17:40:30 × mputz quits (~Thunderbi@dslb-088-064-063-125.088.064.pools.vodafone-ip.de) (Ping timeout: 256 seconds)
17:40:50 <SomeOtherUser> jle` Interesting, I think I"ll go with the other approach for now, as I've not yet worked with Compose and I don't know what else it would affect. But it's worth trying out. Let's see what works best.
17:41:03 × Vulfe quits (~vulfe@2600:1702:31b0:34e0:d958:171:8e7f:eb0c) (Remote host closed the connection)
17:41:41 <jle`> SomeOtherUser: no problem :) the COmpose approach is something you can do if you literally need "a Foldable instance", ie., if you are using a function that works for all Foldable so you need to massage the type into something you can give that function
17:41:49 Vulfe joins (~vulfe@2600:1702:31b0:34e0:d958:171:8e7f:eb0c)
17:41:56 <jle`> SomeOtherUser: if you just want to fold over it, then yeah, explicitly extracting is probably the cleanest
17:42:03 × chele quits (~chele@ip5b416ea2.dynamic.kabel-deutschland.de) (Ping timeout: 260 seconds)
17:42:33 × christo quits (~chris@81.96.113.213) (Remote host closed the connection)
17:43:04 × zclod quits (97436f3c@151.67.111.60) (Remote host closed the connection)
17:44:17 christo joins (~chris@81.96.113.213)
17:47:21 <boxscape61> hm in the paper about IO linked earlier SPJ says " I have to say that I think the GHC approach [of using World -> (a, World)] is a bit of a hack [...] it relies for its correctness on the fact that the compiler never duplicates a redex" Seems like this could now be made non-hacky by using a linear arrow in that type
17:47:39 oish joins (~charlie@228.25.169.217.in-addr.arpa)
17:47:57 boxscape61 is now known as boxscape
17:48:27 <dolio> That's not the only problem with it.
17:49:03 <boxscape> What are the other problems?
17:49:09 <int-e> hseg: Anyway rather than wrecking your brain on how to tame `coerce`, you can just unfold the definition of unionsWith: unionsWith f ts = Foldable.foldl' (unionWith f) empty ts
17:49:26 <jle`> boxscape: how would that model make sense in the context of concurrency/parallelism?
17:49:28 <dolio> It's okay as an implementation detail, but from a semantic perspective, it doesn't really accomplish the goals of having IO.
17:49:42 Varis joins (~Tadas@unaffiliated/varis)
17:49:47 <koz_> I think Edward spelled out some issues with this approach.
17:49:54 <koz_> Let me see if I can find relevant citation.
17:49:58 gproto23 joins (~gproto23@unaffiliated/gproto23)
17:50:05 <boxscape> jle` hm fair point
17:50:20 × gproto23 quits (~gproto23@unaffiliated/gproto23) (Remote host closed the connection)
17:50:38 <koz_> http://comonad.com/reader/2011/free-monads-for-less-3/
17:50:49 <koz_> Section "Who Needs the RealWorld?"
17:50:54 <koz_> First couple of paragraphs.
17:51:06 <boxscape> thanks
17:51:12 <int-e> Hmm... IO isn't free?
17:51:28 <pjb> free monads for less??? You mean you give me money if I use your free monads?
17:51:33 <dolio> For instance, you can't really make sense of infinite loops that do IO without making the actual function arrow have effects. And arguably the point of IO is to avoid that.
17:51:38 <koz_> int-e: Read the article lol?
17:51:43 <koz_> (just one section)
17:51:51 <int-e> koz_: it just sounded funny :)
17:52:03 <koz_> pjb: Rofl.
17:52:17 <boxscape> dolio hm I see
17:52:21 <int-e> koz_: because of the many meanings of 'free'.
17:52:34 <koz_> int-e: Yeah, gotta love overloading!
17:53:07 × oish quits (~charlie@228.25.169.217.in-addr.arpa) (Quit: Lost terminal)
17:53:14 nineonine joins (~nineonine@S01061cabc0b095f3.vf.shawcable.net)
17:53:28 oish joins (~charlie@228.25.169.217.in-addr.arpa)
17:53:35 <hseg> hrm. sure, but when most of the codebase is coerce-copying a type's api to that of the newtype that wraps it, it leaves a bad taste
17:54:10 × nineonine quits (~nineonine@S01061cabc0b095f3.vf.shawcable.net) (Remote host closed the connection)
17:54:56 nineonine joins (~nineonine@50.216.62.2)
17:55:47 <koz_> hseg: You can DerivingVia the type class parts of that, at least.
17:56:09 <int-e> koz_: but yeah this is compatible with my way of thinking which is that the realworld token is just a clever hack of injecting data dependencies that ensure that IO actions cannot be evaluated out of order; no semantic meaning is attached to the token.
17:56:30 <koz_> int-e: Yeah, which is fine. However, Edward's criticisms of the semantics are valid.
17:56:39 × kuribas quits (~user@ptr-25vy0i85lvzulltbjkf.18120a2.ip6.access.telenet.be) (Remote host closed the connection)
17:56:39 <hseg> mostly see gnd in this codebase (monoidal-containers)
17:57:13 <koz_> hseg: GND just enables 'deriving newtype', which is just a more restricted 'deriving ... via ...'.
17:57:19 <hseg> i know
17:57:44 <koz_> I've really fallen in love with DerivingVia. Help, I'm turning into Iceland Jack.
17:57:59 <hseg> same
17:58:02 <koz_> (like, I'm fairly sure he has a mandatory DerivingVia use quota at this point)
17:58:28 <hseg> hm. why is ghc complaining v in sig differs from under coerce? http://ix.io/2Ik1
17:58:42 × notzmv quits (~user@unaffiliated/zmv) (Ping timeout: 260 seconds)
17:59:06 × SomeOtherUser quits (57b0b9ed@p57b0b9ed.dip0.t-ipconnect.de) (Remote host closed the connection)
17:59:25 <int-e> GND is basically just `coerce`-ing all the class methods.
17:59:34 <int-e> hseg: you need ScopedTypeVariables and a forall v.
17:59:43 <int-e> (k too)
17:59:47 <hseg> :facepalm:
17:59:49 <koz_> Ah yes, it's _that_ issue.
17:59:56 × oish quits (~charlie@228.25.169.217.in-addr.arpa) (Quit: Lost terminal)
18:00:14 <hseg> was wondering why i was seeing explicit foralls with no typeapplications
18:00:23 oish joins (~charlie@228.25.169.217.in-addr.arpa)
18:01:05 × christo quits (~chris@81.96.113.213) (Remote host closed the connection)
18:01:46 × rdivyanshu quits (uid322626@gateway/web/irccloud.com/x-fzjxsprliudkdzwi) (Quit: Connection closed for inactivity)
18:02:13 × royal_screwup21 quits (52254809@gateway/web/cgi-irc/kiwiirc.com/ip.82.37.72.9) (Quit: Connection closed)
18:02:35 royal_screwup21 joins (52254809@gateway/web/cgi-irc/kiwiirc.com/ip.82.37.72.9)
18:03:15 × asheshambasta quits (~user@ptr-e1lysaxt4bg7tmaahx1.18120a2.ip6.access.telenet.be) (Ping timeout: 272 seconds)
18:04:26 hnOsmium0001 joins (uid453710@gateway/web/irccloud.com/x-esxplnjepcfjthew)
18:05:29 is_null joins (~jpic@pdpc/supporter/professional/is-null)
18:06:38 × coot quits (~coot@37.30.50.101.nat.umts.dynamic.t-mobile.pl) (Quit: coot)
18:07:10 × oish quits (~charlie@228.25.169.217.in-addr.arpa) (Ping timeout: 272 seconds)
18:07:16 × wroathe quits (~wroathe@c-68-54-25-135.hsd1.mn.comcast.net) (Ping timeout: 240 seconds)
18:07:48 × royal_screwup21 quits (52254809@gateway/web/cgi-irc/kiwiirc.com/ip.82.37.72.9) (Ping timeout: 272 seconds)
18:07:56 coot joins (~coot@37.30.50.101.nat.umts.dynamic.t-mobile.pl)
18:08:43 oish joins (~charlie@228.25.169.217.in-addr.arpa)
18:12:31 christo joins (~chris@81.96.113.213)
18:12:52 × phaul quits (~phaul@ruby/staff/phaul) (Ping timeout: 256 seconds)
18:17:30 runningatnight joins (4f792d3c@host-79-121-45-60.kabelnet.hu)
18:17:50 <hseg> and the bloat of 'containers' continues... why have map if you can define a Functor instance?
18:19:20 phaul joins (~phaul@ruby/staff/phaul)
18:20:19 × milanj_ quits (~milan@178-223-144-9.dynamic.isp.telekom.rs) (Quit: Leaving)
18:22:56 <runningatnight> I simply can't get my head around a few things about type definitions.
18:23:02 cosimone_ joins (~cosimone@2001:b07:ae5:db26:d849:743b:370b:b3cd)
18:24:49 × cosimone quits (~cosimone@93-47-228-249.ip115.fastwebnet.it) (Ping timeout: 264 seconds)
18:24:50 cosimone_ is now known as cosimone
18:25:21 geowiesnot joins (~user@87-89-181-157.abo.bbox.fr)
18:26:24 × shadowdaemon quits (~user@unaffiliated/shadowdaemon) (Ping timeout: 256 seconds)
18:26:31 <runningatnight> In particular, when a variable type denotes some recursive call. Is "recursion" its own type, like Integer? - would sound strange or silly, but I can't think of anything else right now.
18:27:45 <geekosaur> I don't understand what you're asking. Recursion is not a specific type, but types can be recursive
18:28:13 <runningatnight> For example:
18:28:16 <runningatnight> foldr :: (a -> b -> b) -> b -> [a] -> bfoldr f v [] = vfoldr f v (x:xs) = f x (foldr f v xs)
18:28:45 × justanotheruser quits (~justanoth@unaffiliated/justanotheruser) (Ping timeout: 240 seconds)
18:28:54 <runningatnight> I don't get what b means here when it is in place of a recursion.
18:29:15 <koala_man> do you mean higher order functions in general?
18:29:19 <geekosaur> that was multiple lines before your client mangled it, I assume?
18:29:41 <runningatnight> foldr :: (a -> b -> b) -> b -> [a] -> b
18:29:47 <runningatnight> foldr f v [] = v
18:29:48 <runningatnight> foldr f v (x:xs) = f x (foldr f v xs)
18:30:08 <geekosaur> right. b is just some type which can be distinct from a
18:30:43 × Vulfe quits (~vulfe@2600:1702:31b0:34e0:d958:171:8e7f:eb0c) (Remote host closed the connection)
18:31:03 <ephemient> b is unrelated to the recursion. you could define a (very boring) non-recursive function with the same signature
18:31:07 <koala_man> the type would have been the same whether the function was implemented recursively or not
18:31:20 kkd parts (~memxor@unaffiliated/kartikeya) ("WeeChat 2.9")
18:33:31 <runningatnight> Will the type of "b" depend on the result of the recursion, if it is an integer or some other type? - sorry, if this make no sense.
18:34:06 <jle`> it depends on the type of the second argument
18:34:19 <jle`> myFunc :: (a -> b -> b) -> b -> a -> b
18:34:25 <jle`> myFunc f x y = f y x x
18:34:30 <jle`> do you understand that type signature?
18:34:34 × geowiesnot quits (~user@87-89-181-157.abo.bbox.fr) (Ping timeout: 256 seconds)
18:35:06 <jle`> runningatnight: ah hm, do you understand that a function :: X -> Y -> Z can be interpretd as a function that takes an X and a Y and returns a Z ?
18:35:07 <ralu> ford "iterates over list of type a" to produce type b by applying function of type a->b->b
18:35:15 Vulfe joins (~vulfe@2600:1702:31b0:34e0:d958:171:8e7f:eb0c)
18:35:18 <jle`> in that case yes, 'b' is type type of the return value of the foldr
18:35:21 <jle`> *type of
18:35:40 <jle`> so if `foldr blah blah blah` returns an Int, then b is Int in that case
18:35:49 <jle`> but it doesn't have anything to do with recursion, that's true for all function types.
18:36:43 <jle`> recurisve or not
18:36:47 <hseg> hrm... would be nice to be able to convert typeclasses and instances to module signatures and implementations and back
18:37:23 <hseg> eg thinking of making mono-traversable:IsMap into a module signature to avoid instantiation costs
18:39:51 × Vulfe quits (~vulfe@2600:1702:31b0:34e0:d958:171:8e7f:eb0c) (Remote host closed the connection)
18:39:57 Vulfe joins (~vulfe@2600:1702:31b0:34e0:d958:171:8e7f:eb0c)
18:40:04 × _deepfire quits (~user@80.92.100.69) (Remote host closed the connection)
18:42:49 × MOSCOS quits (~MOSCOS@122.54.107.175) (Remote host closed the connection)
18:43:14 MOSCOS joins (~MOSCOS@122.54.107.175)
18:43:41 <dminuoso> 19:17:49 hseg | and the bloat of 'containers' continues... why have map if you can define a Functor instance?
18:43:49 <dminuoso> Because you can't define a Functor instance for say Set.
18:44:11 <hseg> sure, but why does that need to infect the other types?
18:44:26 <dminuoso> What do you mean by "infect"?
18:44:51 <hseg> the fact that Set needs a monomorphic map doesn't justify monomorphising map for say Map
18:45:23 <hseg> unless you're arguing for internal consistency over consistency with standard practice
18:45:44 <dminuoso> What generic interface do you propose, that would fit all data types in containers?
18:46:29 <hseg> none. but a patchwork of interfaces, like we're used to from elsewhere, should work.
18:46:49 royal_screwup21 joins (52254809@gateway/web/cgi-irc/kiwiirc.com/ip.82.37.72.9)
18:47:00 <dminuoso> Seq and (Map k) have Functor
18:47:13 <dminuoso> IntSet is MonoFunctor at best
18:47:19 <hseg> off the top of my head, some combination of Functor/Foldable/Traversable, their keyed variants from Lens, the Align hierchy etc
18:47:19 <dminuoso> Set would require a special OrdFunctor
18:47:47 <dminuoso> There's just no obvious pattern here to abstract over, that would bring you any benefits.
18:47:52 <glguy> Since the .Lazy and .Strict types use the same types you can't really drive the interface with typeclasses
18:48:15 <glguy> modules use the*
18:48:18 <hseg> yet more reason to distinguish between lazy and strict data
18:48:22 <nshepperd> what's so bad about having fmap as well as the monomorphic map
18:48:30 <glguy> I don't want the types to be different; I want to get to pick
18:49:15 <hseg> nshepperd: on its own, nothing. as an example of the wheel being monomorphically reinvented across containers, it's a good scapegoat
18:49:31 <hseg> glguy: ? what do you lose if we split the types?
18:49:55 <dminuoso> Arguably Data.Map.Strict.map/Data.Map.Lazy.map has no reason to exist, but its existence is not a good enough reason to "try and force a generic interface over them all"
18:49:58 <hseg> dminuoso: sure. so you monomorphise what needs to be monomorphised, and keep the others generic
18:50:01 <glguy> the ability to use strict/lazy variants as needed on the same Map
18:50:11 <dminuoso> hseg: thats what containers does.
18:50:16 <glguy> and trying to wedge everything into typeclasses to save on names doesn't get me much
18:50:21 <dminuoso> We have Functor for IntMap and (Map k)
18:50:53 minimario joins (2fe3e53b@047-227-229-059.res.spectrum.com)
18:51:21 <hseg> sure. but i'm arguing that our choice of what gets a monomorphic name and what doesn't is weird
18:51:58 <dminuoso> What's so bad about being monomorphic?
18:52:20 <glguy> some monomorphic names get added when people miss them enough, but it's just hard to be completely consistent
18:52:33 <hseg> i find it distasteful, especially when generic interfaces exist
18:52:34 × runningatnight quits (4f792d3c@host-79-121-45-60.kabelnet.hu) (Ping timeout: 245 seconds)
18:52:45 <dminuoso> hseg: Do you have any particular example here?
18:52:57 <merijn> hseg: IntMap is asymptotically better than Map, that's why it exists
18:53:27 <int-e> bold claim
18:53:32 <merijn> Map is binary search tree, IntMap is not (same applies to IntSet)
18:53:47 <minimario> ohhh
18:53:51 <minimario> cool!
18:54:00 <hseg> sure. not arguing against specialization. but it doesn't mean it shouldn't try to harmonize its api with common practice
18:54:01 <merijn> int-e: Why?
18:54:03 <hseg> as it does
18:54:15 <int-e> IntMap is still a binary tree in the middle, despite the bitmaps at the leafs that help if you have adjacent keys.
18:54:20 <int-e> s/Map/Set
18:54:28 <int-e> And IntMap is a binary tree.
18:54:44 <merijn> int-e: Asymptotically better does not require a different complexity class, though :p
18:54:49 <hseg> dminuoso: just the general vibe from comparing the various maplike containers over the past day
18:55:18 <koz_> merijn: IntMap _is_ of a different complexity class - lookups are bounded by max key bitlength, which is a constant, since the key is an Int.
18:55:34 juuandyy joins (~juuandyy@90.166.144.65)
18:55:34 <int-e> merijn: Your asymptotic improvement is an illusion. On that level of abstraction an IntMap can only hold 2^w different values where w is the word width, while a Map can hold as many as you like.
18:55:45 <merijn> koz_: "Map Int" is also bounded by max key bit length, though
18:56:08 <merijn> int-e: Why is it an illusion
18:56:08 <hseg> in any case, i'll put my money where my mouth is and (eventually) try to harmonize the containers types
18:56:08 <int-e> You'll never fit it into the available address space, of course, because that's (usually) also limited by the word size.
18:56:14 <koz_> merijn: OK, yeah, in that case, sure.
18:56:20 <monochrom> I just received my new 16GB-RAM computer today. My Map cannot exceed that. :)
18:56:25 <koz_> I thought it was 'Map whatever' to 'IntMap'.
18:56:43 <merijn> monochrom: That's why I used a 256GB RAM machine for Haskell!
18:56:52 <monochrom> Haha
18:56:52 <int-e> merijn: Basically "asymptotic" is meaningless here because we cannot make the numbers large enough for there to be a difference.
18:57:00 <koz_> merijn: GHC 10 will have Death Star support. :P
18:57:09 × geekosaur quits (42d52137@66.213.33.55) (Ping timeout: 245 seconds)
18:57:14 <koz_> GHC 11 will add Dyson Sphere support to that.
18:57:20 <monochrom> Um, how does Death Star help?
18:57:23 wroathe joins (~wroathe@c-68-54-25-135.hsd1.mn.comcast.net)
18:57:23 <merijn> int-e: If you have a constant factor improvement you are still asymptotically better :)
18:57:29 <int-e> merijn: no
18:57:37 <koz_> monochrom: I corrected my joke.
18:57:44 <monochrom> Oh haha OK
18:57:49 <koz_> I got Death Stars and Dyson spheres confused.
18:57:53 <koz_> Mea culpa.
18:58:41 <monochrom> On that note, I wonder why the Empire settled for merely a death star, the First Order merely a death planet. Neither aimed high for a death dyson sphere.
18:58:41 <merijn> int-e: 'f' is asymptotically better than 'g' IFF there is an value 'x' such that for all values y > x, f(y) > g(y)
18:59:00 <koz_> monochrom: Death Matrioshka Brain.
18:59:04 <merijn> int-e: If f is a constant factor better than g then that trivially holds for all input sizes
18:59:34 <merijn> I think I got in this argument before here :p
18:59:42 <monochrom> But seriously, "asymptotic" means big-Theta, you drop the constant factor.
18:59:44 chibi_ joins (~chibi@75-26-238-119.lightspeed.glvwil.sbcglobal.net)
18:59:55 <int-e> I bet I can make IntMap slower than Map by a carefully constructed example.
19:00:02 <merijn> monochrom: big Theta is all lies anyway
19:00:33 <monochrom> That is still not license to mistake asymptotic for something else.
19:00:35 <int-e> Because you only need w+1 element to force it to use its maximal depth.
19:00:48 <merijn> monochrom: But I'm not
19:01:17 <chibi_> Halloah.
19:01:19 justsomeguy joins (~justsomeg@unaffiliated/--/x-3805311)
19:01:31 <merijn> int-e: I'd like to see that and the corresponding "Map Int" input, tbh :>
19:02:23 <int-e> > M.fromList [(2^i :: Int, i) | i <- [0..64]] -- including 64 is deliberate
19:02:25 <lambdabot> fromList [(-9223372036854775808,63),(0,64),(1,0),(2,1),(4,2),(8,3),(16,4),(3...
19:02:46 <int-e> the path to 0 has siblings on every level.
19:03:09 <int-e> (if you make that into an IntMap)
19:03:24 berberman_ joins (~berberman@unaffiliated/berberman)
19:03:33 × berberman quits (~berberman@unaffiliated/berberman) (Ping timeout: 268 seconds)
19:03:36 <merijn> Right, but is that sufficient to prove that it's less efficient in terms of performance
19:04:20 cole-h joins (~cole-h@c-73-48-197-220.hsd1.ca.comcast.net)
19:04:33 × Saukk quits (~Saukk@2001:998:ec:944:a00f:6382:4f0:3e7e) (Remote host closed the connection)
19:04:44 <jle`> > M.showTree $ M.fromList [(2^i :: Int, i) | i <- [0..64]]
19:04:46 <lambdabot> error:
19:04:46 <lambdabot> • showTree has moved to Data.Map.Internal.Debug.showTree.
19:04:46 <lambdabot> • In the expression:
19:04:58 × minimario quits (2fe3e53b@047-227-229-059.res.spectrum.com) (Remote host closed the connection)
19:05:01 × wroathe quits (~wroathe@c-68-54-25-135.hsd1.mn.comcast.net) (Ping timeout: 256 seconds)
19:05:09 <jle`> > M.splitRoot $ M.fromList [(2^i :: Int, i) | i <- [0..64]]
19:05:11 <lambdabot> [fromList [(-9223372036854775808,63),(0,64),(1,0),(2,1),(4,2),(8,3),(16,4),(...
19:05:18 <jle`> oh dear
19:05:33 <int-e> jle`: The Data.Map tree is flatter of course
19:05:54 <jle`> > IM.splitRoot $ IM.fromList [(2^i :: Int, i) | i <- [0..64]]
19:05:56 <lambdabot> [fromList [(-9223372036854775808,63)],fromList [(0,64),(1,0),(2,1),(4,2),(8,...
19:06:04 × dbmikus quits (~dbmikus@c-174-49-172-14.hsd1.pa.comcast.net) (Ping timeout: 265 seconds)
19:06:19 <jle`> oof
19:06:24 <jle`> > map IM.splitRoont . IM.splitRoot $ IM.fromList [(2^i :: Int, i) | i <- [0..64]]
19:06:27 <lambdabot> error:
19:06:27 <lambdabot> Not in scope: ‘IM.splitRoont’
19:06:27 <lambdabot> Perhaps you meant one of these:
19:06:34 <jle`> > map IM.splitRoot . IM.splitRoot $ IM.fromList [(2^i :: Int, i) | i <- [0..64]]
19:06:36 <lambdabot> [[fromList [(-9223372036854775808,63)]],[fromList [(0,64),(1,0),(2,1),(4,2),...
19:06:45 <int-e> merijn: well, lucky me
19:06:49 <jle`> i guess the directions alternate
19:08:25 × cr3 quits (~cr3@192-222-143-195.qc.cable.ebox.net) (Ping timeout: 246 seconds)
19:09:35 <int-e> merijn: The example is good enough: https://paste.debian.net/1177166/
19:10:32 × cosimone quits (~cosimone@2001:b07:ae5:db26:d849:743b:370b:b3cd) (Quit: cosimone)
19:11:03 × royal_screwup21 quits (52254809@gateway/web/cgi-irc/kiwiirc.com/ip.82.37.72.9) (Quit: Connection closed)
19:11:30 royal_screwup21 joins (52254809@gateway/web/cgi-irc/kiwiirc.com/ip.82.37.72.9)
19:11:47 <int-e> But you can certainly make this more interesting by adding more nodes at depth w.
19:12:23 <int-e> (say, replace 2^i by x `xor` 2^i, where x is the node you want to have at that depth)
19:16:00 justanotheruser joins (~justanoth@unaffiliated/justanotheruser)
19:16:07 × bliminse quits (~bliminse@host109-158-129-129.range109-158.btcentralplus.com) (Ping timeout: 246 seconds)
19:16:15 cr3 joins (~cr3@192-222-143-195.qc.cable.ebox.net)
19:16:16 × royal_screwup21 quits (52254809@gateway/web/cgi-irc/kiwiirc.com/ip.82.37.72.9) (Ping timeout: 256 seconds)
19:17:02 × OpenSorceress quits (~opensorce@unaffiliated/screamingbanshee) (Read error: Connection reset by peer)
19:17:09 bliminse joins (~bliminse@host109-158-129-129.range109-158.btcentralplus.com)
19:17:28 × Rudd0 quits (~Rudd0@185.189.115.98) (Ping timeout: 256 seconds)
19:18:02 × p-core quits (~Thunderbi@2001:718:1e03:5128:2ab7:7f35:48a1:8515) (Remote host closed the connection)
19:18:37 <int-e> merijn: well let's make it a little more convincing: https://paste.debian.net/1177169/
19:19:33 <int-e> (ignore the comment on the first line, I actually edited the second line between recompiling)
19:19:55 hololeap joins (~hololeap@unaffiliated/hololeap)
19:20:31 fuzzypixelz joins (~fuzzypixe@eth-west-pareq2-46-193-4-100.wb.wifirst.net)
19:20:38 <int-e> Also Strict/Lazy makes no real difference (and it shouldn't when basically all you have are lookups).
19:21:17 <fuzzypixelz> is there really no way for me to learn haskell "by doing"
19:21:36 Tuplanolla joins (~Tuplanoll@91-159-68-239.elisa-laajakaista.fi)
19:21:37 <fuzzypixelz> a very simple mini-project to get my hands dirty?
19:21:38 mouseghost joins (~draco@wikipedia/desperek)
19:21:51 <int-e> is there any other way?
19:21:56 <sm[m]> fuzzypixelz: project Euler is good
19:22:22 <merijn> fuzzypixelz: AOC :P
19:22:29 <merijn> sm[m]: tbh, I gotta disagree there
19:22:35 <int-e> yeah something that focusses on algorithms may be more pleasant to start with than something that requires IO and parsing.
19:22:38 <int-e> so not AoC
19:22:46 × oxide quits (~lambda@unaffiliated/mclaren) (Quit: oxide)
19:22:49 <justsomeguy> Why do I get 0 rather than 128 when I run “abs (minBound :: Int8)”?
19:22:52 Deide joins (~Deide@217.155.19.23)
19:23:07 <merijn> sm[m]: Project Euler is mostly numerical trickery, not programming. It also forces you to spend most of your time dealing with the least pleasant bits of Haskell (fromIntegral hell, etc.)
19:23:11 <merijn> @where exercises
19:23:11 <lambdabot> http://www.haskell.org/haskellwiki/H-99:_Ninety-Nine_Haskell_Problems https://github.com/bitemyapp/learnhaskell http://www.reddit.com/r/dailyprogrammer/ http://www.reddit.com/r/programmingchallenges/
19:23:15 <int-e> > abs (minBound :: Int8)
19:23:17 <lambdabot> -128
19:23:28 <xerox_> that's not very abs
19:23:32 <justsomeguy> Right...
19:23:41 <int-e> but expected
19:23:50 <merijn> xerox_: That's because it overflows and overflow wraps
19:23:52 <xerox_> because a->a
19:23:52 <int-e> 128 can't be represented, it overflows to -128
19:24:05 × oish quits (~charlie@228.25.169.217.in-addr.arpa) (Ping timeout: 240 seconds)
19:24:10 <sm[m]> It's a source of mini projects, and it worked well when I was starting out
19:24:35 <justsomeguy> int-e: Ohh, damn, now it makes sense.
19:24:43 <merijn> sm[m]: That's why I made the @where exercises thing :p
19:25:08 royal_screwup21 joins (52254809@gateway/web/cgi-irc/kiwiirc.com/ip.82.37.72.9)
19:25:11 <sm[m]> nice
19:25:12 <merijn> Those have more programming oriented exercises/projects, rather than numerical ones
19:25:36 <ephemient> hmm, I don't think I've needed any fromIntegral tricks with AoC
19:25:57 <justsomeguy> int-e: “abs $ toInteger (minBound :: Int8)” does indeed work. Also I wonder why does the negative range have 128 numbers, while the positive range has only 127?
19:26:17 <merijn> ephemient: I meant for Project Euler
19:26:30 <sm[m]> But there's nothing wrong with some simple number tasks is there ? The domain was simple enough to not distract from learning haskell
19:26:39 <ephemient> oh. yeah, that is all mathematical, programming being secondary
19:26:41 <int-e> justsomeguy: 2s complenment, working modulo 256... note that you have 256 total bit patterns in total
19:27:15 justsomeguy looks up twos complement on wikipedia ...
19:27:19 <ephemient> I did use Haskell + arithmoi for some of PE, but it's not always a great fit
19:27:29 <int-e> justsomeguy: so you either have ambiguity (say both a positive and a negative zero) or one of the signs gets more values than the other.
19:28:05 <ephemient> for comparison, floating point picks the first option, and has both a positive and negative zero
19:28:11 × bliminse quits (~bliminse@host109-158-129-129.range109-158.btcentralplus.com) (Quit: leaving)
19:28:12 <int-e> justsomeguy: the reason why the negative range wins out is mostly convenience (treating the most significant bit as a sign bit while working modulo 256)
19:28:15 mputz joins (~Thunderbi@dslb-088-064-063-125.088.064.pools.vodafone-ip.de)
19:29:14 <int-e> oh a third option would be to have invalid bit patterns that do not represent a number (which floating point also has, for different reasons)
19:29:28 dbmikus joins (~dbmikus@c-174-49-172-14.hsd1.pa.comcast.net)
19:30:01 <merijn> sm[m]: I mean, it's not bad, but it does often force people to have tons of fromIntegral/realToFrac hacks in their code and the focus on numerical trickery over programming things means it's "not great" in terms of getting better at Haskell programming patterns (not that it can't be fun or anything, but I feel that practicing haskell programming is usually better suited by more programmy problems)
19:30:54 × Franciman quits (~francesco@host-82-54-12-32.retail.telecomitalia.it) (Quit: Leaving)
19:31:17 <ephemient> none of these challenges give you experience with actual engineering in haskell, which I think is harder to pick up
19:31:52 <sm[m]> Not everyone is the same, we know nothing about what fuzzypixel, probably a beginner, really needs. I stand by project Euler as one valid suggestion
19:31:57 <ephemient> although I suppose that's not unique; it's true of any other language you'd be trying to apply too
19:32:02 <merijn> If you want an engineering challenge I can give you one :p
19:33:07 <ephemient> I do agree with merijn that Project Euler isn't a good introduction to Haskell, or any language (aside from CAS packages)
19:34:13 weechat_1 joins (~mingc@2400:8902::f03c:91ff:feb7:8e82)
19:35:37 × star_cloud quits (~star_clou@ec2-34-220-44-120.us-west-2.compute.amazonaws.com) (Ping timeout: 268 seconds)
19:36:14 × juuandyy quits (~juuandyy@90.166.144.65) (Ping timeout: 268 seconds)
19:37:33 × weechat_2 quits (~mingc@2400:8902::f03c:91ff:feb7:8e82) (*.net *.split)
19:37:33 × davean quits (~davean@davean.sciesnet.net) (*.net *.split)
19:38:53 × fresheyeball quits (~isaac@c-71-237-105-37.hsd1.co.comcast.net) (Quit: WeeChat 2.7.1)
19:39:04 guest1216 joins (~user@49.5.6.87)
19:39:46 geekosaur joins (42d52137@66.213.33.55)
19:41:13 × dbmikus quits (~dbmikus@c-174-49-172-14.hsd1.pa.comcast.net) (Read error: Connection reset by peer)
19:42:31 star_cloud joins (~star_clou@ec2-34-220-44-120.us-west-2.compute.amazonaws.com)
19:42:37 dbmikus joins (~dbmikus@c-174-49-172-14.hsd1.pa.comcast.net)
19:43:39 davean joins (~davean@davean.sciesnet.net)
19:44:01 × guest1216 quits (~user@49.5.6.87) (Ping timeout: 264 seconds)
19:45:11 stevenxl joins (uid133530@gateway/web/irccloud.com/x-dagdxzdthcnbrsqa)
19:46:49 fuzzypixelz_ joins (~fuzzypixe@eth-west-pareq2-46-193-4-100.wb.wifirst.net)
19:47:05 × justanotheruser quits (~justanoth@unaffiliated/justanotheruser) (Read error: Connection reset by peer)
19:47:27 juuandyy joins (~juuandyy@90.166.144.65)
19:48:13 × fuzzypixelz quits (~fuzzypixe@eth-west-pareq2-46-193-4-100.wb.wifirst.net) (Ping timeout: 264 seconds)
19:48:13 fuzzypixelz_ is now known as fuzzypixelz
19:49:26 Bjornar joins (bjornargh@cassarossa.samfundet.no)
19:51:19 justanotheruser joins (~justanoth@unaffiliated/justanotheruser)
19:51:21 <geekosaur> the evalprompt is less interesting than it might be, because it can't access xmonad running state
19:51:38 <geekosaur> it's just a mini-ghci built into xmonad
19:52:30 × nbloomf quits (~nbloomf@2600:1700:ad14:3020:fdbb:443:c29e:a69e) (Quit: My MacBook has gone to sleep. ZZZzzz…)
19:52:46 × cfricke quits (~cfricke@unaffiliated/cfricke) (Quit: WeeChat 3.0)
19:53:34 <geekosaur> blah, wrong channel again
19:55:33 nbloomf joins (~nbloomf@2600:1700:ad14:3020:fdbb:443:c29e:a69e)
19:55:43 × rayyyy quits (~nanoz@gateway/tor-sasl/nanoz) (Ping timeout: 240 seconds)
19:59:09 × mounty quits (~mounty@210.1.196.133) (Ping timeout: 260 seconds)
19:59:17 × mud quits (~mud@unaffiliated/kadoban) (Read error: Connection reset by peer)
19:59:38 mud joins (~mud@unaffiliated/kadoban)
20:00:08 × justanotheruser quits (~justanoth@unaffiliated/justanotheruser) (Ping timeout: 256 seconds)
20:04:01 <justsomeguy> Out of curiosity, how do you like xmonad? I've been using i3 for a few years, and mostly like it, and was thinking that xmonad would be similar enough but also give my an excuse to practice my Haskell.
20:05:50 × wonko7 quits (~wonko7@2a01:e35:2ffb:7040:4535:f480:7dff:b3b5) (Ping timeout: 268 seconds)
20:06:35 <geekosaur> I've been using it since 2007ish (0.3 release)
20:06:50 <monochrom> @where exercises
20:06:50 <lambdabot> http://www.haskell.org/haskellwiki/H-99:_Ninety-Nine_Haskell_Problems https://github.com/bitemyapp/learnhaskell http://www.reddit.com/r/dailyprogrammer/ http://www.reddit.com/r/programmingchallenges/
20:07:16 <geekosaur> I'm also a maintainer, so just a bit biased :)
20:07:52 cosimone joins (~cosimone@93-47-228-249.ip115.fastwebnet.it)
20:08:15 mounty joins (~mounty@210.1.196.133)
20:09:30 jules000 joins (~jules000@86-91-126-28.opennet.kpn.net)
20:12:39 rprije joins (~rprije@14-203-203-69.tpgi.com.au)
20:15:14 justanotheruser joins (~justanoth@unaffiliated/justanotheruser)
20:19:05 × phaul quits (~phaul@ruby/staff/phaul) (Ping timeout: 240 seconds)
20:19:34 nrmt^ joins (nrm@ip98-184-89-2.mc.at.cox.net)
20:21:10 × SomeoneSerge quits (~someone-s@37.120.212.76) (Quit: WeeChat 3.0)
20:22:36 × elfets quits (~elfets@ip-37-201-23-96.hsi13.unitymediagroup.de) (Ping timeout: 240 seconds)
20:23:06 wonko7 joins (~wonko7@lns-bzn-55-82-255-183-4.adsl.proxad.net)
20:23:52 phaul joins (~phaul@ruby/staff/phaul)
20:25:04 × Moyst quits (~moyst@212-149-213-144.bb.dnainternet.fi) (Ping timeout: 256 seconds)
20:27:03 gxt joins (~gxt@gateway/tor-sasl/gxt)
20:28:43 × hiroaki quits (~hiroaki@ip4d16fa3b.dynamic.kabel-deutschland.de) (Ping timeout: 265 seconds)
20:29:39 mbomba joins (~mbomba@bras-base-toroon2719w-grc-53-142-114-5-26.dsl.bell.ca)
20:30:07 × juuandyy quits (~juuandyy@90.166.144.65) (Quit: Konversation terminated!)
20:30:57 <Kronic> I'll go ahead and say based on the previous suggestions that I have found AOC to be extremely helpful for me in learning Haskell. Most of the time AOC problems have one data structure or trick that can make them a lot easier
20:31:36 <Kronic> E.g a map, a parser that's a little more than ifs and elses, so for me as a hobbyist who long since forgot most of my haskell knowledge, it has been a great vessel for picking it back up again
20:31:44 × tlaxkit quits (~kvirc@89.35.63.16) (Ping timeout: 268 seconds)
20:32:08 <Kronic> If your goal is to do AOC fast as well as learn Haskell then it's a terrible idea, but if you wanna spend an extra couple of days learning the right way to do something then that's a good idea I think, it has worked for me anyway.
20:34:04 × justsomeguy quits (~justsomeg@unaffiliated/--/x-3805311) ()
20:37:44 knupfer joins (~Thunderbi@200116b82c3d4400d43255fffe083957.dip.versatel-1u1.de)
20:37:46 × knupfer quits (~Thunderbi@200116b82c3d4400d43255fffe083957.dip.versatel-1u1.de) (Client Quit)
20:37:58 knupfer joins (~Thunderbi@i59F7FF55.versanet.de)
20:38:16 Moyst joins (~moyst@212-149-213-144.bb.dnainternet.fi)
20:40:50 hiroaki joins (~hiroaki@ip4d168e73.dynamic.kabel-deutschland.de)
20:42:23 × royal_screwup21 quits (52254809@gateway/web/cgi-irc/kiwiirc.com/ip.82.37.72.9) (Quit: Connection closed)
20:42:47 royal_screwup21 joins (52254809@gateway/web/cgi-irc/kiwiirc.com/ip.82.37.72.9)
20:46:19 tlaxkit joins (~kvirc@89.35.63.16)
20:46:50 × tlaxkit quits (~kvirc@89.35.63.16) (Client Quit)
20:47:16 × royal_screwup21 quits (52254809@gateway/web/cgi-irc/kiwiirc.com/ip.82.37.72.9) (Ping timeout: 240 seconds)
20:48:24 drincruz joins (~adriancru@ool-44c748be.dyn.optonline.net)
20:50:23 × jules000 quits (~jules000@86-91-126-28.opennet.kpn.net) (Quit: Leaving...)
20:53:50 × nbloomf quits (~nbloomf@2600:1700:ad14:3020:fdbb:443:c29e:a69e) (Quit: My MacBook has gone to sleep. ZZZzzz…)
20:56:38 nbloomf joins (~nbloomf@76.217.43.73)
20:57:34 × nbloomf quits (~nbloomf@76.217.43.73) (Client Quit)
20:57:57 jneira joins (501e6453@gateway/web/cgi-irc/kiwiirc.com/ip.80.30.100.83)
21:01:53 elfets joins (~elfets@ip-37-201-23-96.hsi13.unitymediagroup.de)
21:02:34 nyd joins (~nyd@unaffiliated/elysian)
21:08:20 citizen_stig joins (~citizen_s@2001:982:9f64:1:d0e7:75a3:7ee:babc)
21:08:32 justsomeguy joins (~justsomeg@216.186.218.241)
21:08:32 × justsomeguy quits (~justsomeg@216.186.218.241) (Changing host)
21:08:32 justsomeguy joins (~justsomeg@unaffiliated/--/x-3805311)
21:11:32 × Miroboru quits (~myrvoll@78.156.11.206) (Ping timeout: 256 seconds)
21:11:45 Miroboru joins (~myrvoll@129-241-228-96-gw.cgn.ntnu.no)
21:12:44 × knupfer quits (~Thunderbi@i59F7FF55.versanet.de) (Ping timeout: 272 seconds)
21:13:05 × mounty quits (~mounty@210.1.196.133) (Ping timeout: 240 seconds)
21:13:56 son0p joins (~son0p@181.136.122.143)
21:14:59 softwarm joins (4408f588@ip68-8-245-136.sd.sd.cox.net)
21:16:56 × Miroboru quits (~myrvoll@129-241-228-96-gw.cgn.ntnu.no) (Ping timeout: 240 seconds)
21:18:07 shadowdaemon joins (~user@unaffiliated/shadowdaemon)
21:18:16 × son0p quits (~son0p@181.136.122.143) (Ping timeout: 240 seconds)
21:18:27 <tomsmeding> It's fun, I'm working through some of the AoC problems for this year and suddenly I understand where the most arbitrary questions in this channel come from
21:18:47 <tomsmeding> like: is there a vector library that automatically extends when I index past its length
21:19:01 <tomsmeding> reading that yesterday I was like, why on earth would you want that
21:19:13 Miroboru joins (~myrvoll@78.156.11.206)
21:19:13 tomsmeding does AoC day 15: "aaaaah that's why"
21:19:18 <sondr3> When I want to ensure that whatever file I'm reading/writing is UTF8, what should I use? I'm currently using Data.Text and haven't found UTF-8 validation that doesn't involve ByteString -> Text
21:19:19 × Tario quits (~Tario@201.192.165.173) (Read error: Connection reset by peer)
21:20:11 son0p joins (~son0p@181.136.122.143)
21:20:33 <iqubic> tomsmeding: LOL.
21:22:09 justsomeguy also asks many strangely specific questions (like how to query types at compile time) as he follows along haskellbook.com, but he usually tries to provide some context.
21:23:27 troll_ joins (~troll@2a0c:5e00:0:8::1d)
21:23:32 <troll_> haskell is shit.
21:23:45 <iqubic> troll_: You are wrong.
21:23:54 <ski> do you have any more specific criticism ?
21:24:05 <troll_> haskell is bloated too.
21:24:17 <justsomeguy> Or, what specifically are you having trouble with that makes you feel that way?
21:24:35 <troll_> haskell is nasty as well.
21:24:48 ChanServ sets mode +o dolio
21:24:49 dolio sets mode +b troll_!*@*
21:25:02 dolio sets mode -o dolio
21:25:06 <ski> perhaps you mean GHC, or applications or libraries produced by it. or are you talking about the actual parts of the language itself ?
21:25:10 <justsomeguy> He must have been really bored.
21:25:25 troll_ parts (~troll@2a0c:5e00:0:8::1d) ()
21:25:54 <Kronic> Maybe he was talking about that annoying rugby player that is forever in my google search results...
21:26:08 <ski> @where Haskel
21:26:08 <lambdabot> <http://web.archive.org/web/20070703001910/http://www.cs.chalmers.se/~augustss/pics/haskel.gif>
21:27:08 <merijn> sondr3: Well, how would you possibly do validation without going "ByteString -> Text"?
21:27:49 <sondr3> merijn: close my eyes and wish Haskell used UTF-8 by default? :P
21:28:03 <merijn> sondr3: That's a nonsensical statement
21:28:20 <merijn> The contents of files cannot be dictated by a programming language
21:28:32 <merijn> The data in a file is whatever it is
21:29:19 <merijn> And the only way to check is "Read bytes, try to parse them as Text using an encoding"
21:30:01 Tario joins (~Tario@201.192.165.173)
21:30:03 <sondr3> I know, hyperbole, I just wish working with text in Haskell was a bit more like Rust
21:30:07 <merijn> sondr3: Once it is Text it's already unicode data, there's no need to do validation on Text
21:30:34 <merijn> sondr3: I don't know what Rust does, but GHC does the only thing that can sensibly *be* done
21:31:19 justsomeguy sometimes wishes that someone would create a "distribution" of haskell that has performant array-based utf-8 strings by default, first-class syntax for maps and sets, and more container types in Prelude.
21:31:25 wroathe joins (~wroathe@c-68-54-25-135.hsd1.mn.comcast.net)
21:31:42 <merijn> "utf8 strings" is, honestly, just a confusion
21:32:07 <monochrom> :)
21:32:09 <merijn> Once it's parsed as Text or String you operate on *unicode*. UTF-8 is just a way to serialise unicode into data
21:32:10 × jespada quits (~jespada@90.254.245.49) (Ping timeout: 268 seconds)
21:32:19 <merijn> There is no such thing as "utf8 strings"
21:32:36 <merijn> Sure, in languages like C where "string" is just "sequence of bytes" people conflate the two
21:32:45 <justsomeguy> My understanding is that utf-8 uses one byte per codepoint, as opposed to two. Is that right?
21:32:51 <merijn> justsomeguy: No
21:32:51 <monochrom> I have heard worse blasphemy than "utf8 strings". "high ascii", for starters.
21:33:02 jespada joins (~jespada@90.254.245.49)
21:33:14 × Vulfe quits (~vulfe@2600:1702:31b0:34e0:d958:171:8e7f:eb0c) (Remote host closed the connection)
21:33:34 <merijn> justsomeguy: UTF-8 is a variable length encoding that uses anywhere from 1 to 3 (or is it 4?) bytes per unicode codepoint (note: codepoint *not* character)
21:33:39 <dolio> I'm trying to imagine what that means. Is that like high Valyrian?
21:33:59 <monochrom> utf8 uses 1-4 (even 5? I forgot) bytes per codepoint. The whole point of utf8.
21:33:59 <merijn> monochrom: Wanna know something to gross people out and/or confuse them?
21:34:06 Vulfe joins (~vulfe@75-28-176-196.lightspeed.evtnil.sbcglobal.net)
21:34:06 <monochrom> Yes!
21:34:12 <merijn> monochrom: UTF-7 is a thing that exists
21:34:24 <monochrom> haha darn
21:34:48 <merijn> monochrom: Like base64 it's designed to not get corrupted by legacy mail systems that don't allow high bits to be sit
21:34:52 <merijn> s/sit/set
21:34:54 <sondr3> I meant that it used UTF8 as its internal representation, but fair
21:35:15 <merijn> sondr3: The value of that is, honestly, rather marginal
21:35:23 <justsomeguy> merijn: lol, I shouldn't have trusted that reddit comment about strings. I'm going to have to look up a summary of unicode in the near future.
21:35:48 <merijn> It might make for some *slightly* faster parser implementation...maybe, but that assumes you're not being bottle-necked by IO anyway
21:35:56 × wroathe quits (~wroathe@c-68-54-25-135.hsd1.mn.comcast.net) (Ping timeout: 240 seconds)
21:36:06 ski . o O ( sum : summary :: product : ? )
21:36:41 <merijn> sondr3: There was an experiment with UTF-8 based text, but it made interoperation with text-icu more cumbersome and less efficient and text-icu is the closest to thing to exist for properly handling complex unicode operations
21:36:54 <monochrom> dolio: it's called "high" because each number used is >= 128.
21:37:11 <dolio> Oh.
21:37:49 <dolio> Is it intended to mean what you get by subtracting 128 from the number?
21:37:51 <monochrom> So basically recall any DOS codepage that is a strict superset of ASCII
21:38:01 <monochrom> Naw.
21:38:12 <merijn> The number of cases where the copy/conversion to Text's internal representation is a bottleneck is pretty small and only occurs when your IO is somehow fast enough to outpace your ability to process data. Which can certainly happen, but at that point you'll have bigger engineering challenges than I can't zero-copy utf-8 bytes into Text
21:38:44 × Vulfe quits (~vulfe@75-28-176-196.lightspeed.evtnil.sbcglobal.net) (Ping timeout: 256 seconds)
21:39:25 <monochrom> It's any encoding+charset (they weren't separated back then) that uses the range 128-255 for non-English characters, picture characters, and other special characters not in ASCII.
21:42:13 erolm_a joins (~erolm_a@82.24.185.133)
21:43:56 <dolio> Oh, okay.
21:44:34 × sondr3 quits (~sondr3@cm-84.211.56.132.getinternet.no) (Quit: Leaving)
21:47:35 × geekosaur quits (42d52137@66.213.33.55) (Remote host closed the connection)
21:50:15 × nek0 quits (~nek0@mail.nek0.eu) (Remote host closed the connection)
21:50:41 × citizen_stig quits (~citizen_s@2001:982:9f64:1:d0e7:75a3:7ee:babc) ()
21:50:42 <noctux> Hmm, what do I want to use if I want a dead simple, constant-time string comparison for String or Text? Somehow, google was not all that helpful, and stuff like https://security.stackexchange.com/a/83671 that it did turn up, well, look dangerous given a sufficiently smart compiler
21:51:15 <monochrom> ==
21:51:18 geekosaur joins (42d52137@66.213.33.55)
21:51:59 chang joins (~textual@host-173-230-65-85.njjcmar.clients.pavlovmedia.com)
21:52:17 ddellacosta joins (dd@gateway/vpn/mullvad/ddellacosta)
21:52:19 <ephemient> at some point we may have to worry about sufficiently smart processors as well
21:52:40 <ephemient> it's hard to ensure constant-time without actual primitives to support it
21:54:32 Vulfe joins (~vulfe@2600:1702:31b0:34e0:d958:171:8e7f:eb0c)
21:54:37 pavonia joins (~user@unaffiliated/siracusa)
21:54:55 <noctux> Sure :) tell me something new :p In my dayjob, I'm doing wcet analysis for hard realtime stuff, so I know the problem. But there probably should be some best practices or libraries that people do use for passwords validation in haskell that make a credible effort at preventing timing sidechannels
21:55:24 <monochrom> Is "constant-time" now hijacked to mean "uniform, best case time = worst case time so it is less vulnerable to timing attack", instead of the already standard "O(1)"?
21:56:05 <noctux> No, I was probably just not specific enough :p
21:56:41 <ephemient> the term is sort of hijiacked though
21:57:26 × geekosaur quits (42d52137@66.213.33.55) (Remote host closed the connection)
21:57:26 <ephemient> e.g. https://en.wikipedia.org/wiki/Timing_attack uses the term "constant-time" all over
21:57:41 × gOOgler quits (uid125351@gateway/web/irccloud.com/x-gvsdgdjawgkiapwd) (Quit: Connection closed for inactivity)
21:57:42 <monochrom> I will resist it.
21:57:43 × ransom_ quits (~c4264035@8.48.134.25) (Quit: My MacBook has gone to sleep. ZZZzzz…)
21:57:49 × phaul quits (~phaul@ruby/staff/phaul) (Ping timeout: 246 seconds)
21:58:04 <noctux> And actually: bestcase == worstcase makes your algorithm O(1)
21:58:04 <monochrom> "uniform-time" is a much more accurate and honest wording.
21:58:13 <monochrom> No.
21:58:25 <noctux> Well yes?
21:58:32 <ephemient> no
21:58:46 royal_screwup21 joins (52254809@gateway/web/cgi-irc/kiwiirc.com/ip.82.37.72.9)
21:58:57 <noctux> If your worstcase timing is your bestcase timing, your algorithm is input independent
21:59:02 × Vulfe quits (~vulfe@2600:1702:31b0:34e0:d958:171:8e7f:eb0c) (Ping timeout: 260 seconds)
21:59:02 <monochrom> I have an array of length n. I want to look for an occurrence of the number 4 in it. So I loop over the array and do linear-time search.
21:59:06 <boxscape> these algorithms still have different runtime depending on the lengths of the strings to compare it seems, no?
21:59:20 <noctux> (And you got an deterministic execution environment as a bonus)
21:59:21 <ephemient> yes
21:59:45 <noctux> Well global bestcase/wostcasr obvs.
22:00:05 <ephemient> security-related "constant time" (or "uniform time", I hadn't heard that before but it's sane) doesn't generally refer to changing the size of inputs
22:00:06 <noctux> Or is that "worst worstcase" to you?
22:00:09 phaul joins (~phaul@ruby/staff/phaul)
22:00:11 <ephemient> while O(...) time does
22:00:17 <monochrom> Normally my loop exits as soon as the first occurrence is found. Best case is 4 occurs at the first spot I check, O(1) time. Worst case is 4 doesn't occur, O(n) time.
22:00:36 <monochrom> So, not O(1) and best case < worst case.
22:00:53 <monochrom> But the whole array is still length n.
22:01:23 Rudd0 joins (~Rudd0@185.189.115.108)
22:01:27 <ephemient> e.g. for password comparisons, the goal is that it always runs in o(40)=O(40) or however long your hash is
22:01:36 <monochrom> The security people have a proven history of wrong wording and inventing unnecessary concepts.
22:02:08 <ephemient> they're not concerned about changing hash size, but they are concerned about different inputs at that size
22:02:14 <noctux> well, we are leaving the point of my question, but for what it is worth: "global best case timing (for all possible inputs) == global wort case timing (for all possible inputs)" implies (in the logical implication sense) algorithm is in O(1)
22:02:17 × DavidEichmann quits (~david@62.110.198.146.dyn.plus.net) (Remote host closed the connection)
22:02:30 <noctux> I've never claimed anything else
22:03:02 <ephemient> an algorithm that takes O(1) time on arbitrary-sized input can only process O(1) of it, so... it's basically taking bounded-sized input?
22:03:19 <monochrom> But no one implied "for all inputs". Only "for all inputs of the same size".
22:04:09 × sord937 quits (~sord937@gateway/tor-sasl/sord937) (Quit: sord937)
22:04:18 <noctux> monochrom: well I implied it with "global"
22:04:25 <dolio> If the algorithms assume fixed input size, why are the ones on that page testing the input lengths?
22:04:35 <monochrom> The flawed logic of taking "worst case time" to mean "worst case time for all inputs, therefore for all input sizes" implies that worst case time is infinity.
22:05:12 <dolio> The stack overflow page, that is.
22:05:20 <noctux> monochrom: well, please, never write real-time critical software I'm forced to use than :P
22:05:33 <noctux> but yeah, probably im "blind" to my domain :P
22:05:39 <noctux> and its terminology
22:05:55 <noctux> but that is not really my problem anyways
22:06:26 <noctux> in that case, it's about doing password comparision in some webservice I've written in my spare time
22:06:30 <dolio> Several of the algorithms on the stack exchange page appear to leak whether or not the two inputs differ in length, too.
22:06:57 <monochrom> I think you would never compare two passwords in plain text in the first place?
22:07:02 <noctux> dolio: well: you could only provide guarantees up to a fixed length of input anyways
22:07:11 wroathe joins (~wroathe@c-68-54-25-135.hsd1.mn.comcast.net)
22:07:28 <noctux> monochrom: I'm leaking pbk2df2 hashes
22:07:33 <noctux> via the sidechannel
22:07:41 <noctux> not a real problem
22:07:49 × royal_screwup21 quits (52254809@gateway/web/cgi-irc/kiwiirc.com/ip.82.37.72.9) (Quit: Connection closed)
22:08:07 <noctux> but not best practice either, as breaking them via hashcat is probably faster than against the webapi of theserver(tm)
22:08:10 <monochrom> OK, then use the byte-wise xor shown there.
22:08:11 royal_screwup21 joins (52254809@gateway/web/cgi-irc/kiwiirc.com/ip.82.37.72.9)
22:09:58 <ephemient> going back to the original point... it seems like it could be defeated by a sufficiently clever compiler, and to get around that, we'd need proper primitives :-/
22:10:11 <noctux> well, and my question was: "that cannot really be best practice, can it?"
22:11:43 mirrorbird joins (~psutcliff@2a00:801:447:b1bf:a43d:1573:86a9:1f86)
22:12:44 × royal_screwup21 quits (52254809@gateway/web/cgi-irc/kiwiirc.com/ip.82.37.72.9) (Ping timeout: 256 seconds)
22:12:45 <monochrom> I don't pay attention to "best practice", so I can't answer that. But I can remind you what to watch out for.
22:13:11 <monochrom> && and || are short-circuiting. If you use foldr (&&) you're toasted.
22:13:37 <monochrom> "any", "all", "and", "or" do that, so they're toasted too.
22:14:09 <ephemient> as far as I'm aware, best practice is not to use a high-level language (even C counts, to some extent)
22:14:12 <monochrom> (==) for most list and array types also exit early at the first sight of a difference.
22:14:26 <solonarv> '(==1) . length . filter p' will do, I think
22:14:27 × softwarm quits (4408f588@ip68-8-245-136.sd.sd.cox.net) (Quit: Ping timeout (120 seconds))
22:14:33 <monochrom> (But you should benchmark to find out for sure.)
22:14:35 <solonarv> but really if you need performance guarantees, don't write Haskell
22:14:48 notzmv joins (~user@unaffiliated/zmv)
22:14:52 Vulfe joins (~vulfe@2600:1702:31b0:34e0:d958:171:8e7f:eb0c)
22:15:03 <noctux> ephemient: well yeah, C cannot do it either, even when trying to be clever with volatile...
22:15:34 × takuan quits (~takuan@178-116-218-225.access.telenet.be) (Remote host closed the connection)
22:15:34 × mbomba quits (~mbomba@bras-base-toroon2719w-grc-53-142-114-5-26.dsl.bell.ca) (Quit: WeeChat 3.0)
22:15:44 × eyenx quits (~eyenxeyen@unaffiliated/eye/x-1653358) (Quit: Bridge terminating on SIGTERM)
22:15:46 <monochrom> I haven't checked whether hash comparison in cryptonite is time-safe. But you should check.
22:17:02 <monochrom> If it comes down to coding up your own comparison, be aware of lazy evaluation, and check generated Core code, Cmm code, and asm code. (Look at all three, they help explain each other.)
22:17:44 <monochrom> Lazy evaluation is required knowledge for this because the reason foldr (&&) is toasted is because of lazy evaluation.
22:18:16 softwarm joins (4408f588@ip68-8-245-136.sd.sd.cox.net)
22:18:29 <monochrom> But to a large extent, if you understand why foldr (&&) quits early, you already understand the main issue.
22:18:42 <noctux> yeah, I know, that's why I've asked. ASM code is a tricky one, because that makes my application non-portable
22:18:47 <dolio> If C can't do it, then my guess would be that cryptonite isn't time safe.
22:19:03 <noctux> but crypto-libs is a good idea
22:19:07 <Rembane> If it isn't built in many different kinds of ASM
22:19:08 × kenran quits (~kenran@87.123.205.253) (Quit: leaving)
22:19:27 × Vulfe quits (~vulfe@2600:1702:31b0:34e0:d958:171:8e7f:eb0c) (Ping timeout: 260 seconds)
22:19:33 <noctux> unfortunately saltine for instance seems to lack nacls crypto_verify
22:19:52 eyenx joins (~eyenxeyen@unaffiliated/eye/x-1653358)
22:20:28 <noctux> (and if nacls broken, probably a lot more is on fire then some online helpdesk software for remote coputer exercises :P)
22:21:14 × raehik quits (~raehik@cpc95906-rdng25-2-0-cust156.15-3.cable.virginm.net) (Ping timeout: 256 seconds)
22:21:20 <dolio> I would say you probably should just not be using Haskell to write such algorithms, unless it something in Haskell that generates the right code.
22:22:22 <noctux> well, haskell is nice for all the other parts. but yeah, the "use nacl" part can be generalized to "use a native C/Asm cryptolib that exposes a convenient function"
22:22:28 <merijn> monochrom: Man, I don't think I could correctly write a time-attacking safe comparison in C, let alone haskell :p
22:22:57 <merijn> noctux: FWIW, wrapping missing C functions via the FFI is fairly trivial
22:23:07 raehik joins (~raehik@cpc95906-rdng25-2-0-cust156.15-3.cable.virginm.net)
22:23:18 <monochrom> I would check the generated asm code. But I wouldn't worry about it beyond that.
22:23:43 <merijn> noctux: So if it binds NaCl, but is just lacking the binding you can just quickly implement the binding yourself
22:23:47 <ephemient> marshalling is the worst part of FFI, and that's not *too* bad unless you have complex structures with pointers and function pointers and stuff
22:24:01 <merijn> ephemient: Function pointers is still pretty easy
22:24:09 <monochrom> Marshalling is uniform-time. Perhaps that helps.
22:24:16 <ephemient> it's not hard, you just have to think about the lifetime
22:24:26 <merijn> Writing Storable instances sucks, therefore avoid mutating structs from haskell :p
22:24:34 <merijn> ephemient: Sure, but that's the same as in C :p
22:24:43 <merijn> ephemient: Also, you're aware of ForeignPtr? ;)
22:24:46 <noctux> well, in that case, yes. I mean, its two strings -> char *
22:25:14 <noctux> but still, I'm a bit surprised that I seem to be the first one having that issue?
22:25:38 <ephemient> merijn: I was thinking FunPtr...
22:25:49 <ephemient> you can't stick that in a ForeignPtr, can you?
22:26:07 <merijn> ephemient: hmm, not sure
22:26:07 mounty joins (~mounty@2001:8000:2f59:0:e5bf:1b14:94d8:de8b)
22:26:19 <merijn> But allocated FunPtr are rare
22:26:30 <merijn> In fact, can those exist at all in C? I don't think so?
22:27:05 <ephemient> I've done it before with libffi - can generate "closures" in C
22:27:17 <monochrom> No. I used Haskell for allocate function pointers.
22:27:31 × fuzzypixelz quits (~fuzzypixe@eth-west-pareq2-46-193-4-100.wb.wifirst.net) (Remote host closed the connection)
22:27:33 <ephemient> (not in conjunction with Haskell… that seems like a poor use of the power of each language)
22:27:41 <monochrom> heh
22:27:46 × mirrorbird quits (~psutcliff@2a00:801:447:b1bf:a43d:1573:86a9:1f86) (Quit: Leaving)
22:27:54 fuzzypixelz joins (~fuzzypixe@eth-west-pareq2-46-193-4-100.wb.wifirst.net)
22:28:33 <merijn> ephemient: You can generate closures, sure, but those aren't function pointers, just data. I don't think you can generate a function pointer at runtime in C anyway
22:28:48 <merijn> Unless you count dlopen, and even that doesn't "create" them in the sense of needing GC
22:28:58 <ephemient> merijn: libffi generates an executable stub at runtime
22:29:13 <ephemient> and you do have to remember to free them...
22:30:26 <noctux> merijn: well, there are jitting libraries
22:31:09 <noctux> but yeah, the language itself does not provide any way to "create" new code at runtime
22:31:51 <ephemient> it's definitely platform-specific at a minimum
22:33:13 × softwarm quits (4408f588@ip68-8-245-136.sd.sd.cox.net) (Remote host closed the connection)
22:33:39 joaj joins (~joaj@2001:818:e326:8200:5273:55b7:3a86:e6ca)
22:33:50 × Varis quits (~Tadas@unaffiliated/varis) (Ping timeout: 268 seconds)
22:34:41 <monochrom> w00t https://www.manpagez.com/info/libffi/libffi-3.0.13/libffi_10.php#The-Closure-API
22:34:52 Vulfe joins (~vulfe@2600:1702:31b0:34e0:d958:171:8e7f:eb0c)
22:35:45 ransom_ joins (~c4264035@8.48.134.25)
22:35:49 × matryoshka quits (~matryoshk@184.75.223.227) (Quit: ZNC 1.8.2 - https://znc.in)
22:35:59 × eyenx quits (~eyenxeyen@unaffiliated/eye/x-1653358) (Remote host closed the connection)
22:36:20 royal_screwup21 joins (52254809@gateway/web/cgi-irc/kiwiirc.com/ip.82.37.72.9)
22:36:54 matryoshka joins (~matryoshk@2606:6080:1002:8:3285:30e:de43:8809)
22:37:08 × michalz quits (~user@185.246.204.52) (Remote host closed the connection)
22:37:27 Varis joins (~Tadas@unaffiliated/varis)
22:37:30 × royal_screwup21 quits (52254809@gateway/web/cgi-irc/kiwiirc.com/ip.82.37.72.9) (Client Quit)
22:37:30 × matryoshka quits (~matryoshk@2606:6080:1002:8:3285:30e:de43:8809) (Client Quit)
22:37:37 × justanotheruser quits (~justanoth@unaffiliated/justanotheruser) (Read error: Connection reset by peer)
22:37:52 royal_screwup21 joins (52254809@gateway/web/cgi-irc/kiwiirc.com/ip.82.37.72.9)
22:41:19 eyenx joins (~eyenxeyen@unaffiliated/eye/x-1653358)
22:42:22 <noctux> hmm, neither cryptonite nor hsopenssl provide anything in A -> A -> Bool either :/
22:42:27 <noctux> pity
22:42:28 × xff0x quits (~fox@2001:1a81:5229:f800:d68d:6553:23c5:e8ae) (Ping timeout: 268 seconds)
22:42:57 xff0x joins (~fox@2001:1a81:5229:f800:6bf4:ad68:acd0:bb77)
22:43:05 × royal_screwup21 quits (52254809@gateway/web/cgi-irc/kiwiirc.com/ip.82.37.72.9) (Ping timeout: 268 seconds)
22:44:15 <noctux> oh: https://hackage.haskell.org/package/libsodium-1.0.18.1/docs/Libsodium.html#v:crypto_verify_16
22:44:17 <noctux> nice
22:44:51 royal_screwup21 joins (52254809@gateway/web/cgi-irc/kiwiirc.com/ip.82.37.72.9)
22:45:01 <noctux> or even better: sodium_compare
22:46:20 <noctux> well, ok, not sodium_compare. but anyways, locating the correct function to call can be done using libsodiums documentation
22:46:28 <noctux> thanks to you all for the input ;)
22:46:52 <monochrom> noctux: constEq in http://hackage.haskell.org/package/memory-0.15.0/docs/Data-ByteArray.html#v:constEq
22:47:01 softwarm joins (4408f588@ip68-8-245-136.sd.sd.cox.net)
22:47:18 <monochrom> Example: the Eq instance for HMAC uses constEq
22:47:23 × pengjiz quits (~user@2601:547:901:fab0:4223:43ff:febc:71e1) (Quit: ERC (IRC client for Emacs 27.1))
22:48:16 × kritzefitz quits (~kritzefit@212.86.56.80) (Remote host closed the connection)
22:48:28 <monochrom> (HMAC of cryptonite)
22:49:35 <noctux> and that one seems to boil down to http://hackage.haskell.org/package/memory-0.15.0/docs/src/Data.Memory.PtrMethods.html#memConstEqual which does the xor + loop trick again. but yeah, probably good enough
22:52:57 × erolm_a quits (~erolm_a@82.24.185.133) (Ping timeout: 268 seconds)
22:53:17 × son0p quits (~son0p@181.136.122.143) (Quit: leaving)
22:53:54 erolm_a joins (~erolm_a@62.19.36.64)
22:54:05 × hyperisco quits (~hyperisco@d192-186-117-226.static.comm.cgocable.net) (Ping timeout: 240 seconds)
22:55:03 × polyphem quits (~p0lyph3m@2a02:810d:640:776c:76d7:55f6:f85b:c889) (Read error: Connection reset by peer)
22:56:44 justanotheruser joins (~justanoth@unaffiliated/justanotheruser)
22:57:15 × evanjs quits (~evanjs@075-129-098-007.res.spectrum.com) (Quit: ZNC 1.8.2 - https://znc.in)
22:58:03 evanjs joins (~evanjs@075-129-098-007.res.spectrum.com)
22:59:47 polyphem joins (~p0lyph3m@2a02:810d:640:776c:76d7:55f6:f85b:c889)
23:01:02 × royal_screwup21 quits (52254809@gateway/web/cgi-irc/kiwiirc.com/ip.82.37.72.9) (Quit: Connection closed)
23:01:26 royal_screwup21 joins (52254809@gateway/web/cgi-irc/kiwiirc.com/ip.82.37.72.9)
23:01:46 × eyenx quits (~eyenxeyen@unaffiliated/eye/x-1653358) (Remote host closed the connection)
23:03:00 eyenx joins (~eyenxeyen@unaffiliated/eye/x-1653358)
23:03:38 × shatriff quits (~vitaliish@176-52-216-242.irishtelecom.com) (Remote host closed the connection)
23:04:15 shatriff joins (~vitaliish@176-52-216-242.irishtelecom.com)
23:06:31 × royal_screwup21 quits (52254809@gateway/web/cgi-irc/kiwiirc.com/ip.82.37.72.9) (Ping timeout: 268 seconds)
23:09:07 × coot quits (~coot@37.30.50.101.nat.umts.dynamic.t-mobile.pl) (Quit: coot)
23:10:27 × hseg quits (~gesh@IGLD-84-228-238-87.inter.net.il) (Ping timeout: 260 seconds)
23:11:18 hseg joins (~gesh@IGLD-84-228-238-87.inter.net.il)
23:14:53 nbloomf joins (~nbloomf@2600:1700:ad14:3020:a8dc:3f5a:f8f1:dbd6)
23:16:26 × dbmikus quits (~dbmikus@c-174-49-172-14.hsd1.pa.comcast.net) (Ping timeout: 265 seconds)
23:16:37 × erolm_a quits (~erolm_a@62.19.36.64) (Ping timeout: 256 seconds)
23:16:59 erolm_a joins (~erolm_a@62.19.36.64)
23:18:25 × evanjs quits (~evanjs@075-129-098-007.res.spectrum.com) (Quit: ZNC 1.8.2 - https://znc.in)
23:18:39 matryoshka joins (~matryoshk@184.75.223.227)
23:19:37 evanjs joins (~evanjs@075-129-098-007.res.spectrum.com)
23:19:50 × christo quits (~chris@81.96.113.213) (Remote host closed the connection)
23:20:22 christo joins (~chris@81.96.113.213)
23:21:24 <fuzzypixelz> how would I "split" a string into a list based on a seperating char?
23:21:41 <hpc> @hoogle split
23:21:41 <lambdabot> Data.ByteString split :: Word8 -> ByteString -> [ByteString]
23:21:41 <lambdabot> Data.ByteString.Char8 split :: Char -> ByteString -> [ByteString]
23:21:41 <lambdabot> Data.ByteString.Lazy split :: Word8 -> ByteString -> [ByteString]
23:21:47 hseg_ joins (~gesh@IGLD-84-228-238-87.inter.net.il)
23:21:48 <koz_> fuzzypixelz: What do you want done when two separating chars are adjacent?
23:22:01 <hpc> too many splits
23:22:16 × dhouthoo quits (~dhouthoo@ptr-eitgbj2w0uu6delkbrh.18120a2.ip6.access.telenet.be) (Quit: WeeChat 2.9)
23:22:19 × fendor quits (~fendor@178.165.130.183.wireless.dyn.drei.com) (Remote host closed the connection)
23:22:31 <fuzzypixelz> koz_: I'm just trying to parse a file where each line has a number into a list
23:23:06 <koz_> What do your lines look like?
23:23:10 × Ariakenom quits (~Ariakenom@2001:9b1:efb:fc00:f919:1b80:2acc:f96c) (Ping timeout: 268 seconds)
23:24:20 <fuzzypixelz> koz_: each line a 4-6 digit intger
23:24:24 <fuzzypixelz> nothing more
23:24:36 <koz_> :t lines
23:24:37 × hseg quits (~gesh@IGLD-84-228-238-87.inter.net.il) (Ping timeout: 246 seconds)
23:24:38 <lambdabot> String -> [String]
23:25:06 × christo quits (~chris@81.96.113.213) (Ping timeout: 272 seconds)
23:25:14 <fuzzypixelz> aha
23:25:57 × danvet quits (~Daniel@2a02:168:57f4:0:efd0:b9e5:5ae6:c2fa) (Ping timeout: 260 seconds)
23:28:54 × evanjs quits (~evanjs@075-129-098-007.res.spectrum.com) (Quit: ZNC 1.8.2 - https://znc.in)
23:29:34 × hseg_ quits (~gesh@IGLD-84-228-238-87.inter.net.il) (Ping timeout: 256 seconds)
23:30:36 evanjs joins (~evanjs@075-129-098-007.res.spectrum.com)
23:34:52 × Ariakenom_ quits (~Ariakenom@2001:9b1:efb:fc00:3541:7c48:4826:58c0) (Quit: Leaving)
23:34:54 × nyd quits (~nyd@unaffiliated/elysian) (Ping timeout: 256 seconds)
23:35:37 RENNNN joins (~sobhan@gentoo/developer/sobhan)
23:36:04 <koz_> :t catMaybes
23:36:05 <lambdabot> [Maybe a] -> [a]
23:36:09 × evanjs quits (~evanjs@075-129-098-007.res.spectrum.com) (Quit: ZNC 1.8.2 - https://znc.in)
23:36:09 <koz_> Nyaa.
23:37:40 <RENNNN> Hi, I'm trying to find all the nodes such that there exists a path from $ to all those nodes in graph, but i'm having difficulty choosing a datatype. is there an easy, O(n) way to do this?
23:37:48 <RENNNN> i'm having trouble dealing with loops
23:38:14 <koz_> $ is what in this case?
23:38:26 <koz_> How is your graph represented?
23:38:46 <RENNNN> that's the thing, i haven't even started
23:38:46 <fuzzypixelz> I would often want to loop over two list "at the same time"
23:39:02 olligobber joins (olligobber@gateway/vpn/privateinternetaccess/olligobber)
23:39:08 <monochrom> fuzzypixelz: You can consider zip and zipWith
23:39:09 <fuzzypixelz> as in for i in list1 ... for j in list2 ... do something with i, j
23:39:14 <koz_> RENNNN: A lot depends on your choice of representation.
23:39:21 evanjs joins (~evanjs@075-129-098-007.res.spectrum.com)
23:39:27 <koz_> fuzzypixelz: Yep, zipWith or zip are your best friends here.
23:39:31 <fuzzypixelz> monochrom: no like a cartesian product
23:39:42 <fuzzypixelz> all possible pairs
23:39:48 <koz_> fuzzypixelz: (,) <$> list1 <*> list2
23:39:50 ishutin joins (~Ishutin@178-164-206-88.pool.digikabel.hu)
23:40:07 <RENNNN> koz_, i have it as an adjacency list
23:40:11 <koz_> There ya go, all possible pairs.
23:40:16 <monochrom> RENNNN: Data.Graph comes with GHC. It has the "reachable" function.
23:40:21 <fuzzypixelz> how does that even work!
23:40:26 <fuzzypixelz> :)
23:40:32 <koz_> fuzzypixelz: The Applicative instance for list?
23:40:59 <fuzzypixelz> koz_: uhh, yes? if that's what it's called
23:41:01 <monochrom> > (,) <$> [1,2,3] <*> "abc"
23:41:03 <lambdabot> [(1,'a'),(1,'b'),(1,'c'),(2,'a'),(2,'b'),(2,'c'),(3,'a'),(3,'b'),(3,'c')]
23:41:28 <koz_> fuzzypixelz: Just by the way it defines 'pure' and '<*>'.
23:41:32 <monochrom> tl;dr []'s <*> does cartesian product
23:41:33 <koz_> (and the laws)
23:41:54 <monochrom> List comprehension does, too. [(a,b) | a<-[1,2,3], b<-"abc"]
23:42:27 <RENNNN> monochrom, it doesn't support edge weights
23:42:29 × evanjs quits (~evanjs@075-129-098-007.res.spectrum.com) (Client Quit)
23:42:39 <monochrom> []'s monadness does too. [1,2,3] >>= \a -> "abc" >>= \b -> return (a,b)
23:43:24 × ishutin_ quits (~Ishutin@94-21-55-45.pool.digikabel.hu) (Ping timeout: 256 seconds)
23:44:06 christo joins (~chris@81.96.113.213)
23:44:40 evanjs joins (~evanjs@075-129-098-007.res.spectrum.com)
23:45:46 Gigabitten joins (~Somn@098-127-002-172.res.spectrum.com)
23:48:06 nineonin_ joins (~nineonine@50.216.62.2)
23:48:06 × nineonine quits (~nineonine@50.216.62.2) (Remote host closed the connection)
23:49:34 × dhil quits (~dhil@78.156.97.38) (Ping timeout: 260 seconds)
23:52:44 × ransom_ quits (~c4264035@8.48.134.25) (Quit: My MacBook has gone to sleep. ZZZzzz…)
23:54:08 × star_cloud quits (~star_clou@ec2-34-220-44-120.us-west-2.compute.amazonaws.com) (Ping timeout: 265 seconds)
23:57:42 × ubert quits (~Thunderbi@p200300ecdf3514a6e6b318fffe838f33.dip0.t-ipconnect.de) (Ping timeout: 260 seconds)
23:58:03 <fuzzypixelz> can I sort of map read :: Int on a list? I hope I'm making sense
23:58:24 <fuzzypixelz> oh wait I'm silly
23:58:51 <monochrom> map read ["123", "456"] :: [Int]
23:58:52 <fuzzypixelz> >map (\x -> read x :: Int) ["13", "42", "2020"]
23:58:59 <monochrom> That too.
23:59:40 <fuzzypixelz> how can you put the :: [Int] at the end?
23:59:45 <monochrom> Or you don't even need to worry about it. If you give that [Int] to some function that requires [Int], type inference will know.
23:59:58 <fuzzypixelz> it is supposed to be at the end of any expression?

All times are in UTC on 2020-12-16.