Proposal: strictify foldl'

David Feuer david.feuer at gmail.com
Mon Nov 3 17:10:17 UTC 2014


The deepseq package doesn't provide any sort of foldl. I'd personally be
very much opposed to such a change in any case; Something built up by
foldl' may only modify things near the root of the accumulator.

On Mon, Nov 3, 2014 at 11:59 AM, Henning Thielemann <
lemming at henning-thielemann.de> wrote:

>
> 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.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/libraries/attachments/20141103/20e241c2/attachment.html>


More information about the Libraries mailing list