You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/docs/reference/kind-polymorphism.md
+3-3Lines changed: 3 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -3,7 +3,7 @@ layout: doc-page
3
3
title: "Kind Polymorphism"
4
4
---
5
5
6
-
Normally type parameters in Scala are partitioned into _kinds_. First-level types are types of values. Higher-kinded types are type constructurs
6
+
Normally type parameters in Scala are partitioned into _kinds_. First-level types are types of values. Higher-kinded types are type constructors
7
7
such as `List` or `Map`. The kind of a type is indicated by the top type of which it is a subtype. Normal types are subtypes of `Any`,
8
8
covariant single argument type constructors such as `List` are subtypes of `[+X] => Any`, and the `Map` type constructor is
9
9
a subtype of `[X, +Y] => Any`.
@@ -32,12 +32,12 @@ We call type parameters and abstract types with an `AnyKind` upper bound _any-ki
32
32
Since the actual kind of an any-kinded type is unknown, its usage must be heavily restricted: An any-kinded type
33
33
can be neither the type of a value, nor can it be instantiated with type parameters. So about the only
34
34
thing one can do with an any-kinded type is to pass it to another any-kinded type argument.
35
-
Nevertheless, this is enough to achieve some interesting generalizations that work across kinds, typicially
35
+
Nevertheless, this is enough to achieve some interesting generalizations that work across kinds, typically
36
36
through advanced uses of implicits.
37
37
38
38
(todo: insert good concise example)
39
39
40
40
Some technical details: `AnyKind` is a synthesized class just like `Any`, but without any members. It extends no other class.
41
41
It is declared `abstract` and `final`, so it can be neither instantiated nor extended.
42
42
43
-
`AnyKind` plays a special role in Scala's subtype system: It is a supertype of all other types no matter what their kind is. It is also assumed to be kind-compatible with all other types. Furthermore, `AnyKind` is treated as a higher-kinded type (so it cannot be used as a type of values), but at the same time it has no type parameters (so it cannot be instantiated).
43
+
`AnyKind` plays a special role in Scala's subtype system: It is a supertype of all other types no matter what their kind is. It is also assumed to be kind-compatible with all other types. Furthermore, `AnyKind` is treated as a higher-kinded type (so it cannot be used as a type of values), but at the same time it has no type parameters (so it cannot be instantiated).
0 commit comments