Major Overhaul of Pattern Match Checking (Fixes #595)
[ghc.git] / testsuite / tests / pmcheck / should_compile / pmc001.hs
1 {-# LANGUAGE TypeFamilies, GADTs #-}
2 {-# OPTIONS_GHC -fwarn-incomplete-patterns -fwarn-overlapping-patterns #-}
3
4 module PMC001 where
5
6 data family T a
7
8 data instance T [a] where
9 MkT1 :: T [Int]
10 MkT2 :: Char -> T [Char]
11 MkT3 :: T [a]
12
13 f :: T [a] -> T [a] -> Bool
14 f MkT1 MkT1 = True
15 f (MkT2 _) (MkT2 _) = True
16 f MkT3 MkT3 = True
17
18 g :: T [a] -> T [a] -> Bool
19 g x y
20 | MkT1 <- x, MkT1 <- y = True
21 | (MkT2 _) <- x, (MkT2 _) <- y = True
22 | MkT3 <- x, MkT3 <- y = True