rename function

This commit is contained in:
Joeri Exelmans 2025-03-19 15:43:45 +01:00
parent 97b4e83379
commit e892ade34d
8 changed files with 26 additions and 19 deletions

View file

@ -5,6 +5,8 @@ import { Module } from "./module.js";
const constructorLeft = left => ({variant: "L", value: left });
const constructorRight = right => ({variant: "R", value: right});
// signature:
// sum-type -> (leftType -> resultType, rightType -> resultType) -> resultType
const match = sum => handlers => sum.variant === "L"
? handlers.left(sum.value)
: handlers.right(sum.value);
@ -31,6 +33,7 @@ export const makeSumType = (leftType, rightType) => {
};
return [
{i: sType , t: Type},
{i: constructorLeft , t: constructorLeftType},
{i: constructorRight , t: constructorRightType},
{i: constructorLeftType , t: Function},