Bug? Re: GHC version 5.02.2 is available - SuSE RPMs

Sigbjorn Finne sof@galois.com
Sat, 12 Jan 2002 08:27:27 -0800


"Jorge Adriano" <jadrian@mat.uc.pt> writes:
>
 ...
> > 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