diff options
Diffstat (limited to 'testsuite/tests/deriving/should_run/drvrun013.hs')
-rw-r--r-- | testsuite/tests/deriving/should_run/drvrun013.hs | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/testsuite/tests/deriving/should_run/drvrun013.hs b/testsuite/tests/deriving/should_run/drvrun013.hs new file mode 100644 index 0000000000..2a9adae585 --- /dev/null +++ b/testsuite/tests/deriving/should_run/drvrun013.hs @@ -0,0 +1,19 @@ +-- This test makes sure that the derivied instance for +-- Eq A +-- "sees" the non-derived instance for +-- Eq B +-- +-- In a version of GHC 5.05, this didn't happen, because the +-- deriving mechanism looked through A's rep-type and found Int + +module Main where + +newtype B = MkB Int +instance Eq B where + (MkB 1) == (MkB 2) = True -- Non-standard equality + (MkB a) == (MkB b) = False + +newtype A = MkA B deriving( Eq ) + +main = print (MkA (MkB 1) == MkA (MkB 2)) +-- Should say "True", because of B's non-standard instance |