rename function
This commit is contained in:
parent
97b4e83379
commit
e892ade34d
8 changed files with 26 additions and 19 deletions
|
|
@ -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},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue