[GHC] #16129: Incorrect non-exhaustive pattern warning with PatternSynonyms

GHC ghc-devs at haskell.org
Sat Jan 5 02:28:02 UTC 2019


#16129: Incorrect non-exhaustive pattern warning with PatternSynonyms
-------------------------------------+-------------------------------------
        Reporter:  sjakobi           |                Owner:  (none)
            Type:  bug               |               Status:  closed
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  8.6.3
      Resolution:  duplicate         |             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):

 * status:  new => closed
 * resolution:   => duplicate


Comment:

 Urk, please ignore what I wrote in comment:1. I forgot to add a `COMPLETE`
 pragma on `Id`, and that makes the whole example invalid.

 Here is my second attempt at a minimal example:

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

 import Data.Functor.Identity

 {-# COMPLETE Id #-}
 pattern Id :: a -> Identity a
 pattern Id x = Identity x

 class Hm a where
   hm :: a -> a
 instance Hm (Identity a) where
   hm = id

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

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

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

 This time, I'm convinced that this is a duplicate of #15753, as this has
 the distinctive function-application-in-pattern-guard look that #15753
 has. Closing as a duplicate.

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


More information about the ghc-tickets mailing list