testsuite: Assert that testsuite ways are known
[ghc.git] / testsuite / tests / typecheck / should_compile / T12427a.hs
1 {-# LANGUAGE GADTs, RankNTypes #-}
2
3 -- Test pattern bindings, existentials, and higher rank
4
5 module T12427a where
6
7 data T where
8 T1 :: a -> ((forall b. [b]->[b]) -> Int) -> T
9 T2 :: ((forall b. [b]->[b]) -> Int) -> T
10
11 -- Inference
12 -- Worked in 7.10 (probably wrongly)
13 -- Failed in 8.0.1
14 -- Fails in 8.2 because v is polymorphic
15 -- and the T1 pattern match binds existentials,
16 -- and hence bumps levels
17 h11 y = case y of T1 _ v -> v
18
19 -- Worked in 7.10 (probably wrongly)
20 -- Failed in 8.0.1
21 -- Succeeds in 8.2 because the pattern match has
22 -- no existentials, so it doesn't matter than
23 -- v is polymorphic
24 h12 y = case y of T2 v -> v
25
26 -- Inference
27 -- Same results as for h11 and h12 resp
28 T1 _ x1 = undefined
29 T2 x2 = undefined
30
31 -- Works in all versions
32 h2 :: T -> (forall b. [b] -> [b]) -> Int
33 h2 y = case y of T1 _ v -> v
34
35 -- Checking
36 -- Fails in 7.10 (head exploded)
37 -- Fails in 8.0.1 (ditto)
38 -- Succeeds in 8.2
39 x3 :: (forall a. a->a) -> Int
40 T1 _ x3 = undefined