blob: 8bf15161ea50d374a25412779f0a30fab2739d84 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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
|