<table cellspacing="0" cellpadding="0" border="0" ><tr><td valign="top" style="font: inherit;">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 "What is your word?"<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &gt;&gt; getLine<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &gt;&gt;= \str -&gt; return ('Q':str)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &gt;&gt;= \str -&gt; return ('Z':str)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &gt;&gt;= \str -&gt; putStrLn $ "Transformed word is " ++ show str<br>-}<br><br>transform :: IO ()<br>transform = putStrLn "What is your digit
 string?"<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &gt;&gt; getLine<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &gt;&gt;= \str -&gt; return ('9':str)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &gt;&gt;= \str -&gt; return (read str :: Int)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &gt;&gt;= \i -&gt; putStrLn $ "The number is " ++ show i<br><br></td></tr></table><br>