[Haskell-cafe] GHC + interactive input/output

Richard A. O'Keefe ok at cs.otago.ac.nz
Sun Feb 10 18:37:27 EST 2008

On 9 Feb 2008, at 2:29 pm, Philip Weaver wrote:

> GHC certain *could* do this, but it's arguably not the right thing  
> to do.

I have reminded the GHC maintainers before that the Haskell  
*REQUIRES* a Haskell system to support this; there is an example that  
no sense whatever without it.  (And the other Haskell systems I use  
get it

I note that David Bacon's SETL implementation has explicit support for
tying an input stream and an output stream together so that any time  
is done on the input stream the output stream is flushed; this is done
automatically for sockets and is *seriously* useful in avoiding  

Note that this should make essentially no difference to performance  
(a) the flushing is only needed when the input buffer is exhausted,  
     happens once per line,
(b) the kinds of streams where you want it (terminals, STREAMs, sockets,
     serial ports, &c) generally have other costs so high you won't be
     able to measure this one,
(c) it *only* applies to bidirectional streams or to explicitly coupled
     streams, so I/O to disc files or memory sticks or other high speed
     block devices should never be affected at all (unless someone  
     to do it explicitly, in which case it's still going to be faster  
     anything they could have done by hand).

More information about the Haskell-Cafe mailing list