[GHC] #14098: Incorrect pattern match warning on nested GADTs

GHC ghc-devs at haskell.org
Wed Feb 21 14:14:49 UTC 2018


#14098: Incorrect pattern match warning on nested GADTs
-------------------------------------+-------------------------------------
        Reporter:  jmgrosen          |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  8.2.1
      Resolution:                    |             Keywords:
                                     |  PatternMatchWarnings
Operating System:  Unknown/Multiple  |         Architecture:
 Type of failure:  Incorrect         |  Unknown/Multiple
  error/warning at compile-time      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:  #11984            |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by RyanGlScott):

 To hammer home the fact that guards are the culprit, note that this
 problem also erroneously generates a warning:

 {{{#!hs
 {-# Language GADTs #-}
 {-# OPTIONS_GHC -Wall #-}

 data App f a where
   App :: f a -> App f (Maybe a)

 data Ty a where
   TBool :: Ty Bool
   TInt  :: Ty Int

 data T f a where
   C :: T Ty (Maybe Bool)

 f :: T f a -> App f a -> ()
 f C (App x)
   | TBool <- x = ()
 }}}

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


More information about the ghc-tickets mailing list