<div dir="ltr">We tried to minimize the extra symbols we took from the Prelude in 7.10, while ensuring you could write most instances. <div><br></div><div>We left off exporting fold, foldr', foldl' and toList from the Prelude because they were names we didn't strictly have to take.<br></div><div><br></div><div>foldMap was necessary as a minimal definition of the class, and Monoid was needed to deal not only with foldMap, but also to avoid orphaning the existing Applicative ((,) m) writer instance, and implement the Monad for ((,) m) which had previously passed libraries@ review on multiple occasions, most recently in <a href="https://mail.haskell.org/pipermail/libraries/2013-July/020455.html">2013</a> but had been heretofore blocked by the internal structure of base.<div><br></div><div><div>I'm happy to have a conversation about adding foldl' to the Prelude, it is arguably the right default for a huge class of operations on different containers. I'd also be happy to have a conversation about just exporting all of the API of Foldable. We originally planned on punting that off to 7.12 as exporting _any_ additional names from the Prelude was already a big step for us to ask the community to take, and we're still trying to get a sense of the community's appetite for such changes.</div><div><br></div><div>As for exporting foldl' while not exporting foldr' note that that is a rather large pessimization for containers like Vector, which can admit time and space efficient versions of both foldl' and foldr'. The assumption that foldr' is always bad is very list-centric.</div><div><br></div><div>-Edward</div></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Feb 24, 2015 at 3:42 PM, Bob Ippolito <span dir="ltr"><<a href="mailto:bob@redivi.com" target="_blank">bob@redivi.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"><div><span style="font-size:12.8000001907349px">(Cross-posted from haskell-cafe as suggested by Carter Schonwald)</span></div><div><span style="font-size:12.8000001907349px"><br></span></div><span style="font-size:12.8000001907349px">I would love to have foldl' as part of the Prelude. I use it quite frequently and it seems like a beginner trap to have foldl but not foldl' (which is almost always the better choice). I see that foldMap has been added (in addition to all of Monoid and Traversable), why was foldl' left out?</span><div style="font-size:12.8000001907349px"><br></div><div style="font-size:12.8000001907349px">It might be good measure to add foldr' as well, although I use that much less frequently.</div><span class="HOEnZb"><font color="#888888"><div style="font-size:12.8000001907349px"><br></div><div style="font-size:12.8000001907349px">-bob</div><div style="font-size:12.8000001907349px"><br></div></font></span></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" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries</a><br>
<br></blockquote></div><br></div>