add export
This commit is contained in:
parent
4fcfea409a
commit
8cfbd6116f
2 changed files with 11 additions and 3 deletions
|
|
@ -93,16 +93,22 @@ export const assignFn = (funType, paramType, skip=0) => {
|
|||
|
||||
// Ensures that no type variables overlap
|
||||
export const recomputeTypeVars = (types, skip=0) => {
|
||||
return recomputeTypeVarsWithInverse(types, skip)[0];
|
||||
};
|
||||
|
||||
export const recomputeTypeVarsWithInverse = (types, skip=0) => {
|
||||
let nextIdx = skip;
|
||||
return types.map(type => {
|
||||
const inverse = new Map();
|
||||
return [types.map(type => {
|
||||
const substitutions = new Map();
|
||||
const typeVars = occurring(type);
|
||||
for (const typeVar of typeVars) {
|
||||
const idx = nextIdx++;
|
||||
if (typeVar !== UNBOUND_SYMBOLS[idx]) {
|
||||
substitutions.set(typeVar, TYPE_VARS[idx]);
|
||||
inverse.set(UNBOUND_SYMBOLS[idx], typeVar);
|
||||
}
|
||||
}
|
||||
return substitute(type, substitutions);
|
||||
});
|
||||
};
|
||||
}), inverse];
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue