
#8581: Pattern synonym used in an expression context could have different constraints to pattern used in a pattern context -------------------------------------+------------------------------------- Reporter: cactus | Owner: Type: feature request | Status: new Priority: normal | Milestone: Component: Compiler | Version: Resolution: | Keywords: | PatternSynonyms 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 cactus): Replying to [comment:43 dfeuer]:
If we let the constructor have its own signature, can we drop the whole required constraints bit? If so, I think that would make things considerably less confusing.
But the required constraints don't come from builders; a unidirectional pattern synonym can have just as much of a required context. The simplest example I can think of is {{{ pattern P x <- (f -> x) }}} Here, any constraint of `f` on its argument's type will be a required constraint in `P`'s type. (Note that a special case of this is matching against overloaded literals, e.g. `pattern Z = 0`, which requires `(Num a, Eq a)`.) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8581#comment:44 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler