Proposal: strictify foldl'
Henning Thielemann
lemming at henning-thielemann.de
Mon Nov 3 16:59:59 UTC 2014
On Mon, 3 Nov 2014, David Feuer wrote:
> Proposal: make foldl' unconditionally strict in the initial accumulator
> value, both in GHC.List and in (the default definition in)
> Data.Foldable, and make foldr' in Data.Foldable unconditionally strict
> in the initial value of its accumulator.
I am worried about the general move from foldl to foldl', because foldl'
is still not strict enough. E.g. if the accumulator is a list, only the
leading (:) is evaluated. I would prefer a strict foldl provided by the
deepseq package and deprecate foldl' in favor of deepseq:foldl. This new
foldl could immediately implement the unconditional strictness for the
initial accumulator value.
More information about the Libraries
mailing list