#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 mpickering): Replying to [comment:53 goldfire]:
Replying to [comment:46 mpickering]:
Thanks for this detailed reply! I'm happy with all your responses save one:
- The spec says "We verify that the result types of each constructor in a complete match agrees with each other." What does this sentence mean? Consider the possibility of pattern synonyms that match against functions, polymorphic patterns, and possibly even higher-rank patterns.
It means that we look at the result type of each conlike and then verify that the type constructor for each type is the same. In the case of a set containing polymorphic patterns, at least one pattern in the set must have a definite type or you must specify a type signature to fix the type for the whole set.
I'm not sure what you mean here. Where do you specify the type signature? In the `COMPLETE` pragma?
I updated the wiki page now with lots of examples. You can specify something like.. {{{#!hs pattern P :: Maybe a pattern P = Nothing {-# COMPLETE P :: Maybe #-} }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/8779#comment:55> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler