State
Extends:
Indirect Implements:
Class State - it takes a state and returns an intermediate value and some new state value.
Constructor Summary
Public Constructor | ||
public |
constructor(state: Object) Creates an instance of the class State with an initialization or not, the initialization can be occur late with bind method. |
Member Summary
Public Members | ||
public |
The instance of ErrorM. |
|
public |
The instance of Maybe. |
|
public |
state: any Keeps the state of application variables. |
Method Summary
Public Methods | ||
public |
It takes an initial state of the monad if monad has initialized in the constructor then function assigns Error to underlying value. |
|
public |
get(): Pr<T> | Error Extracts the state of app. |
|
public |
Changes the state of application variables, if you try add new key with put() to state object it'll be assigned with Error instance. |
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 Members
Public Methods
public bind(f: Function, v: *) source
It takes an initial state of the monad if monad has initialized in the constructor then function assigns Error to underlying value.
Override:
Monad#bindParams:
Name | Type | Attribute | Description |
f | Function | ||
v | * |
|
underlying value for the monad, it can be null. |