"interact" behaves oddly if used interactively

Christian Maeder maeder at tzi.de
Tue Sep 30 20:35:36 EDT 2003


>>"main=interact id" basically echoes every line of my input, whereas
>>"main=interact show" correctly waits for EOF before 
>>outputting something.
> 
> Which of these are you claiming is wrong? 

I guess "interact" does what it should, but I think it should be changed 
to avoid interleaved in- and output.

> lose Ctrl-D.  C'est la vie.

That is okay if I'm daring enough to change the buffering.

Hugs and NHC gave me no chance for "ctrl-d", though.

> I'd say steer clear of introducing students to interact.

Good advice (currently), but I thought, interact could be used for a 
simple stand alone program, that does not require  "do" (or ">>=").

Christian



More information about the Haskell mailing list