LanguageExt.Core

LanguageExt.Core Traits Writer

Contents

class WriterExtensions Source #

Methods

method K<M, A> Pass <M, W, A> (this K<M, (A Value, Func<W, W> Function)> action) Source #

where M : WriterM<M, W>
where W : Monoid<W>

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

method K<M, (A Value, B Output)> Listens <M, W, A, B> (this Func<W, B> f, K<M, A> ma) Source #

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

listens is executes the action @m@ and adds the result of applying f to the output to the value of the computation.

method K<M, (A Value, B Output)> Listens <M, W, A, B> (this K<M, A> ma, Func<W, B> f) Source #

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

listens is executes the action @m@ and adds the result of applying f to the output to the value of the computation.

method K<M, A> Censor <M, W, A> (this K<M, A> ma, Func<W, W> f) Source #

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

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

method K<M, A> Censor <M, W, A> (this Func<W, W> f, K<M, A> ma) Source #

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

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

class WriterM Source #

Methods

method K<M, Unit> tell <M, W> (W item) Source #

where M : WriterM<M, W>
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 K<M, A> write <M, W, A> ((A, W) item) Source #

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

Writes an item and returns a value at the same time

method K<M, A> write <M, W, A> (A value, W item) Source #

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

Writes an item and returns a value at the same time

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

where M : WriterM<M, W>
where W : Monoid<W>

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

method K<M, (A Value, W Output)> listen <M, W, A> (K<M, A> ma) Source #

where M : WriterM<M, W>
where W : Monoid<W>

Writes an item and returns a value at the same time

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

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

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

method K<M, A> censor <M, W, A> (Func<W, W> f, K<M, A> ma) Source #

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

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

interface WriterM <M, W> Source #

where M : WriterM<M, W>
where W : Monoid<W>

WriterM trait

Tell is how you log to the writer's output. The WriterM carries this 'packet' upwards, merging it if needed (hence the Monoid requirement).

Listen listens to a monad acting, and returns what the monad "said".

Pass lets you provide a writer transformer which changes internals of the written object.

Parameters

type M

Writer self trait

type W

Monoidal output type

Methods

method K<M, Unit> Tell (W item) Source #

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 K<M, (A Value, W Output)> Listen <A> (K<M, A> ma) Source #

Writes an item and returns a value at the same time

method K<M, A> Pass <A> (K<M, (A Value, Func<W, W> Function)> action) Source #

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

For usage, see Writer.censor for how it's used to filter the output.