Generalizing map?

Fumiaki Kinoshita fumiexcel at gmail.com
Fri Mar 13 09:32:05 UTC 2015


A dozen of functions like concat, foldr, mapM, have been generalized
through BBP.

Then, why do we leave `map` just for lists? Obviously `map` can be
generalized, so

map :: Functor f => (a -> b) -> f a -> f b
map = fmap

The current definition of `map` looks too special to be a special case of
mapM (map f = runIdentity . mapM (Identity . f)).
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/libraries/attachments/20150313/5f24a01e/attachment.html>


More information about the Libraries mailing list