
You can turn `[IO a]` into `IO [a]` by traversing the Traversable and
sequencing the actions using `sequence`.
Note that what it creates is a slightly different IO computation that
re-organizes the results, you'll still need to run that IO in the end.
Typically, it's passed all the way down to your closest use of IO (often
main for beginners) where you'll be able to finally get rid of it by
performing the effects and doing something with the results. The flavor of
choice depends on the situation but I find the IO monad very readable.
main :: IO ()
main = do
listOfA <- sequence ioListOfA
-- Use listOfA from here
Alex
On Sep 4, 2017 12:05 PM,
What is the way to transform a list of [IO XXX] type to [XXX]?
Thanks, Alexei _______________________________________________ Beginners mailing list Beginners@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners