LanguageExt.Core

LanguageExt.Core Monads State and Environment Monads RWS RWST

Contents

record RWST <R, W, S, M, A> (Func<(R Env, W Output, S State), K<M, (A Value, W Output, S State)>> runRWST) Source #

where M : Monad<M>, Choice<M>
where W : Monoid<W>

Reader / Write / State monad-transformer

Parameters

type R

Reader environment type

type W

Writer output type

type S

State type

type M

Lifted monad type

type A

Bound value type

Properties

property RWST<R, W, S, M, (A Value, W Output)> Listen Source #

Writes an item and returns a value at the same time

property RWST<R, W, S, M, S> Get Source #

Extracts the state value and returns it as the bound value

Parameters

returns

RWST

Methods

method RWST<R, W, S, M, A> Pure (A value) Source #

method RWST<R, W, S, M, A> Lift (K<M, A> ma) Source #

method RWST<R, W, S, M, A> Lift (Pure<A> ma) Source #

method RWST<R, W, S, M, A> LiftIO (K<IO, A> ma) Source #

method RWST<R, W, S, M, A> Asks (Func<R, A> f) Source #

Extracts the environment value and maps it to the bound value

Parameters

param f

Environment mapping function

returns

RWST

method RWST<R, W, S, M, A> AsksM (Func<R, K<M, A>> f) Source #

Extracts the environment value and maps it to the bound value

Parameters

param f

Environment mapping function

returns

RWST

method RWST<R1, W, S, M, A> With <R1> (Func<R1, R> f) Source #

Maps the Reader's environment value

Parameters

param f

Mapping function

returns

RWST

method RWST<R, W, S, M, A> Local (Func<R, R> f) Source #

Maps the Reader's environment value

Parameters

param f

Mapping function

returns

RWST

method RWST<R, W, S, M, A> Write ((A Value, W Output) result) Source #

Construct a writer computation from a (result, output) pair.

The inverse of Run()

Parameters

param result

Result / Output pair

method RWST<R, W, S, M, A> Write (A value, W output) Source #

Construct a writer computation from a (result, output) pair.

The inverse of Run()

Parameters

param result

Result / Output pair

method RWST<R, W, S, M, (A Value, B Output)> Listens <B> (Func<W, B> f) Source #

Listens executes the action and adds the result of applying f to the output to the value of the computation.

method RWST<R, W, S, M, A> Censor (Func<W, W> f) Source #

Censor executes the action and applies the function f to its output, leaving the return value unchanged.

method RWST<R, W, 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

RWST

method RWST<R, W, 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

RWST

method RWST<R, W, S, M, Unit> Put (S value) Source #

Writes the value into the monadic state

Parameters

returns

RWST

method RWST<R, W, S, M, A> State (A value, S state) Source #

Writes a value and state into the monad

Parameters

returns

RWST

method RWST<R, W, S, M, A> State ((A Value, S State) ma) Source #

Writes a value and state into the monad

Parameters

returns

RWST

method RWST<R, W, 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

RWST

method RWST<R, W, 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

RWST

method RWST<R, W, 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

RWST

method RWST<R, W, 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

RWST

method RWST<R, W, S, M, B> Bind <B> (Func<A, K<RWST<R, W, S, M>, B>> f) Source #

Monad bind operation

Parameters

type B

Target bound value type

param f

Mapping function

returns

RWST

method RWST<R, W, S, M, B> Bind <B> (Func<A, RWST<R, W, S, M, B>> f) Source #

Monad bind operation

Parameters

type B

Target bound value type

param f

Mapping function

returns

RWST

method RWST<R, W, S, M, B> Bind <B> (Func<A, Ask<R, B>> f) Source #

Monad bind operation

Parameters

type B

Target bound value type

param f

Mapping function

returns

RWST

method RWST<R, W, 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

RWST

method RWST<R, W, 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

RWST

method RWST<R, W, S, M, C> SelectMany <B, C> (Func<A, RWST<R, W, 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

RWST

method RWST<R, W, S, M, C> SelectMany <B, C> (Func<A, K<RWST<R, W, 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

RWST

method RWST<R, W, 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

RWST

method RWST<R, W, 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

RWST

method RWST<R, W, 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

RWST

method RWST<R, W, 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

RWST

method RWST<R, W, S, M, C> SelectMany <B, C> (Func<A, Ask<R, 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

RWST

method RWST<R, W, 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

RWST

method RWST<R, W, 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

RWST

method RWST<R, W, 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

RWST

method RWST<R, W, S, M, C> SelectMany <C> (Func<A, Tell<W>> 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

RWST

method K<M, (A Value, W Output, S State)> Run (R env, W output, S state) Source #

Run the monad

method K<M, (A Value, W Output, S State)> Run (R env, S state) Source #

Run the monad

Operators

operator >> (RWST<R, W, S, M, A> lhs, RWST<R, W, 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 >> (RWST<R, W, S, M, A> lhs, K<RWST<R, W, 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 >> (RWST<R, W, S, M, A> lhs, RWST<R, W, 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 >> (RWST<R, W, S, M, A> lhs, K<RWST<R, W, 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 | (RWST<R, W, S, M, A> ma, K<RWST<R, W, S, M>, A> mb) Source #

Choice operator

operator | (K<RWST<R, W, S, M>, A> ma, RWST<R, W, S, M, A> mb) Source #

Choice operator

operator | (RWST<R, W, S, M, A> ma, Pure<A> mb) Source #

Choice operator

operator | (RWST<R, W, S, M, A> ma, Ask<R, A> mb) Source #

Choice operator

operator | (Ask<R, A> ma, RWST<R, W, S, M, A> mb) Source #

Choice operator

operator | (RWST<R, W, S, M, A> ma, K<IO, A> mb) Source #

Choice operator

operator | (K<IO, A> ma, RWST<R, W, S, M, A> mb) Source #

Choice operator

operator + (RWST<R, W, S, M, A> ma, K<RWST<R, W, S, M>, A> mb) Source #

Combine operator

operator + (K<RWST<R, W, S, M>, A> ma, RWST<R, W, S, M, A> mb) Source #

Combine operator

operator + (RWST<R, W, S, M, A> ma, Pure<A> mb) Source #

Combine operator

operator + (RWST<R, W, S, M, A> ma, Ask<R, A> mb) Source #

Combine operator

operator + (Ask<R, A> ma, RWST<R, W, S, M, A> mb) Source #

Combine operator

operator + (RWST<R, W, S, M, A> ma, K<IO, A> mb) Source #

Combine operator

operator + (K<IO, A> ma, RWST<R, W, S, M, A> mb) Source #

Combine operator

class RWSTExtensions Source #

Methods

method RWST<R, W, S, M, A> As <R, W, S, M, A> (this K<RWST<R, W, S, M>, A> ma) Source #

where M : Monad<M>, Choice<M>
where W : Monoid<W>

method K<M, (A Value, W Output, S State)> Run <R, W, S, M, A> ( this K<RWST<R, W, S, M>, A> ma, R env, W output, S state) Source #

where M : Monad<M>, Choice<M>
where W : Monoid<W>

method K<M, (A Value, W Output, S State)> Run <R, W, S, M, A> ( this K<RWST<R, W, S, M>, A> ma, R env, S state) Source #

where M : Monad<M>, Choice<M>
where W : Monoid<W>

method RWST<R, W, S, M, A> Flatten <R, W, S, M, A> (this RWST<R, W, S, M, RWST<R, W, S, M, A>> mma) Source #

where W : Monoid<W>
where M : Monad<M>, Choice<M>

Monadic join

method RWST<R, W, S, M, A> Flatten <R, W, S, M, A> (this RWST<R, W, S, M, K<RWST<R, W, S, M>, A>> mma) Source #

where W : Monoid<W>
where M : Monad<M>, Choice<M>

Monadic join

method RWST<R, W, S, M, C> SelectMany <R, W, S, M, A, B, C> ( this K<M, A> ma, Func<A, K<RWST<R, W, S, M>, B>> bind, Func<A, B, C> project) Source #

where W : Monoid<W>
where M : Monad<M>, Choice<M>

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

ReaderT

method RWST<R, W, S, M, C> SelectMany <R, W, S, M, A, B, C> ( this K<M, A> ma, Func<A, RWST<R, W, S, M, B>> bind, Func<A, B, C> project) Source #

where W : Monoid<W>
where M : Monad<M>, Choice<M>

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

ReaderT

method RWST<R, W, S, M, C> SelectMany <R, W, S, M, A, B, C> ( this K<IO, A> ma, Func<A, K<RWST<R, W, S, M>, B>> bind, Func<A, B, C> project) Source #

where W : Monoid<W>
where M : Monad<M>, Choice<M>

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

ReaderT

method RWST<R, W, S, M, C> SelectMany <R, W, S, M, A, B, C> ( this K<IO, A> ma, Func<A, RWST<R, W, S, M, B>> bind, Func<A, B, C> project) Source #

where W : Monoid<W>
where M : Monad<M>, Choice<M>

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

ReaderT

class RWSTExtensions Source #

Methods

method RWST<R, W, S, M, B> Map <R, W, S, M, A, B> (this Func<A, B> f, K<RWST<R, W, S, M>, A> ma) Source #

where W : Monoid<W>
where M : Monad<M>, Choice<M>

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 RWST<R, W, S, M, B> Map <R, W, S, M, A, B> (this Func<A, B> f, RWST<R, W, S, M, A> ma) Source #

where W : Monoid<W>
where M : Monad<M>, Choice<M>

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 RWST<R, W, S, M, B> Action <R, W, S, M, A, B> (this RWST<R, W, S, M, A> ma, K<RWST<R, W, S, M>, B> mb) Source #

where W : Monoid<W>
where M : Monad<M>, Choice<M>

Applicative action: runs the first applicative, ignores the result, and returns the second applicative

method RWST<R, W, S, M, B> Action <R, W, S, M, A, B> (this K<RWST<R, W, S, M>, A> ma, K<RWST<R, W, S, M>, B> mb) Source #

where W : Monoid<W>
where M : Monad<M>, Choice<M>

Applicative action: runs the first applicative, ignores the result, and returns the second applicative

method RWST<R, W, S, M, B> Apply <R, W, S, M, A, B> (this RWST<R, W, S, M, Func<A, B>> mf, K<RWST<R, W, S, M>, A> ma) Source #

where W : Monoid<W>
where M : Monad<M>, Choice<M>

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 RWST<R, W, S, M, B> Apply <R, W, S, M, A, B> (this K<RWST<R, W, S, M>, Func<A, B>> mf, K<RWST<R, W, S, M>, A> ma) Source #

where W : Monoid<W>
where M : Monad<M>, Choice<M>

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

class RWST Source #

Methods

method RWST<R, W, S, M, A> pure <R, W, S, M, A> (A value) Source #

where W : Monoid<W>
where M : Monad<M>, Choice<M>

method RWST<R, W, S, M, A> lift <R, W, S, M, A> (K<M, A> ma) Source #

where W : Monoid<W>
where M : Monad<M>, Choice<M>

method RWST<R, W, S, M, A> liftIO <R, W, S, M, A> (IO<A> effect) Source #

where W : Monoid<W>
where M : Monad<M>, Choice<M>

Lifts a given monad into the transformer

Parameters

param effect

Monad to lift

returns

ReaderT

method RWST<R, W, S, M, R> ask <R, W, S, M> () Source #

where W : Monoid<W>
where M : Monad<M>, Choice<M>

method RWST<R, W, S, M, A> asks <R, W, S, M, A> (Func<R, A> f) Source #

where W : Monoid<W>
where M : Monad<M>, Choice<M>

method RWST<R, W, S, M, A> asksM <R, W, S, M, A> (Func<R, K<M, A>> f) Source #

where W : Monoid<W>
where M : Monad<M>, Choice<M>

method RWST<R, W, S, M, A> asksM <R, W, S, M, A> (Func<R, K<RWST<R, W, S, M>, A>> f) Source #

where W : Monoid<W>
where M : Monad<M>, Choice<M>

method RWST<R, W, S, M, A> local <R, W, S, M, A> (Func<R, R> f, K<RWST<R, W, S, M>, A> ma) Source #

where W : Monoid<W>
where M : Monad<M>, Choice<M>

method RWST<R, W, S, M, A> with <R, R1, W, S, M, A> (Func<R, R1> f, K<RWST<R1, W, S, M>, A> ma) Source #

where W : Monoid<W>
where M : Monad<M>, Choice<M>

method RWST<R, W, S, M, Unit> tell <R, W, S, M> (W item) Source #

where M : Monad<M>, Choice<M>
where W : Monoid<W>

Tell is an action that produces the writer output

Parameters

type W

Writer type

param item

Item to tell

returns

Structure with the told item

method RWST<R, W, S, M, A> write <R, W, S, M, A> ((A, W) item) Source #

where M : Monad<M>, Choice<M>
where W : Monoid<W>

Writes an item and returns a value at the same time

method RWST<R, W, S, M, A> write <R, W, S, M, A> (A value, W item) Source #

where M : Monad<M>, Choice<M>
where W : Monoid<W>

Writes an item and returns a value at the same time

method RWST<R, W, S, M, A> pass <R, W, S, M, A> (RWST<R, W, S, M, (A Value, Func<W, W> Function)> action) Source #

where M : Monad<M>, Choice<M>
where W : Monoid<W>

pass is an action that executes the action, which returns a value and a function; it then returns the value with the output having been applied to the function.

method RWST<R, W, S, M, (A Value, W Output)> listen <R, W, S, M, A> (RWST<R, W, S, M, A> ma) Source #

where M : Monad<M>, Choice<M>
where W : Monoid<W>

listen executes the action ma and adds the result of applying f to the output to the value of the computation.

method RWST<R, W, S, M, (A Value, B Output)> listens <R, W, S, M, A, B> (Func<W, B> f, RWST<R, W, S, M, A> ma) Source #

where M : Monad<M>, Choice<M>
where W : Monoid<W>

listens executes the action ma and adds the result of applying f to the output to the value of the computation.

method RWST<R, W, S, M, A> censor <R, W, S, M, A> (Func<W, W> f, RWST<R, W, S, M, A> ma) Source #

where M : Monad<M>, Choice<M>
where W : Monoid<W>

censor executes the action ma and applies the function f to its output, leaving the return value unchanged.

method RWST<R, W, S, M, S> get <R, W, S, M> () Source #

where W : Monoid<W>
where M : Monad<M>, Choice<M>

method RWST<R, W, S, M, A> gets <R, W, S, M, A> (Func<S, A> f) Source #

where W : Monoid<W>
where M : Monad<M>, Choice<M>

method RWST<R, W, S, M, A> getsM <R, W, S, M, A> (Func<S, K<M, A>> f) Source #

where W : Monoid<W>
where M : Monad<M>, Choice<M>

method RWST<R, W, S, M, A> getsM <R, W, S, M, A> (Func<S, K<RWST<R, W, S, M>, A>> f) Source #

where W : Monoid<W>
where M : Monad<M>, Choice<M>

method RWST<R, W, S, M, Unit> put <R, W, S, M> (S state) Source #

where W : Monoid<W>
where M : Monad<M>, Choice<M>

method RWST<R, W, S, M, Unit> modify <R, W, S, M> (Func<S, S> f) Source #

where W : Monoid<W>
where M : Monad<M>, Choice<M>

method RWST<R, W, S, M, Unit> modifyM <R, W, S, M> (Func<S, K<M, S>> f) Source #

where W : Monoid<W>
where M : Monad<M>, Choice<M>

method RWST<R, W, S, M, Unit> modifyM <R, W, S, M> (Func<S, K<RWST<R, W, S, M>, S>> f) Source #

where W : Monoid<W>
where M : Monad<M>, Choice<M>

class RWST <R, W, S, M> Source #

where M : Monad<M>, Choice<M>
where W : Monoid<W>

Reader / Write / State monad-transformer trait implementations

Parameters

type R

Reader environment type

type W

Writer output type

type S

State type

type M

Lifted monad type

Methods

method K<RWST<R, W, S, M>, A> LiftIO <A> (K<IO, A> ma) Source #

method K<RWST<R, W, S, M>, A> LiftIO <A> (IO<A> ma) Source #

class Prelude Source #

Methods

method RWST<R, W, S, M, B> map <R, W, S, M, A, B> (Func<A, B> f, K<RWST<R, W, S, M>, A> ma) Source #

where W : Monoid<W>
where M : Monad<M>, Choice<M>

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 RWST<R, W, S, M, B> action <R, W, S, M, A, B> (K<RWST<R, W, S, M>, A> ma, K<RWST<R, W, S, M>, B> mb) Source #

where W : Monoid<W>
where M : Monad<M>, Choice<M>

Applicative action: runs the first applicative, ignores the result, and returns the second applicative

method RWST<R, W, S, M, B> apply <R, W, S, M, A, B> (K<RWST<R, W, S, M>, Func<A, B>> mf, K<RWST<R, W, S, M>, A> ma) Source #

where W : Monoid<W>
where M : Monad<M>, Choice<M>

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