[Haskell-cafe] how to apply a function which returns IO() to a
list?
Stefan Holdermans
stefan at cs.uu.nl
Wed Jun 14 05:50:35 EDT 2006
Nuno,
> I have this function which write a file:
>
> writeHtml b x y = do
> writeFile (b ++ ".html") (htmlCode b x y)
>
> i need to apply to each member of a given list:
Have a look at the mapM and mapM_ functions from the Prelude.
Instantiated to IO, these have the following types:
mapM :: (a -> IO b) -> [a] -> IO [b]
mapM_ :: (a -> IO b) -> [a] -> m ()
HTH,
Stefan
More information about the Haskell-Cafe
mailing list