Hi Haskellers, In the conversation for GHC Proposal #608 I am making some claims on what is popular / what people prefer regarding pattern synonyms. It’s hard to substantiate those claims so therefore I ammaking a poll to get to the bottom of things :).
For background, GHC proposal #448 is the master plan of an effort to make an alternative to ScopedTypeVariables
, which fixes a few issues. On a few occasions, we’ve made new proposals to modify it based on experience in other proposals and experience implementing it. GHC Proposal #608 is one of those proposals.
#448 is reintroducing PatternSignatures
(which does not currently exist, but use to) in order to enable just that feature without the rest of ScopedTypeVariables
. The question is whether that minimized extension should include the implicit binding functionality of pattern signature variables we have today (described below) or not.
(Also, an important disclaimer: we are well aware that ScopedTypeVariables
is one of the most popular and widely-used extensions today. For those of you worried about breaking changes, no one is advocating them / we actually get rid of ScopedTypeVariables
— it is easy to support it and old code using it indefinitely. So don’t worry about breakage.)
OK, now for the question itself.
Today, in code like
f (_ :: x) = ...
the x
inside the pattern signatures can be either a use of an x
bound in an outer scope, or a fresh binding of x
if no such x
is bound in an outer scope.
Note that originally this was added because it it was the only way to bind existential type variables, but now we have a new way with @
which is an explicit binding construct.
The question is do people like this?
- Don’t care, I don’t use pattern signatures so it doesn’t affect me.
- Don’t care, I do use pattern signatures but I still don’t care.
-
No, I don’t like implicit bindings, I want to look at code and always know whether something is binding or using variables without consulting surrounding code. If I need to bind a type variable I will instead use
@
and write something like
(thef @x (_ :: x) = ...
@x
binds the variable, the secondx
uses that bound variable.) -
Yes, I do like implicit binding. I don’t want to have to use this
@...
syntax to bind type variables.
0 voters