taxon
is a concise type system for annotating and documenting Javascript APIs.
any ('a' | 5 | [])
int (123)
real (3.0234)
bool (true)
string ('hello')
none (undefined)
void (undefined)
null (null)
nan (NaN)
Array<Type>: [...values: Type]
Shallow<Type>: { ...properties: Type }
Monad<Type>: (arg: Type) => Type
Maybe<Type>: Type | none
Tuple<A, B, ..., Z>: [A, B, ..., Z]
Of<A, B, ..., Z>: A | B | ... | Z
Integer: int
'x' :: string // true
5.6 :: int // false
undefined :: Maybe<bool> // true
true :: Maybe<bool> // true
3 :: Maybe<bool> // false
[Class.myMethod]: Function
[Class.instance]: Data
[Class
[myMethod]: Function
[instance]: Data
]
Adder: (augend: int, addend: int) => int
Alert: (message: string, [type: string]) => void
Alert: (message: string, type = 'default': string) => void
Human: { height: int, weight: int }
FunctionMap: { ...functions: Function }
Accumulator<Type, Modifier>: (acc: Type, mod: Modifier) => Type
Computable: int | real
Leaf: int
Branch: { value: int, ...leaves: Maybe<Node> }
Node: Branch | Leaf
Human: { height, weight: int }
Human: { (height, weight): int }
Leaf<Value>: Value
Branch<Value>: { value: Value, (left, right): Maybe<Leaf<Value>> }
Node: Branch | Leaf
Heap: Node<int>
Thunk<Value>: Monad<Value> | Value
Algebraics cannot be used directly as applications.
Animal: { weight: int }
Dog: { #Animal, color: string }
[View]: (element: HTMLElement) => View
[Model]: (model: Shallow<Function>) => Model
[ViewModel]: (#View, #Model) => Construct