Dotty Documentation


Type Lambdas

Edit this page on GitHub

A type lambda lets one express a higher-kinded type directly, without a type definition.

[+X, Y] => Map[Y, X]

For instance, the type above defines a binary type constructor, with a covariant parameter X and a non-variant parameter Y. The constructor maps arguments S and T to Map[T, S]. Type parameters of type lambdas can have variances and bounds. A parameterized type definition or declaration such as

type T[X] = (X, X)

is a shorthand for a plain type definition with a type-lambda as its right-hand side:

type T = [X] => (X, X)

More details