IO-System

Sigbjorn Finne sof@galois.com
Mon, 16 Sep 2002 22:33:05 -0700


"Glynn Clements" <glynn.clements@virgin.net> writes:
>>
...chop, chop...
> >
> > A deficiency of the current implementation of the IO system, I'd
> > say. Reading from stdin ought to force a stdout (and stderr) buffer
> > flush. The GHC IO libs used to do this.
>
> The equivalent ANSI C I/O functions typically flush either all
> buffered output streams or all line-buffered output streams whenever a
> read operation is passed to the underlying system call (but not when
> it can be satisified from the input stream's buffer).
>

I'd settle for that kind of indiscriminate flushing -- as is, trivial I/O
examples
such as

main = do
   putStr "What is your name? "
   ls <- getLine
   putStrLn ("Hello " ++ ls ++ "!")

fail to behave as expected.

--sigbjorn