progress and some refactoring

This commit is contained in:
Joeri Exelmans 2025-03-31 15:35:02 +02:00
parent d236eca5e5
commit d8ca2f3999
25 changed files with 376 additions and 163 deletions

22
lib/symbol.js Normal file
View file

@ -0,0 +1,22 @@
import { constructSymbol, eqSymbol, getName } from "../primitives/symbol.js";
import { Bool, SymbolT, Type } from "../primitives/types.js";
import { String } from "../structures/list.js";
import { typedFnType } from "../structures/types.js";
export const ModuleSymbol = {l:[
{i: SymbolT, t: Type},
...typedFnType(constructSymbol, fnType =>
fnType
(String)
(SymbolT)
),
...typedFnType(getName, fnType =>
fnType
(SymbolT)
(String)
),
...typedFnType(eqSymbol, fnType => fnType(SymbolT, fnType(SymbolT, Bool))),
]};

14
lib/type_constructor.js Normal file
View file

@ -0,0 +1,14 @@
import { Int, SymbolT, Type } from "../primitives/types.js";
import { typedFnType } from "../structures/types.js";
import { makeTypeConstructor } from "../type_constructor.js";
// This function and its type signature cannot be in the same file as 'makeTypeConstructor' because then we get an import cycle among JS modules.
export const ModuleTypeConstructor = {l:[
...typedFnType(makeTypeConstructor, fnType =>
fnType
(SymbolT)
(fnType
(Int)
(Type)
)),
]};