Scoped type variables

  • Declaration type signatures
  • Pattern type signatures
  • 9 minutes
Implication graph
ScopedTypeVariables ExplicitForAll

The ScopedTypeVariables extension has two effects:

  1. It allows local type signatures to reference type variables bound with forall in their enclosing context.
  2. 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 ScopedTypeVariables

Sign up for access to the full page, plus the complete archive and all the latest content.