Proposal: Add a few extra members to Foldable and Traversable classes

Sjoerd Visscher sjoerd at
Sun Sep 21 15:21:10 UTC 2014

> foldMap is used to provide a 'natural' fold regardless of associativity.
> foldMap and foldr are are mutually definable, by using Endo to get foldr from foldMap, or just accepting a right associated monoidal reduction.
> This is why foldr or foldMap are the minimal definitions.
> However, you can't build foldr in terms of foldl with the right behavior on infinite containers, so foldl is _not_ a viable minimal definition for Foldable in a world where you can have infinitely big things to fold!

Wouldn’t it be the other way around for infinite snoc-lists?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Libraries mailing list