I'm super-confused here. It is claimed that the Haskell 98 Report requires List.minimumBy and List.maximumBy to be lazy, but the sample implementations given there use foldl1 (https://www.haskell.org/onlinereport/list.html) and I can't find anyplace in the report where that's explicitly said to be wrong. What am I missing?

On Thu, Oct 29, 2015 at 11:15 AM David Feuer <david.feuer@gmail.com> wrote:

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.

On Oct 29, 2015 2:07 PM, "Joachim Breitner" <mail@joachim-breitner.de> wrote:
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.dehttp://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

_______________________________________________
Libraries mailing list
Libraries@haskell.org
http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries