restructure code a bit, add comparison functions for primitive types and composed types (needed to put values in sets)

This commit is contained in:
Joeri Exelmans 2025-04-17 15:11:06 +02:00
parent 3978f7f835
commit 8653bb99c6
12 changed files with 175 additions and 64 deletions

View file

@ -7,7 +7,10 @@ function capitalizeFirstLetter(val) {
return String(val).charAt(0).toUpperCase() + String(val).slice(1);
}
// [{l: "x", r: Double}, {l: "y", r: Double}] => (Double × (Double × Unit))
// 'fields' is an array of (name: string, type: Type) pairs.
// e.g.:
// [{l: "x", r: Double}, {l: "y", r: Double}]
// results in the type (Double × (Double × Unit))
export const structType = fields => {
if (fields.length === 0) {
return Unit;