Bump `base` version to 4.9.0.0 (closes #11026)
[ghc.git] / testsuite / tests / typecheck / should_fail / T6161.hs
1 {-# LANGUAGE TypeFamilies, FlexibleContexts, FlexibleInstances #-}
2
3 module T6161 where
4
5 data family Fam a
6
7 data instance Fam Float = FamFloat Float
8
9 class Super a where
10 testSup :: a -> Float
11
12 class Super a => Duper a where
13 testDup :: a -> Float
14
15 --class ( Super (Fam a) ) => Foo a where
16 class Duper (Fam a) => Foo a where
17 testFoo :: Fam a -> Float
18
19 instance Foo a => Duper (Fam a) where
20 testDup x = testFoo x + testSup x
21
22 --instance Super (Fam Float) where
23 -- testSup (FamFloat x) = x
24
25 instance Foo Float where
26 testFoo (FamFloat _) = 5.0
27
28 testProg :: Float
29 testProg = testDup (FamFloat 3.0)
30
31 {- Reasoning:
32
33 dfDuperFam :: Foo a -> Duper (Fam a)
34 dfDuperFam d = Duper (sc (sc d)) (...testDup...)
35
36 dfFooFloat :: Foo Float
37 dfFooFloat = Foo (dfDuperFloat dx) ...
38
39 dx :: Foo Float
40 dx = dfFooFloat
41
42
43 [W] d1 :: Duper (Fam Float)
44
45 -- Use Duper instnance
46 d1 = dfDuperFam d2
47 [W] d2 :: Foo Float
48 -}