Improve improvement in the constraint solver
[ghc.git] / testsuite / tests / indexed-types / should_fail / T4093a.hs
1 {-# LANGUAGE TypeFamilies #-}
2 module T4093a where
3
4 type family Foo x
5 type instance Foo () = Maybe ()
6
7 hang :: (Foo e ~ Maybe e) => Foo e
8 hang = Just ()
9
10 -- Type is not ambiguous; should get a complaint
11 -- for (e ~ ()) arising from the Just ()
12
13 {- Ambiguity check
14
15 [G] Foo e ~ Maybe e
16 [W] Foo e ~ Foo e0
17 [W] Foo e0 ~ Maybe e0
18 ---
19 [G] Foo e ~ fsk
20 [G] fsk ~ Maybe e
21
22 [W] Foo e ~ fmv1
23 [W] Foo e0 ~ fmv2
24 [W] fmv1 ~ fmv2
25 [W] fmv2 ~ Maybe e0
26
27 ---> fmv1 := fsk
28 [G] Foo e ~ fsk
29 [G] fsk ~ Maybe e
30
31 [W] Foo e0 ~ fmv2
32 [W] fsk ~ fmv2
33 [W] fmv2 ~ Maybe e0
34
35 --->
36 [G] Foo e ~ fsk
37 [G] fsk ~ Maybe e
38
39 [W] Foo e0 ~ fmv2
40 [W] fmv2 ~ Maybe e
41 [W] fmv2 ~ Maybe e0
42
43 Now the question is whether we get a derived equality e ~ e0. Currently
44 we don't, but we easily could. But then we'd need to be careful not to
45 report insoluble Int ~ Bool if we had
46 F a ~ Int, F a ~ Bool
47 -}