Malcolm Wallace wrote:
>
> Bug Report for Hugs98 (May 1999 version) compiled with readline
> support, if that is relevant.
>
> There is a bug in deriving instances of Show, illustrated here when
> the datatype has a constructor containing a \.
>
> For this code:
> data X = X
> | X :\ X
> deriving Show
> main = putStrLn (show (X :\ X))
>
> a call of "main" produces
> X :<nofile> X
> whilst a direct call to "show (X :\ X)" produces
> "X:\NUL<nofile> X"
> instead of the expected
> X :\ X
>
> If I extend the datatype with an extra constructor to
> data X = X
> | X :\ X
> | C X
> deriving Show
> main = putStrLn (show (X :\ X))
>
> then for the same two expressions I get respectively
> X :C X
> "X :\NULC X"
>
Thanks for the report.
In the file machine.c, remove the lines
else if (c=='\\') {
c = textToStr(++t)[0];
if (c!='\\')
c = 0;
}
from the function evalString.
As far as I can determine, evalString is only used for processing
internal strings and var/con names, and none of these have
the "list of Char" backslash semantics.
Hope this helps,
Andy