LanguageExt.Core

LanguageExt.Core Effects Aff

Contents

Sub modules

Catch
Extensions
Prelude

struct Aff <RT, A> Source #

where RT : struct, HasCancel<RT>

Asynchronous effect monad

Methods

method ValueTask<Fin<A>> Run (RT runtime) Source #

Invoke the effect

method ValueTask<Unit> RunUnit (RT runtime) Source #

Invoke the effect

Throws on error

method Aff<RT, A> Memo () Source #

Memoise the result, so subsequent calls don't invoke the side-effect

method Eff<RT, Eff<Unit>> Fork () Source #

Launch the async computation without awaiting the result

If the parent expression has cancel called on it, then it will also cancel the forked child expression.

Fork returns an Eff<Unit> as its bound result value. If you run it, it will cancel the forked child expression.

Parameters

returns

Returns an Eff<Unit> as its bound value. If it runs, it will cancel the forked child expression

method Aff<RT, A> Effect (Func<RT, ValueTask<A>> f) Source #

Lift an asynchronous effect into the Aff monad

method Aff<RT, A> EffectMaybe (Func<RT, ValueTask<Fin<A>>> f) Source #

Lift an asynchronous effect into the Aff monad

method Aff<RT, Unit> Effect (Func<RT, ValueTask> f) Source #

Lift an asynchronous effect into the Aff monad

method Aff<RT, A> Success (A value) Source #

Lift a value into the Aff monad

method Aff<RT, A> Fail (Error error) Source #

Lift a failure into the Aff monad

method Aff<RT, A> Timeout (TimeSpan timeoutDelay) Source #

Force the operation to end after a time out delay

Parameters

param timeoutDelay

Delay for the time out

returns

Either success if the operation completed before the timeout, or Errors.TimedOut

Operators

operator | (Aff<RT, A> ma, Aff<RT, A> mb) Source #

operator | (Aff<RT, A> ma, Aff<A> mb) Source #

operator | (Aff<A> ma, Aff<RT, A> mb) Source #

operator | (Aff<RT, A> ma, Eff<RT, A> mb) Source #

operator | (Eff<RT, A> ma, Aff<RT, A> mb) Source #

operator | (Eff<A> ma, Aff<RT, A> mb) Source #

operator | (Aff<RT, A> ma, Eff<A> mb) Source #

operator | (Aff<RT, A> ma, EffCatch<A> mb) Source #

operator | (Aff<RT, A> ma, AffCatch<A> mb) Source #

operator | (Aff<RT, A> ma, EffCatch<RT, A> mb) Source #

operator | (Aff<RT, A> ma, AffCatch<RT, A> mb) Source #

operator | (Aff<RT, A> ma, CatchValue<A> value) Source #

operator | (Aff<RT, A> ma, CatchError value) Source #

class AffGuards Source #

Methods

method Aff<B> SelectMany <B> (this Guard<Error> ma, Func<Unit, Aff<B>> f) Source #

method Aff<RT, B> SelectMany <RT, B> (this Guard<Error> ma, Func<Unit, Aff<RT, B>> f) Source #

where RT : struct, HasCancel<RT>

method Aff<C> SelectMany <B, C> (this Guard<Error> ma, Func<Unit, Aff<B>> bind, Func<Unit, B, C> project) Source #

method Aff<RT, C> SelectMany <RT, B, C> (this Guard<Error> ma, Func<Unit, Aff<RT, B>> bind, Func<Unit, B, C> project) Source #

where RT : struct, HasCancel<RT>

method Aff<Unit> ToAff (this Guard<Error> ma) Source #

method Aff<RT, Unit> ToAff <RT> (this Guard<Error> ma) Source #

where RT : struct, HasCancel<RT>

method Aff<Unit> SelectMany <A> (this Aff<A> ma, Func<A, Guard<Error>> f) Source #

method Aff<RT, Unit> SelectMany <RT, A> (this Aff<RT, A> ma, Func<A, Guard<Error>> f) Source #

where RT : struct, HasCancel<RT>

method Aff<C> SelectMany <A, C> (this Aff<A> ma, Func<A, Guard<Error>> bind, Func<A, Unit, C> project) Source #

method Aff<RT, C> SelectMany <RT, A, C> (this Aff<RT, A> ma, Func<A, Guard<Error>> bind, Func<A, Unit, C> project) Source #

where RT : struct, HasCancel<RT>

struct Aff <A> Source #

Asynchronous effect monad

Methods

method ValueTask<Fin<A>> Run () Source #

Invoke the effect

method ValueTask<Unit> RunUnit () Source #

Invoke the effect

Throws on error

method Aff<A> Memo () Source #

Memoise the result, so subsequent calls don't invoke the side-effect

method Eff<Unit> Fork () Source #

Launch the async computation without awaiting the result

Parameters

returns

method Aff<A> Effect (Func<ValueTask<A>> f) Source #

Custom awaiter so Aff can be used with async/await

Lift an asynchronous effect into the Aff monad

method Aff<A> EffectMaybe (Func<ValueTask<Fin<A>>> f) Source #

Lift an asynchronous effect into the Aff monad

method Aff<Unit> Effect (Func<ValueTask> f) Source #

Lift an asynchronous effect into the Aff monad

method Aff<A> Success (A value) Source #

Lift a value into the Aff monad

method Aff<A> Fail (Error error) Source #

Lift a failure into the Aff monad

method Aff<A> Timeout (TimeSpan timeoutDelay) Source #

Force the operation to end after a time out delay

Note, the original operation continues even after this returns. To cancel the original operation at the same time as the timeout triggers, use Aff<RT, A> instead of Aff - as it supports cancellation tokens, and so can automatically cancel the long-running operation

Parameters

param timeoutDelay

Delay for the time out

returns

Either success if the operation completed before the timeout, or Errors.TimedOut

method Aff<RT, A> WithRuntime <RT> () Source #

where RT : struct, HasCancel<RT>

method ValueTask<S> Fold <S> (S state, Func<S, A, S> f) Source #

method ValueTask<bool> Exists (Func<A, bool> f) Source #

method ValueTask<bool> ForAll (Func<A, bool> f) Source #

Operators

operator | (Aff<A> ma, Aff<A> mb) Source #

operator | (Aff<A> ma, Eff<A> mb) Source #

operator | (Eff<A> ma, Aff<A> mb) Source #

operator | (Aff<A> ma, EffCatch<A> mb) Source #

operator | (Aff<A> ma, AffCatch<A> mb) Source #

operator | (Aff<A> ma, CatchValue<A> value) Source #

operator | (Aff<A> ma, CatchError value) Source #