dope2/lib/symbol.js

21 lines
724 B
JavaScript

import { 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";
// The way instances of SymbolT are currently encoded, their constructor is not a valid DOPE function, because it is impure.
// The only way to construct symbols is to do it in JS code.
// At some point, we should start encoding SymbolTs as UUIDs rather than JS-Symbols.
export const ModuleSymbol = {l:[
{i: SymbolT, t: Type},
...typedFnType(getName, fnType =>
fnType
(SymbolT)
(String)
),
...typedFnType(eqSymbol, fnType => fnType(SymbolT)(fnType(SymbolT)(Bool))),
]};