- TryAsync <A>
- TryAsyncExtensions
- ToAff <A> (this TryAsync<A> ma)
- Case <A> (this TryAsync<A> ma)
- Memo <A> (this TryAsync<A> ma)
- Retry <A> (TryAsync<A> ma, int amount = 3)
- RetryBackOff <A> (TryAsync<A> ma, int backOffMilliSeconds, int amount = 3)
- GetAwaiter <A> (this TryAsync<A> ma)
- Strict <A> (this TryAsync<A> ma)
- IsSucc <A> (this TryAsync<A> ma)
- IsFail <A> (this TryAsync<A> ma)
- IfSucc <A> (this TryAsync<A> self, Action<A> Succ)
- IfFail <A> (this TryAsync<A> self, A failValue)
- IfFail <A> (this TryAsync<A> self, Func<Task<A>> Fail)
- IfFail <A> (this TryAsync<A> self, Func<A> Fail)
- IfFail <A> (this TryAsync<A> self, Func<Exception, Task<A>> Fail)
- IfFail <A> (this TryAsync<A> self, Func<Exception, A> Fail)
- IfFail <A> (this TryAsync<A> self)
- IfFail <A> (this TryAsync<A> self, Action<Exception> Fail)
- Match <A, R> (this TryAsync<A> self, Func<A, R> Succ, Func<Exception, R> Fail)
- Match <A, R> (this TryAsync<A> self, Func<A, Task<R>> Succ, Func<Exception, R> Fail)
- Match <A, R> (this TryAsync<A> self, Func<A, R> Succ, Func<Exception, Task<R>> Fail)
- Match <A, R> (this TryAsync<A> self, Func<A, Task<R>> Succ, Func<Exception, Task<R>> Fail)
- Match <A, R> (this TryAsync<A> self, Func<A, R> Succ, R Fail)
- Match <A, R> (this TryAsync<A> self, Func<A, Task<R>> Succ, R Fail)
- Match <A> (this TryAsync<A> self, Action<A> Succ, Action<Exception> Fail)
- ToValidation <A, FAIL> (this TryAsync<A> self, Func<Exception, FAIL> Fail)
- ToOption <A> (this TryAsync<A> self)
- ToOptionUnsafe <A> (this TryAsync<A> self)
- ToTryOption <A> (this TryAsync<A> self)
- ToEitherUnsafe <A> (this TryAsync<A> self)
- ToEitherUnsafe <A, L> (this TryAsync<A> self, Func<Error, L> Fail)
- ToEither <A> (this TryAsync<A> self)
- ToEither <A, L> (this TryAsync<A> self, Func<Error, L> Fail)
- IfFailThrow <A> (this TryAsync<A> self)
- Select <A, B> (this TryAsync<A> self, Func<A, B> select)
- Select <A, B> (this TryAsync<A> self, Func<A, Task<B>> select)
- Iter <A> (this TryAsync<A> self, Action<A> action)
- Count <A> (this TryAsync<A> self)
- ForAll <A> (this TryAsync<A> self, Func<A, bool> pred)
- ForAllAsync <A> (this TryAsync<A> self, Func<A, Task<bool>> pred)
- Fold <A, S> (this TryAsync<A> self, S state, Func<S, A, S> folder)
- FoldAsync <A, S> (this TryAsync<A> self, S state, Func<S, A, Task<S>> folder)
- BiFold <A, S> (this TryAsync<A> self, S state, Func<S, A, S> Succ, Func<S, Exception, S> Fail)
- BiFold <A, S> (this TryAsync<A> self, S state, Func<S, A, S> Succ, Func<S, Exception, Task<S>> Fail)
- BiFold <A, S> (this TryAsync<A> self, S state, Func<S, A, Task<S>> Succ, Func<S, Exception, S> Fail)
- BiFold <A, S> (this TryAsync<A> self, S state, Func<S, A, Task<S>> Succ, Func<S, Exception, Task<S>> Fail)
- Exists <A> (this TryAsync<A> self, Func<A, bool> pred)
- ExistsAsync <A> (this TryAsync<A> self, Func<A, Task<bool>> pred)
- Do <A> (this TryAsync<A> ma, Action<A> f)
- Map <A, B> (this TryAsync<A> self, Func<A, B> f)
- MapAsync <A, B> (this TryAsync<A> self, Func<A, Task<B>> f)
- BiMap <A, B> (this TryAsync<A> self, Func<A, B> Succ, Func<Exception, B> Fail)
- BiMap <A, B> (this TryAsync<A> self, Func<A, Task<B>> Succ, Func<Exception, B> Fail)
- BiMap <A, B> (this TryAsync<A> self, Func<A, B> Succ, Func<Exception, Task<B>> Fail)
- BiMap <A, B> (this TryAsync<A> self, Func<A, Task<B>> Succ, Func<Exception, Task<B>> Fail)
- ParMap <A, B, R> (this TryAsync<A> self, Func<A, B, R> func)
- ParMap <A, B, C, R> (this TryAsync<A> self, Func<A, B, C, R> func)
- Filter <A> (this TryAsync<A> self, Func<A, bool> pred)
- Filter <A> (this TryAsync<A> self, Func<A, Task<bool>> pred)
- BiFilter <A> (this TryAsync<A> self, Func<A, bool> Succ, Func<Exception, bool> Fail)
- BiFilter <A> (this TryAsync<A> self, Func<A, Task<bool>> Succ, Func<Exception, bool> Fail)
- BiFilter <A> (this TryAsync<A> self, Func<A, bool> Succ, Func<Exception, Task<bool>> Fail)
- BiFilter <A> (this TryAsync<A> self, Func<A, Task<bool>> Succ, Func<Exception, Task<bool>> Fail)
- Where <A> (this TryAsync<A> self, Func<A, bool> pred)
- Where <A> (this TryAsync<A> self, Func<A, Task<bool>> pred)
- Bind <A, B> (this TryAsync<A> ma, Func<A, TryAsync<B>> f)
- BindAsync <A, B> (this TryAsync<A> ma, Func<A, Task<TryAsync<B>>> f)
- BiBind <A, R> (this TryAsync<A> self, Func<A, TryAsync<R>> Succ, Func<Exception, TryAsync<R>> Fail)
- Plus <A> (this TryAsync<A> ma, TryAsync<A> mb)
- PlusFirst <A> (this TryAsync<A> ma, TryAsync<A> mb)
- ToSeq <A> (this TryAsync<A> self)
- AsEnumerable <A> (this TryAsync<A> self)
- ToList <A> (this TryAsync<A> self)
- ToArray <A> (this TryAsync<A> self)
- Succ <A,R> (this TryAsync<A> self, Func<A, R> succHandler)
- Succ <A> (this TryAsync<A> self, Action<A> succHandler)
- AsString <A> (this TryAsync<A> self)
- SelectMany <A, B, C> ( this TryAsync<A> ma, Func<A, TryAsync<B>> bind, Func<A, B, C> project)
- SelectMany <A, B, C> ( this TryAsync<A> ma, Func<A, Task<TryAsync<B>>> bind, Func<A, B, C> project)
- SelectMany <A, B, C> ( this TryAsync<A> ma, Func<A, Task<TryAsync<B>>> bind, Func<A, B, Task<C>> project)
- SelectMany <A, B, C> ( this TryAsync<A> ma, Func<A, TryAsync<B>> bind, Func<A, B, Task<C>> project)
- Join <A, U, K, V> ( this TryAsync<A> self, TryAsync<U> inner, Func<A, K> outerKeyMap, Func<U, K> innerKeyMap, Func<A, U, V> project)
- Try <T> (this TryAsync<T> self)
- Use <T, U> (this TryAsync<T> self, Func<T, U> select)
- Use <T, U> (this TryAsync<T> self, Func<T, TryAsync<U>> select)
- Sum (this TryAsync<int> self)
- Flatten <T> (this TryAsync<TryAsync<T>> self)
- Flatten <T> (this TryAsync<TryAsync<TryAsync<T>>> self)
- Flatten <T> (this TryAsync<TryAsync<TryAsync<TryAsync<T>>>> self)
- Apply <A, B> (this TryAsync<Func<A, B>> fab, TryAsync<A> fa)
- Apply <A, B> (this Func<A, B> fab, TryAsync<A> fa)
- Apply <A, B, C> (this TryAsync<Func<A, B, C>> fabc, TryAsync<A> fa, TryAsync<B> fb)
- Apply <A, B, C> (this Func<A, B, C> fabc, TryAsync<A> fa, TryAsync<B> fb)
- Apply <A, B, C> (this TryAsync<Func<A, B, C>> fabc, TryAsync<A> fa)
- Apply <A, B, C> (this Func<A, B, C> fabc, TryAsync<A> fa)
- Apply <A, B, C> (this TryAsync<Func<A, Func<B, C>>> fabc, TryAsync<A> fa)
- Apply <A, B, C> (this Func<A, Func<B, C>> fabc, TryAsync<A> fa)
- Action <A, B> (this TryAsync<A> fa, TryAsync<B> fb)
- Compare <ORD, A> (this TryAsync<A> lhs, TryAsync<A> rhs)
- Append <SEMI, A> (this TryAsync<A> lhs, TryAsync<A> rhs)
- Add <ARITH, A> (this TryAsync<A> lhs, TryAsync<A> rhs)
- Subtract <ARITH, A> (this TryAsync<A> lhs, TryAsync<A> rhs)
- Product <ARITH, A> (this TryAsync<A> lhs, TryAsync<A> rhs)
- Divide <NUM, A> (this TryAsync<A> lhs, TryAsync<A> rhs)
- ToNullable <A> (this TryAsync<A> ma)
- Prelude
- TryAsync <A> (Func<Task<A>> f)
- TryAsync <A> (Task<A> v)
- TryAsync <A> (A v)
- TryAsyncSucc <A> (A v)
- TryAsync <A> (Exception ex)
- TryAsyncFail <A> (Exception ex)
- append <SEMI, A> (TryAsync<A> lhs, TryAsync<A> rhs)
- add <NUM, A> (TryAsync<A> lhs, TryAsync<A> rhs)
- subtract <NUM, T> (TryAsync<T> lhs, TryAsync<T> rhs)
- product <NUM, T> (TryAsync<T> lhs, TryAsync<T> rhs)
- divide <NUM, T> (TryAsync<T> lhs, TryAsync<T> rhs)
- apply <A, B> (TryAsync<Func<A, B>> fab, TryAsync<A> fa)
- apply <A, B> (Func<A, B> fab, TryAsync<A> fa)
- apply <A, B, C> (TryAsync<Func<A, B, C>> fabc, TryAsync<A> fa, TryAsync<B> fb)
- apply <A, B, C> (Func<A, B, C> fabc, TryAsync<A> fa, TryAsync<B> fb)
- apply <A, B, C> (TryAsync<Func<A, B, C>> fabc, TryAsync<A> fa)
- apply <A, B, C> (Func<A, B, C> fabc, TryAsync<A> fa)
- apply <A, B, C> (TryAsync<Func<A, Func<B, C>>> fabc, TryAsync<A> fa)
- apply <A, B, C> (Func<A, Func<B, C>> fabc, TryAsync<A> fa)
- action <A, B> (TryAsync<A> fa, TryAsync<B> fb)
- isSucc <T> (TryAsync<T> self)
- isFail <T> (TryAsync<T> self)
- ifSucc <T> (TryAsync<T> self, Action<T> Succ)
- ifFail <T> (TryAsync<T> self, Func<T> Fail)
- ifFail <T> (TryAsync<T> self, T failValue)
- ifFail <T> (TryAsync<T> self)
- ifFail <T> (TryAsync<T> self, Action<Exception> Fail)
- failed <T> (TryAsync<T> self)
- flatten <T> (TryAsync<TryAsync<T>> self)
- flatten <T> (TryAsync<TryAsync<TryAsync<T>>> self)
- flatten <T> (TryAsync<TryAsync<TryAsync<TryAsync<T>>>> self)
- match <T, R> (TryAsync<T> self, Func<T, R> Succ, Func<Exception, R> Fail)
- match <T, R> (TryAsync<T> self, Func<T, R> Succ, R Fail)
- match <T> (TryAsync<T> self, Action<T> Succ, Action<Exception> Fail)
- iter <T> (TryAsync<T> self, Action<T> action)
- fold <S, T> (TryAsync<T> self, S state, Func<S, T, S> folder)
- fold <S, T> (TryAsync<T> self, S state, Func<S, T, S> Succ, Func<S, Exception, S> Fail)
- forall <T> (TryAsync<T> self, Func<T, bool> pred)
- count <T> (TryAsync<T> self)
- exists <T> (TryAsync<T> self, Func<T, bool> pred)
- map <T, R> (TryAsync<T> self, Func<T, R> mapper)
- bimap <T, R> (TryAsync<T> tryDel, Func<T, R> Succ, Func<Exception, R> Fail)
- parmap <T1, T2, R> (TryAsync<T1> self, Func<T1, T2, R> func)
- parmap <T1, T2, T3, R> (TryAsync<T1> self, Func<T1, T2, T3, R> func)
- filter <T> (TryAsync<T> self, Func<T, bool> pred)
- bifilter <T> (TryAsync<T> self, Func<T, bool> Succ, Func<Exception, bool> Fail)
- bind <T, R> (TryAsync<T> tryDel, Func<T, TryAsync<R>> binder)
- bibind <T, R> (TryAsync<T> self, Func<T, TryAsync<R>> Succ, Func<Exception, TryAsync<R>> Fail)
- plus <A> (TryAsync<A> ma, TryAsync<A> mb)
- plusFirst <A> (TryAsync<A> ma, TryAsync<A> mb)
- toList <T> (TryAsync<T> tryDel)
- toArray <T> (TryAsync<T> tryDel)
- tryfun <T> (Func<TryAsync<T>> f)
- choice <A> (TryAsync<A> ma, params TryAsync<A>[] tail)
- choice <A> (Seq<TryAsync<A>> xs)
- TryAsyncSuccContext <A, B>
- Fail (Func<Exception, B> f)
- Fail (Func<Exception, Task<B>> f)
- Fail (B failValue)
- Fail (Task<B> failValue)
- TryAsyncSuccUnitContext <A>
delegate TryAsync <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()
returns | A value that represents the outcome of the computation, either Success or Failure |
class TryAsyncExtensions Source #
Extension methods for the TryAsync monad
method Aff<A> ToAff <A> (this TryAsync<A> ma) Source #
Convert the structure to an Aff
returns | An Aff representation of the structure |
method ValueTask<object> Case <A> (this TryAsync<A> ma) Source #
Use for pattern-matching the case of the target
TryAsync succeeds = result is A
TryAsync fails = result is LanguageExt.Common.Error
method TryAsync<A> Memo <A> (this TryAsync<A> ma) Source #
Memoize the computation so that it's only run once
method TryAsync<A> Retry <A> (TryAsync<A> ma, int amount = 3) Source #
If the TryAsync fails, retry amount
times
type | A | Type of bound value |
param | ma | TryAsync |
param | amount | Amount of retries |
returns | TryAsync |
method TryAsync<A> RetryBackOff <A> (TryAsync<A> ma, int backOffMilliSeconds, int amount = 3) Source #
If the TryOptionAsync fails, retry amount
times whilst backing off backOffMilliSeconds
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 TaskAwaiter<Try<A>> GetAwaiter <A> (this TryAsync<A> ma) Source #
Custom awaiter that turns an TryAsync into an Try
method TryAsync<A> Strict <A> (this TryAsync<A> ma) Source #
Forces evaluation of the lazy TryAsync
type | A | Bound value type |
param | ma | Computation to evaluate |
returns | The Try with the computation executed |
method Task<bool> IsSucc <A> (this TryAsync<A> ma) Source #
Test if the TryAsync is in a success state
type | A | Bound value type |
param | ma | Computation to evaluate |
returns | True if computation has succeeded |
method Task<bool> IsFail <A> (this TryAsync<A> ma) Source #
Test if the TryAsync is in a faulted state
type | A | Bound value type |
param | ma | Computation to evaluate |
returns | True if computation is faulted |
method Task<Unit> IfSucc <A> (this TryAsync<A> self, Action<A> Succ) Source #
Invoke a delegate if the Try returns a value successfully
param | Succ | Delegate to invoke if successful |
method Task<A> IfFail <A> (this TryAsync<A> self, A failValue) Source #
Return a default value if the Try fails
param | failValue | Default value to use on failure |
returns | failValue on failure, the result of the Try otherwise |
method Task<A> IfFail <A> (this TryAsync<A> self, Func<Task<A>> Fail) Source #
Invoke a delegate if the Try fails
param | Fail | Delegate to invoke on failure |
returns | Result of the invocation of Fail on failure, the result of the Try otherwise |
method Task<A> IfFail <A> (this TryAsync<A> self, Func<A> Fail) Source #
Invoke a delegate if the Try fails
param | Fail | Delegate to invoke on failure |
returns | Result of the invocation of Fail on failure, the result of the Try otherwise |
method Task<A> IfFail <A> (this TryAsync<A> self, Func<Exception, Task<A>> Fail) Source #
Returns the Succ(value) of the Try or a default if it's Fail
method Task<A> IfFail <A> (this TryAsync<A> self, Func<Exception, A> Fail) Source #
Returns the Succ(value) of the Try or a default if it's Fail
method ExceptionMatchAsync<A> IfFail <A> (this TryAsync<A> self) Source #
Provides a fluent exception matching interface which is invoked when the Try fails.
returns | Fluent exception matcher |
method Task<Unit> IfFail <A> (this TryAsync<A> self, Action<Exception> Fail) Source #
Invoke a delegate if the TryAsync computation fails
type | A | Type of bound value |
param | self | the TryAsync computation |
param | Fail | The delegate to invoke if the TryAsync computation fails |
method Task<R> Match <A, R> (this TryAsync<A> self, Func<A, R> Succ, Func<Exception, R> Fail) Source #
Pattern matches the two possible states of the Try computation
type | R | Type of the resulting bound value |
param | Succ | Delegate to invoke if the Try computation completes successfully |
param | Fail | Delegate to invoke if the Try computation fails |
returns | The result of either the Succ or Fail delegates |
method Task<R> Match <A, R> (this TryAsync<A> self, Func<A, Task<R>> Succ, Func<Exception, R> Fail) Source #
Pattern matches the two possible states of the Try computation
type | R | Type of the resulting bound value |
param | Succ | Delegate to invoke if the Try computation completes successfully |
param | Fail | Delegate to invoke if the Try computation fails |
returns | The result of either the Succ or Fail delegates |
method Task<R> Match <A, R> (this TryAsync<A> self, Func<A, R> Succ, Func<Exception, Task<R>> Fail) Source #
Pattern matches the two possible states of the Try computation
type | R | Type of the resulting bound value |
param | Succ | Delegate to invoke if the Try computation completes successfully |
param | Fail | Delegate to invoke if the Try computation fails |
returns | The result of either the Succ or Fail delegates |
method Task<R> Match <A, R> (this TryAsync<A> self, Func<A, Task<R>> Succ, Func<Exception, Task<R>> Fail) Source #
Pattern matches the two possible states of the Try computation
type | R | Type of the resulting bound value |
param | Succ | Delegate to invoke if the Try computation completes successfully |
param | Fail | Delegate to invoke if the Try computation fails |
returns | The result of either the Succ or Fail delegates |
method Task<R> Match <A, R> (this TryAsync<A> self, Func<A, R> Succ, R Fail) Source #
Pattern matches the two possible states of the Try computation
type | R | Type of the resulting bound value |
param | Succ | Delegate to invoke if the Try computation completes successfully |
param | Fail | Default value to use if the Try computation fails |
returns | The result of either the Succ delegate or the Fail value |
method Task<R> Match <A, R> (this TryAsync<A> self, Func<A, Task<R>> Succ, R Fail) Source #
Pattern matches the two possible states of the Try computation
type | R | Type of the resulting bound value |
param | Succ | Delegate to invoke if the Try computation completes successfully |
param | Fail | Default value to use if the Try computation fails |
returns | The result of either the Succ delegate or the Fail value |
method Task<Unit> Match <A> (this TryAsync<A> self, Action<A> Succ, Action<Exception> Fail) Source #
Pattern matches the two possible states of the Try computation
param | Succ | Delegate to invoke if the Try computation completes successfully |
param | Fail | Delegate to invoke if the Try computation fails |
method Task<Validation<FAIL, A>> ToValidation <A, FAIL> (this TryAsync<A> self, Func<Exception, FAIL> Fail) Source #
method Task<OptionUnsafe<A>> ToOptionUnsafe <A> (this TryAsync<A> self) Source #
method TryOptionAsync<A> ToTryOption <A> (this TryAsync<A> self) Source #
method Task<EitherUnsafe<Error, A>> ToEitherUnsafe <A> (this TryAsync<A> self) Source #
method Task<EitherUnsafe<L, A>> ToEitherUnsafe <A, L> (this TryAsync<A> self, Func<Error, L> Fail) Source #
method Task<A> IfFailThrow <A> (this TryAsync<A> self) Source #
method TryAsync<B> Select <A, B> (this TryAsync<A> self, Func<A, B> select) Source #
Maps the bound value
type | A | Type of the bound value |
type | B | Resulting bound value type |
param | self | Try computation |
param | select | Delegate to map the bound value |
returns | Mapped Try computation |
method TryAsync<B> Select <A, B> (this TryAsync<A> self, Func<A, Task<B>> select) Source #
Maps the bound value
type | A | Type of the bound value |
type | B | Resulting bound value type |
param | self | Try computation |
param | select | Delegate to map the bound value |
returns | Mapped Try computation |
method Task<Unit> Iter <A> (this TryAsync<A> self, Action<A> action) Source #
Apply Try values to a Try function of arity 2
param | self | Try function |
param | arg1 | Try argument |
param | arg2 | Try argument |
returns | Returns the result of applying the Try arguments to the Try function |
method Task<int> Count <A> (this TryAsync<A> self) Source #
Counts the number of bound values.
type | T | Type of the bound value |
param | self | TrTry computation |
returns | 1 if the Try computation is successful, 0 otherwise. |
method Task<bool> ForAll <A> (this TryAsync<A> self, Func<A, bool> pred) Source #
Tests that a predicate holds for all values of the bound value T
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, or if the Try computation fails. False otherwise. |
method Task<bool> ForAllAsync <A> (this TryAsync<A> self, Func<A, Task<bool>> pred) Source #
Tests that a predicate holds for all values of the bound value T
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, or if the Try computation fails. False otherwise. |
method Task<S> Fold <A, S> (this TryAsync<A> self, S state, Func<S, A, S> folder) Source #
Folds Try value into an S. https://en.wikipedia.org/wiki/Fold_(higher-order_function)
param | self | Try to fold |
param | state | Initial state |
param | folder | Fold function |
returns | Folded state |
method Task<S> FoldAsync <A, S> (this TryAsync<A> self, S state, Func<S, A, Task<S>> folder) Source #
Folds Try value into an S. https://en.wikipedia.org/wiki/Fold_(higher-order_function)
param | self | Try to fold |
param | state | Initial state |
param | folder | Fold function |
returns | Folded state |
method Task<S> BiFold <A, S> (this TryAsync<A> self, S state, Func<S, A, S> Succ, Func<S, Exception, S> Fail) Source #
Folds Try value into an S. https://en.wikipedia.org/wiki/Fold_(higher-order_function)
param | self | Try 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 TryAsync<A> self, S state, Func<S, A, S> Succ, Func<S, Exception, Task<S>> Fail) Source #
Folds Try value into an S. https://en.wikipedia.org/wiki/Fold_(higher-order_function)
param | self | Try 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 TryAsync<A> self, S state, Func<S, A, Task<S>> Succ, Func<S, Exception, S> Fail) Source #
Folds Try value into an S. https://en.wikipedia.org/wiki/Fold_(higher-order_function)
param | self | Try 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 TryAsync<A> self, S state, Func<S, A, Task<S>> Succ, Func<S, Exception, Task<S>> Fail) Source #
Folds Try value into an S. https://en.wikipedia.org/wiki/Fold_(higher-order_function)
param | self | Try to fold |
param | state | Initial state |
param | Succ | Fold function for Success |
param | Fail | Fold function for Failure |
returns | Folded state |
method Task<bool> Exists <A> (this TryAsync<A> self, Func<A, bool> pred) Source #
Tests that a predicate holds for any value of the bound value T
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 TryAsync<A> self, Func<A, Task<bool>> pred) Source #
Tests that a predicate holds for any value of the bound value T
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 TryAsync<A> Do <A> (this TryAsync<A> ma, Action<A> f) Source #
Impure iteration of the bound value in the structure
returns | Returns the original unmodified structure |
method TryAsync<B> Map <A, B> (this TryAsync<A> self, Func<A, B> f) Source #
Maps the bound value
type | A | Type of the bound value |
type | B | Resulting bound value type |
param | self | Try computation |
param | mapper | Delegate to map the bound value |
returns | Mapped Try computation |
method TryAsync<B> MapAsync <A, B> (this TryAsync<A> self, Func<A, Task<B>> f) Source #
Maps the bound value
type | A | Type of the bound value |
type | B | Resulting bound value type |
param | self | Try computation |
param | mapper | Delegate to map the bound value |
returns | Mapped Try computation |
method TryAsync<B> BiMap <A, B> (this TryAsync<A> self, Func<A, B> Succ, Func<Exception, B> Fail) Source #
Maps the bound value
type | A | Type of the bound value |
type | B | Resulting bound value type |
param | self | Try 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 TryAsync<B> BiMap <A, B> (this TryAsync<A> self, Func<A, Task<B>> Succ, Func<Exception, B> Fail) Source #
Maps the bound value
type | A | Type of the bound value |
type | B | Resulting bound value type |
param | self | Try 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 TryAsync<B> BiMap <A, B> (this TryAsync<A> self, Func<A, B> Succ, Func<Exception, Task<B>> Fail) Source #
Maps the bound value
type | A | Type of the bound value |
type | B | Resulting bound value type |
param | self | Try 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 TryAsync<B> BiMap <A, B> (this TryAsync<A> self, Func<A, Task<B>> Succ, Func<Exception, Task<B>> Fail) Source #
Maps the bound value
type | A | Type of the bound value |
type | B | Resulting bound value type |
param | self | Try 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 TryAsync<Func<B, R>> ParMap <A, B, R> (this TryAsync<A> self, Func<A, B, R> func) Source #
Partial application map
method TryAsync<Func<B, Func<C, R>>> ParMap <A, B, C, R> (this TryAsync<A> self, Func<A, B, C, R> func) Source #
Partial application map
method TryAsync<A> BiFilter <A> (this TryAsync<A> self, Func<A, bool> Succ, Func<Exception, bool> Fail) Source #
method TryAsync<A> BiFilter <A> (this TryAsync<A> self, Func<A, Task<bool>> Succ, Func<Exception, bool> Fail) Source #
method TryAsync<A> BiFilter <A> (this TryAsync<A> self, Func<A, bool> Succ, Func<Exception, Task<bool>> Fail) Source #
method TryAsync<A> BiFilter <A> (this TryAsync<A> self, Func<A, Task<bool>> Succ, Func<Exception, Task<bool>> Fail) Source #
method TryAsync<R> BiBind <A, R> (this TryAsync<A> self, Func<A, TryAsync<R>> Succ, Func<Exception, TryAsync<R>> Fail) Source #
method Task<Seq<A>> AsEnumerable <A> (this TryAsync<A> self) Source #
method TryAsyncSuccContext<A, R> Succ <A,R> (this TryAsync<A> self, Func<A, R> succHandler) Source #
method TryAsync<C> SelectMany <A, B, C> ( this TryAsync<A> ma, Func<A, TryAsync<B>> bind, Func<A, B, C> project) Source #
method TryAsync<C> SelectMany <A, B, C> ( this TryAsync<A> ma, Func<A, Task<TryAsync<B>>> bind, Func<A, B, C> project) Source #
method TryAsync<C> SelectMany <A, B, C> ( this TryAsync<A> ma, Func<A, Task<TryAsync<B>>> bind, Func<A, B, Task<C>> project) Source #
method TryAsync<C> SelectMany <A, B, C> ( this TryAsync<A> ma, Func<A, TryAsync<B>> bind, Func<A, B, Task<C>> project) Source #
method TryAsync<V> Join <A, U, K, V> ( this TryAsync<A> self, TryAsync<U> inner, Func<A, K> outerKeyMap, Func<U, K> innerKeyMap, Func<A, U, V> project) Source #
method TryAsync<U> Use <T, U> (this TryAsync<T> self, Func<T, U> select) Source #
method TryAsync<U> Use <T, U> (this TryAsync<T> self, Func<T, TryAsync<U>> select) Source #
method TryAsync<B> Apply <A, B> (this TryAsync<Func<A, B>> fab, TryAsync<A> fa) Source #
Apply
param | fab | Function to apply the applicative to |
param | fa | Applicative to apply |
returns | Applicative of type FB derived from Applicative of B |
method TryAsync<B> Apply <A, B> (this Func<A, B> fab, TryAsync<A> fa) Source #
Apply
param | fab | Function to apply the applicative to |
param | fa | Applicative to apply |
returns | Applicative of type FB derived from Applicative of B |
method TryAsync<C> Apply <A, B, C> (this TryAsync<Func<A, B, C>> fabc, TryAsync<A> fa, TryAsync<B> fb) Source #
Apply
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 TryAsync<C> Apply <A, B, C> (this Func<A, B, C> fabc, TryAsync<A> fa, TryAsync<B> fb) Source #
Apply
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 TryAsync<Func<B, C>> Apply <A, B, C> (this TryAsync<Func<A, B, C>> fabc, TryAsync<A> fa) Source #
Apply
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 TryAsync<Func<B, C>> Apply <A, B, C> (this Func<A, B, C> fabc, TryAsync<A> fa) Source #
Apply
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 TryAsync<Func<B, C>> Apply <A, B, C> (this TryAsync<Func<A, Func<B, C>>> fabc, TryAsync<A> fa) Source #
Apply
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 TryAsync<Func<B, C>> Apply <A, B, C> (this Func<A, Func<B, C>> fabc, TryAsync<A> fa) Source #
Apply
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 TryAsync<B> Action <A, B> (this TryAsync<A> fa, TryAsync<B> fb) Source #
Evaluate fa, then fb, ignoring the result of fa
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 TryAsync<A> lhs, TryAsync<A> rhs) Source #
Compare the bound value of Try(x) to Try(y). If either of the
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 TryAsync<A> Append <SEMI, A> (this TryAsync<A> lhs, TryAsync<A> rhs) Source #
Append the bound value of TryAsync(x) to TryAsync(y). If either of the Trys are Fail then the result is Fail
param | lhs | Left-hand side of the operation |
param | rhs | Right-hand side of the operation |
returns | lhs ++ rhs |
method TryAsync<A> Add <ARITH, A> (this TryAsync<A> lhs, TryAsync<A> rhs) Source #
Add the bound value of Try(x) to Try(y). If either of the Trys are Fail then the result is Fail
param | lhs | Left-hand side of the operation |
param | rhs | Right-hand side of the operation |
returns | lhs + rhs |
method TryAsync<A> Subtract <ARITH, A> (this TryAsync<A> lhs, TryAsync<A> rhs) Source #
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
param | lhs | Left-hand side of the operation |
param | rhs | Right-hand side of the operation |
returns | lhs + rhs |
method TryAsync<A> Product <ARITH, A> (this TryAsync<A> lhs, TryAsync<A> rhs) Source #
Multiply the bound value of Try(x) and Try(y). If either of the Trys are Fail then the result is Fail
param | lhs | Left-hand side of the operation |
param | rhs | Right-hand side of the operation |
returns | lhs + rhs |
method TryAsync<A> Divide <NUM, A> (this TryAsync<A> lhs, TryAsync<A> rhs) Source #
Multiply the bound value of Try(x) and Try(y). If either of the Trys are Fail then the result is Fail
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 TryAsync<A> ma) Source #
Convert the Try type to a Nullable of A
type | A | Type of the bound value |
param | ma | Try to convert |
returns | Nullable of A |
method TryAsync<A> TryAsync <A> (Func<Task<A>> f) Source #
TryAsync constructor function
type | A | Bound value type |
param | f | Function to run asynchronously |
returns | A lifted operation that returns a value of A |
method TryAsync<A> TryAsync <A> (Task<A> v) Source #
TryAsync constructor function
type | A | Bound value type |
param | v | Task to run asynchronously |
returns | A lifted operation that returns a value of A |
method TryAsync<A> TryAsync <A> (A v) Source #
TryAsync identity constructor function
type | A | Bound value type |
param | v | Bound value to return |
returns | A lifted operation that returns a value of A |
method TryAsync<A> TryAsyncSucc <A> (A v) Source #
TryAsync identity constructor function
type | A | Bound value type |
param | v | Bound value to return |
returns | A lifted operation that returns a value of A |
method TryAsync<A> TryAsync <A> (Exception ex) Source #
TryOptionAsync constructor function
type | A | Bound value type |
param | v | Bound value to return |
returns | A lifted operation that returns a value of A |
method TryAsync<A> TryAsyncFail <A> (Exception ex) Source #
TryOptionAsync constructor function
type | A | Bound value type |
param | v | Bound value to return |
returns | A lifted operation that returns a value of A |
method TryAsync<A> append <SEMI, A> (TryAsync<A> lhs, TryAsync<A> rhs) Source #
Append the bound value of TryAsync(x) to TryAsync(y). If either of the Trys are Fail then the result is Fail
param | lhs | Left-hand side of the operation |
param | rhs | Right-hand side of the operation |
returns | lhs ++ rhs |
method TryAsync<A> add <NUM, A> (TryAsync<A> lhs, TryAsync<A> rhs) Source #
Add the bound value of TryAsync(x) to TryAsync(y). If either of the Trys are Fail then the result is Fail
param | lhs | Left-hand side of the operation |
param | rhs | Right-hand side of the operation |
returns | lhs + rhs |
method TryAsync<T> subtract <NUM, T> (TryAsync<T> lhs, TryAsync<T> rhs) Source #
Subtract the TryAsync(x) from TryAsync(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);
param | lhs | Left-hand side of the operation |
param | rhs | Right-hand side of the operation |
returns | lhs - rhs |
method TryAsync<T> product <NUM, T> (TryAsync<T> lhs, TryAsync<T> rhs) Source #
Find the product of TryAsync(x) and TryAsync(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);
param | lhs | Left-hand side of the operation |
param | rhs | Right-hand side of the operation |
returns | lhs * rhs |
method TryAsync<T> divide <NUM, T> (TryAsync<T> lhs, TryAsync<T> rhs) Source #
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);
param | lhs | Left-hand side of the operation |
param | rhs | Right-hand side of the operation |
returns | lhs / rhs |
method TryAsync<B> apply <A, B> (TryAsync<Func<A, B>> fab, TryAsync<A> fa) Source #
Apply
param | fab | Function to apply the applicative to |
param | fa | Applicative to apply |
returns | Applicative of type FB derived from Applicative of B |
method TryAsync<B> apply <A, B> (Func<A, B> fab, TryAsync<A> fa) Source #
Apply
param | fab | Function to apply the applicative to |
param | fa | Applicative to apply |
returns | Applicative of type FB derived from Applicative of B |
method TryAsync<C> apply <A, B, C> (TryAsync<Func<A, B, C>> fabc, TryAsync<A> fa, TryAsync<B> fb) Source #
Apply
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 TryAsync<C> apply <A, B, C> (Func<A, B, C> fabc, TryAsync<A> fa, TryAsync<B> fb) Source #
Apply
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 TryAsync<Func<B, C>> apply <A, B, C> (TryAsync<Func<A, B, C>> fabc, TryAsync<A> fa) Source #
Apply
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 TryAsync<Func<B, C>> apply <A, B, C> (Func<A, B, C> fabc, TryAsync<A> fa) Source #
Apply
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 TryAsync<Func<B, C>> apply <A, B, C> (TryAsync<Func<A, Func<B, C>>> fabc, TryAsync<A> fa) Source #
Apply
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 TryAsync<Func<B, C>> apply <A, B, C> (Func<A, Func<B, C>> fabc, TryAsync<A> fa) Source #
Apply
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 TryAsync<B> action <A, B> (TryAsync<A> fa, TryAsync<B> fb) Source #
Evaluate fa, then fb, ignoring the result of fa
param | fa | Applicative to evaluate first |
param | fb | Applicative to evaluate second and then return |
returns | Applicative of type Option |
method TryAsync<bool> isSucc <T> (TryAsync<T> self) Source #
Test if the TryAsync computation is successful
type | T | Type of the bound value |
param | self | TryAsync computation to test |
returns | True if successful |
method TryAsync<bool> isFail <T> (TryAsync<T> self) Source #
Test if the TryAsync computation fails
type | T | Type of the bound value |
param | self | TryAsync computation to test |
returns | True if fails |
method Task<Unit> ifSucc <T> (TryAsync<T> self, Action<T> Succ) Source #
Invoke a delegate if the TryAsync returns a value successfully
type | T | Type of the bound value |
param | self | TryAsync computation |
param | Succ | Delegate to invoke if successful |
method Task<T> ifFail <T> (TryAsync<T> self, Func<T> Fail) Source #
Invoke a delegate if the TryAsync fails
type | T | Type of the bound value |
param | value | TryAsync computation |
param | Fail | Delegate to invoke on failure |
returns | Result of the invocation of Fail on failure, the result of the TryAsync otherwise |
method Task<T> ifFail <T> (TryAsync<T> self, T failValue) Source #
Return a default value if the TryAsync fails
type | T | Type of the bound value |
param | self | TryAsync computation |
param | failValue | Default value to use on failure |
returns | failValue on failure, the result of the TryAsync otherwise |
method ExceptionMatchAsync<T> ifFail <T> (TryAsync<T> self) Source #
Provides a fluent exception matching interface which is invoked when the Try fails.
type | T | Type of the bound value |
param | self | TryAsync computation |
returns | Fluent exception matcher |
method Task<Unit> ifFail <T> (TryAsync<T> self, Action<Exception> Fail) Source #
Invoke a delegate if the TryAsync computation fails
type | T | Type of bound value |
param | self | The TryAsync computation |
param | Fail | The delegate to invoke if the TryAsync computation fails |
method TryAsync<Exception> failed <T> (TryAsync<T> self) Source #
Maps the bound value to the resulting exception (if the TryAsync computation fails). If the TryAsync computation succeeds then a NotSupportedException is used.
type | T | Type of the bound value |
param | self | TryAsync computation |
returns | Try of Exception |
method TryAsync<T> flatten <T> (TryAsync<TryAsync<T>> self) Source #
Flattens nested TryAsync computations
type | T | Type of the bound value |
param | self | TryAsync computation |
returns | Flattened TryAsync computation |
method TryAsync<T> flatten <T> (TryAsync<TryAsync<TryAsync<T>>> self) Source #
Flattens nested TryAsync computations
type | T | Type of the bound value |
param | self | TryAsync computation |
returns | Flattened TryAsync computation |
method TryAsync<T> flatten <T> (TryAsync<TryAsync<TryAsync<TryAsync<T>>>> self) Source #
Flattens nested TryAsync computations
type | T | Type of the bound value |
param | self | TryAsync computation |
returns | Flattened TryAsync computation |
method Task<R> match <T, R> (TryAsync<T> self, Func<T, R> Succ, Func<Exception, R> Fail) Source #
Pattern matches the two possible states of the TryAsync computation
type | T | Type of the bound value |
type | R | Type of the resulting bound value |
param | self | Try computation |
param | Succ | Delegate to invoke if the TryAsync computation completes successfully |
param | Fail | Delegate to invoke if the TryAsync computation fails |
returns | The result of either the Succ or Fail delegates |
method Task<R> match <T, R> (TryAsync<T> self, Func<T, R> Succ, R Fail) Source #
Pattern matches the two possible states of the TryAsync computation
type | T | Type of the bound value |
type | R | Type of the resulting bound value |
param | self | TryAsync computation |
param | Succ | Delegate to invoke if the TryAsync computation completes successfully |
param | Fail | Default value to use if the TryAsync computation fails |
returns | The result of either the Succ delegate or the Fail value |
method Task<Unit> match <T> (TryAsync<T> self, Action<T> Succ, Action<Exception> Fail) Source #
Pattern matches the two possible states of the TryAsync computation
type | T | Type of the bound value |
param | self | TryAsync computation |
param | Succ | Delegate to invoke if the TryAsync computation completes successfully |
param | Fail | Delegate to invoke if the TryAsync computation fails |
method Task<Unit> iter <T> (TryAsync<T> self, Action<T> action) Source #
Invokes a delegate with the result of the TryAsync computation if it is successful.
type | T | Type of the bound value |
param | self | TryAsync computation |
param | action | Delegate to invoke on successful invocation of the TryAsync computation |
method Task<S> fold <S, T> (TryAsync<T> self, S state, Func<S, T, S> folder) Source #
Folds the value of TryAsync into an S. wikipedia.org/wiki/Fold_(higher-order_function)
param | self | TryAsync to fold |
param | state | Initial state |
param | folder | Fold function |
returns | Folded state |
method Task<S> fold <S, T> (TryAsync<T> self, S state, Func<S, T, S> Succ, Func<S, Exception, S> Fail) Source #
Folds the result of TryAsync into an S. wikipedia.org/wiki/Fold_(higher-order_function)
param | tryDel | TryAsync to fold |
param | state | Initial state |
param | Succ | Fold function when TryAsync succeeds |
param | Fail | Fold function when TryAsync fails |
returns | Folded state |
method Task<bool> forall <T> (TryAsync<T> self, Func<T, bool> pred) Source #
Tests that a predicate holds for all values of the bound value T
type | T | Type of the bound value |
param | self | TryAsync computation |
param | pred | Predicate to test the bound value against |
returns | True if the predicate holds for the bound value, or if the TryAsync computation fails. False otherwise. |
method Task<int> count <T> (TryAsync<T> self) Source #
Counts the number of bound values.
type | T | Type of the bound value |
param | self | TryAsync computation |
returns | 1 if the TryAsync computation is successful, 0 otherwise. |
method Task<bool> exists <T> (TryAsync<T> self, Func<T, bool> pred) Source #
Tests that a predicate holds for any value of the bound value T
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 TryAsync<R> map <T, R> (TryAsync<T> self, Func<T, R> mapper) Source #
Maps the bound value
type | T | Type of the bound value |
type | R | Resulting bound value type |
param | self | TryAsync computation |
param | mapper | Delegate to map the bound value |
returns | Mapped Try computation |
method TryAsync<R> bimap <T, R> (TryAsync<T> tryDel, Func<T, R> Succ, Func<Exception, R> Fail) Source #
Maps the bound value
type | T | Type of the bound value |
type | R | Resulting bound value type |
param | self | TryAsync 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 TryAsync<Func<T2, R>> parmap <T1, T2, R> (TryAsync<T1> self, Func<T1, T2, R> func) Source #
Partial application map
method TryAsync<Func<T2, Func<T3, R>>> parmap <T1, T2, T3, R> (TryAsync<T1> self, Func<T1, T2, T3, R> func) Source #
Partial application map
method TryAsync<T> bifilter <T> (TryAsync<T> self, Func<T, bool> Succ, Func<Exception, bool> Fail) Source #
method TryAsync<R> bibind <T, R> (TryAsync<T> self, Func<T, TryAsync<R>> Succ, Func<Exception, TryAsync<R>> Fail) Source #
struct TryAsyncSuccContext <A, B> Source #