Inline Branches on Tors: One-Line Result Types
A tor declares what it takes and what it can give back. The inputs sit in braces; the outputs are a set of named branches — a tagged union every caller has to route. That used to be spelled vertically:
tor read { path: string }
| ok { a: i32, b: u8 }
| err string The branch arms are the tor’s vocabulary: anything it says it can produce, a caller has to handle. That is the obligation the language is built on — you cannot silently drop an outcome.
Now the compact spelling works too, on one line:
tor add-one { n: i64 } | ok i64 | bad string
add-one => ok n + 1 | ok i64 | bad string reads the way a Result<i64, string> reads. And it is the same thing underneath: the single-line form lowers to exactly the AST its two-line sibling does — a surface spelling, not new semantics.
The wall was a single-field gap
The single-line branch parser never learned the identity spelling. It understood braced record payloads, and its own downstream rule insisted a lone braced field collapse to identity — | ok { v: i64 } should be | ok i64. But that identity form, on the same line, failed to parse. So single-field branches were caught between the two: one path demanded braces it could not take, the other produced the exact form the first could not read. Multi-field records worked inline; the common one-field case could not.
The fix makes the single-line loop accept the same non-braced branches the vertical path always has:
- a bare type —
| ok i64 - a payloadless branch —
| missing - a wildcard —
| c *
It mirrors the multiline parser and routes through the same type grammar, so phantom labels and module-qualified payloads behave identically in either spelling.
The line is about the declaration, not the call
Where a tor is routed, its arms stay one per line. Dispatch favours structure — an eight-outcome run wants its branches separated, and the obligation carried through every exit. The compact form is for naming the tree; the vertical form is for routing it. Both are the same |, the continuation surface the language is built on.