Logs on 2023-04-29 (liberachat/#haskell)
| 00:01:10 | × | merijn quits (~merijn@c-001-001-006.client.esciencecenter.eduvpn.nl) (Ping timeout: 276 seconds) |
| 00:03:25 | × | califax quits (~califax@user/califx) (Remote host closed the connection) |
| 00:04:40 | × | hamster quits (~ham@user/ham) (Read error: Connection reset by peer) |
| 00:04:44 | × | gemmaro quits (~user@240f:74:d1f0:1:ba1:e787:c9e:b1dc) (Remote host closed the connection) |
| 00:05:36 | × | trev quits (~trev@user/trev) (Quit: trev) |
| 00:09:04 | × | talismanick quits (~user@campus-042-001.ucdavis.edu) (Ping timeout: 253 seconds) |
| 00:10:31 | × | AlexNoo quits (~AlexNoo@178.34.150.15) (Read error: Connection reset by peer) |
| 00:10:54 | → | AlexNoo joins (~AlexNoo@178.34.150.15) |
| 00:11:54 | → | Lord_of_Life_ joins (~Lord@user/lord-of-life/x-2819915) |
| 00:12:36 | × | Lord_of_Life quits (~Lord@user/lord-of-life/x-2819915) (Ping timeout: 265 seconds) |
| 00:13:13 | Lord_of_Life_ | is now known as Lord_of_Life |
| 00:15:00 | → | califax joins (~califax@user/califx) |
| 00:47:28 | × | justsomeguy quits (~justsomeg@user/justsomeguy) (Ping timeout: 248 seconds) |
| 00:52:44 | × | pie_ quits (~pie_bnc@user/pie/x-2818909) () |
| 00:53:14 | → | pie_ joins (~pie_bnc@user/pie/x-2818909) |
| 00:53:40 | × | gurkenglas quits (~gurkengla@dynamic-089-204-130-021.89.204.130.pool.telefonica.de) (Ping timeout: 252 seconds) |
| 00:54:48 | → | wroathe joins (~wroathe@207-153-38-140.fttp.usinternet.com) |
| 00:54:48 | × | wroathe quits (~wroathe@207-153-38-140.fttp.usinternet.com) (Changing host) |
| 00:54:48 | → | wroathe joins (~wroathe@user/wroathe) |
| 01:03:23 | × | fun-safe-math quits (~fun-safe-@c-24-22-94-205.hsd1.or.comcast.net) (Quit: Leaving) |
| 01:11:07 | × | albet70 quits (~xxx@2400:8902::f03c:92ff:fe60:98d8) (Remote host closed the connection) |
| 01:17:14 | → | albet70 joins (~xxx@2400:8902::f03c:92ff:fe60:98d8) |
| 01:18:24 | → | merijn joins (~merijn@c-001-001-006.client.esciencecenter.eduvpn.nl) |
| 01:28:15 | → | talismanick joins (~user@2601:204:ef80:6c80::a8e2) |
| 01:39:25 | × | mei quits (~mei@user/mei) (Ping timeout: 240 seconds) |
| 01:49:52 | × | zeenk quits (~zeenk@2a02:2f04:a20f:5200::7fe) (Quit: Konversation terminated!) |
| 01:51:44 | × | merijn quits (~merijn@c-001-001-006.client.esciencecenter.eduvpn.nl) (Ping timeout: 246 seconds) |
| 01:53:10 | × | [itchyjunk] quits (~itchyjunk@user/itchyjunk/x-7353470) (Ping timeout: 250 seconds) |
| 01:57:31 | → | [itchyjunk] joins (~itchyjunk@user/itchyjunk/x-7353470) |
| 02:18:39 | → | bratwurst joins (~dfadsva@2604:3d09:207f:f650::9c24) |
| 02:18:48 | × | tremon quits (~tremon@83.80.159.219) (Quit: getting boxed in) |
| 02:24:52 | → | mei joins (~mei@user/mei) |
| 02:28:27 | → | Digitteknohippie joins (~user@user/digit) |
| 02:28:43 | × | wroathe quits (~wroathe@user/wroathe) (Ping timeout: 276 seconds) |
| 02:29:54 | × | Digit quits (~user@user/digit) (Ping timeout: 249 seconds) |
| 02:32:45 | × | xff0x quits (~xff0x@ai098135.d.east.v6connect.net) (Ping timeout: 240 seconds) |
| 02:38:34 | × | shailangsa quits (~shailangs@host165-120-169-78.range165-120.btcentralplus.com) () |
| 02:42:16 | Digitteknohippie | is now known as Digit |
| 02:43:19 | → | bilegeek joins (~bilegeek@2600:1008:b013:d54f:9ec2:2bf5:4c41:2e9b) |
| 02:48:20 | → | jludwig joins (~justin@li657-110.members.linode.com) |
| 02:51:25 | → | finn_elija joins (~finn_elij@user/finn-elija/x-0085643) |
| 02:51:25 | × | FinnElija quits (~finn_elij@user/finn-elija/x-0085643) (Killed (NickServ (Forcing logout FinnElija -> finn_elija))) |
| 02:51:25 | finn_elija | is now known as FinnElija |
| 02:53:01 | × | bratwurst quits (~dfadsva@2604:3d09:207f:f650::9c24) (Ping timeout: 252 seconds) |
| 02:53:45 | × | td_ quits (~td@i5387093d.versanet.de) (Ping timeout: 255 seconds) |
| 02:55:20 | → | td_ joins (~td@i53870937.versanet.de) |
| 03:00:11 | × | [itchyjunk] quits (~itchyjunk@user/itchyjunk/x-7353470) (Read error: Connection reset by peer) |
| 03:02:04 | × | jero98772 quits (~jero98772@2800:484:1d84:9000::2) (Remote host closed the connection) |
| 03:02:06 | → | merijn joins (~merijn@c-001-001-006.client.esciencecenter.eduvpn.nl) |
| 03:26:13 | → | gemmaro joins (~user@240f:74:d1f0:1:ba1:e787:c9e:b1dc) |
| 03:29:27 | → | nate1 joins (~nate@98.45.169.16) |
| 03:31:31 | × | merijn quits (~merijn@c-001-001-006.client.esciencecenter.eduvpn.nl) (Ping timeout: 252 seconds) |
| 03:32:45 | × | thegeekinside quits (~thegeekin@189.180.38.222) (Ping timeout: 240 seconds) |
| 03:34:15 | × | nate1 quits (~nate@98.45.169.16) (Ping timeout: 253 seconds) |
| 04:15:57 | → | Guest|52 joins (~Guest|52@pool-128-6-37-193.nat.rutgers.edu) |
| 04:24:10 | → | trev joins (~trev@user/trev) |
| 04:25:39 | × | bilegeek quits (~bilegeek@2600:1008:b013:d54f:9ec2:2bf5:4c41:2e9b) (Quit: Leaving) |
| 04:35:51 | × | Guest|52 quits (~Guest|52@pool-128-6-37-193.nat.rutgers.edu) (Quit: Connection closed) |
| 04:46:36 | → | merijn joins (~merijn@c-001-001-006.client.esciencecenter.eduvpn.nl) |
| 04:53:01 | × | merijn quits (~merijn@c-001-001-006.client.esciencecenter.eduvpn.nl) (Ping timeout: 276 seconds) |
| 05:12:38 | → | czy joins (~user@host-140-24.ilcub310.champaign.il.us.clients.pavlovmedia.net) |
| 05:27:30 | × | monochrom quits (trebla@216.138.220.146) (Quit: NO CARRIER) |
| 05:31:41 | → | harveypwca joins (~harveypwc@2601:246:c180:a570:3828:d8:e523:3f67) |
| 05:42:40 | → | takuan joins (~takuan@178-116-218-225.access.telenet.be) |
| 05:43:47 | × | takuan quits (~takuan@178-116-218-225.access.telenet.be) (Read error: Connection reset by peer) |
| 05:44:35 | → | monochrom joins (trebla@216.138.220.146) |
| 05:45:54 | → | takuan joins (~takuan@178-116-218-225.access.telenet.be) |
| 05:46:07 | → | takuan_dozo joins (~takuan@178-116-218-225.access.telenet.be) |
| 05:46:07 | × | hugo- quits (znc@verdigris.lysator.liu.se) (Ping timeout: 244 seconds) |
| 05:46:34 | × | takuan_dozo quits (~takuan@178-116-218-225.access.telenet.be) (Write error: Connection reset by peer) |
| 05:47:01 | → | nate1 joins (~nate@98.45.169.16) |
| 05:47:14 | → | hugo joins (znc@verdigris.lysator.liu.se) |
| 05:52:10 | × | nate1 quits (~nate@98.45.169.16) (Ping timeout: 276 seconds) |
| 05:53:53 | → | tibamita joins (~reidiens@2600:1700:fba0:abe0::22) |
| 05:53:59 | <tibamita> | hey gang |
| 05:54:09 | <tibamita> | i'm trying to learn haskell |
| 05:54:23 | <tibamita> | any tips or tricks for a newbie ? |
| 05:54:28 | <tibamita> | i hear haskell's weird |
| 05:54:56 | <geekosaur> | "weird" compared to what? |
| 05:55:32 | <geekosaur> | it is certainly not simly python or javascript with makeup 🙂 |
| 05:55:41 | <tibamita> | to other languages ? idk |
| 05:55:48 | <tibamita> | i come from a C/C++ background |
| 05:57:17 | <geekosaur> | anyway the haskell wikibook is pretty good |
| 05:57:22 | <geekosaur> | @where wikibook |
| 05:57:23 | <lambdabot> | http://en.wikibooks.org/wiki/Haskell |
| 06:00:50 | <tibamita> | gee whiz that's neat! |
| 06:00:53 | <tibamita> | thank you |
| 06:05:09 | <geekosaur> | be prepared for your brain to explode 🙂 (in a good way) |
| 06:05:41 | <geekosaur> | haskell is indeed fairly different from other languages. the combination of IO and laziness will take you a while to get used to |
| 06:05:44 | <tibamita> | im So Ready |
| 06:07:19 | <tibamita> | is all haskell programming done in ghci ? |
| 06:08:30 | <tibamita> | bcuz if so ... what the deuce |
| 06:11:59 | <geekosaur> | ghci is somewhere between a debugger and an interactive desk calculator |
| 06:12:05 | <geekosaur> | mostly we program in editors |
| 06:12:31 | <geekosaur> | (in particular there's no way to save your work in ghci, at least not yet) |
| 06:13:14 | <geekosaur> | I personally use vscode with the haskell extension for editing |
| 06:13:33 | <tibamita> | ok thank goodness |
| 06:13:46 | <tibamita> | programming in that thing would've been a nightmare |
| 06:15:04 | <geekosaur> | yeh, nobody's asking you to do that |
| 06:15:45 | <geekosaur> | but haskell modes for editors can evaluate code snippets and such, it's much nicer than ghci |
| 06:16:05 | → | merijn joins (~merijn@c-001-001-006.client.esciencecenter.eduvpn.nl) |
| 06:24:05 | × | jle` quits (~jle`@cpe-23-240-75-236.socal.res.rr.com) (Ping timeout: 240 seconds) |
| 06:27:15 | → | jle` joins (~jle`@cpe-23-240-75-236.socal.res.rr.com) |
| 06:29:17 | × | tibamita quits (~reidiens@2600:1700:fba0:abe0::22) (Quit: Leaving) |
| 06:45:32 | × | califax quits (~califax@user/califx) (Remote host closed the connection) |
| 06:46:39 | → | califax joins (~califax@user/califx) |
| 06:49:31 | × | merijn quits (~merijn@c-001-001-006.client.esciencecenter.eduvpn.nl) (Ping timeout: 252 seconds) |
| 06:53:47 | × | werneta quits (~werneta@70-142-214-115.lightspeed.irvnca.sbcglobal.net) (Ping timeout: 246 seconds) |
| 06:55:38 | → | werneta joins (~werneta@70-142-214-115.lightspeed.irvnca.sbcglobal.net) |
| 07:08:12 | → | falafel joins (~falafel@2603-8000-d700-115c-03fc-7660-2ab5-66fe.res6.spectrum.com) |
| 07:24:21 | → | gurkenglas joins (~gurkengla@dynamic-089-204-130-021.89.204.130.pool.telefonica.de) |
| 07:25:46 | <jade[m]> | I program fairly much in ghci when developing, mainly testing out expressions before copying them into the editor |
| 07:27:21 | <jade[m]> | but im also a newbie, so what do I know 😆 |
| 07:27:43 | <fr33domlover> | c_wraith: Why wouldn't you use use acid-state under any circumstances? What would you use instead? (whether it's a single database or many small ones; both are possible for me and I haven't yet determined what's better :p) |
| 07:30:31 | <fr33domlover> | somerandomnick[m: Replying to "from my experience in GHC 8, `readMVar` is already very efficient, although atomic": MVar doesn't have built-in disk persistence and version control/migration |
| 07:35:28 | <geekosaur> | the problem with acid-state is that it is not acid, and its migration is broken |
| 07:37:15 | → | mokee joins (~mokee@37.228.215.215) |
| 07:47:55 | → | _ht joins (~Thunderbi@28-52-174-82.ftth.glasoperator.nl) |
| 07:51:23 | → | acidjnk_new joins (~acidjnk@p200300d6e715c468b4bf77e5a0595f20.dip0.t-ipconnect.de) |
| 07:53:12 | → | merijn joins (~merijn@86-86-29-250.fixed.kpn.net) |
| 07:57:12 | × | harveypwca quits (~harveypwc@2601:246:c180:a570:3828:d8:e523:3f67) (Quit: Leaving) |
| 07:57:57 | <[exa]> | jade[m]: after like 25 years of coding I'm actually doing the same, it's the only thing that works kinda reliably over time :D |
| 07:58:24 | <jade[m]> | haha great |
| 08:00:27 | → | gnalzo joins (~gnalzo@2a01:e0a:498:fd50:fcc6:bb5d:489a:ce8c) |
| 08:02:37 | <[exa]> | kinda wondering, is there any unixy tool that would pool 2 inputs into a single REPL? Like, have vim/emacs scripted to paste a line into a running interpreter, while also allowing the interpreter to take keyboard input |
| 08:03:05 | → | azimut joins (~azimut@gateway/tor-sasl/azimut) |
| 08:03:56 | → | Ou42 joins (~Ou4242a@2600:1700:e930:41b0:274c:69e5:6061:cb5) |
| 08:03:57 | <jade[m]> | sounds like something tmux could do? |
| 08:04:29 | <[exa]> | yeah I wonder |
| 08:04:55 | <[exa]> | except it doesn't seem quite like a tmux thing, it should be _much_ easiler |
| 08:05:20 | <Ou42> | hello. I'm trying to do simple(?) profiling via ghci, but $ ghci -fexternal-interpreter -prof, returns w/ an error ... |
| 08:05:25 | <Ou42> | "Perhaps you haven't installed the profiling libraries for package ‘ghc-prim-0.5.3’?" |
| 08:05:50 | <jade[m]> | [exa]: I guess vim can do stuff like this itself using integrated terninals? |
| 08:05:58 | <jade[m]> | no idea about emacs |
| 08:06:18 | <Ou42> | and in case this is an X-Y prob: I'm trying to go thru, <https://wiki.haskell.org/Foldr_Foldl_Foldl'> but the very first example doesn't SO like it's supposed to. |
| 08:06:41 | <[exa]> | jade[m]: hm true |
| 08:07:05 | <[exa]> | lemme try then |
| 08:08:35 | <jade[m]> | https://stackoverflow.com/questions/4878980/vim-insert-selected-text-into-command-line |
| 08:08:48 | <jade[m]> | If I read this correctly it's already something that is built in |
| 08:09:26 | <[exa]> | oh lovely |
| 08:19:08 | <Ou42> | I tried, "$ cabal install --enable-library-profiling --force-reinstall --lib ghc-prim" w/ and w/o the -0.5.3 and it doesn't error out, but it doesn't work. same error when trying to launch ghci |
| 08:23:01 | × | mokee quits (~mokee@37.228.215.215) (Quit: Lost terminal) |
| 08:30:17 | × | zaquest quits (~notzaques@5.130.79.72) (Remote host closed the connection) |
| 08:30:19 | <[exa]> | jade[m]: ok that fixed it for me, thanks for pushing in the right direction :D |
| 08:30:22 | → | Tuplanolla joins (~Tuplanoll@91-159-68-236.elisa-laajakaista.fi) |
| 08:30:41 | <Ou42> | ":set +s" shows (0.01 secs, 29,904 bytes) for both "try1" and "try2" :thinking: ghci 8.8.4 |
| 08:31:08 | × | eggplantade quits (~Eggplanta@2600:1700:38c5:d800:6cda:c72d:6503:1251) (Remote host closed the connection) |
| 08:31:25 | × | foul_owl quits (~kerry@94.140.8.139) (Ping timeout: 240 seconds) |
| 08:33:20 | → | zaquest joins (~notzaques@5.130.79.72) |
| 08:38:16 | → | jpds1 joins (~jpds@gateway/tor-sasl/jpds) |
| 08:38:17 | × | L29Ah quits (~L29Ah@wikipedia/L29Ah) (Read error: Connection reset by peer) |
| 08:39:44 | × | jpds quits (~jpds@gateway/tor-sasl/jpds) (Ping timeout: 240 seconds) |
| 08:44:15 | → | L29Ah joins (~L29Ah@wikipedia/L29Ah) |
| 08:44:24 | <probie> | Ou42: by default, a program compiled by modern versions of GHC will dynamically grow a thread's stack until it takes up to 80% of physical memory |
| 08:45:38 | → | foul_owl joins (~kerry@45.143.82.151) |
| 08:46:07 | <probie> | Try running ghci with something like `ghci +RTS -K1M` |
| 08:46:12 | <Ou42> | probie: tyvm for the reply! |
| 08:47:00 | → | alexherbo2 joins (~alexherbo@2a02-842a-8180-4601-85e1-23ae-ea70-6ae4.rev.sfr.net) |
| 08:47:52 | <Ou42> | :thinking: should the wiki page be updated to reflect this? if so, how? |
| 08:48:17 | × | falafel quits (~falafel@2603-8000-d700-115c-03fc-7660-2ab5-66fe.res6.spectrum.com) (Ping timeout: 250 seconds) |
| 08:49:39 | <Ou42> | before `ghci +RTS -K1M` (try1,try2,try3) == "((0.01 secs, 29,904 bytes),(0.01 secs, 29,904 bytes),(0.95 secs, 256,062,784 bytes))" |
| 08:50:33 | <Ou42> | after == (SO, SO, (0.95 secs, 256,062,784 bytes)) -- forgot, w/ `:set +s` |
| 08:51:19 | <Ou42> | probie: TYVM. appreciate it. now I can catch some sweet Z's. g'nite. |
| 08:52:26 | × | alexherbo2 quits (~alexherbo@2a02-842a-8180-4601-85e1-23ae-ea70-6ae4.rev.sfr.net) (Remote host closed the connection) |
| 08:52:54 | → | alexherbo2 joins (~alexherbo@2a02-842a-8180-4601-85e1-23ae-ea70-6ae4.rev.sfr.net) |
| 08:53:26 | × | bitdex quits (~bitdex@gateway/tor-sasl/bitdex) (Remote host closed the connection) |
| 08:53:51 | × | alexherbo2 quits (~alexherbo@2a02-842a-8180-4601-85e1-23ae-ea70-6ae4.rev.sfr.net) (Remote host closed the connection) |
| 08:54:16 | → | alexherbo2 joins (~alexherbo@2a02-842a-8180-4601-85e1-23ae-ea70-6ae4.rev.sfr.net) |
| 08:54:34 | → | bitdex joins (~bitdex@gateway/tor-sasl/bitdex) |
| 08:56:59 | × | merijn quits (~merijn@86-86-29-250.fixed.kpn.net) (Ping timeout: 246 seconds) |
| 08:57:13 | × | econo quits (uid147250@user/econo) (Quit: Connection closed for inactivity) |
| 08:58:39 | → | Inst_ joins (~Inst@2601:6c4:4081:54f0:317f:532d:86fb:4a08) |
| 09:00:08 | × | JoseMariaLanda[m quits (~josemaria@2001:470:69fc:105::3:392b) (Quit: You have been kicked for being idle) |
| 09:06:09 | → | coot joins (~coot@2a02:a310:e241:1b00:ec1a:e9df:79ac:66ba) |
| 09:08:40 | → | accord joins (uid568320@id-568320.hampstead.irccloud.com) |
| 09:09:32 | × | Ou42 quits (~Ou4242a@2600:1700:e930:41b0:274c:69e5:6061:cb5) (Quit: Leaving) |
| 09:15:04 | → | merijn joins (~merijn@c-001-001-006.client.esciencecenter.eduvpn.nl) |
| 09:18:20 | × | jinsl quits (~jinsl@123.120.170.97) (Ping timeout: 246 seconds) |
| 09:18:29 | → | jinsl- joins (~jinsl@2408:8207:2558:8870:211:32ff:fec8:6aea) |
| 09:19:44 | × | merijn quits (~merijn@c-001-001-006.client.esciencecenter.eduvpn.nl) (Ping timeout: 246 seconds) |
| 09:21:09 | × | tzh quits (~tzh@c-24-21-73-154.hsd1.wa.comcast.net) (Quit: zzz) |
| 09:29:24 | → | heraldo joins (~heraldo@user/heraldo) |
| 09:31:58 | → | eggplantade joins (~Eggplanta@2600:1700:38c5:d800:d4d0:8bd2:d805:7ab6) |
| 09:36:39 | × | eggplantade quits (~Eggplanta@2600:1700:38c5:d800:d4d0:8bd2:d805:7ab6) (Ping timeout: 265 seconds) |
| 09:45:59 | × | Sgeo quits (~Sgeo@user/sgeo) (Write error: Connection reset by peer) |
| 09:47:54 | <fr33domlover> | geekosaur: Can you say more? The docs and repo make a positive impression so I worry I missed something... and what do I use instead? Are there other Haskell-ish options? Or do I just use SQLite/PostgreSQL/etc. |
| 09:48:35 | → | nate1 joins (~nate@98.45.169.16) |
| 09:50:53 | → | wootehfoot joins (~wootehfoo@user/wootehfoot) |
| 09:53:32 | × | nate1 quits (~nate@98.45.169.16) (Ping timeout: 252 seconds) |
| 09:53:42 | ← | L29Ah parts (~L29Ah@wikipedia/L29Ah) () |
| 10:01:21 | → | Maeda joins (~Maeda@91-161-10-149.subs.proxad.net) |
| 10:08:11 | → | jpds2 joins (~jpds@gateway/tor-sasl/jpds) |
| 10:09:20 | → | [itchyjunk] joins (~itchyjunk@user/itchyjunk/x-7353470) |
| 10:11:20 | × | jpds1 quits (~jpds@gateway/tor-sasl/jpds) (Ping timeout: 240 seconds) |
| 10:13:21 | × | heraldo quits (~heraldo@user/heraldo) (Quit: heraldo) |
| 10:16:08 | → | zeenk joins (~zeenk@2a02:2f04:a20f:5200::7fe) |
| 10:19:08 | → | kuribas joins (~user@ptr-17d51enwg0abanf4ox8.18120a2.ip6.access.telenet.be) |
| 10:20:11 | <kuribas> | I am trying to prove some properties in idris, but I find it incredibly tedious having to search for trivial proofs. Are there language which have better tooling, to automatic trivial proofs, maybe do proofs search or use an smt solver? |
| 10:24:31 | × | shriekingnoise quits (~shrieking@186.137.175.87) (Ping timeout: 276 seconds) |
| 10:30:07 | × | gmg quits (~user@user/gehmehgeh) (Remote host closed the connection) |
| 10:30:52 | → | gmg joins (~user@user/gehmehgeh) |
| 10:32:08 | → | xff0x joins (~xff0x@fsa056e3ab.kytj202.ap.nuro.jp) |
| 10:33:49 | × | puke quits (~puke@user/puke) (Quit: puke) |
| 10:35:45 | × | pyook quits (~puke@user/puke) (Ping timeout: 240 seconds) |
| 10:40:01 | → | Guest7013 joins (~Guest70@2604:4080:11a5:8050:3823:f4c5:f08a:7b71) |
| 10:44:42 | → | merijn joins (~merijn@c-001-001-006.client.esciencecenter.eduvpn.nl) |
| 10:45:15 | → | pyook joins (~puke@user/puke) |
| 10:52:37 | <Guest7013> | hi all, i'm working through the nicta/system-f course and i'm a bit stuck on the very last part of Applicative |
| 10:52:50 | <Guest7013> | i'm supposed to implement "filtering", which i think is filterM? |
| 10:53:02 | <Guest7013> | i've tried to translate my attempt back into usual haskell: https://paste.tomsmeding.com/lOde3S5Z |
| 10:53:13 | <Guest7013> | i'm not exactly sure why the first attempt doesn't work |
| 10:54:01 | <Guest7013> | for simple applicatives it works, but e.g. for lists, it seems to be generating an extra layer of applicative effects? |
| 10:54:24 | × | coot quits (~coot@2a02:a310:e241:1b00:ec1a:e9df:79ac:66ba) (Quit: coot) |
| 10:55:16 | → | JScript joins (~JScript@144.48.39.18) |
| 10:55:21 | × | JScript quits (~JScript@144.48.39.18) (Max SendQ exceeded) |
| 10:55:48 | → | JScript joins (~JScript@144.48.39.18) |
| 10:55:52 | × | JScript quits (~JScript@144.48.39.18) (Max SendQ exceeded) |
| 10:56:22 | <Guest7013> | my reasoning was: we need to use (f x) to determine whether to "keep" x or not. if x doesn't pass the filter, we just keep acc, otherwise we need to prepend x and fmap (x : ) acc does that |
| 10:56:25 | × | pyook quits (~puke@user/puke) (Ping timeout: 240 seconds) |
| 10:57:39 | <ski> | using `liftA3', you're effectively calling recursively twice |
| 10:58:06 | <ski> | (you could try inlining `foldr' to see what's happening, if you want to) |
| 10:59:03 | → | JScript joins (~JScript@144.48.39.18) |
| 10:59:11 | × | JScript quits (~JScript@144.48.39.18) (Max SendQ exceeded) |
| 11:00:37 | <Guest7013> | oh so if i write |
| 11:00:52 | <ski> | filterM f (x:xs) = liftA3 bool (filterM f xs) (fmap (x :) (filterM f xs)) (f x) |
| 11:00:56 | <ski> | vs. |
| 11:01:00 | <ski> | filterM f (x:xs) = liftA2 (bool id (x :)) (f x) (filterM f xs) |
| 11:01:24 | <ski> | (you'll also notice that the ordering of effects, apart from the duplication of effects), is different) |
| 11:01:37 | <Guest7013> | g x acc = liftA2 (bool id (x :)) (f x) acc then i'm using the "effects" in acc once, but my failed attempt uses it twice, once in the "true" argment, once in the "false" argument |
| 11:02:02 | <ski> | yes |
| 11:03:15 | <ski> | for lists, using the effects twice means effectively that you have two nested loops, looping through the list (coming from the recursive call), instead of one nested loop (in addition to one coming from `f x') |
| 11:05:38 | <Guest7013> | hmm |
| 11:05:46 | <Guest7013> | the counting effects bit makes sense but |
| 11:06:13 | <Guest7013> | i still find it unintuitive that the right thing to do is to pick the function i want to lift over the accumulator rather than just picking the end state of the accumulator |
| 11:06:45 | <Guest7013> | (i'm using "state" loosely here) |
| 11:07:01 | → | tremon joins (~tremon@83.80.159.219) |
| 11:08:39 | <ski> | point is that you're not just picking the end state of the accumulator, when using `liftA3' there, you're regenerating it, twice, and then throwing away one end result in favor of the other |
| 11:09:05 | × | totbwf quits (sid402332@id-402332.uxbridge.irccloud.com) (Quit: Connection closed for inactivity) |
| 11:09:11 | <Guest7013> | oh that's a good way of putting it |
| 11:09:16 | → | pyook joins (~puke@user/puke) |
| 11:09:28 | <Guest7013> | i guess i was vaguely thinking that laziness meant i wouldn't actually generate both |
| 11:09:29 | <ski> | (and since you're doing this recursively, you're doing this in a binary tree, so you actually have an exponential explosion of reexecuted effects) |
| 11:09:44 | <ski> | (s/binary tree/binary calling tree/) |
| 11:09:45 | <Guest7013> | but no, i'm lifting the applicative part so that happens regardless |
| 11:10:58 | <Guest7013> | i guess also for the non-applicative version of filter the two approaches are actually equivalent and i tried starting from that and then adding the applicative layer |
| 11:11:06 | <Guest7013> | but i needed to start with the other version |
| 11:11:17 | <ski> | yea, non-strictness is irrelevant here. list monad is strict in the sense that all the effects you specify happen at the place you specify them. (although, it is non-strict, in the sense that you can extract as many or as few results as you want, and the remaining ones won't be computed unless/until you ask for them) |
| 11:11:32 | → | coot joins (~coot@2a02:a310:e241:1b00:ec1a:e9df:79ac:66ba) |
| 11:12:05 | <ski> | for "non-applicative version of filter", you mean the plain `filter :: (a -> Bool) -> [a] -> [a]' ? |
| 11:12:08 | <Guest7013> | yeah |
| 11:12:13 | <ski> | right |
| 11:12:47 | <Guest7013> | okay cool, i think this all makes a lot more sense now |
| 11:13:11 | <Guest7013> | i've mostly been able to stick to the mantra of "just follow the types" and i think this is the first case where it's failed me :( |
| 11:13:27 | <ski> | btw, in a monadic version, you could first run the test on the element, and then use the intermediate result of that to decide what to do next. .. but applicative effects can't do that, can't use intermediate results to decide which effects to perform next |
| 11:13:43 | <ski> | applicative effects are "static", and monadic effects are "dynamic", in this sense |
| 11:13:53 | <Guest7013> | right |
| 11:14:22 | × | coot quits (~coot@2a02:a310:e241:1b00:ec1a:e9df:79ac:66ba) (Client Quit) |
| 11:14:56 | <ski> | (in this particular case, it doesn't matter too much, since in both cases you still want to "continue with the same thing, on the remainder of the list", and then merely *maybe* add the element on top of that, but *not* decide to run some effect or not (which applicative can't do)) |
| 11:15:54 | <ski> | one nice illustration of this is parsers. if you want to parse a number, and then want to parse that many items, then you must use a monadic parser |
| 11:16:14 | <ski> | another illustration : |
| 11:16:15 | <ski> | @where applicative-vs-monadic |
| 11:16:16 | <lambdabot> | "Applicative vs Monadic build systems" by ndm in 2014-07-23 at <https://neilmitchell.blogspot.se/2014/07/applicative-vs-monadic-build-systems.html>. (cf. "static sequencing" vs. "dynamic sequencing") |
| 11:17:42 | <Guest7013> | okay, back to these exercises |
| 11:17:48 | <Guest7013> | thanks for all your help, ski! |
| 11:17:56 | <ski> | (in an applicative build system, the build system makes a complete build plan first, and then executes it. some run-time build result can't influence what the build system will try building next. a monadic one can build part of the build plan at run-time, though) |
| 11:18:01 | → | shailangsa joins (~shailangs@host165-120-169-78.range165-120.btcentralplus.com) |
| 11:18:02 | <ski> | np |
| 11:18:08 | → | JScript joins (~JScript@144.48.39.18) |
| 11:18:10 | × | Guest7013 quits (~Guest70@2604:4080:11a5:8050:3823:f4c5:f08a:7b71) (Quit: Client closed) |
| 11:18:11 | × | JScript quits (~JScript@144.48.39.18) (Max SendQ exceeded) |
| 11:18:45 | × | merijn quits (~merijn@c-001-001-006.client.esciencecenter.eduvpn.nl) (Ping timeout: 240 seconds) |
| 11:19:39 | → | JScript joins (~JScript@144.48.39.18) |
| 11:19:49 | × | JScript quits (~JScript@144.48.39.18) (Max SendQ exceeded) |
| 11:21:11 | → | Joao003 joins (~Joao003@2804:840:8311:b700:e035:773e:85f2:c516) |
| 11:23:03 | → | JScript joins (~JScript@144.48.39.18) |
| 11:23:25 | × | JScript quits (~JScript@144.48.39.18) (Max SendQ exceeded) |
| 11:23:57 | → | JScript joins (~JScript@144.48.39.18) |
| 11:24:02 | × | JScript quits (~JScript@144.48.39.18) (Max SendQ exceeded) |
| 11:26:27 | → | JScript joins (~JScript@144.48.39.18) |
| 11:26:31 | × | JScript quits (~JScript@144.48.39.18) (Max SendQ exceeded) |
| 11:28:53 | <Joao003> | Nothing happening in the channel right now |
| 11:29:41 | <ski> | that's nothing unusual |
| 11:30:05 | → | JScript joins (~JScript@144.48.39.18) |
| 11:30:08 | × | JScript quits (~JScript@144.48.39.18) (Max SendQ exceeded) |
| 11:31:23 | <Joao003> | Why is this same guy joining and quitting over and over |
| 11:31:50 | <ski> | they accidentally pasted many lines, in some channel or in PM with someone |
| 11:32:01 | <Joao003> | oh |
| 11:32:52 | × | Maeda quits (~Maeda@91-161-10-149.subs.proxad.net) (Quit: leaving) |
| 11:33:00 | <Joao003> | ((->) r) is a monad, right? |
| 11:33:15 | → | JScript joins (~JScript@144.48.39.18) |
| 11:33:25 | <probie> | Yes. It is the reader monad (just without a newtype) |
| 11:33:44 | <ski> | environment/input/reader monad |
| 11:34:21 | × | alexherbo2 quits (~alexherbo@2a02-842a-8180-4601-85e1-23ae-ea70-6ae4.rev.sfr.net) (Remote host closed the connection) |
| 11:34:45 | <Joao003> | So if the monad used in `ap` is ((->) r), then `ap`'s type signature is `(r -> a -> b) -> (r -> a) -> r -> b`, which is the same one of the S combinator |
| 11:35:24 | <ski> | yes |
| 11:35:30 | <Joao003> | And indeed, |
| 11:35:38 | <Joao003> | > ap (+) (*2) 3 |
| 11:35:39 | <lambdabot> | 9 |
| 11:35:43 | <Joao003> | It is. |
| 11:35:59 | <ski> | (and what about `ask',`return' and `(=<<)' ?) |
| 11:37:32 | <yushyin> | i have a dejavu ^^ |
| 11:38:06 | <Joao003> | (=<<) also works? |
| 11:38:20 | <Joao003> | > ((+) =<< (*2)) 3 |
| 11:38:22 | <ski> | "works" ? |
| 11:38:22 | <lambdabot> | 9 |
| 11:38:47 | → | alexherbo2 joins (~alexherbo@2a02-842a-8180-4601-85e1-23ae-ea70-6ae4.rev.sfr.net) |
| 11:42:22 | <Joao003> | > ap (-) (*2) 3 -- Should be -3 |
| 11:42:23 | <lambdabot> | -3 |
| 11:42:53 | <Joao003> | > ((-) =<< (*2)) 3 -- Wait... |
| 11:42:55 | <lambdabot> | 3 |
| 11:43:16 | <Joao003> | > ((flip (-)) =<< (*2)) 3 -- I guess it works now |
| 11:43:18 | <lambdabot> | -3 |
| 11:48:55 | <ncf> | the only difference between >>= and <*> is a -> f b vs. f (a -> b), and if f is ((->) r) then the difference is `flip` |
| 11:49:28 | <Joao003> | > ((*2) <*> (-)) 3 |
| 11:49:29 | <lambdabot> | error: |
| 11:49:29 | <lambdabot> | • Occurs check: cannot construct the infinite type: |
| 11:49:29 | <lambdabot> | a0 ~ (a0 -> a0) -> t |
| 11:49:33 | <Joao003> | wut |
| 11:50:20 | <probie> | > ((-) <*> (*2)) 3 |
| 11:50:21 | <lambdabot> | -3 |
| 11:50:27 | → | titibandit joins (~titibandi@user/titibandit) |
| 11:51:14 | <ncf> | oh yeah, i should have said between =<< and <*> |
| 11:51:39 | <ski> | well .. the difference is `flip' |
| 11:51:47 | <ncf> | right, a different one :) |
| 11:52:32 | <ski> | reminds me of the old days of `flip :: Functor f => f (a -> b) -> (a -> f b)' in lambdabot |
| 11:52:36 | → | Inst__ joins (~Inst@2601:6c4:4081:54f0:9027:6f4:a9a6:93a0) |
| 11:52:42 | <Hecate> | 31 |
| 11:53:01 | <ski> | 127 |
| 11:53:23 | <Hecate> | kuribas: I believe Isabelle has a repo of proofs |
| 11:53:32 | <Hecate> | ski: 👋 |
| 11:54:00 | → | mc47 joins (~mc47@xmonad/TheMC47) |
| 11:54:00 | <Joao003> | Just found out that liftM2 works exactly like APL's fork thingy (a.k.a. passing a value through two unary functions and then passing the result of that to a binary function) |
| 11:54:20 | <Joao003> | If the instance used is (->) r |
| 11:54:23 | → | yaxu joins (~yaxu@host-78-148-247-238.as13285.net) |
| 11:54:54 | <ski> | (or `liftA2') |
| 11:54:54 | <yaxu> | Hi all, I'm confused about something.. |
| 11:54:59 | <gry> | ? |
| 11:55:18 | <yaxu> | Say I have a function like this: withShortest f a b | length a > length b = (f a, b) |
| 11:55:18 | <yaxu> | | length a < length b = (a, f b) |
| 11:55:19 | <yaxu> | | otherwise = (a, b) |
| 11:55:27 | ski | looks quizzically at Hecate |
| 11:55:49 | <yaxu> | it has a type: withShortest :: Foldable t => (t a -> t a) -> t a -> t a -> (t a, t a) |
| 11:55:56 | × | Inst_ quits (~Inst@2601:6c4:4081:54f0:317f:532d:86fb:4a08) (Ping timeout: 250 seconds) |
| 11:56:54 | <Joao003> | What's your problem? |
| 11:57:01 | <yaxu> | I don't see why the lists can't contain different types. |
| 11:57:21 | × | bjobjo quits (~bjobjo@user/bjobjo) (Quit: leaving) |
| 11:57:31 | <yaxu> | like, why can't I have: withShortest reverse [1, 2, 3] ["a", "b"] |
| 11:57:33 | <ski> | because `f' is not polymorphic |
| 11:57:34 | <Joao003> | Because your pair can contain unapplied lists or applied lists, so both need to be of the same type |
| 11:57:39 | <ski> | you could say |
| 11:57:59 | <ski> | withShortest :: Foldable t => (forall x. t x -> t x) -> t a -> t b -> (t a,t b) |
| 11:58:19 | <ski> | (you'll need to enable `Rank2Types' (or `RankNTypes') language extension) |
| 11:59:40 | <ski> | however, higher-rank types can't be inferred, so you must give an explicit type signature |
| 11:59:58 | <ski> | (well, rank-2 types could technically be inferred. but GHC doesn't try) |
| 12:00:02 | <yaxu> | aha thanks! yes I see the (more general?) type isn't inferred still |
| 12:00:11 | <ski> | see ^ |
| 12:01:42 | × | gawen quits (~gawen@user/gawen) (Quit: cya) |
| 12:02:01 | <ncf> | note that your function might evaluate length a and length b twice needlessly |
| 12:02:15 | <ncf> | :t comparing length |
| 12:02:16 | <lambdabot> | Foldable t => t a -> t a -> Ordering |
| 12:02:58 | <ski> | you could even determine the comparision without forcing the longer one of the lists fully |
| 12:06:47 | × | gnalzo quits (~gnalzo@2a01:e0a:498:fd50:fcc6:bb5d:489a:ce8c) (Quit: WeeChat 3.8) |
| 12:07:59 | <yaxu> | fair point, the actual data structure I am working with is more complex so worth optimising that comparison.. |
| 12:08:23 | <yaxu> | also I have the < and > the wrong way around ;) |
| 12:08:32 | <ski> | even for lists it can be worth it |
| 12:09:16 | <ski> | oh, it wasn't short for `withShortestUnchanged' ? ;) |
| 12:09:56 | <yaxu> | heh |
| 12:10:02 | → | gawen joins (~gawen@user/gawen) |
| 12:10:42 | <Joao003> | What about `applyShortest`? |
| 12:13:29 | <yaxu> | you prefer that? I quite like 'with' |
| 12:13:43 | × | gurkenglas quits (~gurkengla@dynamic-089-204-130-021.89.204.130.pool.telefonica.de) (Ping timeout: 276 seconds) |
| 12:13:48 | × | mc47 quits (~mc47@xmonad/TheMC47) (Remote host closed the connection) |
| 12:16:17 | ski | . o O ( `withoutLongest' ) |
| 12:16:45 | <ncf> | make it shortest :: Lens' (t a, t a) (t a) and be done with the bikeshedding |
| 12:16:57 | <ncf> | (ok, that's not a lawful lens...) |
| 12:17:33 | <yaxu> | I've not been able to get my head around lenses.. |
| 12:18:12 | <jade[m]> | me neither :c |
| 12:20:10 | → | Vq_ joins (~vq@90-227-195-9-no77.tbcn.telia.com) |
| 12:20:16 | → | hpc_ joins (~juzz@ip98-169-35-163.dc.dc.cox.net) |
| 12:20:22 | → | barrucad1 joins (~barrucadu@carcosa.barrucadu.co.uk) |
| 12:23:18 | → | xff0x_ joins (~xff0x@fsa056e3ab.kytj202.ap.nuro.jp) |
| 12:23:22 | → | drlkf_ joins (~drlkf@192.184.163.34.bc.googleusercontent.com) |
| 12:23:23 | → | ridcully_ joins (~ridcully@p57b52f2c.dip0.t-ipconnect.de) |
| 12:24:20 | → | dfordivam1 joins (~dfordivam@tk2-219-19469.vs.sakura.ne.jp) |
| 12:26:02 | → | cyphase_eviltwin joins (~cyphase@user/cyphase) |
| 12:27:46 | <Joao003> | What is a Lens? Never seen one |
| 12:28:03 | <geekosaur> | it's a way to focus on part of a structure |
| 12:28:17 | <Joao003> | Example? |
| 12:29:01 | <geekosaur> | I don't really use complex enough data structures to be that familiar with it; I just know it's there if I ever do need it 🙂 |
| 12:29:09 | → | puke joins (~puke@user/puke) |
| 12:29:12 | <ncf> | _0 :: Lens' (a, b) a |
| 12:29:30 | <Joao003> | ncf: How will you use that? |
| 12:29:39 | <ncf> | lets you get the a out of (a, b) (this is just fst) and *update* the a with a new value to get a new (a, b) |
| 12:30:05 | <ski> | it gives a name for the path from some arbitrary data structure (of a given type) into a particular sub data structure if it (of a particular type) |
| 12:30:45 | → | masterbu1lder joins (~masterbui@user/masterbuilder) |
| 12:30:49 | <ski> | you can also give names to "multiple locations" at the same time. but then you have a traversal or something like that, rather than a plain lens |
| 12:30:56 | <ncf> | Joao003: depends on the library, if we're talking about kmett's lens then you'd use (^.) / view to get the value and (%~) / over to modify it |
| 12:31:10 | → | nitrix_ joins (~nitrix@user/nitrix) |
| 12:31:46 | <ncf> | > (1, 2) & _0 %~ (+ 10) |
| 12:31:50 | <lambdabot> | error: |
| 12:31:50 | <lambdabot> | • Found hole: _0 :: ASetter (Integer, Integer) b Integer Integer |
| 12:31:50 | <lambdabot> | Where: ‘b’ is a rigid type variable bound by |
| 12:31:56 | → | bravespear|2 joins (~Ranhir@157.97.53.139) |
| 12:32:11 | <ncf> | > (1, 2) & _1 %~ (+ 10) |
| 12:32:13 | <lambdabot> | (11,2) |
| 12:32:16 | → | pie__ joins (~pie_bnc@user/pie/x-2818909) |
| 12:32:18 | <ncf> | right, it's 1-indexed |
| 12:32:21 | → | tremon_ joins (~tremon@83.80.159.219) |
| 12:32:22 | → | kawen_ joins (~quassel@static.208.191.216.95.clients.your-server.de) |
| 12:32:25 | → | wagle_ joins (~wagle@quassel.wagle.io) |
| 12:32:27 | → | turlando_ joins (~turlando@user/turlando) |
| 12:32:28 | → | CAT_S_ joins (apic@brezn3.muc.ccc.de) |
| 12:32:29 | <ncf> | > ((1, 2) & _1 %~ (+ 10)) ^. _1 |
| 12:32:31 | <lambdabot> | 11 |
| 12:32:44 | <Joao003> | > (1, 2) & _2 %~ (+ 10) |
| 12:32:46 | <lambdabot> | (1,12) |
| 12:33:02 | → | tv1 joins (~tv@user/tv) |
| 12:34:10 | <ski> | > [Just (0,1),Just (2,3),Nothing,Just (6,7)] & mapped . mapped . _1 %~ (^ 2) |
| 12:34:11 | <lambdabot> | [Just (0,1),Just (4,3),Nothing,Just (36,7)] |
| 12:34:13 | → | canta1 joins (~canta@cvm0.d5k.one) |
| 12:34:53 | <Joao003> | What does mapped do then? |
| 12:34:58 | <ncf> | :t mapped |
| 12:35:00 | <lambdabot> | (Settable f1, Functor f2) => (a -> f1 b) -> f2 a -> f1 (f2 b) |
| 12:35:07 | <ncf> | ok that's confusing |
| 12:35:10 | <ski> | accesses each element of a functor container |
| 12:35:18 | <ncf> | mapped :: Functor f => Lens' (f a) a |
| 12:35:28 | <ncf> | well, Traversal' |
| 12:35:54 | <ski> | the first `mapped' corresponds to the list, the second corresponds to the `Maybe' (accessing the `Just' parts), the `_1' accesses the first components of the pairs |
| 12:36:56 | <Joao003> | > [1..4] & mapped |
| 12:36:58 | <lambdabot> | error: |
| 12:36:58 | <lambdabot> | • Couldn't match type ‘[a0]’ with ‘a -> f1 b’ |
| 12:36:58 | <lambdabot> | Expected type: [a0] -> f a -> f1 (f b) |
| 12:37:09 | <Joao003> | ... |
| 12:37:19 | → | Teacup_ joins (~teacup@user/teacup) |
| 12:37:24 | <ski> | you need to say what to do with the accessed components |
| 12:37:39 | <Joao003> | > [1..4] & mapped . (+1) |
| 12:37:41 | <lambdabot> | error: |
| 12:37:41 | <lambdabot> | • Couldn't match type ‘[a0]’ with ‘a -> f1 b’ |
| 12:37:41 | <lambdabot> | Expected type: [a0] -> f a -> f1 (f b) |
| 12:37:45 | <Joao003> | uh. |
| 12:38:01 | <Joao003> | Trying to replicate earlier code never works. |
| 12:38:04 | × | cyphase quits (~cyphase@user/cyphase) (Excess Flood) |
| 12:39:00 | × | Vq quits (~vq@90-227-195-9-no77.tbcn.telia.com) (Ping timeout: 320 seconds) |
| 12:39:01 | × | hpc quits (~juzz@ip98-169-35-163.dc.dc.cox.net) (Ping timeout: 320 seconds) |
| 12:39:01 | × | barrucadu quits (~barrucadu@carcosa.barrucadu.co.uk) (Ping timeout: 320 seconds) |
| 12:39:07 | hpc_ | is now known as hpc |
| 12:39:12 | <Joao003> | Ok, it's too confusing |
| 12:39:24 | <eldritchcookie[m> | mapped [1..4] (+1) |
| 12:39:41 | <eldritchcookie[m> | > mapped [1..4] (+1) |
| 12:39:42 | <lambdabot> | error: |
| 12:39:42 | <lambdabot> | • Couldn't match expected type ‘a -> f b’ with actual type ‘[a0]’ |
| 12:39:42 | <lambdabot> | • In the first argument of ‘mapped’, namely ‘[1 .. 4]’ |
| 12:40:03 | <Joao003> | > mapped [1..4] $ (+1) |
| 12:40:05 | <lambdabot> | error: |
| 12:40:06 | <lambdabot> | • Couldn't match expected type ‘a -> f b’ with actual type ‘[a0]’ |
| 12:40:06 | <lambdabot> | • In the first argument of ‘mapped’, namely ‘[1 .. 4]’ |
| 12:40:11 | × | tremon quits (~tremon@83.80.159.219) (Ping timeout: 305 seconds) |
| 12:40:11 | × | xff0x quits (~xff0x@fsa056e3ab.kytj202.ap.nuro.jp) (Ping timeout: 305 seconds) |
| 12:40:11 | × | pie_ quits (~pie_bnc@user/pie/x-2818909) (Ping timeout: 305 seconds) |
| 12:40:11 | × | vgtw quits (~vgtw@user/vgtw) (Ping timeout: 305 seconds) |
| 12:40:11 | × | nitrix quits (~nitrix@user/nitrix) (Ping timeout: 305 seconds) |
| 12:40:11 | × | Teacup quits (~teacup@user/teacup) (Ping timeout: 305 seconds) |
| 12:40:11 | × | drlkf quits (~drlkf@192.184.163.34.bc.googleusercontent.com) (Ping timeout: 305 seconds) |
| 12:40:11 | × | Ranhir quits (~Ranhir@157.97.53.139) (Ping timeout: 305 seconds) |
| 12:40:11 | × | bliminse quits (~bliminse@user/bliminse) (Ping timeout: 305 seconds) |
| 12:40:11 | × | masterbuilder quits (~masterbui@user/masterbuilder) (Ping timeout: 305 seconds) |
| 12:40:11 | × | ridcully quits (~ridcully@p57b52f2c.dip0.t-ipconnect.de) (Ping timeout: 305 seconds) |
| 12:40:11 | × | turlando quits (~turlando@user/turlando) (Ping timeout: 305 seconds) |
| 12:40:11 | × | dfordvm quits (~dfordivam@tk2-219-19469.vs.sakura.ne.jp) (Ping timeout: 305 seconds) |
| 12:40:11 | × | micro quits (~micro@user/micro) (Ping timeout: 305 seconds) |
| 12:40:11 | × | wagle quits (~wagle@quassel.wagle.io) (Ping timeout: 305 seconds) |
| 12:40:11 | × | CAT_S quits (apic@brezn3.muc.ccc.de) (Ping timeout: 305 seconds) |
| 12:40:11 | × | canta quits (~canta@user/canta) (Ping timeout: 305 seconds) |
| 12:40:11 | × | tv quits (~tv@user/tv) (Ping timeout: 305 seconds) |
| 12:40:11 | × | kawen quits (~quassel@static.208.191.216.95.clients.your-server.de) (Ping timeout: 305 seconds) |
| 12:40:13 | nitrix_ | is now known as nitrix |
| 12:40:14 | <eldritchcookie[m> | > mapped (+1) [1..4] |
| 12:40:16 | <lambdabot> | error: |
| 12:40:16 | <lambdabot> | • Ambiguous type variables ‘f0’, |
| 12:40:16 | <lambdabot> | ‘b0’ arising from a use of ‘show_M26522238195... |
| 12:40:24 | <Joao003> | WTH HAPPENED ABOVE US |
| 12:40:34 | → | bliminse joins (~bliminse@user/bliminse) |
| 12:40:35 | <Joao003> | Too many simultaneous quits |
| 12:41:00 | <eldritchcookie[m> | \> mapped (+1) [1..4] |
| 12:41:05 | × | gawen quits (~gawen@user/gawen) (Quit: cya) |
| 12:41:31 | <eldritchcookie[m> | > mapped (+1) [1..5] |
| 12:41:33 | <lambdabot> | error: |
| 12:41:33 | <lambdabot> | • Ambiguous type variables ‘f0’, |
| 12:41:33 | <lambdabot> | ‘b0’ arising from a use of ‘show_M78316969100... |
| 12:41:58 | <Joao003> | Why is it not working |
| 12:42:29 | <eldritchcookie[m> | your case wrong order |
| 12:42:48 | <eldritchcookie[m> | in mine i haven't chosen the f so it is ambigous |
| 12:42:54 | <eldritchcookie[m> | :t mapped |
| 12:42:55 | <lambdabot> | (Settable f1, Functor f2) => (a -> f1 b) -> f2 a -> f1 (f2 b) |
| 12:43:40 | → | vgtw joins (~vgtw@user/vgtw) |
| 12:43:49 | <ski> | > over mapped (^ 2) [0 .. 3] |
| 12:43:50 | <lambdabot> | [0,1,4,9] |
| 12:44:18 | <ski> | Joao003 : some relay or other malfunctioning, i'd gather |
| 12:44:57 | <geekosaur> | :t mapped (+1) [1..4] |
| 12:44:58 | <lambdabot> | (Settable f, Num (f b), Enum (f b)) => f [b] |
| 12:45:04 | <Joao003> | over mapped (+ 1) (1, 2) |
| 12:45:09 | <Joao003> | >over mapped (+ 1) (1, 2) |
| 12:45:13 | <ski> | `mapped (+1)' makes little sense |
| 12:45:14 | <Joao003> | > over mapped (+ 1) (1, 2) |
| 12:45:16 | <lambdabot> | (1,3) |
| 12:45:29 | → | micro joins (~micro@user/micro) |
| 12:45:50 | <eldritchcookie[m> | how is IO code tested? |
| 12:45:52 | <ski> | > over both (^ 2) (6,28) |
| 12:45:53 | <lambdabot> | (36,784) |
| 12:45:58 | <ski> | eldritchcookie[m : very carefully |
| 12:46:35 | <eldritchcookie[m> | could you be more specific? |
| 12:46:36 | <Joao003> | Ever heard of `bimap` |
| 12:46:46 | <Joao003> | > bimap (^ 2) (6, 28) |
| 12:46:48 | <lambdabot> | error: |
| 12:46:48 | <lambdabot> | • Couldn't match expected type ‘c -> d’ with actual type ‘(a0, b1)’ |
| 12:46:48 | <lambdabot> | • In the second argument of ‘bimap’, namely ‘(6, 28)’ |
| 12:46:50 | <Joao003> | uh |
| 12:47:02 | <eldritchcookie[m> | you need to provide 2 functions |
| 12:47:15 | <Joao003> | > join bimap (^2) (6, 28) |
| 12:47:17 | <lambdabot> | (36,784) |
| 12:47:38 | → | merijn joins (~merijn@c-001-001-006.client.esciencecenter.eduvpn.nl) |
| 12:48:23 | <Joao003> | @src both |
| 12:48:23 | <lambdabot> | Source not found. Your mind just hasn't been the same since the electro-shock, has it? |
| 12:48:25 | <ski> | eldritchcookie[m : one approach is to mock it, generating a data structure which you can interpret in a sandbox kind of thing |
| 12:48:41 | <ski> | @botsmack |
| 12:48:41 | <lambdabot> | :) |
| 12:49:10 | <Joao003> | > map (join bimap (^2)) [Left 6, Right 28] |
| 12:49:12 | <lambdabot> | [Left 36,Right 784] |
| 12:49:30 | <ncf> | @let shortest f (a, b) = case comparing length a b of LT -> (,b) <$> f a; _ -> (a,) <$> f b |
| 12:49:32 | <lambdabot> | Defined. |
| 12:49:44 | <eldritchcookie[m> | i am asking because i could rewrite my code to use a dynamic effect instead of IO so then when testing i can use a pure interpreter |
| 12:49:50 | <ski> | (`f' is still monomorphic) |
| 12:49:56 | <ncf> | > over shortest (map (^ 2)) ([1..3], [4..7]) |
| 12:49:58 | <lambdabot> | ([1,4,9],[4,5,6,7]) |
| 12:50:31 | <Joao003> | :t shortest |
| 12:50:32 | <lambdabot> | (Foldable t, Functor f) => (t a -> f (t a)) -> (t a, t a) -> f (t a, t a) |
| 12:50:39 | <ski> | "dynamic effect" ? |
| 12:51:11 | <eldritchcookie[m> | i am using a effectful an effect library they allow you to define effects |
| 12:51:19 | <ski> | mhm |
| 12:51:44 | × | merijn quits (~merijn@c-001-001-006.client.esciencecenter.eduvpn.nl) (Ping timeout: 248 seconds) |
| 12:54:12 | → | Lycurgus joins (~juan@user/Lycurgus) |
| 12:55:19 | × | ryantrinkle quits (~ryantrink@140.174.240.199) (Ping timeout: 276 seconds) |
| 12:56:15 | → | gawen joins (~gawen@user/gawen) |
| 12:58:23 | × | Lycurgus quits (~juan@user/Lycurgus) (Client Quit) |
| 13:01:50 | <somerandomnick[m> | so in effect |
| 13:03:36 | <somerandomnick[m> | nvm |
| 13:09:23 | → | ryantrinkle joins (~ryantrink@204.2.88.230) |
| 13:10:04 | × | anpad quits (~pandeyan@user/anpad) (Ping timeout: 252 seconds) |
| 13:18:17 | → | anpad joins (~pandeyan@user/anpad) |
| 13:22:35 | → | shriekingnoise joins (~shrieking@186.137.175.87) |
| 13:27:52 | × | zeenk quits (~zeenk@2a02:2f04:a20f:5200::7fe) (Quit: Konversation terminated!) |
| 13:28:48 | × | alexherbo2 quits (~alexherbo@2a02-842a-8180-4601-85e1-23ae-ea70-6ae4.rev.sfr.net) (Remote host closed the connection) |
| 13:32:00 | × | anpad quits (~pandeyan@user/anpad) (Read error: Connection reset by peer) |
| 13:33:03 | → | justsomeguy joins (~justsomeg@user/justsomeguy) |
| 13:33:04 | → | o-90 joins (~o-90@gateway/tor-sasl/o-90) |
| 13:35:19 | → | eggplantade joins (~Eggplanta@2600:1700:38c5:d800:d4d0:8bd2:d805:7ab6) |
| 13:36:26 | → | coot joins (~coot@2a02:a310:e241:1b00:ec1a:e9df:79ac:66ba) |
| 13:36:38 | → | VernorVintage joins (~maxsu@wsip-24-120-138-106.lv.lv.cox.net) |
| 13:39:07 | <VernorVintage> | hey all, has anyone built any monads to capture patterns for recursive LLM prompt generation? |
| 13:39:31 | <Joao003> | ghci isn't recognizing the cabal package I just installed |
| 13:39:55 | × | eggplantade quits (~Eggplanta@2600:1700:38c5:d800:d4d0:8bd2:d805:7ab6) (Ping timeout: 250 seconds) |
| 13:40:00 | <geekosaur> | cabal repl --build-depends=that-package |
| 13:40:31 | <geekosaur> | cabal does not install packages where ghc/ghci can see them directly because that invites ghc/ghci to create its own diamond dependency errors |
| 13:41:12 | <geekosaur> | (unless you used cabal install --lib in which case you're doing that inviting) |
| 13:41:40 | <Joao003> | I did cabal install package |
| 13:42:16 | <Joao003> | Your method didn't work |
| 13:43:57 | <geekosaur> | "didn't work" how? it's working here |
| 13:44:20 | × | o-90 quits (~o-90@gateway/tor-sasl/o-90) (Remote host closed the connection) |
| 13:45:13 | × | coot quits (~coot@2a02:a310:e241:1b00:ec1a:e9df:79ac:66ba) (Quit: coot) |
| 13:45:46 | × | Me-me quits (~Me-me@user/me-me) (Quit: Something has gone terribly, terribly wrong, that being that I'm not here any more.) |
| 13:45:58 | <Joao003> | It says "Could not find module <module name here>" |
| 13:46:11 | <Joao003> | When I try to import the module |
| 13:50:05 | → | nate1 joins (~nate@98.45.169.16) |
| 13:51:56 | <jade[m]> | `foo a $ bar b c $ baz d e f |
| 13:52:06 | <Joao003> | jade[m]: what |
| 13:52:39 | <jade[m]> | * `foo a $ bar b c $ baz d e f` vs |
| 13:52:39 | <jade[m]> | `foo a . bar b c $ baz d e f` |
| 13:52:45 | <jade[m]> | which one do you prefer |
| 13:53:48 | <geekosaur> | https://paste.tomsmeding.com/5sbOzTVo |
| 13:54:47 | × | justsomeguy quits (~justsomeg@user/justsomeguy) (Ping timeout: 264 seconds) |
| 13:55:07 | × | nate1 quits (~nate@98.45.169.16) (Ping timeout: 276 seconds) |
| 13:56:03 | × | wootehfoot quits (~wootehfoo@user/wootehfoot) (Read error: Connection reset by peer) |
| 13:56:15 | → | anpad joins (~pandeyan@user/anpad) |
| 13:58:23 | <ski> | jade[m] : `(foo a . bar b c . baz d e) f' or `(foo a . bar b c) (baz d e f)' |
| 13:58:43 | <ski> | (or just `foo a (bar b c (baz d e f))') |
| 13:59:01 | <jade[m]> | hm yeah |
| 13:59:16 | <Joao003> | I prefer `baz d e f & bar b c & foo a` |
| 13:59:17 | <jade[m]> | I usually do f . g . h $ x |
| 13:59:43 | ski | mostly doesn't like to use `$' |
| 14:00:05 | <Joao003> | I forgot how to send these asterisk messages |
| 14:00:15 | <ski> | /me looks at Joao003 |
| 14:00:18 | ski | looks at Joao003 |
| 14:00:51 | <ski> | advantage of `.' over `$' (and `&') is that `.' is associative, so you can factor out any subcomposition of the composition chain |
| 14:00:54 | Joao003 | now knows how to send these asterisk messages |
| 14:01:17 | <ski> | (fwiw, they're known as ACTIONs) |
| 14:10:51 | → | alexherbo2 joins (~alexherbo@2a02-842a-8180-4601-85e1-23ae-ea70-6ae4.rev.sfr.net) |
| 14:13:15 | → | L29Ah joins (~L29Ah@wikipedia/L29Ah) |
| 14:14:57 | → | merijn joins (~merijn@c-001-001-006.client.esciencecenter.eduvpn.nl) |
| 14:22:21 | × | ryantrinkle quits (~ryantrink@204.2.88.230) (Ping timeout: 259 seconds) |
| 14:23:24 | <jade[m]> | I don't know how to format this... (full message at <https://libera.ems.host/_matrix/media/v3/download/libera.chat/ebea9da76705976f0476cb0195a9ff23b82a664f>) |
| 14:23:51 | <jade[m]> | let (no pun intended) me remove the redundant let |
| 14:27:05 | → | justsomeguy joins (~justsomeg@user/justsomeguy) |
| 14:29:18 | <justsomeguy> | n/c |
| 14:29:56 | justsomeguy | reminds himself to bind the clear command to some key sequence that doesn't require pressing enter. |
| 14:32:43 | <ski> | you know you can use `let' in list comprehensions |
| 14:32:56 | <ski> | > [x | let x = 2 + 3] |
| 14:32:57 | <lambdabot> | [5] |
| 14:33:50 | → | sus0 joins (zero@user/zeromomentum) |
| 14:34:25 | × | xff0x_ quits (~xff0x@fsa056e3ab.kytj202.ap.nuro.jp) (Ping timeout: 240 seconds) |
| 14:35:06 | <jade[m]> | I usually know these things but am just too stupid to remind myself of them when I need them |
| 14:35:26 | <jade[m]> | I'm usually more pragmatic and just do, only adjusting stuff like that afterwards |
| 14:35:30 | jade[m] | uploaded an image: (310KiB) < https://libera.ems.host/_matrix/media/v3/download/matrix.org/DjTMcCdCMuYkeEskwqrrEUVj/image.png > |
| 14:35:30 | <jade[m]> | anyways |
| 14:35:51 | <[Leary]> | jade[m]: I would write `draw = for_ iv \x -> for_ iv \y -> do { mkColor (x :+ y); GL.vertex ... } where { step = ...; size = ...; iv = ... }`, but with layout. |
| 14:37:31 | <ski> | yea, what [Leary] said |
| 14:40:27 | × | biberu quits (~biberu@user/biberu) (Read error: Connection reset by peer) |
| 14:44:48 | × | CAT_S_ quits (apic@brezn3.muc.ccc.de) (Quit: Reconnecting) |
| 14:45:03 | → | CAT_S joins (apic@brezn3.muc.ccc.de) |
| 14:45:14 | jade[m] | sent a code block: https://libera.ems.host/_matrix/media/v3/download/libera.chat/79f51cf12a7edf048f185f219f9bc471984f513b |
| 14:45:21 | → | ryantrinkle joins (~ryantrink@204.2.88.230) |
| 14:46:13 | <jade[m]> | I could maybe just do forEach = for_ iv . (for_ iv .) |
| 14:46:27 | → | biberu joins (~biberu@user/biberu) |
| 14:46:36 | <jade[m]> | or is there a better idiom for a cartesian product traversal? |
| 14:49:15 | × | merijn quits (~merijn@c-001-001-006.client.esciencecenter.eduvpn.nl) (Ping timeout: 255 seconds) |
| 14:55:31 | → | totbwf joins (uid402332@id-402332.uxbridge.irccloud.com) |
| 14:58:55 | → | simendsjo joins (~user@84.211.91.241) |
| 15:02:44 | <Joao003> | (&) looks way more intuitive than ($) does, do you agree? |
| 15:03:30 | <ski> | either is usually unnecessary .. |
| 15:03:42 | <ski> | (except `&' for lensy stuff) |
| 15:05:11 | → | harveypwca joins (~harveypwc@2601:246:c180:a570:3828:d8:e523:3f67) |
| 15:06:01 | <jade[m]> | ski: nice in terms of partial application like with `zipWith ($)` |
| 15:06:51 | ski | invokes Mictlantecuthli |
| 15:06:53 | <probie> | jade[m]: Sure, but if you didn't have `($)`, you could just go `zipWith id` |
| 15:07:23 | <jade[m]> | yeah, but that's less intuitive imo |
| 15:07:29 | <Joao003> | But if your function is a sequence of functions you can indent it, put some &s and it looks really intuitive, almost like a step-by-step recipe |
| 15:07:48 | <ski> | @quote aztec.god |
| 15:07:48 | <lambdabot> | quicksilver says: zip`ap`tail the aztec god of consecutive numbers |
| 15:08:47 | <ski> | "intuitive" is in the eye of the beholder |
| 15:09:12 | <Joao003> | The only disadvantage of & though is you have to import it from Data.Function |
| 15:09:12 | <probie> | jade[m]: I don't think `zipWith ($)` isn't particularly intuitive. It's just a well known idiom |
| 15:09:25 | <Joao003> | probie: true |
| 15:09:28 | <jade[m]> | fair enough |
| 15:10:09 | <Joao003> | `zipWith id` is shorter so why not use the latter? |
| 15:10:31 | <Joao003> | It also saves your precious Shift key |
| 15:10:51 | <ski> | do you often have a list of functions ? |
| 15:11:06 | <jade[m]> | occasionally |
| 15:12:10 | <Joao003> | > take 20 [1..] |
| 15:12:12 | <lambdabot> | [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20] |
| 15:12:28 | <Joao003> | ... |
| 15:12:44 | <Joao003> | > enumFromTo 1 20 |
| 15:12:46 | <lambdabot> | [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20] |
| 15:13:26 | <jade[m]> | I really hate the naming of that function |
| 15:13:30 | <jade[m]> | just call it range ffs |
| 15:13:42 | <Joao003> | jade[m]: lol |
| 15:13:56 | <ski> | there's also `enumFrom',`enumFromThen',`enumFromThenTo' .. what ought those be called, in that case ? |
| 15:14:06 | <probie> | Joao003: you can /msg lambdabot directly if you want to |
| 15:14:15 | <darkling> | `rangeffs 1 20` ? :) |
| 15:14:22 | <Joao003> | XD |
| 15:15:59 | <jade[m]> | rangeFrom, rangeStep, rangeStepFrom or something, idk |
| 15:16:09 | <jade[m]> | darkling: yes |
| 15:16:50 | <[Leary]> | Those functions exist to desugar range/enum syntax, not to be used directly. Why would it matter what they're called? |
| 15:17:05 | × | titibandit quits (~titibandi@user/titibandit) (Ping timeout: 240 seconds) |
| 15:17:14 | <jade[m]> | ¯\_(ツ)_/¯ |
| 15:17:52 | <Joao003> | four-eyed shrug .-. |
| 15:18:18 | <ski> | i guess sometimes people partially apply them |
| 15:19:42 | <Joao003> | Anyone uses `take <insert number here> [<insert number here>..]`? |
| 15:20:55 | × | justsomeguy quits (~justsomeg@user/justsomeguy) (Ping timeout: 276 seconds) |
| 15:31:26 | × | VernorVintage quits (~maxsu@wsip-24-120-138-106.lv.lv.cox.net) (Ping timeout: 246 seconds) |
| 15:34:56 | × | azimut quits (~azimut@gateway/tor-sasl/azimut) (Ping timeout: 240 seconds) |
| 15:35:44 | × | Joao003 quits (~Joao003@2804:840:8311:b700:e035:773e:85f2:c516) (Quit: Leaving) |
| 15:43:46 | → | eggplantade joins (~Eggplanta@2600:1700:38c5:d800:d4d0:8bd2:d805:7ab6) |
| 15:44:00 | → | bratwurst joins (~dfadsva@2604:3d09:207f:f650::9c24) |
| 15:44:46 | × | alexherbo2 quits (~alexherbo@2a02-842a-8180-4601-85e1-23ae-ea70-6ae4.rev.sfr.net) (Remote host closed the connection) |
| 15:45:00 | → | alexherbo2 joins (~alexherbo@2a02-842a-8180-4601-85e1-23ae-ea70-6ae4.rev.sfr.net) |
| 15:47:02 | → | GerryH joins (~Brgaammin@p57bd3b04.dip0.t-ipconnect.de) |
| 15:47:02 | × | GerryH quits (~Brgaammin@p57bd3b04.dip0.t-ipconnect.de) (Remote host closed the connection) |
| 15:47:40 | → | GerryH joins (~Brgaammin@p57bd3b04.dip0.t-ipconnect.de) |
| 15:50:09 | <monochrom> | ($) has theoretical importance in the law (<*>) = liftA2 ($). This covers zipWith ($) actually. |
| 15:51:21 | <monochrom> | But when you hear monochrom say that something has theoretical importance, the subtext is that he also says that it has no practical importance. >:) |
| 15:51:31 | → | VernorVintage joins (~maxsu@24.120.138.106) |
| 15:51:44 | × | gemmaro quits (~user@240f:74:d1f0:1:ba1:e787:c9e:b1dc) (Remote host closed the connection) |
| 15:54:42 | <probie> | monochrom: sure, but that law is the same if it's (<*>) = liftA2 id |
| 15:54:42 | ski | figured there had to be a fable about this |
| 15:55:29 | <monochrom> | id is less direct than ($) |
| 15:56:11 | <monochrom> | In this sense: In a code obfuscation contest, replacing ($) by id would be one of my first steps. |
| 15:56:38 | <hpc> | replace it with unsafeCoerce instead |
| 15:56:47 | <monochrom> | haha |
| 15:56:53 | <probie> | I also would like the type of `($)` to change to `a -> a`, but I doubt that will happen |
| 15:56:55 | Vq_ | is now known as Vq |
| 15:57:05 | <ski> | `($) @a @b' may be considered simpler than `id @(a -> b)' |
| 15:57:39 | <monochrom> | You also missed the ship of changing (.) to (a -> b) -> f a -> f b >:) |
| 15:57:52 | <monochrom> | err with Functor f => |
| 15:57:58 | <ski> | well, the problem is that that ship returned to port |
| 15:58:21 | <monochrom> | haha |
| 15:58:40 | <probie> | I'd like the RHS of my `$` to be allowed to be unlifted |
| 15:58:45 | <monochrom> | This is what you get for a recursive languages. They keep coming back. >:) |
| 15:59:07 | <probie> | and to be able to use it with LinearTypes |
| 15:59:53 | → | gurkenglas joins (~gurkengla@dynamic-046-114-176-011.46.114.pool.telefonica.de) |
| 16:00:05 | <ski> | now i'm wondering whether OCaml has any dinatural support with their subtyping .. |
| 16:00:14 | <ski> | .. probably not, if i had to wager a guess |
| 16:00:27 | <monochrom> | @type id id id id id id |
| 16:00:28 | <lambdabot> | a -> a |
| 16:00:37 | <monochrom> | @quote monochrom 17-ary |
| 16:00:37 | <lambdabot> | monochrom says: I am 17-ary, going on 18-ary, I can take curry of you |
| 16:01:03 | <ski> | @quote please.talk |
| 16:01:03 | <lambdabot> | Dave_Benjamin says: please talk to your son or daughter about parametric polymorphism |
| 16:03:49 | × | GerryH quits (~Brgaammin@p57bd3b04.dip0.t-ipconnect.de) (Ping timeout: 276 seconds) |
| 16:04:56 | → | tzh joins (~tzh@24.21.73.154) |
| 16:12:45 | × | pavonia quits (~user@user/siracusa) (Quit: Bye!) |
| 16:16:56 | × | ddellacosta quits (~ddellacos@146.70.165.230) (Ping timeout: 246 seconds) |
| 16:18:07 | → | merijn joins (~merijn@c-001-001-006.client.esciencecenter.eduvpn.nl) |
| 16:18:26 | × | accord quits (uid568320@id-568320.hampstead.irccloud.com) (Quit: Connection closed for inactivity) |
| 16:18:34 | × | puke quits (~puke@user/puke) (Quit: puke) |
| 16:19:25 | → | puke joins (~puke@user/puke) |
| 16:24:12 | × | merijn quits (~merijn@c-001-001-006.client.esciencecenter.eduvpn.nl) (Ping timeout: 255 seconds) |
| 16:24:43 | × | kuribas quits (~user@ptr-17d51enwg0abanf4ox8.18120a2.ip6.access.telenet.be) (Quit: ERC (IRC client for Emacs 27.1)) |
| 16:34:43 | × | simendsjo quits (~user@84.211.91.241) (Ping timeout: 252 seconds) |
| 16:41:37 | → | bontaq joins (~user@ool-45779b84.dyn.optonline.net) |
| 16:42:47 | → | Maeda joins (~Maeda@91-161-10-149.subs.proxad.net) |
| 16:43:15 | × | dsrt^ quits (~dsrt@c-76-105-96-13.hsd1.ga.comcast.net) (Remote host closed the connection) |
| 16:44:32 | × | Maeda quits (~Maeda@91-161-10-149.subs.proxad.net) (Client Quit) |
| 16:44:53 | → | econo joins (uid147250@user/econo) |
| 16:44:54 | → | Maeda joins (~Maeda@91-161-10-149.subs.proxad.net) |
| 16:58:29 | → | azimut joins (~azimut@gateway/tor-sasl/azimut) |
| 17:12:43 | × | Maeda quits (~Maeda@91-161-10-149.subs.proxad.net) (Quit: leaving) |
| 17:32:26 | → | Joao003 joins (~Joao003@2804:840:8311:b700:e035:773e:85f2:c516) |
| 17:32:34 | <Joao003> | Hello again |
| 17:38:23 | <juri_> | hello! |
| 17:40:39 | <[exa]> | good afternon ladies and gentlemen how's your zygosistomorphic prepromorphisms today |
| 17:40:39 | → | Helle joins (~helle@user/Helle) |
| 17:41:59 | → | coot joins (~coot@2a02:a310:e241:1b00:ec1a:e9df:79ac:66ba) |
| 17:42:02 | <Helle> | so if I want to GENERATE XML (yes, I made some bad decisions, like picking up this project), is there a more reasonable package then xml-conduit's Text.XML (I don't need streaming per se) |
| 17:42:17 | <Helle> | it works for my prototype, but the syntax is neither the best nor the worst |
| 17:43:09 | <[exa]> | Helle: if you're annoyed by the syntax, make a tiny syntaxy wrapper? |
| 17:43:46 | <Helle> | [exa]: well, more curious if I should be looking at other libraries or if it is a known good |
| 17:43:56 | <Helle> | it was basically the first and only one my own searches where giving |
| 17:44:52 | <[exa]> | ah yeah Text.XML is crude |
| 17:45:01 | → | merijn joins (~merijn@c-001-001-006.client.esciencecenter.eduvpn.nl) |
| 17:45:24 | <Helle> | [exa]: anything nicer to consider ? |
| 17:46:07 | <[exa]> | I wonder if there's anything aeson-like for xml |
| 17:48:10 | <[exa]> | there's this slight inconvenience with encoding normal data structures to XML, you always have to decide if stuff should be attributes or dom and there's AFAIK no generically right™ way |
| 17:48:27 | <[exa]> | you might like this https://github.com/finnsson/Text.XML.Generic |
| 17:48:38 | <Joao003> | How to do a pointless S combinator without `ap`? |
| 17:48:52 | <Helle> | [exa]: I mean I need to output to a specific XML format |
| 17:49:01 | <[exa]> | Helle: yeah, that's the usual problem :D |
| 17:49:09 | <Helle> | [exa]: so just serialisation is not a great solution |
| 17:49:15 | <Helle> | I did find xml-hamlet which is also sure a thing (inline XML in my Haskell) |
| 17:49:34 | <[exa]> | Joao003: y tho? S _is_ ap by definition. |
| 17:49:53 | <Joao003> | Code golf, importing `ap` would waste bytes |
| 17:50:07 | <[exa]> | Joao003: (<*>) would do the same then |
| 17:51:07 | <monochrom> | If you rule out enough libraries, you can't do anything pointfree. |
| 17:51:37 | <[exa]> | Helle: maybe even this https://hackage.haskell.org/package/tofromxml-0.1.0.2/docs/Text-XML-ToFromXML.html |
| 17:51:39 | → | nate1 joins (~nate@98.45.169.16) |
| 17:52:29 | <[exa]> | Helle: honestly if you want to make the code _nice_ I'd really suggest to quickly play with Aeson to see how folks do with JSON and then try to reapply to XML; the above library might be a good starting point |
| 17:53:10 | <[exa]> | Helle: the wurst part there is that you need good parsing, Aeson has tremendously useful combinators for that |
| 17:55:33 | <Joao003> | [exa]: Needed a flip for <*>, used =<< |
| 17:56:13 | <monochrom> | flip exists. |
| 17:56:13 | → | ddellacosta joins (~ddellacos@143.244.47.73) |
| 17:56:19 | <monochrom> | @type flip (<*>) |
| 17:56:21 | <lambdabot> | Applicative f => f a -> f (a -> b) -> f b |
| 17:56:28 | × | nate1 quits (~nate@98.45.169.16) (Ping timeout: 254 seconds) |
| 17:56:35 | <[exa]> | =<< does something different no? |
| 17:56:58 | <monochrom> | Although I don't understand avoiding ap while embracing =<< under the reason "fewer imports". |
| 17:58:28 | <Joao003> | No, I needed ((flip f)<*>g), so I used f=<<g instead |
| 17:58:43 | <Joao003> | monochrom: Again, code golf |
| 17:58:54 | <[exa]> | ...also <**> |
| 17:59:17 | <monochrom> | Very different. But I think we went over that last time over deaf ears. |
| 18:00:04 | <Helle> | [exa]: right, I've got a bunch of options to consider, ty |
| 18:00:14 | <[exa]> | we should include a tiny APL interpreter into the Prelude so that this codegolf thing finally stops making sense :D |
| 18:00:51 | <[exa]> | Helle: well, as always with xml.... good luck. :D |
| 18:12:14 | <fbytez> | Am I able to define more than one module per file? |
| 18:13:36 | <monochrom> | No. |
| 18:13:53 | <fbytez> | OK, thanks. |
| 18:14:23 | <[exa]> | fbytez: it is kinda implied by the requirement that module names and file names correspond |
| 18:15:50 | <fbytez> | Right. |
| 18:19:10 | × | merijn quits (~merijn@c-001-001-006.client.esciencecenter.eduvpn.nl) (Ping timeout: 252 seconds) |
| 18:31:59 | → | user363627 joins (~user36362@146.70.198.100) |
| 18:38:22 | → | kuttenbrunzer joins (~kuttenbru@2a02:8108:8b80:1d48:4e8:8ad4:7012:2253) |
| 18:41:50 | × | yaxu quits (~yaxu@host-78-148-247-238.as13285.net) (Quit: Leaving) |
| 18:45:14 | × | totbwf quits (uid402332@id-402332.uxbridge.irccloud.com) (Quit: Connection closed for inactivity) |
| 18:45:22 | jade[m] | uploaded an image: (9KiB) < https://libera.ems.host/_matrix/media/v3/download/matrix.org/GPdPaxCveewhuGwhCCeiAhuV/image.png > |
| 18:45:23 | <jade[m]> | this is kind of a bummer ... |
| 18:45:41 | <jade[m]> | It feels like this is some pretty basic stuff that probably should work |
| 18:46:52 | × | harveypwca quits (~harveypwc@2601:246:c180:a570:3828:d8:e523:3f67) (Quit: Leaving) |
| 18:50:16 | <yushyin> | that's what I often think when I stumble upon hls |
| 18:53:19 | → | heraldo joins (~heraldo@user/heraldo) |
| 18:57:20 | × | robertm quits (robertm@lattice.rojoma.com) (Quit: ...) |
| 18:59:05 | → | Sgeo joins (~Sgeo@user/sgeo) |
| 18:59:10 | → | robertm joins (robertm@lattice.rojoma.com) |
| 19:02:39 | → | mud joins (~mud@user/kadoban) |
| 19:05:07 | <jade[m]> | wow, I just 1:1 rebuild a function from Data.List |
| 19:05:19 | <Joao003> | What function? |
| 19:05:32 | jade[m] | uploaded an image: (20KiB) < https://libera.ems.host/_matrix/media/v3/download/matrix.org/VfPBEuACTzpflNIPRiGelNxe/image.png > |
| 19:05:36 | jade[m] | uploaded an image: (26KiB) < https://libera.ems.host/_matrix/media/v3/download/matrix.org/PHObKMUrPgoYIYamNBVgJwsU/image.png > |
| 19:05:56 | <jade[m]> | jade[m]: this could probably be a fold |
| 19:06:16 | <Joao003> | Yes it could |
| 19:07:00 | <c_wraith> | but more to the point, it already has a name. |
| 19:07:58 | <jade[m]> | c_wraith: yeah, I didn't notice it existed until a second ago |
| 19:08:04 | <jade[m]> | now I'll use it ofc |
| 19:08:17 | <Hecate> | 👍 |
| 19:11:20 | × | bitdex quits (~bitdex@gateway/tor-sasl/bitdex) (Ping timeout: 240 seconds) |
| 19:11:46 | × | Sgeo quits (~Sgeo@user/sgeo) (Read error: Connection reset by peer) |
| 19:14:02 | → | Sgeo joins (~Sgeo@user/sgeo) |
| 19:14:11 | × | VernorVintage quits (~maxsu@24.120.138.106) (Read error: Connection reset by peer) |
| 19:14:21 | → | bitdex joins (~bitdex@gateway/tor-sasl/bitdex) |
| 19:15:45 | → | Guest7455 joins (~Guest74@95-24-68-157.broadband.corbina.ru) |
| 19:22:52 | zer0bitz_ | is now known as zer0bitz |
| 19:23:42 | × | Guest7455 quits (~Guest74@95-24-68-157.broadband.corbina.ru) (Quit: Client closed) |
| 19:24:48 | × | heraldo quits (~heraldo@user/heraldo) (Ping timeout: 252 seconds) |
| 19:25:46 | → | mncheck joins (~mncheck@193.224.205.254) |
| 19:26:35 | → | heraldo joins (~heraldo@user/heraldo) |
| 19:31:33 | → | pavonia joins (~user@user/siracusa) |
| 19:35:00 | <Joao003> | Why aren't packages like extra, random and others already in base? |
| 19:36:10 | <[exa]> | because of the cost of maintaining a larger base |
| 19:38:30 | <hpc> | base and ghc are mutually dependent, neither can be updated without the other |
| 19:38:39 | <hpc> | so anything added to base gets similarly stuck |
| 19:40:14 | → | johnjaye joins (~pi@072-181-052-090.res.spectrum.com) |
| 19:42:16 | <mauke> | jade[m]: I feel uneasy about `n` being lazy in your function |
| 19:44:53 | <jade[m]> | mh |
| 19:45:02 | jade[m] | uploaded an image: (509KiB) < https://libera.ems.host/_matrix/media/v3/download/matrix.org/VCDxlFDdEeFYOGCJBpTTaQNO/image.png > |
| 19:45:03 | <jade[m]> | (on a sidenote) |
| 19:46:28 | → | merijn joins (~merijn@c-001-001-006.client.esciencecenter.eduvpn.nl) |
| 19:49:41 | × | mncheck quits (~mncheck@193.224.205.254) (Remote host closed the connection) |
| 19:50:06 | → | mncheck joins (~mncheck@193.224.205.254) |
| 19:51:00 | <somerandomnick[m> | yeah, go does not need to evaluate n to call itself |
| 19:51:28 | <jade[m]> | why would that be a problem? |
| 19:51:31 | <somerandomnick[m> | so I expect a huge thunk at the end |
| 19:51:33 | <jade[m]> | Thunk buildup? |
| 19:51:40 | <jade[m]> | mhm |
| 19:52:11 | <monochrom> | consider "go a (x:xs) = g (a+x) xs" |
| 19:53:11 | <mauke> | Just ((((((((0 + 1) + 1) + 1) + 1) + ... |
| 19:53:48 | → | michalz joins (~michalz@185.246.207.203) |
| 19:53:56 | <jade[m]> | yeah |
| 19:54:01 | <jade[m]> | can I just ! it? |
| 19:54:36 | <mauke> | yes |
| 19:54:37 | <jade[m]> | not that it matters, as I have replaced it with findIndex - but would it have been possible? |
| 19:55:06 | <jade[m]> | mauke: thanks! |
| 19:55:07 | <jade[m]> | I know the theoretical stuff about laziness but haven't had much practical experience |
| 19:55:25 | <somerandomnick[m> | catching the go 0 _ case would also work |
| 19:56:06 | <mauke> | heh, base cheats and just uses unboxed integers to begin with |
| 19:56:27 | <somerandomnick[m> | XD |
| 19:56:37 | <mauke> | somerandomnick[m: what do you mean? |
| 19:56:40 | <somerandomnick[m> | yeah bro just used an unboxed data type |
| 19:56:47 | → | hueso_ joins (~root@user/hueso) |
| 19:57:06 | × | hueso quits (~root@user/hueso) (Read error: Connection reset by peer) |
| 19:57:16 | <somerandomnick[m> | mauke: you would catch go 0 _ _ first |
| 19:57:33 | <mauke> | define catch |
| 19:57:46 | <somerandomnick[m> | then everytime go gets called with n, n needs to be evaluated |
| 19:57:51 | <somerandomnick[m> | to make sure its not 0 |
| 19:58:05 | <mauke> | ah, the oleg trick |
| 19:58:11 | <somerandomnick[m> | catch as in pattern guards |
| 19:58:23 | <mauke> | but n is definitely 0 in the first call |
| 19:58:26 | <somerandomnick[m> | there is already pattern guards used here |
| 19:58:46 | <somerandomnick[m> | it needs to be -1 then ig |
| 19:58:52 | × | hippoid quits (~My_user_n@user/hippoid) (Quit: WeeChat 3.8) |
| 19:58:53 | <ski> | go 0 _ _ | False = undefined -- or |
| 19:58:56 | <mauke> | go n _ _ | n `seq` False = undefined |
| 19:59:21 | <mauke> | majestic stereo |
| 19:59:34 | <ski> | like in the old days |
| 19:59:47 | <mauke> | https://okmij.org/ftp/Haskell/#making-function-strict |
| 20:01:01 | <ski> | @quote cornered |
| 20:01:01 | <lambdabot> | edwinb says: where does 'Oleg cornered me in a pub and explained delimited continuations to me' fit in? |
| 20:03:06 | <mauke> | delimited continuations are weird |
| 20:03:29 | <mauke> | I know what they are, but when I see them in code, it still breaks my brain |
| 20:04:54 | × | alexherbo2 quits (~alexherbo@2a02-842a-8180-4601-85e1-23ae-ea70-6ae4.rev.sfr.net) (Remote host closed the connection) |
| 20:05:09 | → | alexherbo2 joins (~alexherbo@2a02-842a-8180-4601-85e1-23ae-ea70-6ae4.rev.sfr.net) |
| 20:08:55 | × | alexherbo2 quits (~alexherbo@2a02-842a-8180-4601-85e1-23ae-ea70-6ae4.rev.sfr.net) (Remote host closed the connection) |
| 20:09:09 | → | alexherbo2 joins (~alexherbo@2a02-842a-8180-4601-85e1-23ae-ea70-6ae4.rev.sfr.net) |
| 20:16:01 | × | kuttenbrunzer quits (~kuttenbru@2a02:8108:8b80:1d48:4e8:8ad4:7012:2253) (Quit: Leaving) |
| 20:19:39 | → | wroathe joins (~wroathe@50.205.197.50) |
| 20:19:39 | × | wroathe quits (~wroathe@50.205.197.50) (Changing host) |
| 20:19:39 | → | wroathe joins (~wroathe@user/wroathe) |
| 20:20:55 | × | merijn quits (~merijn@c-001-001-006.client.esciencecenter.eduvpn.nl) (Ping timeout: 255 seconds) |
| 20:22:30 | tremon_ | is now known as tremon |
| 20:23:20 | Ristovsk- | is now known as [Ristovski] |
| 20:26:16 | → | zeenk joins (~zeenk@2a02:2f04:a20f:5200::7fe) |
| 20:28:42 | × | heraldo quits (~heraldo@user/heraldo) (Quit: heraldo) |
| 20:30:50 | <mauke> | speaking of pretty images, https://imgur.com/a/VzpSe76 |
| 20:31:28 | <mauke> | they're blurry because imgur resized them; the originals are smaller (but less blurry) |
| 20:32:09 | <monochrom> | Is that cosmic microwave background on TV? (butterfly man meme) >:) |
| 20:32:52 | <mauke> | all of these were generated by the same 30-lines C program |
| 20:35:06 | <mauke> | https://paste.tomsmeding.com/2roeQYem |
| 20:35:20 | <mauke> | porting it to Haskell and making it interactive is left as an exercise for the reader :-) |
| 20:35:58 | <jade[m]> | might actually do that in the context of my graphics thingy |
| 20:36:02 | <jade[m]> | seems cool |
| 20:38:34 | → | mncheck-m joins (~mncheck@193.224.205.254) |
| 20:40:17 | → | hueso joins (~root@user/hueso) |
| 20:40:36 | × | hueso_ quits (~root@user/hueso) (Read error: Connection reset by peer) |
| 20:41:08 | × | michalz quits (~michalz@185.246.207.203) (*.net *.split) |
| 20:41:08 | × | mncheck quits (~mncheck@193.224.205.254) (*.net *.split) |
| 20:41:08 | × | Sgeo quits (~Sgeo@user/sgeo) (*.net *.split) |
| 20:41:08 | × | CAT_S quits (apic@brezn3.muc.ccc.de) (*.net *.split) |
| 20:41:08 | × | shriekingnoise quits (~shrieking@186.137.175.87) (*.net *.split) |
| 20:41:08 | × | micro quits (~micro@user/micro) (*.net *.split) |
| 20:41:08 | × | vgtw quits (~vgtw@user/vgtw) (*.net *.split) |
| 20:41:08 | × | Alex_test quits (~al_test@178.34.150.15) (*.net *.split) |
| 20:41:08 | × | AlexZenon quits (~alzenon@178.34.150.15) (*.net *.split) |
| 20:41:08 | × | B-J quits (~BenziJuni@dsl-149-64-86.hive.is) (*.net *.split) |
| 20:41:08 | × | marienz quits (~marienz@libera/staff/marienz) (*.net *.split) |
| 20:41:08 | × | eL_Bart0- quits (eL_Bart0@dietunichtguten.org) (*.net *.split) |
| 20:41:08 | × | niko quits (niko@libera/staff/niko) (*.net *.split) |
| 20:41:19 | → | micro joins (~micro@user/micro) |
| 20:41:22 | → | marienz joins (~marienz@libera/staff/marienz) |
| 20:41:25 | → | CAT_S joins (apic@brezn3.muc.ccc.de) |
| 20:41:28 | → | niko joins (niko@libera/staff/niko) |
| 20:41:29 | → | eL_Bart0 joins (eL_Bart0@dietunichtguten.org) |
| 20:41:31 | → | Sgeo joins (~Sgeo@user/sgeo) |
| 20:42:03 | → | shriekingnoise joins (~shrieking@186.137.175.87) |
| 20:43:26 | → | vgtw joins (~vgtw@user/vgtw) |
| 20:44:03 | → | Benzi-Junior joins (~BenziJuni@dsl-149-64-86.hive.is) |
| 20:44:54 | × | _ht quits (~Thunderbi@28-52-174-82.ftth.glasoperator.nl) (Remote host closed the connection) |
| 20:45:56 | → | michalz joins (~michalz@185.246.207.221) |
| 20:46:33 | → | AlexZenon joins (~alzenon@178.34.150.15) |
| 20:46:55 | → | Alex_test joins (~al_test@178.34.150.15) |
| 20:58:46 | × | alexherbo2 quits (~alexherbo@2a02-842a-8180-4601-85e1-23ae-ea70-6ae4.rev.sfr.net) (Remote host closed the connection) |
| 21:01:21 | → | alexherbo2 joins (~alexherbo@2a02-842a-8180-4601-85e1-23ae-ea70-6ae4.rev.sfr.net) |
| 21:02:28 | <Joao003> | Does anyone use ($!) |
| 21:04:06 | <jade[m]> | might be useful to avoid a distracting seq |
| 21:05:28 | → | ec joins (~ec@gateway/tor-sasl/ec) |
| 21:06:07 | × | ec quits (~ec@gateway/tor-sasl/ec) (Client Quit) |
| 21:06:20 | → | ec joins (~ec@gateway/tor-sasl/ec) |
| 21:06:29 | <Joao003> | jade[m]: How do you say? |
| 21:10:13 | <int-e> | Joao003: why did you ask? |
| 21:10:26 | <Joao003> | Examples |
| 21:10:57 | × | kaskal quits (~kaskal@2001:4bb8:2cc:efb3:2d42:311d:d744:4a5) (Quit: ZNC - https://znc.in) |
| 21:11:38 | <Rembane> | :t ($!) |
| 21:11:39 | <lambdabot> | (a -> b) -> a -> b |
| 21:11:57 | → | kaskal joins (~kaskal@213-147-167-152.nat.highway.webapn.at) |
| 21:11:59 | <Rembane> | Looks pretty, gives a certain oompf to function calls. |
| 21:12:57 | <int-e> | @src ($!) |
| 21:12:57 | <lambdabot> | f $! x = x `seq` f x |
| 21:13:16 | <Joao003> | > (+1) $! 2 |
| 21:13:18 | <lambdabot> | 3 |
| 21:14:18 | <Joao003> | @src seq |
| 21:14:18 | <lambdabot> | Source not found. That's something I cannot allow to happen. |
| 21:14:27 | <int-e> | Meh, it's a bit of a special use function... especially ever since bang patterns were added to the language. |
| 21:15:17 | <Joao003> | > (\x -> print x >> print x) "Hi" |
| 21:15:18 | <lambdabot> | <IO ()> |
| 21:15:22 | <Joao003> | Wut |
| 21:15:29 | <Joao003> | % (\x -> print x >> print x) "Hi" |
| 21:15:29 | <yahb2> | "Hi" ; "Hi" |
| 21:15:37 | <int-e> | As usual with adding strictness, you do that to avoid building huge thunks. The standard example of that is probably foldl, let's take the special case of list length: length xs = go xs 0 where go [] n = n; go (x:xs) n = go xs (n+1) |
| 21:16:01 | <int-e> | > let length xs = go xs 0 where go [] n = n; go (x:xs) n = go xs (n+1) in length [1..1000000] |
| 21:16:04 | <lambdabot> | 1000000 |
| 21:17:14 | <Joao003> | > let length = foldl (+1) 0 in length [1..1000000] |
| 21:17:15 | <lambdabot> | error: |
| 21:17:16 | <lambdabot> | • Occurs check: cannot construct the infinite type: b1 ~ a -> b1 |
| 21:17:16 | <lambdabot> | Expected type: b1 -> a -> b1 |
| 21:17:17 | <int-e> | looks harmless, but it turns out to use a lot of heap space and stack, because it builds a huge (...((1+1)+1)+1...)+1 expression |
| 21:17:31 | <Joao003> | > let length = foldr (+1) 0 in length [1..1000000] |
| 21:17:32 | <lambdabot> | error: |
| 21:17:33 | <lambdabot> | • No instance for (Num (Integer -> Integer)) |
| 21:17:33 | <lambdabot> | arising from a use of ‘e_11011000000’ |
| 21:17:39 | <Joao003> | > let length = foldr (1+) 0 in length [1..1000000] |
| 21:17:41 | <lambdabot> | error: |
| 21:17:41 | <lambdabot> | • No instance for (Num (Integer -> Integer)) |
| 21:17:41 | <lambdabot> | arising from a use of ‘e_11011000000’ |
| 21:17:46 | × | trev quits (~trev@user/trev) (Quit: trev) |
| 21:17:48 | <int-e> | > let length xs = go xs 0 where go [] n = n; go (x:xs) n = go xs $! (n+1) in length [1..1000000] -- this version forces the accumulator so it doesn't have that problem. |
| 21:17:50 | <lambdabot> | 1000000 |
| 21:18:29 | <int-e> | Joao003: (1+) takes only one argument; it gets two, the current accumulator, and the list element. you'd have to ignore the list element. |
| 21:19:14 | <Joao003> | > let length = foldr (const (1+)) in length [1..1000000] |
| 21:19:17 | <lambdabot> | error: |
| 21:19:17 | <lambdabot> | • No instance for (Typeable b0) |
| 21:19:17 | <lambdabot> | arising from a use of ‘show_M13079378390562866788’ |
| 21:19:27 | <Joao003> | Too huge to handle |
| 21:19:51 | <Joao003> | > length [1..1000000] -- Prelude |
| 21:19:51 | <int-e> | > foldl (flip (const (1+))) 0 [1..1000000] |
| 21:19:53 | <lambdabot> | 1000000 |
| 21:19:54 | <lambdabot> | 1000000 |
| 21:20:00 | <int-e> | > foldr (const (1+)) 0 [1..1000000] |
| 21:20:02 | <lambdabot> | 1000000 |
| 21:20:07 | int-e | shrugs |
| 21:21:02 | <Joao003> | > let length = go 0 where go n (x:xs) = go (n+1) xs; go n [] = n in length [1..1000000] |
| 21:21:04 | <lambdabot> | 1000000 |
| 21:21:52 | <int-e> | The reason why $! is more of special use function is that often the argument that needs to be strict is not the final argument of the function, or you want to force several arguments. |
| 21:22:36 | <int-e> | So you'll notice that your version of `go` doesn't allow a natural use of $!... you'd have to write `(go $! n+1) xs` which is awkward. |
| 21:23:05 | <int-e> | I deliberately had the arguments swapped in my example. |
| 21:24:00 | <Joao003> | > let reverse = go [] where go res (x:xs) = go (x:res) xs; go res [] = res in reverse [1..10^6] |
| 21:24:02 | <lambdabot> | [1000000,999999,999998,999997,999996,999995,999994,999993,999992,999991,9999... |
| 21:24:11 | × | alexherbo2 quits (~alexherbo@2a02-842a-8180-4601-85e1-23ae-ea70-6ae4.rev.sfr.net) (Remote host closed the connection) |
| 21:24:26 | <int-e> | > let length = go 0 where go !n (x:xs) = go (n+1) xs; go n [] = n in length "abc" -- and BangPatterns are easier in this case anyway |
| 21:24:28 | <lambdabot> | 3 |
| 21:27:19 | <Joao003> | > let foldl f s = go s where go r (x:xs) = go (f r x) xs; go r [] = r in foldl (+) [1..10] |
| 21:27:21 | <lambdabot> | error: |
| 21:27:21 | <lambdabot> | • No instance for (Num [Integer]) arising from a use of ‘e_1110’ |
| 21:27:21 | <lambdabot> | • In the expression: e_1110 |
| 21:27:27 | <Joao003> | > let foldl f s = go s where go r (x:xs) = go (f r x) xs; go r [] = r in foldl (+) 0 [1..10] |
| 21:27:29 | <lambdabot> | 55 |
| 21:27:59 | <jean-paul[m]> | If I want to write Haskell that works on large data structures in memory (specifically this - not so large structures that they can't all fit into memory) are there things I should be considering in my design that are particular to Haskell (or maybe even to GHC) _up front_ so the result will perform well? Or do I just make it right first and make it fast later? Or is it just another one of those inconvenient "it depends" questions? |
| 21:29:36 | × | michalz quits (~michalz@185.246.207.221) (Remote host closed the connection) |
| 21:30:44 | <Rembane> | jean-paul[m]: will the datastructures be retained in memory for the whole program execution or will they be replaced? |
| 21:32:57 | <int-e> | jean-paul[m]: I don't know. Avoid lists (except when they're really short or you benefit from laziness or you can share tails a lot... ultimately "it depends"); you can avoid quite a few excessive laziness pitfalls if you make the appropriate fields in your data structures strict. |
| 21:33:13 | <Joao003> | Fun fact: in the Hackage page for Prelude, there is only one occurrence of the character `%` |
| 21:35:13 | Batzy_ | is now known as Batzy |
| 21:38:38 | × | lottaquestions quits (~nick@2607:fa49:503f:6d00:5c2:d038:28d6:c518) (Remote host closed the connection) |
| 21:39:04 | → | alexherbo2 joins (~alexherbo@2a02-842a-8180-4601-85e1-23ae-ea70-6ae4.rev.sfr.net) |
| 21:39:05 | → | lottaquestions joins (~nick@2607:fa49:503f:6d00:b69d:225e:2844:c837) |
| 21:45:52 | <jade[m]> | has anyone used liquid haskell and can share their experience with it? |
| 21:46:38 | × | Joao003 quits (~Joao003@2804:840:8311:b700:e035:773e:85f2:c516) (Quit: Leaving) |
| 21:50:42 | × | dy quits (sid3438@user/dy) (Quit: Updating details, brb) |
| 21:50:51 | → | dy joins (sid3438@user/dy) |
| 21:51:53 | → | jero98772 joins (~jero98772@2800:484:1d84:9000::2) |
| 21:53:13 | → | nate1 joins (~nate@98.45.169.16) |
| 21:58:04 | × | nate1 quits (~nate@98.45.169.16) (Ping timeout: 252 seconds) |
| 22:00:27 | <jean-paul[m]> | Rembane: They'll change a bit at a time |
| 22:01:05 | <jean-paul[m]> | int-e: So consider strict vs lazy early? Does that mean it's tricky to go back later and make lazy things strict? |
| 22:01:13 | <Rembane> | jean-paul[m]: So no huge garbage collections in the middle? |
| 22:01:44 | <int-e> | jean-paul[m]: it's tricky to figure out *where* things are insufficiently strict |
| 22:01:55 | <somerandomnick[m> | nono, write small, simple composable pieces |
| 22:01:56 | <somerandomnick[m> | then you can make those strict or lazy later |
| 22:05:57 | × | coot quits (~coot@2a02:a310:e241:1b00:ec1a:e9df:79ac:66ba) (Quit: coot) |
| 22:07:12 | <int-e> | jean-paul[m]: It doesn't really matter when you do this I suppose... the main idea here is that making fields strict if evaluating subdata lazily won't ever pay off is better than forcing that same field all over the place. |
| 22:07:27 | <int-e> | going back and changing things later works both ways too |
| 22:07:52 | <hammond> | I'm calling this: |
| 22:07:54 | <hammond> | roundToStr :: (PrintfArg a, Floating a) => Int -> a -> String |
| 22:07:56 | <hammond> | roundToStr = printf "%0.*f" |
| 22:08:08 | <hammond> | with a Double and it works fine. why is that? |
| 22:08:18 | <jean-paul[m]> | Rembane: I'm not sure. That's one place where I don't feel like I have much of an intuition yet. If there's one large structure, will a small change to it create a huge amount of garbage? If it is immutable I could imagine this being the case. |
| 22:08:21 | <hammond> | how is Floating a Double? |
| 22:08:32 | <int-e> | It's a type class |
| 22:08:39 | <hammond> | k |
| 22:08:40 | <int-e> | Both Double and Float are instances of Floating |
| 22:08:55 | <int-e> | (I imagine Comples Double and Comples Float are as well) |
| 22:09:03 | <int-e> | *Complex |
| 22:09:32 | <Rembane> | jean-paul[m]: I usually assume that there's some magic in the RTS that handles that. There's probably a more formal explanation for how that works. |
| 22:10:21 | <jade[m]> | int-e: `ReaFloat a => Floating (Complex a)` |
| 22:10:29 | <int-e> | (But are there PrintfArg instances for Complex?) |
| 22:10:51 | <jade[m]> | s/ReaFloat/RealFloat/ |
| 22:11:05 | <int-e> | (Answer, not by default.) |
| 22:12:05 | × | [itchyjunk] quits (~itchyjunk@user/itchyjunk/x-7353470) (Ping timeout: 260 seconds) |
| 22:12:36 | <hammond> | whats that => thingie, I don't understand that in relation to currying. |
| 22:12:40 | <hammond> | :) |
| 22:12:58 | <jean-paul[m]> | int-e: Got it, thanks |
| 22:13:00 | <jade[m]> | It adds a constraint on the type |
| 22:13:02 | <jean-paul[m]> | Rembane: I love RTS magic. :) |
| 22:13:09 | <Rembane> | jean-paul[m]: It's the best kind of magic. :) |
| 22:13:27 | <jade[m]> | here it's a typeclass constraint (whatever a may be, it has to be an instance of the typeclass) |
| 22:13:59 | <hammond> | but it seems to turn into an Int. |
| 22:14:14 | <jade[m]> | hm? |
| 22:14:37 | <hammond> | i call the function like this roundToStr 2 someDoubleHere |
| 22:14:52 | <hammond> | why do i need all that. |
| 22:15:12 | <jade[m]> | I don't understand the question |
| 22:15:27 | <hammond> | I could have just defined the function Int->Double->String |
| 22:15:39 | <monochrom> | Yes. |
| 22:15:49 | <geekosaur> | "%.*f" means "print something in fixed floating point format, with a specified width (the *)" |
| 22:15:56 | <geekosaur> | the Int corresponds to the width |
| 22:16:17 | <jade[m]> | yes, you can make the function more narrow |
| 22:16:28 | <jade[m]> | but usually you don't want that |
| 22:16:50 | <jade[m]> | keeping things as general as possible is good most of the time |
| 22:16:52 | <monochrom> | If someone else want a more general and polymorphic version, they are not wrong. If you want a more concrete KISS version, you are not wrong either. |
| 22:16:53 | <int-e> | :t sort |
| 22:16:54 | <lambdabot> | Ord a => [a] -> [a] |
| 22:17:11 | <geekosaur> | jade[m], there's tradeoffs there |
| 22:17:13 | → | merijn joins (~merijn@c-001-001-006.client.esciencecenter.eduvpn.nl) |
| 22:17:18 | <monochrom> | There is not going to be an answer to "why must I do that?". Do whatever you want. |
| 22:17:32 | <geekosaur> | more general means slower and (usually) more complex error modes |
| 22:17:39 | <geekosaur> | more specific means less flexible |
| 22:17:53 | <jade[m]> | compile time errors that is? |
| 22:17:57 | <geekosaur> | yes |
| 22:18:07 | <monochrom> | If you are curious about "Floating a =>", read up on type classes. |
| 22:18:20 | <hammond> | ok |
| 22:18:28 | <jade[m]> | fair point, I think it strongly depends on the scope that the function will be used in |
| 22:18:43 | → | [itchyjunk] joins (~itchyjunk@user/itchyjunk/x-7353470) |
| 22:19:16 | <int-e> | hammond: Type class constraints are used a lot in Haskell to give polymorphic functions access to useful operations on types. `sort` (see above), for example, needs to compare values, and that's what the `Ord` class is for. You (usually) don't have to worry about the constraint much... the compiler will infer it for you when possible. You will see type errors though when that fails. (Try... |
| 22:19:22 | <int-e> | ...`roundToStr 42 "abc"` and see what error you get...) |
| 22:19:43 | <hammond> | lemmi see |
| 22:20:23 | <int-e> | (Unfortunately those errors are not exactly pretty... they'll take a while to get used to.) |
| 22:22:29 | <monochrom> | If you keep seeing advanced generalizations in libraries, well that's because libraries need to be general, and besides the target audience is people who have finished learning Haskell. |
| 22:22:40 | <monochrom> | This is the same over all languages. |
| 22:22:41 | <hammond> | I'll read more on it. |
| 22:23:44 | <jade[m]> | monochrom: is there a finish to learning haskell? ;) |
| 22:23:57 | <monochrom> | An absolute C beginner who has barely started with "int foo(int i)" will look at a real world library and see "void *" all over the place and the correct response is "one step at a time". |
| 22:25:40 | × | cheater quits (~Username@user/cheater) (Quit: Going offline, see ya! (www.adiirc.com)) |
| 22:31:44 | × | azimut quits (~azimut@gateway/tor-sasl/azimut) (Ping timeout: 240 seconds) |
| 22:33:29 | → | cheater joins (~Username@user/cheater) |
| 22:36:07 | → | cheater_ joins (~Username@user/cheater) |
| 22:36:22 | × | cheater_ quits (~Username@user/cheater) (Read error: Connection reset by peer) |
| 22:37:12 | → | cheater_ joins (~Username@user/cheater) |
| 22:37:28 | × | cheater_ quits (~Username@user/cheater) (Read error: Connection reset by peer) |
| 22:37:31 | × | wroathe quits (~wroathe@user/wroathe) (Ping timeout: 248 seconds) |
| 22:39:01 | × | cheater quits (~Username@user/cheater) (Ping timeout: 276 seconds) |
| 22:41:04 | × | takuan quits (~takuan@178-116-218-225.access.telenet.be) (Remote host closed the connection) |
| 22:47:14 | × | zeenk quits (~zeenk@2a02:2f04:a20f:5200::7fe) (Quit: Konversation terminated!) |
| 22:49:57 | × | bratwurst quits (~dfadsva@2604:3d09:207f:f650::9c24) (Quit: Leaving) |
| 22:50:20 | × | merijn quits (~merijn@c-001-001-006.client.esciencecenter.eduvpn.nl) (Ping timeout: 246 seconds) |
| 22:51:27 | → | wroathe joins (~wroathe@207-153-38-140.fttp.usinternet.com) |
| 22:51:27 | × | wroathe quits (~wroathe@207-153-38-140.fttp.usinternet.com) (Changing host) |
| 22:51:27 | → | wroathe joins (~wroathe@user/wroathe) |
| 22:53:08 | × | acidjnk_new quits (~acidjnk@p200300d6e715c468b4bf77e5a0595f20.dip0.t-ipconnect.de) (Ping timeout: 246 seconds) |
| 22:54:00 | wagle_ | is now known as wagle |
| 23:01:54 | × | tubogram44 quits (~tubogram@user/tubogram) (Quit: Ping timeout (120 seconds)) |
| 23:02:14 | → | tubogram44 joins (~tubogram@user/tubogram) |
| 23:10:01 | × | tremon quits (~tremon@83.80.159.219) (Quit: getting boxed in) |
| 23:16:38 | × | gurkenglas quits (~gurkengla@dynamic-046-114-176-011.46.114.pool.telefonica.de) (Ping timeout: 246 seconds) |
| 23:25:53 | <somerandomnick[m> | jade: keep in mind that type class constraints can make your compiled program inefficient. When exposing an API I recommend the SPECIALIZE pragma. |
| 23:26:13 | <somerandomnick[m> | when using general functions in your code make sure GHC creates specialized instances of those functions |
| 23:26:31 | <somerandomnick[m> | or just dont call them "all the time" |
| 23:32:00 | → | falafel joins (~falafel@2603-8000-d700-115c-2fcd-f6bf-9b28-c84d.res6.spectrum.com) |
| 23:40:12 | → | mauke_ joins (~mauke@user/mauke) |
| 23:41:47 | × | mauke quits (~mauke@user/mauke) (Ping timeout: 246 seconds) |
| 23:41:47 | mauke_ | is now known as mauke |
| 23:47:54 | × | falafel quits (~falafel@2603-8000-d700-115c-2fcd-f6bf-9b28-c84d.res6.spectrum.com) (Ping timeout: 250 seconds) |
| 23:48:27 | <mmynsted[m]> | How do I customize the files used by cabal init when I create a new project? For example the default Main.hs it creates for an executable? |
| 23:48:59 | → | cheater joins (~Username@user/cheater) |
| 23:51:34 | → | jmdaemon joins (~jmdaemon@user/jmdaemon) |
| 23:51:53 | × | cheater quits (~Username@user/cheater) (Read error: Connection reset by peer) |
| 23:53:51 | → | janus joins (janus@anubis.0x90.dk) |
| 23:57:51 | <mmynsted[m]> | It does not appear to be in or referenced in ~/.cabal/config |
| 23:58:10 | → | Me-me joins (~Me-me@user/me-me) |
All times are in UTC on 2023-04-29.