monads - Convert [IO Int] to IO [Int] in Haskell? -
i have code fits need:
f :: [io int] -> io [int] f [] = return [] f (x:xs) = <- x <- f xs return (a:as)
but thougth there predefined way (msum ?)
but can't see how.
any welcome. thx
yes, it's available in standard library under name sequence
. has more general type f
: monad m => [m a] -> m [a]
, since works monad
, not io
.
you find searching type [io a] -> io [a]
on hoogle.
Comments
Post a Comment