Another test
commite2b9bad252ff63d65a110d1aa5259ee6f5b6df71
authorPhil Freeman <paf31@cantab.net>
dateWed 8 Oct 2014, 21:41 (12 years ago)
parent480b297
examples/failing/OverlappingInstances2.pursnew file+23
@@ -0,0 +1,23 @@
1+module OverlappingInstances where
2+
3+data A = A | B
4+
5+instance eqA1 :: Eq A where
6+ (==) A A = true
7+ (==) B B = true
8+ (==) _ _ = false
9+ (/=) x y = not (x == y)
10+
11+instance eqA2 :: Eq A where
12+ (==) _ _ = true
13+ (/=) _ _ = false
14+
15+instance ordA :: Ord A where
16+ compare A B = LT
17+ compare B A = GT
18+ compare _ _ = EQ
19+
20+test :: forall a. (Ord a) => a -> a -> String
21+test x y = show $ x == y
22+
23+main = Debug.Trace.trace $ test A B