Foldable and Traversable vs. FunctorM
lemming at henning-thielemann.de
Sun Mar 1 18:21:45 EST 2009
On Fri, 27 Feb 2009, Isaac Dupree wrote:
> Henning Thielemann wrote:
>> ? However 'foldMap' cannot utilize the additional information, namely
>> Position and (Maybe e), respectively. In the first case this is sad, in
>> the second case I consider this bad, since it is too easy to throw away
>> and thus ignore the exception (Maybe e). Some kind of fold is always
>> useful on these structures, but 'foldMap' is too limited.
> I'm not sure what you mean, but if you define Traversable in a sensible way,
> then you can define Foldable with Data.Traversable.foldMapDefault and get a
> sensible definition.
This reminds me on using Data.Traversable.foldMapDefault for the
definition of foldMap. So thanks for that hint! However, what I like to
complain about is, that this foldMap is pretty useless, at least for me.
Are there data structures beyond very simple ones (that is, list, tree,
graphs of elements without additional information) where you can make any
use of it?
More information about the Libraries