recursive types (and operations on them, like pretty-printing, comparison and unification) seem to be working.

big part of the code base still needs to be 'ported' to the updated type constructors.
This commit is contained in:
Joeri Exelmans 2025-05-05 17:17:45 +02:00
parent 55c5d7cffa
commit 8eec5b9239
34 changed files with 523 additions and 295 deletions

View file

@ -4,14 +4,14 @@ import { newLeft, newRight, match } from "../structures/sum.js";
import { fnType, sumType } from "../structures/types.js";
import { pretty } from '../util/pretty.js';
const IntOrBool = sumType(Int)(Bool);
const IntOrBool = sumType(() => Int)(() => Bool);
// console.log(int5);
console.log(pretty(unify(
makeGeneric(() => IntOrBool),
makeGeneric(a => sumType(Int)(a)),
makeGeneric(a => sumType(() => Int)(() => a)),
)));
const cipFunction = (x) => {
@ -38,7 +38,7 @@ const typeAtCallSite = assign(
makeGeneric((a, b) =>
fnType
(a)
(sumType(a)(b))
(sumType(() => a)(() => b))
),
makeGeneric(() => Int));
console.log(pretty(typeAtCallSite));