Alex Gontcharov <[EMAIL PROTECTED]> writes:
> I'm fairly new to Haskell, I'd like to know how to convert
> a list of Strings of type IO [String] to Int.
Ah... an IO [String] is *not* a list of strings, it is an IO action
that can produce a list of strings. You can only get at the strings
inside the IO monad.
> I used map read p, where p is a list of IO Strings ["1", "2"]
p >>= (return . map read)
Or using do notation
do
x <- p
let z = map read x
gives you IO [Int] from your IO [String], but there's no� escape from
IO.
PS: You probably need a few type annotations to make the above work.
-kzm
� Well, there is, really, but we don't like to talk about it much :-)
--
If I haven't seen further, it is by standing in the footprints of giants
_______________________________________________
Haskell-Cafe mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell-cafe