
22 Dec
2005
22 Dec
'05
8:57 p.m.
Paul Moore wrote:
Not trying to fan the flames, but one thing I struggle with is understanding (at a "gut level" - if you explain the theory, I'll understand, but go away none the wiser in practice...) why I need mapM as well as map (and all the other -M functions, liftM, foldM, etc...)
All you really need to understand is what sequence :: Monad m => [m a] -> m [a] does. Once you get that, the difference between map and mapM is clear because of mapM f xs = sequence (map f xs) Udo. -- Worrying is like rocking in a rocking chair -- It gives you something to do, but it doesn't get you anywhere.