File tree Expand file tree Collapse file tree 3 files changed +31
-0
lines changed
Expand file tree Collapse file tree 3 files changed +31
-0
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ layout : doc-page
3+ title : " Type Lambdas"
4+ ---
5+
6+ A _ type lambda_ lets one express a higher-kinded type directly, without
7+ a type definition.
8+
9+ [+X, Y] => Map[Y, X]
10+
11+ For instance, the type above defines a binary type constructor, with a
12+ covariant parameter ` X ` and a non-variant parameter ` Y ` . The
13+ constructor maps arguments ` S ` and ` T ` to ` Map[T, S] ` . Type parameters
14+ of type lambdas can have variances and bounds. A parameterized type
15+ definition or declaration such as
16+
17+ type T[X] = (X, X)
18+
19+ is a shorthand for a plain type definition with a type-lambda as its
20+ right-hand side:
21+
22+ type T = [X] => (X, X)
Original file line number Diff line number Diff line change 77 url : docs/reference/intersection-types.html
88 - title : Union types
99 url : docs/reference/union-types.html
10+ - title : Type lambdas
11+ url : docs/reference/type-lambdas.html
1012 - title : Trait Parameters
1113 url : docs/reference/trait-parameters.html
1214 - title : Enumerations
Original file line number Diff line number Diff line change 1+ package typeLambdas
2+
3+ object Test {
4+
5+ type T = [+ X , Y ] => Map [Y , X ]
6+
7+ }
You can’t perform that action at this time.
0 commit comments