Scoped type variables

  • An example using lexically scoped type variables
  • Pattern type signatures
  • History
  • 9 minutes

The ScopedTypeVariables has two effects:

  1. It allows local type signatures to reference type variables bound with forall in their enclosing context. (This aspect is where the name of the language flag, “scoped type variables”, comes from.)
  2. It allows pattern type signatures – the use of :: to insert a type signature within a pattern.

This extension first appeared in GHC 6.8.1 GHC Manual documentation for this extension. and it implies the extension ExplicitForAll.

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