get rid of some stuff

This commit is contained in:
Joeri Exelmans 2025-05-23 14:45:35 +02:00
parent 2333abe70f
commit 3d72f4d416
6 changed files with 38 additions and 86 deletions

View file

@ -1,6 +1,5 @@
import { makeCompareFn } from "../compare/dynamic.js";
import { compareTypes } from "../compare/type.js";
import { assignFn, UnifyError } from "../generics/generics.js";
import { getInst, getType, newDynamic } from "../primitives/dynamic.js";
import { Dynamic, Type } from "../primitives/primitive_types.js";
import { getSymbol } from "../primitives/type.js";
@ -77,22 +76,22 @@ export const getFunctions = env => {
})([])(types);
};
// return list of functions that can be called on 'dynamic'
export const getEnabledFunctions = env => dynamic => {
const allFunctions = getFunctions(env);
const enabled = foldList(enabled => fun => {
try {
const outType = assignFn(getType(fun), getType(dynamic));
return [...enabled, {fun, outType}];
} catch (e) {
if (!(e instanceof UnifyError)) {
throw e;
}
return enabled;
}
})([])(allFunctions);
return enabled;
};
// // return list of functions that can be called on 'dynamic'
// export const getEnabledFunctions = env => dynamic => {
// const allFunctions = getFunctions(env);
// const enabled = foldList(enabled => fun => {
// try {
// const outType = assignFn(getType(fun), getType(dynamic));
// return [...enabled, {fun, outType}];
// } catch (e) {
// if (!(e instanceof UnifyError)) {
// throw e;
// }
// return enabled;
// }
// })([])(allFunctions);
// return enabled;
// };
export const getCompatibleInputTypes = env => funType => {
const allTypes = getTypes(env);