2 Sep
2006
2 Sep
'06
11:51 p.m.
Hello, i've got a newbie question to ask. I'd like to ask for user input in the same line as the prompt. I found this example on the web main = do putStr "Who are you? " name <- getLine putStrLn ("Hello, " ++ name) This works find in ghci, but the compiled code (ghc 6.4.2) executes getLine first before executing putStr. Instead of: Who are you? myself Hello, myself I got: myself Who are you? Hello, myself I'm new with haskell, so I can't be too sure about this, but it seems from putStr implementation in Prelude, putStr should be executed first. Why are they different? And if they are suppose to be different, then how to put prompt and input on the same line for the compiled code? Thank you in advance -andre