[GHC] #10746: No non-exhaustive pattern match warning given for empty case analysis

GHC ghc-devs at haskell.org
Fri May 13 16:05:19 UTC 2016


#10746: No non-exhaustive pattern match warning given for empty case analysis
-------------------------------------+-------------------------------------
        Reporter:  bgamari           |                Owner:
            Type:  bug               |               Status:  patch
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  7.10.2
      Resolution:                    |             Keywords:
                                     |  PatternMatchWarnings
Operating System:  Unknown/Multiple  |         Architecture:
 Type of failure:  Incorrect         |  Unknown/Multiple
  warning at compile-time            |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:  #7669, #11806     |  Differential Rev(s):  Phab:D2105
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by dfeuer):

 I don't know about the other stuff, but I think I disagree on the bounded
 bit. In that situation, I would expect the compiler to go into an infinite
 loop (unless it has pity on us in that particular case and happens to
 detect the loop, which is not the pattern checker's problem in any case).
 If I tell the type checker to go into an infinite loop and heat up my
 computer, it's really okay if it does that. Again, I can always write

 {{{#!hs
 foo :: F Int -> a
 foo !_ = error "Unreachable, but that's not provable within Haskell."
 }}}

 if I want to impose an ad hoc postulate about program behavior. Empty case
 is for what GHC *can* prove. The case of terminally stuck closed type
 families (ones that no additional information could possibly reduce) is a
 bit weird; I think for now at least you should probably treat them the
 same as stuck open type families and assume them inhabited.

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


More information about the ghc-tickets mailing list