LanguageExt.Core

LanguageExt.Core Monads Alternative Value Monads Try TryOptionAsync

Contents

delegate TryOptionAsync <A> Source #

The Try monad captures exceptions and uses them to cancel the computation. Primarily useful for expression based processing of errors.

To invoke directly, call x.Try()

Parameters

returns

A value that represents the outcome of the computation, either Success or Failure

class TryOptionAsyncExtensions Source #

Extension methods for the TryOptionAsync monad

Methods

method ValueTask<object> Case <A> (this TryOptionAsync<A> ma) Source #

Use for pattern-matching the case of the target

TryOptionAsync Some = result is A
TryOptionAsync None = result is null
TryOptionAsync Fail = result is LanguageExt.Common.Error

method TryOptionAsync<A> Memo <A> (this TryOptionAsync<A> ma) Source #

Memoize the computation so that it's only run once

method TryOptionAsync<A> Retry <A> (TryOptionAsync<A> ma, int amount = 3) Source #

If the TryOptionAsync fails, retry amount times

Parameters

type A

Type of bound value

param ma

TryOptionAsync

param amount

Amount of retries

returns

TryOptionAsync

method TryOptionAsync<A> RetryBackOff <A> (TryOptionAsync<A> ma, int backOffMilliSeconds, int amount = 3) Source #

If the TryOptionAsync fails, retry amount times whilst backing off backOffMilliSeconds

Parameters

type A

Type of bound value

param ma

TryOptionAsync

param backOffMilliSeconds

Amount of time in milliseconds to back-off upon failure. The back-off time is added to itself on each retry. i.e. 100, 200, 400, 800, 1600...

param amount

Amount of retries

returns

TryOptionAsync

method TryOptionAsync<A> Strict <A> (this TryOptionAsync<A> ma) Source #

Forces evaluation of the lazy TryOptionAsync

Parameters

type A

Bound value type

param ma

Computation to evaluate

returns

The TryOption with the computation executed

method TaskAwaiter<TryOption<A>> GetAwaiter <A> (this TryOptionAsync<A> ma) Source #

Custom awaiter that turns an TryOptionAsync into an TryOption

method Task<bool> IsSome <A> (this TryOptionAsync<A> ma) Source #

Test if the TryOptionAsync is in a success state

Parameters

type A

Bound value type

param ma

Computation to evaluate

returns

True if computation has succeeded

method Task<bool> IsFail <A> (this TryOptionAsync<A> ma) Source #

Test if the TryOptionAsync is in a Fail state

Parameters

type A

Bound value type

param ma

Computation to evaluate

returns

True if computation is faulted

method Task<bool> IsNoneOrFail <A> (this TryOptionAsync<A> ma) Source #

Test if the TryOptionAsync is in a None or Fail state

Parameters

type A

Bound value type

param ma

Computation to evaluate

returns

True if computation is faulted

method Task<bool> IsNone <A> (this TryOptionAsync<A> ma) Source #

Test if the TryOptionAsync is in a None state

Parameters

type A

Bound value type

param ma

Computation to evaluate

returns

True if computation is faulted

method Task<Unit> IfSome <A> (this TryOptionAsync<A> self, Action<A> Some) Source #

Invoke a delegate if the computation returns a value successfully

Parameters

param Some

Delegate to invoke if successful

method Task<A> IfNoneOrFail <A> (this TryOptionAsync<A> self, A defaultValue) Source #

Return a default value if the computation fails or completes successfully but returns None

Parameters

param Some

Delegate to invoke if successful

method Task<Unit> IfNoneOrFail <A> (this TryOptionAsync<A> self, Action None) Source #

Invoke a delegate if the computation fails or completes successfully but returns None

Parameters

param Some

Delegate to invoke if successful

method Task<A> IfNoneOrFail <A> (this TryOptionAsync<A> self, Func<A> None) Source #

Invoke a delegate if the computation fails or completes successfully but returns None

Parameters

param Some

Delegate to invoke if successful

method Task<A> IfNoneOrFail <A> (this TryOptionAsync<A> self, Func<Task<A>> None) Source #

Invoke a delegate if the computation fails or completes successfully but returns None

Parameters

param Some

Delegate to invoke if successful

method Task<A> IfNoneOrFail <A> (this TryOptionAsync<A> self, Func<A> None, Func<Exception, A> Fail) Source #

Invoke a delegate if the computation fails or completes successfully but returns None

Parameters

param Some

Delegate to invoke if successful

method Task<A> IfNoneOrFail <A> (this TryOptionAsync<A> self, Func<Task<A>> None, Func<Exception, A> Fail) Source #

Invoke a delegate if the computation fails or completes successfully but returns None

Parameters

param Some

Delegate to invoke if successful

method Task<A> IfNoneOrFail <A> (this TryOptionAsync<A> self, Func<A> None, Func<Exception, Task<A>> Fail) Source #

Invoke a delegate if the computation fails or completes successfully but returns None

Parameters

param Some

Delegate to invoke if successful

method Task<A> IfNoneOrFail <A> (this TryOptionAsync<A> self, Func<Task<A>> None, Func<Exception, Task<A>> Fail) Source #

Invoke a delegate if the computation fails or completes successfully but returns None

Parameters

param Some

Delegate to invoke if successful

method ExceptionMatchOptionalAsync<A> IfFail <A> (this TryOptionAsync<A> self) Source #

Provides a fluent exception matching interface which is invoked when the computation fails.

Parameters

returns

Fluent exception matcher

method Task<Unit> IfFail <A> (this TryOptionAsync<A> self, Action<Exception> Fail) Source #

Invoke an action if the TryOptionAsync fails

Parameters

type A

Type of bound value

param self

TryOptionAsync computation

param Fail

The delegate to invoke if the TryOptionAsync computation fails

method Task<R> Match <A, R> (this TryOptionAsync<A> self, Func<A, R> Succ, R Fail) Source #

Pattern matches the three possible states of the computation computation

Parameters

type R

Type of the resulting bound value

param Succ

Delegate to invoke if the computation completes successfully

param Fail

Value to use if the computation fails

returns

The result of either the Succ, None, or Fail delegate

method Task<R> MatchUnsafe <A, R> (this TryOptionAsync<A> self, Func<A, R> Succ, R Fail) Source #

Pattern matches the three possible states of the computation computation

Parameters

type R

Type of the resulting bound value

param Succ

Delegate to invoke if the computation completes successfully

param Fail

Value to use if the computation fails

returns

The result of either the Succ, None, or Fail delegate

method Task<Unit> Match <A> (this TryOptionAsync<A> self, Action<A> Succ, Action Fail) Source #

Pattern matches the three possible states of the computation computation

Parameters

param Succ

Delegate to invoke if the computation completes successfully

param Fail

Delegate to invoke if the computation fails

returns

The result of either the Succ, None, or Fail delegate

method Task<Unit> MatchAsync <A> (this TryOptionAsync<A> self, Func<A, Task> SuccAsync, Action Fail) Source #

Pattern matches the three possible states of the computation computation

Parameters

param SuccAsync

Delegate to invoke if the computation completes successfully

param Fail

Delegate to invoke if the computation fails

returns

The result of either the Succ, None, or Fail delegate

method Task<Unit> MatchAsync <A> (this TryOptionAsync<A> self, Action<A> Succ, Func<Task> FailAsync) Source #

Pattern matches the three possible states of the computation computation

Parameters

param SuccAsync

Delegate to invoke if the computation completes successfully

param FailAsync

Delegate to invoke if the computation fails

returns

The result of either the Succ, None, or Fail delegate

method Task<Unit> MatchAsync <A> (this TryOptionAsync<A> self, Func<A, Task> SuccAsync, Func<Task> FailAsync) Source #

Pattern matches the three possible states of the computation computation

Parameters

param SuccAsync

Delegate to invoke if the computation completes successfully

param FailAsync

Delegate to invoke if the computation fails

returns

The result of either the Succ, None, or Fail delegate

method Task<R> Match <A, R> (this TryOptionAsync<A> self, Func<A, R> Succ, Func<R> Fail) Source #

Pattern matches the three possible states of the computation computation

Parameters

type R

Type of the resulting bound value

param Succ

Delegate to invoke if the computation completes successfully

param Fail

Delegate to invoke if the computation fails

returns

The result of either the Succ, None, or Fail delegate

method Task<R> MatchUnsafe <A, R> (this TryOptionAsync<A> self, Func<A, R> Succ, Func<R> Fail) Source #

Pattern matches the three possible states of the computation computation

Parameters

type R

Type of the resulting bound value

param Succ

Delegate to invoke if the computation completes successfully

param Fail

Delegate to invoke if the computation fails

returns

The result of either the Succ, None, or Fail delegate

method Task<R> MatchUnsafe <A, R> (this TryOptionAsync<A> self, Func<A, R> Succ, Func<R> None, Func<Exception, R> Fail) Source #

Pattern matches the three possible states of the computation computation

Parameters

type R

Type of the resulting bound value

param Succ

Delegate to invoke if the computation completes successfully

param Fail

Delegate to invoke if the computation fails

returns

The result of either the Succ, None, or Fail delegate

method Task<R> MatchAsync <A, R> (this TryOptionAsync<A> self, Func<A, R> Succ, Func<Task<R>> FailAsync) Source #

Pattern matches the three possible states of the computation computation

Parameters

type R

Type of the resulting bound value

param Succ

Delegate to invoke if the computation completes successfully

param FailAsync

Delegate to invoke if the computation fails

returns

The result of either the Succ, Fail delegate

method Task<R> MatchUnsafeAsync <A, R> (this TryOptionAsync<A> self, Func<A, R> Succ, Func<Task<R>> FailAsync) Source #

Pattern matches the three possible states of the computation computation

Parameters

type R

Type of the resulting bound value

param Succ

Delegate to invoke if the computation completes successfully

param FailAsync

Delegate to invoke if the computation fails

returns

The result of either the Succ, Fail delegate

method Task<R> MatchAsync <A, R> (this TryOptionAsync<A> self, Func<A, Task<R>> SuccAsync, Func<R> Fail) Source #

Pattern matches the three possible states of the computation computation

Parameters

type R

Type of the resulting bound value

param SuccAsync

Delegate to invoke if the computation completes successfully

param Fail

Delegate to invoke if the computation fails

returns

The result of either the Succ, Fail delegate

method Task<R> MatchUnsafeAsync <A, R> (this TryOptionAsync<A> self, Func<A, Task<R>> SuccAsync, Func<R> Fail) Source #

Pattern matches the three possible states of the computation computation

Parameters

type R

Type of the resulting bound value

param SuccAsync

Delegate to invoke if the computation completes successfully

param Fail

Delegate to invoke if the computation fails

returns

The result of either the Succ, Fail delegate

method Task<R> MatchAsync <A, R> (this TryOptionAsync<A> self, Func<A, Task<R>> SuccAsync, Func<Task<R>> FailAsync) Source #

Pattern matches the three possible states of the computation computation

Parameters

type R

Type of the resulting bound value

param SuccAsync

Delegate to invoke if the computation completes successfully

param FailAsync

Delegate to invoke if the computation fails

returns

The result of either the Succ, Fail delegate

method Task<R> MatchUnsafeAsync <A, R> (this TryOptionAsync<A> self, Func<A, Task<R>> SuccAsync, Func<Task<R>> FailAsync) Source #

Pattern matches the three possible states of the computation computation

Parameters

type R

Type of the resulting bound value

param SuccAsync

Delegate to invoke if the computation completes successfully

param FailAsync

Delegate to invoke if the computation fails

returns

The result of either the Succ, Fail delegate

method Task<R> Match <A, R> (this TryOptionAsync<A> self, Func<A, R> Some, Func<R> None, Func<Exception, R> Fail) Source #

Pattern matches the three possible states of the computation computation

Parameters

type R

Type of the resulting bound value

param Some

Delegate to invoke if the computation completes successfully

param None

Delegate to invoke if the computation completes successfully but returns no value

param Fail

Delegate to invoke if the computation fails

returns

The result of either the Succ, None, or Fail delegate

method Task<R> MatchUntypedUnsafe <A, R> (this TryOptionAsync<A> self, Func<A, R> Some, Func<R> None, Func<Exception, R> Fail) Source #

Pattern matches the three possible states of the computation computation

Parameters

type R

Type of the resulting bound value

param Some

Delegate to invoke if the computation completes successfully

param None

Delegate to invoke if the computation completes successfully but returns no value

param Fail

Delegate to invoke if the computation fails

returns

The result of either the Succ, None, or Fail delegate

method Task<R> MatchAsync <A, R> (this TryOptionAsync<A> self, Func<A, R> Some, Func<Task<R>> NoneAsync, Func<Exception, R> Fail) Source #

Pattern matches the three possible states of the computation

Parameters

type R

Type of the resulting bound value

param Some

Delegate to invoke if the computation completes successfully

param NoneAsync

Delegate to invoke if the computation completes successfully but returns no value

param Fail

Delegate to invoke if the computation fails

returns

The result of either the Succ, None, or Fail delegate

method Task<R> MatchUnsafeAsync <A, R> (this TryOptionAsync<A> self, Func<A, R> Some, Func<Task<R>> NoneAsync, Func<Exception, R> Fail) Source #

Pattern matches the three possible states of the computation

Parameters

type R

Type of the resulting bound value

param Some

Delegate to invoke if the computation completes successfully

param NoneAsync

Delegate to invoke if the computation completes successfully but returns no value

param Fail

Delegate to invoke if the computation fails

returns

The result of either the Succ, None, or Fail delegate

method Task<R> MatchAsync <A, R> (this TryOptionAsync<A> self, Func<A, Task<R>> SomeAsync, Func<R> None, Func<Exception, R> Fail) Source #

Pattern matches the three possible states of the computation

Parameters

type R

Type of the resulting bound value

param SomeAsync

Delegate to invoke if the computation completes successfully

param None

Delegate to invoke if the computation completes successfully but returns no value

param Fail

Delegate to invoke if the computation fails

returns

The result of either the Succ, None, or Fail delegate

method Task<R> MatchUnsafeAsync <A, R> (this TryOptionAsync<A> self, Func<A, Task<R>> SomeAsync, Func<R> None, Func<Exception, R> Fail) Source #

Pattern matches the three possible states of the computation

Parameters

type R

Type of the resulting bound value

param SomeAsync

Delegate to invoke if the computation completes successfully

param None

Delegate to invoke if the computation completes successfully but returns no value

param Fail

Delegate to invoke if the computation fails

returns

The result of either the Succ, None, or Fail delegate

method Task<R> MatchAsync <A, R> (this TryOptionAsync<A> self, Func<A, Task<R>> SomeAsync, Func<Task<R>> NoneAsync, Func<Exception, R> Fail) Source #

Pattern matches the three possible states of the computation

Parameters

type R

Type of the resulting bound value

param SomeAsync

Delegate to invoke if the computation completes successfully

param NoneAsync

Delegate to invoke if the computation completes successfully but returns no value

param Fail

Delegate to invoke if the computation fails

returns

The result of either the Succ, None, or Fail delegate

method Task<R> MatchUnsafeAsync <A, R> (this TryOptionAsync<A> self, Func<A, Task<R>> SomeAsync, Func<Task<R>> NoneAsync, Func<Exception, R> Fail) Source #

Pattern matches the three possible states of the computation

Parameters

type R

Type of the resulting bound value

param SomeAsync

Delegate to invoke if the computation completes successfully

param NoneAsync

Delegate to invoke if the computation completes successfully but returns no value

param Fail

Delegate to invoke if the computation fails

returns

The result of either the Succ, None, or Fail delegate

method Task<R> MatchAsync <A, R> (this TryOptionAsync<A> self, Func<A, R> Some, Func<R> None, Func<Exception, Task<R>> FailAsync) Source #

Pattern matches the three possible states of the computation

Parameters

type R

Type of the resulting bound value

param Some

Delegate to invoke if the computation completes successfully

param None

Delegate to invoke if the computation completes successfully but returns no value

param FailAsync

Delegate to invoke if the computation fails

returns

The result of either the Succ, None, or Fail delegate

method Task<R> MatchUnsafeAsync <A, R> (this TryOptionAsync<A> self, Func<A, R> Some, Func<R> None, Func<Exception, Task<R>> FailAsync) Source #

Pattern matches the three possible states of the computation

Parameters

type R

Type of the resulting bound value

param Some

Delegate to invoke if the computation completes successfully

param None

Delegate to invoke if the computation completes successfully but returns no value

param FailAsync

Delegate to invoke if the computation fails

returns

The result of either the Succ, None, or Fail delegate

method Task<R> MatchAsync <A, R> (this TryOptionAsync<A> self, Func<A, R> Some, Func<Task<R>> NoneAsync, Func<Exception, Task<R>> FailAsync) Source #

Pattern matches the three possible states of the computation

Parameters

type R

Type of the resulting bound value

param Some

Delegate to invoke if the computation completes successfully

param NoneAsync

Delegate to invoke if the computation completes successfully but returns no value

param FailAsync

Delegate to invoke if the computation fails

returns

The result of either the Succ, None, or Fail delegate

method Task<R> MatchUnsafeAsync <A, R> (this TryOptionAsync<A> self, Func<A, R> Some, Func<Task<R>> NoneAsync, Func<Exception, Task<R>> FailAsync) Source #

Pattern matches the three possible states of the computation

Parameters

type R

Type of the resulting bound value

param Some

Delegate to invoke if the computation completes successfully

param NoneAsync

Delegate to invoke if the computation completes successfully but returns no value

param FailAsync

Delegate to invoke if the computation fails

returns

The result of either the Succ, None, or Fail delegate

method Task<R> MatchAsync <A, R> (this TryOptionAsync<A> self, Func<A, Task<R>> SomeAsync, Func<R> None, Func<Exception, Task<R>> FailAsync) Source #

Pattern matches the three possible states of the computation

Parameters

type R

Type of the resulting bound value

param SomeAsync

Delegate to invoke if the computation completes successfully

param None

Delegate to invoke if the computation completes successfully but returns no value

param FailAsync

Delegate to invoke if the computation fails

returns

The result of either the Succ, None, or Fail delegate

method Task<R> MatchUnsafeAsync <A, R> (this TryOptionAsync<A> self, Func<A, Task<R>> SomeAsync, Func<R> None, Func<Exception, Task<R>> FailAsync) Source #

Pattern matches the three possible states of the computation

Parameters

type R

Type of the resulting bound value

param SomeAsync

Delegate to invoke if the computation completes successfully

param None

Delegate to invoke if the computation completes successfully but returns no value

param FailAsync

Delegate to invoke if the computation fails

returns

The result of either the Succ, None, or Fail delegate

method Task<R> MatchAsync <A, R> (this TryOptionAsync<A> self, Func<A, Task<R>> SomeAsync, Func<Task<R>> NoneAsync, Func<Exception, Task<R>> FailAsync) Source #

Pattern matches the three possible states of the computation

Parameters

type R

Type of the resulting bound value

param SomeAsync

Delegate to invoke if the computation completes successfully

param NoneAsync

Delegate to invoke if the computation completes successfully but returns no value

param FailAsync

Delegate to invoke if the computation fails

returns

The result of either the Succ, None, or Fail delegate

method Task<R> MatchUnsafeAsync <A, R> (this TryOptionAsync<A> self, Func<A, Task<R>> SomeAsync, Func<Task<R>> NoneAsync, Func<Exception, Task<R>> FailAsync) Source #

Pattern matches the three possible states of the computation

Parameters

type R

Type of the resulting bound value

param SomeAsync

Delegate to invoke if the computation completes successfully

param NoneAsync

Delegate to invoke if the computation completes successfully but returns no value

param FailAsync

Delegate to invoke if the computation fails

returns

The result of either the Succ, None, or Fail delegate

method Task<R> Match <A, R> (this TryOptionAsync<A> self, Func<A, R> Some, Func<R> None, R Fail) Source #

Pattern matches the three possible states of the computation

Parameters

type R

Type of the resulting bound value

param Some

Delegate to invoke if the computation completes successfully

param None

Delegate to invoke if the computation completes successfully but returns no value

param Fail

Delegate to invoke if the computation fails

returns

The result of either the Succ, None, or Fail delegate

method Task<R> MatchUnsafe <A, R> (this TryOptionAsync<A> self, Func<A, R> Some, Func<R> None, R Fail) Source #

Pattern matches the three possible states of the computation

Parameters

type R

Type of the resulting bound value

param Some

Delegate to invoke if the computation completes successfully

param None

Delegate to invoke if the computation completes successfully but returns no value

param Fail

Delegate to invoke if the computation fails

returns

The result of either the Succ, None, or Fail delegate

method Task<R> MatchAsync <A, R> (this TryOptionAsync<A> self, Func<A, R> Some, Func<Task<R>> NoneAsync, R Fail) Source #

Pattern matches the three possible states of the computation

Parameters

type R

Type of the resulting bound value

param Some

Delegate to invoke if the computation completes successfully

param NoneAsync

Delegate to invoke if the computation completes successfully but returns no value

param Fail

Delegate to invoke if the computation fails

returns

The result of either the Succ, None, or Fail delegate

method Task<R> MatchUnsafeAsync <A, R> (this TryOptionAsync<A> self, Func<A, R> Some, Func<Task<R>> NoneAsync, R Fail) Source #

Pattern matches the three possible states of the computation

Parameters

type R

Type of the resulting bound value

param Some

Delegate to invoke if the computation completes successfully

param NoneAsync

Delegate to invoke if the computation completes successfully but returns no value

param Fail

Delegate to invoke if the computation fails

returns

The result of either the Succ, None, or Fail delegate

method Task<R> MatchAsync <A, R> (this TryOptionAsync<A> self, Func<A, Task<R>> SomeAsync, Func<R> None, R Fail) Source #

Pattern matches the three possible states of the computation

Parameters

type R

Type of the resulting bound value

param SomeAsync

Delegate to invoke if the computation completes successfully

param None

Delegate to invoke if the computation completes successfully but returns no value

param Fail

Delegate to invoke if the computation fails

returns

The result of either the Succ, None, or Fail delegate

method Task<R> MatchUnsafeAsync <A, R> (this TryOptionAsync<A> self, Func<A, Task<R>> SomeAsync, Func<R> None, R Fail) Source #

Pattern matches the three possible states of the computation

Parameters

type R

Type of the resulting bound value

param SomeAsync

Delegate to invoke if the computation completes successfully

param None

Delegate to invoke if the computation completes successfully but returns no value

param Fail

Delegate to invoke if the computation fails

returns

The result of either the Succ, None, or Fail delegate

method Task<R> MatchAsync <A, R> (this TryOptionAsync<A> self, Func<A, Task<R>> SomeAsync, Func<Task<R>> NoneAsync, R Fail) Source #

Pattern matches the three possible states of the computation

Parameters

type R

Type of the resulting bound value

param SomeAsync

Delegate to invoke if the computation completes successfully

param NoneAsync

Delegate to invoke if the computation completes successfully but returns no value

param Fail

Delegate to invoke if the computation fails

returns

The result of either the Succ, None, or Fail delegate

method Task<R> MatchUnsafeAsync <A, R> (this TryOptionAsync<A> self, Func<A, Task<R>> SomeAsync, Func<Task<R>> NoneAsync, R Fail) Source #

Pattern matches the three possible states of the computation

Parameters

type R

Type of the resulting bound value

param SomeAsync

Delegate to invoke if the computation completes successfully

param NoneAsync

Delegate to invoke if the computation completes successfully but returns no value

param Fail

Delegate to invoke if the computation fails

returns

The result of either the Succ, None, or Fail delegate

method Task<Unit> Match <A> (this TryOptionAsync<A> self, Action<A> Some, Action None, Action<Exception> Fail) Source #

Pattern matches the three possible states of the computation

Parameters

type R

Type of the resulting bound value

param Some

Delegate to invoke if the computation completes successfully

param None

Delegate to invoke if the computation completes successfully but returns no value

param Fail

Delegate to invoke if the computation fails

returns

The result of either the Succ, None, or Fail delegate

method Task<Validation<Exception, Option<A>>> ToValidation <A> (this TryOptionAsync<A> self) Source #

method Aff<A> ToAff <A> (this TryOptionAsync<A> ma) Source #

Convert the structure to an Aff

Parameters

returns

An Aff representation of the structure

method Aff<A> ToAff <A> (this TryOptionAsync<A> ma, Error None) Source #

Convert the structure to an Aff

Parameters

returns

An Aff representation of the structure

method Aff<A> ToAff <A> (this TryOptionAsync<A> ma, Func<Error> None) Source #

Convert the structure to an Aff

Parameters

returns

An Aff representation of the structure

method Aff<A> ToAff <A> (this TryOptionAsync<A> ma, A None) Source #

Convert the structure to an Aff

Parameters

returns

An Aff representation of the structure

method Aff<A> ToAff <A> (this TryOptionAsync<A> ma, Func<A> None) Source #

Convert the structure to an Aff

Parameters

returns

An Aff representation of the structure

method Task<Option<A>> ToOption <A> (this TryOptionAsync<A> self) Source #

method Task<OptionUnsafe<A>> ToOptionUnsafe <A> (this TryOptionAsync<A> self) Source #

method Task<Either<Exception, Option<A>>> ToEither <A> (this TryOptionAsync<A> self) Source #

method Task<Either<L, Option<A>>> ToEither <A, L> (this TryOptionAsync<A> self, Func<Exception, L> Fail) Source #

method Task<EitherUnsafe<Exception, Option<A>>> ToEitherUnsafe <A> (this TryOptionAsync<A> self) Source #

method Task<EitherUnsafe<L, Option<A>>> ToEitherUnsafe <A, L> (this TryOptionAsync<A> self, Func<Exception, L> Fail) Source #

method TryAsync<Option<A>> ToTry <A> (this TryOptionAsync<A> self) Source #

method TryAsync<A> ToTry <A> (this TryOptionAsync<A> self, Func<A> None) Source #

method Task<A> IfFailThrow <A> (this TryOptionAsync<A> self) Source #

method TryOptionAsync<B> Select <A, B> (this TryOptionAsync<A> self, Func<A, B> select) Source #

Maps the bound value

Parameters

type A

Type of the bound value

type B

Resulting bound value type

param self

computation

param select

Delegate to map the bound value

returns

Mapped computation

method TryOptionAsync<B> Select <A, B> (this TryOptionAsync<A> self, Func<A, Task<B>> select) Source #

Maps the bound value

Parameters

type A

Type of the bound value

type B

Resulting bound value type

param self

computation

param select

Delegate to map the bound value

returns

Mapped computation

method Task<Unit> Iter <A> (this TryOptionAsync<A> self, Action<A> action) Source #

Apply computation values to a computation function of arity 2

Parameters

param self

computation function

param arg1

computation argument

param arg2

computation argument

returns

Returns the result of applying the computation arguments to the computation function

method Task<int> Count <A> (this TryOptionAsync<A> self) Source #

Counts the number of bound values.

Parameters

type T

Type of the bound value

param self

computation

returns

1 if the computation is successful, 0 otherwise.

method Task<bool> ForAll <A> (this TryOptionAsync<A> self, Func<A, bool> pred) Source #

Tests that a predicate holds for all values of the bound value T

Parameters

type T

Type of the bound value

param self

computation

param pred

Predicate to test the bound value against

returns

True if the predicate holds for the bound value, or if the computation fails. False otherwise.

method Task<bool> ForAllAsync <A> (this TryOptionAsync<A> self, Func<A, Task<bool>> pred) Source #

Tests that a predicate holds for all values of the bound value T

Parameters

type T

Type of the bound value

param self

computation

param pred

Predicate to test the bound value against

returns

True if the predicate holds for the bound value, or if the computation fails. False otherwise.

method Task<S> Fold <A, S> (this TryOptionAsync<A> self, S state, Func<S, A, S> folder) Source #

Parameters

param self

computation to fold

param state

Initial state

param folder

Fold function

returns

Folded state

method Task<S> FoldAsync <A, S> (this TryOptionAsync<A> self, S state, Func<S, A, Task<S>> folder) Source #

Parameters

param self

computation to fold

param state

Initial state

param folder

Fold function

returns

Folded state

method Task<S> BiFold <A, S> (this TryOptionAsync<A> self, S state, Func<S, A, S> Succ, Func<S, S> Fail) Source #

Parameters

param self

computation to fold

param state

Initial state

param Succ

Fold function for Success

param Fail

Fold function for Failure

returns

Folded state

method Task<S> BiFold <A, S> (this TryOptionAsync<A> self, S state, Func<S, A, S> Succ, Func<S, Task<S>> Fail) Source #

Parameters

param self

computation to fold

param state

Initial state

param Succ

Fold function for Success

param Fail

Fold function for Failure

returns

Folded state

method Task<S> BiFold <A, S> (this TryOptionAsync<A> self, S state, Func<S, A, Task<S>> Succ, Func<S, S> Fail) Source #

Parameters

param self

computation to fold

param state

Initial state

param Succ

Fold function for Success

param Fail

Fold function for Failure

returns

Folded state

method Task<S> BiFold <A, S> (this TryOptionAsync<A> self, S state, Func<S, A, Task<S>> Succ, Func<S, Task<S>> Fail) Source #

Parameters

param self

computation to fold

param state

Initial state

param Succ

Fold function for Success

param Fail

Fold function for Failure

returns

Folded state

method Task<S> TriFold <A, S> (this TryOptionAsync<A> self, S state, Func<S, A, S> Some, Func<S, S> None, Func<S, Exception, S> Fail) Source #

Parameters

param self

Try to fold

param state

Initial state

param Some

Fold function for Success

param None

Fold function for None

param Fail

Fold function for Failure

returns

Folded state

method Task<S> TriFold <A, S> (this TryOptionAsync<A> self, S state, Func<S, A, Task<S>> Some, Func<S, S> None, Func<S, Exception, S> Fail) Source #

Parameters

param self

Try to fold

param state

Initial state

param Some

Fold function for Success

param None

Fold function for None

param Fail

Fold function for Failure

returns

Folded state

method Task<S> TriFold <A, S> (this TryOptionAsync<A> self, S state, Func<S, A, S> Some, Func<S, Task<S>> None, Func<S, Exception, S> Fail) Source #

Parameters

param self

Try to fold

param state

Initial state

param Some

Fold function for Success

param None

Fold function for None

param Fail

Fold function for Failure

returns

Folded state

method Task<S> TriFold <A, S> (this TryOptionAsync<A> self, S state, Func<S, A, S> Some, Func<S, S> None, Func<S, Exception, Task<S>> Fail) Source #

Parameters

param self

Try to fold

param state

Initial state

param Some

Fold function for Success

param None

Fold function for None

param Fail

Fold function for Failure

returns

Folded state

method Task<S> TriFold <A, S> (this TryOptionAsync<A> self, S state, Func<S, A, Task<S>> Some, Func<S, Task<S>> None, Func<S, Exception, S> Fail) Source #

Parameters

param self

Try to fold

param state

Initial state

param Some

Fold function for Success

param None

Fold function for None

param Fail

Fold function for Failure

returns

Folded state

method Task<S> TriFold <A, S> (this TryOptionAsync<A> self, S state, Func<S, A, S> Some, Func<S, Task<S>> None, Func<S, Exception, Task<S>> Fail) Source #

Parameters

param self

Try to fold

param state

Initial state

param Some

Fold function for Success

param None

Fold function for None

param Fail

Fold function for Failure

returns

Folded state

method Task<S> TriFold <A, S> (this TryOptionAsync<A> self, S state, Func<S, A, Task<S>> Some, Func<S, Task<S>> None, Func<S, Exception, Task<S>> Fail) Source #

Parameters

param self

Try to fold

param state

Initial state

param Some

Fold function for Success

param None

Fold function for None

param Fail

Fold function for Failure

returns

Folded state

method Task<bool> Exists <A> (this TryOptionAsync<A> self, Func<A, bool> pred) Source #

Tests that a predicate holds for any value of the bound value T

Parameters

type A

Type of the bound value

param self

Try computation

param pred

Predicate to test the bound value against

returns

True if the predicate holds for the bound value. False otherwise.

method Task<bool> ExistsAsync <A> (this TryOptionAsync<A> self, Func<A, Task<bool>> pred) Source #

Tests that a predicate holds for any value of the bound value T

Parameters

type A

Type of the bound value

param self

Try computation

param pred

Predicate to test the bound value against

returns

True if the predicate holds for the bound value. False otherwise.

method TryOptionAsync<A> Do <A> (this TryOptionAsync<A> ma, Action<A> f) Source #

Impure iteration of the bound value in the structure

Parameters

returns

Returns the original unmodified structure

method TryOptionAsync<B> Map <A, B> (this TryOptionAsync<A> self, Func<A, B> f) Source #

Maps the bound value

Parameters

type A

Type of the bound value

type B

Resulting bound value type

param self

computation

param mapper

Delegate to map the bound value

returns

Mapped computation

method TryOptionAsync<B> MapAsync <A, B> (this TryOptionAsync<A> self, Func<A, Task<B>> f) Source #

Maps the bound value

Parameters

type A

Type of the bound value

type B

Resulting bound value type

param self

computation

param mapper

Delegate to map the bound value

returns

Mapped computation

method TryOptionAsync<B> BiMap <A, B> (this TryOptionAsync<A> self, Func<A, B> Succ, Func<B> Fail) Source #

Maps the bound value

Parameters

type A

Type of the bound value

type B

Resulting bound value type

param self

computation

param Succ

Delegate to map the bound value

param Fail

Delegate to map the exception to the desired bound result type

returns

Mapped computation

method TryOptionAsync<B> BiMap <A, B> (this TryOptionAsync<A> self, Func<A, Task<B>> Succ, Func<B> Fail) Source #

Maps the bound value

Parameters

type A

Type of the bound value

type B

Resulting bound value type

param self

computation

param Succ

Delegate to map the bound value

param Fail

Delegate to map the exception to the desired bound result type

returns

Mapped computation

method TryOptionAsync<B> BiMap <A, B> (this TryOptionAsync<A> self, Func<A, B> Succ, Func<Task<B>> Fail) Source #

Maps the bound value

Parameters

type A

Type of the bound value

type B

Resulting bound value type

param self

computation

param Succ

Delegate to map the bound value

param Fail

Delegate to map the exception to the desired bound result type

returns

Mapped computation

method TryOptionAsync<B> BiMap <A, B> (this TryOptionAsync<A> self, Func<A, Task<B>> Succ, Func<Task<B>> Fail) Source #

Maps the bound value

Parameters

type A

Type of the bound value

type B

Resulting bound value type

param self

computation

param Succ

Delegate to map the bound value

param Fail

Delegate to map the exception to the desired bound result type

returns

Mapped computation

method TryOptionAsync<B> TriMap <A, B> (this TryOptionAsync<A> self, Func<A, B> Some, Func<B> None, Func<Exception, B> Fail) Source #

Maps the bound value

Parameters

type A

Type of the bound value

type B

Resulting bound value type

param self

