[GHC] #15753: Inconsistent pattern-match warnings when using guards versus case expressions

GHC ghc-devs at haskell.org
Tue Oct 16 15:17:58 UTC 2018


#15753: Inconsistent pattern-match warnings when using guards versus case
expressions
-------------------------------------+-------------------------------------
        Reporter:  RyanGlScott       |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:  8.8.1
       Component:  Compiler          |              Version:  8.6.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:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by RyanGlScott):

 A workaround is to bind the result of `id g` to some auxiliary variable.
 For instance, both of the following variants of `ex1` are deemed to be
 exhaustive:

 {{{#!hs
 ex1a, ex1b
   :: a :~: Int
   -> G a
   -> ()

 ex1a Refl g
   | let g' = id g
   , GInt <- g'
   = ()

 ex1b Refl g
   | g' <- id g
   , GInt <- g'
   = ()
 }}}

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


More information about the ghc-tickets mailing list