Skip to main content
Reference for every built-in type in Kairo v0.1: scalars, text, collections, nullable, Result<T, E>, and generics.

Scalar types

Rules
  • Integer literals default to Int64. Assign to Int32 explicitly to narrow.
  • Fractional literals default to Decimal. Float64 requires explicit typing or conversion.
  • Overflow is a compile-time error when a literal cannot fit the target type.

Literals

Nullable type T?

Represents either a value of T or null. Rules
  • T and T? are different types.
  • null may only be assigned where the target type is nullable.
  • Nested nullables like T?? are not part of v0.1.
  • Inside a value, T? is allowed only when T is value-like.

Collections

All collections are immutable in v0.1.

List<T>

Immutable ordered collection.

Set<T>

Immutable collection of unique values.

Map<K, V>

Immutable key-value collection.
Value-likeness rules
  • List<T> is value-like only when T is value-like.
  • Set<T> is value-like only when T is value-like.
  • Map<K, V> is value-like only when both K and V are value-like.

Result<T, E>

Represents an expected outcome: success with a T or expected failure with an E. Rules
  • Part of the Kairo Core prelude; no import required.
  • E must be value-like.
  • Constructed with Result.success(value) or Result.failure(error).
  • Contextually typed as Result<T, E> in v0.1.
Inspection surface See Error Handling for guidance and examples.

Generic type parameters

Declared in angle brackets on a type or contract.
Rules
  • Type argument arity must match the declaration.
  • Generic values may not store unconstrained generic parameters in value members in v0.1.

Generic contract constraints

Constrain a type parameter to a contract with T: ContractName.
Rules
  • Constraint target must resolve to a contract.
  • Multiple constraints and non-contract constraints are deferred.

Deferred

  • Custom equality rules
  • Mutable collections
  • Broad numeric promotion
  • Additional temporal types
  • T: value and other non-contract constraints

Types (language guide)

The value/object model in prose.

Declarations reference

How types are declared.