map :: (a -> b) -> [a] -> [b]
fmap :: Functor f => (a -> b) -> f a -> f b
liftM :: Monad m => (a -> b) -> m a -> m b
Why do we have three different functions that do essentially the same thing?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
mapexists to simplify operations on lists and for historical reasons (see What's the point of map in Haskell, when there is fmap?).— Typeclassopedia, page 20
fmapandliftMexist because monads were not automatically functors in Haskell:— Typeclassopedia, page 33
Edit: agustuss’s history of
mapandfmap:— What's the point of map in Haskell, when there is fmap?