dope2/primitives/dynamic.js
Joeri Exelmans 8eec5b9239 recursive types (and operations on them, like pretty-printing, comparison and unification) seem to be working.
big part of the code base still needs to be 'ported' to the updated type constructors.
2025-05-05 17:17:45 +02:00

19 lines
623 B
JavaScript

import { typedFnType } from "../structures/types.js";
import { Top, 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: Top , t: Type},
...typedFnType(getInst, fnType => fnType(() => Dynamic)(() => Top)),
...typedFnType(getType, fnType => fnType(() => Dynamic)(() => Top)),
]};