4 ms·
Variance is related to type parameters in type constructors. For example, consider the -> function type constructor. It has two parameters, the input type and
by ufo 8y ago
Variance is related to type parameters in type constructors.
For example, consider the -> function type constructor. It has two parameters, the input type and the output type. Examples of function types are int->int and bool->bool.
The first parameter of the -> constructor (the type of the input) is contravariant while the second (the type of the output) is covariant.
For another example, consider the type of a generic immutable list, List<T>. The T type parameter of the List constructor is covariant.