LanguageExt.Core

LanguageExt.Core Monads Alternative Monads ChronicleT

Contents

Sub modules

Extensions
Operators
Prelude
Trait

record ChronicleT <Ch, M, A> (Func<SemigroupInstance<Ch>, K<M, These<Ch, A>>> runChronicleT) Source #

where M : Monad<M>

The ChronicleT monad transformer.

Hybrid error/writer monad class that allows both accumulating outputs and aborting computation with a final output.

The expected use case is for computations with a notion of fatal vs. non-fatal errors.

The 'pure' function produces a computation with no output, and Bind combines multiple outputs with semigroup combine.

Parameters

type Ch

Chronicle type

type M

Monad type

type A

Bound value type

param runChronicleT

Composed monadic type

Methods

method K<M, These<Ch, A>> Run (SemigroupInstance<Ch> trait) Source #

Run the chronicle to yield its inner monad

Parameters

param f

Semigroup combine operation

method ChronicleT<Ch, M, B> Map <B> (Func<A, B> f) Source #

Functor map operation

Parameters

type B

Resulting bound value type

param f

Mapping function

returns

Mapped structure

method ChronicleT<Ch1, M, B> BiMap <Ch1, B> (Func<Ch, Ch1> This, Func<A, B> That) Source #

where Ch1 : Semigroup<Ch1>

Bifunctor map operation

Parameters

type Ch1

Chronicle type to map to

param This

Chronicle mapping function

param That

Dictation mapping function

returns

method ChronicleT<Ch, M, B> Select <B> (Func<A, B> f) Source #

Functor map operation

Parameters

type B

Resulting bound value type

param f

Mapping function

returns

Mapped structure

method ChronicleT<Ch, M, B> Bind <B> (Func<A, K<ChronicleT<Ch, M>, B>> f) Source #

Monad bind operation

Parameters

param f

Chaining function

returns

Chained structure

method ChronicleT<Ch1, M, A> BindFirst <Ch1> (Func<Ch, K<ChronicleT<M>, Ch1, A>> f) Source #

where Ch1 : Semigroup<Ch1>

Monad bind operation

Parameters

param f

Chaining function

returns

Chained structure

method ChronicleT<Ch, M, B> BindSecond <B> (Func<A, K<ChronicleT<M>, Ch, B>> f) Source #

Monad bind operation

Parameters

param f

Chaining function

returns

Chained structure

method ChronicleT<Ch, M, C> SelectMany <B, C> (Func<A, K<ChronicleT<Ch, M>, B>> bind, Func<A, B, C> project) Source #

Monad bind operation

Parameters

type B

Resulting bound value type

param f

Chaining function

returns

Chained structure

method ChronicleT<Ch, M, C> SelectMany <B, C> (Func<A, IO<B>> bind, Func<A, B, C> project) Source #

Monad bind operation

Parameters

type B

Resulting bound value type

param f

Chaining function

returns

Chained structure

method ChronicleT<Ch, M, C> SelectMany <C> (Func<A, Guard<Ch, Unit>> bind, Func<A, Unit, C> project) Source #

Monad bind operation

Parameters

type B

Resulting bound value type

param f

Chaining function

returns

Chained structure

method ChronicleT<Ch, M, Either<Ch, A>> Memento () Source #

Memento is an action that executes the action within this structure, returning either its record, if it ended with Confess, or its final value otherwise, with any record added to the current record.

Similar to 'Catch' in the 'Fallible' trait, but with a notion of non-fatal errors (which are accumulated) vs. fatal errors (which are caught without accumulating).

method ChronicleT<Ch, M, A> Absolve (A defaultValue) Source #

Absolve is an action that executes this structure and discards any record it had. The defaultValue will be used if the action ended via Confess.

Parameters

param defaultValue

method ChronicleT<Ch, M, A> Condemn () Source #

This can be seen as converting non-fatal errors into fatal ones.

Condemn is an action that executes the structure and keeps its value only if it had no record. Otherwise, the value (if any) will be discarded and only the record kept.

method ChronicleT<Ch, M, A> Censor (Func<Ch, Ch> f) Source #

An action that executes the structure and applies the function f to its output, leaving the return value unchanged.-

Equivalent to censor for the 'Writable` trait.

Parameters

param f

Censoring function

method ChronicleT<Ch, M, A> Choose (K<ChronicleT<Ch, M>, A> rhs) Source #

Coalescing operation

method ChronicleT<Ch, M, A> Choose (Func<K<ChronicleT<Ch, M>, A>> rhs) Source #

Coalescing operation

method ChronicleT<Ch, M, A> Catch (Func<Ch, bool> Predicate, Func<Ch, K<ChronicleT<Ch, M>, A>> Fail) Source #

Fallible error catching operation

Parameters

param Predicate
param Fail
returns

class ChronicleT <Ch, M> Source #

Methods

method ChronicleT<Ch, M, A> dictate <A> (A value) Source #

dictate is an action that records the output value. Equivalent to tell for the Writable traits.

Parameters

param value

Value to construct with

returns

Chronicle structure

method ChronicleT<Ch, M, A> confess <A> (Ch value) Source #

confess is an action that ends with a final output value. Equivalent to fail for the 'Fallible' trait.

