LanguageExt.Core

LanguageExt.Core Effects Eff Prelude

Contents

class Prelude Source #

Methods

method EffCatch<RT, A> @catch <RT, A> (Error error, Func<Error, Eff<RT, A>> Fail) Source #

where RT : struct

Catch an error if the error matches the argument provided

method EffCatch<A> @catch <A> (Error error, Func<Error, Eff<A>> Fail) Source #

Catch an error if the error matches the argument provided

method EffCatch<RT, A> @catch <RT, A> (Error error, Eff<RT, A> Fail) Source #

where RT : struct

Catch an error if the error matches the argument provided

method EffCatch<A> @catch <A> (Error error, Eff<A> Fail) Source #

Catch an error if the error matches the argument provided

method EffCatch<RT, A> @catch <RT, A> (int errorCode, Func<Error, Eff<RT, A>> Fail) Source #

where RT : struct

Catch an error if the error Code matches the errorCode argument provided

method EffCatch<A> @catch <A> (int errorCode, Func<Error, Eff<A>> Fail) Source #

Catch an error if the error Code matches the errorCode argument provided

method EffCatch<RT, A> @catch <RT, A> (int errorCode, Eff<RT, A> Fail) Source #

where RT : struct

Catch an error if the error Code matches the errorCode argument provided

method EffCatch<A> @catch <A> (int errorCode, Eff<A> Fail) Source #

Catch an error if the error Code matches the errorCode argument provided

method EffCatch<RT, A> @catch <RT, A> (string errorText, Func<Error, Eff<RT, A>> Fail) Source #

where RT : struct

Catch an error if the error message matches the errorText argument provided

method EffCatch<A> @catch <A> (string errorText, Func<Error, Eff<A>> Fail) Source #

Catch an error if the error message matches the errorText argument provided

method EffCatch<RT, A> @catch <RT, A> (string errorText, Eff<RT, A> Fail) Source #

where RT : struct

Catch an error if the error message matches the errorText argument provided

method EffCatch<A> @catch <A> (string errorText, Eff<A> Fail) Source #

Catch an error if the error message matches the errorText argument provided

method EffCatch<A> @catch <A> (Func<Exception, bool> predicate, Func<Exception, Eff<A>> Fail) Source #

Catch an error if it's of a specific exception type

method EffCatch<A> @catch <A> (Func<Exception, bool> predicate, Eff<A> Fail) Source #

Catch an error if it's of a specific exception type

method EffCatch<RT, A> @catch <RT, A> (Func<Exception, bool> predicate, Func<Exception, Eff<RT, A>> Fail) Source #

where RT : struct

Catch an error if it's of a specific exception type

method EffCatch<RT, A> @catch <RT, A> (Func<Exception, bool> predicate, Eff<RT, A> Fail) Source #

where RT : struct

Catch an error if it's of a specific exception type

method EffCatch<RT, A> @catch <RT, A> (Eff<RT, A> Fail) Source #

where RT : struct

Catch all errors

method EffCatch<A> @catch <A> (Eff<A> Fail) Source #

Catch all errors

method EffCatch<RT, A> @catch <RT, A> (Func<Error, Eff<RT, A>> Fail) Source #

where RT : struct

Catch all errors

method EffCatch<A> @catch <A> (Func<Error, Eff<A>> Fail) Source #

Catch all errors

method EffCatch<A> @catchOf <E, A> (Func<E, Eff<A>> Fail) Source #

where E : Error

Catch errors

method EffCatch<RT, A> @catchOf <RT, E, A> (Func<E, Eff<RT, A>> Fail) Source #

where RT : struct
where E : Error

Catch errors

method EffCatch<A> @expected <A> (Func<Expected, Eff<A>> Fail) Source #

Catch expected errors

method EffCatch<RT, A> @expected <RT, A> (Func<Expected, Eff<RT, A>> Fail) Source #

where RT : struct

Catch expected errors

