Types#
Choose a type based on the data you need to represent. Use a record for named fields, an alternative for a fixed set of cases, and an interface for operations a caller needs. Generic types let you reuse a model with different element types.
| Concept | What you will learn |
|---|---|
| Records and nominal types | Declare mutable fields and distinguish domain identifiers. |
| Alternatives | Represent a fixed set of possibilities with tagged cases. |
| Collections | Use mutable lists, maps, and sets with explicit shallow copies. |
| Optional values | Represent absence explicitly with some and none. |
| Mutation and references | Understand aliases, reassignment, and shallow copies. |
| Destructuring bindings | Unpack list positions and record fields. |
| Interfaces and implementations | Implement interfaces with concrete or generic blocks and construct explicit contract views. |
| Equality and hashing | Understand value comparison and key eligibility. |
| Generics and bounds | Apply parameterized types and express required properties. |
| Type compatibility and expected types | Check exact types, contextual constructors, and inference boundaries. |