50 lines
1.8 KiB
JavaScript
50 lines
1.8 KiB
JavaScript
// to break up dependency cycles, primitive types are defined in their own JS module
|
|
|
|
import { makeTypeConstructor } from "../type_constructor.js";
|
|
|
|
export const SymbolInt = Symbol('Int');
|
|
export const SymbolBool = Symbol('Bool');
|
|
export const SymbolDouble = Symbol('Double');
|
|
export const SymbolByte = Symbol('Byte');
|
|
export const SymbolChar = Symbol('Char');
|
|
export const SymbolUnit = Symbol('Unit');
|
|
export const SymbolBottom = Symbol('⊥');
|
|
export const SymbolSymbol = Symbol('Symbol');
|
|
export const SymbolType = Symbol('Type');
|
|
export const symbolAny = Symbol('Any');
|
|
export 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);
|
|
|
|
// Bottom type has no instances.
|
|
export const Bottom = makeTypeConstructor(SymbolBottom)(0);
|
|
|
|
export const SymbolT = makeTypeConstructor(SymbolSymbol)(0);
|
|
|
|
// Types are typed by Any
|
|
export const Type = makeTypeConstructor(SymbolType)(0);
|
|
|
|
export const GenericType = makeTypeConstructor(SymbolGenericType)(0);
|
|
|
|
// Everything is typed by Any
|
|
export const Any = makeTypeConstructor(symbolAny)(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: SymbolBottom, t: SymbolT},
|
|
{i: SymbolSymbol, t: SymbolT},
|
|
{i: SymbolType , t: SymbolT},
|
|
{i: SymbolGenericType, t: SymbolT},
|
|
]};
|