{ "schema": "ailang/v0", "name": "eq_ord_polymorphic", "imports": [], "defs": [ { "kind": "fn", "name": "at_most", "doc": "Composition of prelude `gt` with `not` — semantically equivalent to `le`. Used to exercise polymorphic-helper-over-prelude-fns composition through the unified mono pass.", "type": { "k": "forall", "vars": ["a"], "constraints": [{ "class": "Ord", "type": { "k": "var", "name": "a" } }], "body": { "k": "fn", "params": [ { "k": "var", "name": "a" }, { "k": "var", "name": "a" } ], "param_modes": ["borrow", "borrow"], "ret": { "k": "con", "name": "Bool" }, "effects": [] } }, "params": ["x", "y"], "body": { "t": "app", "fn": { "t": "var", "name": "not" }, "args": [{ "t": "app", "fn": { "t": "var", "name": "gt" }, "args": [ { "t": "var", "name": "x" }, { "t": "var", "name": "y" } ] }] } }, { "kind": "fn", "name": "main", "type": { "k": "fn", "params": [], "ret": { "k": "con", "name": "Unit" }, "effects": ["IO"] }, "params": [], "body": { "t": "seq", "lhs": { "t": "do", "op": "io/print_int", "args": [{ "t": "if", "cond": { "t": "app", "fn": { "t": "var", "name": "at_most" }, "args": [ { "t": "lit", "lit": { "kind": "int", "value": 3 } }, { "t": "lit", "lit": { "kind": "int", "value": 5 } } ] }, "then": { "t": "lit", "lit": { "kind": "int", "value": 1 } }, "else": { "t": "lit", "lit": { "kind": "int", "value": 0 } } }] }, "rhs": { "t": "seq", "lhs": { "t": "do", "op": "io/print_int", "args": [{ "t": "if", "cond": { "t": "app", "fn": { "t": "var", "name": "at_most" }, "args": [ { "t": "lit", "lit": { "kind": "bool", "value": true } }, { "t": "lit", "lit": { "kind": "bool", "value": false } } ] }, "then": { "t": "lit", "lit": { "kind": "int", "value": 1 } }, "else": { "t": "lit", "lit": { "kind": "int", "value": 0 } } }] }, "rhs": { "t": "do", "op": "io/print_int", "args": [{ "t": "if", "cond": { "t": "app", "fn": { "t": "var", "name": "at_most" }, "args": [ { "t": "lit", "lit": { "kind": "str", "value": "abc" } }, { "t": "lit", "lit": { "kind": "str", "value": "abd" } } ] }, "then": { "t": "lit", "lit": { "kind": "int", "value": 1 } }, "else": { "t": "lit", "lit": { "kind": "int", "value": 0 } } }] } } } } ] }