gitlab-ci: Move hadrian-ghc-in-ghci job first
[ghc.git] / testsuite / tests / indexed-types / should_compile / T12522.hs
1 {-# LANGUAGE TypeFamilyDependencies #-}
2 {-# LANGUAGE FlexibleInstances #-}
3 {-# LANGUAGE AllowAmbiguousTypes #-}
4
5 module T12522 where
6
7 foo = f (Just 'c')
8
9 data D1 x
10 data D2
11
12 type family TF x = t | t -> x
13 type instance TF (D1 x, a) = Maybe (TF (x, a))
14 type instance TF (D2, ()) = Char
15
16 f :: TF (x, a) -> ()
17 f _ = ()
18
19 foo1 = f_good (Just 'c')
20 foo2 = f_bad (Just 'c')
21
22 type family TF2 x y = t | t -> x y
23 type instance TF2 Int Float = Char
24
25 type family TF_Good x y = t | t -> x y
26 type instance TF_Good a (Maybe x) = Maybe (TF2 a x)
27
28 f_good :: TF_Good a x -> ()
29 f_good _ = ()
30
31 type family TF_Bad x y = t | t -> x y
32 type instance TF_Bad (Maybe x) a = Maybe (TF2 a x)
33
34 f_bad :: TF_Bad x a -> ()
35 f_bad _ = ()
36
37 {-
38
39 Maybe Char ~ TF (xx, aa)
40
41
42 Model [D] s_aF4 ~ Maybe Char
43
44 [W] TF (x_aDY, a_aJn) ~ s_aF4 FunEq
45 --> {aJn = aJp)
46 [W} TF (x_aDY, a_aJp) ~ s_aF4 FunEq
47 --> {new derived equalities}
48 [D] x_aDY ~ D1 x_aJq
49 [D] a_aJp ~ a_aJR
50 -}