[Haskell-cafe] Bug in "Haskell for C programmers" tutorial?

Cale Gibbard cgibbard at gmail.com
Sun Jan 1 14:51:33 EST 2006

On 01/01/06, Glynn Clements <glynn at gclements.plus.com> wrote:
> Cale Gibbard wrote:
> > You shouldn't have to flush output manually. Which implementation are
> > you using? Try importing System.IO and doing:
> > hGetBuffering stdout >>= print
> > and see what gets printed. It should be "NoBuffering".
> The buffering for stdout should be LineBuffering if stdout is a
> terminal and BlockBuffering otherwise. The buffering for stderr should
> always be NoBuffering.

It's actually not, if you're starting your program from ghci, which is
what confused me. From GHCi, you get NoBuffering on stdout, and
LineBuffering on stdin, which is sane for interactive programs. Why
anyone would want LineBuffering as default on stdout is somewhat
mysterious to me.

 - Cale

More information about the Haskell-Cafe mailing list