Re: [Haskell] putStr is not evaluated in the correct order

2006-09-04 Thread Paul Johnson
"Andreas S" <[EMAIL PROTECTED]> writes: 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 have now fixed the WikiBook to use putStrLn instead of p

Re: [Haskell] putStr is not evaluated in the correct order

2006-09-03 Thread Tomasz Zielonka
On Sat, Sep 02, 2006 at 05:11:33PM -0700, Jeremy Shaw wrote: > GHCi and the compiled program do not buffer the output in quite the > same way. This comes up so often that perhaps GHCi should advertise those differences. For example, the starting message could say something like this: ___

Re: [Haskell] putStr is not evaluated in the correct order

2006-09-02 Thread Jeremy Shaw
Hello, GHCi and the compiled program do not buffer the output in quite the same way. In the compile program, stdout is line buffered, so it will not output anything until it gets a '\n'. You can force the output using 'hFlush stdout': > import System.IO > main = do >putStr "Who are you? " >

[Haskell] putStr is not evaluated in the correct order

2006-09-02 Thread Andreas S
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