2009/10/12 michael rice <nowgate@yahoo.com>
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.

Is the second example illegal? If so, is there a different way to change a String to an Int along the >>= chain?

Michael

===========

import Data.Char

{-
transform :: IO ()
transform = putStrLn "What is your word?"
         >> getLine
         >>= \str -> return ('Q':str)
         >>= \str -> return ('Z':str)
         >>= \str -> putStrLn $ "Transformed word is " ++ show str
-}

transform :: IO ()
transform = putStrLn "What is your digit string?"
         >> getLine
         >>= \str -> return ('9':str)
         >>= \str -> return (read str :: Int)
         >>= \i -> putStrLn $ "The number is " ++ show i



Both seem good to me and my old ghci (6.6.1)...

Thu