
#15886: Spurious warning about incomplete pattern with PatternSynonyms -------------------------------------+------------------------------------- Reporter: selinger | Owner: (none) Type: bug | Status: closed Priority: normal | Milestone: 8.6.3 Component: Compiler | Version: 8.6.1 Resolution: invalid | Keywords: | PatternSynonyms, | PatternMatchWarnings Operating System: Linux | Architecture: x86_64 Type of failure: Incorrect | (amd64) error/warning at compile-time | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by goldfire): Is it worth pondering the utility of inferring a `COMPLETE` for an obviously-total pattern synonym? That is, GHC looks at the patsyn definition, sees that it's total (by doing its normal pattern-match completeness check) and then marks the patsyn as complete. This doesn't violate abstraction -- it's just a little more inference magic. Indeed, this idea could be expanded, allowing you to tell GHC that you expect a certain set of pattern synonyms to be complete, asking GHC to check for you. For example: {{{#!hs patterns where -- silly hypothetical syntax Some x = Just x None = Nothing }}} GHC would check these, notice that they're complete, and then pretend as if someone had said `{-# COMPLETE Some, None #-}`. If they're not complete, and we're warning about patterns, then issue a warning. I don't care enough about this to write, defend, etc., a proposal on the subject, but perhaps you (for any value of "you") do. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15886#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler