Contents
- State <S, A> (Func<S, (A Value, S State)> runState)
- Pure (A value)
- Modify (Func<S, S> f)
- Put (S value)
- Get
- Gets (Func<S, A> f)
- GetsM (Func<S, State<S, A>> f)
- Lift (Pure<A> monad)
- Lift (Func<A> f)
- Map <B> (Func<A, B> f)
- Select <B> (Func<A, B> f)
- Bind <B> (Func<A, K<State<S>, B>> f)
- Bind <B> (Func<A, State<S, B>> f)
- Bind <B> (Func<A, Gets<S, B>> f)
- Bind (Func<A, Put<S>> f)
- Bind (Func<A, Modify<S>> f)
- SelectMany <B, C> (Func<A, K<State<S>, B>> bind, Func<A, B, C> project)
- SelectMany <B, C> (Func<A, State<S, B>> bind, Func<A, B, C> project)
- SelectMany <B, C> (Func<A, Pure<B>> bind, Func<A, B, C> project)
- SelectMany <C> (Func<A, Put<S>> bind, Func<A, Unit, C> project)
- SelectMany <B, C> (Func<A, Gets<S, B>> bind, Func<A, B, C> project)
- SelectMany <C> (Func<A, Modify<S>> bind, Func<A, Unit, C> project)
- >> (State<S, A> lhs, State<S, A> rhs)
- >> (State<S, A> lhs, K<State<S>, A> rhs)
- >> (State<S, A> lhs, State<S, Unit> rhs)
- >> (State<S, A> lhs, K<State<S>, Unit> rhs)
- Run (S state)
- StateExtensions
- As <S, A> (this K<State<S>, A> ma)
- Run <S, A> (this K<State<S>, A> ma, S state)
- Flatten <S, A> (this State<S, State<S, A>> mma)
- Flatten <S, A> (this State<S, K<State<S>, A>> mma)
- StateExtensions
- Map <S, A, B> (this Func<A, B> f, K<State<S>, A> ma)
- Map <S, A, B> (this Func<A, B> f, State<S, A> ma)
- Action <S, A, B> (this State<S, A> ma, K<State<S>, B> mb)
- Action <S, A, B> (this K<State<S>, A> ma, K<State<S>, B> mb)
- Apply <S, A, B> (this State<S, Func<A, B>> mf, K<State<S>, A> ma)
- Apply <S, A, B> (this K<State<S>, Func<A, B>> mf, K<State<S>, A> ma)
- State <S>
- State
- pure <S, A> (A value)
- get <S> ()
- gets <S, A> (Func<S, A> f)
- getsM <S, A> (Func<S, State<S, A>> f)
- put <S> (S state)
- modify <S> (Func<S, S> f)
- State <S>
- Prelude
record State <S, A> (Func<S, (A Value, S State)> runState) Source #
State
monad transformer, which adds a modifiable state to a given monad.
Parameters
type | S | State type |
type | M | Given monad trait |
type | A | Bound value type |
Properties
Methods
method State<S, A> Pure (A value) Source #
Lift a pure value into the monad-transformer
Parameters
param | value | Value to lift |
returns |
|
method State<S, Unit> Modify (Func<S, S> f) Source #
Extracts the state value, maps it, and then puts it back into the monadic state.
Parameters
param | f | State mapping function |
returns |
|
method State<S, Unit> Put (S value) Source #
Writes the value into the monadic state
Parameters
returns |
|
method State<S, A> Gets (Func<S, A> f) Source #
Extracts the state value and maps it to the bound value
Parameters
param | f | State mapping function |
returns |
|
method State<S, A> GetsM (Func<S, State<S, A>> f) Source #
Extracts the state value and maps it to the bound value
Parameters
param | f | State mapping function |
returns |
|
method State<S, A> Lift (Pure<A> monad) Source #
Lifts a given monad into the transformer
Parameters
param | monad | Monad to lift |
returns |
|
method State<S, A> Lift (Func<A> f) Source #
Lifts a function into the transformer
Parameters
param | f | Function to lift |
returns |
|
method State<S, B> Map <B> (Func<A, B> f) Source #
Maps the bound value
Parameters
type | B | Target bound value type |
param | f | Mapping function |
returns |
|
method State<S, B> Select <B> (Func<A, B> f) Source #
Maps the bound value
Parameters
type | B | Target bound value type |
param | f | Mapping transducer |
returns |
|
method State<S, B> Bind <B> (Func<A, K<State<S>, B>> f) Source #
Monad bind operation
Parameters
type | B | Target bound value type |
param | f | Mapping function |
returns |
|
method State<S, B> Bind <B> (Func<A, State<S, B>> f) Source #
Monad bind operation
Parameters
type | B | Target bound value type |
param | f | Mapping function |
returns |
|
method State<S, B> Bind <B> (Func<A, Gets<S, B>> f) Source #
Monad bind operation
Parameters
type | B | Target bound value type |
param | f | Mapping function |
returns |
|
method State<S, Unit> Bind (Func<A, Put<S>> f) Source #
Monad bind operation
Parameters
type | B | Target bound value type |
param | f | Mapping function |
returns |
|
method State<S, Unit> Bind (Func<A, Modify<S>> f) Source #
Monad bind operation
Parameters
type | B | Target bound value type |
param | f | Mapping function |
returns |
|
method State<S, C> SelectMany <B, C> (Func<A, K<State<S>, B>> bind, Func<A, B, C> project) Source #
Monad bind operation
Parameters
type | B | Intermediate bound value type |
type | C | Target bound value type |
param | bind | Monadic bind function |
param | project | Projection function |
returns |
|
method State<S, C> SelectMany <B, C> (Func<A, State<S, B>> bind, Func<A, B, C> project) Source #
Monad bind operation
Parameters
type | B | Intermediate bound value type |
type | C | Target bound value type |
param | bind | Monadic bind function |
param | project | Projection function |
returns |
|
method State<S, C> SelectMany <B, C> (Func<A, Pure<B>> bind, Func<A, B, C> project) Source #
Monad bind operation
Parameters
type | B | Intermediate bound value type |
type | C | Target bound value type |
param | bind | Monadic bind function |
param | project | Projection function |
returns |
|
method State<S, C> SelectMany <C> (Func<A, Put<S>> bind, Func<A, Unit, C> project) Source #
Monad bind operation
Parameters
type | B | Intermediate bound value type |
type | C | Target bound value type |
param | bind | Monadic bind function |
param | project | Projection function |
returns |
|
method State<S, C> SelectMany <B, C> (Func<A, Gets<S, B>> bind, Func<A, B, C> project) Source #
Monad bind operation
Parameters
type | B | Intermediate bound value type |
type | C | Target bound value type |
param | bind | Monadic bind function |
param | project | Projection function |
returns |
|
method State<S, C> SelectMany <C> (Func<A, Modify<S>> bind, Func<A, Unit, C> project) Source #
Monad bind operation
Parameters
type | B | Intermediate bound value type |
type | C | Target bound value type |
param | bind | Monadic bind function |
param | project | Projection function |
returns |
|
Operators
class StateExtensions Source #
State monad extensions
class StateExtensions Source #
Methods
method State<S, B> Map <S, A, B> (this Func<A, B> f, K<State<S>, A> ma) Source #
Functor map operation
Unwraps the value within the functor, passes it to the map function f
provided, and
then takes the mapped value and wraps it back up into a new functor.
Parameters
param | ma | Functor to map |
param | f | Mapping function |
returns | Mapped functor |
method State<S, B> Map <S, A, B> (this Func<A, B> f, State<S, A> ma) Source #
Functor map operation
Unwraps the value within the functor, passes it to the map function f
provided, and
then takes the mapped value and wraps it back up into a new functor.
Parameters
param | ma | Functor to map |
param | f | Mapping function |
returns | Mapped functor |
method State<S, B> Action <S, A, B> (this State<S, A> ma, K<State<S>, B> mb) Source #
Applicative action: runs the first applicative, ignores the result, and returns the second applicative
method State<S, B> Action <S, A, B> (this K<State<S>, A> ma, K<State<S>, B> mb) Source #
Applicative action: runs the first applicative, ignores the result, and returns the second applicative
method State<S, B> Apply <S, A, B> (this State<S, Func<A, B>> mf, K<State<S>, A> ma) Source #
Applicative functor apply operation
Unwraps the value within the ma
applicative-functor, passes it to the unwrapped function(s) within mf
, and
then takes the resulting value and wraps it back up into a new applicative-functor.
Parameters
param | ma | Value(s) applicative functor |
param | mf | Mapping function(s) |
returns | Mapped applicative functor |
method State<S, B> Apply <S, A, B> (this K<State<S>, Func<A, B>> mf, K<State<S>, A> ma) Source #
Applicative functor apply operation
Unwraps the value within the ma
applicative-functor, passes it to the unwrapped function(s) within mf
, and
then takes the resulting value and wraps it back up into a new applicative-functor.
Parameters
param | ma | Value(s) applicative functor |
param | mf | Mapping function(s) |
returns | Mapped applicative functor |
Methods
Methods
method State<S, B> map <S, A, B> (Func<A, B> f, K<State<S>, A> ma) Source #
Functor map operation
Unwraps the value within the functor, passes it to the map function f
provided, and
then takes the mapped value and wraps it back up into a new functor.
Parameters
param | ma | Functor to map |
param | f | Mapping function |
returns | Mapped functor |
method State<S, B> action <S, A, B> (K<State<S>, A> ma, K<State<S>, B> mb) Source #
Applicative action: runs the first applicative, ignores the result, and returns the second applicative
method State<S, B> apply <S, A, B> (K<State<S>, Func<A, B>> mf, K<State<S>, A> ma) Source #
Applicative functor apply operation
Unwraps the value within the ma
applicative-functor, passes it to the unwrapped function(s) within mf
, and
then takes the resulting value and wraps it back up into a new applicative-functor.
Parameters
param | ma | Value(s) applicative functor |
param | mf | Mapping function(s) |
returns | Mapped applicative functor |