{ "schema": "ailang/v0", "name": "prelude", "imports": [], "defs": [ { "kind": "type", "name": "Ordering", "vars": [], "doc": "Result of a three-way comparison: LT (less than), EQ (equal), GT (greater than). Ships in milestone 23 as the codomain of Ord.compare.", "ctors": [ { "name": "LT", "fields": [] }, { "name": "EQ", "fields": [] }, { "name": "GT", "fields": [] } ] }, { "kind": "class", "name": "Eq", "param": "a", "doc": "Structural equality. Ships in milestone 23 alongside Ord. The primitive `==` operator stays as the surface-level comparator this iter; routing `==` through `Eq.eq` is the declared P2 follow-up (see docs/specs/2026-05-10-23-eq-ord-prelude.md, `Out of scope`).", "methods": [ { "name": "eq", "type": { "k": "fn", "params": [ { "k": "var", "name": "a" }, { "k": "var", "name": "a" } ], "param_modes": ["borrow", "borrow"], "ret": { "k": "con", "name": "Bool" }, "effects": [] } } ] }, { "kind": "instance", "class": "Eq", "type": { "k": "con", "name": "Int" }, "doc": "Eq Int. Body lowers to `icmp eq i64` via the existing primitive `==` dispatch in `lower_eq`.", "methods": [ { "name": "eq", "body": { "t": "lam", "params": ["x", "y"], "paramTypes": [ { "k": "var", "name": "a" }, { "k": "var", "name": "a" } ], "retType": { "k": "con", "name": "Bool" }, "body": { "t": "app", "fn": { "t": "var", "name": "==" }, "args": [ { "t": "var", "name": "x" }, { "t": "var", "name": "y" } ] } } } ] }, { "kind": "instance", "class": "Eq", "type": { "k": "con", "name": "Bool" }, "doc": "Eq Bool. Body lowers to `icmp eq i1` via the existing primitive `==` dispatch in `lower_eq`.", "methods": [ { "name": "eq", "body": { "t": "lam", "params": ["x", "y"], "paramTypes": [ { "k": "var", "name": "a" }, { "k": "var", "name": "a" } ], "retType": { "k": "con", "name": "Bool" }, "body": { "t": "app", "fn": { "t": "var", "name": "==" }, "args": [ { "t": "var", "name": "x" }, { "t": "var", "name": "y" } ] } } } ] }, { "kind": "instance", "class": "Eq", "type": { "k": "con", "name": "Str" }, "doc": "Eq Str. The lambda body shape mirrors Int/Bool for round-trip stability, but the codegen intercept in `emit_fn` overrides the body to call `@ail_str_eq` directly — see `try_emit_primitive_instance_body` in `crates/ailang-codegen/src/lib.rs`.", "methods": [ { "name": "eq", "body": { "t": "lam", "params": ["x", "y"], "paramTypes": [ { "k": "var", "name": "a" }, { "k": "var", "name": "a" } ], "retType": { "k": "con", "name": "Bool" }, "body": { "t": "app", "fn": { "t": "var", "name": "==" }, "args": [ { "t": "var", "name": "x" }, { "t": "var", "name": "y" } ] } } } ] } ] }