dope2/primitives/int.js
Joeri Exelmans 8eec5b9239 recursive types (and operations on them, like pretty-printing, comparison and unification) seem to be working.
big part of the code base still needs to be 'ported' to the updated type constructors.
2025-05-05 17:17:45 +02:00

19 lines
654 B
JavaScript

import { typedFnType } from "../structures/types.js";
import { Type } from "./types.js";
import {Bool, Int} from "./types.js";
export const addInt = x => y => x + y;
export const mulInt = x => y => x * y;
export const eqInt = x => y => x === y;
const serialize = x => x.toString();
const deserialize = str => BigInt(str);
export const ModuleInt = {l:[
{i: Int , t: Type },
...typedFnType(addInt, fnType => fnType(() => Int)(fnType(Int)(() => Int))),
...typedFnType(mulInt, fnType => fnType(() => Int)(fnType(Int)(() => Int))),
...typedFnType(eqInt , fnType => fnType(() => Int)(fnType(Int)(() => Bool))),
]};