[GHC] #8970: Non-exhaustive pattern match warning with DataKinds and TypeFamilies

GHC ghc-devs at haskell.org
Mon Apr 7 21:16:15 UTC 2014


#8970: Non-exhaustive pattern match warning with DataKinds and TypeFamilies
------------------------------------+-------------------------------------
       Reporter:  tensor5           |             Owner:
           Type:  bug               |            Status:  new
       Priority:  normal            |         Milestone:
      Component:  Compiler          |           Version:  7.6.3
       Keywords:                    |  Operating System:  Unknown/Multiple
   Architecture:  Unknown/Multiple  |   Type of failure:  None/Unknown
     Difficulty:  Unknown           |         Test Case:
     Blocked By:                    |          Blocking:
Related Tickets:                    |
------------------------------------+-------------------------------------
 The code is:

 {{{
 data K = Foo
        | Bar

 data D1 :: K -> * where
     F1 :: D1 Foo
     B1 :: D1 Bar

 class C (a :: K -> *) where
     data D2 a :: K -> *
     foo :: a k -> D2 a k -> Bool

 instance C D1 where
     data D2 D1 k where
               F2 :: D2 D1 Foo
               B2 :: D2 D1 Bar
     foo F1 F2 = True
     foo B1 B2 = True
 }}}


 With -Wall it gives the warning:

 {{{
 Test.hs:23:5: Warning:
     Pattern match(es) are non-exhaustive
     In an equation for `foo':
         Patterns not matched:
             F1 B2
             B1 F2
 }}}

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


More information about the ghc-tickets mailing list