computation

param Some

Delegate to map the bound value

param None

Delegate to map the None to the desired bound result type

param Fail

Delegate to map the exception to the desired bound result type

returns

Mapped computation

method TryOptionAsync<B> TriMap <A, B> (this TryOptionAsync<A> self, Func<A, Task<B>> Some, Func<B> None, Func<Exception, B> Fail) Source #

Maps the bound value

Parameters

type A

Type of the bound value

type B

Resulting bound value type

param self

computation

param Some

Delegate to map the bound value

param None

Delegate to map the None to the desired bound result type

param Fail

Delegate to map the exception to the desired bound result type

returns

Mapped computation

method TryOptionAsync<B> TriMap <A, B> (this TryOptionAsync<A> self, Func<A, B> Some, Func<Task<B>> None, Func<Exception, B> Fail) Source #

Maps the bound value

Parameters

type A

Type of the bound value

type B

Resulting bound value type

param self

computation

param Some

Delegate to map the bound value

param None

Delegate to map the None to the desired bound result type

param Fail

Delegate to map the exception to the desired bound result type

returns

Mapped computation

method TryOptionAsync<B> TriMap <A, B> (this TryOptionAsync<A> self, Func<A, B> Some, Func<B> None, Func<Exception, Task<B>> Fail) Source #

Maps the bound value

Parameters

type A

Type of the bound value

type B

Resulting bound value type

param self

computation

param Some

Delegate to map the bound value

param None

Delegate to map the None to the desired bound result type

param Fail

Delegate to map the exception to the desired bound result type

returns

Mapped computation

method TryOptionAsync<B> TriMap <A, B> (this TryOptionAsync<A> self, Func<A, Task<B>> Some, Func<Task<B>> None, Func<Exception, B> Fail) Source #

Maps the bound value

Parameters

type A

Type of the bound value

type B

Resulting bound value type

param self

computation

param Some

Delegate to map the bound value

param None

Delegate to map the None to the desired bound result type

param Fail

Delegate to map the exception to the desired bound result type

returns

Mapped computation

method TryOptionAsync<B> TriMap <A, B> (this TryOptionAsync<A> self, Func<A, B> Some, Func<Task<B>> None, Func<Exception, Task<B>> Fail) Source #

Maps the bound value

Parameters

type A

Type of the bound value

type B

Resulting bound value type

param self

computation

param Some

Delegate to map the bound value

param None

Delegate to map the None to the desired bound result type

param Fail

Delegate to map the exception to the desired bound result type

returns

Mapped computation

method TryOptionAsync<B> TriMap <A, B> (this TryOptionAsync<A> self, Func<A, Task<B>> Some, Func<Task<B>> None, Func<Exception, Task<B>> Fail) Source #

Maps the bound value

Parameters

type A

Type of the bound value

type B

Resulting bound value type

param self

computation

param Some

Delegate to map the bound value

param None

Delegate to map the None to the desired bound result type

param Fail

Delegate to map the exception to the desired bound result type

returns

Mapped computation

method TryOptionAsync<Func<B, R>> ParMap <A, B, R> (this TryOptionAsync<A> self, Func<A, B, R> func) Source #

Partial application map

method TryOptionAsync<Func<B, Func<C, R>>> ParMap <A, B, C, R> (this TryOptionAsync<A> self, Func<A, B, C, R> func) Source #

Partial application map

method TryOptionAsync<A> Filter <A> (this TryOptionAsync<A> self, Func<A, bool> pred) Source #

method TryOptionAsync<A> Filter <A> (this TryOptionAsync<A> self, Func<A, Task<bool>> pred) Source #

method TryOptionAsync<A> BiFilter <A> (this TryOptionAsync<A> self, Func<A, bool> Succ, Func<bool> Fail) Source #

method TryOptionAsync<A> BiFilter <A> (this TryOptionAsync<A> self, Func<A, Task<bool>> Succ, Func<bool> Fail) Source #

method TryOptionAsync<A> BiFilter <A> (this TryOptionAsync<A> self, Func<A, bool> Succ, Func<Task<bool>> Fail) Source #

method TryOptionAsync<A> BiFilter <A> (this TryOptionAsync<A> self, Func<A, Task<bool>> Succ, Func<Task<bool>> Fail) Source #

method TryOptionAsync<A> Where <A> (this TryOptionAsync<A> self, Func<A, bool> pred) Source #

method TryOptionAsync<A> Where <A> (this TryOptionAsync<A> self, Func<A, Task<bool>> pred) Source #

method TryOptionAsync<B> Bind <A, B> (this TryOptionAsync<A> ma, Func<A, TryOptionAsync<B>> f) Source #

method TryOptionAsync<B> BindAsync <A, B> (this TryOptionAsync<A> self, Func<A, Task<TryOptionAsync<B>>> binder) Source #

method TryOptionAsync<R> BiBind <A, R> (this TryOptionAsync<A> self, Func<A, TryOptionAsync<R>> Succ, Func<TryOptionAsync<R>> Fail) Source #

method TryOptionAsync<A> Plus <A> (this TryOptionAsync<A> ma, TryOptionAsync<A> mb) Source #

method TryOptionAsync<A> PlusFirst <A> (this TryOptionAsync<A> ma, TryOptionAsync<A> mb) Source #

method Task<Seq<A>> ToSeq <A> (this TryOptionAsync<A> self) Source #

method Task<Seq<A>> AsEnumerable <A> (this TryOptionAsync<A> self) Source #

method Task<Lst<A>> ToList <A> (this TryOptionAsync<A> self) Source #

method Task<Arr<A>> ToArray <A> (this TryOptionAsync<A> self) Source #

method TryOptionAsyncSuccContext<A, R> Some <A, R> (this TryOptionAsync<A> self, Func<A, R> succHandler) Source #

method TryOptionAsyncSuccContext<A> Some <A> (this TryOptionAsync<A> self, Action<A> succHandler) Source #

method Task<string> AsString <A> (this TryOptionAsync<A> self) Source #

method TryOptionAsync<C> SelectMany <A, B, C> ( this TryOptionAsync<A> ma, Func<A, TryOptionAsync<B>> bind, Func<A, B, C> project) Source #

method TryOptionAsync<C> SelectMany <A, B, C> ( this TryOptionAsync<A> ma, Func<A, Task<TryOptionAsync<B>>> bind, Func<A, B, C> project) Source #

method TryOptionAsync<C> SelectMany <A, B, C> ( this TryOptionAsync<A> ma, Func<A, Task<TryOptionAsync<B>>> bind, Func<A, B, Task<C>> project) Source #

method TryOptionAsync<C> SelectMany <A, B, C> ( this TryOptionAsync<A> ma, Func<A, TryOptionAsync<B>> bind, Func<A, B, Task<C>> project) Source #

method TryOptionAsync<D> Join <A, B, C, D> ( this TryOptionAsync<A> self, TryOptionAsync<B> inner, Func<A, C> outerKeyMap, Func<B, C> innerKeyMap, Func<A, B, D> project) Source #

method Task<OptionalResult<T>> Try <T> (this TryOptionAsync<T> self) Source #

method TryOptionAsync<U> Use <T, U> (this TryOptionAsync<T> self, Func<T, U> select) Source #

where T : IDisposable

method TryOptionAsync<U> Use <T, U> (this TryOptionAsync<T> self, Func<T, TryOptionAsync<U>> select) Source #

where T : IDisposable

method Task<int> Sum (this TryOptionAsync<int> self) Source #

method TryOptionAsync<T> Flatten <T> (this TryOptionAsync<TryOptionAsync<T>> self) Source #

method TryOptionAsync<T> Flatten <T> (this TryOptionAsync<TryOptionAsync<TryOptionAsync<T>>> self) Source #

method TryOptionAsync<T> Flatten <T> (this TryOptionAsync<TryOptionAsync<TryOptionAsync<TryOptionAsync<T>>>> self) Source #

method TryOptionAsync<B> Apply <A, B> (this TryOptionAsync<Func<A, B>> fab, TryOptionAsync<A> fa) Source #

Apply

Parameters

param fab

Function to apply the applicative to

param fa

Applicative to apply

returns

Applicative of type FB derived from Applicative of B

method TryOptionAsync<B> Apply <A, B> (this Func<A, B> fab, TryOptionAsync<A> fa) Source #

Apply

Parameters

param fab

Function to apply the applicative to

param fa

Applicative to apply

returns

Applicative of type FB derived from Applicative of B

method TryOptionAsync<C> Apply <A, B, C> (this TryOptionAsync<Func<A, B, C>> fabc, TryOptionAsync<A> fa, TryOptionAsync<B> fb) Source #

Apply

Parameters

param fab

Function to apply the applicative to

param fa

Applicative a to apply

param fb

Applicative b to apply

returns

Applicative of type FC derived from Applicative of C

method TryOptionAsync<C> Apply <A, B, C> (this Func<A, B, C> fabc, TryOptionAsync<A> fa, TryOptionAsync<B> fb) Source #

