dope2/primitives/int.js
2025-03-23 13:25:47 +01:00

19 lines
618 B
JavaScript

import { typedFnType } from "../structures/types.js";
import { Type } from "../type.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))),
]};