progress and some refactoring

This commit is contained in:
Joeri Exelmans 2025-03-31 15:35:02 +02:00
parent d236eca5e5
commit d8ca2f3999
25 changed files with 376 additions and 163 deletions

View file

@ -1,5 +1,6 @@
import { eqType } from "../type.js";
import { pretty, zip } from "../util.js";
import { zip } from "../util/util.js";
import { pretty } from '../util/pretty.js';
// constructor for generic types
// for instance, the type:
@ -22,6 +23,8 @@ export const makeGeneric = callback => {
// From the given set of type variables, return only those that occur in the given type.
export const occurring = (type, typeVars) => {
console.log("occurring", type, typeVars);
if (typeVars.has(type)) {
// type IS a type variable:
return new Set([type]);

View file

@ -1,7 +1,7 @@
import { Bool, Int } from "../primitives/types.js";
import { fnType, lsType } from "../structures/types.js";
import { assign, makeGeneric, unify } from "./generics.js";
import { pretty } from "../util.js";
import { pretty } from "../util/pretty.js";
// a -> Int
const a_to_Int = makeGeneric(a => fnType(a)(Int));