proposal #2461: add Traversable generalizations of mapAccumL
isaacdupree at charter.net
Fri Aug 1 13:16:09 EDT 2008
Ross Paterson wrote:
> The proposal is to add the following functions to Data.Traversable,
> mapAccumL :: Traversable t => (a -> b -> (a, c)) -> a -> t b -> (a, t c)
> mapAccumR :: Traversable t => (a -> b -> (a, c)) -> a -> t b -> (a, t c)
It is useful as an education effort so that people can see how/which
can be naturally generalized -- or if converting code from using Lists.
(Probably it's useful in its own right, but I haven't used Traversable
recently enough to be able to report on that.) I often thought that even
Data.List.mapAccum[LR] is just on the edge of deserving to be its own
seperate from foldl/foldr anyway...
More information about the Libraries