History of scoped type variables

Contents
  • Introduction in GHC (1998)
  • “Lexically-scoped type variables” (2002)
  • Declaration type signatures (2005)
  • Result type signatures removed (2006)
  • -XScopedTypeVariables (2007)
  • Formal specification (2018)

While the idea of lexically scoped type variables predates Haskell 98, they are not supported natively by the Haskell language even as of Haskell 2010. It was clear fairly early on, though, that it would be desirable, and sometimes necessary, to allow programmers to supply type annotations for subexpressions and patterns.

Introduction in GHC (1998)

The first support for scoped type variables appears Release notes for GHC 4.02 in GHC in version 4.02. It did not have a compiler flag of its own; rather, it was part of the wide set of features enabled by the -fglasgow-exts flag. List of language flags as of GHC 5.00

Its initial incarnation introduced two new features:

  1. pattern type signatures (which exist to this day);
  2. result type signatures (later removed in GHC 6.6).

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