Type definitions
Table of Contents
pint° still have no types with complex behavior, but you can introduce product
types and sum types with the type
keyword. The types defined by the type
keyword are opaque and have structural identity.
All types are made of a type name with optional type parameters and one or more type variants.
Product types #
Product types are described by providing parameters delimited by commas.
|
|
Sum types #
You can declare multiple variants of a type by separating each variant with the
pseudo-operator +
.
type LogLevel = Debug + Info + Warn + Error + Fatal
Combining both types #
You can combine both product types and sum types to make more complex types.
|
|