This commit is contained in:
Joeri Exelmans 2025-03-23 09:15:37 +01:00
parent afd78c3b3e
commit 29d20b2273
25 changed files with 369 additions and 469 deletions

View file

@ -1,39 +1,39 @@
import { fnType } from "../metacircular.js";
import {Function} from "../metacircular.js";
// import { fnType } from "../metacircular.js";
// import {Function} from "../metacircular.js";
// import {Typed} from "../typed.js";
// // import {Typed} from "../typed.js";
// import {Bool} from "../primitives/symbols.js";
// import {deepEqual} from "../util.js";
// import {Conformable, conformanceCheck} from "../typeclasses/conformable.js";
// // import {Bool} from "../primitives/symbols.js";
// // import {deepEqual} from "../util.js";
// // import {Conformable, conformanceCheck} from "../typeclasses/conformable.js";
// // Identity function
// const idBoundToType = Symbol('idBoundToType');
// // // Identity function
// // const idBoundToType = Symbol('idBoundToType');
// const id = type => x => x;
// const idFn = {name: "id", inType: Type, outType: {inType: Type, outType: Type}, fn: id};
// const idIsConform = {
// name: "isConform",
// inType: idBoundToType,
// outType: Bool,
// fn: fn => deepEqual(fnIn(fn), fnOut(fn))
// }
// // const id = type => x => x;
// // const idFn = {name: "id", inType: Type, outType: {inType: Type, outType: Type}, fn: id};
// // const idIsConform = {
// // name: "isConform",
// // inType: idBoundToType,
// // outType: Bool,
// // fn: fn => deepEqual(fnIn(fn), fnOut(fn))
// // }
// export const ModuleId = [
// {i: idBoundToType, t: Type},
// {i: idFn, t: Function},
// ... makeTypedFnInOut({f: idBoundToType, inType: Type, outType: Type}),
// // export const ModuleId = [
// // {i: idBoundToType, t: Type},
// // {i: idFn, t: Function},
// // ... makeTypedFnInOut({f: idBoundToType, inType: Type, outType: Type}),
// {i: idBoundToType, t: Conformable},
// {i: idIsConform, t: conformanceCheck},
// ];
// // {i: idBoundToType, t: Conformable},
// // {i: idIsConform, t: conformanceCheck},
// // ];
// generates explicitly typed id-function
export const makeIdFn = typ => {
const Typ_to_Typ = fnType({in: typ, out: typ});
const id = x => x;
return {l:[
{i: id , t: Typ_to_Typ},
{i: Typ_to_Typ, t: Function},
]};
};
// // generates explicitly typed id-function
// export const makeIdFn = typ => {
// const Typ_to_Typ = fnType({in: typ, out: typ});
// const id = x => x;
// return {l:[
// {i: id , t: Typ_to_Typ},
// {i: Typ_to_Typ, t: Function},
// ]};
// };