[Haskell-beginners] [IO String] to IO [String]

Nathan Hüsken nathan.huesken at posteo.de
Sun Mar 31 12:24:33 CEST 2013


Try

sequence :: Monad m => [m a] -> m [a]

I thinkg

sequence f :: IO [String]

should be what you want.

On 03/31/2013 12:19 PM, Ovidiu D wrote:
> I have the function f which reads lines form the stdin and looks like this:
>
> f :: [IO String]
> f = getLine : f
>
> What I don't like is the fact that the line processing I'm doing will
> have to be in the IO Monad
>
> I would like to make this function to have the signature
> f : IO [String]
> ...such that I can get rid of the IO monad and pass the pure string list
> to the processing function.
>
> Can I do this?
>
> Thanks
>
>
> _______________________________________________
> Beginners mailing list
> Beginners at haskell.org
> http://www.haskell.org/mailman/listinfo/beginners
>




More information about the Beginners mailing list