2021/09/10

2021-09-10 00:00:02 +0200 <geekosaur> more common is using haskell to program microcontrollers via something like atom or clash
2021-09-10 00:00:42 +0200 <mangoiv> geekosaur: well, I am aware of that, but Controllers nrF52840 run OSes so I thought that this might be an option
2021-09-10 00:01:26 +0200mikoto-c1(~mikoto-ch@83.137.2.241) (Quit: mikoto-c1)
2021-09-10 00:01:29 +0200 <mangoiv> I think I already looked at Haskino but didn't consider it worth digging into, so maybe I'll have to do that :D
2021-09-10 00:06:24 +0200amitnjha(~amit@024-216-124-116.res.spectrum.com) (Quit: amitnjha)
2021-09-10 00:06:38 +0200amitnjha(~amit@024-216-124-116.res.spectrum.com)
2021-09-10 00:08:04 +0200MQ-17J(~MQ-17J@d14-69-206-129.try.wideopenwest.com)
2021-09-10 00:08:15 +0200tinhatcat(~manjaro-g@2620:103:a000:2201:8e4c:af6a:e11c:11a1)
2021-09-10 00:08:38 +0200jtomas(~jtomas@95.red-88-11-64.dynamicip.rima-tde.net) (Ping timeout: 260 seconds)
2021-09-10 00:11:05 +0200tinhatcat(~manjaro-g@2620:103:a000:2201:8e4c:af6a:e11c:11a1) (Client Quit)
2021-09-10 00:12:24 +0200 <sm> mangoiv, https://www.reddit.com/r/haskell/comments/pjmktr/ann_copilot_35/
2021-09-10 00:12:28 +0200 <sm> oops
2021-09-10 00:12:38 +0200MQ-17J(~MQ-17J@d14-69-206-129.try.wideopenwest.com) (Ping timeout: 252 seconds)
2021-09-10 00:12:45 +0200Pickchea(~private@user/pickchea)
2021-09-10 00:12:57 +0200MQ-17J(~MQ-17J@d14-69-206-129.try.wideopenwest.com)
2021-09-10 00:18:13 +0200roboguy_(~roboguy_@cpe-98-156-4-161.kc.res.rr.com) ()
2021-09-10 00:20:51 +0200ec_(~ec@gateway/tor-sasl/ec) (Ping timeout: 276 seconds)
2021-09-10 00:20:53 +0200 <ldlework> Hmm mapAccumL wont actually work for me here because I need to translate runs of Char into a single Char which mapAccumL doesn't fit for
2021-09-10 00:21:30 +0200 <ldlework> I wonder if I just need a "fold"
2021-09-10 00:21:32 +0200AlistairB(~AlistairB@121-200-5-212.79c805.syd.nbn.aussiebb.net)
2021-09-10 00:22:27 +0200 <ldlework> hmm
2021-09-10 00:27:59 +0200ec_(~ec@gateway/tor-sasl/ec)
2021-09-10 00:28:26 +0200shapr(~user@pool-100-36-247-68.washdc.fios.verizon.net) (Remote host closed the connection)
2021-09-10 00:29:10 +0200favonia(~favonia@user/favonia) (Ping timeout: 260 seconds)
2021-09-10 00:29:32 +0200AlistairB(~AlistairB@121-200-5-212.79c805.syd.nbn.aussiebb.net) (Quit: Client closed)
2021-09-10 00:31:49 +0200 <mniip> RLE is not really a stock recursion scheme
2021-09-10 00:32:51 +0200 <ldlework> almost feel like i should just stop what i'm doing and learn how parser combinators work :P
2021-09-10 00:33:50 +0200 <mniip> an easy way to see the problem is
2021-09-10 00:33:59 +0200chisui(~chisui@2001:16b8:68aa:4700:b819:7f5a:e91c:7e7c) (Quit: Client closed)
2021-09-10 00:34:03 +0200 <mniip> if you know `rle xs` and `rle ys`, how do you compute `rle (xs ++ ys)`
2021-09-10 00:34:06 +0200unit73e(~emanuel@2001:818:e8dd:7c00:32b5:c2ff:fe6b:5291) (Quit: Leaving)
2021-09-10 00:34:18 +0200MQ-17J(~MQ-17J@d14-69-206-129.try.wideopenwest.com) (Ping timeout: 265 seconds)
2021-09-10 00:34:23 +0200 <mniip> the answer is nuanced and reflects the non-trivial structure of the transformation
2021-09-10 00:34:28 +0200unit73e(~emanuel@2001:818:e8dd:7c00:32b5:c2ff:fe6b:5291)
2021-09-10 00:35:01 +0200shapr(~user@pool-100-36-247-68.washdc.fios.verizon.net)
2021-09-10 00:35:26 +0200MQ-17J(~MQ-17J@d14-69-206-129.try.wideopenwest.com)
2021-09-10 00:35:51 +0200Tuplanolla(~Tuplanoll@91-159-69-50.elisa-laajakaista.fi)
2021-09-10 00:35:58 +0200 <unit73e> finally got to the ugly part of SDL2 examples: https://paste.tomsmeding.com/yCUq2s3R
2021-09-10 00:36:06 +0200 <unit73e> I really dislike that function
2021-09-10 00:36:44 +0200amitnjha(~amit@024-216-124-116.res.spectrum.com) (Quit: amitnjha)
2021-09-10 00:36:58 +0200amitnjha(~amit@024-216-124-116.res.spectrum.com)
2021-09-10 00:39:54 +0200 <unit73e> maybe some new types can fix that function
2021-09-10 00:42:04 +0200amitnjha(~amit@024-216-124-116.res.spectrum.com) (Quit: amitnjha)
2021-09-10 00:42:17 +0200amitnjha(~amit@024-216-124-116.res.spectrum.com)
2021-09-10 00:43:46 +0200 <ldlework> man fp hurts my head
2021-09-10 00:44:34 +0200cheater(~Username@user/cheater) (Ping timeout: 252 seconds)
2021-09-10 00:44:47 +0200mmohammadi9812(~Mohammad@2.178.201.78) (Read error: Connection reset by peer)
2021-09-10 00:45:00 +0200 <unit73e> ldlework, you'll get used to it. it's not that hard to grasp once you understand the fundamental principles, imo.
2021-09-10 00:45:00 +0200cheater(~Username@user/cheater)
2021-09-10 00:45:27 +0200 <unit73e> the issue is understandint those
2021-09-10 00:45:41 +0200 <unit73e> college should focus on that
2021-09-10 00:47:57 +0200 <ldlework> I'm 20 years into my career heh
2021-09-10 00:48:10 +0200L29Ah(~L29Ah@wikipedia/L29Ah) (Ping timeout: 240 seconds)
2021-09-10 00:49:32 +0200 <geekosaur> I was around 25 years in
2021-09-10 00:49:58 +0200 <geekosaur> although admittedly I'd been exposed to Lisp and Scheme before SML and Haskell
2021-09-10 00:51:03 +0200 <monochrom> It is possible that age itself hurts learning.
2021-09-10 00:51:21 +0200 <ldlework> I definitely think so
2021-09-10 00:51:47 +0200 <ldlework> I'm also an emacs user so I have also written a bunch of lisp. But I have had similar pains in the past there too.
2021-09-10 00:51:48 +0200 <monochrom> Wanna bet a 50yo FPer learning imperative programming for the first time feeling hurt?
2021-09-10 00:52:22 +0200 <ldlework> FP feels like distilling an implementation down to exactly what you want
2021-09-10 00:52:24 +0200amitnjha(~amit@024-216-124-116.res.spectrum.com) (Quit: amitnjha)
2021-09-10 00:52:38 +0200amitnjha(~amit@024-216-124-116.res.spectrum.com)
2021-09-10 00:52:45 +0200 <ldlework> I guess the challenge comes from waffling between various possibilities down at the bottom
2021-09-10 00:53:24 +0200 <monochrom> As a corollary, if you have 50 year experience in Pascal and then you learn C, it doesn't count as learning. Not enough difference. What's there to learn?
2021-09-10 00:53:32 +0200 <ldlework> I am OK thinking conceptually about the problem right until it comes to expressing that exact function which I really need
2021-09-10 00:54:10 +0200 <ldlework> When I did F# I leaned a lot on its support for for-loops
2021-09-10 00:54:37 +0200 <monochrom> Let's first correct some of your wording to illuminate the issue. s/conceptually/decompositionally/
2021-09-10 00:54:48 +0200 <monochrom> Ah but now we see the problem.
2021-09-10 00:55:19 +0200 <ldlework> Even lisp has such constructs
2021-09-10 00:55:28 +0200 <monochrom> Decomposing a problem with C at the back of your mind is different from decomposing a problem with Haskell at the back of your mind.
2021-09-10 00:55:58 +0200 <ldlework> (that's not a criticism of Haskell, only observing the for-loop has always been at arms reach for me)
2021-09-10 00:56:07 +0200 <monochrom> John Hughes's "why functional programming matters" in fact shows that it is the opposite kind of decomposition.
2021-09-10 00:56:15 +0200 <geekosaur> it is in Haskell as well. flip map{,M}
2021-09-10 00:57:01 +0200pretty_dumm_guy(trottel@gateway/vpn/protonvpn/prettydummguy/x-88029655) (Ping timeout: 265 seconds)
2021-09-10 00:57:15 +0200Vajb(~Vajb@hag-jnsbng11-58c3a8-176.dhcp.inet.fi) (Read error: Connection reset by peer)
2021-09-10 00:57:27 +0200Vajb(~Vajb@hag-jnsbng11-58c3a8-176.dhcp.inet.fi)
2021-09-10 00:57:32 +0200 <unit73e> 23 pages? I'll read it. I just starting coding and understood along the way
2021-09-10 00:57:44 +0200amitnjha(~amit@024-216-124-116.res.spectrum.com) (Quit: amitnjha)
2021-09-10 00:57:48 +0200 <c_wraith> :t for
2021-09-10 00:57:49 +0200 <lambdabot> (Traversable t, Applicative f) => t a -> (a -> f b) -> f (t b)
2021-09-10 00:58:02 +0200amitnjha(~amit@024-216-124-116.res.spectrum.com)
2021-09-10 00:58:19 +0200 <c_wraith> geekosaur: you have to admit, that requires at least a couple new concepts coming from C. Unlike lispian for macros
2021-09-10 00:59:09 +0200 <unit73e> not sure if it's the best method because I had to figure out what each symbols and whatnot meant one by one
2021-09-10 00:59:31 +0200 <unit73e> I just find it a less boring method
2021-09-10 00:59:36 +0200pretty_dumm_guy(trottel@gateway/vpn/protonvpn/prettydummguy/x-88029655)
2021-09-10 01:00:31 +0200AlistairB(~AlistairB@121-200-5-212.79c805.syd.nbn.aussiebb.net)
2021-09-10 01:03:25 +0200 <unit73e> there's no formula tbh. In java channel they recommend programming with a notepad first and I think they're crazy.
2021-09-10 01:04:06 +0200 <geekosaur> that actually can work with haskell
2021-09-10 01:04:23 +0200 <unit73e> I agree but not with java
2021-09-10 01:04:29 +0200 <geekosaur> there's a lot to be said for just doing some lambda calculus reductions by hand before diving in
2021-09-10 01:04:38 +0200 <unit73e> java is too verbose to work with notepad
2021-09-10 01:04:47 +0200Pickchea(~private@user/pickchea) (Quit: Leaving)
2021-09-10 01:05:34 +0200wroathe(~wroathe@user/wroathe) (Ping timeout: 260 seconds)
2021-09-10 01:06:02 +0200 <monochrom> I had classmates who programmed with pico, even in their final year.
2021-09-10 01:06:18 +0200 <geekosaur> a notepad, not windows notepad
2021-09-10 01:06:24 +0200 <monochrom> Oh heh.
2021-09-10 01:07:31 +0200cafkafk(~cafkafk@user/cafkafk) (Ping timeout: 252 seconds)
2021-09-10 01:07:32 +0200 <unit73e> interestingly I did learn lamdba calculus in college but I didn't know it had anything to do with programming at the time
2021-09-10 01:08:22 +0200 <unit73e> the teacher didn't really care and neither did I at the time lol
2021-09-10 01:09:36 +0200vicfred(~vicfred@user/vicfred) (Quit: Leaving)
2021-09-10 01:12:17 +0200 <hpc> i learned function composition in algebra when i was 14
2021-09-10 01:12:55 +0200 <hpc> it was never mentioned again, even in the cs classes
2021-09-10 01:13:15 +0200 <hpc> to this day i have no idea why they had it on the schedule
2021-09-10 01:13:30 +0200hendursaga(~weechat@user/hendursaga) (Ping timeout: 276 seconds)
2021-09-10 01:13:58 +0200[itchyjunk](~itchyjunk@user/itchyjunk/x-7353470)
2021-09-10 01:14:09 +0200ChaiTRex(~ChaiTRex@user/chaitrex) (Ping timeout: 276 seconds)
2021-09-10 01:14:23 +0200 <monochrom> It could be used in stating the chain rule of differentiation. Then again how many teachers are capable of that level of point-free abstraction?
2021-09-10 01:14:42 +0200 <hpc> it wasn't mentioned even then
2021-09-10 01:14:51 +0200 <hpc> actually, that was another thing i had to notice on my own
2021-09-10 01:14:58 +0200 <monochrom> Right, they only know how to show you the pointful version.
2021-09-10 01:15:01 +0200 <hpc> that the chain rule was just recursion
2021-09-10 01:15:04 +0200hendursaga(~weechat@user/hendursaga)
2021-09-10 01:15:31 +0200wroathe(~wroathe@c-75-72-98-163.hsd1.mn.comcast.net)
2021-09-10 01:15:31 +0200wroathe(~wroathe@c-75-72-98-163.hsd1.mn.comcast.net) (Changing host)
2021-09-10 01:15:31 +0200wroathe(~wroathe@user/wroathe)
2021-09-10 01:15:42 +0200ChaiTRex(~ChaiTRex@user/chaitrex)
2021-09-10 01:16:04 +0200 <hpc> they also taught the "big {" syntax for pattern matching in math notation, but then never used it to show the whole differentiation formula either
2021-09-10 01:16:20 +0200 <hpc> they just went "here's half a dozen rules, pick which one looks right and repeat"
2021-09-10 01:16:40 +0200 <[itchyjunk]> :o chain rule is recursion?
2021-09-10 01:17:17 +0200 <hpc> derivative(f) = something * derivative(a smaller part of f)
2021-09-10 01:17:45 +0200lavaman(~lavaman@98.38.249.169)
2021-09-10 01:18:11 +0200favonia(~favonia@user/favonia)
2021-09-10 01:18:38 +0200acidjnk_new(~acidjnk@p5487d0ba.dip0.t-ipconnect.de) (Ping timeout: 252 seconds)
2021-09-10 01:21:18 +0200ec_(~ec@gateway/tor-sasl/ec) (Ping timeout: 276 seconds)
2021-09-10 01:21:56 +0200MQ-17J(~MQ-17J@d14-69-206-129.try.wideopenwest.com) (Ping timeout: 252 seconds)
2021-09-10 01:22:29 +0200MQ-17J(~MQ-17J@d14-69-206-129.try.wideopenwest.com)
2021-09-10 01:22:30 +0200lavaman(~lavaman@98.38.249.169) (Ping timeout: 260 seconds)
2021-09-10 01:23:46 +0200Gurkenglas(~Gurkengla@dslb-002-207-014-195.002.207.pools.vodafone-ip.de) (Ping timeout: 260 seconds)
2021-09-10 01:23:47 +0200MQ-17J(~MQ-17J@d14-69-206-129.try.wideopenwest.com) (Read error: Connection reset by peer)
2021-09-10 01:24:09 +0200max22-(~maxime@2a01cb08833598004190beef1e8cf3bf.ipv6.abo.wanadoo.fr) (Remote host closed the connection)
2021-09-10 01:24:46 +0200ic2000_(~ic2000_@cpc108265-brom11-2-0-cust119.16-1.cable.virginm.net)
2021-09-10 01:26:07 +0200MQ-17J(~MQ-17J@d14-69-206-129.try.wideopenwest.com)
2021-09-10 01:26:53 +0200cafkafk(~cafkafk@user/cafkafk)
2021-09-10 01:28:32 +0200zaquest(~notzaques@5.128.210.178) (Remote host closed the connection)
2021-09-10 01:29:10 +0200 <[itchyjunk]> oh
2021-09-10 01:29:45 +0200zaquest(~notzaques@5.128.210.178)
2021-09-10 01:31:28 +0200L29Ah(~L29Ah@wikipedia/L29Ah)
2021-09-10 01:35:41 +0200merijn(~merijn@83-160-49-249.ip.xs4all.nl)
2021-09-10 01:36:31 +0200amahl(~amahl@dsl-jklbng12-54fbca-64.dhcp.inet.fi) (Remote host closed the connection)
2021-09-10 01:37:10 +0200TheCoffeMaker(~TheCoffeM@user/thecoffemaker) (Ping timeout: 240 seconds)
2021-09-10 01:37:59 +0200cafkafk(~cafkafk@user/cafkafk) (Quit: WeeChat 3.1)
2021-09-10 01:39:25 +0200favonia(~favonia@user/favonia) (Ping timeout: 260 seconds)
2021-09-10 01:39:44 +0200TheCoffeMaker(~TheCoffeM@user/thecoffemaker)
2021-09-10 01:40:19 +0200 <monochrom> Or rather, differential calculus uses recursion.
2021-09-10 01:40:55 +0200 <monochrom> diff(f + g) = diff(f) + diff(g) is a recursive rule, too.
2021-09-10 01:41:23 +0200 <monochrom> Differentiation is one of the early recursive algorithms everyone had to learn to do by hand.
2021-09-10 01:43:07 +0200amitnjha(~amit@024-216-124-116.res.spectrum.com) (Quit: amitnjha)
2021-09-10 01:43:22 +0200wroathe(~wroathe@user/wroathe) (Ping timeout: 260 seconds)
2021-09-10 01:43:31 +0200amitnjha(~amit@024-216-124-116.res.spectrum.com)
2021-09-10 01:44:28 +0200roboguy_(~roboguy_@cpe-98-156-4-161.kc.res.rr.com)
2021-09-10 01:44:51 +0200 <hpc> that's a better way to explain it
2021-09-10 01:47:49 +0200TheCoffeMaker(~TheCoffeM@user/thecoffemaker) (Ping timeout: 252 seconds)
2021-09-10 01:48:35 +0200falafel(~falafel@2603-8000-d801-2d68-1d6d-bf72-eba2-a20e.res6.spectrum.com)
2021-09-10 01:49:12 +0200wroathe(~wroathe@c-68-54-25-135.hsd1.mn.comcast.net)
2021-09-10 01:49:12 +0200wroathe(~wroathe@c-68-54-25-135.hsd1.mn.comcast.net) (Changing host)
2021-09-10 01:49:12 +0200wroathe(~wroathe@user/wroathe)
2021-09-10 01:50:15 +0200TheCoffeMaker(~TheCoffeM@user/thecoffemaker)
2021-09-10 01:52:25 +0200Tuplanolla(~Tuplanoll@91-159-69-50.elisa-laajakaista.fi) (Quit: Leaving.)
2021-09-10 01:57:01 +0200Axma21295(~Axman6@user/axman6) (Remote host closed the connection)
2021-09-10 01:57:15 +0200Axman6(~Axman6@user/axman6)
2021-09-10 02:00:40 +0200hendursaga(~weechat@user/hendursaga) (Quit: hendursaga)
2021-09-10 02:01:06 +0200hendursaga(~weechat@user/hendursaga)
2021-09-10 02:05:53 +0200glguy(x@libera/staff/glguy) (Quit: Quit)
2021-09-10 02:09:28 +0200eggplantade(~Eggplanta@2600:1700:bef1:5e10:c1f1:b01b:5ae7:397c) (Remote host closed the connection)
2021-09-10 02:09:49 +0200merijn(~merijn@83-160-49-249.ip.xs4all.nl) (Ping timeout: 252 seconds)
2021-09-10 02:22:34 +0200falafel(~falafel@2603-8000-d801-2d68-1d6d-bf72-eba2-a20e.res6.spectrum.com) (Ping timeout: 260 seconds)
2021-09-10 02:23:32 +0200pbrisbin(~patrick@pool-108-16-214-93.phlapa.fios.verizon.net) (Ping timeout: 265 seconds)
2021-09-10 02:23:33 +0200MQ-17J(~MQ-17J@d14-69-206-129.try.wideopenwest.com) (Read error: Connection reset by peer)
2021-09-10 02:23:34 +0200eggplantade(~Eggplanta@2600:1700:bef1:5e10:c1f1:b01b:5ae7:397c)
2021-09-10 02:23:46 +0200pony(~ed@101.53.218.157)
2021-09-10 02:27:00 +0200unit73e(~emanuel@2001:818:e8dd:7c00:32b5:c2ff:fe6b:5291) (Remote host closed the connection)
2021-09-10 02:30:25 +0200MQ-17J(~MQ-17J@d14-69-206-129.try.wideopenwest.com)
2021-09-10 02:31:26 +0200proofofkeags_(~proofofke@205.209.28.54) (Ping timeout: 260 seconds)
2021-09-10 02:36:35 +0200beka(~beka@104.193.170.240) (Ping timeout: 265 seconds)
2021-09-10 02:37:14 +0200hiruji(~hiruji@user/hiruji) (Quit: ZNC 1.8.2 - https://znc.in)
2021-09-10 02:37:35 +0200hiruji(~hiruji@user/hiruji)
2021-09-10 02:39:32 +0200elf_fortrez(~elf_fortr@adsl-72-50-5-53.prtc.net)
2021-09-10 02:41:40 +0200AlistairB(~AlistairB@121-200-5-212.79c805.syd.nbn.aussiebb.net) (Quit: Client closed)
2021-09-10 02:41:43 +0200euandreh(~euandreh@2804:14c:33:9fe5:c3ab:c75d:f803:b354) (Ping timeout: 252 seconds)
2021-09-10 02:43:38 +0200eggplantade(~Eggplanta@2600:1700:bef1:5e10:c1f1:b01b:5ae7:397c) (Remote host closed the connection)
2021-09-10 02:45:44 +0200elf_fortrez(~elf_fortr@adsl-72-50-5-53.prtc.net) (Quit: Client closed)
2021-09-10 02:45:56 +0200favonia(~favonia@user/favonia)
2021-09-10 02:47:46 +0200 <mjrosenb> and then there's integration, which they teach in nearly the same way, and is most definitely not recursive
2021-09-10 02:55:41 +0200eggplantade(~Eggplanta@2600:1700:bef1:5e10:c1f1:b01b:5ae7:397c)
2021-09-10 02:57:06 +0200raehik(~raehik@cpc95906-rdng25-2-0-cust156.15-3.cable.virginm.net) (Ping timeout: 260 seconds)
2021-09-10 02:58:51 +0200ponylua
2021-09-10 02:59:18 +0200geekosaur(~geekosaur@xmonad/geekosaur) (Ping timeout: 265 seconds)
2021-09-10 03:04:49 +0200aratamizuki(~aratamizu@p2135145-ipoe.ipoe.ocn.ne.jp) (Remote host closed the connection)
2021-09-10 03:05:01 +0200aratamizuki(~aratamizu@p2135145-ipoe.ipoe.ocn.ne.jp)
2021-09-10 03:08:34 +0200amitnjha(~amit@024-216-124-116.res.spectrum.com) (Quit: amitnjha)
2021-09-10 03:08:47 +0200amitnjha(~amit@024-216-124-116.res.spectrum.com)
2021-09-10 03:09:11 +0200mangoiv(~MangoIV@193.175.5.172) (Quit: WeeChat 3.2)
2021-09-10 03:10:27 +0200neurocyte6(~neurocyte@94.16.66.63)
2021-09-10 03:10:27 +0200neurocyte6(~neurocyte@94.16.66.63) (Changing host)
2021-09-10 03:10:27 +0200neurocyte6(~neurocyte@user/neurocyte)
2021-09-10 03:11:50 +0200albet70(~xxx@2400:8902::f03c:92ff:fe60:98d8) (Remote host closed the connection)
2021-09-10 03:12:21 +0200dajoer(~david@user/gvx)
2021-09-10 03:12:30 +0200neurocyte(~neurocyte@user/neurocyte) (Ping timeout: 260 seconds)
2021-09-10 03:12:30 +0200ezzieyguywuf(~Unknown@user/ezzieyguywuf)
2021-09-10 03:12:30 +0200neurocyte6neurocyte
2021-09-10 03:12:58 +0200albet70(~xxx@2400:8902::f03c:92ff:fe60:98d8)
2021-09-10 03:13:30 +0200luapony
2021-09-10 03:15:18 +0200MQ-17J(~MQ-17J@d14-69-206-129.try.wideopenwest.com) (Ping timeout: 260 seconds)
2021-09-10 03:15:36 +0200MQ-17J(~MQ-17J@d14-69-206-129.try.wideopenwest.com)
2021-09-10 03:17:35 +0200 <koz> Is there a convenient way to prettyprint records?
2021-09-10 03:17:50 +0200 <awpr> shameless self-promotion:
2021-09-10 03:17:55 +0200 <awpr> @hackage portray
2021-09-10 03:17:55 +0200 <lambdabot> https://hackage.haskell.org/package/portray
2021-09-10 03:18:06 +0200 <c_wraith> there are some libraries that attempt to parse and format Show's output, especially for records
2021-09-10 03:18:31 +0200 <koz> awpr - that looks _gorgeous_.
2021-09-10 03:18:43 +0200 <awpr> comes with generics-based deriving that handles records nicely, even in really obtuse cases like having infix operators as field names
2021-09-10 03:19:20 +0200 <koz> awpr: What's the general workflow to integrate with prettyprinter?
2021-09-10 03:20:25 +0200 <awpr> currently the only document rendering library it's hooked up to is `pretty`, but the intent is that it could work with anything
2021-09-10 03:20:37 +0200 <koz> How would you suggest interoperating then?
2021-09-10 03:20:56 +0200 <koz> I'm already using prettyprinter quite heavily, so if I can avoid a port to 'pretty', that'd be good.
2021-09-10 03:21:05 +0200 <awpr> so depending on what you mean by the question, it's either "you can't yet", or "write something like portray-pretty"
2021-09-10 03:21:10 +0200 <awpr> @hackage portray-pretty
2021-09-10 03:21:10 +0200 <lambdabot> https://hackage.haskell.org/package/portray-pretty
2021-09-10 03:21:38 +0200 <koz> Ah, I see. So something like WrappedPortray basically?
2021-09-10 03:22:07 +0200 <awpr> yep, if it's a direct equivalent, then you'd say "deriving ThePrettyPrinterClass via WrappedPortray MyRecord"
2021-09-10 03:22:20 +0200 <koz> I can probably bash that into place. Thanks!
2021-09-10 03:23:14 +0200xff0x(~xff0x@port-92-193-229-234.dynamic.as20676.net) (Ping timeout: 260 seconds)
2021-09-10 03:23:38 +0200 <awpr> and then you're using `portray` as deriving for `prettyprinter`. although a big chunk of the functionality is in `portray-pretty`, since `portray` tells you what sort of syntax to render, and `portray-pretty` actually has all the details of how to format it
2021-09-10 03:24:47 +0200xff0x(~xff0x@2001:1a81:52f8:6100:708e:280b:baf5:c97b)
2021-09-10 03:27:01 +0200aratamizuki(~aratamizu@p2135145-ipoe.ipoe.ocn.ne.jp) (Remote host closed the connection)
2021-09-10 03:27:34 +0200aratamizuki(~aratamizu@p2135145-ipoe.ipoe.ocn.ne.jp)
2021-09-10 03:29:29 +0200 <awpr> oh, a caveat for that sort of usage: it can't call _back_ into `prettyprinter`'s typeclasses when deriving instances, so it'll expect you to have `Portray` instances for the whole transitive closure of the record you want. so it'll be great and low-overhead for a bunch of records with strings, ints, etc., but there'll be some up-front work if your records have tons of deeply nested domain types
2021-09-10 03:30:55 +0200sneedsfeed(~sneedsfee@rrcs-173-95-122-169.midsouth.biz.rr.com)
2021-09-10 03:33:54 +0200amitnjha(~amit@024-216-124-116.res.spectrum.com) (Quit: amitnjha)
2021-09-10 03:34:07 +0200amitnjha(~amit@024-216-124-116.res.spectrum.com)
2021-09-10 03:34:50 +0200aratamizuki(~aratamizu@p2135145-ipoe.ipoe.ocn.ne.jp) (Remote host closed the connection)
2021-09-10 03:35:02 +0200aratamizuki(~aratamizu@p2135145-ipoe.ipoe.ocn.ne.jp)
2021-09-10 03:39:14 +0200amitnjha(~amit@024-216-124-116.res.spectrum.com) (Quit: amitnjha)
2021-09-10 03:39:28 +0200amitnjha(~amit@024-216-124-116.res.spectrum.com)
2021-09-10 03:43:52 +0200MQ-17J(~MQ-17J@d14-69-206-129.try.wideopenwest.com) (Ping timeout: 252 seconds)
2021-09-10 03:47:57 +0200vysn(~vysn@user/vysn) (Ping timeout: 245 seconds)
2021-09-10 03:51:18 +0200dsrt^(~dsrt@68.101.54.227) (Remote host closed the connection)
2021-09-10 03:51:51 +0200beka(~beka@104.193.170.240)
2021-09-10 03:53:36 +0200MQ-17J(~MQ-17J@d14-69-206-129.try.wideopenwest.com)
2021-09-10 04:00:07 +0200glguy(x@libera/staff/glguy)
2021-09-10 04:05:42 +0200FinnElija(~finn_elij@user/finn-elija/x-0085643) (Ping timeout: 260 seconds)
2021-09-10 04:05:57 +0200merijn(~merijn@83-160-49-249.ip.xs4all.nl)
2021-09-10 04:07:31 +0200FinnElija(~finn_elij@user/finn-elija/x-0085643)
2021-09-10 04:14:34 +0200td_(~td@94.134.91.64) (Ping timeout: 260 seconds)
2021-09-10 04:16:02 +0200td_(~td@94.134.91.202)
2021-09-10 04:16:09 +0200alx741(~alx741@186.178.109.214)
2021-09-10 04:35:11 +0200vs^(~dsrt@68.101.54.227)
2021-09-10 04:37:07 +0200alx741(~alx741@186.178.109.214) (Quit: alx741)
2021-09-10 04:38:35 +0200sneedsfeed(~sneedsfee@rrcs-173-95-122-169.midsouth.biz.rr.com) (Ping timeout: 256 seconds)
2021-09-10 04:40:14 +0200merijn(~merijn@83-160-49-249.ip.xs4all.nl) (Ping timeout: 260 seconds)
2021-09-10 04:40:50 +0200jespada(~jespada@90.254.245.194) (Ping timeout: 260 seconds)
2021-09-10 04:42:44 +0200jespada(~jespada@90.254.245.194)
2021-09-10 04:42:45 +0200Tordek(tordek@triton.blinkenshell.org)
2021-09-10 04:44:34 +0200amitnjha(~amit@024-216-124-116.res.spectrum.com) (Quit: amitnjha)
2021-09-10 04:44:48 +0200amitnjha(~amit@024-216-124-116.res.spectrum.com)
2021-09-10 04:45:52 +0200 <Tordek> hi! https://paste.tomsmeding.com/nrP8eHRv I have a series of functions taht do this pattern a lot: they thread a parameter as state, by doing \p -> foo p (\p -> otherFooThatReceivesThatPotentiallyModifiedP); is there a cleaner way to handle this?
2021-09-10 04:53:00 +0200 <Axman6> sounds a lot like the statew monad before I open the link...
2021-09-10 04:53:14 +0200 <c_wraith> it definitely wants to be state
2021-09-10 04:53:17 +0200 <Axman6> yes this definitely the state monad
2021-09-10 04:53:29 +0200 <Axman6> State p, whatever the type of p is
2021-09-10 04:54:20 +0200machinedgod(~machinedg@135-23-192-217.cpe.pppoe.ca) (Ping timeout: 265 seconds)
2021-09-10 04:54:54 +0200 <Tordek> sounds reasonable I guess
2021-09-10 04:54:55 +0200 <Tordek> thanks
2021-09-10 04:55:11 +0200 <Axman6> You have successfully completely reinvented the state monad, which is basically nicer syntax for exactly what you've written
2021-09-10 04:55:25 +0200 <Axman6> have you use it before?
2021-09-10 04:55:48 +0200 <Tordek> I think I've never used State, no
2021-09-10 04:57:11 +0200 <Axman6> ok, well the functions to know are get :: State p p, a.k.a, give me whatever the current state is. put :: p -> State p (), a.k.a, update the current state with a new value, and modify :: (p -> p) -> State p (), a.k.a, apply this function to the current state and update it
2021-09-10 05:03:04 +0200FinnElija(~finn_elij@user/finn-elija/x-0085643) (Ping timeout: 252 seconds)
2021-09-10 05:03:13 +0200 <Tordek> https://paste.tomsmeding.com/TuzAz5OK roughly this?
2021-09-10 05:04:02 +0200shapr(~user@pool-100-36-247-68.washdc.fios.verizon.net) (Ping timeout: 260 seconds)
2021-09-10 05:04:45 +0200FinnElija(~finn_elij@user/finn-elija/x-0085643)
2021-09-10 05:09:33 +0200 <Axman6> why do you pass in a and then return it?
2021-09-10 05:09:56 +0200 <Axman6> that code doesn't compile right?
2021-09-10 05:10:34 +0200 <Axman6> pushTick = modify (\p -> p {pc = pc p + 1 }) I think
2021-09-10 05:10:37 +0200 <Tordek> arbitrary code; I was looking at the state part, not the real code
2021-09-10 05:11:12 +0200haykam1(~haykam@static.100.2.21.65.clients.your-server.de) (Remote host closed the connection)
2021-09-10 05:11:25 +0200haykam1(~haykam@static.100.2.21.65.clients.your-server.de)
2021-09-10 05:13:49 +0200 <Axman6> actually I don't know what pushTick is supposed to do, in the original code it takes an input but I don't know what it's supposed to do with it.
2021-09-10 05:14:53 +0200 <Tordek> https://paste.tomsmeding.com/BBxEVKhO it's... uh... weird, I guess
2021-09-10 05:15:18 +0200 <Axman6> also, to access sub parts of the state, you can use gets: gets :: (p -> b) -> State p b, which is just fmap f get, a.k.a, use a function to access things. so you can use do {h <- gets (high . pc); pushTick h; ...}
2021-09-10 05:16:37 +0200 <Tordek> it's meant to be a cycle-accurate 6502 emulator; the "readTick": "sends" a read request on the bus, and "waits" for the response on the next cycle, providing the value it read to the next funciton in the chain
2021-09-10 05:17:39 +0200 <Axman6> Did you write all of this or are you modifying it?
2021-09-10 05:18:02 +0200 <Axman6> This is like one of the classic examples of the state monad btw, writing CPU emulators, because it maps so naturally
2021-09-10 05:18:28 +0200 <Tordek> I wrote it all, yeah
2021-09-10 05:19:09 +0200lavaman(~lavaman@98.38.249.169)
2021-09-10 05:19:54 +0200amitnjha(~amit@024-216-124-116.res.spectrum.com) (Quit: amitnjha)
2021-09-10 05:20:08 +0200vs^(~dsrt@68.101.54.227) (Remote host closed the connection)
2021-09-10 05:20:08 +0200amitnjha(~amit@024-216-124-116.res.spectrum.com)
2021-09-10 05:20:21 +0200 <Axman6> it feels like what you want is something like State (Data, ProcessorState, BusState) as the return type of basically all of your functions
2021-09-10 05:23:23 +0200lavaman(~lavaman@98.38.249.169) (Ping timeout: 252 seconds)
2021-09-10 05:29:12 +0200bitdex(~bitdex@gateway/tor-sasl/bitdex)
2021-09-10 05:30:09 +0200 <Axman6> I wouldn't recfommend using a tuple thoughm I would have a record which contains all the state, with field accessors for each subpart
2021-09-10 05:32:17 +0200[itchyjunk](~itchyjunk@user/itchyjunk/x-7353470) (Quit: Leaving)
2021-09-10 05:34:59 +0200zmt01(~zmt00@user/zmt00)
2021-09-10 05:36:50 +0200waleee(~waleee@2001:9b0:216:8200:d457:9189:7843:1dbd) (Ping timeout: 260 seconds)
2021-09-10 05:38:06 +0200zmt00(~zmt00@user/zmt00) (Ping timeout: 260 seconds)
2021-09-10 05:39:26 +0200cjb(~cjbayliss@user/cjb)
2021-09-10 05:40:39 +0200 <iqubic> Is hoogle down for anyone else?
2021-09-10 05:41:04 +0200 <ldlework> @hoogle (a -> b -> a) -> a -> [b] -> a
2021-09-10 05:41:05 +0200 <lambdabot> GHC.List foldl :: forall a b . (b -> a -> b) -> b -> [a] -> b
2021-09-10 05:41:05 +0200 <lambdabot> GHC.List foldl' :: forall a b . (b -> a -> b) -> b -> [a] -> b
2021-09-10 05:41:05 +0200 <lambdabot> GHC.OldList foldl :: forall a b . (b -> a -> b) -> b -> [a] -> b
2021-09-10 05:41:32 +0200abhixec(~abhixec@c-67-169-139-16.hsd1.ca.comcast.net)
2021-09-10 05:41:34 +0200 <iqubic> I think lambdabot has a local hoogle server it queries.
2021-09-10 05:41:44 +0200 <iqubic> This is returning a 503 for me: https://hoogle.haskell.org/?hoogle=accumulate&scope=set%3Astackage
2021-09-10 05:42:45 +0200 <monochrom> oh w00t cabal-instal 3.6
2021-09-10 05:45:05 +0200favonia(~favonia@user/favonia) (Ping timeout: 265 seconds)
2021-09-10 05:45:27 +0200monochrom(trebla@216.138.220.146) (Quit: NO CARRIER)
2021-09-10 05:46:54 +0200shriekingnoise_(~shrieking@186.137.144.80) (Quit: Quit)
2021-09-10 05:48:07 +0200 <cjb> is there a way to convert a reStructuredText file with haskell code block to lhs that is better/nicer/easier-to-read than this? (i.e. no sed, no conversion to markdown and back to rst) http://ix.io/3yqp
2021-09-10 05:49:08 +0200 <Axman6> Pandoc is also a library, so you could parse it and then modifty the AST
2021-09-10 05:49:20 +0200 <iqubic> I was going to say use Pandoc, but that can't output lhs files.
2021-09-10 05:49:35 +0200 <Tordek> thanks, Axman6
2021-09-10 05:50:09 +0200 <Axman6> pandoc --from markdown --to rst+lhs --output test.lhs seems to imply it can?
2021-09-10 05:50:17 +0200dsrt^(~dsrt@68.101.54.227)
2021-09-10 05:51:39 +0200 <ldlework> iqubic: i actually didn't notice your message and was just using @hoogle because I tried hoogle web and it was down
2021-09-10 05:51:41 +0200 <ldlework> :D
2021-09-10 05:52:01 +0200 <cjb> Axman6: hm, yeah that might be the go. thanks :)
2021-09-10 05:52:34 +0200 <Axman6> Tordek: this might be... extremely... relevant :P https://github.com/blitzcode/neskell/
2021-09-10 05:52:51 +0200 <iqubic> Axman6: The front page of the Pandoc website doesn't list literate haskell as a format it can output. https://pandoc.org/#
2021-09-10 05:53:19 +0200 <Tordek> oh no he stole my name (?)
2021-09-10 05:54:24 +0200 <cjb> iqubic: https://pandoc.org/MANUAL.html#literate-haskell-support
2021-09-10 05:55:16 +0200 <iqubic> cjb: Why is that not listed on the home page?
2021-09-10 05:56:40 +0200spruit11(~quassel@2a02:a467:ccd6:1:6cc9:33fd:d92c:45c) (Ping timeout: 260 seconds)
2021-09-10 05:58:48 +0200monochrom(trebla@216.138.220.146)
2021-09-10 06:05:23 +0200 <iqubic> ldlework: hoogle is back up on the interwebs.
2021-09-10 06:06:15 +0200pavonia(~user@user/siracusa) (Quit: Bye!)
2021-09-10 06:06:18 +0200 <Axman6> Tordek: is it becomming clear how to use the state monad to do what you want?
2021-09-10 06:07:14 +0200 <Axman6> you might find that you want to not explicitly use State, but instead use MonadState SystemState m => m a instead - this means that you can also add other constraints later, like Writer if you want to store logs or history or something
2021-09-10 06:10:12 +0200 <Tordek> sorta; I'm still trying to marry that implementation with my "bus" concept
2021-09-10 06:10:16 +0200 <Tordek> thanks!
2021-09-10 06:14:25 +0200haykam1(~haykam@static.100.2.21.65.clients.your-server.de) (Remote host closed the connection)
2021-09-10 06:14:29 +0200haykam2(~haykam@static.100.2.21.65.clients.your-server.de)
2021-09-10 06:15:06 +0200arkho(~ccc@dynamic-acs-24-112-153-241.zoominternet.net) (Remote host closed the connection)
2021-09-10 06:15:24 +0200arkho(~ccc@dynamic-acs-24-112-153-241.zoominternet.net)
2021-09-10 06:17:38 +0200hyiltiz(~quassel@31.220.5.250) (Quit: No Ping reply in 180 seconds.)
2021-09-10 06:18:26 +0200bgamari(~bgamari@72.65.101.163) (Ping timeout: 265 seconds)
2021-09-10 06:18:57 +0200hyiltiz(~quassel@31.220.5.250)
2021-09-10 06:21:20 +0200spruit11(~quassel@2a02:a467:ccd6:1:6cc9:33fd:d92c:45c)
2021-09-10 06:21:25 +0200zebrag(~chris@user/zebrag) (Quit: Konversation terminated!)
2021-09-10 06:22:50 +0200phma_(~phma@host-67-44-208-90.hnremote.net)
2021-09-10 06:22:59 +0200 <ldlework> I am so close with this keypad translator challenge
2021-09-10 06:24:42 +0200bontaq(~user@ool-45779fe5.dyn.optonline.net)
2021-09-10 06:25:59 +0200sleblanc(~sleblanc@user/sleblanc)
2021-09-10 06:26:10 +0200spruit11(~quassel@2a02:a467:ccd6:1:6cc9:33fd:d92c:45c) (Ping timeout: 260 seconds)
2021-09-10 06:26:30 +0200hyiltiz(~quassel@31.220.5.250) (Remote host closed the connection)
2021-09-10 06:26:38 +0200phma(~phma@host-67-44-208-90.hnremote.net) (Ping timeout: 252 seconds)
2021-09-10 06:27:39 +0200hyiltiz(~quassel@31.220.5.250)
2021-09-10 06:27:42 +0200 <roboguy_> ldlework: nice!
2021-09-10 06:27:55 +0200 <ldlework> It actually seems kind of ill-defined
2021-09-10 06:28:14 +0200 <ldlework> Since if you want to type an 'l' you have to hit 5 three times
2021-09-10 06:28:25 +0200 <ldlework> but if you want to spell hello it's 6 consecutive fives
2021-09-10 06:28:29 +0200 <ldlework> and there's no way to translate back
2021-09-10 06:29:01 +0200 <ldlework> 555555 could be jkl
2021-09-10 06:30:14 +0200amitnjha(~amit@024-216-124-116.res.spectrum.com) (Quit: amitnjha)
2021-09-10 06:30:27 +0200amitnjha(~amit@024-216-124-116.res.spectrum.com)
2021-09-10 06:32:15 +0200zmt01(~zmt00@user/zmt00) (Quit: Gone.)
2021-09-10 06:33:08 +0200bgamari(~bgamari@71.241.201.27)
2021-09-10 06:33:52 +0200zmt00(~zmt00@user/zmt00)
2021-09-10 06:36:43 +0200merijn(~merijn@83-160-49-249.ip.xs4all.nl)
2021-09-10 06:39:57 +0200 <roboguy_> ldlework: on a flip phone, you would usually use a time delay to distinguish between letters. IIRC, there was also often a button you could press to force it to go to the next symbol as well (my current printer is like that, actually). Not sure if the exercise has anything like that
2021-09-10 06:40:09 +0200 <awpr> I don't have the HFFP book, but if it's the same exercise I found on Stack Overflow, it looks like the representation of presses it's concerned with is `[(Char, Int)]`, which already delimits where the letter boundaries are
2021-09-10 06:44:44 +0200phma(~phma@host-67-44-208-90.hnremote.net)
2021-09-10 06:44:56 +0200phma(~phma@host-67-44-208-90.hnremote.net) (Read error: Connection reset by peer)
2021-09-10 06:45:24 +0200beka(~beka@104.193.170.240) (Remote host closed the connection)
2021-09-10 06:45:34 +0200amitnjha(~amit@024-216-124-116.res.spectrum.com) (Quit: amitnjha)
2021-09-10 06:45:42 +0200phma(~phma@host-67-44-208-90.hnremote.net)
2021-09-10 06:45:52 +0200amitnjha(~amit@024-216-124-116.res.spectrum.com)
2021-09-10 06:46:13 +0200poljar(~poljar@93-139-113-226.adsl.net.t-com.hr) (Read error: Connection reset by peer)
2021-09-10 06:46:20 +0200beka(~beka@104.193.170.240)
2021-09-10 06:46:37 +0200poljar(~poljar@93-139-113-226.adsl.net.t-com.hr)
2021-09-10 06:46:42 +0200wroathe(~wroathe@user/wroathe) (Ping timeout: 260 seconds)
2021-09-10 06:46:44 +0200 <ldlework> awpr: that's more of an intermediary representation, they want output like "5555" for [('5', 4)]
2021-09-10 06:47:13 +0200hyiltiz(~quassel@31.220.5.250) (Remote host closed the connection)
2021-09-10 06:47:20 +0200 <ldlework> I think I've gotten all I can get out of this one :D
2021-09-10 06:47:28 +0200 <awpr> hm, the one I'm looking at is from https://codereview.stackexchange.com/questions/140494/key-phone-in-haskell/140517
2021-09-10 06:47:32 +0200phma_(~phma@host-67-44-208-90.hnremote.net) (Ping timeout: 252 seconds)
2021-09-10 06:48:10 +0200 <awpr> must be slightly different, it sounds like a buggy exercise if it's asking to round-trip via a form that doesn't encode the pauses somehow
2021-09-10 06:48:32 +0200hyiltiz(~quassel@31.220.5.250)
2021-09-10 06:50:24 +0200spruit11(~quassel@2a02:a467:ccd6:1:6cc9:33fd:d92c:45c)
2021-09-10 06:51:33 +0200 <ldlework> awpr: it doesn't actually specify to go round trip on rereading
2021-09-10 06:52:50 +0200 <awpr> huh, I guess it's just concatenating them for fun then
2021-09-10 06:53:11 +0200 <awpr> :t foldMap (uncurry (flip replicate))
2021-09-10 06:53:12 +0200 <lambdabot> Foldable t => t (a, Int) -> [a]
2021-09-10 06:59:40 +0200 <ldlework> Here's my go, https://gist.github.com/dustinlacewell/9640ad9f66ca91847a42e2b57e62b94a
2021-09-10 07:03:53 +0200spoonm(spoonm@inaba.spoonm.org) (Quit: I might be back. I might not.)
2021-09-10 07:05:25 +0200spoonm(spoonm@inaba.spoonm.org)
2021-09-10 07:05:43 +0200spruit11(~quassel@2a02:a467:ccd6:1:6cc9:33fd:d92c:45c) (Ping timeout: 252 seconds)
2021-09-10 07:10:38 +0200merijn(~merijn@83-160-49-249.ip.xs4all.nl) (Ping timeout: 252 seconds)
2021-09-10 07:14:57 +0200michalz(~michalz@185.246.204.41)
2021-09-10 07:15:57 +0200amitnjha(~amit@024-216-124-116.res.spectrum.com) (Quit: amitnjha)
2021-09-10 07:16:14 +0200amitnjha(~amit@024-216-124-116.res.spectrum.com)
2021-09-10 07:20:46 +0200takuan(~takuan@178-116-218-225.access.telenet.be)
2021-09-10 07:21:32 +0200img(~img@user/img) (Quit: ZNC 1.8.2 - https://znc.in)
2021-09-10 07:21:48 +0200img(~img@user/img)
2021-09-10 07:26:21 +0200wonko(~wjc@62.115.229.50)
2021-09-10 07:35:25 +0200chele(~chele@user/chele)
2021-09-10 07:37:04 +0200abhixec(~abhixec@c-67-169-139-16.hsd1.ca.comcast.net) (Ping timeout: 252 seconds)
2021-09-10 07:42:00 +0200 <dsal> ldlework: as an if-hater, I'd probably do one of these: https://www.irccloud.com/pastebin/3flz7xOm/if.hs
2021-09-10 07:45:58 +0200 <dsal> ldlework: also, you can avoid some nesting there. https://www.irccloud.com/pastebin/ASuf3zh3/maybe.hs
2021-09-10 07:46:20 +0200amitnjha(~amit@024-216-124-116.res.spectrum.com) (Quit: amitnjha)
2021-09-10 07:46:33 +0200amitnjha(~amit@024-216-124-116.res.spectrum.com)
2021-09-10 07:46:56 +0200jtomas(~jtomas@95.red-88-11-64.dynamicip.rima-tde.net)
2021-09-10 07:49:56 +0200chop(~chattille@222.211.142.77)
2021-09-10 07:50:21 +0200 <dsal> ldlework: and while I'm throwing out unwarranted opinions: `convertKeypadMessage phone = foldMap (seqForPress phone) . mapMaybe (pressFor phone) . normalizeMessage`
2021-09-10 07:52:02 +0200Erutuon(~Erutuon@user/erutuon) (Ping timeout: 260 seconds)
2021-09-10 07:52:12 +0200 <dsal> I've been arguing with people about this a bit, but I really don't like let. It makes everything look upside down to me. It's like, "hey, let's start with the least important ingredient" and then you get to the bottom and only then find out what the function is actually doing.
2021-09-10 07:53:59 +0200 <dsal> So I read that function bottom to top and the actual thing it does is `ret` which is just a `concat` of another value which is just the result of a map, so those three things are really just one `foldMap`. And the input to that is a `catMaybes` of a `map` which is just `mapMaybe` and that's of a thing called `normalizedMsg` that's just the final parameter with `normalizeMessage` called on it.
2021-09-10 07:54:15 +0200 <dsal> So you don't really need to name any of that other than the mapping.
2021-09-10 07:54:45 +0200asivitz(uid178348@id-178348.tinside.irccloud.com) (Quit: Connection closed for inactivity)
2021-09-10 07:56:40 +0200amitnjha(~amit@024-216-124-116.res.spectrum.com) (Quit: amitnjha)
2021-09-10 07:56:56 +0200amitnjha(~amit@024-216-124-116.res.spectrum.com)
2021-09-10 07:58:34 +0200aman(~aman@user/aman)
2021-09-10 07:58:54 +0200roboguy_(~roboguy_@cpe-98-156-4-161.kc.res.rr.com) ()
2021-09-10 07:59:36 +0200chop(~chattille@222.211.142.77) (WeeChat 3.2.1)
2021-09-10 08:02:03 +0200amitnjha(~amit@024-216-124-116.res.spectrum.com) (Quit: amitnjha)
2021-09-10 08:02:17 +0200amitnjha(~amit@024-216-124-116.res.spectrum.com)
2021-09-10 08:11:50 +0200oxide(~lambda@user/oxide)
2021-09-10 08:11:58 +0200max22-(~maxime@2a01cb088335980070c545bb3ed78a74.ipv6.abo.wanadoo.fr)
2021-09-10 08:12:29 +0200Neuromancer(~Neuromanc@user/neuromancer)
2021-09-10 08:15:16 +0200 <dsal> And if you want to get weird, you can do `pressFor` with fewer passes by remembering the position you found the char in right away instead of noting that you found it and then counting back to that list position and searching again: `pressFor (Keypad keys) c = listToMaybe . catMaybes $ zipWith (\k i -> (i,) . succ <$> elemIndex c k) keys [0..]`
2021-09-10 08:15:22 +0200jakalx(~jakalx@base.jakalx.net) (Error from remote client)
2021-09-10 08:18:27 +0200dyeplexer(~dyeplexer@user/dyeplexer)
2021-09-10 08:19:38 +0200falafel(~falafel@2603-8000-d801-2d68-1d6d-bf72-eba2-a20e.res6.spectrum.com)
2021-09-10 08:20:37 +0200Lycurgus(~juan@98.4.112.204)
2021-09-10 08:22:35 +0200fefufo[m](~fefufomat@2001:470:69fc:105::f3a9)
2021-09-10 08:22:48 +0200Pickchea(~private@user/pickchea)
2021-09-10 08:27:23 +0200amitnjha(~amit@024-216-124-116.res.spectrum.com) (Quit: amitnjha)
2021-09-10 08:27:37 +0200amitnjha(~amit@024-216-124-116.res.spectrum.com)
2021-09-10 08:32:43 +0200amitnjha(~amit@024-216-124-116.res.spectrum.com) (Quit: amitnjha)
2021-09-10 08:32:57 +0200amitnjha(~amit@024-216-124-116.res.spectrum.com)
2021-09-10 08:35:18 +0200Sgeo(~Sgeo@user/sgeo) (Read error: Connection reset by peer)
2021-09-10 08:35:35 +0200oxide(~lambda@user/oxide) (Quit: oxide)
2021-09-10 08:38:16 +0200cjb(~cjbayliss@user/cjb) ()
2021-09-10 08:40:00 +0200m4lvin(~m4lvin@w4eg.de) (Quit: m4lvin)
2021-09-10 08:40:23 +0200m4lvin(~m4lvin@w4eg.de)
2021-09-10 08:43:23 +0200jakalx(~jakalx@base.jakalx.net)
2021-09-10 08:45:47 +0200beka(~beka@104.193.170.240) (Ping timeout: 252 seconds)
2021-09-10 08:46:22 +0200meinside(uid24933@id-24933.helmsley.irccloud.com) (Quit: Connection closed for inactivity)
2021-09-10 08:46:25 +0200amahl(~amahl@dsl-jklbng12-54fbca-64.dhcp.inet.fi)
2021-09-10 08:48:02 +0200falafel(~falafel@2603-8000-d801-2d68-1d6d-bf72-eba2-a20e.res6.spectrum.com) (Ping timeout: 260 seconds)
2021-09-10 08:48:47 +0200cfricke(~cfricke@user/cfricke)
2021-09-10 08:56:16 +0200Akronymus(~Akronymus@85.31.8.180)
2021-09-10 08:56:20 +0200max22-(~maxime@2a01cb088335980070c545bb3ed78a74.ipv6.abo.wanadoo.fr) (Ping timeout: 260 seconds)
2021-09-10 09:00:10 +0200ic2000_(~ic2000_@cpc108265-brom11-2-0-cust119.16-1.cable.virginm.net) (Ping timeout: 260 seconds)
2021-09-10 09:00:22 +0200kuribas(~user@ptr-25vy0i7jzpijs82kd6g.18120a2.ip6.access.telenet.be)
2021-09-10 09:02:19 +0200xff0x(~xff0x@2001:1a81:52f8:6100:708e:280b:baf5:c97b) (Ping timeout: 252 seconds)
2021-09-10 09:02:58 +0200xff0x(~xff0x@port-92-193-132-242.dynamic.as20676.net)
2021-09-10 09:03:40 +0200acidjnk_new(~acidjnk@p200300d0c7203080c0b3f2662aa27c56.dip0.t-ipconnect.de)
2021-09-10 09:04:05 +0200Gurkenglas(~Gurkengla@dslb-002-207-014-195.002.207.pools.vodafone-ip.de)
2021-09-10 09:05:54 +0200tzh_(~tzh@c-24-21-73-154.hsd1.or.comcast.net)
2021-09-10 09:07:07 +0200tzh(~tzh@c-24-21-73-154.hsd1.or.comcast.net) (Ping timeout: 265 seconds)
2021-09-10 09:08:03 +0200amitnjha(~amit@024-216-124-116.res.spectrum.com) (Quit: amitnjha)
2021-09-10 09:08:17 +0200amitnjha(~amit@024-216-124-116.res.spectrum.com)
2021-09-10 09:08:23 +0200brandonh(brandonh@gateway/vpn/protonvpn/brandonh)
2021-09-10 09:08:51 +0200merijn(~merijn@83-160-49-249.ip.xs4all.nl)
2021-09-10 09:09:08 +0200acidjnk_new3(~acidjnk@p5487d0ba.dip0.t-ipconnect.de)
2021-09-10 09:12:46 +0200acidjnk_new(~acidjnk@p200300d0c7203080c0b3f2662aa27c56.dip0.t-ipconnect.de) (Ping timeout: 260 seconds)
2021-09-10 09:12:51 +0200max22-(~maxime@2a01cb088335980093c01212af90dc30.ipv6.abo.wanadoo.fr)
2021-09-10 09:13:00 +0200mei(~mei@user/mei)
2021-09-10 09:17:01 +0200tzh_(~tzh@c-24-21-73-154.hsd1.or.comcast.net) (Ping timeout: 252 seconds)
2021-09-10 09:17:07 +0200dagit(~dagit@2001:558:6025:38:6476:a063:d05a:44da) (Ping timeout: 250 seconds)
2021-09-10 09:18:00 +0200slowButPresent(~slowButPr@user/slowbutpresent) (Quit: leaving)
2021-09-10 09:20:42 +0200lavaman(~lavaman@98.38.249.169)
2021-09-10 09:23:36 +0200nicbk(~nicbk@user/nicbk) (Ping timeout: 276 seconds)
2021-09-10 09:24:25 +0200dagit(~dagit@2001:558:6025:38:6476:a063:d05a:44da)
2021-09-10 09:25:22 +0200lavaman(~lavaman@98.38.249.169) (Ping timeout: 260 seconds)
2021-09-10 09:28:43 +0200tzh(~tzh@c-24-21-73-154.hsd1.wa.comcast.net)
2021-09-10 09:30:10 +0200mastarija(~mastarija@31.217.13.81)
2021-09-10 09:40:23 +0200aratamizuki(~aratamizu@p2135145-ipoe.ipoe.ocn.ne.jp) ()
2021-09-10 09:40:57 +0200merijn(~merijn@83-160-49-249.ip.xs4all.nl) (Ping timeout: 265 seconds)
2021-09-10 09:41:36 +0200Pickchea(~private@user/pickchea) (Quit: Leaving)
2021-09-10 09:43:48 +0200fm(~fm@user/fm)
2021-09-10 09:45:52 +0200feliix42(~felix@gibbs.uberspace.de) (Quit: ZNC 1.8.2 - https://znc.in)
2021-09-10 09:46:04 +0200feliix42(~felix@gibbs.uberspace.de)
2021-09-10 09:46:48 +0200mastarija(~mastarija@31.217.13.81) (Quit: Leaving)
2021-09-10 09:49:57 +0200Lycurgus(~juan@98.4.112.204) (Quit: Exeunt)
2021-09-10 09:55:56 +0200chomwitt(~chomwitt@2a02:587:dc14:5d00:12c3:7bff:fe6d:d374)
2021-09-10 10:00:28 +0200merijn(~merijn@83-160-49-249.ip.xs4all.nl)
2021-09-10 10:01:46 +0200fm(~fm@user/fm) (Quit: fm)
2021-09-10 10:03:12 +0200tzh(~tzh@c-24-21-73-154.hsd1.wa.comcast.net) (Quit: zzz)
2021-09-10 10:06:08 +0200hendursa1(~weechat@user/hendursaga)
2021-09-10 10:08:24 +0200mikoto-chan(~mikoto-ch@84.199.144.235)
2021-09-10 10:09:45 +0200hendursaga(~weechat@user/hendursaga) (Ping timeout: 276 seconds)
2021-09-10 10:14:36 +0200azeem(~azeem@2a00:801:23e:e471:2966:ade4:f65d:e1fd) (Read error: Connection reset by peer)
2021-09-10 10:14:51 +0200azeem(~azeem@emp-182-240.eduroam.uu.se)
2021-09-10 10:15:33 +0200tromp(~textual@dhcp-077-249-230-040.chello.nl) (Quit: Textual IRC Client: www.textualapp.com)
2021-09-10 10:17:31 +0200meinside(uid24933@id-24933.helmsley.irccloud.com)
2021-09-10 10:21:25 +0200ubert(~Thunderbi@178.115.42.105.wireless.dyn.drei.com)
2021-09-10 10:23:41 +0200fendor(~fendor@e232-108.eduroam.tuwien.ac.at)
2021-09-10 10:29:52 +0200mikoto-chan(~mikoto-ch@84.199.144.235) (Quit: mikoto-chan)
2021-09-10 10:30:09 +0200vysn(~vysn@user/vysn)
2021-09-10 10:38:23 +0200amitnjha(~amit@024-216-124-116.res.spectrum.com) (Quit: amitnjha)
2021-09-10 10:38:38 +0200amitnjha(~amit@024-216-124-116.res.spectrum.com)
2021-09-10 10:38:44 +0200amitnjha(~amit@024-216-124-116.res.spectrum.com) (Client Quit)
2021-09-10 10:39:02 +0200amitnjha(~amit@024-216-124-116.res.spectrum.com)
2021-09-10 10:39:26 +0200spruit11(~quassel@2a02:a467:ccd6:1:d1b3:349a:ee3f:a17e)
2021-09-10 10:41:18 +0200jpds(~jpds@gateway/tor-sasl/jpds) (Remote host closed the connection)
2021-09-10 10:41:54 +0200jpds(~jpds@gateway/tor-sasl/jpds)
2021-09-10 10:43:10 +0200eggplantade(~Eggplanta@2600:1700:bef1:5e10:c1f1:b01b:5ae7:397c) (Remote host closed the connection)
2021-09-10 10:45:48 +0200econo(uid147250@user/econo) (Quit: Connection closed for inactivity)
2021-09-10 10:50:42 +0200fendor(~fendor@e232-108.eduroam.tuwien.ac.at) (Remote host closed the connection)
2021-09-10 10:51:31 +0200neo2(~neo3@cpe-292712.ip.primehome.com) (Ping timeout: 265 seconds)
2021-09-10 11:03:24 +0200thyriaen(~thyriaen@dynamic-077-013-126-036.77.13.pool.telefonica.de)
2021-09-10 11:05:45 +0200arjun(~Srain@user/arjun)
2021-09-10 11:05:54 +0200 <arjun> Hi
2021-09-10 11:06:04 +0200 <arjun> `f :: forall b a. (Read a, Read b) => String -> (a,b)`
2021-09-10 11:06:09 +0200bitdex(~bitdex@gateway/tor-sasl/bitdex) (Quit: = "")
2021-09-10 11:06:16 +0200aplainzetakind(~johndoe@captainludd.powered.by.lunarbnc.net) (Quit: Free ZNC ~ Powered by LunarBNC: https://LunarBNC.net)
2021-09-10 11:06:29 +0200 <arjun> what does the for all here do? isn't the (Read a, Read b) => constraint enough ?
2021-09-10 11:06:56 +0200 <Hecate> arjun: sometimes for clarifiations
2021-09-10 11:07:24 +0200 <Hecate> arjun: some other times to be able to access a and b (as defined in the signature) in inner bindings like `where` blocks
2021-09-10 11:07:31 +0200 <Hecate> see ScopedTypedVariables
2021-09-10 11:07:53 +0200 <Hecate> arjun: I know of people who systematically insert the forall
2021-09-10 11:08:12 +0200azeem(~azeem@emp-182-240.eduroam.uu.se) (Read error: Connection reset by peer)
2021-09-10 11:08:45 +0200azeem(~azeem@emp-182-240.eduroam.uu.se)
2021-09-10 11:08:49 +0200 <arjun> why do they do that Hecate?
2021-09-10 11:12:19 +0200 <Hecate> arjun: so that they have less to infer by themselves when reading a type signature
2021-09-10 11:12:35 +0200 <ldlework> Is it to correct to understand the HKT `:: *` as "is a concrete/constant type"
2021-09-10 11:12:42 +0200 <ldlework> aka "not a type constructor"
2021-09-10 11:12:43 +0200 <ldlework> ?
2021-09-10 11:12:44 +0200phma(~phma@host-67-44-208-90.hnremote.net) (Read error: Connection reset by peer)
2021-09-10 11:12:56 +0200 <Hecate> it's like having a "dramatis personæ" at the beginning of your theatre play script, arjun
2021-09-10 11:13:15 +0200 <arjun> now i'll have to look _that_ up
2021-09-10 11:13:33 +0200 <kuribas> arjun: a implicit forall containing all the free type variables is implied, when there is no explicit.
2021-09-10 11:13:36 +0200phma(~phma@host-67-44-208-57.hnremote.net)
2021-09-10 11:13:48 +0200 <kuribas> arjun: except that some extensions (ScopedTypeVariables), only work on explicit foralls.
2021-09-10 11:13:57 +0200 <arjun> but i think i get the tl;dr, its to be overtly explicit i guess
2021-09-10 11:14:22 +0200 <arjun> kuribas: i see.
2021-09-10 11:14:22 +0200Vajb(~Vajb@hag-jnsbng11-58c3a8-176.dhcp.inet.fi) (Read error: Connection reset by peer)
2021-09-10 11:14:28 +0200 <kuribas> arjun: and it's always on toplevel, if you want RankN functions, you also need explicit forall.
2021-09-10 11:14:34 +0200merijn(~merijn@83-160-49-249.ip.xs4all.nl) (Ping timeout: 260 seconds)
2021-09-10 11:14:42 +0200 <arjun> thanks Hecate: kuribas:
2021-09-10 11:15:16 +0200 <Hecate> arjun: https://github.com/Kleidukos/effectful-contrib/blob/main/effectful-time/src/Effectful/Time.hs#L30-…
2021-09-10 11:15:19 +0200Vajb(~Vajb@hag-jnsbng11-58c3a8-176.dhcp.inet.fi)
2021-09-10 11:15:22 +0200 <Hecate> see how it can be useful at times
2021-09-10 11:18:04 +0200 <dminuoso> arjun: A few even think that `forall` should have been mandated for all type variables.
2021-09-10 11:18:46 +0200dyeplexer(~dyeplexer@user/dyeplexer) (Ping timeout: 260 seconds)
2021-09-10 11:18:48 +0200 <kuribas> IMO it makes the intention clearer.
2021-09-10 11:19:07 +0200 <dminuoso> Or rather whenever it would be implied.
2021-09-10 11:19:41 +0200 <arjun> Hecate: i see, so everything before the "." are sort of like variable declarations, but at type level ?
2021-09-10 11:20:03 +0200 <Hecate> I think it may be noise when the variables are utterly bland, but when you're doing stuff like forall (a :: [Effect]), then it provides much needed context
2021-09-10 11:20:10 +0200 <Hecate> arjun: yus
2021-09-10 11:20:16 +0200 <Hecate> at the signature level
2021-09-10 11:20:29 +0200 <Hecate> and those variables can be re-used in inner bindings with ScopedTypeVariables
2021-09-10 11:20:41 +0200 <arjun> es :: [Effect], is there another way to do that ? i can't think of any
2021-09-10 11:20:42 +0200 <dminuoso> Hecate: You can use ∀ insead of forall to make it more terse.
2021-09-10 11:21:22 +0200dyeplexer(~dyeplexer@user/dyeplexer)
2021-09-10 11:21:25 +0200 <Hecate> dminuoso: no I'm not taking about the keyword, I'm talking about the whole (possible) line of forall (a :: Type) (b :: Type) (c :: Type), or even forall a b c.
2021-09-10 11:21:32 +0200 <Hecate> arjun: no
2021-09-10 11:22:02 +0200 <arjun> then everything before the "=>" but after the "." deals with those type variables (eg putting constraints on them)
2021-09-10 11:22:10 +0200 <Hecate> I have a simple heuristics: When some type variables are more complex than (:: Type), then I write them all down with their signature
2021-09-10 11:22:24 +0200 <arjun> and then we can happily use them in our fn signatures after the "=>"
2021-09-10 11:22:52 +0200 <Hecate> arjun: or without typeclass constraints, see https://github.com/Kleidukos/effectful-contrib/blob/main/effectful-time/src/Effectful/Time.hs#L25-…
2021-09-10 11:22:58 +0200 <Hecate> NO WAIT
2021-09-10 11:23:00 +0200 <Hecate> I DIDN'T SAY ANYTHING
2021-09-10 11:23:04 +0200 <Hecate> FORGET ABOUT WHAT I JUST SAID
2021-09-10 11:23:15 +0200 <Hecate> arjun: so yes you're right
2021-09-10 11:23:15 +0200 <arjun> about what ?
2021-09-10 11:23:24 +0200 <Hecate> arjun: about the last link I posted
2021-09-10 11:23:34 +0200 <arjun> i dont see anything
2021-09-10 11:23:42 +0200 <Hecate> perfect
2021-09-10 11:24:18 +0200 <Hecate> arjun: do you have any other question?
2021-09-10 11:24:43 +0200 <arjun> no, thanks Hecate:
2021-09-10 11:26:25 +0200 <Hecate> you're welcome
2021-09-10 11:26:41 +0200 <Hecate> arjun: if you feel in need of exploring effect systems, I can recommend Effectful :)
2021-09-10 11:27:07 +0200 <arjun> noted !
2021-09-10 11:28:52 +0200 <tomsmeding> arjun: Another reason why people might use an explicit 'forall' is to fix the order of the type variables. GHC automatically inserts a forall that lists the type variables in a particular order; when giving the forall yourself, you can choose that order
2021-09-10 11:29:20 +0200 <Akronymus> Does anyone here use shake?
2021-09-10 11:29:22 +0200 <tomsmeding> normally this order does not matter at all, but it becomes relevant when you expect people to use your function with TypeApplications
2021-09-10 11:29:29 +0200 <Akronymus> And how does it compare to cmake?
2021-09-10 11:29:47 +0200 <tomsmeding> Witch does this to good effect: https://hackage.haskell.org/package/witch-0.3.4.0/docs/Witch.html
2021-09-10 11:30:12 +0200 <Hecate> Akronymus: shake gives you the basis for making your own build system, while you need to conform to cmake for your project
2021-09-10 11:30:30 +0200 <Hecate> arjun: oh yeah, type app order, very useful
2021-09-10 11:30:39 +0200 <Akronymus> I used a bit a FAKE in the past.
2021-09-10 11:30:51 +0200 <Akronymus> MUCH better than msbuild by itself.
2021-09-10 11:31:00 +0200toms(~foobar@pogostick.net) (Remote host closed the connection)
2021-09-10 11:31:01 +0200 <Hecate> arjun: https://hackage.haskell.org/package/pg-entity-0.0.1.0/candidate/docs/Database-PostgreSQL-Entity.ht…
2021-09-10 11:31:09 +0200 <Hecate> Akronymus: oh, you're doing development on windows?
2021-09-10 11:31:23 +0200 <Akronymus> Yeah.
2021-09-10 11:31:29 +0200 <Akronymus> Altough it was for my own project
2021-09-10 11:31:37 +0200 <Akronymus> Have to use msbuild/c# at work
2021-09-10 11:33:35 +0200 <arjun> tomsmeding: Hecate: yus, thanks! that's what brought me here
2021-09-10 11:33:50 +0200 <arjun> `f :: forall b a. (Read a, Read b) => String -> (a,b)
2021-09-10 11:33:51 +0200 <arjun> f s = (read s, read s)
2021-09-10 11:33:51 +0200 <arjun> λ f @Int @Double "1"`
2021-09-10 11:34:06 +0200 <arjun> In this example b is getting the type Int, and a is getting the type Double.
2021-09-10 11:34:32 +0200 <arjun> from this article here https://rebeccaskinner.net/posts/2021-08-25-introduction-to-type-level-programming.html
2021-09-10 11:35:13 +0200 <Akronymus> Explaining monads well is impossible. :(
2021-09-10 11:35:25 +0200 <Akronymus> I finally understood them but I dunno how to explain them
2021-09-10 11:35:32 +0200 <arjun> tomsmeding: if we didn't, typedApplication will assign in-order right?
2021-09-10 11:35:55 +0200 <Hecate> Akronymus: understanding and teaching are two different skills
2021-09-10 11:36:29 +0200 <Akronymus> Even explaining why they are useful is hard.
2021-09-10 11:36:38 +0200 <Hecate> Akronymus: I highly encourage you to read (and thus teach with) this book https://leanpub.com/finding-success-in-haskell
2021-09-10 11:36:48 +0200 <Hecate> this has unlocked many "explaining" abilities for me
2021-09-10 11:36:50 +0200 <Akronymus> I often get back that it'd be easier to not use a wrapper in any ase I give.
2021-09-10 11:36:58 +0200 <arjun> Akronymus: i heard a joke flying around, based on the "heisenberg's uncertainty principle"
2021-09-10 11:37:12 +0200 <Akronymus> Those who get monads can't explain them?
2021-09-10 11:37:15 +0200 <arjun> you can either use Monads, or understand Monads, but not at once.
2021-09-10 11:37:22 +0200 <Hecate> arjun: LOL
2021-09-10 11:37:23 +0200 <Akronymus> Oh gotcha.
2021-09-10 11:37:49 +0200 <ldlework> If I have a `Just a` is there a way to write `let Just a in print a` that doesn't require the let-just-to-pattern-match?
2021-09-10 11:38:20 +0200 <tomsmeding> arjun: yes, I believe the default order that GHC chooses is the order of appearance, where kind variables are ordered to come before type variables
2021-09-10 11:38:52 +0200 <arjun> i've been doing read 1 :: Int like an idiot all this time lol
2021-09-10 11:39:07 +0200amitnjha(~amit@024-216-124-116.res.spectrum.com) (Quit: amitnjha)
2021-09-10 11:39:10 +0200 <Akronymus> Kinda weird thing for me: I like both, haskell and lisp.
2021-09-10 11:39:20 +0200amitnjha(~amit@024-216-124-116.res.spectrum.com)
2021-09-10 11:39:25 +0200 <Akronymus> But REALLY don't like languages that fall in between in terms of type system
2021-09-10 11:39:25 +0200 <xsperry> ldlework, what should happen on Nothing?
2021-09-10 11:39:28 +0200burnsidesLlama(~burnsides@client-8-80.eduroam.oxuni.org.uk)
2021-09-10 11:39:49 +0200 <ldlework> xsperry: but the function only takes Just a, so I assume the caller already figured that out
2021-09-10 11:40:01 +0200 <tomsmeding> why not let it take an 'a' then :)
2021-09-10 11:40:03 +0200 <Akronymus> Couldn't you just use a map?
2021-09-10 11:40:24 +0200 <ldlework> I'm mostly asking if there's an easy way to get bits out of a datatype without having to wrap a thing in a let-expression
2021-09-10 11:40:30 +0200 <ldlework> not about Just
2021-09-10 11:40:43 +0200 <tomsmeding> only ways that are specific to datatypes
2021-09-10 11:40:54 +0200 <tomsmeding> for maybe there's fromJust, which throws an error on Nothing
2021-09-10 11:40:59 +0200 <ldlework> tomsmeding: you mean like how record types have the member functions
2021-09-10 11:41:02 +0200 <tomsmeding> for record types there are the record selectors of course
2021-09-10 11:41:03 +0200 <Akronymus> Seems like using a naked value is probably the right course of action.
2021-09-10 11:41:07 +0200 <ldlework> I see
2021-09-10 11:41:09 +0200 <ldlework> Thanks
2021-09-10 11:41:10 +0200 <Akronymus> To me.
2021-09-10 11:41:14 +0200 <xsperry> there's also fromMaybe and maybe
2021-09-10 11:41:17 +0200 <tomsmeding> but yeah, from a program design standpoint, try to avoid getting in this situation :)
2021-09-10 11:41:23 +0200 <tomsmeding> xsperry++
2021-09-10 11:41:38 +0200 <xsperry> :t maybe (return ()) print
2021-09-10 11:41:39 +0200 <ldlework> Just really was just the first datatype in mind
2021-09-10 11:41:39 +0200 <lambdabot> Show a => Maybe a -> IO ()
2021-09-10 11:41:52 +0200 <tomsmeding> ldlework: Just is not a datatype, 'Maybe a' is
2021-09-10 11:41:57 +0200 <tomsmeding> Just is a constructor of Maybe
2021-09-10 11:42:45 +0200 <ldlework> ah yeah i'm still working out the fog in nailing down the exact concepts
2021-09-10 11:42:51 +0200 <Akronymus> Why do people keep saying loops are easier to understand?
2021-09-10 11:42:59 +0200 <Akronymus> (for loops that is)
2021-09-10 11:43:05 +0200 <kuribas> Akronymus: because it's all they ever did
2021-09-10 11:43:09 +0200 <ldlework> Akronymus: momentum
2021-09-10 11:43:11 +0200 <ldlework> yeah that
2021-09-10 11:43:13 +0200cafkafk(~cafkafk@user/cafkafk)
2021-09-10 11:43:34 +0200eggplantade(~Eggplanta@2600:1700:bef1:5e10:c1f1:b01b:5ae7:397c)
2021-09-10 11:43:34 +0200 <Akronymus> When I see a "for" it may be doing anything and everything
2021-09-10 11:43:38 +0200 <ldlework> the challenges in haskell are like
2021-09-10 11:44:01 +0200 <ldlework> "change all the occurances of 'the' to 'a' when followed by a word starting with a vowel"
2021-09-10 11:44:02 +0200 <Akronymus> While with map or fold I know that it converts the values without changing structure or that it changes structure.
2021-09-10 11:44:08 +0200 <ldlework> and i sit here for hours thinking about how to do it
2021-09-10 11:44:20 +0200 <ldlework> where in a language i'm comfortable with it would take maybe less than a minute
2021-09-10 11:44:21 +0200 <ldlework> lol
2021-09-10 11:44:27 +0200amitnjha(~amit@024-216-124-116.res.spectrum.com) (Quit: amitnjha)
2021-09-10 11:44:40 +0200amitnjha(~amit@024-216-124-116.res.spectrum.com)
2021-09-10 11:44:56 +0200 <tomsmeding> yeah, folds are frequently easier to read because of their more limited capabilities, but sometimes for loops are easier to _write_
2021-09-10 11:44:56 +0200 <ldlework> challenges in *Haskell From First Principles
2021-09-10 11:45:15 +0200 <tomsmeding> because when you start writing the loop, sometimes you don't yet know what kind of accesses to the lists/arrays/whatever you need to do
2021-09-10 11:45:17 +0200 <Akronymus> I'd solve that with a fold that keeps track of the last 2 tokens, and use that as a basic lookahead.
2021-09-10 11:45:34 +0200 <tomsmeding> with a for loop, you can just start writing; with a fold, you need to nail down what you need before you can even start
2021-09-10 11:45:36 +0200 <ldlework> it's really odd having to create a type to hold the state of the work for a given "loop"
2021-09-10 11:45:52 +0200 <Akronymus> If "the" and a word starting with a vowel are the last 2, then insert a, otherse the original word.
2021-09-10 11:45:54 +0200 <ldlework> and then writing something to "fold" over that state until its done
2021-09-10 11:46:04 +0200 <Akronymus> And then have a extra function that takes care of the remainder.
2021-09-10 11:46:05 +0200 <tomsmeding> I find myself writing a for loop sometimes first to figure out what I even want, and then afterwards convert it to a proper fold (which is usually simpler than the for loop was)(
2021-09-10 11:46:07 +0200 <tomsmeding> )
2021-09-10 11:46:20 +0200 <ldlework> Akronymus: yeah but it's the act of writing a type to hold the state, and a function to iterate it which is really strange
2021-09-10 11:46:28 +0200 <Hecate> sometimes I just go with for_, or forM and it is the right answer
2021-09-10 11:46:30 +0200 <ldlework> tomsmeding: have you tried F# :P
2021-09-10 11:46:45 +0200 <ldlework> Hecate: haven't gotten to chapter 15 of HFFP yet :P
2021-09-10 11:46:48 +0200 <ldlework> I'm on 12!
2021-09-10 11:46:57 +0200 <Hecate> we don't always have to sacrifice our first-born loops to YHWH
2021-09-10 11:47:01 +0200 <tomsmeding> no, what's it do, does it support for loops in pure code?
2021-09-10 11:47:03 +0200 <Akronymus> For me, not having them is stranger nowadays ldlework
2021-09-10 11:47:12 +0200 <tomsmeding> haskell does too, with the ST monad, but it's very unwieldy
2021-09-10 11:47:13 +0200 <ldlework> Akronymus: I believe it
2021-09-10 11:47:22 +0200aplainzetakind(~johndoe@captainludd.powered.by.lunarbnc.net)
2021-09-10 11:47:41 +0200 <ldlework> tomsmeding: yeah it's an ML with for-loop and other imperative support
2021-09-10 11:47:41 +0200 <kuribas> ldlework: the only difference is that you create a new structure instead of modifying the existing one.
2021-09-10 11:47:50 +0200 <kuribas> ldlework: and use recursion instead of a loop.
2021-09-10 11:48:06 +0200 <ldlework> right but those are experientially and cognitively pretty different
2021-09-10 11:48:06 +0200 <Akronymus> f# is pretty good.
2021-09-10 11:48:10 +0200eggplantade(~Eggplanta@2600:1700:bef1:5e10:c1f1:b01b:5ae7:397c) (Ping timeout: 260 seconds)
2021-09-10 11:48:12 +0200 <kuribas> ldlework: also, use the `words` function.
2021-09-10 11:48:19 +0200 <ldlework> hehe i will thanks
2021-09-10 11:48:23 +0200 <Akronymus> I use that over haskell in my projects because of the great .net support.
2021-09-10 11:48:31 +0200 <kuribas> ldlework: not really. Well structural recursion is much easier than a for loop.
2021-09-10 11:48:31 +0200 <Akronymus> But I DO miss HKT.
2021-09-10 11:48:41 +0200 <ldlework> yeah it doesn't have a do syntax either
2021-09-10 11:48:51 +0200 <ldlework> but it has a kind of wierd frankenstein replacement
2021-09-10 11:48:55 +0200 <ldlework> it's not bad in practice
2021-09-10 11:49:02 +0200 <Akronymus> Yeah, the computation expressions
2021-09-10 11:49:05 +0200 <ldlework> yeah
2021-09-10 11:49:05 +0200 <Akronymus> Pretty useful.
2021-09-10 11:49:46 +0200 <ldlework> it's a pretty wierd thing for MS to make
2021-09-10 11:49:57 +0200 <ldlework> F# I mean
2021-09-10 11:50:59 +0200 <ldlework> ah `words` is handy thanks kuribas
2021-09-10 11:51:36 +0200 <tdammers> it does fit the original .NET concept though - one runtime environment / VM, with a whole zoo of languages to run on it, with seamless interop between them
2021-09-10 11:52:50 +0200 <tdammers> it just so happened that "Managed C++" turned out an abomination, VB.NET was only useful as a stop-gap in migrating from legacy VB to C#, F# was "too academic", and rebranding Java.NET as J# or whatever was apparently not enough to keep in the clear legally, so the only one left, really, is C#
2021-09-10 11:52:51 +0200jpds(~jpds@gateway/tor-sasl/jpds) (Remote host closed the connection)
2021-09-10 11:53:09 +0200 <tdammers> but back then, it made sense
2021-09-10 11:53:12 +0200 <ldlework> F# is still there!
2021-09-10 11:53:18 +0200jpds(~jpds@gateway/tor-sasl/jpds)
2021-09-10 11:53:26 +0200 <Akronymus> And still gets updates.
2021-09-10 11:53:34 +0200 <Akronymus> And may even get HKT at some point.
2021-09-10 11:53:34 +0200 <tdammers> well yes, so are managed c++ and vb.net, afaik
2021-09-10 11:53:42 +0200 <Akronymus> (There is a HKT proposal for x#)
2021-09-10 11:53:48 +0200 <Akronymus> s/x#/c#
2021-09-10 11:53:55 +0200 <ldlework> tdammers: haha, I mean they still make releases for it
2021-09-10 11:54:11 +0200 <ldlework> F# is actually a kind of proving ground for some of the features that go into C#
2021-09-10 11:54:47 +0200amitnjha(~amit@024-216-124-116.res.spectrum.com) (Quit: amitnjha)
2021-09-10 11:55:04 +0200amitnjha(~amit@024-216-124-116.res.spectrum.com)
2021-09-10 11:55:23 +0200 <ldlework> Oh shi- actually they said F# 5 is last release
2021-09-10 11:55:26 +0200 <Akronymus> Lambdas, async await and such
2021-09-10 11:55:27 +0200 <ldlework> that's sad
2021-09-10 11:55:47 +0200 <ldlework> oh wait
2021-09-10 11:55:52 +0200 <ldlework> i think i just misread this title
2021-09-10 11:55:55 +0200 <Akronymus> source?
2021-09-10 11:55:59 +0200 <ldlework> that was simply saying they were "done with F# 5"
2021-09-10 11:56:03 +0200 <ldlework> as in they finished it
2021-09-10 11:56:05 +0200 <Akronymus> Oh yeah.
2021-09-10 11:56:09 +0200 <ldlework> rather than "we're finish with F# 5"
2021-09-10 11:56:11 +0200 <ldlework> phew!
2021-09-10 11:56:58 +0200 <Akronymus> https://github.com/fsharp/fslang-design/tree/main/preview ldlework
2021-09-10 11:57:01 +0200 <Gurkenglas> <Gurkenglas> Why aren't the lens laws just "view l s ≡ view l s' implies set l b s ≡ set l b s'"? <- <nshepperd2> because that law isn't true? <- may I have an example?
2021-09-10 11:57:06 +0200 <ldlework> kinda wish haskell had a maybeIf hehe
2021-09-10 11:57:17 +0200 <Akronymus> Wait, wrong folder
2021-09-10 11:57:21 +0200 <Akronymus> Or not
2021-09-10 11:57:27 +0200 <Akronymus> I looked at the wrong tab
2021-09-10 11:57:30 +0200mangoiv(~MangoIV@193.175.5.172)
2021-09-10 11:58:44 +0200 <Akronymus> Also: ldlework >New releases of F# typically align with a .NET and/or Visual Studio version.
2021-09-10 11:58:53 +0200 <ldlework> C#, F#, TypeScript is not a bad repertoire I'll hand it to them
2021-09-10 11:58:57 +0200 <Akronymus> So, when we get .net 6 we'll probably also get f# 6
2021-09-10 11:59:04 +0200 <ldlework> I was learning about TypeScript mapped and conditional types a few months ago
2021-09-10 11:59:12 +0200 <ldlework> mind-melting!
2021-09-10 11:59:21 +0200 <Hecate> ldlework: what would be the type signature of this maybeIf ?
2021-09-10 12:00:13 +0200 <ldlework> Hecate: I guess it would be like an if A then X else Y, evaluating to X when A is Just and Y when X is Nothing
2021-09-10 12:00:50 +0200 <ldlework> just like a short hand sugar for a Maybe handling case-of
2021-09-10 12:01:49 +0200favonia(~favonia@user/favonia)
2021-09-10 12:02:24 +0200 <ldlework> I guess case has the advantage of the destructure, allowing you to actually utilize the value
2021-09-10 12:02:34 +0200 <ldlework> not sure how that'd work with a maybeIf
2021-09-10 12:02:37 +0200 <ldlework> nevermind!
2021-09-10 12:03:15 +0200 <ldlework> in lisp the macro would bind the Just value to `it` and call it a day :D
2021-09-10 12:04:16 +0200 <Hecate> huhu
2021-09-10 12:05:47 +0200 <tomsmeding> :t maybe -- ldlework
2021-09-10 12:05:48 +0200 <lambdabot> b -> (a -> b) -> Maybe a -> b
2021-09-10 12:06:18 +0200 <tomsmeding> > map (maybe 0 (*2)) [-2..2]
2021-09-10 12:06:20 +0200 <lambdabot> error:
2021-09-10 12:06:20 +0200 <lambdabot> • No instance for (Num (Maybe Integer))
2021-09-10 12:06:20 +0200 <lambdabot> arising from a use of ‘e_10222’
2021-09-10 12:06:21 +0200 <ldlework> one day i hope to be able to look at a function type and infer its utility
2021-09-10 12:06:33 +0200 <tomsmeding> > map (maybe 0 (*2)) [Just 2, Just 4, Nothing, Just 5]
2021-09-10 12:06:34 +0200 <lambdabot> [4,8,0,10]
2021-09-10 12:06:48 +0200 <tomsmeding> (ignore the one that gave an error, brainfart)
2021-09-10 12:07:05 +0200 <ldlework> so map the function over the list, for any Nothing's return the constant value
2021-09-10 12:07:07 +0200 <ldlework> ?
2021-09-10 12:07:17 +0200 <tomsmeding> well, I used 'map' to map it over the list
2021-09-10 12:07:32 +0200 <ldlework> right
2021-09-10 12:07:40 +0200 <tomsmeding> `maybe default fun x` is equivalent to `case x of Just value -> fun value ; Nothing -> default`
2021-09-10 12:07:49 +0200 <tomsmeding> @src maybe
2021-09-10 12:07:49 +0200 <lambdabot> maybe n _ Nothing = n
2021-09-10 12:07:49 +0200 <lambdabot> maybe _ f (Just x) = f x
2021-09-10 12:08:08 +0200 <ldlework> ah that's a nice bot command to know
2021-09-10 12:08:11 +0200 <tomsmeding> @src fromMaybe
2021-09-10 12:08:11 +0200 <lambdabot> fromMaybe d Nothing = d
2021-09-10 12:08:11 +0200 <lambdabot> fromMaybe _ (Just v) = v
2021-09-10 12:08:39 +0200 <Akronymus> How can people even live without algebraic data types?
2021-09-10 12:08:43 +0200 <ldlework> @src maybeMap
2021-09-10 12:08:43 +0200 <lambdabot> Source not found. :(
2021-09-10 12:08:43 +0200 <tomsmeding> (@src only works for a select list of functions, and contains some simplified implementations sometimes for didactical reasons)
2021-09-10 12:09:04 +0200 <ldlework> you mean pedagogical reasons
2021-09-10 12:09:05 +0200 <ldlework> ?
2021-09-10 12:09:24 +0200 <tomsmeding> maaaybe, I always switch those words around
2021-09-10 12:09:25 +0200 <ldlework> oh
2021-09-10 12:09:36 +0200 <ldlework> i think either kinda works here whatever
2021-09-10 12:09:41 +0200 <ldlework> cool
2021-09-10 12:09:45 +0200 <tomsmeding> right, yes
2021-09-10 12:09:46 +0200spruit11_(~quassel@2a02:a467:ccd6:1:5542:2068:efaa:d531)
2021-09-10 12:10:20 +0200 <tomsmeding> though in this case, @src didn't simplify anything :D https://hackage.haskell.org/package/base-4.15.0.0/docs/src/Data-Maybe.html#maybe
2021-09-10 12:10:38 +0200arjun(~Srain@user/arjun) (Read error: Connection reset by peer)
2021-09-10 12:11:09 +0200arjun(~Srain@user/arjun)
2021-09-10 12:11:38 +0200 <tomsmeding> :t either -- see also this one
2021-09-10 12:11:39 +0200 <lambdabot> (a -> c) -> (b -> c) -> Either a b -> c
2021-09-10 12:12:30 +0200 <tomsmeding> :t foldr -- and this one; the moment you understand how foldr is similar to maybe and either, you're going to have a big brain moment
2021-09-10 12:12:31 +0200 <lambdabot> Foldable t => (a -> b -> b) -> b -> t a -> b
2021-09-10 12:12:36 +0200 <ldlework> i always tell young programmers how they'll have a better time with statically typed languages because of how much more powerful your editor/compiler can become when it has such explicit information
2021-09-10 12:12:57 +0200 <ldlework> the vscode haskell plugin is not bad as refining expressions down to functions which cover that form
2021-09-10 12:13:11 +0200 <ldlework> like a map to a concat can become a concatMap
2021-09-10 12:13:24 +0200 <tomsmeding> (that foldr remark is about foldr on lists [a] specifically, not on arbitrary Foldables)
2021-09-10 12:13:30 +0200spruit11(~quassel@2a02:a467:ccd6:1:d1b3:349a:ee3f:a17e) (Ping timeout: 260 seconds)
2021-09-10 12:13:52 +0200 <tomsmeding> ldlework: that's actually hlint that gives those suggestions, FYI
2021-09-10 12:14:00 +0200 <ldlework> good to know
2021-09-10 12:14:49 +0200 <ldlework> oh I need a concatMap that takes a delimeter :P
2021-09-10 12:14:58 +0200 <tomsmeding> :t intercalate
2021-09-10 12:14:59 +0200 <lambdabot> [a] -> [[a]] -> [a]
2021-09-10 12:15:08 +0200 <ldlework> XD
2021-09-10 12:15:15 +0200 <tomsmeding> > intercalate "," ["abc","def","ghi"]
2021-09-10 12:15:17 +0200 <lambdabot> "abc,def,ghi"
2021-09-10 12:15:19 +0200 <ldlework> I guess 'concatMapWith'
2021-09-10 12:15:22 +0200 <ldlework> guessed*
2021-09-10 12:15:50 +0200 <tomsmeding> https://hackage.haskell.org/package/bytestring-0.11.1.0/docs/Data-ByteString-Internal.html#v:accur…
2021-09-10 12:16:33 +0200 <ldlework> 🎵 "It's time for intercalation." 🎵
2021-09-10 12:16:41 +0200dudek(~dudek@185.150.236.103)
2021-09-10 12:17:52 +0200 <ldlework> oh "unwords"
2021-09-10 12:17:54 +0200 <ldlework> hehe
2021-09-10 12:18:40 +0200 <[exa]> btw is there some standard `untokens` ? (aka reverse strtok)
2021-09-10 12:19:58 +0200azeem(~azeem@emp-182-240.eduroam.uu.se) (Ping timeout: 265 seconds)
2021-09-10 12:20:38 +0200 <ldlework> my solution https://gist.github.com/dustinlacewell/06a6cb6e97c9fa70bc0342c36fe1374c
2021-09-10 12:21:02 +0200 <ldlework> oh i forgot the vowel constraint
2021-09-10 12:21:12 +0200 <tomsmeding> [exa]: isn't that intercalate?
2021-09-10 12:21:54 +0200 <ldlework> oh that isn't an actual constraint
2021-09-10 12:22:08 +0200 <[exa]> tomsmeding: it adds quotes and escapes
2021-09-10 12:22:21 +0200fusionr86(~fusion@2a02-a44c-e6e5-1-cd1b-44f3-eefe-5182.fixed6.kpn.net)
2021-09-10 12:22:27 +0200 <[exa]> it could be called `unshell` probably
2021-09-10 12:22:52 +0200 <tomsmeding> (I thought strtok() was just splitOn)
2021-09-10 12:26:49 +0200azeem(~azeem@2a00:801:448:a48c:d59f:aee2:6d38:40c4)
2021-09-10 12:26:54 +0200 <fusionr86> sup all. for my uni course we have to learn haskell and I'm currently working through my homework. I've got a few small questions about it though. Am I allowed to ask them here, or is that frowned upon? (ironically enough I can already see my teacher in this chat)
2021-09-10 12:28:09 +0200 <tomsmeding> ;)
2021-09-10 12:28:19 +0200 <tomsmeding> (can also ask in teams if you wish)
2021-09-10 12:28:45 +0200 <tomsmeding> (assuming I'm the person you're talking about)
2021-09-10 12:29:05 +0200 <fusionr86> (yeah but teams is a pita to use and less 'informal')
2021-09-10 12:29:21 +0200 <tomsmeding> re:pita: yes, re:informal: /shrug/
2021-09-10 12:29:43 +0200 <fusionr86> is it possible to send code blocks in irc? (like in markdown ``` code ```)?
2021-09-10 12:30:05 +0200 <tomsmeding> irc is single-line-per-message; if you want to send multiple lines, use some kind of pastebin (see also the channel topic)
2021-09-10 12:30:36 +0200 <tomsmeding> also: homework questions in #haskell is perfectly fine as long as you state that it's homework :)
2021-09-10 12:32:19 +0200azeem(~azeem@2a00:801:448:a48c:d59f:aee2:6d38:40c4) (Read error: Connection reset by peer)
2021-09-10 12:32:47 +0200 <Akronymus> https://hastebin.com/karaxagabi.typescript
2021-09-10 12:33:11 +0200 <Akronymus> This is how I'd solve the replace the "the" with "a" if followed by a word starting with a vowel.
2021-09-10 12:33:16 +0200 <Akronymus> Altough this is f#
2021-09-10 12:33:19 +0200 <fusionr86> alrighty, you probably know what I'm talking about but I added comments with context in case anyone else looks at it -> https://paste.tomsmeding.com/3GfIgN6z
2021-09-10 12:33:35 +0200azeem(~azeem@emp-182-240.eduroam.uu.se)
2021-09-10 12:33:51 +0200 <Akronymus> Only works with strings that are just one line though
2021-09-10 12:33:54 +0200 <fusionr86> expected output should be "+-+--+---+----+" I messed that up in the example
2021-09-10 12:34:03 +0200 <Akronymus> And only separated by a single space
2021-09-10 12:35:48 +0200burnsidesLlama(~burnsides@client-8-80.eduroam.oxuni.org.uk) (Remote host closed the connection)
2021-09-10 12:36:07 +0200 <tomsmeding> fusionr86: in my opinion, lambda _is_ prettier; "+" ++ intercalate "+" (map (\n -> replicate n '-') x) ++ "+" looks fine to me
2021-09-10 12:36:33 +0200 <tomsmeding> alternative is using the infix function notation (like `div`), but together with an operator section
2021-09-10 12:36:40 +0200 <Akronymus> Nvm, I messed the function up
2021-09-10 12:36:42 +0200 <tomsmeding> :t (2 +)
2021-09-10 12:36:43 +0200 <lambdabot> Num a => a -> a
2021-09-10 12:36:50 +0200 <tomsmeding> > (2 +) 10
2021-09-10 12:36:52 +0200 <lambdabot> 12
2021-09-10 12:36:54 +0200Akronymus(~Akronymus@85.31.8.180) ()
2021-09-10 12:37:02 +0200Akronymus(~Akronymus@85.31.8.180)
2021-09-10 12:37:07 +0200 <tomsmeding> > (`replicate` '-') 5
2021-09-10 12:37:09 +0200 <lambdabot> "-----"
2021-09-10 12:37:39 +0200 <tomsmeding> but I think (\n -> replicate n '-') is significantly easier to read than (`replicate` '-') :p
2021-09-10 12:38:04 +0200 <tomsmeding> fusionr86: exercise: use 'flip' to avoid a lambda
2021-09-10 12:38:05 +0200 <tomsmeding> :t flip
2021-09-10 12:38:06 +0200choucavalier_(~choucaval@peanutbuttervibes.com) (Quit: ZNC 1.8.2 - https://znc.in)
2021-09-10 12:38:07 +0200 <lambdabot> (a -> b -> c) -> b -> a -> c
2021-09-10 12:39:01 +0200 <Akronymus> https://rebeccaskinner.net/posts/2021-08-25-introduction-to-type-level-programming.html
2021-09-10 12:39:06 +0200 <Akronymus> Some may find this interesting
2021-09-10 12:39:49 +0200 <tomsmeding> Akronymus: if you're using regex anyway, why not replace /\b[Tt][Hh][Ee]\s+([aeiouAEIOU])/ with "a \1"
2021-09-10 12:40:01 +0200 <tomsmeding> I think using regex here is missing the point of the exercise :p
2021-09-10 12:40:42 +0200 <Akronymus> I of course could have checked for each possibly letter through match
2021-09-10 12:40:51 +0200 <Akronymus> But I messed up the code anyways.
2021-09-10 12:41:10 +0200 <tomsmeding> isThe :: String -> Bool ; isThe w = map toLower w == "the"
2021-09-10 12:41:15 +0200 <tomsmeding> inspiration :P
2021-09-10 12:42:23 +0200 <Akronymus> I pretty much wrote it out in 5 minutes.
2021-09-10 12:42:45 +0200 <Akronymus> But yeah, this is one of the cases, where an iterative approach is probably easier.
2021-09-10 12:43:58 +0200arjun(~Srain@user/arjun) (Ping timeout: 252 seconds)
2021-09-10 12:47:42 +0200 <ldlework> An easy way is to write a foldl2
2021-09-10 12:48:11 +0200 <ldlework> foldl2 _ b [] = b; foldl2 _ b [_] = b; foldl2 f b (a:a2:as) =
2021-09-10 12:48:13 +0200 <ldlework> foldl2 f b' (a2:as)
2021-09-10 12:48:15 +0200 <ldlework> where b' = f b a a2
2021-09-10 12:48:40 +0200 <ldlework> though this is for counting `the`s followed by a word starting with a vowel
2021-09-10 12:48:50 +0200 <ldlework> so you just need isThe and startWithVowel
2021-09-10 12:48:56 +0200 <ldlework> but you can do a map2 too
2021-09-10 12:49:08 +0200 <tomsmeding> Akronymus: the cop-out approach where you ignore that folds are cool is to just write the loop as a recursive function directly: https://paste.tomsmeding.com/ZbIpppMe
2021-09-10 12:49:23 +0200 <tomsmeding> this is barely more thinking work than writing an imperative loop
2021-09-10 12:50:19 +0200 <fusionr86> okay, and "f1 = (`replicate` '-')" and "f2 x = replicate x '-'" are exactly the same, correct?
2021-09-10 12:50:25 +0200 <tomsmeding> yes
2021-09-10 12:50:49 +0200 <tomsmeding> just like "f1 = (+ 10)" and "f2 x = x + 10" are exactly the same
2021-09-10 12:51:01 +0200 <fusionr86> coming from c-style languages stuff like this is completely mind shattering
2021-09-10 12:51:32 +0200 <tomsmeding> it allows for very concise things sometimes :)
2021-09-10 12:51:58 +0200 <tomsmeding> like, "map (*2)" is a function that returns a list containing all the elements in its argument list doubled
2021-09-10 12:52:08 +0200 <tomsmeding> beat that in anything but a golfing language like GolfScript
2021-09-10 12:52:50 +0200 <Akronymus> Yeah, that's fair
2021-09-10 12:52:55 +0200 <Akronymus> tomsmeding
2021-09-10 12:53:06 +0200 <Akronymus> I messed up MANY things with my fold solution anyways.
2021-09-10 12:53:08 +0200 <Rembane> J!
2021-09-10 12:53:10 +0200hpc(~juzz@ip98-169-35-13.dc.dc.cox.net) (Ping timeout: 240 seconds)
2021-09-10 12:53:19 +0200 <tomsmeding> J is a golfing language, hot take :p
2021-09-10 12:53:25 +0200 <tomsmeding> okay no it isn't
2021-09-10 12:53:25 +0200 <carbolymer> I'm trying to understand linear types; is there any tl;dr what those are and when would I need them?
2021-09-10 12:54:22 +0200 <tomsmeding> carbolymer: section 2 of https://arxiv.org/pdf/1710.09756.pdf is actually quite readable
2021-09-10 12:54:46 +0200 <carbolymer> tomsmeding: thanks!
2021-09-10 12:54:58 +0200 <Rembane> tomsmeding: It's just very good for golfing :D
2021-09-10 12:55:04 +0200hpc(~juzz@ip98-169-35-13.dc.dc.cox.net)
2021-09-10 12:56:00 +0200arjun(~Srain@user/arjun)
2021-09-10 12:56:53 +0200raehik(~raehik@cpc95906-rdng25-2-0-cust156.15-3.cable.virginm.net)
2021-09-10 12:56:53 +0200 <Akronymus> Rembane Java is good at golfing /s
2021-09-10 12:57:05 +0200 <carbolymer> s/golfing/loosing at golfing/
2021-09-10 12:57:13 +0200 <Akronymus> s/loosing/losing
2021-09-10 12:58:19 +0200 <carbolymer> your pattern is missing trailing slash - substitution failed
2021-09-10 12:58:57 +0200 <Akronymus> Most IRC sed bots worked without a trailing slash
2021-09-10 12:59:11 +0200 <Akronymus> I miss having a sed bot at all.
2021-09-10 13:00:35 +0200mitchell(~mitchell@185.64.41.91)
2021-09-10 13:00:38 +0200mitchell(~mitchell@185.64.41.91) ()
2021-09-10 13:00:58 +0200alx741(~alx741@186.178.109.214)
2021-09-10 13:03:01 +0200 <fusionr86> tomsmeding: Ah and this is what you meant by using flip? `printLine x = "+" ++ intercalate "+" (map (flip replicate '-') x) ++ "+"` Though I like the infix solution more (and so does hlint)
2021-09-10 13:03:57 +0200ubert(~Thunderbi@178.115.42.105.wireless.dyn.drei.com) (Ping timeout: 265 seconds)
2021-09-10 13:04:02 +0200 <raehik> I'm getting a strange issue trying to build a package that uses hmatrix -- Cabal won't use my --extra-[lib,include]-dirs flags
2021-09-10 13:04:43 +0200 <raehik> It keeps failing on hmatrix saying "cannot find blas, lapack". I downloaded hmatrix source and tried the same command, and that works (it was able to find my built libs)
2021-09-10 13:05:18 +0200 <raehik> Does Cabal push --extra-x-flags down when building dependencies? How else can I solve this?
2021-09-10 13:05:53 +0200azeem(~azeem@emp-182-240.eduroam.uu.se) (Ping timeout: 265 seconds)
2021-09-10 13:06:01 +0200arjun_(~Srain@user/arjun)
2021-09-10 13:06:31 +0200arjun(~Srain@user/arjun) (Ping timeout: 252 seconds)
2021-09-10 13:06:32 +0200arjun_arjun
2021-09-10 13:07:05 +0200pony(~ed@101.53.218.157) (Quit: WeeChat 2.8)
2021-09-10 13:08:21 +0200azeem(~azeem@2a00:801:448:a48c:d59f:aee2:6d38:40c4)
2021-09-10 13:08:53 +0200azeem(~azeem@2a00:801:448:a48c:d59f:aee2:6d38:40c4) (Read error: Connection reset by peer)
2021-09-10 13:09:02 +0200 <tomsmeding> fusionr86: that's indeed what I meant :)
2021-09-10 13:09:10 +0200machinedgod(~machinedg@135-23-192-217.cpe.pppoe.ca)
2021-09-10 13:09:11 +0200azeem(~azeem@emp-182-240.eduroam.uu.se)
2021-09-10 13:09:29 +0200 <tomsmeding> my preference would go to the lambda version though, hlint notwithstanding
2021-09-10 13:09:36 +0200 <tomsmeding> but that's subjective
2021-09-10 13:10:59 +0200merijn(~merijn@83-160-49-249.ip.xs4all.nl)
2021-09-10 13:11:18 +0200 <tomsmeding> raehik: you might want to try using a cabal.project file https://arxiv.org/pdf/1710.09756.pdf
2021-09-10 13:11:21 +0200 <tomsmeding> oh crap
2021-09-10 13:11:25 +0200 <tomsmeding> this link https://cabal.readthedocs.io/en/3.4/cabal-project.html#foreign-function-interface-options
2021-09-10 13:11:40 +0200arjun_(~Srain@user/arjun)
2021-09-10 13:11:53 +0200 <tomsmeding> like, "packages: .\npackage hmatrix\n\textra-include-dirs: ...\n\textra-lib-dirs: ...\n"
2021-09-10 13:12:10 +0200arjun(~Srain@user/arjun) (Ping timeout: 260 seconds)
2021-09-10 13:12:10 +0200mangoiv(~MangoIV@193.175.5.172) (Ping timeout: 260 seconds)
2021-09-10 13:12:10 +0200arjun_arjun
2021-09-10 13:15:52 +0200 <raehik> tomsmeding: thank you! so that's what this (open, 2015) issue was about https://github.com/haskell/cabal/issues/2997
2021-09-10 13:16:07 +0200 <raehik> I was writing that into the *.cabal file instead oops. not used cabal.project before
2021-09-10 13:16:55 +0200 <raehik> It looks like the -I include dir flag is successfully added now, but not the -L lib dir one, & fails with same error
2021-09-10 13:17:18 +0200 <raehik> ah nope -L s are there too, good
2021-09-10 13:17:54 +0200mei(~mei@user/mei) (Read error: Connection reset by peer)
2021-09-10 13:19:17 +0200teo(~teo@137.220.120.222)
2021-09-10 13:19:58 +0200 <raehik> Very weird. I'm building on Windows. --extra-x-dirs flags with Linux-style dirs (/x/y/z) work on building hmatrix directly
2021-09-10 13:19:59 +0200oxide(~lambda@user/oxide)
2021-09-10 13:20:30 +0200 <raehik> but for a project that uses hmatrix as a dep, I need a cabal.project and I need to use Windows-style dirs (C:\x\y\z)
2021-09-10 13:20:42 +0200 <tomsmeding> isn't that because ghc uses mingw internally, and that has a linux-path-to-windows-path conversion thing?
2021-09-10 13:21:17 +0200 <tomsmeding> raehik: ghc versions?
2021-09-10 13:22:26 +0200 <tomsmeding> 9 or 9.2 or something added a new windows layer for the RTS or something? that did away with some of the mingw stuff? just guessing
2021-09-10 13:22:27 +0200lavaman(~lavaman@98.38.249.169)
2021-09-10 13:22:32 +0200 <raehik> GHC 9.0.1 via ghcup
2021-09-10 13:23:08 +0200 <raehik> You're right I see lots of /x/ghcup/mingw32 paths in the verbose build logs
2021-09-10 13:23:14 +0200 <fusionr86> tomsmeding: so which of these two solutions is prettier? https://paste.tomsmeding.com/TSpvZg9Q I kinda like 2a because it uses less () aka more readable imo, but abusing ++ like that feels wrong.
2021-09-10 13:23:21 +0200 <ldlework> I'm having a hard time writing a map2
2021-09-10 13:23:42 +0200 <ldlework> why are these cases incomplete? https://gist.github.com/dustinlacewell/0bd14c3457ee70b6a840149268d0c97f
2021-09-10 13:23:58 +0200brandonh(brandonh@gateway/vpn/protonvpn/brandonh) (Ping timeout: 252 seconds)
2021-09-10 13:24:26 +0200 <tomsmeding> ldlework: you need some () instead of some [], probably in your third and fourth cases
2021-09-10 13:24:38 +0200 <jneira[m]> tomsmeding: i think it is not the default yet, at least in 9.9
2021-09-10 13:24:40 +0200 <jneira[m]> 9.0
2021-09-10 13:24:43 +0200 <ldlework> oh
2021-09-10 13:24:45 +0200 <ldlework> that worked
2021-09-10 13:25:10 +0200 <tomsmeding> jneira[m]: ah
2021-09-10 13:25:39 +0200 <tomsmeding> fusionr86: 2a will cost you points for excessive pointfree notation lol
2021-09-10 13:26:02 +0200 <tomsmeding> @pl \a b c d f -> f d b a c
2021-09-10 13:26:02 +0200 <lambdabot> ((flip . (flip .)) .) . flip (flip . (flip .) . flip (flip . flip id))
2021-09-10 13:26:49 +0200 <tomsmeding> fusionr86: the big question when writing "nice" haskell code is: how easy is it to figure out what it does by reading it
2021-09-10 13:27:12 +0200 <tomsmeding> not any kind of metric-following where you want more or less pointfreeness
2021-09-10 13:27:12 +0200euandreh(~euandreh@2804:14c:33:9fe5:293c:729f:ef0:fde4)
2021-09-10 13:27:15 +0200 <jneira[m]> <raehik> "but for a project that uses..." <- i would say that putting paths in the cabal.project for a dependency should work like putting them in the cabal global config file or the cli option for building it directly
2021-09-10 13:27:33 +0200 <jneira[m]> so it is a cabal bug
2021-09-10 13:27:47 +0200 <tomsmeding> fusionr86: for 2a I had to mentally convert it to 2b to even get what it's doing
2021-09-10 13:28:02 +0200lavaman(~lavaman@98.38.249.169) (Ping timeout: 260 seconds)
2021-09-10 13:28:17 +0200 <raehik> jneira[m]: It looks like it's an open issue #2997 on the Cabal github
2021-09-10 13:28:21 +0200 <jneira[m]> but i think putting windows paths in the config or cli option works as well no?
2021-09-10 13:28:48 +0200 <sclv> its not a bug per se
2021-09-10 13:28:49 +0200 <jneira[m]> hmm it talks about windows vs posix paths too?
2021-09-10 13:29:16 +0200 <jneira[m]> a feature then 😆
2021-09-10 13:29:17 +0200 <fusionr86> tomsmeding: alright I'll go with 2b, but tbh all haskell code I see looks like 2a to me (complexity wise)
2021-09-10 13:29:21 +0200 <sclv> its a question of semantics -- if you have an option set _in general_ then you need to decide what packages it applies to
2021-09-10 13:29:24 +0200 <raehik> no not that (I can imagine that's awkwardness with MSYS)
2021-09-10 13:29:42 +0200 <sclv> if it gets applied to every package then you're rebuilding the full dep tree with that option, etc
2021-09-10 13:29:48 +0200 <ldlework> this still doesn't work
2021-09-10 13:29:50 +0200 <ldlework> https://gist.github.com/dustinlacewell/0bd14c3457ee70b6a840149268d0c97f
2021-09-10 13:29:52 +0200 <sclv> the problem is nobody worked out the "right" way
2021-09-10 13:29:52 +0200 <ldlework> leaves the string unchanged
2021-09-10 13:29:57 +0200 <jneira[m]> i talk about handle paths the same way
2021-09-10 13:29:59 +0200 <ldlework> it should iterate over it 2 chars at a time
2021-09-10 13:30:11 +0200 <ldlework> replace any char who's followed by a vowel with '!'
2021-09-10 13:30:13 +0200 <ldlework> what gives?
2021-09-10 13:30:23 +0200 <ldlework> oh
2021-09-10 13:30:25 +0200 <ldlework> see my problem
2021-09-10 13:30:26 +0200 <sclv> so the solution punted and said "we'll just take specified options"
2021-09-10 13:30:46 +0200 <sclv> and didn't try to figure out the "right meaning" for setting the extra lib stuff "in general"
2021-09-10 13:30:49 +0200 <ldlework> no didn't fix it
2021-09-10 13:31:03 +0200 <nshepperd> Gurkenglas: pretty much any object and lens on it
2021-09-10 13:31:04 +0200 <ldlework> updated with fix though
2021-09-10 13:31:06 +0200 <jneira[m]> sclv: agree on that, it is tricky
2021-09-10 13:31:11 +0200ChaiTRex(~ChaiTRex@user/chaitrex) (Quit: ChaiTRex)
2021-09-10 13:31:19 +0200 <jneira[m]> but paths should be handle the same way :-)
2021-09-10 13:32:16 +0200ChaiTRex(~ChaiTRex@user/chaitrex)
2021-09-10 13:32:25 +0200 <nshepperd> Gurkenglas: s = (1, 0), s' = (2, 0), l = _2, for one
2021-09-10 13:33:05 +0200lambdap(~lambdap@static.167.190.119.168.clients.your-server.de) (Quit: lambdap)
2021-09-10 13:33:11 +0200 <tomsmeding> fusionr86: example of code in the wild that looks like that to you?
2021-09-10 13:33:26 +0200acidjnk_new3(~acidjnk@p5487d0ba.dip0.t-ipconnect.de) (Ping timeout: 252 seconds)
2021-09-10 13:33:41 +0200 <tomsmeding> (not saying it doesn't exist, just want to see what it looks like)
2021-09-10 13:33:44 +0200lambdap(~lambdap@static.167.190.119.168.clients.your-server.de)
2021-09-10 13:35:34 +0200ManofLetters[m](~manoflett@2001:470:69fc:105::3be)
2021-09-10 13:37:08 +0200aman(~aman@user/aman) (Quit: aman)
2021-09-10 13:39:43 +0200 <fusionr86> tomsmeding: nothing in particular, was just referring to the fact that haskell is a huge mindset switch compared to 'other' languages (well it is for me at least)
2021-09-10 13:39:50 +0200FinnElija(~finn_elij@user/finn-elija/x-0085643) (Quit: FinnElija)
2021-09-10 13:40:25 +0200 <tomsmeding> fusionr86: that makes sense; it is for most people :)
2021-09-10 13:40:28 +0200raehik(~raehik@cpc95906-rdng25-2-0-cust156.15-3.cable.virginm.net) (Ping timeout: 252 seconds)
2021-09-10 13:40:50 +0200 <tomsmeding> you'll get more familiar with the mindset as you go along
2021-09-10 13:41:29 +0200 <ldlework> tomsmeding: where am i going wrong
2021-09-10 13:45:31 +0200merijn(~merijn@83-160-49-249.ip.xs4all.nl) (Ping timeout: 265 seconds)
2021-09-10 13:45:36 +0200eggplantade(~Eggplanta@2600:1700:bef1:5e10:c1f1:b01b:5ae7:397c)
2021-09-10 13:48:30 +0200FinnElija(~finn_elij@user/finn-elija/x-0085643)
2021-09-10 13:48:36 +0200 <Gurkenglas> nshepperd, how silly of me, I thought quotient sets are the inverse of set product :)
2021-09-10 13:49:40 +0200ic2000_(~ic2000_@cpc108265-brom11-2-0-cust119.16-1.cable.virginm.net)
2021-09-10 13:49:52 +0200 <ldlework> stumped
2021-09-10 13:50:02 +0200eggplantade(~Eggplanta@2600:1700:bef1:5e10:c1f1:b01b:5ae7:397c) (Ping timeout: 245 seconds)
2021-09-10 13:50:48 +0200raehik(~raehik@cpc95906-rdng25-2-0-cust156.15-3.cable.virginm.net)
2021-09-10 13:52:39 +0200 <tomsmeding> ldlework: I don't see a word starting with a vowel?
2021-09-10 13:53:11 +0200 <tomsmeding> (also note that the pattern '(a:[b])' is equivalent to the pattern '[a,b]')
2021-09-10 13:53:52 +0200 <ldlework> lmao, changing it to "the ape" doesn't have any change in behavior
2021-09-10 13:53:54 +0200 <tomsmeding> ldlework: also you're not using 'words' anywhere
2021-09-10 13:54:25 +0200 <ldlework> tomsmeding: this is just iterating the characters
2021-09-10 13:54:42 +0200 <ldlework> switching the first of any pair of characters to '!' if it's followed by a vowel
2021-09-10 13:54:52 +0200 <ldlework> i made it simplier to try to figure out what's going on
2021-09-10 13:55:00 +0200max22-(~maxime@2a01cb088335980093c01212af90dc30.ipv6.abo.wanadoo.fr) (Ping timeout: 260 seconds)
2021-09-10 13:55:03 +0200 <ldlework> this gist, just to be sure https://gist.github.com/dustinlacewell/0bd14c3457ee70b6a840149268d0c97f
2021-09-10 13:55:19 +0200 <ldlework> grass should => g!ass
2021-09-10 13:55:27 +0200 <tomsmeding> ah
2021-09-10 13:55:40 +0200 <tomsmeding> `[a', b] ++ cs where a' = f a b` doesn't recurse
2021-09-10 13:55:51 +0200 <ldlework> but there's only two elements
2021-09-10 13:56:10 +0200 <ldlework> oh
2021-09-10 13:56:14 +0200brandonh(brandonh@gateway/vpn/protonvpn/brandonh)
2021-09-10 13:56:42 +0200 <ldlework> I see
2021-09-10 13:56:44 +0200 <tomsmeding> also, when you're done, the third case of map2 (a:[b]) is probably going to be redundant because it does the same as case 4 and case 2 together
2021-09-10 13:57:41 +0200jeicher(~jeicher@102.132.229.54)
2021-09-10 13:58:11 +0200raehik(~raehik@cpc95906-rdng25-2-0-cust156.15-3.cable.virginm.net) (Ping timeout: 252 seconds)
2021-09-10 13:59:07 +0200 <ldlework> I get an infinite type now
2021-09-10 13:59:13 +0200 <tomsmeding> yay
2021-09-10 13:59:19 +0200fusionr86(~fusion@2a02-a44c-e6e5-1-cd1b-44f3-eefe-5182.fixed6.kpn.net) (Quit: Leaving)
2021-09-10 13:59:32 +0200lambdap(~lambdap@static.167.190.119.168.clients.your-server.de) (Ping timeout: 265 seconds)
2021-09-10 13:59:50 +0200 <ldlework> https://gist.github.com/dustinlacewell/0bd14c3457ee70b6a840149268d0c97f
2021-09-10 14:00:07 +0200raehik(~raehik@cpc95906-rdng25-2-0-cust156.15-3.cable.virginm.net)
2021-09-10 14:00:31 +0200 <tomsmeding> ldlework: as the error says, f :: a -> a -> a and xs :: [a]
2021-09-10 14:01:00 +0200 <tomsmeding> presumably s/map/map2/
2021-09-10 14:01:08 +0200 <ldlework> oh
2021-09-10 14:01:12 +0200 <ldlework> man I should go to sleep
2021-09-10 14:01:15 +0200 <ldlework> 7am up all night
2021-09-10 14:01:17 +0200 <ldlework> heh
2021-09-10 14:01:34 +0200 <tomsmeding> it's 7am in the morning for you? please go to sleep now
2021-09-10 14:01:52 +0200 <ldlework> it still somehow doesn't work XD
2021-09-10 14:02:01 +0200 <ldlework> ok ok, night :) (thanks for the help btw)
2021-09-10 14:02:21 +0200 <tomsmeding> after sleep you'll have a better time fixing the code :)
2021-09-10 14:02:24 +0200 <ldlework> oh
2021-09-10 14:02:25 +0200 <ldlework> now it does
2021-09-10 14:02:27 +0200 <ldlework> nice
2021-09-10 14:02:34 +0200jeicherjcat
2021-09-10 14:02:37 +0200parisienne(sid383587@id-383587.helmsley.irccloud.com) (Quit: Connection closed for inactivity)
2021-09-10 14:02:50 +0200 <ldlework> "t!e!a!e!a!e t!e g!ass??"
2021-09-10 14:03:20 +0200 <ChaiTRex> What's a good name for a function that takes a list, xs, and produces the list of all possible lists of the same length as xs consisting of any elements from xs, but the elements have to be sorted in the same order they appear in xs? whatever [a,b,c] == [[a,a,a],[a,a,b],[a,a,c],[a,b,b],[a,b,c],[a,c,c],[b,b,b],[b,b,c],[b,c,c],[c,c,c]]
2021-09-10 14:03:31 +0200[itchyjunk](~itchyjunk@user/itchyjunk/x-7353470)
2021-09-10 14:03:55 +0200 <ldlework> orderedPermutations ?
2021-09-10 14:03:56 +0200WorldSEnder(~martin@88.215.87.144)
2021-09-10 14:04:16 +0200 <ldlework> cccomboMaker
2021-09-10 14:04:39 +0200 <ChaiTRex> Well, they're not exactly permutations.
2021-09-10 14:05:27 +0200WorldSEnder(~martin@88.215.87.144) (Client Quit)
2021-09-10 14:05:33 +0200 <ChaiTRex> What is it called when you do whatever [a,b] and get [[a,a],[a,b],[b,a],[b,b]]?
2021-09-10 14:05:49 +0200 <tomsmeding> if the length of the sublists was a parameter instead of hard-coded to be "the length of the input list", then it would be sublists
2021-09-10 14:05:52 +0200 <Akronymus> Point free syntax, yay or nay?
2021-09-10 14:06:03 +0200 <tomsmeding> well, sublistsWithReplacement, which is weird
2021-09-10 14:06:10 +0200 <tomsmeding> ChaiTRex: combinations
2021-09-10 14:06:21 +0200 <tomsmeding> Akronymus: if it makes the code more readable ;)
2021-09-10 14:06:38 +0200 <ChaiTRex> combinationsWithReplacement maybe.
2021-09-10 14:06:49 +0200burnsidesLlama(~burnsides@dhcp168-023.wadham.ox.ac.uk)
2021-09-10 14:06:54 +0200 <Akronymus> Tbh, I don't think I have seen a case where point free made it actually more readable.
2021-09-10 14:06:59 +0200 <tomsmeding> combinations to me implies that [b,a] is in the result
2021-09-10 14:07:03 +0200 <Akronymus> Rather than less or the same.
2021-09-10 14:07:19 +0200 <hpc> Akronymus: poınt free syntax :D
2021-09-10 14:07:22 +0200 <ChaiTRex> So, orderedCombinationsWithReplacement
2021-09-10 14:07:35 +0200 <tomsmeding> Akronymus: dumb case is simple operator sections: map (*2) is better than map (\x -> x * 2)
2021-09-10 14:07:52 +0200 <Gurkenglas> ChaiTRex, are they in the same order because they're not supposed to have an order?
2021-09-10 14:07:56 +0200 <Akronymus> Oh like that.
2021-09-10 14:08:04 +0200 <tomsmeding> 'ordNub = uniq . sort' also
2021-09-10 14:08:06 +0200 <Akronymus> Didn't even occur to me that it was points free.
2021-09-10 14:08:55 +0200 <Akronymus> If you have a list of lists, for example, and I want to sum all things, I'd probably do something like this: fold (fold +)
2021-09-10 14:09:29 +0200 <tomsmeding> :t fold (fold (+))
2021-09-10 14:09:30 +0200 <lambdabot> (Foldable ((->) m), Monoid m, Num m) => m
2021-09-10 14:09:34 +0200 <tomsmeding> not sure you meant that
2021-09-10 14:09:37 +0200 <ChaiTRex> Gurkenglas: The order is irrelevant, so I want to avoid what are essentially duplicates with the same elements in different orders.
2021-09-10 14:09:41 +0200 <tomsmeding> Akronymus: sum . map sum
2021-09-10 14:09:46 +0200 <Akronymus> Oh that works too.
2021-09-10 14:10:03 +0200 <tomsmeding> ChaiTRex: submultisets
2021-09-10 14:11:29 +0200 <Gurkenglas> ChaiTRex, why are they the same size? I'd expect them to only be the same size if it is meaningful to zip them together.
2021-09-10 14:12:06 +0200arjun(~Srain@user/arjun) (Ping timeout: 265 seconds)
2021-09-10 14:12:36 +0200 <ChaiTRex> I'm making a program to relabel dice to get a certain distribution of sum-what-you-rolled outcomes.
2021-09-10 14:13:29 +0200 <ChaiTRex> So, when you label a fair die, the order you label the sides doesn't matter.
2021-09-10 14:13:49 +0200 <Gurkenglas> Why do you fix the labels to [1..6]?
2021-09-10 14:13:50 +0200 <ChaiTRex> So, I want to choose labels for the sides from, say [0 .. 9] or something.
2021-09-10 14:14:13 +0200 <Gurkenglas> Aka why dont you let them label a sixsided die 1,2,4,8,16,32?
2021-09-10 14:14:49 +0200 <ChaiTRex> Well, I could do [1 .. 32] for the possible labels and that would eventually produce that labelling.
2021-09-10 14:15:10 +0200 <Gurkenglas> no, that only labels 32-sided dice.
2021-09-10 14:15:20 +0200 <ChaiTRex> No, those are the possible labels.
2021-09-10 14:15:33 +0200 <ChaiTRex> 1,2,4,8,16,32 are all in [1 .. 32].
2021-09-10 14:15:46 +0200 <Gurkenglas> "all possible lists of the same length as xs" you said
2021-09-10 14:16:34 +0200 <ChaiTRex> Yeah, but someone suggested that the length of the sublists could be a parameter.
2021-09-10 14:16:57 +0200 <Gurkenglas> Oh, sorry.
2021-09-10 14:17:43 +0200 <ChaiTRex> tomsmeding: I think submultisetsOfLength might work.
2021-09-10 14:18:03 +0200 <ChaiTRex> Or multisetsOfLength
2021-09-10 14:18:09 +0200 <Gurkenglas> replicateM, for the Bag monad.
2021-09-10 14:19:02 +0200 <Gurkenglas> (aka lists without order)
2021-09-10 14:20:50 +0200 <Gurkenglas> (just another word for multisets)
2021-09-10 14:23:14 +0200 <Gurkenglas> > replicateM 3 [x,y]
2021-09-10 14:23:16 +0200 <lambdabot> [[x,x,x],[x,x,y],[x,y,x],[x,y,y],[y,x,x],[y,x,y],[y,y,x],[y,y,y]]
2021-09-10 14:24:07 +0200 <ChaiTRex> Yeah, one implementation is this:
2021-09-10 14:24:22 +0200 <ChaiTRex> > nub . map sort . replicateM 3 $ [x, y]
2021-09-10 14:24:23 +0200 <lambdabot> [[x,x,x],[x,x,y],[x,y,y],[y,y,y]]
2021-09-10 14:25:10 +0200amitnjha(~amit@024-216-124-116.res.spectrum.com) (Quit: amitnjha)
2021-09-10 14:25:11 +0200Vajb(~Vajb@hag-jnsbng11-58c3a8-176.dhcp.inet.fi) (Read error: Connection reset by peer)
2021-09-10 14:25:24 +0200amitnjha(~amit@024-216-124-116.res.spectrum.com)
2021-09-10 14:25:28 +0200 <Gurkenglas> Yeah but I'm going for nubbing at each step to help with the combinatorial runtime
2021-09-10 14:25:58 +0200raehik(~raehik@cpc95906-rdng25-2-0-cust156.15-3.cable.virginm.net) (Quit: WeeChat 3.2)
2021-09-10 14:26:38 +0200 <Gurkenglas> (oh, it's replicateM for the MultiSet monad *with [] replaced by MultiSet as well*)
2021-09-10 14:27:12 +0200 <ChaiTRex> @let multisetsOfSize :: Word8 -> [a] -> [[a]]; multisetsOfSize 0 = const [[]]; multisetsOfSize n = concatMap (\ yys@(y : _) -> map (y :) (multisetsOfSize (n - 1) yys)) . init . tails
2021-09-10 14:27:14 +0200 <lambdabot> Defined.
2021-09-10 14:27:30 +0200 <ChaiTRex> That's an implementation that doesn't produce duplicates or require Ord.
2021-09-10 14:27:41 +0200 <ChaiTRex> > moltisetsOfSize 3 [x, y]
2021-09-10 14:27:43 +0200 <lambdabot> error:
2021-09-10 14:27:43 +0200 <lambdabot> • Variable not in scope: moltisetsOfSize :: t0 -> [Expr] -> t
2021-09-10 14:27:43 +0200 <lambdabot> • Perhaps you meant ‘multisetsOfSize’ (line 154)
2021-09-10 14:27:46 +0200 <ChaiTRex> > multisetsOfSize 3 [x, y]
2021-09-10 14:27:48 +0200 <lambdabot> [[x,x,x],[x,x,y],[x,y,y],[y,y,y]]
2021-09-10 14:29:23 +0200Vajb(~Vajb@n1xq4ni1adi29tefj-2.v6.elisa-mobile.fi)
2021-09-10 14:29:24 +0200acidjnk_new3(~acidjnk@p200300d0c7203080b51432c313ea99eb.dip0.t-ipconnect.de)
2021-09-10 14:29:49 +0200 <Gurkenglas> Data.Monoid.Combinators says to use reducers instead, but where's the replicate?
2021-09-10 14:32:34 +0200shapr(~user@pool-100-36-247-68.washdc.fios.verizon.net)
2021-09-10 14:34:27 +0200 <Gurkenglas> oh well, not like it needs an import.
2021-09-10 14:37:03 +0200raehik(~raehik@cpc95906-rdng25-2-0-cust156.15-3.cable.virginm.net)
2021-09-10 14:37:03 +0200Vajb(~Vajb@n1xq4ni1adi29tefj-2.v6.elisa-mobile.fi) (Read error: Connection reset by peer)
2021-09-10 14:38:08 +0200Vajb(~Vajb@hag-jnsbng11-58c3a8-176.dhcp.inet.fi)
2021-09-10 14:46:28 +0200eggplantade(~Eggplanta@2600:1700:bef1:5e10:c09c:3e60:e691:1fba)
2021-09-10 14:48:39 +0200 <Gurkenglas> Is there a proposal to have Typeclasses propagate constraints automatiaclly, so that Set could have a monad instance?
2021-09-10 14:48:49 +0200ic2000_(~ic2000_@cpc108265-brom11-2-0-cust119.16-1.cable.virginm.net) (Ping timeout: 252 seconds)
2021-09-10 14:50:10 +0200pera(~pera@user/pera)
2021-09-10 14:51:06 +0200eggplantade(~Eggplanta@2600:1700:bef1:5e10:c09c:3e60:e691:1fba) (Ping timeout: 260 seconds)
2021-09-10 14:51:49 +0200zmt01(~zmt00@user/zmt00)
2021-09-10 14:54:10 +0200burnsidesLlama(~burnsides@dhcp168-023.wadham.ox.ac.uk) (Remote host closed the connection)
2021-09-10 14:54:22 +0200zmt00(~zmt00@user/zmt00) (Ping timeout: 260 seconds)
2021-09-10 15:05:58 +0200shriekingnoise(~shrieking@186.137.144.80)
2021-09-10 15:08:50 +0200MQ-17J(~MQ-17J@d14-69-206-129.try.wideopenwest.com) (Ping timeout: 260 seconds)
2021-09-10 15:09:07 +0200MQ-17J(~MQ-17J@d14-69-206-129.try.wideopenwest.com)
2021-09-10 15:16:17 +0200geekosaur(~geekosaur@xmonad/geekosaur)
2021-09-10 15:19:02 +0200mei(~mei@user/mei)
2021-09-10 15:19:25 +0200slowButPresent(~slowButPr@user/slowbutpresent)
2021-09-10 15:20:15 +0200mei(~mei@user/mei) (Read error: Connection reset by peer)
2021-09-10 15:20:49 +0200dudek(~dudek@185.150.236.103) (Read error: Connection reset by peer)
2021-09-10 15:21:06 +0200dudek(~dudek@185.150.236.103)
2021-09-10 15:22:07 +0200mei(~mei@user/mei)
2021-09-10 15:24:50 +0200pottsy(~pottsy@2400:4050:b560:3700:6306:be47:d72c:aeef)
2021-09-10 15:25:50 +0200vpan(~vilius@212.117.1.172)
2021-09-10 15:27:04 +0200mei(~mei@user/mei) (Quit: mei)
2021-09-10 15:27:35 +0200mei(~mei@user/mei)
2021-09-10 15:31:30 +0200burnsidesLlama(~burnsides@dhcp168-023.wadham.ox.ac.uk)
2021-09-10 15:34:15 +0200Vajb(~Vajb@hag-jnsbng11-58c3a8-176.dhcp.inet.fi) (Read error: Connection reset by peer)
2021-09-10 15:34:23 +0200n3t(n3t@s45.mydevil.net)
2021-09-10 15:35:03 +0200Vajb(~Vajb@n1xq4ni1adi29tefj-2.v6.elisa-mobile.fi)
2021-09-10 15:35:30 +0200amitnjha(~amit@024-216-124-116.res.spectrum.com) (Quit: amitnjha)
2021-09-10 15:35:48 +0200amitnjha(~amit@024-216-124-116.res.spectrum.com)
2021-09-10 15:35:55 +0200burnsidesLlama(~burnsides@dhcp168-023.wadham.ox.ac.uk) (Ping timeout: 260 seconds)
2021-09-10 15:36:32 +0200Guest|1(~Guest|1@p1627016-ipngn200910fukuokachu.fukuoka.ocn.ne.jp)
2021-09-10 15:37:11 +0200Guest|1(~Guest|1@p1627016-ipngn200910fukuokachu.fukuoka.ocn.ne.jp) (Client Quit)
2021-09-10 15:37:16 +0200max22-(~maxime@2a01cb088335980003a066e559758211.ipv6.abo.wanadoo.fr)
2021-09-10 15:38:34 +0200rond_(~rond_@2a02:a31a:a23c:f480:2fd7:e087:5546:a438)
2021-09-10 15:41:29 +0200merijn(~merijn@83-160-49-249.ip.xs4all.nl)
2021-09-10 15:43:24 +0200tureba_(~tureba@tureba.org)
2021-09-10 15:43:45 +0200tureba_(~tureba@tureba.org) (Client Quit)
2021-09-10 15:43:50 +0200sleblanc(~sleblanc@user/sleblanc) (Ping timeout: 260 seconds)
2021-09-10 15:45:07 +0200hendursa1(~weechat@user/hendursaga) (Quit: hendursa1)
2021-09-10 15:45:19 +0200thyriaen(~thyriaen@dynamic-077-013-126-036.77.13.pool.telefonica.de) (Ping timeout: 252 seconds)
2021-09-10 15:45:37 +0200hendursaga(~weechat@user/hendursaga)
2021-09-10 15:45:53 +0200amitnjha(~amit@024-216-124-116.res.spectrum.com) (Quit: amitnjha)
2021-09-10 15:46:06 +0200amitnjha(~amit@024-216-124-116.res.spectrum.com)
2021-09-10 15:46:49 +0200tureba(~tureba@tureba.org)
2021-09-10 15:49:54 +0200favonia(~favonia@user/favonia) (Ping timeout: 260 seconds)
2021-09-10 15:53:19 +0200jcat(~jeicher@102.132.229.54) (Quit: WeeChat 3.2)
2021-09-10 15:55:55 +0200pbrisbin(~patrick@pool-108-16-214-93.phlapa.fios.verizon.net)
2021-09-10 15:58:01 +0200wolfshappen(~waff@irc.furworks.de) (Ping timeout: 252 seconds)
2021-09-10 15:58:45 +0200wolfshappen(~waff@irc.furworks.de)
2021-09-10 15:59:27 +0200TranquilEcho(~grom@user/tranquilecho)
2021-09-10 16:01:54 +0200zebrag(~chris@user/zebrag)
2021-09-10 16:05:44 +0200burnsidesLlama(~burnsides@client-8-80.eduroam.oxuni.org.uk)
2021-09-10 16:05:54 +0200teo(~teo@137.220.120.222) ()
2021-09-10 16:10:32 +0200favonia(~favonia@user/favonia)
2021-09-10 16:12:46 +0200jinsun(~quassel@user/jinsun) (Ping timeout: 260 seconds)
2021-09-10 16:13:48 +0200aman(~aman@user/aman)
2021-09-10 16:15:50 +0200merijn(~merijn@83-160-49-249.ip.xs4all.nl) (Ping timeout: 265 seconds)
2021-09-10 16:20:48 +0200img(~img@user/img) (Quit: ZNC 1.8.2 - https://znc.in)
2021-09-10 16:20:58 +0200amahl(~amahl@dsl-jklbng12-54fbca-64.dhcp.inet.fi) (Remote host closed the connection)
2021-09-10 16:21:04 +0200img(~img@user/img)
2021-09-10 16:21:13 +0200amitnjha(~amit@024-216-124-116.res.spectrum.com) (Quit: amitnjha)
2021-09-10 16:21:26 +0200amitnjha(~amit@024-216-124-116.res.spectrum.com)
2021-09-10 16:22:07 +0200Akronymus(~Akronymus@85.31.8.180) (Quit: Client closed)
2021-09-10 16:24:33 +0200Sgeo(~Sgeo@user/sgeo)
2021-09-10 16:24:40 +0200waleee(~waleee@2001:9b0:216:8200:d457:9189:7843:1dbd)
2021-09-10 16:26:14 +0200pottsy(~pottsy@2400:4050:b560:3700:6306:be47:d72c:aeef) (Quit: Leaving)
2021-09-10 16:32:45 +0200azeem(~azeem@emp-182-240.eduroam.uu.se) (Ping timeout: 265 seconds)
2021-09-10 16:34:42 +0200favonia(~favonia@user/favonia) (Ping timeout: 260 seconds)
2021-09-10 16:36:11 +0200mangoiv(~MangoIV@193.175.5.172)
2021-09-10 16:41:10 +0200cafkafk(~cafkafk@user/cafkafk) (Quit: WeeChat 3.1)
2021-09-10 16:41:32 +0200slep(~slep@cpc150002-brnt4-2-0-cust437.4-2.cable.virginm.net) (Ping timeout: 252 seconds)
2021-09-10 16:41:33 +0200amitnjha(~amit@024-216-124-116.res.spectrum.com) (Quit: amitnjha)
2021-09-10 16:41:47 +0200amitnjha(~amit@024-216-124-116.res.spectrum.com)
2021-09-10 16:41:47 +0200gentauro(~gentauro@user/gentauro) (Read error: Connection reset by peer)
2021-09-10 16:45:23 +0200pera(~pera@user/pera) (Ping timeout: 252 seconds)
2021-09-10 16:45:30 +0200pera(~pera@137.221.132.212)
2021-09-10 16:45:54 +0200peraGuest265
2021-09-10 16:47:00 +0200azeem(~azeem@2a00:801:3c7:c672:c46:3e15:33ac:e08b)
2021-09-10 16:47:43 +0200gentauro(~gentauro@user/gentauro)
2021-09-10 16:48:13 +0200eggplantade(~Eggplanta@2600:1700:bef1:5e10:c09c:3e60:e691:1fba)
2021-09-10 16:48:14 +0200brandonh(brandonh@gateway/vpn/protonvpn/brandonh) (Ping timeout: 260 seconds)
2021-09-10 16:50:38 +0200dsrt^(~dsrt@68.101.54.227) (Remote host closed the connection)
2021-09-10 16:50:49 +0200brandonh(~brandonh@151.36.214.216)
2021-09-10 16:52:42 +0200[itchyjunk](~itchyjunk@user/itchyjunk/x-7353470) (Remote host closed the connection)
2021-09-10 16:52:54 +0200eggplantade(~Eggplanta@2600:1700:bef1:5e10:c09c:3e60:e691:1fba) (Ping timeout: 260 seconds)
2021-09-10 16:53:23 +0200Guest265(~pera@137.221.132.212) (Quit: leaving)
2021-09-10 16:57:50 +0200mei(~mei@user/mei) (Read error: Connection reset by peer)
2021-09-10 16:59:05 +0200 <c_wraith> Gurkenglas: I'm not a big fan of breaking parametricity
2021-09-10 16:59:42 +0200shapr(~user@pool-100-36-247-68.washdc.fios.verizon.net) (Remote host closed the connection)
2021-09-10 16:59:49 +0200wroathe(~wroathe@c-68-54-25-135.hsd1.mn.comcast.net)
2021-09-10 16:59:49 +0200wroathe(~wroathe@c-68-54-25-135.hsd1.mn.comcast.net) (Changing host)
2021-09-10 16:59:49 +0200wroathe(~wroathe@user/wroathe)
2021-09-10 17:00:28 +0200hexfive(~eric@50.35.83.177)
2021-09-10 17:01:30 +0200shapr(~user@pool-100-36-247-68.washdc.fios.verizon.net)
2021-09-10 17:01:40 +0200burnsidesLlama(~burnsides@client-8-80.eduroam.oxuni.org.uk) (Remote host closed the connection)
2021-09-10 17:02:44 +0200hexfive(~eric@50.35.83.177) (Client Quit)
2021-09-10 17:03:05 +0200 <c_wraith> I really like looking at (>>=) :: Monad m => m a -> (a -> m b) -> m b and knowing that it can't do arbitrary things based on the types `a' and `b', or what values of each may or may not exist.
2021-09-10 17:03:29 +0200acidjnk_new(~acidjnk@p200300d0c7203049d04185c247f1acfb.dip0.t-ipconnect.de)
2021-09-10 17:06:17 +0200acidjnk_new3(~acidjnk@p200300d0c7203080b51432c313ea99eb.dip0.t-ipconnect.de) (Ping timeout: 245 seconds)
2021-09-10 17:06:54 +0200 <Gurkenglas> c_wraith, can you give an example of an arbitrary thing you could do if (>>=) specialized to (Ord a, Ord b) => Set a -> (a -> Set b) -> Set b?
2021-09-10 17:07:22 +0200MQ-17J(~MQ-17J@d14-69-206-129.try.wideopenwest.com) (Ping timeout: 260 seconds)
2021-09-10 17:07:39 +0200MQ-17J(~MQ-17J@d14-69-206-129.try.wideopenwest.com)
2021-09-10 17:07:52 +0200 <c_wraith> No, but I could give you plenty of examples of bad things if (>>=) specialized to (Typeable a, Typeable b) => Foo a -> (a -> Foo b) -> (Foo b)
2021-09-10 17:09:26 +0200 <Gurkenglas> Ooh! Such as?
2021-09-10 17:10:10 +0200jespada(~jespada@90.254.245.194) (Ping timeout: 252 seconds)
2021-09-10 17:11:43 +0200jespada(~jespada@90.254.245.194)
2021-09-10 17:12:07 +0200goepsilongo(~chacho@2603-7000-ab00-62ed-0000-0000-0000-0bd0.res6.spectrum.com)
2021-09-10 17:13:28 +0200ic2000_(~ic2000_@cpc108265-brom11-2-0-cust119.16-1.cable.virginm.net)
2021-09-10 17:14:22 +0200 <c_wraith> newtype Foo a = Foo (Maybe a) ; Foo (Just x) >>= Foo (Just f) = case (eqT :: Maybe (b :~: Double)) of Just Refl -> Foo Nothing ; Nothing -> f x
2021-09-10 17:14:29 +0200brandonh(~brandonh@151.36.214.216) (Read error: Connection reset by peer)
2021-09-10 17:14:31 +0200brandonh_(brandonh@gateway/vpn/protonvpn/brandonh)
2021-09-10 17:14:32 +0200favonia(~favonia@user/favonia)
2021-09-10 17:14:36 +0200 <c_wraith> left a bunch out, but that should be enough to get the point across
2021-09-10 17:15:28 +0200merijn(~merijn@83-160-49-249.ip.xs4all.nl)
2021-09-10 17:15:36 +0200 <c_wraith> err. that second arg should just be f, not a pattern match. forgot I wasn't writing (<*>)
2021-09-10 17:15:40 +0200 <Gurkenglas> I agree that you could do such a thing, but have not yet demonstrated the badness.
2021-09-10 17:15:44 +0200sneedsfeed(~sneedsfee@rrcs-173-95-122-169.midsouth.biz.rr.com)
2021-09-10 17:15:47 +0200 <Gurkenglas> *you
2021-09-10 17:15:55 +0200 <c_wraith> that is the badness
2021-09-10 17:16:04 +0200 <Gurkenglas> Is there something that relies on such things being impossible?
2021-09-10 17:16:07 +0200 <c_wraith> I can no longer reason about the behavior of (>>=)
2021-09-10 17:16:10 +0200 <Gurkenglas> Why not?
2021-09-10 17:16:17 +0200 <c_wraith> it lost parametricity
2021-09-10 17:16:19 +0200slep(~slep@cpc150002-brnt4-2-0-cust437.4-2.cable.virginm.net)
2021-09-10 17:16:32 +0200 <c_wraith> Right now, I know that's impossible
2021-09-10 17:16:56 +0200 <c_wraith> This is explicitly documented by the type
2021-09-10 17:16:57 +0200 <Gurkenglas> You can reason out what it will do depending on the type signature it ends up with
2021-09-10 17:17:16 +0200 <c_wraith> Right now you can reason out what it will do by looking at the type of (>>=)
2021-09-10 17:17:31 +0200 <c_wraith> you propose to replace that with having to know what type it will be used at before you can know what it does
2021-09-10 17:17:36 +0200 <c_wraith> that's a massive downgrade
2021-09-10 17:19:03 +0200 <Gurkenglas> The behavior of (>>=) already depends on the instance it is used with, is there something about drawing the line where it is drawn that is optimal?
2021-09-10 17:20:16 +0200 <c_wraith> the behavior only depends on m
2021-09-10 17:20:25 +0200 <c_wraith> You're proposing to make it also depend on a and b
2021-09-10 17:20:40 +0200 <c_wraith> despite the fact that only m is used to select an implementation
2021-09-10 17:20:43 +0200Phantastes(~Phantaste@c-67-173-229-120.hsd1.co.comcast.net)
2021-09-10 17:20:54 +0200 <c_wraith> Once again, it comes down to the types
2021-09-10 17:21:09 +0200 <c_wraith> The type signature shows m is constrained, but a and b are parametric
2021-09-10 17:21:17 +0200acidjnk_new(~acidjnk@p200300d0c7203049d04185c247f1acfb.dip0.t-ipconnect.de) (Ping timeout: 245 seconds)
2021-09-10 17:21:32 +0200 <c_wraith> This is *documentation*
2021-09-10 17:21:52 +0200 <c_wraith> It says that what it does will depend on m, but not a and b
2021-09-10 17:22:16 +0200PhantastesFufu
2021-09-10 17:22:35 +0200 <Gurkenglas> I think your monad instance breaks the functor laws
2021-09-10 17:22:50 +0200 <c_wraith> laws are not enforced by the compiler.
2021-09-10 17:22:51 +0200lambdap(~lambdap@static.167.190.119.168.clients.your-server.de)
2021-09-10 17:22:57 +0200 <c_wraith> parametricity is
2021-09-10 17:23:00 +0200Fufu(~Phantaste@c-67-173-229-120.hsd1.co.comcast.net) (Client Quit)
2021-09-10 17:23:04 +0200 <c_wraith> It is stronger than laws
2021-09-10 17:24:02 +0200 <Gurkenglas> Can you give a scenario where you would be negatively surprised by Foo's existence or something like it?
2021-09-10 17:24:14 +0200 <c_wraith> (yes, there are some dirty things you can do to break parametricity using ghc internals. But even they can't see newtype wrappers at runtime, for instance)
2021-09-10 17:24:19 +0200 <Gurkenglas> (or someone else, if you want using an existing library)
2021-09-10 17:24:27 +0200cfricke(~cfricke@user/cfricke) (Quit: WeeChat 3.2)
2021-09-10 17:25:11 +0200lavaman(~lavaman@98.38.249.169)
2021-09-10 17:25:49 +0200 <c_wraith> Every single place I see an unconstrained type variable, I use that knowledge
2021-09-10 17:26:31 +0200 <c_wraith> It's the sort of documentation almost every other language lacks badly, and suffers for
2021-09-10 17:26:35 +0200shapr(~user@pool-100-36-247-68.washdc.fios.verizon.net) (Remote host closed the connection)
2021-09-10 17:26:59 +0200 <c_wraith> (Unlike other documentation, it's actually correct)
2021-09-10 17:27:22 +0200 <c_wraith> You're proposing to remove the correctness
2021-09-10 17:27:44 +0200 <c_wraith> that seems like giving up far more than you're gaining.
2021-09-10 17:29:46 +0200lavaman(~lavaman@98.38.249.169) (Ping timeout: 260 seconds)
2021-09-10 17:33:12 +0200shapr(~user@pool-100-36-247-68.washdc.fios.verizon.net)
2021-09-10 17:35:35 +0200brandonh_(brandonh@gateway/vpn/protonvpn/brandonh) (Ping timeout: 265 seconds)
2021-09-10 17:38:50 +0200brandonh(~brandonh@151.82.39.118)
2021-09-10 17:43:13 +0200rond_(~rond_@2a02:a31a:a23c:f480:2fd7:e087:5546:a438) (Quit: Client closed)
2021-09-10 17:44:26 +0200ec_(~ec@gateway/tor-sasl/ec)
2021-09-10 17:46:35 +0200Erutuon(~Erutuon@user/erutuon)
2021-09-10 17:46:44 +0200dajoer(~david@user/gvx) (Quit: leaving)
2021-09-10 17:49:46 +0200chele(~chele@user/chele) (Remote host closed the connection)
2021-09-10 17:51:31 +0200eggplantade(~Eggplanta@2600:1700:bef1:5e10:c09c:3e60:e691:1fba)
2021-09-10 17:53:35 +0200xsperry(~as@user/xsperry) (Ping timeout: 252 seconds)
2021-09-10 18:00:52 +0200wroathe(~wroathe@user/wroathe) (Ping timeout: 245 seconds)
2021-09-10 18:01:08 +0200dudek(~dudek@185.150.236.103) (Quit: Leaving)
2021-09-10 18:05:03 +0200tzh(~tzh@c-24-21-73-154.hsd1.wa.comcast.net)
2021-09-10 18:07:05 +0200texasmynsted(~texasmyns@99.96.221.112)
2021-09-10 18:07:39 +0200vpan(~vilius@212.117.1.172) (Quit: Leaving.)
2021-09-10 18:08:19 +0200wroathe(~wroathe@c-68-54-25-135.hsd1.mn.comcast.net)
2021-09-10 18:08:20 +0200wroathe(~wroathe@c-68-54-25-135.hsd1.mn.comcast.net) (Changing host)
2021-09-10 18:08:20 +0200wroathe(~wroathe@user/wroathe)
2021-09-10 18:08:30 +0200 <texasmynsted> What is a great way to handle configuration? I like dhall but it feels like a better yaml. What if yaml is not the ideal way to describe configuration? Is there some language or package this is just config?
2021-09-10 18:09:54 +0200 <kritzefitz> texasmynsted, I'm not sure I understand your question correctly, but maybe TOML might be in the right direction? https://toml.io/en/
2021-09-10 18:10:23 +0200xff0x(~xff0x@port-92-193-132-242.dynamic.as20676.net) (Ping timeout: 265 seconds)
2021-09-10 18:11:36 +0200 <texasmynsted> Toml is good, but it is still a file. Why not a language w/o a human readable file?
2021-09-10 18:11:36 +0200MQ-17J(~MQ-17J@d14-69-206-129.try.wideopenwest.com) (Read error: Connection reset by peer)
2021-09-10 18:11:55 +0200 <texasmynsted> Maybe what I am looking for is a bad idea or does not really make sense.
2021-09-10 18:12:12 +0200xff0x(~xff0x@2001:1a81:531e:3c00:7633:19f7:d2d8:9bde)
2021-09-10 18:12:36 +0200MQ-17J(~MQ-17J@d14-69-206-129.try.wideopenwest.com)
2021-09-10 18:12:47 +0200 <geekosaur> in general tose turn out badly because you can't use standard tools to query or manipulate them
2021-09-10 18:13:16 +0200 <texasmynsted> Do you have an example of one?
2021-09-10 18:13:27 +0200 <maerwald> XML... it's not readable after 10 lines of code
2021-09-10 18:13:57 +0200 <geekosaur> with JSON you have to use jq to do anything useful
2021-09-10 18:14:00 +0200ec_(~ec@gateway/tor-sasl/ec) (Ping timeout: 276 seconds)
2021-09-10 18:14:28 +0200 <texasmynsted> JSON is just a human readable description of Javascript data
2021-09-10 18:14:34 +0200 <dminuoso> texasmynsted: for haskell configuration?
2021-09-10 18:14:39 +0200 <geekosaur> sometimes you want to look up one or two settings for use in a shell script
2021-09-10 18:14:56 +0200 <texasmynsted> dminuoso: Ideally but just anything would be a good start.
2021-09-10 18:15:03 +0200 <dminuoso> texasmynsted: I'm a big fan of config-schema
2021-09-10 18:15:15 +0200 <texasmynsted> config-schema?
2021-09-10 18:15:16 +0200 <dminuoso> Yes.
2021-09-10 18:15:18 +0200texasmynstedgoogles
2021-09-10 18:15:20 +0200 <dminuoso> https://hackage.haskell.org/package/config-schema
2021-09-10 18:15:27 +0200qbt(~edun@user/edun)
2021-09-10 18:16:01 +0200 <dminuoso> It's a cute package with built-in schema verification, good enough error messages, easy custom schemas, and documentation output you can directly glue into your program
2021-09-10 18:16:22 +0200 <sm> texasmynsted, "language" but not "human readable file" ? could you clarify ?
2021-09-10 18:17:15 +0200aman(~aman@user/aman) (Quit: aman)
2021-09-10 18:17:26 +0200 <dminuoso> All my programs have some kind of --config-help option that prints out the generated docs, meaning I dont need to separately document that format either. :)
2021-09-10 18:17:29 +0200 <texasmynsted> dminuoso: Nice. I like this.
2021-09-10 18:17:51 +0200_ht(~quassel@82-169-194-8.biz.kpn.net)
2021-09-10 18:18:12 +0200 <dsal> % traverse_ print (Just 2) -- ldlework, in your initial question, you were asking about `let Just a in print a` without the Let binding (and presumably not printing when `Nothing`). That's what `traverse_` does.
2021-09-10 18:18:13 +0200 <yahb> dsal: 2
2021-09-10 18:18:24 +0200 <texasmynsted> sm: Most things build a config file that is human readable like toml, yaml, ini files, etc. Then the program reads the human and computer readable file.
2021-09-10 18:20:01 +0200 <texasmynsted> What if the language was a haskell DSL or something, specifically for configuration and the result was not human readable but very efficient for the program to load and use
2021-09-10 18:21:06 +0200ec_(~ec@gateway/tor-sasl/ec)
2021-09-10 18:21:47 +0200 <dminuoso> I'd pick lisp then.
2021-09-10 18:22:08 +0200 <texasmynsted> It feels like there are challenges because we want a file format that works for both humans and programs, then we need tools to have more control over producing those human and computer readable files.
2021-09-10 18:22:19 +0200 <dminuoso> Bu not really, dhall would be that thing I guess
2021-09-10 18:22:48 +0200 <[exa]> texasmynsted: the best language probably depends on environment and users. For exampel if they are unixy, you might be better off just sourcing the config file with bash and taking out environment/stdout
2021-09-10 18:22:49 +0200 <dminuoso> Well, any programming or configuration language is for unidirectional communication between a human and a computer.
2021-09-10 18:22:58 +0200ic2000_(~ic2000_@cpc108265-brom11-2-0-cust119.16-1.cable.virginm.net) (Ping timeout: 260 seconds)
2021-09-10 18:23:01 +0200neo2(~neo3@cpe-292712.ip.primehome.com)
2021-09-10 18:23:06 +0200 <[exa]> otherwise +1 for lisp-ish scheme-ish configs
2021-09-10 18:23:40 +0200 <dminuoso> at least lispy syntax, simply so you dont have the overhead of some complicated syntax.
2021-09-10 18:25:21 +0200phma(~phma@host-67-44-208-57.hnremote.net) (Read error: Connection reset by peer)
2021-09-10 18:25:26 +0200 <sm> texasmynsted: well I'd call haskell human readable, compared to say a sqlite db, but I see. xmonad uses haskell for config, the problem with that is you need to do an expensive recompile to change any config
2021-09-10 18:26:00 +0200 <dminuoso> And you need to be a haskell programmer to deal with virtually any typo.
2021-09-10 18:26:06 +0200 <sm> propellor, shake also use haskell for "config", if you squint at it
2021-09-10 18:26:10 +0200ormaaj2ormaaj
2021-09-10 18:26:28 +0200 <geekosaur> not very expensive, it's not like you're dealing with e.g. lots of type families
2021-09-10 18:26:52 +0200phma(~phma@host-67-44-208-118.hnremote.net)
2021-09-10 18:26:57 +0200 <geekosaur> xmonad gets away with it because 100 lines is an unusually large config
2021-09-10 18:26:59 +0200 <dminuoso> Indeed, I have a moderately complex xmonad configuration, and rebuilding takes about 3-4 seconds?
2021-09-10 18:27:05 +0200 <texasmynsted> Dhall is nice. Like why Json or Yaml over something like messagepack
2021-09-10 18:27:10 +0200 <[exa]> geekosaur: unfortunately you're talking to a channel where every second person will start the config with UndecidableInstances pragma
2021-09-10 18:27:11 +0200 <sm> it's relatively expensive compared to tweaking an ini file, no matter how you look at it (consider all the requirements and opportunities for it to fail)
2021-09-10 18:28:11 +0200 <texasmynsted> I think that viewing/understanding the config from looking at the file could be different than "tweaking" it.
2021-09-10 18:28:59 +0200 <sm> ie, it's not that recompiling xmonad config once you're all set up takes a long time, it's that you have to install a haskell toolchain on your random platform, and keep it working, both non-trivial
2021-09-10 18:30:03 +0200 <texasmynsted> So dhall or config-schema...
2021-09-10 18:32:03 +0200 <dsal> I really liked dhall until I tried using it. heh
2021-09-10 18:32:46 +0200vicfred(~vicfred@user/vicfred)
2021-09-10 18:33:37 +0200 <sm> lua is an option - programmable, but embeddable within your program so the user doesn't have to install anything. pandoc uses this for certain things
2021-09-10 18:33:48 +0200 <dsal> The case where I'm still using it was simple enough. I don't format "correctly" because their canonical format is unusable. I can't remember what my last attempt was, but it wasn't expressive enough.
2021-09-10 18:33:49 +0200 <sm> ...but you have to write lua
2021-09-10 18:33:55 +0200 <texasmynsted> Oh yeah, I forgot about lua
2021-09-10 18:34:08 +0200 <dsal> Ha. Yeah, I've embedded lua in a few projects and then got to that "now I have to write lua" part.
2021-09-10 18:34:35 +0200 <sm> one of these days we'll have "haskellscript" !
2021-09-10 18:34:40 +0200 <texasmynsted> I would rather an embeddable haskell-like language though
2021-09-10 18:34:55 +0200 <janus> what would be the difference between haskellscript and cabal script?
2021-09-10 18:35:25 +0200 <texasmynsted> Maybe there is some part of nix that could be used this way
2021-09-10 18:35:45 +0200 <geekosaur> arguably hugs is haskellscript
2021-09-10 18:36:01 +0200 <sm> a "cabal/stack script" is haskell, requiring all the know-how and toolchain etc. "haskellscript" is an easier low-install just-works no-compilation-step language
2021-09-10 18:36:38 +0200dunj3(~dunj3@2001:16b8:3076:ac00:597e:94f1:37b7:cb6c)
2021-09-10 18:36:53 +0200amitnjha(~amit@024-216-124-116.res.spectrum.com) (Quit: amitnjha)
2021-09-10 18:37:07 +0200amitnjha(~amit@024-216-124-116.res.spectrum.com)
2021-09-10 18:37:08 +0200 <geekosaur> the remaining problem is "already installed everywhere" which, well, glwt
2021-09-10 18:37:21 +0200 <janus> aah ok, so we're talking about how all linux distros have a python interpreter with most of the stdlib installed by default
2021-09-10 18:37:23 +0200 <dminuoso> If you need `already installed everywhere`, there's realistically only sh, bash and perl.
2021-09-10 18:37:41 +0200 <geekosaur> python also fits, especially these days
2021-09-10 18:38:00 +0200 <geekosaur> and most machines have some flavor of js around
2021-09-10 18:38:07 +0200 <sm> it might look like modern tooling like deno or zig, where you download one small executable for any platform and it does everything (build, run, stdlib, packages etc)
2021-09-10 18:38:22 +0200brandonh(~brandonh@151.82.39.118) (Quit: brandonh)
2021-09-10 18:38:33 +0200__monty__(~toonn@user/toonn)
2021-09-10 18:40:06 +0200 <janus> would be intresting to see if it is possible to have a distro with all the usual linux parts written in haskell
2021-09-10 18:40:18 +0200 <janus> like, how hard is it to write an init system in haskell?
2021-09-10 18:40:25 +0200pavonia(~user@user/siracusa)
2021-09-10 18:40:51 +0200 <janus> and how hard would it be to provide systemd-like services written in haskell? i guess the ghc api is not geared for that now
2021-09-10 18:41:42 +0200 <sm> there was http://programatica.cs.pdx.edu/House/
2021-09-10 18:41:57 +0200ec_(~ec@gateway/tor-sasl/ec) (Ping timeout: 276 seconds)
2021-09-10 18:42:03 +0200 <geekosaur> sadly that requires a lot of signal hhandling, and the ghc runtime's signal handling is badly broken
2021-09-10 18:42:04 +0200 <janus> right, but wasn't that lower level? it mentions vga and ps2
2021-09-10 18:42:36 +0200 <sm> oh, well there's https://hackage.haskell.org/package/angel, is that the sort of thing ?
2021-09-10 18:43:16 +0200 <janus> yeah i was thinking of something like systemd
2021-09-10 18:43:29 +0200 <janus> this is way simpler probably if it is inspired by djb
2021-09-10 18:43:44 +0200 <janus> but i guess the systemd debate is another can o worms :P
2021-09-10 18:45:11 +0200sneedsfeed(~sneedsfee@rrcs-173-95-122-169.midsouth.biz.rr.com) (Ping timeout: 256 seconds)
2021-09-10 18:45:17 +0200brandonh_(brandonh@gateway/vpn/protonvpn/brandonh)
2021-09-10 18:45:42 +0200 <janus> geekosaur: do you have any links about what is wrong with the RTS? just curious
2021-09-10 18:46:22 +0200 <geekosaur> most of them are not well documented. talk to merijn, pretty sure he can give you a lot of detail
2021-09-10 18:46:38 +0200merijn(~merijn@83-160-49-249.ip.xs4all.nl) (Ping timeout: 265 seconds)
2021-09-10 18:46:53 +0200 <geekosaur> ...timing
2021-09-10 18:46:56 +0200 <janus> i don't wanna bother people too much since i don't really have an actual problem, just armchair programming here :P
2021-09-10 18:47:31 +0200 <geekosaur> trust me, if merijn had been paying attention here he'd have jumped in immediately and volubly :)
2021-09-10 18:47:32 +0200 <__monty__> Don't worry merijn likes being vocal about it : )
2021-09-10 18:48:57 +0200ec_(~ec@gateway/tor-sasl/ec)
2021-09-10 18:50:37 +0200 <dminuoso> And very emotional.
2021-09-10 18:51:24 +0200texasmynstedgoogles deno and zig
2021-09-10 18:53:41 +0200mikoto-chan(~mikoto-ch@83.137.2.248)
2021-09-10 18:53:53 +0200brandonh_(brandonh@gateway/vpn/protonvpn/brandonh) (Ping timeout: 265 seconds)
2021-09-10 18:54:25 +0200mc47(~mc47@xmonad/TheMC47)
2021-09-10 18:55:32 +0200brandonh(~brandonh@151.82.75.211)
2021-09-10 18:55:40 +0200 <sm> yes https://ziglang.org, https://deno.land, good inspiration for us haskellers
2021-09-10 18:56:39 +0200 <Hecate> one day we'll have `cabal build --target <triplet>`
2021-09-10 18:57:03 +0200 <texasmynsted> wow, both zig and deno are fascinating
2021-09-10 18:57:13 +0200amitnjha(~amit@024-216-124-116.res.spectrum.com) (Quit: amitnjha)
2021-09-10 18:57:28 +0200amitnjha(~amit@024-216-124-116.res.spectrum.com)
2021-09-10 18:57:53 +0200texasmynstednow wonders if Unsion could be made to work this way
2021-09-10 18:58:44 +0200 <sm> they are winners, we should interop with them :)
2021-09-10 19:01:07 +0200mc47(~mc47@xmonad/TheMC47) (Ping timeout: 252 seconds)
2021-09-10 19:02:38 +0200 <maerwald> we can barely interop with C++
2021-09-10 19:02:49 +0200econo(uid147250@user/econo)
2021-09-10 19:07:02 +0200justsomeguy(~justsomeg@user/justsomeguy)
2021-09-10 19:07:33 +0200amitnjha(~amit@024-216-124-116.res.spectrum.com) (Quit: amitnjha)
2021-09-10 19:07:46 +0200amitnjha(~amit@024-216-124-116.res.spectrum.com)
2021-09-10 19:09:04 +0200kayprish(~kayprish@cable-188-2-153-140.dynamic.sbb.rs)
2021-09-10 19:09:29 +0200hpc(~juzz@ip98-169-35-13.dc.dc.cox.net) (Ping timeout: 252 seconds)
2021-09-10 19:09:46 +0200merijn(~merijn@83-160-49-249.ip.xs4all.nl)
2021-09-10 19:09:48 +0200proofofkeags_(~proofofke@205.209.28.54)
2021-09-10 19:09:54 +0200ec_(~ec@gateway/tor-sasl/ec) (Ping timeout: 276 seconds)
2021-09-10 19:11:23 +0200hpc(~juzz@ip98-169-35-13.dc.dc.cox.net)
2021-09-10 19:14:39 +0200 <kuribas> hmm, I have a exe and a library, it doesn't seem that stack recompiles when I just change the library...
2021-09-10 19:17:14 +0200ec_(~ec@gateway/tor-sasl/ec)
2021-09-10 19:17:47 +0200gehmehgeh(~user@user/gehmehgeh)
2021-09-10 19:18:32 +0200 <kuribas> strange, now it does...
2021-09-10 19:22:21 +0200jinsun(~quassel@user/jinsun)
2021-09-10 19:26:54 +0200merijn(~merijn@83-160-49-249.ip.xs4all.nl) (Ping timeout: 260 seconds)
2021-09-10 19:29:19 +0200justsomeguy(~justsomeg@user/justsomeguy) (Ping timeout: 252 seconds)
2021-09-10 19:29:32 +0200 <maerwald> kuribas: why are you using stack again? You don't seem like you're enjoying it
2021-09-10 19:30:19 +0200 <kuribas> maerwald: it's not about enjoying, about letting my coworkers use intellij...
2021-09-10 19:30:29 +0200 <maerwald> that only works with stack?
2021-09-10 19:30:34 +0200 <kuribas> maerwald: yeah
2021-09-10 19:30:40 +0200 <maerwald> also, why not use stack2cabal?
2021-09-10 19:30:49 +0200 <kuribas> it works ok with the latests snapshot.
2021-09-10 19:31:13 +0200 <maerwald> you don't have to be confined to stack just bc your coworkers use it
2021-09-10 19:31:43 +0200 <dminuoso> maerwald: really?
2021-09-10 19:31:54 +0200 <dminuoso> does stack2cabal generate appropriate constraints matching the resolver?
2021-09-10 19:31:57 +0200 <maerwald> yes
2021-09-10 19:32:01 +0200 <dminuoso> Ah great.
2021-09-10 19:32:03 +0200 <kuribas> maerwald: I cannot force them to use emacs :)
2021-09-10 19:32:05 +0200 <kuribas> or vim
2021-09-10 19:32:23 +0200 <maerwald> dminuoso: it doesn't understand ALL pantry syntax (most users don't use all of it) and doesn't translate flags yet
2021-09-10 19:32:31 +0200 <glguy> maerwald: assuming it was you, thanks for getting cabal-install-3.6.0.0 into ghcup so quickly
2021-09-10 19:32:34 +0200 <maerwald> but works on non-trivial projects
2021-09-10 19:36:39 +0200 <maerwald> glguy: it took so long because I had to build darwin-aarch64 bindists and then got stuck with CI
2021-09-10 19:37:00 +0200 <maerwald> there are no official darwin-aarch64 bindists
2021-09-10 19:37:34 +0200MQ-17J(~MQ-17J@d14-69-206-129.try.wideopenwest.com) (Ping timeout: 252 seconds)
2021-09-10 19:38:30 +0200ec_(~ec@gateway/tor-sasl/ec) (Ping timeout: 276 seconds)
2021-09-10 19:38:48 +0200 <maerwald> I think github actions still doesn't provide it
2021-09-10 19:38:54 +0200eggplantade(~Eggplanta@2600:1700:bef1:5e10:c09c:3e60:e691:1fba) (Remote host closed the connection)
2021-09-10 19:38:56 +0200mikoto-chan(~mikoto-ch@83.137.2.248) (Quit: mikoto-chan)
2021-09-10 19:45:24 +0200vicfred(~vicfred@user/vicfred) (Quit: Leaving)
2021-09-10 19:45:41 +0200ec_(~ec@gateway/tor-sasl/ec)
2021-09-10 19:48:22 +0200alanz(sid110616@highgate.irccloud.com) (Ping timeout: 250 seconds)
2021-09-10 19:48:22 +0200obviyus(sid415299@user/obviyus) (Ping timeout: 250 seconds)
2021-09-10 19:48:22 +0200b20n(sid115913@id-115913.highgate.irccloud.com) (Ping timeout: 250 seconds)
2021-09-10 19:48:42 +0200totbwf__(sid402332@id-402332.highgate.irccloud.com) (Read error: Connection reset by peer)
2021-09-10 19:48:42 +0200bradparker(sid262931@id-262931.highgate.irccloud.com) (Read error: Connection reset by peer)
2021-09-10 19:48:42 +0200systemfault(sid267009@id-267009.highgate.irccloud.com) (Read error: Connection reset by peer)
2021-09-10 19:48:44 +0200etrepum(sid763@highgate.irccloud.com) (Read error: Connection reset by peer)
2021-09-10 19:48:44 +0200T_S_(sid501726@highgate.irccloud.com) (Read error: Connection reset by peer)
2021-09-10 19:48:44 +0200davetapley(sid666@id-666.highgate.irccloud.com) (Read error: Connection reset by peer)
2021-09-10 19:48:56 +0200aarchi(sid486183@id-486183.highgate.irccloud.com) (Read error: Connection reset by peer)
2021-09-10 19:49:06 +0200SrPx(sid108780@highgate.irccloud.com) (Read error: Connection reset by peer)
2021-09-10 19:49:06 +0200vito(sid1962@user/vito) (Write error: Connection reset by peer)
2021-09-10 19:50:18 +0200justsomeguy(~justsomeg@user/justsomeguy)
2021-09-10 19:50:32 +0200stevenxl(uid133530@highgate.irccloud.com) (Ping timeout: 250 seconds)
2021-09-10 19:51:10 +0200alanz(sid110616@id-110616.highgate.irccloud.com)
2021-09-10 19:51:13 +0200davetapley(sid666@id-666.highgate.irccloud.com)
2021-09-10 19:51:15 +0200etrepum(sid763@id-763.highgate.irccloud.com)
2021-09-10 19:51:20 +0200T_S_(sid501726@id-501726.highgate.irccloud.com)
2021-09-10 19:51:21 +0200SrPx(sid108780@id-108780.highgate.irccloud.com)
2021-09-10 19:51:33 +0200b20n(sid115913@id-115913.highgate.irccloud.com)
2021-09-10 19:51:46 +0200totbwf__(sid402332@highgate.irccloud.com)
2021-09-10 19:51:53 +0200obviyus(sid415299@user/obviyus)
2021-09-10 19:52:22 +0200systemfault(sid267009@id-267009.highgate.irccloud.com)
2021-09-10 19:52:29 +0200aarchi(sid486183@id-486183.highgate.irccloud.com)
2021-09-10 19:52:33 +0200vito(sid1962@user/vito)
2021-09-10 19:52:34 +0200bradparker(sid262931@id-262931.highgate.irccloud.com)
2021-09-10 19:53:40 +0200MQ-17J(~MQ-17J@2607:fb90:1d3a:e28c:515f:1bae:68b2:8409)
2021-09-10 19:53:49 +0200wroathe(~wroathe@user/wroathe) (Ping timeout: 265 seconds)
2021-09-10 19:54:36 +0200MQ-17J(~MQ-17J@2607:fb90:1d3a:e28c:515f:1bae:68b2:8409) (Read error: Connection reset by peer)
2021-09-10 19:54:46 +0200stevenxl(sid133530@id-133530.highgate.irccloud.com)
2021-09-10 19:54:54 +0200MQ-17J(~MQ-17J@d192-24-122-179.try.wideopenwest.com)
2021-09-10 19:57:56 +0200wroathe(~wroathe@c-68-54-25-135.hsd1.mn.comcast.net)
2021-09-10 19:57:56 +0200wroathe(~wroathe@c-68-54-25-135.hsd1.mn.comcast.net) (Changing host)
2021-09-10 19:57:56 +0200wroathe(~wroathe@user/wroathe)
2021-09-10 20:01:44 +0200 <jneira[m]> <maerwald> "I think github actions still..." <- nope, the gitlab arm image is gold for now
2021-09-10 20:02:13 +0200 <maerwald> they aren't cheap :)
2021-09-10 20:03:45 +0200kuribas(~user@ptr-25vy0i7jzpijs82kd6g.18120a2.ip6.access.telenet.be) (Quit: ERC (IRC client for Emacs 26.3))
2021-09-10 20:04:03 +0200asivitz(uid178348@id-178348.tinside.irccloud.com)
2021-09-10 20:05:39 +0200brandonh(~brandonh@151.82.75.211) (Quit: brandonh)
2021-09-10 20:06:27 +0200ec_(~ec@gateway/tor-sasl/ec) (Ping timeout: 276 seconds)
2021-09-10 20:06:52 +0200MQ-17J(~MQ-17J@d192-24-122-179.try.wideopenwest.com) (Ping timeout: 265 seconds)
2021-09-10 20:07:11 +0200MQ-17J(~MQ-17J@d192-24-122-179.try.wideopenwest.com)
2021-09-10 20:07:40 +0200wroathe(~wroathe@user/wroathe) (Ping timeout: 252 seconds)
2021-09-10 20:08:13 +0200alx741(~alx741@186.178.109.214) (Ping timeout: 252 seconds)
2021-09-10 20:10:36 +0200xsperry(~as@user/xsperry)
2021-09-10 20:14:43 +0200abhixec(~abhixec@c-67-169-139-16.hsd1.ca.comcast.net)
2021-09-10 20:17:53 +0200amitnjha(~amit@024-216-124-116.res.spectrum.com) (Quit: amitnjha)
2021-09-10 20:18:07 +0200amitnjha(~amit@024-216-124-116.res.spectrum.com)
2021-09-10 20:22:50 +0200alx741(~alx741@186.178.109.89)
2021-09-10 20:24:08 +0200justsomeguy(~justsomeg@user/justsomeguy) (Quit: WeeChat 3.2)
2021-09-10 20:24:15 +0200wroathe(~wroathe@c-68-54-25-135.hsd1.mn.comcast.net)
2021-09-10 20:24:15 +0200wroathe(~wroathe@c-68-54-25-135.hsd1.mn.comcast.net) (Changing host)
2021-09-10 20:24:15 +0200wroathe(~wroathe@user/wroathe)
2021-09-10 20:24:21 +0200eggplantade(~Eggplanta@2600:1700:bef1:5e10:c09c:3e60:e691:1fba)
2021-09-10 20:29:06 +0200wroathe(~wroathe@user/wroathe) (Ping timeout: 265 seconds)
2021-09-10 20:29:53 +0200MQ-17J(~MQ-17J@d192-24-122-179.try.wideopenwest.com) (Remote host closed the connection)
2021-09-10 20:31:18 +0200MQ-17J(~MQ-17J@d192-24-122-179.try.wideopenwest.com)
2021-09-10 20:32:18 +0200dyeplexer(~dyeplexer@user/dyeplexer) (Remote host closed the connection)
2021-09-10 20:32:50 +0200pooryorick(~pooryoric@87-119-174-173.tll.elisa.ee)
2021-09-10 20:33:31 +0200MQ-17J(~MQ-17J@d192-24-122-179.try.wideopenwest.com) (Remote host closed the connection)
2021-09-10 20:35:45 +0200max22-(~maxime@2a01cb088335980003a066e559758211.ipv6.abo.wanadoo.fr) (Ping timeout: 260 seconds)
2021-09-10 20:38:15 +0200 <mrianbloom> Does anyone know how to persuade cabal to notice when an embedded file has changed?
2021-09-10 20:38:22 +0200pmk(~user@2a02:587:9416:c4cd:a38a:dea2:e28e:646d)
2021-09-10 20:39:11 +0200 <sclv> add it to the extra-files iirc
2021-09-10 20:39:37 +0200 <lechner> Hi, which type does Lucid's title_ take, please? Efforts to replace a literal string with Text or a String produce errors like this: https://dpaste.org/th9v
2021-09-10 20:39:59 +0200 <sclv> mrianbloom: `extra-source-files` rather
2021-09-10 20:41:10 +0200 <[exa]> lechner: you may put an underscore instead of the title_ and see what ghc thinks should be there
2021-09-10 20:41:42 +0200 <mrianbloom> sclv : I see, trying that out.
2021-09-10 20:42:43 +0200 <geekosaur> at a guess, Html has an IsString instance
2021-09-10 20:42:56 +0200 <geekosaur> that produces an html-encoded literal string
2021-09-10 20:43:13 +0200 <geekosaur> (properly escaped etc.)
2021-09-10 20:44:01 +0200 <[exa]> I have to say the type on hoogle is opaque
2021-09-10 20:44:12 +0200 <[exa]> title :: Term arg result => arg -> result
2021-09-10 20:44:25 +0200 <lechner> [exa]: thanks! here it is. (Take another look at the nice short URL!) maybe i should pass the expression (title_ "Literal") instead? https://dpaste.org/buGs
2021-09-10 20:44:33 +0200 <[exa]> title = term "title"
2021-09-10 20:44:59 +0200ec_(~ec@gateway/tor-sasl/ec)
2021-09-10 20:45:25 +0200 <lechner> i posted this by accident on #hackage earlier Hi, is the name 'result' appropriate fo a type? https://hackage.haskell.org/package/lucid-2.9.12.1/docs/Lucid-Html5.html
2021-09-10 20:46:32 +0200 <[exa]> lechner: I guess you want to add another custom tag into the head?
2021-09-10 20:46:57 +0200 <[exa]> anyway `result` is technically perfectly same type variable name as `a` or `b` or `oiruweoiruqweiurqwioeruqwiur`
2021-09-10 20:46:58 +0200 <lechner> [exa]: just a page title, really
2021-09-10 20:47:54 +0200 <lechner> maybe those types are chainable. i think i have to pass (title- "Literal"0 :: Html
2021-09-10 20:48:00 +0200 <lechner> titel_
2021-09-10 20:48:05 +0200 <lechner> title_
2021-09-10 20:48:11 +0200 <[exa]> then `title_ "YourTitle"` should work
2021-09-10 20:48:12 +0200 <mrianbloom> sclv FYYI that doesn't seem to work. I also tried data-files
2021-09-10 20:48:29 +0200 <[exa]> the problem with title_ is that they want it both as a tag and as argument, therefore the typeclass in there
2021-09-10 20:48:59 +0200 <maerwald> extra-source-files should work
2021-09-10 20:49:01 +0200 <sclv> i'm pretty sure extra-source-files works, if you have a recent enough cabal
2021-09-10 20:49:07 +0200 <sclv> i just tested/improved it
2021-09-10 20:49:33 +0200 <maerwald> how do you embed the file?
2021-09-10 20:50:34 +0200 <maerwald> I'm not sure if `qAddDependentFile` makes any difference in the TH expression
2021-09-10 20:51:01 +0200 <lechner> [exa]: thanks! maybe one day i'll understand why
2021-09-10 20:51:23 +0200 <maerwald> https://hackage.haskell.org/package/file-embed
2021-09-10 20:51:48 +0200 <maerwald> https://github.com/snoyberg/file-embed/blob/548430d2a79bb6f4cb4256768761071f59909aa5/file-embed.ca…
2021-09-10 20:51:50 +0200 <maerwald> checks out
2021-09-10 20:52:37 +0200 <sclv> adding a dependent file hints ghc, but it can't get transmitted back to cabal -- there's no interface for it
2021-09-10 20:52:51 +0200 <[exa]> lechner: anyway you need to wrap the inner `pageTitle` into HTML
2021-09-10 20:53:03 +0200brandonh(brandonh@gateway/vpn/protonvpn/brandonh)
2021-09-10 20:53:06 +0200eggplantade(~Eggplanta@2600:1700:bef1:5e10:c09c:3e60:e691:1fba) (Remote host closed the connection)
2021-09-10 20:53:08 +0200 <[exa]> lechner: in the instance you can see that title_ doesn't wrap text, it needs inner html already
2021-09-10 20:53:20 +0200 <[exa]> s/instance/error message with the instance/
2021-09-10 20:53:45 +0200 <lechner> [exa]: but how does the overloaded string satisfy it?
2021-09-10 20:54:19 +0200 <geekosaur> fromString provided by the IsString instance
2021-09-10 20:54:26 +0200 <[exa]> overloaded strings only work with string literals
2021-09-10 20:54:37 +0200 <[exa]> it's not an autoconversion
2021-09-10 20:55:19 +0200 <lechner> i thought they only provide String, ByteString and Text, but that must be wrong
2021-09-10 20:55:39 +0200 <geekosaur> those are the standard ones. the package you're using added one
2021-09-10 20:55:49 +0200 <geekosaur> remember, typeclasses are open
2021-09-10 20:56:12 +0200 <geekosaur> you could define your own IsString instance for some type and OverloadedStrings would start working with it
2021-09-10 20:56:22 +0200 <lechner> not the first time i saw type magic here. so cool!
2021-09-10 20:56:31 +0200 <janus> sclv: so in summary, addDependentFile and extra-source-files should be sufficient to always get the right modules build when the embedded file changes?
2021-09-10 20:57:57 +0200 <lechner> [exa]: did you mean "Html ()" when you referred to html inner?
2021-09-10 20:58:01 +0200 <[exa]> is there anything standard that would do `FromString a => Text -> a` ?
2021-09-10 20:58:26 +0200 <[exa]> lechner: quick check: if you write `title_ "asasdasd"` it works, right?
2021-09-10 20:58:39 +0200 <sclv> i believe so. also file-embed should be calling addDependentFile for you https://hackage.haskell.org/package/file-embed-0.0.15.0/docs/src/Data.FileEmbed.html
2021-09-10 20:58:41 +0200 <lechner> yes, with a literal
2021-09-10 20:58:46 +0200oxide(~lambda@user/oxide) (Quit: oxide)
2021-09-10 20:59:07 +0200 <[exa]> lechner: good, so you just need to push your variable into the correct type
2021-09-10 20:59:39 +0200 <[exa]> something crude like `title_ . fromString . T.unpack $ pageTitle` could work
2021-09-10 20:59:56 +0200 <[exa]> but I guess people here will have better suggestions (I don't use the text libs often)
2021-09-10 21:00:40 +0200 <lechner> i just pulled (title_ "Literal") :: Html () into the caller
2021-09-10 21:00:59 +0200 <lechner> String has the same issue
2021-09-10 21:01:42 +0200ec_(~ec@gateway/tor-sasl/ec) (Ping timeout: 276 seconds)
2021-09-10 21:01:50 +0200 <geekosaur> for String you can cheat and call fromString directly
2021-09-10 21:02:11 +0200 <geekosaur> sadly this doesn't work for Text, you have to unpack it into a String
2021-09-10 21:03:55 +0200max22-(~maxime@2a01cb08833598002b7e84d0aaf65199.ipv6.abo.wanadoo.fr)
2021-09-10 21:05:16 +0200timCF(~timCF@m91-129-108-244.cust.tele2.ee)
2021-09-10 21:05:44 +0200eggplantade(~Eggplanta@2600:1700:bef1:5e10:c09c:3e60:e691:1fba)
2021-09-10 21:06:19 +0200 <timCF> Hello! There is a method to avoid Proxy types on class methods using TypeApplications. But is there any way to do the same thing with normal functions as well?
2021-09-10 21:06:36 +0200 <lechner> geekosaur: not sure that works https://dpaste.org/65Kr
2021-09-10 21:08:52 +0200neo2(~neo3@cpe-292712.ip.primehome.com) (Ping timeout: 252 seconds)
2021-09-10 21:11:02 +0200Guest81(~Guest81@2804:14c:109:2a81:b85d:234a:ff63:99ad)
2021-09-10 21:12:16 +0200ec_(~ec@gateway/tor-sasl/ec)
2021-09-10 21:14:33 +0200 <[exa]> lechner: do you have perhaps a fuller code example?
2021-09-10 21:17:00 +0200dunj3(~dunj3@2001:16b8:3076:ac00:597e:94f1:37b7:cb6c) (Remote host closed the connection)
2021-09-10 21:17:33 +0200 <lechner> [exa]: https://dpaste.org/m8NX#L28
2021-09-10 21:17:34 +0200vicfred(~vicfred@user/vicfred)
2021-09-10 21:18:13 +0200amitnjha(~amit@024-216-124-116.res.spectrum.com) (Quit: amitnjha)
2021-09-10 21:18:27 +0200amitnjha(~amit@024-216-124-116.res.spectrum.com)
2021-09-10 21:23:29 +0200ic2000_(~ic2000_@cpc108265-brom11-2-0-cust119.16-1.cable.virginm.net)
2021-09-10 21:25:39 +0200 <[exa]> lechner: you probably want title_ (fromString pageTitle) instead of the dot there
2021-09-10 21:27:19 +0200 <[exa]> also, having the type as `commonHeader :: Html () -> Html ()`, you shouldn't need fromString there, and the string type below in `indexPage` should get properly autoconverted
2021-09-10 21:28:09 +0200 <lechner> with your first suggestion, i get this https://dpaste.org/f0HD
2021-09-10 21:28:37 +0200 <[exa]> ah, import it, it should be in Data.String
2021-09-10 21:29:20 +0200 <lechner> i see. the second one works,but seems super unsafe
2021-09-10 21:29:33 +0200 <lechner> sorry about the import error
2021-09-10 21:29:41 +0200 <[exa]> np
2021-09-10 21:30:16 +0200 <[exa]> yeah you don't want any inner Html in title, it was just the easiest way how to do the conversion at the spot where it's already present
2021-09-10 21:31:23 +0200 <lechner> [exa]: the second one is super weird, though. how can a module work well (or be safe) that does not distriguish between quoted and literal HTML?
2021-09-10 21:31:58 +0200Erutuon(~Erutuon@user/erutuon) (Ping timeout: 252 seconds)
2021-09-10 21:32:03 +0200Guest81(~Guest81@2804:14c:109:2a81:b85d:234a:ff63:99ad) (Quit: Client closed)
2021-09-10 21:32:20 +0200 <[exa]> well you're using the same there, passing in the string as html content as if nothing happened :]
2021-09-10 21:32:26 +0200 <[exa]> title_ doesn't magically wrap it
2021-09-10 21:32:42 +0200 <lechner> i guess it's literally only a problem with literal strings
2021-09-10 21:32:47 +0200 <[exa]> anyway, you can disable this whole behavior by turning off the overloadedStrings, yes
2021-09-10 21:32:48 +0200 <awpr> presumably the IsString instance should escape its contents?
2021-09-10 21:33:06 +0200 <[exa]> what you could do is:
2021-09-10 21:33:50 +0200 <awpr> indeed it does: https://hackage.haskell.org/package/lucid-2.9.12.1/docs/src/Lucid.Base.html#line-200
2021-09-10 21:33:58 +0200 <[exa]> (ah noes sorry, bad idea)
2021-09-10 21:34:33 +0200 <lechner> awpr: more magic! haskell always outsmarts me
2021-09-10 21:34:43 +0200xff0x(~xff0x@2001:1a81:531e:3c00:7633:19f7:d2d8:9bde) (Ping timeout: 252 seconds)
2021-09-10 21:34:49 +0200AkechiShiro(~licht@user/akechishiro) (Quit: WeeChat 2.9)
2021-09-10 21:34:55 +0200 <mrianbloom> sclv: alright not sure what my error is but this is how my cabal file is setup: https://pastebin.com/me24hifY
2021-09-10 21:35:01 +0200 <[exa]> lechner: the literal overloading is tricky but once you see it it's pretty straightforward
2021-09-10 21:35:23 +0200xff0x(~xff0x@2001:1a81:531e:3c00:3db9:e43a:c387:7efa)
2021-09-10 21:35:30 +0200 <mrianbloom> sclv check line 43
2021-09-10 21:35:54 +0200 <[exa]> lechner: the same goes with numbers, `1+1` desugars to something like `fromInteger 1 + fromInteger 1` in which the 1's are of fixed type Integer
2021-09-10 21:36:10 +0200 <mrianbloom> I can also show you how the embed is set up in the repository if you are interested.
2021-09-10 21:36:55 +0200 <[exa]> lechner: then you can make e.g. an instance of lists that behave like numbers, where you go stuff like `1 + [2,3,4] == [3,4,5]` etc.
2021-09-10 21:37:18 +0200 <lechner> [exa]: thanks for taking the time to explore all that1 for now, i'll probably stick to passing Lucid's own stuff as Html (), and use title_ in the caller
2021-09-10 21:37:27 +0200 <lechner> ti meant !
2021-09-10 21:37:29 +0200 <lechner> i
2021-09-10 21:37:59 +0200favonia(~favonia@user/favonia) (Remote host closed the connection)
2021-09-10 21:38:28 +0200 <sclv> and which version of cabal-install are you using?
2021-09-10 21:38:57 +0200Lycurgus(~juan@98.4.112.204)
2021-09-10 21:40:43 +0200 <sclv> mrianbloom: it only started working in 3.4: https://github.com/haskell/cabal/blob/master/release-notes/cabal-install-3.4.0.0.md
2021-09-10 21:41:33 +0200wroathe(~wroathe@c-68-54-25-135.hsd1.mn.comcast.net)
2021-09-10 21:41:33 +0200wroathe(~wroathe@c-68-54-25-135.hsd1.mn.comcast.net) (Changing host)
2021-09-10 21:41:33 +0200wroathe(~wroathe@user/wroathe)
2021-09-10 21:41:56 +0200 <[exa]> lechner: that may be even more problematic since someone can stick a tagless string into the head then
2021-09-10 21:42:35 +0200 <[exa]> go with the String->Html(), that's good
2021-09-10 21:42:41 +0200 <lechner> [exa]: would you please rephrase that?
2021-09-10 21:42:44 +0200 <[exa]> the extra fromString is the safety there
2021-09-10 21:43:13 +0200 <[exa]> if you call the function as `commonHeader (title_ "asd")`, it doesn't the restrict the user from calling just `commomHeader "asd"` right?
2021-09-10 21:43:24 +0200 <lechner> right!
2021-09-10 21:43:48 +0200 <lechner> so it's more confusing. i get it now
2021-09-10 21:43:55 +0200 <[exa]> or `commonHeader (h1_ "oh hello there")`
2021-09-10 21:43:57 +0200 <lechner> good call
2021-09-10 21:44:39 +0200caubert(~caubert@136.244.111.235) (Quit: WeeChat 3.2)
2021-09-10 21:44:41 +0200 <[exa]> or inject javascript.
2021-09-10 21:44:42 +0200 <[exa]> :D
2021-09-10 21:45:35 +0200 <lechner> [exa]: why did geekosaur call it cheating though?
2021-09-10 21:45:57 +0200caubert(~caubert@136.244.111.235)
2021-09-10 21:46:19 +0200 <[exa]> not sure, need to scrollback
2021-09-10 21:46:39 +0200 <geekosaur> there's usually some "proper" way to do conversions rather than manually evoking fromString
2021-09-10 21:46:43 +0200 <lechner> 12:01:50
2021-09-10 21:47:06 +0200 <awpr> `toHtml` probably
2021-09-10 21:47:16 +0200 <janus> geekosaur: what's your take on Data.Convertible?
2021-09-10 21:47:26 +0200 <[exa]> geekosaur: otoh some conversion there kinda ensures that it's a string that arrives, not a js bitcoin miner
2021-09-10 21:48:00 +0200 <[exa]> anyway, yeah, the concern is valid, we should write the least amount of conversions possible
2021-09-10 21:48:13 +0200 <janus> what i don't like about Data.Convertible is that every call site has to decide whether to do a partial conversion or not
2021-09-10 21:48:31 +0200 <janus> and then if you have lots of conversions, you may not notice one 'convert' that should have been 'safeConvert'
2021-09-10 21:48:33 +0200 <[exa]> especially if the literal is literally sitting there waiting to be converted to html
2021-09-10 21:48:56 +0200 <janus> but names are hard, so i also feel like it is cumbersome to invent a new name for every conversion, especially all the ones that can never fail
2021-09-10 21:49:03 +0200 <geekosaur> pretty much
2021-09-10 21:49:27 +0200 <geekosaur> also I sort of distrust "magical" conversions, I prefer to be as explicit as possible
2021-09-10 21:49:57 +0200 <janus> so that means you'd make an alias of coerce instead of using it directly?
2021-09-10 21:50:12 +0200 <geekosaur> it may be cumbersome but it feels safer
2021-09-10 21:50:16 +0200 <[exa]> this would call for something like: `commonHeader :: IsString s, ToHtml s => s -> Html ()`
2021-09-10 21:51:26 +0200 <awpr> seems to me the `IsString` shouldn't be necessary there, if you can convert `s` directly to HTML
2021-09-10 21:51:48 +0200 <[exa]> awpr: we want to ensure no one passes in HTML with shenanigans
2021-09-10 21:51:49 +0200beka(~beka@104.193.170.240)
2021-09-10 21:52:23 +0200 <awpr> then just `IsString` and no `ToHtml`?
2021-09-10 21:52:25 +0200 <[exa]> ah there's `StringLike` that does that much better
2021-09-10 21:52:43 +0200 <[exa]> if we don't have ToHtml, we have no idea how to convert it
2021-09-10 21:53:01 +0200 <awpr> `toHtml . toString`
2021-09-10 21:53:45 +0200 <[exa]> ah ofc
2021-09-10 21:54:05 +0200 <[exa]> I wanted to go with just toHtml, possibly bypassing the string
2021-09-10 21:54:15 +0200 <[exa]> good point. :D
2021-09-10 21:54:45 +0200 <awpr> anyway if it should be plain text, there are several types for that (Text, String)
2021-09-10 21:54:58 +0200jakalx(~jakalx@base.jakalx.net) (Error from remote client)
2021-09-10 21:55:40 +0200kenran(~kenran@200116b82b2f0f0026d2b42ae928c649.dip.versatel-1u1.de)
2021-09-10 21:55:43 +0200 <awpr> the `IsString`-polymorphic signature might behave poorly with `OverloadedStrings`, since literals in its argument would be ambiguous types
2021-09-10 21:55:56 +0200jakalx(~jakalx@base.jakalx.net)
2021-09-10 21:56:30 +0200favonia(~favonia@user/favonia)
2021-09-10 21:56:39 +0200 <[exa]> yeah
2021-09-10 21:56:54 +0200 <[exa]> like, probably best to have a look what Html is using internally and make sure the later conversion doesn't hurt
2021-09-10 21:56:58 +0200unit73e(~emanuel@2001:818:e8dd:7c00:32b5:c2ff:fe6b:5291)
2021-09-10 22:00:59 +0200 <awpr> I'm thinking `Text` is the way to go, since a) using `String` could result in actually using `String`s if GHC doesn't optimize magically enough, b) even though it uses `ByteString` internally, it has to take a pass over the bytes anyway for HTML escaping, and c) `Text` is meant for text, unlike `ByteString`
2021-09-10 22:03:19 +0200wroathe(~wroathe@user/wroathe) (Ping timeout: 252 seconds)
2021-09-10 22:03:33 +0200amitnjha(~amit@024-216-124-116.res.spectrum.com) (Quit: amitnjha)
2021-09-10 22:03:46 +0200amitnjha(~amit@024-216-124-116.res.spectrum.com)
2021-09-10 22:05:17 +0200juhp(~juhp@128.106.188.220) (Ping timeout: 265 seconds)
2021-09-10 22:07:02 +0200juhp(~juhp@128.106.188.220)
2021-09-10 22:07:15 +0200clever(~clever@99.192.114.98)
2021-09-10 22:07:47 +0200 <__monty__> janus: This is an init written in Haskell fyi, https://github.com/cleverca22/nix-tests/blob/master/haskell-init/hello_world.hs
2021-09-10 22:08:01 +0200 <__monty__> Very basic but it's a proof of concept.
2021-09-10 22:09:48 +0200_ht(~quassel@82-169-194-8.biz.kpn.net) (Remote host closed the connection)
2021-09-10 22:10:31 +0200timCF(~timCF@m91-129-108-244.cust.tele2.ee) (Quit: leaving)
2021-09-10 22:13:06 +0200Lycurgus(~juan@98.4.112.204) (Quit: Exeunt)
2021-09-10 22:16:31 +0200goepsilongo(~chacho@2603-7000-ab00-62ed-0000-0000-0000-0bd0.res6.spectrum.com) (Quit: Konversation terminated!)
2021-09-10 22:18:47 +0200acidjnk_new(~acidjnk@p200300d0c7203049d04185c247f1acfb.dip0.t-ipconnect.de)
2021-09-10 22:19:42 +0200wroathe(~wroathe@c-68-54-25-135.hsd1.mn.comcast.net)
2021-09-10 22:19:43 +0200wroathe(~wroathe@c-68-54-25-135.hsd1.mn.comcast.net) (Changing host)
2021-09-10 22:19:43 +0200wroathe(~wroathe@user/wroathe)
2021-09-10 22:20:27 +0200wrengrwrengr_away
2021-09-10 22:22:58 +0200brandonh(brandonh@gateway/vpn/protonvpn/brandonh) (Ping timeout: 252 seconds)
2021-09-10 22:24:37 +0200wroathe(~wroathe@user/wroathe) (Ping timeout: 265 seconds)
2021-09-10 22:25:27 +0200 <janus> nice to see that someones trying it out :D
2021-09-10 22:25:27 +0200epolanski(uid312403@id-312403.helmsley.irccloud.com)
2021-09-10 22:27:23 +0200brandonh(~brandonh@151.82.85.99)
2021-09-10 22:34:46 +0200wroathe(~wroathe@c-68-54-25-135.hsd1.mn.comcast.net)
2021-09-10 22:34:46 +0200wroathe(~wroathe@c-68-54-25-135.hsd1.mn.comcast.net) (Changing host)
2021-09-10 22:34:46 +0200wroathe(~wroathe@user/wroathe)
2021-09-10 22:38:46 +0200eggplantade(~Eggplanta@2600:1700:bef1:5e10:c09c:3e60:e691:1fba) (Remote host closed the connection)
2021-09-10 22:41:13 +0200__monty__(~toonn@user/toonn) (Quit: leaving)
2021-09-10 22:47:39 +0200hololeap(~hololeap@user/hololeap) (Ping timeout: 276 seconds)
2021-09-10 22:48:18 +0200takuan(~takuan@178-116-218-225.access.telenet.be) (Ping timeout: 265 seconds)
2021-09-10 22:49:10 +0200hololeap(~hololeap@user/hololeap)
2021-09-10 22:53:53 +0200amitnjha(~amit@024-216-124-116.res.spectrum.com) (Quit: amitnjha)
2021-09-10 22:54:07 +0200amitnjha(~amit@024-216-124-116.res.spectrum.com)
2021-09-10 22:55:27 +0200gehmehgeh(~user@user/gehmehgeh) (Ping timeout: 276 seconds)
2021-09-10 22:56:17 +0200gehmehgeh(~user@user/gehmehgeh)
2021-09-10 22:57:02 +0200brandonh(~brandonh@151.82.85.99) (Quit: brandonh)
2021-09-10 22:58:13 +0200eggplantade(~Eggplanta@2600:1700:bef1:5e10:c09c:3e60:e691:1fba)
2021-09-10 22:58:21 +0200Lord_of_Life_(~Lord@user/lord-of-life/x-2819915)
2021-09-10 22:58:50 +0200Lord_of_Life(~Lord@user/lord-of-life/x-2819915) (Ping timeout: 252 seconds)
2021-09-10 22:58:56 +0200 <monochrom> I am OK with OverloadedStrings for Text because String and Text are really informationally equivalent, any conflation doesn't really hurt. But that's an exception.
2021-09-10 22:59:37 +0200Lord_of_Life_Lord_of_Life
2021-09-10 22:59:59 +0200 <monochrom> When a type is informationally less than String, for example Bytestring, one should use an explicit "conversion" function name to make explicit what the "conversion" is losing.
2021-09-10 23:00:36 +0200 <lechner> monochrom: +1
2021-09-10 23:00:39 +0200lavaman(~lavaman@98.38.249.169)
2021-09-10 23:01:05 +0200 <Gurkenglas> -1
2021-09-10 23:01:13 +0200 <monochrom> In the same way I agree with Haskell's "floor, ceiling, truncate, round" for "converting" Double to Integer, I disagree with C's reckless approach.
2021-09-10 23:02:19 +0200 <Gurkenglas> compromise: use optics for all that
2021-09-10 23:05:10 +0200 <Gurkenglas> makes you use two words for each direction, incentivizing a restructuring of code that mentions the optic once
2021-09-10 23:06:42 +0200wroathe(~wroathe@user/wroathe) (Ping timeout: 260 seconds)
2021-09-10 23:08:55 +0200vicfred(~vicfred@user/vicfred) (Quit: Leaving)
2021-09-10 23:13:19 +0200stiell(~stiell@gateway/tor-sasl/stiell) (Remote host closed the connection)
2021-09-10 23:13:59 +0200stiell(~stiell@gateway/tor-sasl/stiell)
2021-09-10 23:14:15 +0200ic2000_(~ic2000_@cpc108265-brom11-2-0-cust119.16-1.cable.virginm.net) (Leaving)
2021-09-10 23:16:30 +0200favonia(~favonia@user/favonia) (Ping timeout: 260 seconds)
2021-09-10 23:16:32 +0200kenran(~kenran@200116b82b2f0f0026d2b42ae928c649.dip.versatel-1u1.de) (Quit: WeeChat info:version)
2021-09-10 23:17:25 +0200 <janus> what is the reason that overflowed literals compile?
2021-09-10 23:17:33 +0200 <janus> > 0x100000000000000000000 :: Word
2021-09-10 23:17:35 +0200 <lambdabot> 0
2021-09-10 23:17:55 +0200 <monochrom> Actually with not-old GHC you get a warning.
2021-09-10 23:18:10 +0200 <janus> right, but why is it a warning in the first place and not an error?
2021-09-10 23:18:33 +0200 <janus> i am trying to think of a use case, but nothing comes up especially because it isn't using mod 32 or anything
2021-09-10 23:18:52 +0200 <geekosaur> because they compile to Integer and the actual conversion is done at runtime?
2021-09-10 23:19:19 +0200 <geekosaur> I imagine the warning is an ugly hack somewhere in the typechecker
2021-09-10 23:19:33 +0200 <janus> oooooh that does make more sense now
2021-09-10 23:20:02 +0200 <awpr> I know this isn't exactly a complete answer, but `-Werror=overflowed-literals` will make it an error
2021-09-10 23:20:10 +0200 <monochrom> I would reduce it to "that ship has sailed".
2021-09-10 23:20:25 +0200 <awpr> (my `stack.yaml`s all have `-Werror -Wall` for local builds)
2021-09-10 23:21:01 +0200 <monochrom> The Haskell Reports do not say to reject that code. Implicitly it means accepting that code and doing some undefined behaviour.
2021-09-10 23:21:13 +0200 <janus> monochrom: well, the situation also exists in idris. so the ship is still influencing its departure port
2021-09-10 23:21:18 +0200 <janus> Main> the Bits8 0x100000000000000000
2021-09-10 23:21:21 +0200 <janus> 0
2021-09-10 23:21:26 +0200 <monochrom> Your question should be reduced to "why didn't the Haskell committee make it an error". Well, that ship has sailed.
2021-09-10 23:21:57 +0200 <awpr> I suppose making it an error would give a false sense of security: does `x :: Num a => a; x = 0x100000000000000000` give that error?
2021-09-10 23:22:06 +0200ec_(~ec@gateway/tor-sasl/ec) (Ping timeout: 276 seconds)
2021-09-10 23:22:13 +0200 <monochrom> That other ship is in #idris or something.
2021-09-10 23:22:44 +0200merijn(~merijn@83-160-49-249.ip.xs4all.nl)
2021-09-10 23:23:16 +0200hololeap(~hololeap@user/hololeap) (Remote host closed the connection)
2021-09-10 23:23:42 +0200 <janus> awpr: right, so i guess the fundamental issue is whether fromIntegral should return an error? hmmm
2021-09-10 23:24:32 +0200wroathe(~wroathe@96-88-30-181-static.hfc.comcastbusiness.net)
2021-09-10 23:24:32 +0200wroathe(~wroathe@96-88-30-181-static.hfc.comcastbusiness.net) (Changing host)
2021-09-10 23:24:32 +0200wroathe(~wroathe@user/wroathe)
2021-09-10 23:24:41 +0200hololeap(~hololeap@user/hololeap)
2021-09-10 23:24:42 +0200 <janus> hmmm but fromIntegral _can_ do modN on overflow
2021-09-10 23:25:05 +0200 <awpr> IIUC it does do that for most types
2021-09-10 23:25:20 +0200 <awpr> > 65537 :: Word8
2021-09-10 23:25:22 +0200 <lambdabot> 1
2021-09-10 23:25:30 +0200 <awpr> eh, I meant Word16, but same idea
2021-09-10 23:26:01 +0200kayprish_(~kayprish@cable-188-2-153-140.dynamic.sbb.rs)
2021-09-10 23:26:14 +0200 <xsperry> does -Wall include overflowed-literals warning?
2021-09-10 23:26:24 +0200kayprish(~kayprish@cable-188-2-153-140.dynamic.sbb.rs) (Read error: Connection reset by peer)
2021-09-10 23:26:33 +0200 <janus> what is the function that the compiler inserts that returns 0 on overflow?
2021-09-10 23:27:10 +0200 <janus> ooooh since the warning is a hack, i guess the function doesn't necessarily have a name
2021-09-10 23:27:12 +0200 <monochrom> On one hand, the compiler can't do anything to "1600 :: MonochromSecretNumberType", because I am not going to tell the compiler the range of my secret number type.
2021-09-10 23:27:24 +0200 <awpr> xsperry: I'm amused that that's actually a sensible question given it's called `-Wall`
2021-09-10 23:27:42 +0200 <hpc> > floor (1/0) -- just to shake things up
2021-09-10 23:27:43 +0200 <lambdabot> 1797693134862315907729305190789024733617976978942306572734300811577326758055...
2021-09-10 23:27:55 +0200 <hololeap> one approach is to use "-Weverything" and then turn off the stuff you don't want
2021-09-10 23:28:06 +0200 <awpr> xsperry: https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/using-warnings.html says overflowed-literals is enabled by default
2021-09-10 23:28:08 +0200 <monochrom> On the other hand, the compiler, even the Haskell Report, could still insist on checking the standard number types.
2021-09-10 23:28:25 +0200merijn(~merijn@83-160-49-249.ip.xs4all.nl) (Ping timeout: 265 seconds)
2021-09-10 23:28:41 +0200 <monochrom> or maybe s/could/could have/
2021-09-10 23:28:51 +0200 <awpr> janus: that's not what happens, it just was coincidentally the case that your literal modulo 2^64 was 0
2021-09-10 23:29:15 +0200 <monochrom> But the implementation could get ugly, yeah.
2021-09-10 23:29:16 +0200max22-(~maxime@2a01cb08833598002b7e84d0aaf65199.ipv6.abo.wanadoo.fr) (Quit: Leaving)
2021-09-10 23:29:49 +0200 <janus> awpr: aaaah! makes sense, yeah
2021-09-10 23:30:22 +0200 <geekosaur> > 0x1000000000000000000001 :: Word
2021-09-10 23:30:24 +0200 <lambdabot> 1
2021-09-10 23:31:20 +0200acidjnk_new3(~acidjnk@p200300d0c720304924f33c3f96bd7d34.dip0.t-ipconnect.de)
2021-09-10 23:31:36 +0200 <xsperry> awpr, thanks. so at least it is a warning by default
2021-09-10 23:32:35 +0200 <hololeap> https://medium.com/mercury-bank/enable-all-the-warnings-a0517bc081c3 -- good info
2021-09-10 23:32:46 +0200Gurkenglas(~Gurkengla@dslb-002-207-014-195.002.207.pools.vodafone-ip.de) (Ping timeout: 265 seconds)
2021-09-10 23:33:53 +0200FragByte(~christian@user/fragbyte) (Quit: Quit)
2021-09-10 23:34:37 +0200acidjnk_new(~acidjnk@p200300d0c7203049d04185c247f1acfb.dip0.t-ipconnect.de) (Ping timeout: 252 seconds)
2021-09-10 23:35:06 +0200abhixec(~abhixec@c-67-169-139-16.hsd1.ca.comcast.net) (Quit: leaving)
2021-09-10 23:35:41 +0200FragByte(~christian@user/fragbyte)
2021-09-10 23:39:54 +0200wroathe(~wroathe@user/wroathe) (Quit: Lost terminal)
2021-09-10 23:41:22 +0200mangoiv(~MangoIV@193.175.5.172) (Quit: WeeChat 3.2)
2021-09-10 23:43:00 +0200wroathe(~wroathe@96-88-30-181-static.hfc.comcastbusiness.net)
2021-09-10 23:43:01 +0200wroathe(~wroathe@96-88-30-181-static.hfc.comcastbusiness.net) (Changing host)
2021-09-10 23:43:01 +0200wroathe(~wroathe@user/wroathe)
2021-09-10 23:44:44 +0200favonia(~favonia@user/favonia)
2021-09-10 23:48:21 +0200jessj
2021-09-10 23:50:20 +0200acidjnk_new(~acidjnk@p200300d0c720304924f33c3f96bd7d34.dip0.t-ipconnect.de)
2021-09-10 23:52:37 +0200Guest16(~Guest16@pool-108-17-124-115.pitbpa.fios.verizon.net)
2021-09-10 23:53:22 +0200acidjnk_new3(~acidjnk@p200300d0c720304924f33c3f96bd7d34.dip0.t-ipconnect.de) (Ping timeout: 260 seconds)
2021-09-10 23:54:28 +0200Guest16(~Guest16@pool-108-17-124-115.pitbpa.fios.verizon.net) (Client Quit)
2021-09-10 23:54:49 +0200Guest46(~Guest46@pool-108-17-124-115.pitbpa.fios.verizon.net)