method EffCatch<A> @expectedOf <E, A> (Func<E, Eff<A>> Fail) Source #

where E : Expected

Catch expected errors

method EffCatch<RT, A> @expectedOf <RT, E, A> (Func<E, Eff<RT, A>> Fail) Source #

where RT : struct
where E : Expected

Catch expected errors

method EffCatch<A> @exceptional <A> (Func<Exceptional, Eff<A>> Fail) Source #

Catch exceptional errors

method EffCatch<RT, A> @exceptional <RT, A> (Func<Exceptional, Eff<RT, A>> Fail) Source #

where RT : struct

Catch exceptional errors

method EffCatch<A> @exceptionalOf <E, A> (Func<E, Eff<A>> Fail) Source #

where E : Exceptional

Catch exceptional errors

method EffCatch<RT, A> @exceptionalOf <RT, E, A> (Func<E, Eff<RT, A>> Fail) Source #

where RT : struct
where E : Exceptional

Catch exceptional errors

class Prelude Source #

Fields

field Eff<Unit> unitEff = SuccessEff(unit) Source #

Unit effect

Always succeeds with a Unit value

field Eff<bool> trueEff = SuccessEff(true) Source #

True effect

Always succeeds with a boolean true value

field Eff<bool> falseEff = SuccessEff(false) Source #

False effect

Always succeeds with a boolean false value

Methods

method Eff<RT, A> EffMaybe <RT, A> (Func<RT, Fin<A>> f) Source #

where RT : struct

Construct an effect that will either succeed, have an exceptional, or unexceptional failure

Parameters

type A

Bound value type

param f

Function to capture the effect

returns

Synchronous IO monad that captures the effect

method Eff<RT, A> Eff <RT, A> (Func<RT, A> f) Source #

where RT : struct

Construct an effect that will either succeed or have an exceptional failure

Parameters

type A

Bound value type

param f

Function to capture the effect

returns

Synchronous IO monad that captures the effect

method Eff<A> EffMaybe <A> (Func<Fin<A>> f) Source #

Construct an effect that will either succeed, have an exceptional, or unexceptional failure

Parameters

type A

Bound value type

param f

Function to capture the effect

returns

Synchronous IO monad that captures the effect

method Eff<A> Eff <A> (Func<A> f) Source #

Construct an effect that will either succeed or have an exceptional failure

Parameters

type A

Bound value type

param f

Function to capture the effect

returns

Synchronous IO monad that captures the effect

method Eff<A> SuccessEff <A> (A value) Source #

Construct an successful effect with a pure value

Parameters

type A

Bound value type

param value

Pure value to construct the monad with

returns

Synchronous IO monad that captures the pure value

method Eff<RT, A> SuccessEff <RT, A> (A value) Source #

where RT : struct

Construct an successful effect with a pure value

Parameters

type A

Bound value type

param value

Pure value to construct the monad with

returns

Synchronous IO monad that captures the pure value

method Eff<A> FailEff <A> (Error error) Source #

Construct a failed effect

Parameters

type A

Bound value type

param error

Error that represents the failure

returns

Synchronous IO monad that captures the failure

method Eff<RT, A> FailEff <RT, A> (Error error) Source #

where RT : struct

Construct a failed effect

Parameters

type A

Bound value type

param error

Error that represents the failure

returns

Synchronous IO monad that captures the failure

method Eff<OuterRT, A> localEff <OuterRT, InnerRT, A> (Func<OuterRT, InnerRT> f, Eff<InnerRT, A> ma) Source #

where InnerRT : struct
where OuterRT : struct

Create a new local context for the environment by mapping the outer environment and then using the result as a new context when running the IO monad provided

Parameters

param f

Function to map the outer environment into a new one to run ma

param ma

IO monad to run in the new context

class Prelude Source #

Methods

method Eff<RT, S> fold <RT, S, A> (Schedule schedule, Eff<RT, A> ma, S state, Func<S, A, S> fold) Source #

where RT : struct

Fold over the effect repeatedly until the schedule expires or the effect fails

Parameters

type RT

Runtime

type S

State type

type A

Bound value type

param ma

Effect to fold over

param schedule

Scheduler that controls the number of folds and the delay between each fold iteration

param state

Initial state

param fold

Folder function

returns

The result of the fold operation

method Eff<RT, S> foldWhile <RT, S, A> (Schedule schedule, Eff<RT, A> ma, S state, Func<S, A, S> fold, Func<A, bool> pred) Source #

where RT : struct

Fold over the effect repeatedly until the schedule expires, the effect fails, or the predicate returns false

Parameters

type RT

Runtime

type S

State type

type A

Bound value type

param ma

Effect to fold over

param schedule

Scheduler that controls the number of folds and the delay between each fold iteration

param state

Initial state

param fold

Folder function

param pred

Predicate function - when this returns false, the fold ends

returns

The result of the fold operation

method Eff<RT, S> foldUntil <RT, S, A> (Schedule schedule, Eff<RT, A> ma, S state, Func<S, A, S> fold, Func<A, bool> pred) Source #

where RT : struct

Fold over the effect repeatedly until the schedule expires, the effect fails, or the predicate returns true

Parameters

type RT

Runtime

type S

State type

type A

Bound value type

param ma

Effect to fold over

param schedule

Scheduler that controls the number of folds and the delay between each fold iteration

param state

Initial state

param fold

Folder function

param pred

Predicate function - when this returns true, the fold ends

returns

The result of the fold operation

method Eff<RT, S> fold <RT, S, A> (Eff<RT, A> ma, S state, Func<S, A, S> fold) Source #

where RT : struct

Fold over the effect repeatedly until the effect fails

Parameters

type RT

Runtime

type S

State type

type A

Bound value type

param ma

Effect to fold over

param state

Initial state

param fold

Folder function

returns

The result of the fold operation

method Eff<RT, S> foldWhile <RT, S, A> (Eff<RT, A> ma, S state, Func<S, A, S> fold, Func<A, bool> pred) Source #

where RT : struct

Fold over the effect repeatedly until the effect fails or the predicate returns false

Parameters

type RT

Runtime

type S

State type

type A

Bound value type

param ma

Effect to fold over

param state

Initial state

param fold

Folder function

param pred

Predicate function - when this returns false, the fold ends

returns

The result of the fold operation

method Eff<RT, S> foldUntil <RT, S, A> (Eff<RT, A> ma, S state, Func<S, A, S> fold, Func<A, bool> pred) Source #

where RT : struct

Fold over the effect repeatedly until the effect fails or the predicate returns true

Parameters

type RT

Runtime

type S

State type

type A

Bound value type

param ma

Effect to fold over

param state

Initial state

param fold

Folder function

param pred

Predicate function - when this returns true, the fold ends

returns

The result of the fold operation

method Eff<S> fold <S, A> (Schedule schedule, Eff<A> ma, S state, Func<S, A, S> fold) Source #

Fold over the effect repeatedly until the schedule expires or the effect fails

Parameters

type S

State type

type A

Bound value type

param ma

Effect to fold over

param schedule

Scheduler that controls the number of folds and the delay between each fold iteration

param state

Initial state

param fold

Folder function

returns

The result of the fold operation

method Eff<S> foldWhile <S, A> (Schedule schedule, Eff<A> ma, S state, Func<S, A, S> fold, Func<A, bool> pred) Source #

Fold over the effect repeatedly until the schedule expires, the effect fails, or the predicate returns false

Parameters

type S

State type

type A

Bound value type

param ma

Effect to fold over

param schedule

Scheduler that controls the number of folds and the delay between each fold iteration

param state

Initial state

param fold

Folder function

param pred

Predicate function - when this returns false, the fold ends

returns

The result of the fold operation

method Eff<S> foldUntil <S, A> (Schedule schedule, Eff<A> ma, S state, Func<S, A, S> fold, Func<A, bool> pred) Source #

Fold over the effect repeatedly until the schedule expires, the effect fails, or the predicate returns true

Parameters

type S

State type

type A

Bound value type

param ma

Effect to fold over

param schedule

Scheduler that controls the number of folds and the delay between each fold iteration

param state

Initial state

param fold

Folder function

param pred

Predicate function - when this returns true, the fold ends

returns

The result of the fold operation

method Eff<S> fold <S, A> (Eff<A> ma, S state, Func<S, A, S> fold) Source #

Fold over the effect repeatedly until the effect fails

Parameters

type S

State type

type A

Bound value type

param ma

Effect to fold over

param state

Initial state

param fold

Folder function

returns

The result of the fold operation

method Eff<S> foldWhile <S, A> (Eff<A> ma, S state, Func<S, A, S> fold, Func<A, bool> pred) Source #

Fold over the effect repeatedly until the effect fails or the predicate returns false

Parameters

type S

State type

type A

Bound value type

param ma

Effect to fold over

param state

Initial state

param fold

Folder function

param pred

Predicate function - when this returns false, the fold ends

returns

The result of the fold operation

method Eff<S> foldUntil <S, A> (Eff<A> ma, S state, Func<S, A, S> fold, Func<A, bool> pred) Source #

Fold over the effect repeatedly until the effect fails or the predicate returns true

Parameters

type S

State type

type A

Bound value type

param ma

Effect to fold over

param state

Initial state

param fold

Folder function

param pred

Predicate function - when this returns true, the fold ends

returns

The result of the fold operation

class Prelude Source #

Methods

method Eff<RT, A> repeat <RT, A> (Eff<RT, A> ma) Source #

where RT : struct

Keeps repeating the computation until it fails

Parameters

type RT

Runtime

type A

Computation bound value type

param ma

Computation to repeat

returns

The result of the last invocation of ma

method Eff<A> repeat <A> (Eff<A> ma) Source #

Keeps repeating the computation until it fails

Parameters

type RT

Runtime

type A

Computation bound value type

param ma

Computation to repeat

returns

The result of the last invocation of ma

method Eff<RT, A> repeat <RT, A> (Schedule schedule, Eff<RT, A> ma) Source #

where RT : struct

Keeps repeating the computation until it fails

Parameters

type RT

Runtime

type A

Computation bound value type

param schedule

Scheduler strategy for repeating

param ma

Computation to repeat

returns

The result of the last invocation of ma

method Eff<A> repeat <A> (Schedule schedule, Eff<A> ma) Source #

Keeps repeating the computation until it fails

Parameters

type RT

Runtime

type A

Computation bound value type

param schedule

Scheduler strategy for repeating

param ma

Computation to repeat

returns

The result of the last invocation of ma

method Eff<RT, A> repeatWhile <RT, A> (Eff<RT, A> ma, Func<A, bool> predicate) Source #

where RT : struct

Keeps repeating the computation until it fails or the predicate returns false

Parameters

type RT

Runtime

type A

Computation bound value type

param ma

Computation to repeat

returns

The result of the last invocation of ma

method Eff<A> repeatWhile <A> (Eff<A> ma, Func<A, bool> predicate) Source #

Keeps repeating the computation until it fails or the predicate returns false

Parameters

type RT

Runtime

type A

Computation bound value type

param ma

Computation to repeat

returns

The result of the last invocation of ma

method Eff<RT, A> repeatWhile <RT, A> (Schedule schedule, Eff<RT, A> ma, Func<A, bool> predicate) Source #

where RT : struct

Keeps repeating the computation until it fails or the predicate returns false

Parameters

type RT

Runtime

type A

Computation bound value type

param schedule

Scheduler strategy for repeating

param ma

Computation to repeat

returns

The result of the last invocation of ma

