<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<div class="moz-cite-prefix">You can use sequence which will turn
your [IO String] into a IO [String]. If you want to "map a
function" along the way, you can use mapM (or traverse):<br>
<br>
That is:<br>
mapM :: (String -> IO b) -> [IO String] -> IO [b]<br>
<br>
For further reading, there is a paper about this function called
The Essence of the Iterator Pattern.<br>
<br>
On 31/03/13 20:19, Ovidiu D wrote:<br>
</div>
<blockquote
cite="mid:CAKVsE7vhTPDuDfN7fQc7N48ibCUQ=m5TEgpC2RKKcx7ijUCj5Q@mail.gmail.com"
type="cite">
<div dir="ltr">
<div>
<div>
<div>I have the function f which reads lines form the stdin
and looks like this:<br>
<br>
f :: [IO String]<br>
f = getLine : f<br>
<br>
</div>
<div>What I don't like is the fact that the line processing
I'm doing will have to be in the IO Monad<br>
<br>
</div>
I would like to make this function to have the signature <br>
f : IO [String] <br>
</div>
...such that I can get rid of the IO monad and pass the pure
string list to the processing function. <br>
<br>
Can I do this?<br>
<br>
</div>
Thanks<br>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
Beginners mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Beginners@haskell.org">Beginners@haskell.org</a>
<a class="moz-txt-link-freetext" href="http://www.haskell.org/mailman/listinfo/beginners">http://www.haskell.org/mailman/listinfo/beginners</a>
</pre>
</blockquote>
<br>
<br>
<pre class="moz-signature" cols="72">--
Tony Morris
<a class="moz-txt-link-freetext" href="http://tmorris.net/">http://tmorris.net/</a>
</pre>
</body>
</html>