[GHC] #15450: Inconsistency w.r.t. coverage checking warnings for EmptyCase under unsatisfiable constraints

GHC ghc-devs at haskell.org
Mon Jul 30 08:33:02 UTC 2018


#15450: Inconsistency w.r.t. coverage checking warnings for EmptyCase under
unsatisfiable constraints
-------------------------------------+-------------------------------------
        Reporter:  RyanGlScott       |                Owner:  (none)
            Type:  bug               |               Status:  patch
        Priority:  normal            |            Milestone:  8.6.1
       Component:  Compiler          |              Version:  8.4.3
      Resolution:                    |             Keywords:
                                     |  PatternMatchWarnings
Operating System:  Unknown/Multiple  |         Architecture:
 Type of failure:  Poor/confusing    |  Unknown/Multiple
  error message                      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:  #12957            |  Differential Rev(s):  Phab:D5017
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by simonpj):

 Another thing.  I see in `Note [Checking EmptyCase Expressions]` (in
 `Check.hs`) this:
 {{{
 Empty case expressions are strict on the scrutinee. That is, `case x of
 {}`
 will force argument `x`. Hence, `checkMatches` is not sufficient for
 checking
 empty cases, because it assumes that the match is not strict (which is
 true
 for all other cases, apart from EmptyCase). This gave rise to #10746.
 }}}
 I had no idea!  The [http://downloads.haskell.org/~ghc/master/users-
 guide/glasgow_exts.html#empty-case-alternatives user manual entry] says
 nothing about this non-uniform behaviour of empty case expressions.

 What actually stops us from treating an empty case as an ordinary case
 expression with no alternatives?  Anything else seems.. unexpected.

 The explanation in the user manual is cryptic (see the text about
 `absurd`.  And it relates directly to this ticket, because it has `True ~
 False` in scope, which is a contradiction.  So maybe fixing comment:2
 would mean we could treat case expressions uniformly, which would mean we
 could delete code?

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


More information about the ghc-tickets mailing list