[Haskell-beginners] Mapping inside State

Karl Voelker karl at karlv.net
Tue Apr 1 04:36:17 UTC 2014

On Mon, Mar 31, 2014, at 09:15 PM, martin wrote:
> (1) I had tried mapM, but this didn't work. I am having trouble to
> understand why the return type is m() and not m [a]

mapM_ is like mapM, except that mapM_ ignores the result value. In other
words, mapM_ is for when you only want the monadic effects. You could
define it like this:

mapM_ f xs = mapM f xs >> return ()


More information about the Beginners mailing list