LanguageExt.Core

LanguageExt.Core Monads Alternative Monads ChronicleT Prelude

Contents

class Prelude Source #

Methods

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.

This is 'Applicative.Pure'.

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.

This is akin to yielding an error.

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, Either<Ch, A>> memento <Ch, M, A> (K<ChronicleT<Ch, M>, A> ma) Source #

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