
#15885: Enhancing COMPLETE pragma to support pattern synonyms with polymorphic (output) types -------------------------------------+------------------------------------- Reporter: Shayan-Najd | Owner: (none) Type: task | Status: new Priority: normal | Milestone: 8.6.3 Component: Compiler | Version: 8.6.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by Shayan-Najd): It is worth mentioning that the combination of the ordered set of pattern synonym names in the pragma and the type of the pattern synonyms themselves often guarantees abstraction (currently, I don't know of any situation that does not): the pattern matching totality checker does not need to know the implementation details of pattern synonyms (e.g., such details can be omitted from the interface files). I noticed the required type constraints guarantee that a pattern synonym mentioned in a COMPLETE ordered set is always used in a setting where, well, the required constraints hold. This fact immediately implies that, for example in `{-# COMPLETE LL :: HasSrcSpan a => a #-}`, `a` always satisfies `HasSrcSpan`, hence checking the completeness of a matching on `LL` does not need to consider types at all; all types match `a` and `HasSrcSpan a` is already guaranteed to hold by the pattern synonym type checking. I might be wrong about this observation though. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15885#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler