"interact" behaves oddly if used interactively

Thomas Hallgren hallgren at cse.ogi.edu
Thu Oct 2 17:08:51 EDT 2003

John Meacham wrote:

>personally, I think the easiest solution would be to punt the whole
>issue by having:
>lazily read the file if it is mmapable or a pipe
>eagerly slurp the whole file if it refers to a tty
I think this kind of irregular behaviour would make the IO functions 
even more difficult to understand. Why should some invokations of the 
same program exhibit utterly different space/time behaviour from others?!

mycomputer% ./myprogram
mycomputer% cat | ./myprogram
mycomputer% ./myprogram <myfile
mycomputer% luit ./myprogram

>of course this makes 'interact' not really interactive,
Exactly, it defeats the whole purpose of the interact function (to 
provide support for Landin-stream IO), so you might just as well remove 
it completely...

Thomas H

More information about the Haskell-Cafe mailing list