small changes

This commit is contained in:
Joeri Exelmans 2025-05-08 23:35:34 +02:00
parent 4c394441b0
commit 34d06aa82a
3 changed files with 23 additions and 6 deletions

View file

@ -1,10 +1,11 @@
import { getDefaultTypeParser } from "../parser/type_parser.js";
import { addDouble, eqDouble, mulDouble } from "./double.js";
import { newDynamic } from "./dynamic.js";
const mkType = getDefaultTypeParser();
export const ModuleDouble = [
{ i: addDouble, t: mkType("Double -> Double -> Double") },
newDynamic(addDouble)(mkType("Double -> Double -> Double")),
{ i: mulDouble, t: mkType("Double -> Double -> Double") },
{ i: eqDouble, t: mkType("Double -> Double -> Bool") },
];

View file

@ -1,6 +1,14 @@
import { inspect } from "node:util";
import { assignFn } from "../generics/generics.js";
export const newDynamic = i => t => ({i, t});
function inspectDynamic(_depth, options, inspect) {
return `${inspect(this.i, options)} :: ${inspect(this.t, options)}`;
}
export const newDynamic = i => t => ({
i, t,
[inspect.custom]: inspectDynamic,
});
export const getInst = lnk => lnk.i;
export const getType = lnk => lnk.t;