[GHC] #13484: Incorrect Exhaustivity Checking

GHC ghc-devs at haskell.org
Sat Mar 25 22:29:08 UTC 2017


#13484: Incorrect Exhaustivity Checking
-------------------------------------+-------------------------------------
        Reporter:  andrewthad        |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  8.0.2
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by RyanGlScott):

 This is expected behavior. The first implementation of `impossibleChunk01`
 you gave is not exhaustive because the second argument might be `⊥`, which
 may involve neither constructor! If you don't believe me, try evaluating
 `impossibleChunk01 ChunkNil (let x = x in x)`.

 So the most correct solution is to adopt your suggestion and write this
 second case:

 {{{#!hs
 impossibleChunk01 ChunkNill x = case x of {}
 }}}

 And, as you noted, GHC 8.2 will verify that that empty-case on `x` really
 is exhaustive, so you can be assured that `x` isn't inhabited by a
 (terminating) `Chunk` value.

 Is that a satisfying answer? If so, please feel free to close this ticket.

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


More information about the ghc-tickets mailing list