So lately I have a list of strings, and need to independently go over each one and perform some IO function.
So basically what I have is this:
sepp2k and solrize are right to recommend mapM_. But, in the spirit of teaching you to fish instead of giving you a fish, here's something you can try in the future:
(String -> IO ()) -> [String] -> IO ().String with a to get (a -> IO ()) -> [a] -> IO (), and search for that.Now the third result of the second search is mapM_ :: Monad m => (a -> m b) -> [a] -> m (), which is exactly what you want. (The first answer, closeFdWith :: (Fd -> IO ()) -> Fd -> IO () is not a relevant result; the second, traverse_ :: (Foldable t, Applicative f) => (a -> f b) -> t a -> f () is relevant but a bit more complicated to understand and use.)