use newDynamic() everywhere instead of { i: ... , t: ... }

This commit is contained in:
Joeri Exelmans 2025-05-08 23:56:58 +02:00
parent 34d06aa82a
commit e1a2139cb4
22 changed files with 141 additions and 124 deletions

View file

@ -4,6 +4,6 @@ import { compareDynamic, makeCompareFn } from "./dynamic.js";
const mkType = getDefaultTypeParser();
export const ModuleCompareDynamic = [
{i: makeCompareFn , t: mkType("Type -> a -> a -> Int")},
{i: compareDynamic, t: mkType("Dynamic -> Dynamic -> Int")},
newDynamic(makeCompareFn )(mkType("Type -> a -> a -> Int")),
newDynamic(compareDynamic)(mkType("Dynamic -> Dynamic -> Int")),
];

View file

@ -1,11 +1,12 @@
import { getDefaultTypeParser } from "../parser/type_parser.js";
import { newDynamic } from "../primitives/dynamic.js";
import { compareBools, compareNumbers, compareSymbols, compareUnits } from "./primitives.js";
const mkType = getDefaultTypeParser();
export const ModuleComparePrimitives = [
{i: compareNumbers, t: mkType("Double -> Double -> Int")},
{i: compareBools , t: mkType("Bool -> Bool -> Int")},
{i: compareUnits , t: mkType("Unit -> Unit -> Int")},
{i: compareSymbols, t: mkType("UUID -> UUID -> Int")},
newDynamic(compareNumbers)(mkType("Double -> Double -> Int")),
newDynamic(compareBools )(mkType("Bool -> Bool -> Int")),
newDynamic(compareUnits )(mkType("Unit -> Unit -> Int")),
newDynamic(compareSymbols)(mkType("UUID -> UUID -> Int")),
];

View file

@ -1,16 +1,17 @@
import { getDefaultTypeParser } from "../parser/type_parser.js";
import { newDynamic } from "../primitives/dynamic.js";
import { compareDicts, compareLists, compareProducts, compareSets, compareSums } from "./structures.js";
const mkType = getDefaultTypeParser();
export const ModuleCompareStructures = [
{i: compareLists, t: mkType("(a -> a -> Int) -> [a] -> [a] -> Int")},
newDynamic(compareLists)(mkType("(a -> a -> Int) -> [a] -> [a] -> Int")),
{i: compareProducts, t: mkType("(a -> a -> Int) -> (b -> b -> Int) -> (a*b) -> (a*b) -> Int")},
newDynamic(compareProducts)(mkType("(a -> a -> Int) -> (b -> b -> Int) -> (a*b) -> (a*b) -> Int")),
{i: compareSums, t: mkType("(a -> a -> Int) -> (b -> b -> Int) -> (a+b) -> (a+b) -> Int")},
newDynamic(compareSums)(mkType("(a -> a -> Int) -> (b -> b -> Int) -> (a+b) -> (a+b) -> Int")),
{i: compareSets, t: mkType("(a -> a -> Int) -> {a} -> {a} -> Int")},
newDynamic(compareSets)(mkType("(a -> a -> Int) -> {a} -> {a} -> Int")),
{i: compareDicts, t: mkType("(a -> a -> Int) -> (b -> b-> Int) -> (a => b) -> (a => b) -> Int")}
newDynamic(compareDicts)(mkType("(a -> a -> Int) -> (b -> b-> Int) -> (a => b) -> (a => b) -> Int"))
];

View file

@ -1,8 +1,9 @@
import { getDefaultTypeParser } from "../parser/type_parser.js";
import { newDynamic } from "../primitives/dynamic.js";
import { compareTypes } from "./type.js";
const mkType = getDefaultTypeParser();
export const ModuleCompareTypes = [
{i: compareTypes, t: mkType("Type -> Type -> Int")},
newDynamic(compareTypes)(mkType("Type -> Type -> Int")),
];