41 lines
1.4 KiB
JavaScript
41 lines
1.4 KiB
JavaScript
// to break up dependency cycles, primitive types are defined in their own JS module
|
|
|
|
import { makeTypeConstructor } from "../type_constructor.js";
|
|
|
|
const SymbolInt = Symbol('Int');
|
|
const SymbolBool = Symbol('Bool');
|
|
const SymbolDouble = Symbol('Double');
|
|
const SymbolByte = Symbol('Byte');
|
|
const SymbolChar = Symbol('Char');
|
|
const SymbolUnit = Symbol('Unit');
|
|
const SymbolSymbol = Symbol('Symbol');
|
|
const SymbolType = Symbol('Type');
|
|
const SymbolGenericType = Symbol('GenericType');
|
|
|
|
export const Int = makeTypeConstructor(SymbolInt)(0);
|
|
export const Bool = makeTypeConstructor(SymbolBool)(0);
|
|
export const Double = makeTypeConstructor(SymbolDouble)(0);
|
|
export const Byte = makeTypeConstructor(SymbolByte)(0);
|
|
export const Char = makeTypeConstructor(SymbolChar)(0);
|
|
|
|
// Unit type has only 1 instance, the empty tuple.
|
|
export const Unit = makeTypeConstructor(SymbolUnit)(0);
|
|
|
|
export const SymbolT = makeTypeConstructor(SymbolSymbol)(0);
|
|
|
|
export const Type = makeTypeConstructor(SymbolType)(0);
|
|
|
|
export const GenericType = makeTypeConstructor(SymbolGenericType)(0);
|
|
|
|
|
|
export const ModuleSymbols = {l:[
|
|
{i: SymbolInt , t: SymbolT},
|
|
{i: SymbolBool , t: SymbolT},
|
|
{i: SymbolDouble, t: SymbolT},
|
|
{i: SymbolByte , t: SymbolT},
|
|
{i: SymbolChar , t: SymbolT},
|
|
{i: SymbolUnit , t: SymbolT},
|
|
{i: SymbolSymbol, t: SymbolT},
|
|
{i: SymbolType , t: SymbolT},
|
|
{i: SymbolGenericType, t: SymbolT},
|
|
]};
|