Parameters

param value

Value to construct with

returns

Chronicle structure

method ChronicleT<Ch, M, A> chronicle <A> (Ch @this, A that) Source #

Construct a new chronicle with this and that.

Parameters

param @this

Value to construct with

param that

Value to construct with

returns

Chronicle structure

method ChronicleT<Ch, M, A> lift <A> (These<Ch, A> these) Source #

Construct a new chronicle with these.

Parameters

param these

What to chronicle

returns

Chronicle structure

method ChronicleT<Ch, M, A> lift <A> (K<M, A> ma) Source #

Lift a monad M into the monad-transformer

Parameters

param ma

Monad to lift

returns

Chronicle structure

method ChronicleT<Ch, M, A> liftIO <A> (K<IO, A> ma) Source #

Lift an IO monad into the monad-transformer

Parameters

param ma

Monad to lift

returns

Chronicle structure

method ChronicleT<Ch, M, Either<Ch, A>> memento <A> (K<ChronicleT<Ch, M>, A> ma) Source #

Memento is an action that executes the action within this structure, returning either its record, if it ended with Confess, or its final value otherwise, with any record added to the current record.

Similar to 'Catch' in the 'Fallible' trait, but with a notion of non-fatal errors (which are accumulated) vs. fatal errors (which are caught without accumulating).

method ChronicleT<Ch, M, A> absolve <A> (A defaultValue, K<ChronicleT<Ch, M>, A> ma) Source #

absolve is an action that executes this structure and discards any record it had. The defaultValue will be used if the action ended via Confess.

Parameters

param defaultValue

method ChronicleT<Ch, M, A> condemn <A> (K<ChronicleT<Ch, M>, A> ma) Source #

Condemn is an action that executes the structure and keeps its value only if it had no record. Otherwise, the value (if any) will be discarded and only the record kept.

This can be seen as converting non-fatal errors into fatal ones.

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

An action that executes the structure and applies the function f to its output, leaving the return value unchanged.-

Equivalent to censor for the 'Writable` trait.

Parameters

param f

Censoring function

class ChronicleT Source #

Methods

method ChronicleT<Ch, M, A> empty <Ch, M, A> () Source #

where Ch : Monoid<Ch>
where M : Monad<M>

Monoid empty confession

Parameters

type Ch

Chronicle type (a monoid)

type M

Lifted monad type

type A

Bound value type

returns

method ChronicleT<Ch, M, A> dictate <Ch, M, A> (A value) Source #

where M : Monad<M>

dictate is an action that records the output value. Equivalent to tell for the Writable traits.

Parameters

param value

Value to construct with

returns

Chronicle structure

method ChronicleT<Ch, M, A> confess <Ch, M, A> (Ch value) Source #

where M : Monad<M>

confess is an action that ends with a final output value. Equivalent to fail for the 'Fallible' trait.

Parameters

param value

Value to construct with

returns

Chronicle structure

method ChronicleT<Ch, M, A> chronicle <Ch, M, A> (Ch @this, A that) Source #

where M : Monad<M>

Construct a new chronicle with this and that.

Parameters

param @this

Value to construct with

param that

Value to construct with

returns

Chronicle structure

method ChronicleT<Ch, M, A> chronicle <Ch, M, A> (These<Ch, A> these) Source #

where M : Monad<M>

Construct a new chronicle with these.

Parameters

param these

What to chronicle

returns

Chronicle structure

method ChronicleT<Ch, M, A> lift <Ch, M, A> (K<M, A> ma) Source #

where M : Monad<M>

Lift a monad M into the monad-transformer

Parameters

param ma

Monad to lift

returns

Chronicle structure

method ChronicleT<Ch, M, A> liftIO <Ch, M, A> (K<IO, A> ma) Source #

where M : Monad<M>

Lift an IO monad into the monad-transformer

Parameters

param ma

Monad to lift

returns

Chronicle structure

method ChronicleT<Ch, M, Either<Ch, A>> memento <Ch, M, A> (K<ChronicleT<Ch, M>, A> ma) Source #

where M : Monad<M>

Memento is an action that executes the action within this structure, returning either its record, if it ended with Confess, or its final value otherwise, with any record added to the current record.

Similar to 'Catch' in the 'Fallible' trait, but with a notion of non-fatal errors (which are accumulated) vs. fatal errors (which are caught without accumulating).

method ChronicleT<Ch, M, A> absolve <Ch, M, A> (A defaultValue, K<ChronicleT<Ch, M>, A> ma) Source #

where M : Monad<M>

absolve is an action that executes this structure and discards any record it had. The defaultValue will be used if the action ended via Confess.

Parameters

param defaultValue

method ChronicleT<Ch, M, A> condemn <Ch, M, A> (K<ChronicleT<Ch, M>, A> ma) Source #

where M : Monad<M>

Condemn is an action that executes the structure and keeps its value only if it had no record. Otherwise, the value (if any) will be discarded and only the record kept.

This can be seen as converting non-fatal errors into fatal ones.

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

where M : Monad<M>

An action that executes the structure and applies the function f to its output, leaving the return value unchanged.-

Equivalent to censor for the 'Writable` trait.

Parameters

param f

Censoring function