[GHC] #8779: Exhaustiveness checks for pattern synonyms

GHC ghc-devs at haskell.org
Thu Jan 26 00:23:04 UTC 2017


#8779: Exhaustiveness checks for pattern synonyms
-------------------------------------+-------------------------------------
        Reporter:  nomeata           |                Owner:  mpickering
            Type:  feature request   |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler (Type    |              Version:  7.8.1
  checker)                           |             Keywords:
      Resolution:                    |  PatternSynonyms
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):  Phab:D2669
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by Matthew Pickering <matthewtpickering@…>):

 In [changeset:"1a3f1eebf81952accb6340252816211c7d391300/ghc" 1a3f1ee/ghc]:
 {{{
 #!CommitTicketReference repository="ghc"
 revision="1a3f1eebf81952accb6340252816211c7d391300"
 COMPLETE pragmas for enhanced pattern exhaustiveness checking

 This patch adds a new pragma so that users can specify `COMPLETE` sets of
 `ConLike`s in order to sate the pattern match checker.

 A function which matches on all the patterns in a complete grouping
 will not cause the exhaustiveness checker to emit warnings.

 ```
 pattern P :: ()
 pattern P = ()

 {-# COMPLETE P #-}

 foo P = ()
 ```

 This example would previously have caused the checker to warn that
 all cases were not matched even though matching on `P` is sufficient to
 make `foo` covering. With the addition of the pragma, the compiler
 will recognise that matching on `P` alone is enough and not emit
 any warnings.

 Reviewers: goldfire, gkaracha, alanz, austin, bgamari

 Reviewed By: alanz

 Subscribers: lelf, nomeata, gkaracha, thomie

 Differential Revision: https://phabricator.haskell.org/D2669

 GHC Trac Issues: #8779
 }}}

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


More information about the ghc-tickets mailing list