basic functionality, no generics
This commit is contained in:
commit
a8260f2afb
17 changed files with 615 additions and 0 deletions
38
lib/id.js
Normal file
38
lib/id.js
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
import {Function} from "../metacircular.js";
|
||||
|
||||
// import {Typed} from "../typed.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');
|
||||
|
||||
// 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}),
|
||||
|
||||
// {i: idBoundToType, t: Conformable},
|
||||
// {i: idIsConform, t: conformanceCheck},
|
||||
// ];
|
||||
|
||||
// generates explicitly typed id-function
|
||||
export const makeIdFn = typ => {
|
||||
const Typ_to_Typ = {in: typ, out: typ};
|
||||
const id = x => x;
|
||||
return [
|
||||
{i: id , t: Typ_to_Typ},
|
||||
{i: Typ_to_Typ, t: Function},
|
||||
];
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue