patch for `interact'

Sigbjorn Finne sof@galois.com
Thu, 20 Dec 2001 02:00:56 -0800


[Cc'ing hugs-users]

Thanks, this is a long-standing and known feature of Hugs' interact
implementation, so before possibly bringing it into line with what
Haskell 98 tells us how `interact' ought to behave regarding echoing
of input,  it would be prudent to first check whether anyone depends
on the current behaviour. In particular, are there 'important' resources
(e.g., textbooks and tutorials) based around Hugs98 that depend on
the current non-echoing behaviour? Or are there other weighty
arguments in favour of maintaining status quo?

--sigbjorn

----- Original Message -----
From: "Malcolm Wallace" <Malcolm.Wallace@cs.york.ac.uk>
To: <hugs-bugs@haskell.org>
Sent: Tuesday, December 18, 2001 02:56
Subject: patch for `interact'


> There is a bug in Dec2001 Hugs (and earlier releases too) which causes
> the Prelude function `interact' to behave unexpectedly - the user's
> input is not echoed to the screen as she types it.  A patch is attached
> which solves the problem.
>
> Regards,
>     Malcolm
>
> --- src/iomonad.c Tue Dec 11 00:54:51 2001
> +++ src/iomonad.c.patched Tue Dec 18 10:53:47 2001
> @@ -844,6 +844,7 @@
>      HandleArg(h,1);
>      if (handles[h].hmode&HSEMICLOSED) { /* read requires semi-closed
handle*/
>   Int c = (h==HSTDIN ? readTerminalChar() : getc(handles[h].hfp));
> + if (h==HSTDIN) putchar(c);
>   if (c!=EOF && c>=0 && c<NUM_CHARS) {
>       updapRoot(consChar(c),ap(nameHreader,primArg(1)));
>       return;
>
> _______________________________________________
> Hugs-Bugs mailing list
> Hugs-Bugs@haskell.org
> http://www.haskell.org/mailman/listinfo/hugs-bugs