Make ScopedTypedVariables be effective for any type signature
At the moment, ScopedTypeVariables
does not have an effect for type signatures without an explicit forall
. Therefore, you are forced to explicitly quantify type variables if you want the type variables of your type signature to be visible outside the type signature.
When defining global variables, this means that you have to change part of the interface (the type signature) because of a change in the implementation. Of course, the change is only syntactical, but there is still a change. This is particularly problematic, because Haddock will follow the source code when deciding whether to include a top-level forall
in the generated documentation or not. Your Haddock-generated documentation will include spurious forall
s just because of the way your implementation works.
You could say that this is just a Haddock issue. However, problems do not stop here. There is also an inconsistency between scoped type variables in variable definitions and scoped type variables in instance declarations. In instance declarations, you do not have to use an explicit forall
. Type variables in the instance declaration head are visible in the body as soon as ScopedTypeVariables
is enabled.
I propose to change the semantics of ScopedTypeVariables
such that as soon as it is enabled, the feature is in effect for all rank-1 type variables in any type signature.
Trac metadata
Trac field | Value |
---|---|
Version | 8.2.1 |
Type | FeatureRequest |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | Compiler (Type checker) |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | jeltsch |
Operating system | |
Architecture |