Type Declarations
Calibre uses type declarations to introduce new named types.
type Pair := struct { left right : int };This binds the name Pair to a struct type. The same type form is also used for enums, tuple-style structs, and generic types.
type Language := enum { ENGLISH : int, SPANISH, ARABIC : <Language, Language>};
type Country := struct (Language);type Box:<T> := struct { value : T };Calibre also allows built-in types to be named in type declarations when overloading or extending them.
type int := int @overload { "+" := fn (left right : int) => left - right};Most of the time, though, type is simply how you define your own data shapes.
Once a type has been declared, it can be constructed, destructured, matched against, and extended just like the built-in types used throughout the rest of the tour.