2020/12/16

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