progress and some refactoring
This commit is contained in:
parent
d236eca5e5
commit
d8ca2f3999
25 changed files with 376 additions and 163 deletions
|
|
@ -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]);
|
||||
|
|
|
|||
|
|
@ -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));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue