So I've got something like:
[IO Blah, IO Blah, IO Blah]
and I really want just a list of Blah
s, how can I do it?
P.S.: Yes, I am working within an IO function.
Use sequence
.
Evaluate each action in the sequence from left to right, and collect the results.
do blahs <- sequence listOfIoBlah
-- now use blahs
Hoogle can be very useful in answering these sort of questions, if you know how to formulate the question as a type, for example: http://www.haskell.org/hoogle/?hoogle=%5BIO+a%5D+-%3E+IO+%5Ba%5D
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With