Apply

Parameters

param fab

Function to apply the applicative to

param fa

Applicative a to apply

param fb

Applicative b to apply

returns

Applicative of type FC derived from Applicative of C

method TryOptionAsync<Func<B, C>> Apply <A, B, C> (this TryOptionAsync<Func<A, B, C>> fabc, TryOptionAsync<A> fa) Source #

Apply

Parameters

param fab

Function to apply the applicative to

param fa

Applicative to apply

returns

Applicative of type f(b -> c) derived from Applicative of Func<B, C>

method TryOptionAsync<Func<B, C>> Apply <A, B, C> (this Func<A, B, C> fabc, TryOptionAsync<A> fa) Source #

Apply

Parameters

param fab

Function to apply the applicative to

param fa

Applicative to apply

returns

Applicative of type f(b -> c) derived from Applicative of Func<B, C>

method TryOptionAsync<Func<B, C>> Apply <A, B, C> (this TryOptionAsync<Func<A, Func<B, C>>> fabc, TryOptionAsync<A> fa) Source #

Apply

Parameters

param fab

Function to apply the applicative to

param fa

Applicative to apply

returns

Applicative of type f(b -> c) derived from Applicative of Func<B, C>

method TryOptionAsync<Func<B, C>> Apply <A, B, C> (this Func<A, Func<B, C>> fabc, TryOptionAsync<A> fa) Source #

Apply

Parameters

param fab

Function to apply the applicative to

param fa

Applicative to apply

returns

Applicative of type f(b -> c) derived from Applicative of Func<B, C>

method TryOptionAsync<B> Action <A, B> (this TryOptionAsync<A> fa, TryOptionAsync<B> fb) Source #

Evaluate fa, then fb, ignoring the result of fa

Parameters

param fa

Applicative to evaluate first

param fb

Applicative to evaluate second and then return

returns

Applicative of type Option

method Task<int> Compare <ORD, A> (this TryOptionAsync<A> lhs, TryOptionAsync<A> rhs) Source #

where ORD : struct, Ord<A>

Compare the bound value of Try(x) to Try(y). If either of the

Parameters

param lhs

Left-hand side of the operation

param rhs

Right-hand side of the operation

returns

1 if lhs > rhs, 0 if lhs == rhs, -1 if lhs < rhs

method TryOptionAsync<A> Append <SEMI, A> (this TryOptionAsync<A> lhs, TryOptionAsync<A> rhs) Source #

where SEMI : struct, Semigroup<A>

Append the bound value of TryOptionAsync(x) to TryOptionAsync(y). If either of the Trys are Fail then the result is Fail

Parameters

param lhs

Left-hand side of the operation

param rhs

Right-hand side of the operation

returns

lhs ++ rhs

method TryOptionAsync<A> Add <NUM, A> (this TryOptionAsync<A> lhs, TryOptionAsync<A> rhs) Source #

where NUM : struct, Num<A>

Add the bound value of Try(x) to Try(y). If either of the Trys are Fail then the result is Fail

Parameters

param lhs

Left-hand side of the operation

param rhs

Right-hand side of the operation

returns

lhs + rhs

method TryOptionAsync<A> Subtract <NUM, A> (this TryOptionAsync<A> lhs, TryOptionAsync<A> rhs) Source #

where NUM : struct, Num<A>

Find the subtract of the bound value of Try(x) and Try(y). If either of the Trys are Fail then the result is Fail

Parameters

param lhs

Left-hand side of the operation

param rhs

Right-hand side of the operation

returns

lhs + rhs

method TryOptionAsync<A> Product <NUM, A> (this TryOptionAsync<A> lhs, TryOptionAsync<A> rhs) Source #

where NUM : struct, Num<A>

Multiply the bound value of Try(x) and Try(y). If either of the Trys are Fail then the result is Fail

Parameters

param lhs

Left-hand side of the operation

param rhs

Right-hand side of the operation

returns

lhs + rhs

method TryOptionAsync<A> Divide <NUM, A> (this TryOptionAsync<A> lhs, TryOptionAsync<A> rhs) Source #

where NUM : struct, Num<A>

Multiply the bound value of Try(x) and Try(y). If either of the Trys are Fail then the result is Fail

Parameters

param lhs

Left-hand side of the operation

param rhs

Right-hand side of the operation

returns

lhs + rhs

method Task<A?> ToNullable <A> (this TryOptionAsync<A> ma) Source #

where A : struct

Convert the computation type to a Nullable of A

Parameters

type A

Type of the bound value

param ma

computation to convert

returns

Nullable of A

class Prelude Source #

Methods

method TryOptionAsync<A> TryOptionAsync <A> (Func<Task<A>> f) Source #

TryOptionAsync constructor function

Parameters

type A

Bound value type

param f

Function to run asynchronously

returns

A lifted operation that returns a value of A

method TryOptionAsync<A> TryOptionAsync <A> (Func<Task<Option<A>>> f) Source #

TryOptionAsync constructor function

Parameters

type A

Bound value type

param f

Function to run asynchronously

returns

A lifted operation that returns a value of A

method TryOptionAsync<A> TryOptionAsync <A> (Task<A> v) Source #

TryOptionAsync constructor function

Parameters

type A

Bound value type

param v

Task to run asynchronously

returns

A lifted operation that returns a value of A

method TryOptionAsync<A> TryOptionAsync <A> (Task<Option<A>> v) Source #

TryOptionAsync constructor function

Parameters

type A

Bound value type

param v

Task to run asynchronously

returns

A lifted operation that returns a value of A

method TryOptionAsync<A> TryOptionAsync <A> (A v) Source #

TryOptionAsync constructor function

Parameters

type A

Bound value type

param v

Bound value to return

returns

A lifted operation that returns a value of A

method TryOptionAsync<A> TryOptionAsyncSucc <A> (A v) Source #

TryOptionAsync constructor function

Parameters

type A

Bound value type

param v

Bound value to return

returns

A lifted operation that returns a value of A

method TryOptionAsync<A> TryOptionAsync <A> (Option<A> v) Source #

TryOptionAsync constructor function

Parameters

type A

Bound value type

param v

Bound value to return

returns

A lifted operation that returns a value of A

method TryOptionAsync<A> TryOptionalAsync <A> (Option<A> v) Source #

TryOptionAsync constructor function

Parameters

type A

Bound value type

param v

Bound value to return

returns

A lifted operation that returns a value of A

method TryOptionAsync<A> TryOptionAsync <A> (Exception ex) Source #

TryOptionAsync constructor function

Parameters

type A

Bound value type

param v

Bound value to return

returns

A lifted operation that returns a value of A

method TryOptionAsync<A> TryOptionAsyncFail <A> (Exception ex) Source #

TryOptionAsync constructor function

Parameters

type A

Bound value type

param v

Bound value to return

returns

A lifted operation that returns a value of A

method TryOptionAsync<A> append <SEMI, A> (TryOptionAsync<A> lhs, TryOptionAsync<A> rhs) Source #

where SEMI : struct, Semigroup<A>

Append the bound value of TryOptionAsync(x) to TryOptionAsync(y). If either of the Trys are Fail then the result is Fail

Parameters

param lhs

Left-hand side of the operation

param rhs

Right-hand side of the operation

returns

lhs ++ rhs

method TryOptionAsync<A> add <NUM, A> (TryOptionAsync<A> lhs, TryOptionAsync<A> rhs) Source #

where NUM : struct, Num<A>

Add the bound value of TryOptionAsync(x) to TryOptionAsync(y). If either of the Trys are Fail then the result is Fail

Parameters

param lhs

Left-hand side of the operation

param rhs

Right-hand side of the operation

returns

lhs + rhs

method TryOptionAsync<T> subtract <NUM, T> (TryOptionAsync<T> lhs, TryOptionAsync<T> rhs) Source #

where NUM : struct, Num<T>

Subtract the TryOptionAsync(x) from TryOptionAsync(y). If either of the Trys throw then the result is Fail For numeric values the behaviour is to find the subtract between the Trys (lhs - rhs) For Lst values the behaviour is to remove items in the rhs from the lhs For Map or Set values the behaviour is to remove items in the rhs from the lhs Otherwise if the R type derives from ISubtractable then the behaviour is to call lhs.Subtract(rhs);

Parameters

param lhs

Left-hand side of the operation

param rhs

Right-hand side of the operation

returns

lhs - rhs

method TryOptionAsync<T> product <NUM, T> (TryOptionAsync<T> lhs, TryOptionAsync<T> rhs) Source #

where NUM : struct, Num<T>

Find the product of TryOptionAsync(x) and TryOptionAsync(y). If either of the Trys throw then the result is Fail For numeric values the behaviour is to multiply the Trys (lhs * rhs) For Lst values the behaviour is to multiply all combinations of values in both lists to produce a new list Otherwise if the R type derives from IMultiplicable then the behaviour is to call lhs.Multiply(rhs);

