Language
variant
Declare a kind-tagged union and its constructors in one place.
example.tt
export variant Result<T, E> {
Ok(value: T),
Err(error: E),
}
const value = Result.Ok(42);Features
- Payload, unit, explicit zero-argument constructor, generic, and exported cases.
- Unit cases are values; empty-parenthesis cases are functions.
- Plain objects with the same kind-tagged shape remain assignable.