branching and very basic merging of slots

This commit is contained in:
Joeri Exelmans 2025-04-17 09:19:41 +02:00
parent 614e6c0fdb
commit 3978f7f835
32 changed files with 684 additions and 420 deletions

View file

@ -4,9 +4,9 @@ import { typedFnType } from "./types.js";
import { prodType } from "./types.js";
// In JS, all products are encoded in the same way:
const constructor = left => right => ({left, right});
const getLeft = product => product.left;
const getRight = product => product.right;
export const constructorProduct = l => r => ({l, r});
export const getLeft = product => product.l;
export const getRight = product => product.r;
export const ModuleProduct = {l: [
// binary type constructor
@ -21,7 +21,7 @@ export const ModuleProduct = {l: [
),
// a -> b -> (a, b)
...typedFnType(constructor, fnType =>
...typedFnType(constructorProduct, fnType =>
makeGeneric((a, b) =>
fnType
(a)