simplify: no distinction between generic types and 'normal' types.

This commit is contained in:
Joeri Exelmans 2025-05-08 16:58:07 +02:00
parent b4826605af
commit a664ddac8a
27 changed files with 535 additions and 360 deletions

View file

@ -11,7 +11,7 @@ const eatParameters = (numParams, result) => {
export const makeMatchFn = variants => {
if (variants.length === 0) {
return undefined;
throw new Error("Bottom!");
}
const [_, ...remainingVariants] = variants;
return sum => handler => {
@ -34,4 +34,4 @@ export const makeConstructors = variants => {
...makeConstructors(remainingVariants).map(ctor =>
({[ctor.name]: val => newRight(ctor(val))}[ctor.name])),
];
}
};