Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
The Scala language reference gives an exhaustive list of all Scala types, which is reproduced in Table 18–1, with brief explanations for each type.
| Type | Syntax | Notes |
|---|---|---|
| Class or trait | class C ..., trait C ... | See Chapter 5, Chapter 10 |
| Tuple type | (T1, ..., Tn) | Section 4.7 |
| Function type | (T1, ..., Tn) => T | |
| Annotated type | T @A | See Chapter 15 |
| Parameterized type | A[T1, ..., Tn] | See Chapter 17 |
| Singleton type | value.type | See Section 18.1 |
| Type projection | O#I | See Section 18.2 |
| Compound type | T1 with T2 with ... with Tn { declarations } | See Section 18.6 |
| Infix type | T1 A T2 | See Section 18.7 |
| Existential type | T forSome { type and val declarations } | See Section 18.8 |