{ "schema": "ailang/v0", "name": "data_simple", "imports": [], "defs": [ { "kind": "type", "name": "Box", "vars": ["a"], "doc": "A unary box around a polymorphic value.", "ctors": [ { "name": "MkBox", "fields": [ { "k": "var", "name": "a" } ] } ] }, { "kind": "fn", "name": "wrap_one", "doc": "Construct a Box Int via MkBox. The body uses (reuse-as src body) — a hint that the freshly-allocated Box should reuse the source's memory slot under --alloc=rc. Exercises TermCtor, ReuseAs, and Type::Var inside a ctor field position.", "type": { "k": "fn", "params": [ { "k": "con", "name": "Box", "args": [ { "k": "con", "name": "Int" } ] } ], "param_modes": ["own"], "ret": { "k": "con", "name": "Box", "args": [ { "k": "con", "name": "Int" } ] }, "ret_mode": "own", "effects": [] }, "params": ["src"], "body": { "t": "reuse-as", "source": { "t": "var", "name": "src" }, "body": { "t": "ctor", "type": "Box", "ctor": "MkBox", "args": [ { "t": "lit", "lit": { "kind": "int", "value": 1 } } ] } } } ] }