<div dir="ltr">foldl1 is lazy, whereas foldl1' is strict. The primes are usually used to indicate strictness.</div><div class="gmail_extra"><br><div class="gmail_quote">On 29 October 2015 at 23:59, Bart Massey <span dir="ltr"><<a href="mailto:bart.massey@gmail.com" target="_blank">bart.massey@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">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 (<a href="https://www.haskell.org/onlinereport/list.html" target="_blank">https://www.haskell.org/onlinereport/list.html</a>) and I can't find anyplace in the report where that's explicitly said to be wrong. What am I missing?</div><div class="HOEnZb"><div class="h5"><br><div class="gmail_quote"><div dir="ltr">On Thu, Oct 29, 2015 at 11:15 AM David Feuer <<a href="mailto:david.feuer@gmail.com" target="_blank">david.feuer@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><p dir="ltr">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.</p>
<div class="gmail_quote">On Oct 29, 2015 2:07 PM, "Joachim Breitner" <<a href="mailto:mail@joachim-breitner.de" target="_blank">mail@joachim-breitner.de</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<br>
Am Donnerstag, den 29.10.2015, 17:34 +0200 schrieb Roman Cheplyaka:<br>
> I just realized (thanks to this reddit thread[1]) that minimumBy is now<br>
> implemented through foldr1. Previously (before FTP), minimumBy from Data.List<br>
> used foldl1, while minimumBy from Data.Foldable used foldr1.<br>
><br>
> I think that the way these were merged was a mistake.<br>
<br>
this has also been raised by Neil at<br>
<a href="https://ghc.haskell.org/trac/ghc/ticket/10830" rel="noreferrer" target="_blank">https://ghc.haskell.org/trac/ghc/ticket/10830</a><br>
<br>
Also note <a href="https://ghc.haskell.org/trac/ghc/ticket/3416" rel="noreferrer" target="_blank">https://ghc.haskell.org/trac/ghc/ticket/3416</a> where it is<br>
stated that the report demands minimum (and hence minimumBy) to be<br>
lazy.<br>
<br>
Ignoring that argument, and that of not changing libraries light-<br>
harted, I do think that foldl1' would be the better choice here; users<br>
who rely on laziness here are likely in the minority and it would be<br>
reasonable to expect them to manually use foldl1 or foldr1.<br>
<br>
BTW, why is there no fold' method in Foldable that leaves the<br>
associativity (left, right, or mixed in case of a tree) to the Foldable<br>
instance?<br>
<br>
<br>
Greetings,<br>
Joachim<br>
<br>
--<br>
Joachim “nomeata” Breitner<br>
  <a href="mailto:mail@joachim-breitner.de" target="_blank">mail@joachim-breitner.de</a> • <a href="http://www.joachim-breitner.de/" rel="noreferrer" target="_blank">http://www.joachim-breitner.de/</a><br>
  Jabber: <a href="mailto:nomeata@joachim-breitner.de" target="_blank">nomeata@joachim-breitner.de</a>  • GPG-Key: 0xF0FBF51F<br>
  Debian Developer: <a href="mailto:nomeata@debian.org" target="_blank">nomeata@debian.org</a><br>
<br>
<br>_______________________________________________<br>
Libraries mailing list<br>
<a href="mailto:Libraries@haskell.org" target="_blank">Libraries@haskell.org</a><br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries</a><br>
<br></blockquote></div>
_______________________________________________<br>
Libraries mailing list<br>
<a href="mailto:Libraries@haskell.org" target="_blank">Libraries@haskell.org</a><br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries</a><br>
</blockquote></div>
</div></div><br>_______________________________________________<br>
Libraries mailing list<br>
<a href="mailto:Libraries@haskell.org">Libraries@haskell.org</a><br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries</a><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><div>Regards</div><div dir="ltr"><div><br></div><div>Sumit Sahrawat</div></div></div></div></div></div></div>
</div>