dope2/typed.js
2025-03-23 09:15:37 +01:00

22 lines
591 B
JavaScript

import { fnType } from "./structures/function.js";
import { Type } from "./metacircular.js";
// Everything is (implicitly) typed by the Any type.
export const Any = { symbol: Symbol('Any'), params: [] };
// A type-link, connecting a value to its Type.
export const Typed = { symbol: Symbol('Typed'), params: [] };
const getInst = lnk => lnk.i;
const getType = lnk => lnk.t;
const Typed_to_Type = fnType({in: Any, out: Type});
export const ModuleTyped = {l:[
{i: Typed, t: Type},
{i: Typed_to_Type, t: Type},
{i: getInst, t: Typed_to_Type},
{i: getType, t: Typed_to_Type},
]};