list of byte encoded as JS Uint8Array + demo more readable
This commit is contained in:
parent
574651ccb7
commit
3d08485a08
6 changed files with 102 additions and 37 deletions
|
|
@ -3,8 +3,8 @@ import { Function } from "../metacircular.js";
|
|||
|
||||
// In JS, all products are encoded in the same way:
|
||||
const constructor = left => right => ({left, right});
|
||||
const left = product => product.left;
|
||||
const right = product => product.right;
|
||||
const getLeft = product => product.left;
|
||||
const getRight = product => product.right;
|
||||
|
||||
// Given two types A and B, create the type (A × B).
|
||||
export const makeProductType = (leftType, rightType) => {
|
||||
|
|
@ -14,11 +14,11 @@ export const makeProductType = (leftType, rightType) => {
|
|||
const rightFnType = fnType({in: productType, out: rightType});
|
||||
|
||||
const constructorBoundType = fnType({in: rightType, out: productType});
|
||||
const constructorType = fnType({in: leftType, out: constructorBoundType});
|
||||
const constructorType = fnType({in: leftType , out: constructorBoundType});
|
||||
|
||||
return [
|
||||
{i: left , t: leftFnType},
|
||||
{i: right , t: rightFnType},
|
||||
{i: getLeft , t: leftFnType},
|
||||
{i: getRight , t: rightFnType},
|
||||
{i: leftFnType , t: Function},
|
||||
{i: rightFnType, t: Function},
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue