7.1 The Erlang Type Language

Erlang is a dynamically typed language. Still, it comes with a notation for declaring sets of Erlang terms to form a particular type. This effectively forms specific subtypes of the set of all Erlang terms.

Subsequently, these types can be used to specify types of record fields and also the argument and return types of functions.

Type information can be used for the following:

  • To document function interfaces
  • To provide more information for bug detection tools, such as Dialyzer
  • To be exploited by documentation tools, such as EDoc, for generating program documentation of various formsIt is expected that the type language described in this section supersedes and replaces the purely comment-based @type and @spec declarations used by EDoc.