type-theory

Definition

Type Constructor

Let be the set of all concrete types, i.e. the universe of types. A type constructor is a mapping (function) from the universe of types to itself:

Let denote the application of the type to the constructor to produce a new concrete type.

Variance

Covariant

Definition

Covariant Type Constructor

Let and be type. A type constructor is called covariant if it preserves the subtype relation of the types:

where denotes the subtype relation.

Link to original

Contravariant

Definition

Contravariant Type Constructor

Let and be type. A type constructor is called contravariant if it reverses the subtype relation of the types:

where denotes the subtype relation.

Link to original

Invariant

Definition

Invariant Type Constructor

Let and be type. A type constructor is called invariant if it is neither covariant nor contravariant:

where denotes the subtype relation.

Link to original