CondAsyncExt Class

Extensions to the CondAsync type

DECLARATION
public static class CondAsyncExt
NAMESPACE
LanguageExt

Methods

All<A, B>(CondAsync<A, B>, Func<B, Task<bool>>)
SUMMARY

A conditional computation where the input value must match all of the predicates provided to return a positive Some/True state. This is like an if(a && b && c ...) operation.

PARAMETERS
self
CondAsync<A, B>
The Cond computation to test
predicates
Func<B, Task<bool>>
The predicates to test the bound value with
DECLARATION
[Pure]
public static CondAsync<A, B> All<A, B>(this CondAsync<A, B> self, Func<B, Task<bool>> predicates)
RETURNS
CondAsync<A, B>
A conditional computation
All<A, B>(CondAsync<A, B>, Func<B, bool>)
SUMMARY

A conditional computation where the input value must match all of the predicates provided to return a positive Some/True state. This is like an if(a && b && c ...) operation.

PARAMETERS
self
CondAsync<A, B>
The Cond computation to test
predicates
Func<B, bool>
The predicates to test the bound value with
DECLARATION
[Pure]
public static CondAsync<A, B> All<A, B>(this CondAsync<A, B> self, Func<B, bool> predicates)
RETURNS
CondAsync<A, B>
A conditional computation
Any<A, B>(CondAsync<A, B>, Func<B, Task<bool>>)
SUMMARY

A conditional computation where the input value can match any of the predicates provided to return a positive Some/True state. This is like an if(a || b || c ...) operation.

PARAMETERS
self
CondAsync<A, B>
The Cond computation to test
predicates
Func<B, Task<bool>>
The predicates to test the bound value with
DECLARATION
[Pure]
public static CondAsync<A, B> Any<A, B>(this CondAsync<A, B> self, Func<B, Task<bool>> predicates)
RETURNS
CondAsync<A, B>
A conditional computation
Any<A, B>(CondAsync<A, B>, Func<B, bool>)
SUMMARY

A conditional computation where the input value can match any of the predicates provided to return a positive Some/True state. This is like an if(a || b || c ...) operation.

PARAMETERS
self
CondAsync<A, B>
The Cond computation to test
predicates
Func<B, bool>
The predicates to test the bound value with
DECLARATION
[Pure]
public static CondAsync<A, B> Any<A, B>(this CondAsync<A, B> self, Func<B, bool> predicates)
RETURNS
CondAsync<A, B>
A conditional computation
Apply<A, B>(A, Func<A, Task<B>>)
SUMMARY

Apply a value as the first argument to the function provided.

PARAMETERS
a
A
Value to apply to the function
f
Func<A, Task<B>>
Function to apply the value to
REMARKS
This is a general case apply function, however it is especially useful for fluently applying a value to the result of the CondAsync.Else() extension method.
DECLARATION
[Pure]
public static Task<B> Apply<A, B>(this A a, Func<A, Task<B>> f)
RETURNS
Task<B>
Promise to return the result of applying the value to the function
Apply<A, B>(Task<A>, Func<A, Task<B>>)
SUMMARY

Apply a value as the first argument to the function provided.

PARAMETERS
taskA
Task<A>
Task to continue from and apply its result value to the conditional computation
f
Func<A, Task<B>>
Function to apply the value to
REMARKS
This is a general case apply function, however it is especially useful for fluently applying a value to the result of the CondAsync.Else() extension method.
DECLARATION
[Pure]
public static Task<B> Apply<A, B>(this Task<A> taskA, Func<A, Task<B>> f)
RETURNS
Task<B>
Promise to return the result of applying the value to the function
Apply<A, B>(Task<A>, Func<Task<A>, Task<B>>)
SUMMARY

Apply a value as the first argument to the function provided.

PARAMETERS
taskA
Task<A>
Task to continue from and apply its result value to the conditional computation
f
Func<Task<A>, Task<B>>
Function to apply the value to
REMARKS
This is a general case apply function, however it is especially useful for fluently applying a value to the result of the CondAsync.Else() extension method.
DECLARATION
[Pure]
public static Task<B> Apply<A, B>(this Task<A> taskA, Func<Task<A>, Task<B>> f)
RETURNS
Task<B>
Promise to return the result of applying the value to the function
Else<A, B>(CondAsync<A, B>, Func<A, B>)
SUMMARY

Builds a delegate that runs the conditional computation, taking an input value and returning a result value. This would usually be the last thing in a fluent Cond computation.

PARAMETERS
self
CondAsync<A, B>
The Cond computation to test
f
Func<A, B>
The else function to run if the Cond computation ends up in a None/False state.
DECLARATION
[Pure]
public static Func<A, Task<B>> Else<A, B>(this CondAsync<A, B> self, Func<A, B> f)
RETURNS
Func<A, Task<B>>
The result of the conditional computation
Else<A, B>(CondAsync<A, B>, Func<B>)
SUMMARY

Builds a delegate that runs the conditional computation, taking an input value and returning a result value. This would usually be the last thing in a fluent Cond computation.

PARAMETERS
self
CondAsync<A, B>
The Cond computation to test
f
Func<B>
The else function to run if the Cond computation ends up in a None/False state.
DECLARATION
[Pure]
public static Func<A, Task<B>> Else<A, B>(this CondAsync<A, B> self, Func<B> f)
RETURNS
Func<A, Task<B>>
The result of the conditional computation
Else<A, B>(CondAsync<A, B>, B)
SUMMARY

Builds a delegate that runs the conditional computation, taking an input value and returning a result value. This would usually be the last thing in a fluent Cond computation.

PARAMETERS
self
CondAsync<A, B>
The Cond computation to test
value
B
The else value to use if the Cond computation ends up in a None/False state.
DECLARATION
[Pure]
public static Func<A, Task<B>> Else<A, B>(this CondAsync<A, B> self, B value)
RETURNS
Func<A, Task<B>>
The result of the conditional computation
Else<A, B>(CondAsync<A, B>, Func<A, Task<B>>)
SUMMARY

Builds a delegate that runs the conditional computation, taking an input value and returning a result value. This would usually be the last thing in a fluent Cond computation.

PARAMETERS
self
CondAsync<A, B>
The Cond computation to test
f
Func<A, Task<B>>
The else function to run if the Cond computation ends up in a None/False state.
DECLARATION
[Pure]
public static Func<A, Task<B>> Else<A, B>(this CondAsync<A, B> self, Func<A, Task<B>> f)
RETURNS
Func<A, Task<B>>
The result of the conditional computation
Else<A, B>(CondAsync<A, B>, Func<Task<B>>)
SUMMARY

Builds a delegate that runs the conditional computation, taking an input value and returning a result value. This would usually be the last thing in a fluent Cond computation.

PARAMETERS
self
CondAsync<A, B>
The Cond computation to test
f
Func<Task<B>>
The else function to run if the Cond computation ends up in a None/False state.
DECLARATION
[Pure]
public static Func<A, Task<B>> Else<A, B>(this CondAsync<A, B> self, Func<Task<B>> f)
RETURNS
Func<A, Task<B>>
The result of the conditional computation
Else<A, B>(CondAsync<A, B>, Task<B>)
SUMMARY

Builds a delegate that runs the conditional computation, taking an input value and returning a result value. This would usually be the last thing in a fluent Cond computation.

PARAMETERS
self
CondAsync<A, B>
The Cond computation to test
valuePromise
Task<B>
The else value promise to use if the Cond computation ends up in a None/False state.
REMARKS
The Else task will always run, even if not needed by the computation. Only use this variant if the Else task is a Task.FromResult(x) or you absolutely definitely need the operation to run in parallel to the If/Then computation so that the result is available as quickly as possible.
DECLARATION
[Pure]
public static Func<A, Task<B>> Else<A, B>(this CondAsync<A, B> self, Task<B> valuePromise)
RETURNS
Func<A, Task<B>>
The result of the conditional computation
ElseAsync<A, B>(CondAsync<A, B>, Func<A, B>)
SUMMARY

