Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Keyword Reference

KeywordUsage
andLogical AND (short-circuit): x and y
asType cast: x as f64
breakExit enclosing for loop: break if i >= 10
catchInline error handling: expr catch err { fallback }
constCompile-time constant: const N: i64 = 42
ctlControl effect operation (captures continuation)
dataDeclare a data type (sum type): Point :: data .{ .x: i32, .y: i32 }
effectDeclare an algebraic effect
elseDefault arm: else => ..., or inline: if x then a else b
errorError set modifier: data E = error ..., or error value: error.NotFound
falseBoolean literal
finalFinal effect operation (never resumes)
fnDeclare a function, or a tail-resumptive effect operation
forallUniversal quantifier for scoped type variables: forall<s> fn() -> ...
handlerDefine an effect handler
ifConditional: if x > 0 then ..., guard-style: if { cond => ... }, postfix: break if x
ignotPackage/crate root in paths
inNamed effect containment: named effect ref<s, a> in heap<s>
letBind an immutable value to a name
forLoop: for, for cond, for i in 0..n, for x in coll, for x, i in coll, for x in coll where f(x)
maskHide an effect from the current scope
matchPattern matching: match x { pat => body }
modDeclare a module
namedNamed effect modifier: named effect ref<s, a>
nilAbsence of value (for ?T optional types)
notLogical NOT: not x
orLogical OR (short-circuit): x or y
orelseOptional default: expr orelse fallback
overrideRe-handle an effect in scope
pvtMark an item as private (public by default)
resumeResume continuation in ctl handler: resume(value)
returnReturn a value from a function early: return error.X if cond
scopedScoped effect modifier: scoped effect heap<s::S>
superParent module in paths
thenInline if branch: if cond then expr else expr
trueBoolean literal
tryError propagation: try expr
typeDeclare a type alias: type Id = i32
unsafeUnsafe block
useImport items from a module
varMutable binding: var x = 5
withInstall an effect handler

Reserved Symbols

SymbolUsage
@Intrinsic prefix: @add(x, y), @sizeof(T)
!Error union type prefix: !T
?Optional type prefix: ?T
=>Arm separator in match/if: pattern => body
#[...]Attribute annotation
|...|Lambda parameters: |x| x + 1
|Pipe separator in data variants: data Color = Red | Green
::Path separator or kind annotation: Foo::bar, s::S
..Spread in literals, range in patterns
->Return type separator
<-Handler binding: with r <- named handler
_Wildcard pattern