Files
AILang/examples/rc_match_arm_partial_drop_leak.prose.txt
T
Brummel a9d57c5c81 prose: human-readable projection renderer (iter 20a)
New crate ailang-prose with one public fn module_to_prose(&Module)
-> String. Rust-flavour with braces, =>-match-arms, mode keywords
(own/borrow), effects as trailing 'with IO', Cons(1, Nil) ctor
form, /// doc strings.

Lossy projection where the LLM can re-derive: (con T) wrap,
(fn-type ...) wrap, (term-ctor ...) wrap. Load-bearing semantic
detail stays visible (modes, effects, clone, reuse-as, doc strings,
type annotations, tail flag).

CLI: 'ail prose <file.ail.json>' prints the projection.

3 snapshot fixtures + 28 unit tests. 215-line .ail.json reduces
to ~18 lines of legible source.

20b queued: infix arithmetic, paren elision, let-inlining, do
prettify.
2026-05-08 18:06:16 +02:00

24 lines
428 B
Plaintext

// module rc_match_arm_partial_drop_leak
data Wrap = MkWrap(Int)
data Cell = MkCell(Wrap, Wrap)
data Pair = MkPair(Cell, Cell)
fn build_pair(n: Int) -> own Pair {
MkPair(MkCell(MkWrap(n), MkWrap(2)), MkCell(MkWrap(3), MkWrap(4)))
}
fn use_first(p: own Pair) -> Int {
match p {
MkPair(a, b) => match a {
MkCell(w1, _) => 1
}
}
}
fn main() -> Unit with IO {
do io/print_int(use_first(build_pair(1)))
}