Builds a delegate that runs the conditional computation, taking an input value and returning a result value. This would usually be the last thing in a fluent Cond computation.

PARAMETERS
self
CondAsync<A, B>
The Cond computation to test
f
Func<A, B>
The else function to run if the Cond computation ends up in a None/False state.
DECLARATION
[Pure]
public static Func<Task<A>, Task<B>> ElseAsync<A, B>(this CondAsync<A, B> self, Func<A, B> f)
RETURNS
Func<Task<A>, Task<B>>
The result of the conditional computation
ElseAsync<A, B>(CondAsync<A, B>, Func<B>)
SUMMARY

Builds a delegate that runs the conditional computation, taking an input value and returning a result value. This would usually be the last thing in a fluent Cond computation.

PARAMETERS
self
CondAsync<A, B>
The Cond computation to test
f
Func<B>
The else function to run if the Cond computation ends up in a None/False state.
DECLARATION
[Pure]
public static Func<Task<A>, Task<B>> ElseAsync<A, B>(this CondAsync<A, B> self, Func<B> f)
RETURNS
Func<Task<A>, Task<B>>
The result of the conditional computation
ElseAsync<A, B>(CondAsync<A, B>, B)
SUMMARY

Builds a delegate that runs the conditional computation, taking an input value and returning a result value. This would usually be the last thing in a fluent Cond computation.

PARAMETERS
self
CondAsync<A, B>
The Cond computation to test
value
B
The else value to use if the Cond computation ends up in a None/False state.
DECLARATION
[Pure]
public static Func<Task<A>, Task<B>> ElseAsync<A, B>(this CondAsync<A, B> self, B value)
RETURNS
Func<Task<A>, Task<B>>
The result of the conditional computation
ElseAsync<A, B>(CondAsync<A, B>, Func<A, Task<B>>)
SUMMARY

Builds a delegate that runs the conditional computation, taking an input value and returning a result value. This would usually be the last thing in a fluent Cond computation.

PARAMETERS
self
CondAsync<A, B>
The Cond computation to test
f
Func<A, Task<B>>
The else function to run if the Cond computation ends up in a None/False state.
DECLARATION
[Pure]
public static Func<Task<A>, Task<B>> ElseAsync<A, B>(this CondAsync<A, B> self, Func<A, Task<B>> f)
RETURNS
Func<Task<A>, Task<B>>
The result of the conditional computation
ElseAsync<A, B>(CondAsync<A, B>, Func<Task<B>>)
SUMMARY

Builds a delegate that runs the conditional computation, taking an input value and returning a result value. This would usually be the last thing in a fluent Cond computation.

PARAMETERS
self
CondAsync<A, B>
The Cond computation to test
f
Func<Task<B>>
The else function to run if the Cond computation ends up in a None/False state.
DECLARATION
[Pure]
public static Func<Task<A>, Task<B>> ElseAsync<A, B>(this CondAsync<A, B> self, Func<Task<B>> f)
RETURNS
Func<Task<A>, Task<B>>
The result of the conditional computation
ElseAsync<A, B>(CondAsync<A, B>, Task<B>)
SUMMARY

Builds a delegate that runs the conditional computation, taking an input value and returning a result value. This would usually be the last thing in a fluent Cond computation.

PARAMETERS
self
CondAsync<A, B>
The Cond computation to test
valuePromise
Task<B>
The else value promise to use if the Cond computation ends up in a None/False state.
REMARKS
The Else task will always run, even if not needed by the computation. Only use this variant if the Else task is a Task.FromResult(x) or you absolutely definitely need the operation to run in parallel to the If/Then computation so that the result is available as quickly as possible.
DECLARATION
[Pure]
public static Func<Task<A>, Task<B>> ElseAsync<A, B>(this CondAsync<A, B> self, Task<B> valuePromise)
RETURNS
Func<Task<A>, Task<B>>
The result of the conditional computation
Filter<A, B>(CondAsync<A, B>, Func<B, bool>)
SUMMARY

