<br><br><div class="gmail_quote">2009/10/12 michael rice <span dir="ltr">&lt;<a href="mailto:nowgate@yahoo.com">nowgate@yahoo.com</a>&gt;</span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">

<table border="0" cellpadding="0" cellspacing="0"><tbody><tr><td style="font-family: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; font-size: inherit; line-height: inherit; font-size-adjust: inherit; font-stretch: inherit;" valign="top">

The first of these works, but not the second. It would seem that the type cannot change along a &gt;&gt;= chain, but I may be missing something in the code.<br><br>Is the second example illegal? If so, is there a different way to change a String to an Int along the &gt;&gt;= chain?<br>

<br>Michael<br><br>===========<br><br>import Data.Char<br><br>{-<br>transform :: IO ()<br>transform = putStrLn &quot;What is your word?&quot;<br>         &gt;&gt; getLine<br>         &gt;&gt;= \str -&gt; return (&#39;Q&#39;:str)<br>

         &gt;&gt;= \str -&gt; return (&#39;Z&#39;:str)<br>         &gt;&gt;= \str -&gt; putStrLn $ &quot;Transformed word is &quot; ++ show str<br>-}<br><br>transform :: IO ()<br>transform = putStrLn &quot;What is your digit
 string?&quot;<br>         &gt;&gt; getLine<br>         &gt;&gt;= \str -&gt; return (&#39;9&#39;:str)<br>         &gt;&gt;= \str -&gt; return (read str :: Int)<br>         &gt;&gt;= \i -&gt; putStrLn $ &quot;The number is &quot; ++ show i<br>

<br></td></tr></tbody></table><br></blockquote><div><br>Both seem good to me and my old ghci (6.6.1)...<br><br>Thu<br></div></div><br>