wip
This commit is contained in:
parent
afd78c3b3e
commit
29d20b2273
25 changed files with 369 additions and 469 deletions
|
|
@ -1,8 +1,8 @@
|
|||
import {Function, getIn, getOut} from "../metacircular.js";
|
||||
import {Module} from "../structures/list_types/module.js";
|
||||
import { deepEqual } from "../util.js";
|
||||
import { Typed } from "../typed.js";
|
||||
import { fnType } from "../metacircular.js";
|
||||
// import { getIn, getOut } from "../metacircular.js";
|
||||
// import {Module} from "../structures/list_types/module.js";
|
||||
// import { deepEqual } from "../util.js";
|
||||
// import { Typed } from "../typed.js";
|
||||
// import { fnType } from "../metacircular.js";
|
||||
|
||||
// import {Num, NumDict, getType, getMul} from "../typeclasses/num.js";
|
||||
|
||||
|
|
@ -27,24 +27,24 @@ import { fnType } from "../metacircular.js";
|
|||
// ];
|
||||
|
||||
|
||||
export const makeSquare = ({i: mul, t: mulFunction}) => {
|
||||
const numType = getIn(mulFunction);
|
||||
const boundMulFunction = getOut(mulFunction);
|
||||
if (!deepEqual(getOut(boundMulFunction), numType) || !deepEqual(getIn(boundMulFunction), numType)) {
|
||||
console.log(getOut(boundMulFunction), getIn(boundMulFunction), numType);
|
||||
throw new Error("invalid signature");
|
||||
}
|
||||
const square = x => mul(x)(x);
|
||||
const squareFunction = fnType({in: numType, out: numType});
|
||||
return {l:[
|
||||
{i: square , t: squareFunction},
|
||||
{i: squareFunction, t: Function},
|
||||
]};
|
||||
};
|
||||
// export const makeSquare = ({i: mul, t: mulFunction}) => {
|
||||
// const numType = getIn(mulFunction);
|
||||
// const boundMulFunction = getOut(mulFunction);
|
||||
// if (!deepEqual(getOut(boundMulFunction), numType) || !deepEqual(getIn(boundMulFunction), numType)) {
|
||||
// console.log(getOut(boundMulFunction), getIn(boundMulFunction), numType);
|
||||
// throw new Error("invalid signature");
|
||||
// }
|
||||
// const square = x => mul(x)(x);
|
||||
// const squareFunction = fnType({in: numType, out: numType});
|
||||
// return {l:[
|
||||
// {i: square , t: squareFunction},
|
||||
// {i: squareFunction, t: Function},
|
||||
// ]};
|
||||
// };
|
||||
|
||||
const makeSquareType = fnType({in: Typed, out: Module});
|
||||
// const makeSquareType = fnType({in: Typed, out: Module});
|
||||
|
||||
export const ModuleSquare = {l:[
|
||||
{i: makeSquare , t: makeSquareType},
|
||||
{i: makeSquareType, t: Function},
|
||||
]};
|
||||
// export const ModuleSquare = {l:[
|
||||
// {i: makeSquare , t: makeSquareType},
|
||||
// {i: makeSquareType, t: Function},
|
||||
// ]};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue