LanguageExt.Core

LanguageExt.Core Traits Chronicaler

Contents

class ChronicalerExtensions Source #

Methods

method K<M, Either<Ch, A>> Memento <Ch, M, A> (this K<M, A> ma) Source #

where M : Chronicaler<M, Ch>

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

Parameters

param ma

Action to memento

method K<M, A> Absolve <Ch, M, A> (this K<M, A> ma, A defaultValue) Source #

where M : Chronicaler<M, Ch>

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

Action to absolve

method K<M, A> Condemn <Ch, M, A> (this K<M, A> ma) Source #

where M : Chronicaler<M, Ch>

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.

Parameters

param ma

Action to condemn

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

where M : Chronicaler<M, Ch>

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

param ma

Action to censor

method K<M, A> Chronicle <Ch, M, A> (this These<Ch, A> ma) Source #

where M : Chronicaler<M, Ch>

Construct a new chronicle with these.

Parameters

param these

What to chronicle

returns

Chronicle structure

class Chronicaler <Ch> Source #

Methods

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

where M : Chronicaler<M, Ch>

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 K<M, A> confess <M, A> (Ch confession) Source #

where M : Chronicaler<M, Ch>

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

Parameters

param confession

Value to construct with

returns

Chronicle structure

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

where M : Chronicaler<M, Ch>

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

Parameters

param ma

Action to memento

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

where M : Chronicaler<M, Ch>

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

Action to absolve

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

where M : Chronicaler<M, Ch>

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.

Parameters

param ma

Action to condemn

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

where M : Chronicaler<M, Ch>

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

param ma

Action to censor

method K<M, A> chronicle <M, A> (These<Ch, A> ma) Source #

where M : Chronicaler<M, Ch>

Construct a new chronicle with these.

Parameters

param these

What to chronicle

returns

Chronicle structure

interface Chronicaler <M, Ch> Source #

where M : Chronicaler<M, Ch>

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.

Parameters

type M

Self

type Ch

Chronicle type

Methods

method K<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 K<M, A> Confess <A> (Ch confession) Source #

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

Parameters

param confession

Value to construct with

returns

Chronicle structure

method K<M, Either<Ch, A>> Memento <A> (K<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).

Parameters

param ma

Action to memento

method K<M, A> Absolve <A> (A defaultValue, K<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
param ma

Action to absolve

method K<M, A> Condemn <A> (K<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.

Parameters

param ma

Action to condemn

method K<M, A> Censor <A> (Func<Ch, Ch> f, K<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

param ma

Action to censor

method K<M, A> Chronicle <A> (These<Ch, A> ma) Source #

Construct a new chronicle with these.

Parameters

param these

What to chronicle

returns

Chronicle structure