big part of the code base still needs to be 'ported' to the updated type constructors.
51 lines
1.9 KiB
JavaScript
51 lines
1.9 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 symbolTop = Symbol('⊤');
|
||
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 Top
|
||
export const Type = makeTypeConstructor(SymbolType)(0);
|
||
|
||
export const GenericType = makeTypeConstructor(SymbolGenericType)(0);
|
||
|
||
// Everything is typed by Top
|
||
export const Top = makeTypeConstructor(symbolTop)(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},
|
||
{i: symbolTop , t: SymbolT},
|
||
]};
|