parser for types + start moving all types to separate modules

This commit is contained in:
Joeri Exelmans 2025-05-06 23:41:12 +02:00
parent 8eec5b9239
commit 1d826ea8d4
11 changed files with 277 additions and 88 deletions

View file

@ -1,5 +1,5 @@
import { inspect } from 'node:util';
import { symbolFunction, symbolList, symbolProduct, symbolSet, symbolSum } from '../structures/types.js';
import { symbolDict, symbolFunction, symbolList, symbolProduct, symbolSet, symbolSum } from '../structures/types.js';
import { mapRecursiveStructure } from './util.js';
export function pretty(obj) {
@ -35,6 +35,7 @@ const renderType = (symbol, annot, params) => {
[symbolFunction]: `${annot}(${params[0]} -> ${params[1]})`,
[symbolSum] : `${annot}(${params[0]} + ${params[1]})`,
[symbolProduct] : `${annot}(${params[0]} ${params[1]})`,
[symbolDict] : `${annot}(${params[0]} => ${params[1]})`,
}[symbol] || symbol.description;
};