"interact" behaves oddly if used interactively

Tomasz Zielonka t.zielonka at students.mimuw.edu.pl
Wed Oct 1 12:16:00 EDT 2003


On Tue, Sep 30, 2003 at 03:52:50PM +0200, Christian Maeder wrote:
> Hi,
> 
> For GHC (6.0.1)
> 
> "main=interact id" basically echoes every line of my input, whereas
> "main=interact show" correctly waits for EOF before outputting something.

That's only because output to terminal is line buffered by default and
show converts all newlines to \n.

Try feeding it from /dev/urandom or similar endless character resource -
you'll see that it doesn't wait for EOF.

PS. The name 'interact' suggests interaction :)

Best regards,
Tom

-- 
.signature: Too many levels of symbolic links


More information about the Haskell mailing list