Parameters

param lhs

Left-hand side of the operation

param rhs

Right-hand side of the operation

returns

lhs * rhs

method TryOptionAsync<T> divide <NUM, T> (TryOptionAsync<T> lhs, TryOptionAsync<T> rhs) Source #

where NUM : struct, Num<T>

Divide Try(x) by Try(y). If either of the Trys throw then the result is Fail For numeric values the behaviour is to divide the Trys (lhs / rhs) For Lst values the behaviour is to divide all combinations of values in both lists to produce a new list Otherwise if the R type derives from IDivisible then the behaviour is to call lhs.Divide(rhs);

Parameters

param lhs

Left-hand side of the operation

param rhs

Right-hand side of the operation

returns

lhs / rhs

method TryOptionAsync<B> apply <A, B> (TryOptionAsync<Func<A, B>> fab, TryOptionAsync<A> fa) Source #

Apply

Parameters

param fab

Function to apply the applicative to

param fa

Applicative to apply

returns

Applicative of type FB derived from Applicative of B

method TryOptionAsync<B> apply <A, B> (Func<A, B> fab, TryOptionAsync<A> fa) Source #

Apply

Parameters

param fab

Function to apply the applicative to

param fa

Applicative to apply

returns

Applicative of type FB derived from Applicative of B

method TryOptionAsync<C> apply <A, B, C> (TryOptionAsync<Func<A, B, C>> fabc, TryOptionAsync<A> fa, TryOptionAsync<B> fb) Source #

Apply

Parameters

param fab

Function to apply the applicative to

param fa

Applicative a to apply

param fb

Applicative b to apply

returns

Applicative of type FC derived from Applicative of C

method TryOptionAsync<C> apply <A, B, C> (Func<A, B, C> fabc, TryOptionAsync<A> fa, TryOptionAsync<B> fb) Source #

Apply

Parameters

param fab

Function to apply the applicative to

param fa

Applicative a to apply

param fb

Applicative b to apply

returns

Applicative of type FC derived from Applicative of C

method TryOptionAsync<Func<B, C>> apply <A, B, C> (TryOptionAsync<Func<A, B, C>> fabc, TryOptionAsync<A> fa) Source #

Apply

Parameters

param fab

Function to apply the applicative to

param fa

Applicative to apply

returns

Applicative of type f(b -> c) derived from Applicative of Func<B, C>

method TryOptionAsync<Func<B, C>> apply <A, B, C> (Func<A, B, C> fabc, TryOptionAsync<A> fa) Source #

Apply

Parameters

param fab

Function to apply the applicative to

param fa

Applicative to apply

returns

Applicative of type f(b -> c) derived from Applicative of Func<B, C>

method TryOptionAsync<Func<B, C>> apply <A, B, C> (TryOptionAsync<Func<A, Func<B, C>>> fabc, TryOptionAsync<A> fa) Source #

Apply

Parameters

param fab

Function to apply the applicative to

param fa

Applicative to apply

returns

Applicative of type f(b -> c) derived from Applicative of Func<B, C>

method TryOptionAsync<Func<B, C>> apply <A, B, C> (Func<A, Func<B, C>> fabc, TryOptionAsync<A> fa) Source #

Apply

Parameters

param fab

Function to apply the applicative to

param fa

Applicative to apply

returns

Applicative of type f(b -> c) derived from Applicative of Func<B, C>

method TryOptionAsync<B> action <A, B> (TryOptionAsync<A> fa, TryOptionAsync<B> fb) Source #

Evaluate fa, then fb, ignoring the result of fa

Parameters

param fa

Applicative to evaluate first

param fb

Applicative to evaluate second and then return

returns

Applicative of type Option

method TryOptionAsync<bool> isSome <T> (TryOptionAsync<T> self) Source #

Test if the TryOptionAsync computation is successful

Parameters

type T

Type of the bound value

param self

TryOptionAsync computation to test

returns

True if successful

method TryOptionAsync<bool> isFail <T> (TryOptionAsync<T> self) Source #

Test if the TryOptionAsync computation fails

Parameters

type T

Type of the bound value

param self

TryOptionAsync computation to test

returns

True if fails

method Task<Unit> ifSome <T> (TryOptionAsync<T> self, Action<T> Succ) Source #

Invoke a delegate if the TryOptionAsync returns a value successfully

Parameters

type T

Type of the bound value

param self

TryOptionAsync computation

param Succ

Delegate to invoke if successful

method Task<T> ifFailOrNone <T> (TryOptionAsync<T> self, Func<T> Fail) Source #

Invoke a delegate if the TryOptionAsync fails

Parameters

type T

Type of the bound value

param value

TryOptionAsync computation

param Fail

Delegate to invoke on failure

returns

Result of the invocation of Fail on failure, the result of the TryOptionAsync otherwise

method Task<T> ifNoneOrFail <T> (TryOptionAsync<T> self, T failValue) Source #

Return a default value if the TryOptionAsync fails

Parameters

type T

Type of the bound value

param self

TryOptionAsync computation

param failValue

Default value to use on failure

returns

failValue on failure, the result of the TryOptionAsync otherwise

method ExceptionMatchOptionalAsync<T> ifFail <T> (TryOptionAsync<T> self) Source #

Provides a fluent exception matching interface which is invoked when the Try fails.

Parameters

type T

Type of the bound value

param self

TryOptionAsync computation

returns

Fluent exception matcher

method Task<Unit> ifFail <T> (TryOptionAsync<T> self, Action<Exception> Fail) Source #

Invoke a delegate if the TryOptionAsync fails

Parameters

type T

Type of bound value

param self

TryOptionAsync computation

param Fail

The delegate to invoke if the TryOption computation fails

method TryOptionAsync<T> flatten <T> (TryOptionAsync<TryOptionAsync<T>> self) Source #

Flattens nested TryOptionAsync computations

Parameters

type T

Type of the bound value

param self

TryOptionAsync computation

returns

Flattened TryOptionAsync computation

method TryOptionAsync<T> flatten <T> (TryOptionAsync<TryOptionAsync<TryOptionAsync<T>>> self) Source #

Flattens nested TryOptionAsync computations

Parameters

type T

Type of the bound value

param self

TryOptionAsync computation

returns

Flattened TryOptionAsync computation

method TryOptionAsync<T> flatten <T> (TryOptionAsync<TryOptionAsync<TryOptionAsync<TryOptionAsync<T>>>> self) Source #

Flattens nested TryOptionAsync computations

Parameters

type T

Type of the bound value

param self

TryOptionAsync computation

returns

Flattened TryOptionAsync computation

method Task<R> match <A, R> (TryOptionAsync<A> self, Func<A, R> Some, Func<R> None, Func<Exception, R> Fail) Source #

Pattern matches the three possible states of the Try computation

Parameters

type R

Type of the resulting bound value

param Some

Delegate to invoke if the Try computation completes successfully

param None

Delegate to invoke if the Try computation completes successfully but returns no value

param Fail

Delegate to invoke if the Try computation fails

returns

The result of either the Succ, None, or Fail delegate

method Task<R> match <A, R> (TryOptionAsync<A> self, Func<A, R> Some, Func<Task<R>> None, Func<Exception, R> Fail) Source #

Pattern matches the three possible states of the Try computation

Parameters

type R

Type of the resulting bound value

param Some

Delegate to invoke if the Try computation completes successfully

param None

Delegate to invoke if the Try computation completes successfully but returns no value

param Fail

Delegate to invoke if the Try computation fails

returns

The result of either the Succ, None, or Fail delegate

method Task<R> match <A, R> (TryOptionAsync<A> self, Func<A, Task<R>> Some, Func<R> None, Func<Exception, R> Fail) Source #

Pattern matches the three possible states of the Try computation

Parameters

type R

Type of the resulting bound value

param Some

Delegate to invoke if the Try computation completes successfully

param None

Delegate to invoke if the Try computation completes successfully but returns no value

param Fail

Delegate to invoke if the Try computation fails

returns

The result of either the Succ, None, or Fail delegate

method Task<R> match <A, R> (TryOptionAsync<A> self, Func<A, Task<R>> Some, Func<Task<R>> None, Func<Exception, R> Fail) Source #

Pattern matches the three possible states of the Try computation

Parameters

type R

Type of the resulting bound value

param Some

Delegate to invoke if the Try computation completes successfully

param None

Delegate to invoke if the Try computation completes successfully but returns no value

param Fail

Delegate to invoke if the Try computation fails

returns

The result of either the Succ, None, or Fail delegate

method Task<R> match <A, R> (TryOptionAsync<A> self, Func<A, R> Some, Func<R> None, Func<Exception, Task<R>> Fail) Source #

Pattern matches the three possible states of the Try computation

Parameters

type R

Type of the resulting bound value

param Some

Delegate to invoke if the Try computation completes successfully

param None

Delegate to invoke if the Try computation completes successfully but returns no value

