patch applied (packages/base): Add Control.Monad.forM and forM_
Simon Marlow
simonmar at microsoft.com
Wed Aug 30 08:19:15 EDT 2006
Thu Aug 24 01:11:18 PDT 2006 Don Stewart <dons at cse.unsw.edu.au>
* Add Control.Monad.forM and forM_
flip mapM_ is more and more common, I find. Several suggestions have
been made to add this, as foreach or something similar. This patch
does just that:
forM :: (Monad m) => [a] -> (a -> m b) -> m [b]
forM_ :: (Monad m) => [a] -> (a -> m b) -> m ()
So we can write:
Prelude Control.Monad> forM_ [1..4] $ \x -> print x
1
2
3
4
M ./Control/Monad.hs +13
More information about the Cvs-libraries
mailing list