[Haskell-cafe] GHC + interactive input/output

Philip Weaver philip.weaver at gmail.com
Fri Feb 8 20:29:22 EST 2008


GHC certain *could* do this, but it's arguably not the right thing to do.
For performance, the operating system buffers writes until it is ready to
write large chunks at a time.  If you do not want this behavior, change the
buffering mode from its default.

- Phil

On Feb 8, 2008 5:07 PM, Jonathan Cast <jonathanccast at fastmail.fm> wrote:

> On 8 Feb 2008, at 4:50 PM, Brandon S. Allbery KF8NH wrote:
>
> >
> > On Feb 8, 2008, at 19:41 , Philip Weaver wrote:
> >
> >> Your "gsi> " is buffered because there's no newline at the end.
> >> To flush the buffer and force it to be printed immediately, use
> >> 'hFlush' from the System.IO library, or use 'hSetBuffering' from
> >> that same library: http://haskell.org/ghc/docs/latest/html/
> >> libraries/base/System-IO.html
> >>
> >> I believe you can observe the same behavior in C.
> >
> > Most C stdio libraries in my experience have extra code in the
> > functions that read stdin to flush stdout first, specifically
> > because of lazy people who don't pay attention to buffering.
>
> Why can't GHC implement the same thing?
>
> jcc
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20080208/00c4c236/attachment.htm


More information about the Haskell-Cafe mailing list