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

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -