Repository navigation
v0.3.0
Typechecker!
Text, (Text n) | a string, at most n bytes when bounded
Num | an integer
Bool | true / false
Sym | a string
(List τ), (List τ n) | an array, at most n elements
a record R | an object with exactly R's fields
constructor K with fields | {"tag": "K", "f₁": …}; a nullary K is {"tag": "K"}
ty ::= Text | (Text numeral) ; optionally bounded, in bytes
| Num | Bool | Sym | Money | Dur
| (List ty) | (List ty numeral)
| Type | Record ; anything you defined
| (Type ty …) ; one with type parameters, applied
| Any ; a placeholder; never askable
A datatype or record can take type parameters, and is then given that many arguments wherever it’s used:
(datatype (Outcome e a) [Got (value a)] [Unsure (why e)])
(ask m (Outcome (Text 40) Num) ctx) ; a (Got 7), or an (Unsure "…")
A type variable may appear only inside the definition that declares it, and inside its own definition a type is applied to exactly its own parameters: (Tree a), never (Tree (List a)).
A type is askable when it is built only from Text, Num, Bool, Sym, List, and datatypes or records whose fields are all askable, at the arguments given: (Option Num) is askable and (Option Any) isn’t. Any, Money and Dur are not askable; JSON has no amounts of money or time.
That one rule is what keeps authority unforgeable: a capability is not an askable type, so no model answer can ever contain a tool. Authority comes only from the host.
A bound caps the answer's size, which caps the reservation. A Verdict with 400-byte reasons reserves far less than the same type with unbounded text, so it fits budgets the unbounded one is refused by.
The type is also sent with every ask, as a JSON schema, and billed as input. The project's first real API call spent 538 input tokens on a 175-character prompt, 478 of them on the schema. So bounding an answer shrinks the reservation, while adding a constructor or a field makes every ask dearer on input for as long as the program runs. No bound on the text inside those fields helps, because what is sent is the schema, not the answer.
How a type maps to JSON
µNorman JSON
Text, (Text n) a string, at most n bytes when bounded
Num an integer
Bool true / false
Sym a string
(List τ), (List τ n) an array, at most n elements
a record R an object with exactly R's fields
constructor K with fields {"tag": "K", "f₁": …}; a nullary K is {"tag": "K"}