Modify a couple of error messages slightly
[ghc.git] / testsuite / tests / gadt / scoped.hs
1 {-# LANGUAGE GADTs, ScopedTypeVariables #-}
2
3 -- Tests for scoped type variables and GADTs
4
5 module GADT where
6
7 data C x y where
8 C :: a -> C a a
9
10 data D x y where
11 D :: C b c -> D a c
12
13 ------- All these should be ok
14
15 -- Rejected!
16 g1 :: forall x y . C x y -> ()
17 -- C (..) :: C x y
18 -- Inside match on C, x=y
19 g1 (C (p :: y)) = ()
20
21 -- OK!
22 g2 :: forall x y . C x y -> ()
23 -- C (..) :: C x y
24 -- Inside match on C, x=y
25 g2 (C (p :: x)) = ()
26
27 -- Rejected!
28 g3 :: forall x y . D x y -> ()
29 -- D (..) :: D x y
30 -- C (..) :: C sk y
31 -- sk = y
32 -- p :: sk
33 g3 (D (C (p :: y))) = ()