Dumb! I just figured out I was entering the input string in quotes. So, I suppose the answer to my question is yes, type CAN be changed along a >>= chain. I was having trouble doing it in a different problem, created this small example to illustrate the problem, and then screwed it up putting quotes around my input string.
Thanks! Michael --- On Mon, 10/12/09, Niklas Broberg <niklas.brob...@gmail.com> wrote: From: Niklas Broberg <niklas.brob...@gmail.com> Subject: Re: [Haskell-cafe] Can type be changed along a >>= chain? To: "michael rice" <nowg...@yahoo.com> Cc: haskell-cafe@haskell.org Date: Monday, October 12, 2009, 12:43 PM On Mon, Oct 12, 2009 at 6:37 PM, michael rice <nowg...@yahoo.com> wrote: 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 This code works perfectly for me. What problem are you seeing specifically? Cheers,/Niklas
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe