Either
Extends:
Indirect Implements:
Class Either - represents computation with two possibilities.
Constructor Summary
Public Constructor | ||
public |
constructor(r: function(v: any), l: function(v: any)) Creates an instance of class Either. |
Method Summary
Public Methods | ||
public |
bind(f: D<T>, v: any): boolean | Pr<any> | Error Binds controller function and underlying value to the monad. |
|
public |
left(v: T): Pr Extract result of left(v) computation. |
|
public |
right(v: T): Pr Extract result of right(v) computation. |
Inherited Summary
From class Monad | ||
public abstract |
bind(f: MF<T, U>|D<T>, v: *): Promise<U> | Pr<U> | Error | boolean | void Binds transformation function and underlying value to the monad. |
|
protected |
Takes Error or string return Error. |
|
protected |
Produces result after execution f(v). |
Public Constructors
Public Methods
public bind(f: D<T>, v: any): boolean | Pr<any> | Error source
Binds controller function and underlying value to the monad.
Override:
Monad#bindParams:
Name | Type | Attribute | Description |
f | D<T> | controller function, after execution f(v) produce true (execute right func-n) or false (execute left func-n). |
|
v | any | underlying value for the monad. |
Return:
boolean | Pr<any> | Error |
public left(v: T): Pr source
Extract result of left(v) computation.
Params:
Name | Type | Attribute | Description |
v | T | underlying value. |
Return:
Pr |
public right(v: T): Pr source
Extract result of right(v) computation.
Params:
Name | Type | Attribute | Description |
v | T | underlying value. |
Return:
Pr |