Table of contents
- URI (type alias)
- State (class)
- URI (constant)
- state (constant)
- get (function)
- gets (function)
- modify (function)
- put (function)
URI (type alias)
Signature
export type URI = typeof URI
State (class)
Signature
export class State<S, A> {
constructor(readonly run: (s: S) => [A, S]) { ... }
...
}
Added in v1.0.0
eval (method)
Signature
eval(s: S): A { ... }
exec (method)
Signature
exec(s: S): S { ... }
map (method)
Signature
map<B>(f: (a: A) => B): State<S, B> { ... }
ap (method)
Signature
ap<B>(fab: State<S, (a: A) => B>): State<S, B> { ... }
ap_ (method)
Flipped version of ap
Signature
ap_<B, C>(this: State<S, (b: B) => C>, fb: State<S, B>): State<S, C> { ... }
applyFirst (method)
Combine two effectful actions, keeping only the result of the first
Signature
applyFirst<B>(fb: State<S, B>): State<S, A> { ... }
Added in v1.7.0
applySecond (method)
Combine two effectful actions, keeping only the result of the second
Signature
applySecond<B>(fb: State<S, B>): State<S, B> { ... }
Added in v1.7.0
chain (method)
Signature
chain<B>(f: (a: A) => State<S, B>): State<S, B> { ... }
URI (constant)
Signature
export const URI = ...
state (constant)
Signature
export const state: Monad2<URI> = ...
Added in v1.0.0
get (function)
Get the current state
Signature
export const get = <S>(): State<S, S> => ...
Added in v1.0.0
gets (function)
Get a value which depends on the current state
Signature
export const gets = <S, A>(f: (s: S) => A): State<S, A> => ...
Added in v1.0.0
modify (function)
Modify the state by applying a function to the current state
Signature
export const modify = <S>(f: (s: S) => S): State<S, undefined> => ...
Added in v1.0.0
put (function)
Set the state
Signature
export const put = <S>(s: S): State<S, void> => ...
Added in v1.0.0