[Haskell-beginners] Simple IO problem

Ali Razavi ali.razavi at gmail.com
Thu Mar 4 13:06:42 EST 2010

Why doesn't this work the way it's supposed to, or the way it's intuitively
apparent from the code, that is, showing the prompt first, getting the line
next, and printing the result finally?

main = do
        putStr "Please Enter Your Name: "
        name <- getLine
        putStrLn ("Hello " ++ name)

changing putStr with putStrLn rectifies it to the expected behavior, but I
wonder why this version misbehaves. FWIW, I use ghc in cygwin.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/beginners/attachments/20100304/d610a776/attachment.html

More information about the Beginners mailing list