Logs: liberachat/#haskell
| 2026-01-08 20:15:04 | → | newmind joins (~newmind@91-133-90-252.dyn.cablelink.at) |
| 2026-01-08 20:15:36 | × | Googulator82 quits (~Googulato@2a01-036d-0106-4994-68db-cf64-05de-a70a.pool6.digikabel.hu) (Quit: Client closed) |
| 2026-01-08 20:15:44 | → | Googulator82 joins (~Googulato@2a01-036d-0106-4994-68db-cf64-05de-a70a.pool6.digikabel.hu) |
| 2026-01-08 20:21:24 | × | tromp quits (~textual@2001:1c00:3487:1b00:a460:d351:8685:d1f0) (Quit: My iMac has gone to sleep. ZZZzzz…) |
| 2026-01-08 20:21:45 | <Leary> | @where dangerous |
| 2026-01-08 20:21:45 | <lambdabot> | https://github.com/NorfairKing/haskell-dangerous-functions |
| 2026-01-08 20:21:48 | <Leary> | larsivi: ^ |
| 2026-01-08 20:22:11 | × | vanishingideal quits (~vanishing@user/vanishingideal) (Ping timeout: 250 seconds) |
| 2026-01-08 20:22:26 | × | peterbecich quits (~Thunderbi@71.84.33.135) (Quit: peterbecich) |
| 2026-01-08 20:22:30 | → | tromp joins (~textual@2001:1c00:3487:1b00:a460:d351:8685:d1f0) |
| 2026-01-08 20:23:53 | <EvanR> | yes foldl and foldl' are strictly (no pun intended) different beasts and not simply one is a more optimized version of the other |
| 2026-01-08 20:24:03 | <EvanR> | which might be why we still have them |
| 2026-01-08 20:25:11 | <EvanR> | larsivi, and foldl' was one of the first things covered in "tutorials" way back when. Once you see this, "primed" versions of other functions start to raise enough eyebrows to not be surprising |
| 2026-01-08 20:25:50 | → | merijn joins (~merijn@77.242.116.146) |
| 2026-01-08 20:25:56 | × | comerijn quits (~merijn@host-cl.cgnat-g.v4.dfn.nl) (Read error: Connection reset by peer) |
| 2026-01-08 20:28:11 | → | vanishingideal joins (~vanishing@user/vanishingideal) |
| 2026-01-08 20:30:29 | × | Googulator82 quits (~Googulato@2a01-036d-0106-4994-68db-cf64-05de-a70a.pool6.digikabel.hu) (Quit: Client closed) |
| 2026-01-08 20:30:52 | → | Googulator82 joins (~Googulato@2a01-036d-0106-4994-68db-cf64-05de-a70a.pool6.digikabel.hu) |
| 2026-01-08 20:30:55 | × | yin quits (~zero@user/zero) (Ping timeout: 246 seconds) |
| 2026-01-08 20:31:15 | × | merijn quits (~merijn@77.242.116.146) (Ping timeout: 240 seconds) |
| 2026-01-08 20:32:04 | → | haritz joins (~hrtz@2a01:4b00:bc2e:7000:d5af:a266:ca31:5ef8) |
| 2026-01-08 20:32:05 | × | haritz quits (~hrtz@2a01:4b00:bc2e:7000:d5af:a266:ca31:5ef8) (Changing host) |
| 2026-01-08 20:32:05 | → | haritz joins (~hrtz@user/haritz) |
| 2026-01-08 20:33:55 | → | yin joins (~zero@user/zero) |
| 2026-01-08 20:36:56 | → | pavonia joins (~user@user/siracusa) |
| 2026-01-08 20:39:06 | → | CiaoSen joins (~Jura@2a02:8071:64e1:da0:5a47:caff:fe78:33db) |
| 2026-01-08 20:42:42 | → | jreicher joins (~joelr@user/jreicher) |
| 2026-01-08 20:43:40 | → | merijn joins (~merijn@host-cl.cgnat-g.v4.dfn.nl) |
| 2026-01-08 20:50:15 | × | merijn quits (~merijn@host-cl.cgnat-g.v4.dfn.nl) (Ping timeout: 240 seconds) |
| 2026-01-08 20:52:45 | <jreicher> | tomsmeding: I've sometimes wondered why foldl exists at all. |
| 2026-01-08 20:53:30 | × | Enrico63 quits (~Enrico63@host-95-251-99-143.retail.telecomitalia.it) (Quit: Client closed) |
| 2026-01-08 20:54:27 | <monochrom> | It came from an old time when people did not notice or did not mind the space growth in e.g. foldl (+) |
| 2026-01-08 20:55:43 | <monochrom> | and also when they just copied the standard libraries of other functional languages (and those languages are not lazy). |
| 2026-01-08 20:56:16 | <tomsmeding> | jreicher: on lists, foldl is almost useless (`last` notwithstanding), but on general Foldables, foldl is just the mirror image of foldr |
| 2026-01-08 20:56:51 | <jreicher> | monochrom: but why not "replace" foldl with foldl'? Even if you're copying the standard libraries from other languages, you don't need to keep the same implementation. |
| 2026-01-08 20:56:54 | <tomsmeding> | so monochrom's explanation is historically correct (because foldl started out as a plain-list function), but these days, there is a reason for hvaing foldl |
| 2026-01-08 20:56:56 | × | michalz quits (~michalz@185.246.207.221) (Remote host closed the connection) |
| 2026-01-08 20:57:01 | <jreicher> | tomsmeding: yes, that's my point. if foldl is useless, why keep it? |
| 2026-01-08 20:57:15 | <tomsmeding> | % :t foldl |
| 2026-01-08 20:57:15 | <yahb2> | foldl :: Foldable t => (b -> a -> b) -> b -> t a -> b |
| 2026-01-08 20:57:51 | <tomsmeding> | jreicher: I just explained how foldl is not useless any more on certain types that are not [a] |
| 2026-01-08 20:58:08 | <monochrom> | This community is too polite to delete things in the stdlib or on the wiki. :) |
| 2026-01-08 20:58:51 | <monochrom> | I mean :( even >:( but it's a good day let's just :) |
| 2026-01-08 20:58:53 | <tomsmeding> | in particular, if you have `data RevList a = Nil | Snoc (RevList a) a deriving (Foldable)`, then foldr will have the useless behaviour and foldl will be as useful as foldr is on [a] |
| 2026-01-08 20:59:36 | <tomsmeding> | granted, [a] is much more common than RevList, but still, removing it now would be a bit brash |
| 2026-01-08 20:59:41 | → | Enrico63 joins (~Enrico63@host-95-251-99-143.retail.telecomitalia.it) |
| 2026-01-08 20:59:56 | <monochrom> | OK yeah Foldable should have all 4 combinations and then you choose the best one for the actual use case. |
| 2026-01-08 20:59:57 | → | itaipu joins (~itaipu@168.121.99.54) |
| 2026-01-08 21:00:40 | <tomsmeding> | (and indeed, Foldable does have foldr' since GHC 7.6 :p) |
| 2026-01-08 21:01:19 | <jreicher> | I can't shake the feeling that it shouldn't be necessary to have four instead of two, but I can't assemble a coherent argument just at the moment. |
| 2026-01-08 21:01:23 | → | merijn joins (~merijn@host-cl.cgnat-g.v4.dfn.nl) |
| 2026-01-08 21:01:50 | <monochrom> | > foldr (&&) False (False : undefined) |
| 2026-01-08 21:01:51 | <lambdabot> | False |
| 2026-01-08 21:01:58 | <monochrom> | I don't want your foldr' for that. |
| 2026-01-08 21:02:15 | <tomsmeding> | jreicher: you can reduce it to two: foldMap and foldMap' |
| 2026-01-08 21:02:16 | <monochrom> | But I would want your foldr' for some other data structure. |
| 2026-01-08 21:02:25 | × | ridcully quits (~ridcully@pd951fc06.dip0.t-ipconnect.de) (Ping timeout: 245 seconds) |
| 2026-01-08 21:02:43 | → | ridcully joins (~ridcully@pd951f83e.dip0.t-ipconnect.de) |
| 2026-01-08 21:03:10 | <monochrom> | My point is that I want to be allowed to choose between foldr and foldr' and you don't know a priori which one is best for me. |
| 2026-01-08 21:04:15 | <dolio> | Yes, the only question is which one gets which name. |
| 2026-01-08 21:04:44 | <tomsmeding> | a prime for a strict version is so entrenched at this point that doing it the other way round would be a crime. :) |
| 2026-01-08 21:04:56 | <ncf> | if we had better identifiers we could have foldl! for the strict version |
| 2026-01-08 21:05:17 | <tomsmeding> | (that always makes me think of Ruby's chop!) |
| 2026-01-08 21:05:19 | <monochrom> | Oh haha that inspires me. foldr' and foldr_ to make it more confusing. :) |
| 2026-01-08 21:05:55 | <monochrom> | What is Ruby's chop? Is it similar to Prolog's cut? |
| 2026-01-08 21:05:55 | × | merijn quits (~merijn@host-cl.cgnat-g.v4.dfn.nl) (Ping timeout: 240 seconds) |
| 2026-01-08 21:06:04 | <tomsmeding> | no, it just sounds funny with the ! |
| 2026-01-08 21:06:12 | <dolio> | It's in-place trimming or something. |
| 2026-01-08 21:06:35 | × | Enrico63 quits (~Enrico63@host-95-251-99-143.retail.telecomitalia.it) (Quit: Client closed) |
| 2026-01-08 21:06:45 | <dolio> | Exclamation points indicate mutation, I think. |
| 2026-01-08 21:07:02 | monochrom | invents Prolog's dice, which means "if random() > 0.5 then cut else nop", so literally dice in two senses. >:) |
| 2026-01-08 21:07:23 | <monochrom> | Oh, like Perl's chop. |
| 2026-01-08 21:07:27 | <dolio> | Yeah. |
| 2026-01-08 21:07:39 | <monochrom> | @stab monochrom |
| 2026-01-08 21:07:39 | lambdabot | throws some pointy lambdas at monochrom |
| 2026-01-08 21:07:40 | × | trickard quits (~trickard@cpe-50-98-47-163.wireline.com.au) (Ping timeout: 246 seconds) |
| 2026-01-08 21:07:42 | <monochrom> | @stab monochrom |
| 2026-01-08 21:07:42 | lambdabot | pulls monochrom through the Evil Mangler |
| 2026-01-08 21:07:45 | <monochrom> | @stab monochrom |
| 2026-01-08 21:07:45 | lambdabot | moulds monochrom into a delicous cookie, and places it in her oven |
| 2026-01-08 21:08:06 | → | trickard_ joins (~trickard@cpe-50-98-47-163.wireline.com.au) |
| 2026-01-08 21:08:14 | <monochrom> | There is one that says "chop ... into pieces" or something like that. |
| 2026-01-08 21:09:40 | <monochrom> | Oh haha there is also a Banach-Tarski one. :) |
| 2026-01-08 21:10:05 | <darkling> | monochrommonochrom. An anagram. :) |
| 2026-01-08 21:10:30 | <monochrom> | haha |
| 2026-01-08 21:11:17 | <monochrom> | I think the mathematicians also have a joke along the line of "what's the anagram of Banach-Tarski" |
| 2026-01-08 21:11:36 | <darkling> | That's the joke I was thinking of. |
| 2026-01-08 21:11:51 | <monochrom> | hehe |
| 2026-01-08 21:17:11 | → | merijn joins (~merijn@host-cl.cgnat-g.v4.dfn.nl) |
| 2026-01-08 21:18:08 | Square3 | is now known as Square |
| 2026-01-08 21:21:55 | × | merijn quits (~merijn@host-cl.cgnat-g.v4.dfn.nl) (Ping timeout: 240 seconds) |
| 2026-01-08 21:24:12 | × | Vizious quits (~bes@user/Vizious) (Quit: WeeChat 4.8.1) |
| 2026-01-08 21:24:23 | <EvanR> | we spend a lot of time hating on foldl because we think we understand it and think it's completely useless. But if we didn't dwell on foldl so much, we might miss all the other things in the standard library which potentially blow up in your face and don't have real answers |
| 2026-01-08 21:25:01 | <EvanR> | we'd have like 10 different other foldl situations and the conversion would get kind of confusing |
| 2026-01-08 21:25:23 | <EvanR> | the whole drama stems from haskell's laziness, which you can't really escape |
| 2026-01-08 21:25:27 | <EvanR> | you have to understand it |
| 2026-01-08 21:26:41 | <EvanR> | I'm thinking of the various Writer monads |
| 2026-01-08 21:29:18 | <EvanR> | jreicher, on the subject of how many folds you need in Foldable... there's a huge number of other folding strategies other than left fold and right fold, just for a tree-like DS |
| 2026-01-08 21:30:01 | × | mulk quits (~mulk@pd95143a6.dip0.t-ipconnect.de) (Ping timeout: 264 seconds) |
| 2026-01-08 21:30:04 | × | vanishingideal quits (~vanishing@user/vanishingideal) (Ping timeout: 246 seconds) |
All times are in UTC.