Skip to main content
Kairo ships with a rich set of built-in types that cover everyday domain modelling needs without requiring third-party libraries. This page is the complete reference for scalar types, temporal types, collections, the 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 a value 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

Prefer immutable collections (List, Set, Map) wherever possible. Switch to the mutable variants only when you need to build up a collection incrementally.

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.
Always check isSuccess or isFailure before accessing .value or .error. Reading .value on a failed result, or .error on a successful result, is a runtime 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-nullable T?? is invalid and a compile error.
  • The null literal is null.
  • You must handle the nullable case explicitly — there is no automatic null propagation.
T?? is not valid Kairo. If you find yourself wanting a nullable-of-nullable, consider whether Result<T?, E> or a dedicated value type better models your domain.

Type Notes