<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 >>= 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 >>= chain?<br><br>Michael<br><br>===========<br><br>import Data.Char<br><br>{-<br>transform :: IO ()<br>transform = putStrLn "What is your word?"<br> >> getLine<br> >>= \str -> return ('Q':str)<br> >>= \str -> return ('Z':str)<br> >>= \str -> putStrLn $ "Transformed word is " ++ show str<br>-}<br><br>transform :: IO ()<br>transform = putStrLn "What is your digit
string?"<br> >> getLine<br> >>= \str -> return ('9':str)<br> >>= \str -> return (read str :: Int)<br> >>= \i -> putStrLn $ "The number is " ++ show i<br><br></td></tr></table><br>