echoing of stdin

Ross Paterson ross@soi.city.ac.uk
Sun, 3 Aug 2003 14:04:50 +0100


On Sat, Aug 02, 2003 at 09:51:50PM +0100, Alastair Reid wrote:
> I think runhugs should follow the report or what ghc does.

Indeed, and the runhugs handling of stdin is quite different from them.
Try the following rendition of cat with the input redirected:

main = sequence_ (repeat (getChar >>= putChar)) `catch` \ _ -> return ()

> I think it may be reasonable that interactive Haskell systems (e.g., Hugs) 
> should behave differently from batch mode Haskell systems (e.g., ghc).  At 
> least, that's what I concluded 5+ years ago when I looked at it thoroughly.
> 
> But, I think any difference can (and should) be restricted to changing the 
> default echoing and buffering behaviour and should be changeable by calling 
> hSetEcho and friends.  

People will want to test their programs with the interpreter, and won't
want much difference in behaviour.  An interpreter should discard unread
terminal input before prompting for another command, but is any other
difference needed?