param Fail

Delegate to invoke if the Try computation fails

returns

The result of either the Succ, None, or Fail delegate

method Task<R> match <A, R> (TryOptionAsync<A> self, Func<A, R> Some, Func<Task<R>> None, Func<Exception, Task<R>> Fail) Source #

Pattern matches the three possible states of the Try computation

Parameters

type R

Type of the resulting bound value

param Some

Delegate to invoke if the Try computation completes successfully

param None

Delegate to invoke if the Try computation completes successfully but returns no value

param Fail

Delegate to invoke if the Try computation fails

returns

The result of either the Succ, None, or Fail delegate

method Task<R> match <A, R> (TryOptionAsync<A> self, Func<A, Task<R>> Some, Func<R> None, Func<Exception, Task<R>> Fail) Source #

Pattern matches the three possible states of the Try computation

Parameters

type R

Type of the resulting bound value

param Some

Delegate to invoke if the Try computation completes successfully

param None

Delegate to invoke if the Try computation completes successfully but returns no value

param Fail

Delegate to invoke if the Try computation fails

returns

The result of either the Succ, None, or Fail delegate

method Task<R> match <A, R> (TryOptionAsync<A> self, Func<A, Task<R>> Some, Func<Task<R>> None, Func<Exception, Task<R>> Fail) Source #

Pattern matches the three possible states of the Try computation

Parameters

type R

Type of the resulting bound value

param Some

Delegate to invoke if the Try computation completes successfully

param None

Delegate to invoke if the Try computation completes successfully but returns no value

param Fail

Delegate to invoke if the Try computation fails

returns

The result of either the Succ, None, or Fail delegate

method Task<R> match <A, R> (TryOptionAsync<A> self, Func<A, R> Some, Func<R> None, R Fail) Source #

Pattern matches the three possible states of the Try computation

Parameters

type R

Type of the resulting bound value

param Some

Delegate to invoke if the Try computation completes successfully

param None

Delegate to invoke if the Try computation completes successfully but returns no value

param Fail

Delegate to invoke if the Try computation fails

returns

The result of either the Succ, None, or Fail delegate

method Task<R> match <A, R> (TryOptionAsync<A> self, Func<A, R> Some, Func<Task<R>> None, R Fail) Source #

Pattern matches the three possible states of the Try computation

Parameters

type R

Type of the resulting bound value

param Some

Delegate to invoke if the Try computation completes successfully

param None

Delegate to invoke if the Try computation completes successfully but returns no value

param Fail

Delegate to invoke if the Try computation fails

returns

The result of either the Succ, None, or Fail delegate

method Task<R> match <A, R> (TryOptionAsync<A> self, Func<A, Task<R>> Some, Func<R> None, R Fail) Source #

Pattern matches the three possible states of the Try computation

Parameters

type R

Type of the resulting bound value

param Some

Delegate to invoke if the Try computation completes successfully

param None

Delegate to invoke if the Try computation completes successfully but returns no value

param Fail

Delegate to invoke if the Try computation fails

returns

The result of either the Succ, None, or Fail delegate

method Task<R> match <A, R> (TryOptionAsync<A> self, Func<A, Task<R>> Some, Func<Task<R>> None, R Fail) Source #

Pattern matches the three possible states of the Try computation

Parameters

type R

Type of the resulting bound value

param Some

Delegate to invoke if the Try computation completes successfully

param None

Delegate to invoke if the Try computation completes successfully but returns no value

param Fail

Delegate to invoke if the Try computation fails

returns

The result of either the Succ, None, or Fail delegate

method Task<Unit> match <A> (TryOptionAsync<A> self, Action<A> Some, Action None, Action<Exception> Fail) Source #

Pattern matches the three possible states of the Try computation

Parameters

type R

Type of the resulting bound value

param Some

Delegate to invoke if the Try computation completes successfully

param None

Delegate to invoke if the Try computation completes successfully but returns no value

param Fail

Delegate to invoke if the Try computation fails

returns

The result of either the Succ, None, or Fail delegate

method Task<Unit> iter <T> (TryOptionAsync<T> self, Action<T> action) Source #

Invokes a delegate with the result of the TryOptionAsync computation if it is successful.

Parameters

type T

Type of the bound value

param self

TryOptionAsync computation

param action

Delegate to invoke on successful invocation of the TryOptionAsync computation

method Task<S> fold <S, T> (TryOptionAsync<T> self, S state, Func<S, T, S> folder) Source #

Folds the value of TryOptionAsync into an S. https://en.wikipedia.org/wiki/Fold_(higher-order_function)

Parameters

param self

TryOptionAsync to fold

param state

Initial state

param folder

Fold function

returns

Folded state

method Task<bool> forall <T> (TryOptionAsync<T> self, Func<T, bool> pred) Source #

Tests that a predicate holds for all values of the bound value T

Parameters

type T

Type of the bound value

param self

TryOptionAsync computation

param pred

Predicate to test the bound value against

returns

True if the predicate holds for the bound value, or if the TryOptionAsync computation fails. False otherwise.

method Task<int> count <T> (TryOptionAsync<T> self) Source #

Counts the number of bound values.

Parameters

type T

Type of the bound value

param self

TryOptionAsync computation

returns

1 if the TryOptionAsync computation is successful, 0 otherwise.

method Task<bool> exists <T> (TryOptionAsync<T> self, Func<T, bool> pred) Source #

Tests that a predicate holds for any value of the bound value T

Parameters

type T

Type of the bound value

param self

Try computation

param pred

Predicate to test the bound value against

returns

True if the predicate holds for the bound value. False otherwise.

method TryOptionAsync<R> map <T, R> (TryOptionAsync<T> self, Func<T, R> mapper) Source #

Maps the bound value

Parameters

type T

Type of the bound value

type R

Resulting bound value type

param self

TryOptionAsync computation

param mapper

Delegate to map the bound value

returns

Mapped Try computation

method TryOptionAsync<R> bimap <T, R> (TryOptionAsync<T> tryDel, Func<T, R> Succ, Func<R> Fail) Source #

Maps the bound value

Parameters

type T

Type of the bound value

type R

Resulting bound value type

param self

TryOptionAsync computation

param Succ

Delegate to map the bound value

param Fail

Delegate to map the exception to the desired bound result type

returns

Mapped Try computation

method TryOptionAsync<Func<T2, R>> parmap <T1, T2, R> (TryOptionAsync<T1> self, Func<T1, T2, R> func) Source #

Partial application map

method TryOptionAsync<Func<T2, Func<T3, R>>> parmap <T1, T2, T3, R> (TryOptionAsync<T1> self, Func<T1, T2, T3, R> func) Source #

Partial application map

method TryOptionAsync<T> filter <T> (TryOptionAsync<T> self, Func<T, bool> pred) Source #

method TryOptionAsync<T> bifilter <T> (TryOptionAsync<T> self, Func<T, bool> Succ, Func< bool> Fail) Source #

method TryOptionAsync<R> bind <T, R> (TryOptionAsync<T> tryDel, Func<T, TryOptionAsync<R>> binder) Source #

method TryOptionAsync<R> bibind <T, R> (TryOptionAsync<T> self, Func<T, TryOptionAsync<R>> Succ, Func<TryOptionAsync<R>> Fail) Source #

method TryOptionAsync<A> plus <A> (TryOptionAsync<A> ma, TryOptionAsync<A> mb) Source #

method TryOptionAsync<A> plusFirst <A> (TryOptionAsync<A> ma, TryOptionAsync<A> mb) Source #

method Task<Lst<T>> toList <T> (TryOptionAsync<T> tryDel) Source #

method Task<Arr<T>> toArray <T> (TryOptionAsync<T> tryDel) Source #

method TryOptionAsync<T> tryfun <T> (Func<TryOptionAsync<T>> f) Source #

method TryOptionAsync<A> choice <A> (TryOptionAsync<A> ma, params TryOptionAsync<A>[] tail) Source #

Returns the first successful computation

Parameters

type A

Bound value

param ma

The first computation to run

param tail

The rest of the computations to run

returns

The first computation that succeeds

method TryOptionAsync<A> choice <A> (Seq<TryOptionAsync<A>> xs) Source #

Returns the first successful computation

Parameters

type A

Bound value

param xs

Sequence of computations to run

returns

The first computation that succeeds

struct TryOptionAsyncSuccContext <A, B> Source #

Methods

method TryOptionAsyncSuccContext<A, B> None (Func<B> f) Source #

method Task<B> Fail (Func<Exception, B> f) Source #

method Task<B> Fail (Func<Exception, Task<B>> f) Source #

method Task<B> Fail (B failValue) Source #

method Task<B> Fail (Task<B> failValue) Source #

struct TryOptionAsyncSuccContext <A> Source #

Methods

method TryOptionAsyncSuccContext<A> None (Action f) Source #

method Task<Unit> Fail (Action<Exception> f) Source #