
4 Mar
2010
4 Mar
'10
1:13 p.m.
2010/3/4 Ali Razavi
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.
Ali
FWIW using GHCi in standard Windows Vista, this works like it should. -- Deniz Dogan