[Haskell-cafe] IO () and IO [()]

Lars Viklund zao at acc.umu.se
Mon Mar 10 18:19:09 EDT 2008


On Mon, Mar 10, 2008 at 10:11:33PM +0000, Paulo J. Matos wrote:
> mapM :: (Monad m) => (a -> m b) -> [a] -> m [b]
> 
> So I guess that it makes sense that you get IO [()] instead of IO (),
> and adding an exception just to say that [()] == () isn't good.
> By the way, as a consequence can you possibly get IO (()) or IO ([()])
> and are these all different from each other?

Note that there exists mapM_ which discards the return values.
mapM_ :: (Monad m) => (a -> m b) -> [a] -> m ()

-- 
Lars Viklund | zao at acc.umu.se


More information about the Haskell-Cafe mailing list