
12 Jan
2002
12 Jan
'02
11:27 a.m.
"Jorge Adriano"
...
module Main where main :: IO() main = do putStr "n:" n <- readLn :: IO(Int) print n
Used to work fine with ghc 5.00.2, that is, it would print "n:", then wait for the input, and finaly print n. With Ghc 5.02.2 it only prints "n:" after reading the n.
Unless I'm missing something here it seems like a bug to me. Haven't tried installing from the tarball yet.
It's actually expected behaviour with the current IO implementation - you have to explicitly flush stdout before reading from stdin (if stdout is buffered, that is). FWIW, I don't think this is the Right behaviour either. --sigbjorn