summaryrefslogtreecommitdiff
path: root/testsuite/tests/deriving/should_run/drvrun013.hs
blob: 2a9adae585321b6e1372f9a3ffd1c1c19eb80c70 (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