Merge branch 'master' of http://darcs.haskell.org/testsuite
[ghc.git] / testsuite / tests / typecheck / should_fail / FrozenErrorTests.hs
1 {-# LANGUAGE RankNTypes, GADTs, TypeFamilies #-}
2 module Test where
3
4
5 data T a where
6 MkT :: a -> T a
7 MkT3 :: forall a. (a ~ Bool) => T a
8
9 -- Mismatches in givens
10 bloh :: T Int -> ()
11 bloh x = case x of
12 MkT3 -> ()
13
14 type family F a b
15 type family G a b
16 type instance F a Bool = a
17 type instance G a Char = a
18
19 goo1 :: forall a b. (F a b ~ [a]) => b -> a -> a
20 goo1 = undefined
21
22 goo2 :: forall a. G a Char ~ [Int] => a -> a
23 goo2 = undefined
24
25 -- Just an occurs check
26 test1 = goo1 False undefined
27
28 -- A frozen occurs check, now transformed to decomposition error
29 test2 = goo2 (goo1 False undefined)
30 test3 = goo1 False (goo2 undefined)
31
32
33 -- A frozen occurs check, now transformed to both a decomposition and occurs check
34 data M a where
35 M :: M a
36 data T2 a b where
37 T2 :: T2 a b
38
39 goo3 :: forall a b. F a b ~ T2 (M a) a => b -> a -> a
40 goo3 = undefined
41
42 goo4 :: forall a c. G a Char ~ T2 (T2 c c) c => a -> a
43 goo4 = undefined
44
45 test4 = goo4 (goo3 False undefined)
46 test5 = goo3 False (goo4 undefined)
47
48
49