method Eff<A> repeatWhile <A> (Schedule schedule, Eff<A> ma, Func<A, bool> predicate) Source #

Keeps repeating the computation until it fails or the predicate returns false

Parameters

type RT

Runtime

type A

Computation bound value type

param schedule

Scheduler strategy for repeating

param ma

Computation to repeat

returns

The result of the last invocation of ma

method Eff<RT, A> repeatUntil <RT, A> (Eff<RT, A> ma, Func<A, bool> predicate) Source #

where RT : struct

Keeps repeating the computation until it fails or the predicate returns true

Parameters

type RT

Runtime

type A

Computation bound value type

param ma

Computation to repeat

returns

The result of the last invocation of ma

method Eff<A> repeatUntil <A> (Eff<A> ma, Func<A, bool> predicate) Source #

Keeps repeating the computation until it fails or the predicate returns true

Parameters

type RT

Runtime

type A

Computation bound value type

param ma

Computation to repeat

returns

The result of the last invocation of ma

method Eff<RT, A> repeatUntil <RT, A> (Schedule schedule, Eff<RT, A> ma, Func<A, bool> predicate) Source #

where RT : struct

Keeps repeating the computation until it fails or the predicate returns true

Parameters

type RT

Runtime

type A

Computation bound value type

param schedule

Scheduler strategy for repeating

param ma

Computation to repeat

returns

The result of the last invocation of ma

method Eff<A> repeatUntil <A> (Schedule schedule, Eff<A> ma, Func<A, bool> predicate) Source #

Keeps repeating the computation until it fails or the predicate returns true

Parameters

type RT

Runtime

type A

Computation bound value type

param schedule

Scheduler strategy for repeating

param ma

Computation to repeat

returns

The result of the last invocation of ma

class Prelude Source #

Methods

method Eff<RT, A> retry <RT, A> (Eff<RT, A> ma) Source #

where RT : struct

Keeps retrying the computation

Parameters

type RT

Runtime

type A

Computation bound value type

param ma

Computation to retry

returns

The result of the last invocation of ma

method Eff<A> retry <A> (Eff<A> ma) Source #

Keeps retrying the computation

Parameters

type RT

Runtime

type A

Computation bound value type

param ma

Computation to retry

returns

The result of the last invocation of ma

method Eff<RT, A> retry <RT, A> (Schedule schedule, Eff<RT, A> ma) Source #

where RT : struct

Keeps retrying the computation, until the scheduler expires

Parameters

type RT

Runtime

type A

Computation bound value type

param schedule

Scheduler strategy for retrying

param ma

Computation to retry

returns

The result of the last invocation of ma

method Eff<A> retry <A> (Schedule schedule, Eff<A> ma) Source #

Keeps retrying the computation, until the scheduler expires

Parameters

type RT

Runtime

type A

Computation bound value type

param schedule

Scheduler strategy for retrying

param ma

Computation to retry

returns

The result of the last invocation of ma

method Eff<RT, A> retryWhile <RT, A> (Eff<RT, A> ma, Func<Error, bool> predicate) Source #

where RT : struct

Keeps retrying the computation until the predicate returns false

Parameters

type RT

Runtime

type A

Computation bound value type

param ma

Computation to retry

returns

The result of the last invocation of ma

method Eff<A> retryWhile <A> (Eff<A> ma, Func<Error, bool> predicate) Source #

Keeps retrying the computation until the predicate returns false

Parameters

type RT

Runtime

type A

Computation bound value type

param ma

Computation to retry

returns

The result of the last invocation of ma

method Eff<RT, A> retryWhile <RT, A> (Schedule schedule, Eff<RT, A> ma, Func<Error, bool> predicate) Source #

where RT : struct

Keeps retrying the computation, until the scheduler expires, or the predicate returns false

Parameters

type RT

Runtime

type A

Computation bound value type

param schedule

Scheduler strategy for retrying

param ma

Computation to retry

returns

The result of the last invocation of ma

