
#10928: Refine pattern synonym signatures -------------------------------------+------------------------------------- Reporter: mpickering | Owner: Type: bug | Status: new Priority: normal | Milestone: 8.0.1 Component: Compiler | Version: 7.10.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: Other | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): -------------------------------------+------------------------------------- Comment (by rwbarton): Thinking about this some more it seems wrong to change the operator used for provided constraints, since the whole type of a constructor in a GADT declaration {{{ data T a where MkT :: (Show a, Show b) => a -> b -> T a }}} should be a unit in the type of a pattern {{{ pattern MkT :: (Show a, Show b) => a -> b -> T a }}} Or looking at it another way, the fields of type `a` and `b`, despite being provided by a match on the pattern, appear in negative position in the type; so the provided context `(Show a, Show b)` should also appear in negative position too, which is the normal role of `=>`. So if we're going to use two different operators here, the non-`=>` one should mark the required constraints, like {{{ pattern P :: (Eq a, Num a) ??> (Show a, Show b) => b -> T a }}} But this is somehow a bit less appealing to me, since I don't see how this other operator `??>` could make sense in any other context. We have provided constraints, provided values (the values bound by a matching pattern), required constraints, but no required values. That's PatternFamilies. However there is no proposed syntax for the type of a pattern family there. It might be worthwhile to try to solve that problem at the same time. For example a syntax that would accommodate required arguments (while being rather ugly and perhaps unparseable) could be {{{ pattern ReqC => ReqVal1 -> ReqVal2 -> P :: ProvC => ProvVal1 -> ProvVal2 -> Res }}} This also happens to be backwards compatible in the case where `ReqC => ReqVal1 -> ReqVal2 -> ` is empty. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10928#comment:12 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler