<table cellspacing="0" cellpadding="0" border="0" ><tr><td valign="top" style="font: inherit;">That was my suspicion. So, you can't change horses (monads) in mid-stream.<br><br>A parallel question:<br><br>main = do ...&nbsp;&nbsp;&nbsp; -- in the IO monad<br><br>I know I can have other *do*s in main,<br><br>&nbsp; if foo<br>&nbsp; &nbsp; then do<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; .<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; .<br>&nbsp; &nbsp; else do<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; .<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; .<br><br>but must all these other *do*s also be in the same IO monad? What determines what monad a *do* is "in"? The first line after the *do*?<br><br>Thanks for your patience.<br><br>Michael<br><br>--- On <b>Sun, 8/8/10, Henning Thielemann <i>&lt;lemming@henning-thielemann.de&gt;</i></b>
 wrote:<br><blockquote style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; padding-left: 5px;"><br>From: Henning Thielemann &lt;lemming@henning-thielemann.de&gt;<br>Subject: Re: [Haskell-cafe] What is &lt;-<br>To: "michael rice" &lt;nowgate@yahoo.com&gt;<br>Date: Sunday, August 8, 2010, 11:01 AM<br><br><div class="plainMail"><br>On Sun, 8 Aug 2010, michael rice wrote:<br><br>&gt; How would I print each of these integers, one per line?<br>&gt; <br>&gt; [1,2,3,4,5] &gt;&gt;= \x -&gt; ?<br><br>You can't do this from inside the List monad, but you can easily do it from outside, since the result of a 'do' block in List monad is just a list.<br><br>&nbsp; mapM_ print [1..5]<br><br>or<br><br>&nbsp; mapM_ print $ do<br>&nbsp; &nbsp;&nbsp;&nbsp;x &lt;- [1..]<br>&nbsp; &nbsp;&nbsp;&nbsp;...<br>&nbsp; &nbsp;&nbsp;&nbsp;return (x+y+z)<br></div></blockquote></td></tr></table><br>