Take account of GADTs when reporting patterm-match overlap
authorsimonpj@microsoft.com <unknown>
Wed, 22 Jul 2009 05:09:33 +0000 (05:09 +0000)
committersimonpj@microsoft.com <unknown>
Wed, 22 Jul 2009 05:09:33 +0000 (05:09 +0000)
commit5b49434484d86b2dfad682d5eb26ef7f3e2e2b56
treeafa2c882ca42d2e8c66d57f8dd40ce6d15f35c9d
parenta62da487378d873399d2dedb85fc0d546fa911d8
Take account of GADTs when reporting patterm-match overlap

When matching against a GADT, some of the constructors may be impossible.
For example
data T a where
          T1 :: T Int
          T2 :: T Bool
          T3 :: T a

        f :: T Int -> Int
        f T1 = 3
        f T3 = 4

Here, does not have any missing cases, despite omittting T2, because
T2 :: T Bool.

This patch teaches the overlap checker about GADTs, which happily
turned out to be rather easy even though the overlap checker needs
a serious rewrite.
compiler/deSugar/Check.lhs
compiler/typecheck/TcTyClsDecls.lhs