I think it would be very nice to offer a few folds tailored to specific strictness patterns. I'm not sure of the best interface, however.
Hi,
Am Donnerstag, den 29.10.2015, 17:34 +0200 schrieb Roman Cheplyaka:
> I just realized (thanks to this reddit thread[1]) that minimumBy is now
> implemented through foldr1. Previously (before FTP), minimumBy from Data.List
> used foldl1, while minimumBy from Data.Foldable used foldr1.
>
> I think that the way these were merged was a mistake.
this has also been raised by Neil at
https://ghc.haskell.org/trac/ghc/ticket/10830
Also note https://ghc.haskell.org/trac/ghc/ticket/3416 where it is
stated that the report demands minimum (and hence minimumBy) to be
lazy.
Ignoring that argument, and that of not changing libraries light-
harted, I do think that foldl1' would be the better choice here; users
who rely on laziness here are likely in the minority and it would be
reasonable to expect them to manually use foldl1 or foldr1.
BTW, why is there no fold' method in Foldable that leaves the
associativity (left, right, or mixed in case of a tree) to the Foldable
instance?
Greetings,
Joachim
--
Joachim “nomeata” Breitner
mail@joachim-breitner.de • http://www.joachim-breitner.de/
Jabber: nomeata@joachim-breitner.de • GPG-Key: 0xF0FBF51F
Debian Developer: nomeata@debian.org
_______________________________________________
Libraries mailing list
Libraries@haskell.org
http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries