Bug in show instance
Sigbjorn Finne
sof@galois.com
Thu, 21 Mar 2002 15:46:04 -0800
Hi,
what options do you have :set when seeing this behaviour?
(i.e., I'm having trouble reproducing it here.)
--sigbjorn
----- Original Message -----
From: "Shawn P. Garbett" <Shawn@Garbett.org>
To: <hugs-bugs@haskell.org>
Cc: "Dean Herington" <heringto@cs.unc.edu>
Sent: Thursday, January 31, 2002 06:39
Subject: Bug in show instance
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> The following code generates some unexpected behavior (at least to me) in
> hugs (Feburary 2001: hugs 98 compatibility)
>
> - -----------------------------------
> main = print(show test)
>
> newtype Out a = MkOut (String, a)
>
> instance (Show a) => Show (Out a) where
> show (MkOut (x,y)) = x ++ " value: " ++ show y
>
> test = MkOut("Blah\nBlah", 4)
> - --------------------------------------
>
> Hugs Output:
>
> Main> test
> ("Blah\nBlah",4)
> (20 reductions, 55 cells)
> Main>
>
> - ------------------------------
>
> GHCi (and expected output):
>
> Main> test
> Blah
> Blah value: 4
> Main>
>