LanguageExt.Core

LanguageExt.Core Monads State and Environment Monads RWS RWST

Contents

Sub modules

Extensions
Operators
Trait

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>
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

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>

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>

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>

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>

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>

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>

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>

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>

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>

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

where M : Monad<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>
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>
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>
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>
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>
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>
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>

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>

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>

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>

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

where W : Monoid<W>
where M : Monad<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>

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>

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>