Contents
- StateT <S, M, A> (Func<S, K<M, (A Value, S State)>> runState)
- Pure (A value)
- Modify (Func<S, S> f)
- ModifyM (Func<S, K<M, S>> f)
- Put (S value)
- State (A value, S state)
- State ((A value, S state) ma)
- Get
- Gets (Func<S, A> f)
- GetsM (Func<S, K<M, A>> f)
- Lift (Pure<A> monad)
- Lift (K<M, A> monad)
- Lift (Func<A> f)
- LiftIO (IO<A> ma)
- MapT <M1, B> (Func<K<M, (A Value, S State)>, K<M1, (B Value, S State)>> f)
- MapM <B> (Func<K<M, A>, K<M, B>> f)
- Map <B> (Func<A, B> f)
- Select <B> (Func<A, B> f)
- Bind <B> (Func<A, K<StateT<S, M>, B>> f)
- Bind <B> (Func<A, StateT<S, M, B>> f)
- Bind <B> (Func<A, Gets<S, B>> f)
- Bind (Func<A, Put<S>> f)
- Bind (Func<A, Modify<S>> f)
- Bind <B> (Func<A, IO<B>> f)
- Bind <B> (Func<A, K<IO, B>> f)
- SelectMany <B, C> (Func<A, K<StateT<S, M>, B>> bind, Func<A, B, C> project)
- SelectMany <B, C> (Func<A, StateT<S, M, B>> bind, Func<A, B, C> project)
- SelectMany <B, C> (Func<A, K<M, 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)
- SelectMany <B, C> (Func<A, IO<B>> bind, Func<A, B, C> project)
- SelectMany <B, C> (Func<A, K<IO, B>> bind, Func<A, B, C> project)
- >> (StateT<S, M, A> lhs, StateT<S, M, A> rhs)
- >> (StateT<S, M, A> lhs, K<StateT<S, M>, A> rhs)
- >> (StateT<S, M, A> lhs, StateT<S, M, Unit> rhs)
- >> (StateT<S, M, A> lhs, K<StateT<S, M>, Unit> rhs)
- Run (S state)
- StateT <S>
- StateT <S, M>
- StateT
Sub modules
| Extensions |
| Operators |
| Trait |
record StateT <S, M, A> (Func<S, K<M, (A Value, S State)>> runState) Source #
StateT 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 |
| param | runState | Function that represents the transformer operation |
Properties
Methods
method StateT<S, M, A> Pure (A value) Source #
Lift a pure value into the monad-transformer
Parameters
| param | value | Value to lift |
| returns |
| |
method StateT<S, M, 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 StateT<S, M, Unit> ModifyM (Func<S, K<M, 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 StateT<S, M, Unit> Put (S value) Source #
Writes the value into the monadic state
Parameters
| returns |
| |
method StateT<S, M, A> State (A value, S state) Source #
Writes a value and state into the monad
Parameters
| returns |
| |
method StateT<S, M, A> State ((A value, S state) ma) Source #
Writes a value and state into the monad
Parameters
| returns |
| |
method StateT<S, M, 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 StateT<S, M, A> GetsM (Func<S, K<M, A>> f) Source #
Extracts the state value and maps it to the bound value
Parameters
| param | f | State mapping function |
| returns |
| |
method StateT<S, M, A> Lift (Pure<A> monad) Source #
Lifts a given monad into the transformer
Parameters
| param | monad | Monad to lift |
| returns |
| |
method StateT<S, M, A> Lift (K<M, A> monad) Source #
Lifts a given monad into the transformer
Parameters
| param | monad | Monad to lift |
| returns |
| |
method StateT<S, M, A> Lift (Func<A> f) Source #
Lifts a function into the transformer
Parameters
| param | f | Function to lift |
| returns |
| |
method StateT<S, M, A> LiftIO (IO<A> ma) Source #
Lifts an IO monad into the monad
NOTE: If the IO monad isn't the innermost monad of the transformer stack then this will throw an exception.
Parameters
| param | ma | IO monad to lift |
| returns |
| |
method StateT<S, M1, B> MapT <M1, B> (Func<K<M, (A Value, S State)>, K<M1, (B Value, S State)>> f) Source #
Maps the given monad
Parameters
| type | M1 | Trait of the monad to map to |
| param | f | Mapping function |
| returns |
| |
method StateT<S, M, B> MapM <B> (Func<K<M, A>, K<M, B>> f) Source #
Maps the given monad
Parameters
| param | f | Mapping function |
| returns |
| |
method StateT<S, M, 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 StateT<S, M, 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 StateT<S, M, B> Bind <B> (Func<A, K<StateT<S, M>, B>> f) Source #
Monad bind operation
Parameters
| type | B | Target bound value type |
| param | f | Mapping function |
| returns |
| |
method StateT<S, M, B> Bind <B> (Func<A, StateT<S, M, B>> f) Source #
Monad bind operation
Parameters
| type | B | Target bound value type |
| param | f | Mapping function |
| returns |
| |
method StateT<S, M, 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 StateT<S, M, Unit> Bind (Func<A, Put<S>> f) Source #
Monad bind operation
Parameters
| type | B | Target bound value type |
| param | f | Mapping function |
| returns |
| |
method StateT<S, M, Unit> Bind (Func<A, Modify<S>> f) Source #
Monad bind operation
Parameters
| type | B | Target bound value type |
| param | f | Mapping function |
| returns |
| |
method StateT<S, M, B> Bind <B> (Func<A, IO<B>> f) Source #
Monad bind operation
Parameters
| type | B | Target bound value type |
| param | f | Mapping function |
| returns |
| |
method StateT<S, M, B> Bind <B> (Func<A, K<IO, B>> f) Source #
Monad bind operation
Parameters
| type | B | Target bound value type |
| param | f | Mapping function |
| returns |
| |
method StateT<S, M, C> SelectMany <B, C> (Func<A, K<StateT<S, M>, 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 StateT<S, M, C> SelectMany <B, C> (Func<A, StateT<S, M, 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 StateT<S, M, C> SelectMany <B, C> (Func<A, K<M, 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 StateT<S, M, 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 StateT<S, M, 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 StateT<S, M, 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 StateT<S, M, 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 |
| |
method StateT<S, M, C> SelectMany <B, C> (Func<A, IO<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 StateT<S, M, C> SelectMany <B, C> (Func<A, K<IO, 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 |
| |
Operators
operator >> (StateT<S, M, A> lhs, StateT<S, M, A> rhs) Source #
Sequentially compose two actions, discarding any value produced by the first, like sequencing operators (such as the semicolon) in C#.
Parameters
| param | lhs | First action to run |
| param | rhs | Second action to run |
| returns | Result of the second action | |
operator >> (StateT<S, M, A> lhs, K<StateT<S, M>, A> rhs) Source #
Sequentially compose two actions, discarding any value produced by the first, like sequencing operators (such as the semicolon) in C#.
Parameters
| param | lhs | First action to run |
| param | rhs | Second action to run |
| returns | Result of the second action | |
operator >> (StateT<S, M, A> lhs, StateT<S, M, Unit> rhs) Source #
Sequentially compose two actions. The second action is a unit returning action, so the result of the first action is propagated.
Parameters
| param | lhs | First action to run |
| param | rhs | Second action to run |
| returns | Result of the first action | |
operator >> (StateT<S, M, A> lhs, K<StateT<S, M>, Unit> rhs) Source #
Sequentially compose two actions. The second action is a unit returning action, so the result of the first action is propagated.
Parameters
| param | lhs | First action to run |
| param | rhs | Second action to run |
| returns | Result of the first action | |