daitai-lang quick reference
This is the one-page summary. For the normative specification, see the v1.4 spec.
Keywords
class interface enum function method
static return if else for
in while match case val
this import module implements extends
Algebraic keywords (v1.2+)
MONOID GROUP RING SEMIRING LATTICE CATEGORY
FUNCTOR APPLICATIVE MONAD COMONAD FREEMONAD ARROW
NATURALTRANSFORM COALGEBRA YONEDA ADJUNCTION GALOIS
TOPOS OPERAD MONOIDALCATEGORY ENRICHEDCATEGORY
Literals
42 -- Int
3.14 -- Float
true, false -- Bool
"hello" -- String
None -- Optional<T> (empty)
Some(x) -- Optional<T> (with value)
/pattern/flags -- Regex
|0⟩, |1⟩, ⟨ψ| -- bra-ket (v1.3+)
Effects
There are no exceptions. Failable operations return Result<T, E>:
function parseInt(s: String) -> Result<Int, ParseError>
There are no null pointers. Absence is Optional<T>:
function find(xs: List<T>, p: T -> Bool) -> Optional<T>
There is no implicit mutation. Mutation lives behind a Step:
function tick(state: GameState, dt: Duration) -> GameState =
Step(state, .player.position, dt * state.player.velocity)
Reading next
- Full specification (v1.4) — the normative reference.
- The bra-ket primitives — what the literals mean.