method Eff<A> retryWhile <A> (Schedule schedule, Eff<A> ma, Func<Error, bool> predicate) Source #

Keeps retrying the computation, until the scheduler expires, or the predicate returns false

Parameters

type RT

Runtime

type A

Computation bound value type

param schedule

Scheduler strategy for retrying

param ma

Computation to retry

returns

The result of the last invocation of ma

method Eff<RT, A> retryUntil <RT, A> (Eff<RT, A> ma, Func<Error, bool> predicate) Source #

where RT : struct

Keeps retrying the computation until the predicate returns true

Parameters

type RT

Runtime

type A

Computation bound value type

param ma

Computation to retry

returns

The result of the last invocation of ma

method Eff<A> retryUntil <A> (Eff<A> ma, Func<Error, bool> predicate) Source #

Keeps retrying the computation until the predicate returns true

Parameters

type RT

Runtime

type A

Computation bound value type

param ma

Computation to retry

returns

The result of the last invocation of ma

method Eff<RT, A> retryUntil <RT, A> (Schedule schedule, Eff<RT, A> ma, Func<Error, bool> predicate) Source #

where RT : struct

Keeps retrying the computation, until the scheduler expires, or the predicate returns true

Parameters

type RT

Runtime

type A

Computation bound value type

param schedule

Scheduler strategy for retrying

param ma

Computation to retry

returns

The result of the last invocation of ma

method Eff<A> retryUntil <A> (Schedule schedule, Eff<A> ma, Func<Error, bool> predicate) Source #

Keeps retrying the computation, until the scheduler expires, or the predicate returns true

Parameters

type RT

Runtime

type A

Computation bound value type

param schedule

Scheduler strategy for retrying

param ma

Computation to retry

returns

The result of the last invocation of ma

class Prelude Source #

Methods

method Aff<R> use <H, R> (Eff<H> Acq, Func<H, Aff<R>> Use) Source #

where H : IDisposable

Safely use a disposable resource

Parameters

param Acq

Acquire resource

param Use

Use resource

method Aff<RT, R> use <RT, H, R> (Eff<H> Acq, Func<H, Aff<RT, R>> Use) Source #

where RT : struct, HasCancel<RT>
where H : IDisposable

Safely use a disposable resource

Parameters

param Acq

Acquire resource

param Use

Use resource

method Eff<R> use <H, R> (Eff<H> Acq, Func<H, Eff<R>> Use) Source #

where H : IDisposable

Safely use a disposable resource

Parameters

param Acq

Acquire resource

param Use

Use resource

method Eff<RT, R> use <RT, H, R> (Eff<H> Acq, Func<H, Eff<RT, R>> Use) Source #

where RT : struct
where H : IDisposable

Safely use a disposable resource

Parameters

param Acq

Acquire resource

param Use

Use resource

method Aff<RT, R> use <RT, H, R> (Eff<RT, H> Acq, Func<H, Aff<R>> Use) Source #

where RT : struct, HasCancel<RT>
where H : IDisposable

Safely use a disposable resource

Parameters

param Acq

Acquire resource

param Use

Use resource

method Aff<RT, R> use <RT, H, R> (Eff<RT, H> Acq, Func<H, Aff<RT, R>> Use) Source #

where RT : struct, HasCancel<RT>
where H : IDisposable

Safely use a disposable resource

Parameters

param Acq

Acquire resource

param Use

Use resource

method Eff<RT, R> use <RT, H, R> (Eff<RT, H> Acq, Func<H, Eff<R>> Use) Source #

where RT : struct
where H : IDisposable

Safely use a disposable resource

Parameters

param Acq

Acquire resource

param Use

Use resource

method Eff<RT, R> use <RT, H, R> (Eff<RT, H> Acq, Func<H, Eff<RT, R>> Use) Source #

where RT : struct
where H : IDisposable

Safely use a disposable resource

Parameters

param Acq

Acquire resource

param Use

Use resource