Filter the conditional computation. This is the equivalent of the predicate in an If statement.

PARAMETERS
self
CondAsync<A, B>
The conditional computation to test
pred
Func<B, bool>
The predicate function
DECLARATION
[Pure]
public static CondAsync<A, B> Filter<A, B>(this CondAsync<A, B> self, Func<B, bool> pred)
RETURNS
CondAsync<A, B>
A conditional computation
Filter<A, B>(CondAsync<A, B>, Func<B, Task<bool>>)
SUMMARY

Filter the conditional computation. This is the equivalent of the predicate in an If statement.

PARAMETERS
self
CondAsync<A, B>
The conditional computation to test
pred
Func<B, Task<bool>>
The predicate function
DECLARATION
[Pure]
public static CondAsync<A, B> Filter<A, B>(this CondAsync<A, B> self, Func<B, Task<bool>> pred)
RETURNS
CondAsync<A, B>
A conditional computation
Map<A, B, C>(CondAsync<A, B>, Func<B, Task<C>>)
SUMMARY

Functor map of the conditional computation

PARAMETERS
self
CondAsync<A, B>
The conditional computation to map
map
Func<B, Task<C>>
Functor mapping function
DECLARATION
[Pure]
public static CondAsync<A, C> Map<A, B, C>(this CondAsync<A, B> self, Func<B, Task<C>> map)
RETURNS
CondAsync<A, C>
A mapped conditional computation
Map<A, B, C>(CondAsync<A, B>, Func<B, C>)
SUMMARY

Functor map of the conditional computation

PARAMETERS
self
CondAsync<A, B>
The conditional computation to map
map
Func<B, C>
Functor mapping function
DECLARATION
[Pure]
public static CondAsync<A, C> Map<A, B, C>(this CondAsync<A, B> self, Func<B, C> map)
RETURNS
CondAsync<A, C>
A mapped conditional computation
Select<A, B, C>(CondAsync<A, B>, Func<B, Task<C>>)
SUMMARY

Functor map of the conditional computation

PARAMETERS
self
CondAsync<A, B>
The conditional computation to map
map
Func<B, Task<C>>
Functor mapping function
DECLARATION
[Pure]
public static CondAsync<A, C> Select<A, B, C>(this CondAsync<A, B> self, Func<B, Task<C>> map)
RETURNS
CondAsync<A, C>
A mapped conditional computation
Select<A, B, C>(CondAsync<A, B>, Func<B, C>)
SUMMARY

Functor map of the conditional computation

PARAMETERS
self
CondAsync<A, B>
The conditional computation to map
map
Func<B, C>
Functor mapping function
DECLARATION
[Pure]
public static CondAsync<A, C> Select<A, B, C>(this CondAsync<A, B> self, Func<B, C> map)
RETURNS
CondAsync<A, C>
A mapped conditional computation
SelectMany<A, B, C, D>(CondAsync<A, B>, Func<B, CondAsync<A, C>>, Func<B, C, D>)
SUMMARY

Monadic bind for conditional computations. Allows nesting of computations that follow the rules of Cond, namely that a None/False result cancels the operation until an Else is encountered.

PARAMETERS
self
CondAsync<A, B>
bind
Func<B, CondAsync<A, C>>
project
Func<B, C, D>
DECLARATION
[Pure]
public static CondAsync<A, D> SelectMany<A, B, C, D>(this CondAsync<A, B> self, Func<B, CondAsync<A, C>> bind, Func<B, C, D> project)
RETURNS
CondAsync<A, D>
Then<A, B>(CondAsync<A, A>, Func<A, B>)
SUMMARY

Provide the behaviour to run if the condition of the Cond computation is in a Some/True state. This is equivalent to the 'then' part of an If/Then/Else operation.

PARAMETERS
self
CondAsync<A, A>
The Cond computation to compose with
f
Func<A, B>
The 'then' computation
DECLARATION
[Pure]
public static CondAsync<A, B> Then<A, B>(this CondAsync<A, A> self, Func<A, B> f)
RETURNS
CondAsync<A, B>
A conditional computation
Then<A, B>(CondAsync<A, A>, Func<B>)
SUMMARY

