fix some things

This commit is contained in:
Joeri Exelmans 2025-05-08 21:30:56 +02:00
parent d9111c3969
commit bbac7858ae
16 changed files with 69 additions and 55 deletions

View file

@ -8,6 +8,11 @@ import { TYPE_VARS } from "../primitives/typevars.js";
import { dictType, fnType, lsType, prodType, sumType } from "../structures/type_constructors.js";
import { setType } from "../structures/type_constructors.js";
// A very stupid little parser, that can only parse:
// - primitives => simply maps onto types.
// - things between brackets => calls a type constructor that takes one parameter on whatever is between the brackets.
// - binary (infix) operators => calls a type constructor that takes two parameters on the LHS and RHS.
export const makeTypeParser = ({
// parser can be extended:
extraPrimitives=[],
@ -49,13 +54,6 @@ export const makeTypeParser = ({
['⇒', dictType],
['=>', dictType],
// only used for type variables (e.g., ∀a,b,c:)
[',', fnX => fnY => {
const x = fnX();
const y = fnY();
return Array.isArray(x) ? x.concat(y) : [x].concat(y)
}],
...extraInfixOperators,
]);