The type system
Bynk makes illegal states unrepresentable: refined and opaque types, sums and
records, and Result/Option errors-as-values, all checked before emission.
Understand
- The type-system philosophy
- The refined-literal admission model
- Recursion and iteration
- Choosing
Int,FloatorDecimal
Do
- Define and validate untrusted input
- Decode untrusted JSON into a typed value
- Read a YAML settings file into a typed value
- Use a literal where a refined type is expected
- Define sum, record, and opaque types
- Work with
Resultand optional values - Pattern-match with
match - Match on a record’s fields
- Destructure a record with
let - Match on a list’s shape
- Match on a range of numbers
- Narrow and bind with
is - Fault on the impossible or the unfinished
- Declare
Eqon a generic that compares - Recursive generic types
- Handle money correctly
- Understand ordering your own types
- Generic code that crosses the boundary
- Constructors for generic types
See also: Reference — Type system, Refined-type API, Spec §6 — The type system.