Scoped type variables
- Declaration type signatures
- Pattern type signatures
- 9 minutes
ScopedTypeVariables extension has two effects:
- It allows local type signatures to reference type variables bound with
forallin their enclosing context.
- It allows pattern type signatures – the use of
::to insert a type signature within a pattern.
To appreciate why these two features are lumped together under a single language extension, it may be helpful to read about the history of scoped type variables. Scoped type variables has existed in its present form GHC 6.6, though the feature dates all the way back to GHC 4.02. GHC documentation for