fix
This commit is contained in:
parent
1f2249e75a
commit
63b1aa6238
2 changed files with 4 additions and 4 deletions
|
|
@ -5,7 +5,7 @@ import { symbolDictIterator } from "../structures/dict.types.js";
|
|||
import { symbolSetIterator } from "../structures/set.types.js";
|
||||
import { symbolDict, symbolFunction, symbolList, symbolProduct, symbolSet, symbolSum } from "../structures/type_constructors.js";
|
||||
import { prettyT } from "../util/pretty.js";
|
||||
import { compareBools, compareDoubles, compareOrderings, compareStrings, compareSymbols, compareUnits } from "./primitives.js";
|
||||
import { compareBools, compareDoubles, compareInts, compareOrderings, compareStrings, compareSymbols, compareUnits } from "./primitives.js";
|
||||
import { compareDictIterators, compareDicts, compareFunctions, compareLists, compareProducts, compareSetIterators, compareSets, compareSums } from "./structures.js";
|
||||
import { compareTypes } from "./type.js";
|
||||
|
||||
|
|
@ -16,7 +16,7 @@ export const compareDynamic = x => y =>
|
|||
const cannotCompareTypeVarInstances = _ => _ => { throw new Error("Cannot compare instance of type variables"); }
|
||||
|
||||
const typeSymbolToCmp = new Map([
|
||||
[SymbolInt , compareDoubles ],
|
||||
[SymbolInt , compareInts ],
|
||||
[SymbolBool , compareBools ],
|
||||
[SymbolDouble , compareDoubles ],
|
||||
[SymbolByte , compareDoubles ],
|
||||
|
|
|
|||
|
|
@ -2,14 +2,14 @@
|
|||
|
||||
export const compareInts = x => y => {
|
||||
if (typeof(x) !== 'bigint' || typeof(y) !== 'bigint') {
|
||||
throw new Error(`was only meant to compare bigints! got ${x} and ${y}`);
|
||||
throw new Error(`was only meant to compare bigints! got ${x} (${typeof(x)}) and ${y} (${typeof(y)})`);
|
||||
}
|
||||
return (x < y) ? -1 : (x > y) ? 1 : 0;
|
||||
};
|
||||
|
||||
export const compareDoubles = x => y => {
|
||||
if (typeof(x) !== 'number' || typeof(y) !== 'number') {
|
||||
throw new Error(`was only meant to compare numbers! got ${x} and ${y}`);
|
||||
throw new Error(`was only meant to compare numbers! got ${x} (${typeof(x)}) and ${y} (${typeof(y)})`);
|
||||
}
|
||||
return (x < y) ? -1 : (x > y) ? 1 : 0;
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue