[Haskell-cafe] Should foldl' be added to the post-"Plan FTP" Prelude?

Roman Cheplyaka roma at ro-che.info
Tue Feb 24 20:38:14 UTC 2015

I'd agree that foldl' should be in Prelude.

foldr', on the other hand, is another trap. It only makes sense for
left-associated data structures like snoc lists, but some may think that
foldr' is an "improved" version of foldr and use it for lists as well,
which would be a mistake.

On 24/02/15 22:24, Bob Ippolito wrote:
> 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?
> It might be good measure to add foldr' as well, although I use that much
> less frequently.
> -bob
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe

More information about the Haskell-Cafe mailing list