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"

Regards,
    Malcolm

Reply via email to