dope2/lib/primitives/dynamic.js

26 lines
731 B
JavaScript

import { inspect } from "node:util";
// import { assignFn } from "../generics/generics.js";
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;
// export const apply = input => fun => {
// const inputType = getType(input)
// const funType = getType(fun);
// const outputType = assignFn(funType, inputType);
// const inputValue = getInst(input);
// const funValue = getInst(fun);
// const outputValue = funValue(inputValue);
// return newDynamic(outputValue)(outputType);
// };