Result<T, E> outcome type, and nullable T? — including usage notes, API surface, and examples.
Scalar Types
Scalar types represent single, indivisible values. All scalar types are value-like and can be stored inside avalue declaration.
Kairo uses
Text as the canonical string type — there is no String. Similarly, Decimal is the default for fractional numbers like 9.99; only use Float64 when you have a specific reason to work with binary floating-point arithmetic.Temporal Types
Kairo provides first-class temporal types for dates, times, and durations. All temporal types are value-like.Collection Types
Kairo provides immutable and mutable variants of three standard collection shapes. All collection types are generic.Immutable Collections
Mutable Collections
Result<T, E>
Result<T, E> is the standard type for representing an operation that can either succeed with a value of type T or fail with an error of type E. It is always available without an import — Result is part of the Core prelude.
E must be a value-like type (a value declaration or scalar).
Construction
Result<T, E>
Wraps a successful outcome. Pass the success value as the argument.
Result<T, E>
Wraps a failure outcome. Pass an instance of the error type
E as the argument.Properties
Bool
true when the result holds a success value.Bool
true when the result holds a failure value.T
The success value. Accessing this property when
isFailure is true is a fault.E
The failure value. Accessing this property when
isSuccess is true is a fault.Nullable Types — T?
By default, every type in Kairo is non-null. To allow a value to be absent, append ? to the type name.
Rules:
T?is the only nullable form. Double-nullableT??is invalid and a compile error.- The null literal is
null. - You must handle the nullable case explicitly — there is no automatic null propagation.
