IO-System

Simon Marlow simonmar@microsoft.com
Tue, 17 Sep 2002 10:16:18 +0100


> I'd settle for that kind of indiscriminate flushing -- as is,=20
> trivial I/O examples such as
>=20
> main =3D do
>    putStr "What is your name? "
>    ls <- getLine
>    putStrLn ("Hello " ++ ls ++ "!")
>=20
> fail to behave as expected.

That depends on what you expect... :-)  The Haskell report says nothing
about triggering a flush on stdout when reading from stdin.

I disagree that introducing this ad-hoc flush would be the right thing.
A workaround for a common misconception, yes; but not the right thing in
general.  IMHO, it's better that programmers learn about buffering early
because they'll get bitten by it later on anyhow.

Suppose we were to implement this, when exactly should it be enabled?
All the time?  When stdin is a terminal?  When stdin and stdout are both
connected to the same terminal?  For every output handle connected to
the same terminal as stdin?  Should it happen for a socket too?  (if
not, won't that be confusing for users?)

Cheers,
	Simon