22 lines
704 B
JavaScript
22 lines
704 B
JavaScript
import { typedFnType } from "./structures/types.js";
|
|
import { Type } from "./primitives/types.js";
|
|
import { makeTypeConstructor } from "./type_constructor.js";
|
|
|
|
// Everything is (implicitly) typed by the Any type.
|
|
const symbolAny = Symbol('Any');
|
|
export const Any = makeTypeConstructor(symbolAny)(0);
|
|
|
|
// A type-link, connecting a value to its Type.
|
|
const symbolTyped = Symbol('Typed');
|
|
export const Typed = makeTypeConstructor(symbolTyped)(0);
|
|
|
|
const getInst = lnk => lnk.i;
|
|
const getType = lnk => lnk.t;
|
|
|
|
export const ModuleTyped = {l:[
|
|
{i: Typed, t: Type},
|
|
{i: Any , t: Type},
|
|
|
|
...typedFnType(getInst, fnType => fnType(Typed)(Any)),
|
|
...typedFnType(getType, fnType => fnType(Typed)(Any)),
|
|
]};
|