[Haskell-cafe] GHC + interactive input/output

Brandon S. Allbery KF8NH allbery at ece.cmu.edu
Fri Feb 8 19:50:15 EST 2008


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.

-- 
brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allbery at kf8nh.com
system administrator [openafs,heimdal,too many hats] allbery at ece.cmu.edu
electrical and computer engineering, carnegie mellon university    KF8NH




More information about the Haskell-Cafe mailing list