[GHC] #16129: Incorrect non-exhaustive pattern warning with PatternSynonyms (was: Incorrect non-exhaustive pattern warning with PatternSynonyms, ViewPatterns and TypeFamilies)

GHC ghc-devs at haskell.org
Sat Jan 5 01:57:47 UTC 2019


#16129: Incorrect non-exhaustive pattern warning with PatternSynonyms
-------------------------------------+-------------------------------------
        Reporter:  sjakobi           |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  8.6.3
      Resolution:                    |             Keywords:
                                     |  PatternMatchWarnings,
                                     |  PatternSynonyms
Operating System:  Unknown/Multiple  |         Architecture:
 Type of failure:  Incorrect         |  Unknown/Multiple
  error/warning at compile-time      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:  #15753            |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------
Changes (by RyanGlScott):

 * keywords:  PatternMatchWarnings => PatternMatchWarnings, PatternSynonyms
 * related:   => #15753


Comment:

 Here is a simpler version without `ViewPatterns` or `TypeFamilies` (they
 aren't essential to triggering this bug):

 {{{#!hs
 {-# LANGUAGE PatternSynonyms #-}
 module Bug where

 import Data.Functor.Identity

 pattern Id :: a -> Identity a
 pattern Id x = Identity x

 bug, workaround1, workaround2 :: Identity a -> a
 bug ia
   | Id a <- ia
   = a

 workaround1 ia
   | let ia' = ia
   , Identity a <- ia'
   = a

 workaround2 ia = a
   where Id a = ia
 }}}

 While this doesn't appear to be exactly the same bug as #15753, they feel
 related somehow.

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


More information about the ghc-tickets mailing list