rename some things

This commit is contained in:
Joeri Exelmans 2025-04-20 21:09:51 +02:00
parent e04cac4f7d
commit 8a4bd44f04
16 changed files with 92 additions and 60 deletions

19
primitives/dynamic.js Normal file
View file

@ -0,0 +1,19 @@
import { typedFnType } from "../structures/types.js";
import { Any, Type } from "./types.js";
import { makeTypeConstructor } from "../type_constructor.js";
// A type-link, connecting a value to its Type.
export const symbolDynamic = Symbol('Dynamic');
export const Dynamic = makeTypeConstructor(symbolDynamic)(0);
export const getInst = lnk => lnk.i;
export const getType = lnk => lnk.t;
export const ModuleDynamic = {l:[
{i: Dynamic, t: Type},
{i: Any , t: Type},
...typedFnType(getInst, fnType => fnType(Dynamic)(Any)),
...typedFnType(getType, fnType => fnType(Dynamic)(Any)),
]};

View file

@ -1,4 +1,4 @@
import { constructorLeft, constructorRight } from "../structures/sum.js";
import { newLeft, newRight } from "../structures/sum.js";
import { setType, sumType, typedFnType } from "../structures/types.js";
import { Any, GenericType, SymbolT, Type, Unit } from "./types.js";
import { unit } from "./unit.js";
@ -7,8 +7,8 @@ export const getType = genericType => genericType.type;
export const getTypeVars = genericType => genericType.typeVars;
export const toNonGeneric = genericType => (genericType.typeVars.size === 0)
? constructorRight(genericType.type)
: constructorLeft(unit);
? newRight(genericType.type)
: newLeft(unit);
export const ModuleGenericType = {l:[
{i: GenericType, t: Any},