Provide the behaviour to run if the condition of the Cond computation is in a Some/True state. This is equivalent to the 'then' part of an If/Then/Else operation.

PARAMETERS
self
CondAsync<A, A>
The Cond computation to compose with
f
Func<B>
The 'then' computation
DECLARATION
[Pure]
public static CondAsync<A, B> Then<A, B>(this CondAsync<A, A> self, Func<B> f)
RETURNS
CondAsync<A, B>
A conditional computation
Then<A, B>(CondAsync<A, A>, B)
SUMMARY

Provide the behaviour to run if the condition of the Cond computation is in a Some/True state. This is equivalent to the 'then' part of an If/Then/Else operation.

PARAMETERS
self
CondAsync<A, A>
The Cond computation to compose with
value
B
The 'then' value
DECLARATION
[Pure]
public static CondAsync<A, B> Then<A, B>(this CondAsync<A, A> self, B value)
RETURNS
CondAsync<A, B>
A conditional computation
Then<A, B>(CondAsync<A, A>, Func<A, Task<B>>)
SUMMARY

Provide the behaviour to run if the condition of the Cond computation is in a Some/True state. This is equivalent to the 'then' part of an If/Then/Else operation.

PARAMETERS
self
CondAsync<A, A>
The Cond computation to compose with
f
Func<A, Task<B>>
The 'then' computation
DECLARATION
[Pure]
public static CondAsync<A, B> Then<A, B>(this CondAsync<A, A> self, Func<A, Task<B>> f)
RETURNS
CondAsync<A, B>
A conditional computation
Then<A, B>(CondAsync<A, A>, Func<Task<B>>)
SUMMARY

Provide the behaviour to run if the condition of the Cond computation is in a Some/True state. This is equivalent to the 'then' part of an If/Then/Else operation.

PARAMETERS
self
CondAsync<A, A>
The Cond computation to compose with
f
Func<Task<B>>
The 'then' computation
DECLARATION
[Pure]
public static CondAsync<A, B> Then<A, B>(this CondAsync<A, A> self, Func<Task<B>> f)
RETURNS
CondAsync<A, B>
A conditional computation
Then<A, B>(CondAsync<A, A>, Task<B>)
SUMMARY

Provide the behaviour to run if the condition of the Cond computation is in a Some/True state. This is equivalent to the 'then' part of an If/Then/Else operation.

PARAMETERS
self
CondAsync<A, A>
The Cond computation to compose with
value
Task<B>
The 'then' value
REMARKS
The Then task will always run, even if not needed by the computation. Only use this variant if the Then task is a Task.FromResult(x) or you absolutely definitely need the operation to run in parallel to the If/Else computation so that the result is available as quickly as possible.
DECLARATION
[Pure]
public static CondAsync<A, B> Then<A, B>(this CondAsync<A, A> self, Task<B> value)
RETURNS
CondAsync<A, B>
A conditional computation
Where<A, B>(CondAsync<A, B>, Func<B, bool>)
SUMMARY

Filter the conditional computation. This is the equivalent of the predicate in an If statement.

PARAMETERS
self
CondAsync<A, B>
The conditional computation to test
pred
Func<B, bool>
The predicate function
DECLARATION
[Pure]
public static CondAsync<A, B> Where<A, B>(this CondAsync<A, B> self, Func<B, bool> pred)
RETURNS
CondAsync<A, B>
A conditional computation
Where<A, B>(CondAsync<A, B>, Func<B, Task<bool>>)
SUMMARY

Filter the conditional computation. This is the equivalent of the predicate in an If statement.

PARAMETERS
self
CondAsync<A, B>
The conditional computation to test
pred
Func<B, Task<bool>>
The predicate function
DECLARATION
[Pure]
public static CondAsync<A, B> Where<A, B>(this CondAsync<A, B> self, Func<B, Task<bool>> pred)
RETURNS
CondAsync<A, B>
A conditional computation