Skip to content

Types

TypeValuesNotes
str<=Nstrings of at most N tokensstr (unbounded) is allowed except where appended to a context
int, float, bool64-bit integer, 64-bit float, booleanint converts to float implicitly
()unitfunctions without -> return ()
Ctx<M>a linear handle to a context on model Msee Linearity rules
(T1, T2, ...)tuplestuples containing a Ctx must be destructured
Sa record of schema Sfields accessed with .name
[T; <=N]list of at most N elementsfrom json<S> output, iterable with for
Tensor<[d..], fmt, abs<=m, err<=e>tensor with static shape, format, magnitude and error boundssee Precision layer

String bounds are computed, never guessed:

expressiontype
"text"str<=bytes("text")
a + bstr<=(A + B)
gen c max Nstr<=N
gen c max N as choice[o1, o2]str<=max(bytes(oi))
to_str(x)str<=24
trim(s)same as s
tool resultthe declared bound (enforced at runtime by truncation)

str<=A is accepted where str<=B is expected if A ≤ B. Any bounded string is accepted where str is expected. A tensor is accepted where a tensor type is expected if shape and format match and its abs/err bounds are no larger. [T; <=A] fits [U; <=B] if A ≤ B and T fits U.

let can carry an annotation, which is required when a variable will later be assigned a larger value:

fn main() {
let best: str<=96 = "" // without the annotation `best` would be str<=0
for i in 0..3 {
best = "candidate"
}
print(best)
}

Functions are checked in call-graph order, callees first. A function’s declared return type is checked against its body, and callers see a refined type: for tensors, the bound the body actually achieves rather than the declared one. veer types prints these summaries.