[GHC] #14813: EmptyCase thinks pattern match involving type family is not exhaustive, when it actually is

GHC ghc-devs at haskell.org
Fri Feb 16 14:27:01 UTC 2018


#14813: EmptyCase thinks pattern match involving type family is not exhaustive,
when it actually is
-------------------------------------+-------------------------------------
        Reporter:  RyanGlScott       |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  8.2.2
      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):

 The line of code which is responsible for this infelicity is
 [http://git.haskell.org/ghc.git/blob/7c173b9043f7a9a5da46c5b0cc5fc3b38d1a7019:/compiler/deSugar/Check.hs#l415
 here], within `checkEmptyCase'`:

 {{{#!hs
 mb_candidates <- inhabitationCandidates fam_insts (idType var)
 }}}

 But this is checking the inhabitation candidates of the raw `idType` of
 `x`, which is `F b a` instead of `F 'False a`. It seems that what needs to
 happen is that we need to take the local dictionary evidence in scope
 (i.e., `liftD getDictsDs`)—in this example, `b ~ 'False`—and somehow use
 that to turn `F b a` into `F 'False a`.

 On the other hand, I have no idea how one would do this, as `liftD
 getDictsDs` gives you a `Bag EvVar` instead of, say, a substitution, it's
 far from clear to me how you'd "apply" a `Bag EvVar`...

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


More information about the ghc-tickets mailing list