add enum type (generalization of sum-type)
This commit is contained in:
parent
8653bb99c6
commit
0b262daf7f
6 changed files with 102 additions and 7 deletions
|
|
@ -8,9 +8,10 @@ const SymbolDouble = Symbol('Double');
|
|||
const SymbolByte = Symbol('Byte');
|
||||
const SymbolChar = Symbol('Char');
|
||||
const SymbolUnit = Symbol('Unit');
|
||||
const SymbolBottom = Symbol('⊥');
|
||||
const SymbolSymbol = Symbol('Symbol');
|
||||
const SymbolType = Symbol('Type');
|
||||
const symbolAny = Symbol('Any');
|
||||
const symbolAny = Symbol('Any');
|
||||
const SymbolGenericType = Symbol('GenericType');
|
||||
|
||||
export const Int = makeTypeConstructor(SymbolInt)(0);
|
||||
|
|
@ -22,6 +23,9 @@ 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
|
||||
|
|
@ -39,6 +43,7 @@ export const ModuleSymbols = {l:[
|
|||
{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},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue