LanguageExt.Core

LanguageExt.Core Monads State and Environment Monads Writer

Contents

delegate Writer <MonoidW, W, A> Source #

class WriterExtensions Source #

Extension methods for Writer

Methods

method Writer<MSeq<W>, Seq<W>, A> Flatten <W, A> (this Writer<MSeq<W>, Seq<W>, Writer<MSeq<W>, Seq<W>, A>> ma) Source #

Monadic join

method Writer<MonoidW, W, A> Flatten <MonoidW, W, A> (this Writer<MonoidW, W, Writer<MonoidW, W, A>> ma) Source #

where MonoidW : struct, Monoid<W>

Monadic join

method Writer<MSeq<W>, Seq<W>, A> ToWriter <W, A> (this (A Value, Seq<W> Output) ma) Source #

Conversion from tuple to writer

Parameters

type W

Type of the writer monad's output

type A

Bound value type

param ma

Tuple to convert to writeer

returns

Writer monad

method Writer<MonoidW, W, A> ToWriter <MonoidW, W, A> (this (A Value, W Output) ma) Source #

where MonoidW : struct, Monoid<W>

Conversion from tuple to writer

Parameters

type W

Type of the writer monad's output

type A

Bound value type

param ma

Tuple to convert to writeer

returns

Writer monad

method (TryOption<A> Value, Seq<W> Output) Run <W, A> (this Writer<MSeq<W>, Seq<W>, A> self) Source #

Runs the Writer monad and memoizes the result in a TryOption monad. Use Match, IfSucc, IfNone, etc to extract.

method (TryOption<A> Value, W Output) Run <MonoidW, W, A> (this Writer<MonoidW, W, A> self) Source #

where MonoidW : struct, Monoid<W>

Runs the Writer monad and memoizes the result in a TryOption monad. Use Match, IfSucc, IfNone, etc to extract.

method Writer<MSeq<W>, Seq<W>, Seq<A>> ToSeq <W, A> (this Writer<MSeq<W>, Seq<W>, A> self) Source #

method Writer<MonoidW, W, Seq<A>> ToSeq <MonoidW, W, A> (this Writer<MonoidW, W, A> self) Source #

where MonoidW : struct, Monoid<W>

method Writer<MonoidW, W, Seq<A>> AsEnumerable <MonoidW, W, A> (this Writer<MonoidW, W, A> self) Source #

where MonoidW : struct, Monoid<W>

method Writer<MSeq<W>, Seq<W>, int> Count <W> (this Writer<MSeq<W>, Seq<W>, int> self) Source #

method Writer<MonoidW, W, int> Count <MonoidW, W> (this Writer<MonoidW, W, int> self) Source #

where MonoidW : struct, Monoid<W>

method Writer<MSeq<W>, Seq<W>, bool> ForAll <W, A> (this Writer<MSeq<W>, Seq<W>, A> self, Func<A, bool> pred) Source #

method Writer<MonoidW, W, bool> ForAll <MonoidW, W, A> (this Writer<MonoidW, W, A> self, Func<A, bool> pred) Source #

where MonoidW : struct, Monoid<W>

method Writer<MSeq<W>, Seq<W>, bool> Exists <W, A> (this Writer<MSeq<W>, Seq<W>, A> self, Func<A, bool> pred) Source #

method Writer<MonoidW, W, bool> Exists <MonoidW, W, A> (this Writer<MonoidW, W, A> self, Func<A, bool> pred) Source #

where MonoidW : struct, Monoid<W>

method Writer<MSeq<W>, Seq<W>, FState> Fold <FState, W, A> (this Writer<MSeq<W>, Seq<W>, A> self, FState initialState, Func<FState, A, FState> f) Source #

method Writer<MonoidW, W, FState> Fold <FState, MonoidW, W, A> (this Writer<MonoidW, W, A> self, FState initialState, Func<FState, A, FState> f) Source #

where MonoidW : struct, Monoid<W>

method Writer<MSeq<W>, Seq<W>, Seq<W>> Fold <W, A> (this Writer<MSeq<W>, Seq<W>, A> self, Func<Seq<W>, A, Seq<W>> f) Source #

method Writer<MonoidW, W, W> Fold <MonoidW, W, A> (this Writer<MonoidW, W, A> self, Func<W, A, W> f) Source #

where MonoidW : struct, Monoid<W>

method Writer<MSeq<W>, Seq<W>, B> Map <W, A, B> (this Writer<MSeq<W>, Seq<W>, A> self, Func<A, B> f) Source #

method Writer<MonoidW, W, B> Map <MonoidW, W, A, B> (this Writer<MonoidW, W, A> self, Func<A, B> f) Source #

where MonoidW : struct, Monoid<W>

method Writer<MSeq<W>, Seq<W>, A> Do <W, A> (this Writer<MSeq<W>, Seq<W>, A> ma, Action<A> f) Source #

Impure iteration of the bound value in the structure

Parameters

returns

Returns the original unmodified structure

method Writer<MonoidW, W, A> Do <MonoidW, W, A> (this Writer<MonoidW, W, A> ma, Action<A> f) Source #

where MonoidW : struct, Monoid<W>

Impure iteration of the bound value in the structure

Parameters

returns

Returns the original unmodified structure

method Writer<MSeq<W>, Seq<W>, A> Strict <W, A> (this Writer<MSeq<W>, Seq<W>, A> ma) Source #

Force evaluation of the Writer

method Writer<MonoidW, W, A> Strict <MonoidW, W, A> (this Writer<MonoidW, W, A> ma) Source #

where MonoidW : struct, Monoid<W>

Force evaluation of the Writer

method Writer<MSeq<W>, Seq<W>, A> Pass <W, A> (this Writer<MSeq<W>, Seq<W>, (A, Func<Seq<W>, Seq<W>>)> self) Source #

pass is an action that executes the monad, which returns a value and a function, and returns the value, applying the function to the output.

method Writer<MonoidW, W, A> Pass <MonoidW, W, A> (this Writer<MonoidW, W, (A, Func<W, W>)> self) Source #

where MonoidW : struct, Monoid<W>

pass is an action that executes the monad, which returns a value and a function, and returns the value, applying the function to the output.

method Writer<MSeq<W>, Seq<W>, (A, B)> Listen <W, A, B> (this Writer<MSeq<W>, Seq<W>, A> self, Func<Seq<W>, B> f) Source #

listen is an action that executes the monad and adds its output to the value of the computation.

method Writer<MonoidW, W, (A, B)> Listen <MonoidW, W, A, B> (this Writer<MonoidW, W, A> self, Func<W, B> f) Source #

where MonoidW : struct, Monoid<W>

listen is an action that executes the monad and adds its output to the value of the computation.

method Writer<MSeq<W>, Seq<W>, A> Censor <W, A> (this Writer<MSeq<W>, Seq<W>, A> self, Func<Seq<W>, Seq<W>> f) Source #

Censor is an action that executes the writer monad and applies the function f to its output, leaving the return value unchanged.

method Writer<MonoidW, W, A> Censor <MonoidW, W, A> (this Writer<MonoidW, W, A> self, Func<W, W> f) Source #

where MonoidW : struct, Monoid<W>

Censor is an action that executes the writer monad and applies the function f to its output, leaving the return value unchanged.

method Writer<MSeq<W>, Seq<W>, B> Bind <W, A, B> (this Writer<MSeq<W>, Seq<W>, A> self, Func<A, Writer<MSeq<W>, Seq<W>, B>> f) Source #

method Writer<MonoidW, W, B> Bind <MonoidW, W, A, B> (this Writer<MonoidW, W, A> self, Func<A, Writer<MonoidW, W, B>> f) Source #

where MonoidW : struct, Monoid<W>

method Writer<MSeq<W>, Seq<W>, B> Select <W, A, B> (this Writer<MSeq<W>, Seq<W>, A> self, Func<A, B> f) Source #

method Writer<MonoidW, W, B> Select <MonoidW, W, A, B> (this Writer<MonoidW, W, A> self, Func<A, B> f) Source #

where MonoidW : struct, Monoid<W>

method Writer<MSeq<W>, Seq<W>, C> SelectMany <W, A, B, C> ( this Writer<MSeq<W>, Seq<W>, A> self, Func<A, Writer<MSeq<W>, Seq<W>, B>> bind, Func<A, B, C> project) Source #

method Writer<MonoidW, W, C> SelectMany <MonoidW, W, A, B, C> ( this Writer<MonoidW, W, A> self, Func<A, Writer<MonoidW, W, B>> bind, Func<A, B, C> project) Source #

where MonoidW : struct, Monoid<W>

method Writer<MSeq<W>, Seq<W>, A> Filter <W, A> (this Writer<MSeq<W>, Seq<W>, A> self, Func<A, bool> pred) Source #

method Writer<MonoidW, W, A> Filter <MonoidW, W, A> (this Writer<MonoidW, W, A> self, Func<A, bool> pred) Source #

where MonoidW : struct, Monoid<W>

method Writer<MSeq<W>, Seq<W>, A> Where <W, A> (this Writer<MSeq<W>, Seq<W>, A> self, Func<A, bool> pred) Source #

method Writer<MonoidW, W, A> Where <MonoidW, W, A> (this Writer<MonoidW, W, A> self, Func<A, bool> pred) Source #

where MonoidW : struct, Monoid<W>

method Writer<MSeq<W>, Seq<W>, Unit> Iter <W, A> (this Writer<MSeq<W>, Seq<W>, A> self, Action<A> action) Source #

method Writer<MonoidW, W, Unit> Iter <MonoidW, W, A> (this Writer<MonoidW, W, A> self, Action<A> action) Source #

where MonoidW : struct, Monoid<W>

class Prelude Source #

Methods

method Writer<MonoidW, W, A> Writer <MonoidW, W, A> (A value) Source #

where MonoidW : struct, Monoid<W>

Writer monad constructor

Parameters

type W

Writer type

type A

Bound value type

param value

Value

returns

Writer monad

method Writer<MonoidW, W, A> Writer <MonoidW, W, A> (A value, W output) Source #

where MonoidW : struct, Monoid<W>

Writer monad constructor

Parameters

type W

Writer type

type A

Bound value type

param output

Output

param value

Value

returns

Writer monad

method Writer<MSeq<W>, Seq<W>, A> Writer <W, A> (A value) Source #

Writer monad constructor

Parameters

type W

Writer type

type A

Bound value type

param value

Value

returns

Writer monad

method Writer<MSeq<W>, Seq<W>, A> Writer <W, A> (A value, Seq<W> output) Source #

Writer monad constructor

Parameters

type W

Writer type

type A

Bound value type

param output

Output

param value

Value

returns

Writer monad

method Writer<MonoidW, W, int> count <MonoidW, W> (Writer<MonoidW, W, int> self) Source #

where MonoidW : struct, Monoid<W>

Count

method Writer<MonoidW, W, bool> forall <MonoidW, W, A> (Writer<MonoidW, W, A> self, Func<A, bool> pred) Source #

where MonoidW : struct, Monoid<W>

For all

method Writer<MonoidW, W, bool> exists <MonoidW, W, A> (Writer<MonoidW, W, A> self, Func<A, bool> pred) Source #

where MonoidW : struct, Monoid<W>

Exists

method Writer<MonoidW, W, FState> fold <FState, MonoidW, W, A> (Writer<MonoidW, W, A> self, FState initialState, Func<FState, A, FState> f) Source #

where MonoidW : struct, Monoid<W>

Fold

method Writer<MonoidW, W, W> fold <MonoidW, W, A> (Writer<MonoidW, W, A> self, Func<W, A, W> f) Source #

where MonoidW : struct, Monoid<W>

Fold

method Writer<MonoidW, W, A> pass <MonoidW, W, A> (Writer<MonoidW, W, (A, Func<W, W>)> self) Source #

where MonoidW : struct, Monoid<W>

pass is an action that executes the monad, which returns a value and a function, and returns the value, applying the function to the output.

method Writer<MonoidW, W, (A, B)> listen <MonoidW, W, A, B> (Writer<MonoidW, W, A> self, Func<W, B> f) Source #

where MonoidW : struct, Monoid<W>

listen is an action that executes the monad and adds its output to the value of the computation.

method Writer<MonoidW, W, A> censor <MonoidW, W, A> (Writer<MonoidW, W, A> self, Func<W, W> f) Source #

where MonoidW : struct, Monoid<W>

Censor is an action that executes the writer monad and applies the function f to its output, leaving the return value unchanged.

method Writer<MonoidW, W, Unit> tell <MonoidW, W> (W what) Source #

where MonoidW : struct, Monoid<W>

Tells the monad what you want it to hear. The monad carries this 'packet' upwards, merging it if needed (hence the Monoid requirement).

Parameters

type W

Type of the value tell

param what

The value to tell

returns

Updated writer monad

method Writer<MSeq<W>, Seq<W>, Unit> tell <W> (W what) Source #

Tells the monad what you want it to hear. The monad carries this 'packet' upwards, merging it if needed (hence the Monoid requirement).

Parameters

type W

Type of the value tell

param what

The value to tell

returns

Updated writer monad

method Writer<MonoidW, W, B> bind <MonoidW, W, A, B> (Writer<MonoidW, W, A> self, Func<A, Writer<MonoidW, W, B>> f) Source #

where MonoidW : struct, Monoid<W>

Bind

method Writer<MonoidW, W, B> map <MonoidW, W, A, B> (Writer<MonoidW, W, A> self, Func<A, B> f) Source #

where MonoidW : struct, Monoid<W>

Map

method Writer<MonoidW, W, A> filter <MonoidW, W, A> (Writer<MonoidW, W, A> self, Func<A, bool> pred) Source #

where MonoidW : struct, Monoid<W>

Filter

method Writer<MonoidW, W, Unit> iter <MonoidW, W, A> (Writer<MonoidW, W, A> self, Action<A> action) Source #

where MonoidW : struct, Monoid<W>

Iter

method Writer<MonoidW, W, A> trywrite <MonoidW, W, A> (Writer<MonoidW, W, A> m) Source #

where MonoidW : struct, Monoid<W>

Run the writer and catch exceptions

method Try<Writer<MonoidW, W, A>> tryfun <MonoidW, W, A> (Writer<MonoidW, W, A> ma) Source #

where MonoidW : struct, Monoid<W>