[GHC] #11503: TypeError woes (incl. pattern match checker)

GHC ghc-devs at haskell.org
Thu Jan 28 03:55:58 UTC 2016


#11503: TypeError woes (incl. pattern match checker)
-------------------------------------+-------------------------------------
           Reporter:  goldfire       |             Owner:
               Type:  bug            |            Status:  new
           Priority:  normal         |         Milestone:
          Component:  Compiler       |           Version:  8.1
           Keywords:                 |  Operating System:  Unknown/Multiple
       Architecture:                 |   Type of failure:  None/Unknown
  Unknown/Multiple                   |
          Test Case:                 |        Blocked By:
           Blocking:                 |   Related Tickets:
Differential Rev(s):                 |         Wiki Page:
-------------------------------------+-------------------------------------
 When I say

 {{{
 {-# LANGUAGE DataKinds, GADTs, KindSignatures, TypeFamilies,
              UndecidableInstances #-}
 {-# OPTIONS_GHC -fwarn-incomplete-patterns #-}

 module Bug where

 import GHC.TypeLits
 import GHC.Exts ( Constraint )

 type family NotInt a where
   NotInt Int = TypeError (Text "That's Int, silly.")
   NotInt _   = (() :: Constraint)

 data T a where
   MkT1 :: a -> T a
   MkT2 :: NotInt a => T a

 foo :: T Int -> Int
 foo (MkT1 x) = x
 }}}

 I get

 {{{
 Bug.hs:19:1: warning:
     Pattern match(es) are non-exhaustive
     In an equation for ‘foo’: Patterns not matched: MkT2
 }}}

 But I shouldn't.

 Even worse, perhaps, GHC accepts my pattern-match against `MkT2` if I add
 it. If I change the `TypeError` to `False ~ True`, I get the correct
 behavior.

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11503>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list