interactive prompt can handle polymorphic types

This commit is contained in:
Joeri Exelmans 2025-04-02 15:49:43 +02:00
parent a0e3aa0cb3
commit 4a4983f693
20 changed files with 485 additions and 276 deletions

View file

@ -9,17 +9,22 @@ const symbolVersioned = Symbol("Versioned");
export const versionedType = makeTypeConstructor(symbolVersioned)(1);
export const constructor = parents => value => {
export const constructor = parents => alternatives => {
return { parents, alternatives };
}
const constructorType = makeGeneric(a =>
fnType
(a)
(setType(versionedType(a)))
(fnType
(setType(a))
(versionedType(a))
)
);
// const getValue = v =>
const initial = x => ({ parents: new Set(), alternatives: new Set(x) });
const initialFnType = makeGeneric(a => fnType(a)(versionedType(a)));
const eq = eqDict => vA => vB => {
return getEq(eqDict)(vA.value,vB.value) // compare values