Should foldl' be added to the post-"Plan FTP" Prelude

Ben Franksen ben.franksen at online.de
Sat Mar 7 23:08:11 UTC 2015


David Feuer wrote:
> FTP sets up the expectation that foldl has a specific relationship to
> foldMap.

How does foldl have a more specific relationship with foldMap than foldl'? 
Both are currently methods of class Foldable, BTW.

> I suppose you could go against that, 

I have not yet formed an opinion. I just want to understand your response 
which remains cryptic to me.

> and also break any code
> relying on the current foldl semantics, but I'd personally be very much
> opposed to that.

Fair enough, but a different matter.

Cheers
Ben
> On Mar 1, 2015 5:13 PM, "Ben Franksen" <ben.franksen at online.de> wrote:
> 
>> Why not?
>>
>> David Feuer wrote:
>> > No, that is not a way now that we have FTP.
>> >
>> > On Wed, Feb 25, 2015 at 7:31 PM, Kazu Yamamoto <kazu at iij.ad.jp> 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?
>> >>
>> >> That is one way but I think another way is to make foldl strict:
>> >>
>> >>         http://www.well-typed.com/blog/90/
>> >>
>> >> I'm tired of explaining the difference of foldl and foldl' to
>> >> beginners. :-)
>> >>
>> >> --Kazu




More information about the Libraries mailing list