foldl' semantic change

David Feuer david.feuer at gmail.com
Fri Jun 10 12:29:47 UTC 2016


The semantics of foldl' for lists were changed between base 4.7 and base
4.8. Specifically, foldl' became strict in the initial value of its
accumulator. I opened http://ghc.haskell.org/trac/ghc/ticket/12173 to
report this. The change was entirely accidental, according to Joachim
Breitner. However, Duncan Coutts indicated he is pleased with the change. I
don't personally have a dog in this race, but I feel very strongly about
three things:

1. The strictness should be fully documented, both in Haddock and the next
Haskell Report (the Haskell 2010 Report does not go into sufficient detail
to support either choice).

2. There should be *one* meaning of foldl' in base. Thus the default
Foldable instance should match the ones for lists and arrays.

3. The containers package should be consistent with base in this regard.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/libraries/attachments/20160610/55f610f8/attachment.html>


More information about the Libraries mailing list