Pattern synonyms and explicit forall.

Consider the following existential type: ``` data Some where Some :: a -> Some ``` The following (bidirectional) pattern synonym is accepted: ``` pattern Any :: a -> Some pattern Any a = Some a ``` However using an explicit `forall` results in a type error: ``` pattern Any :: forall a. a -> Some pattern Any a = Some ``` ``` Patterns.hs:63:23: error: • Couldn't match expected type ‘a’ with actual type ‘a1’ ‘a1’ is a rigid type variable bound by a pattern with constructor: Some :: forall a. a -> Some, in a pattern synonym declaration at Patterns.hs:63:18-23 ‘a’ is a rigid type variable bound by the signature for pattern synonym ‘Any’ at Patterns.hs:62:23 • In the declaration for pattern synonym ‘Any’ • Relevant bindings include a :: a1 (bound at Patterns.hs:63:23) | 63 | pattern Any a <- Some a | ^ ``` This is indpendent whether `ExplicitForAll` or `ScopedTypedVariables` extensions are enabled or not. Is there a way around it, or is this a missing feature? Best regards, Marcin Szamotulski Sent with ProtonMail Secure Email.
participants (1)
-
coot@coot.me