CondSyncToAsyncExt Class

DECLARATION
public static class CondSyncToAsyncExt
NAMESPACE
LanguageExt

Methods

All<A, B>(Cond<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
Cond<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 Cond<A, B> self, Func<B, Task<bool>> predicates)
RETURNS
CondAsync<A, B>
A conditional computation
Any<A, B>(Cond<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
Cond<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 Cond<A, B> self, Func<B, Task<bool>> predicates)
RETURNS
CondAsync<A, B>
A conditional computation
Else<A, B>(Cond<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
Cond<A, B>
The Cond computation to test
Else
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 Cond<A, B> self, Func<A, Task<B>> Else)
RETURNS
Func<A, Task<B>>
The result of the conditional computation
Else<A, B>(Cond<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
Cond<A, B>
The Cond computation to test
Else
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 Cond<A, B> self, Func<Task<B>> Else)
RETURNS
Func<A, Task<B>>
The result of the conditional computation
Else<A, B>(Cond<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
Cond<A, B>
The Cond computation to test
Else
Task<B>
The Else task 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 Cond<A, B> self, Task<B> Else)
RETURNS
Func<A, Task<B>>
The result of the conditional computation
ElseAsync<A, B>(Cond<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
Cond<A, B>
The Cond computation to test
Else
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 Cond<A, B> self, Func<A, Task<B>> Else)
RETURNS
Func<Task<A>, Task<B>>
The result of the conditional computation
ElseAsync<A, B>(Cond<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
Cond<A, B>
The Cond computation to test
Else
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 Cond<A, B> self, Func<Task<B>> Else)
RETURNS
Func<Task<A>, Task<B>>
The result of the conditional computation
ElseAsync<A, B>(Cond<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
Cond<A, B>
The Cond computation to test
Else
Task<B>
The Else task 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 Cond<A, B> self, Task<B> Else)
RETURNS
Func<Task<A>, Task<B>>
The result of the conditional computation
Filter<A, B>(Cond<A, B>, Func<B, Task<bool>>)
SUMMARY

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

PARAMETERS
self
Cond<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 Cond<A, B> self, Func<B, Task<bool>> pred)
RETURNS
CondAsync<A, B>
A conditional computation
Map<A, B, C>(Cond<A, B>, Func<B, Task<C>>)
SUMMARY

Functor map of the conditional computation

PARAMETERS
self
Cond<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 Cond<A, B> self, Func<B, Task<C>> map)
RETURNS
CondAsync<A, C>
A mapped conditional computation
Select<A, B, C>(Cond<A, B>, Func<B, Task<C>>)
SUMMARY

Functor map of the conditional computation

PARAMETERS
self
Cond<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 Cond<A, B> self, Func<B, Task<C>> map)
RETURNS
CondAsync<A, C>
A mapped conditional computation
SelectMany<A, B, C, D>(Cond<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
Cond<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 Cond<A, B> self, Func<B, CondAsync<A, C>> bind, Func<B, C, D> project)
RETURNS
CondAsync<A, D>
Then<A, B>(Cond<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
Cond<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 Cond<A, A> self, Func<A, Task<B>> f)
RETURNS
CondAsync<A, B>
A conditional computation
Then<A, B>(Cond<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
Cond<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 Cond<A, A> self, Func<Task<B>> f)
RETURNS
CondAsync<A, B>
A conditional computation
Then<A, B>(Cond<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
Cond<A, A>
The Cond computation to compose with
value
Task<B>
The 'then' value
DECLARATION
[Pure]
public static CondAsync<A, B> Then<A, B>(this Cond<A, A> self, Task<B> value)
RETURNS
CondAsync<A, B>
A conditional computation
ToAsync<A, B>(Cond<A, B>)
SUMMARY

Converts a synchronous conditional computation to an asynchronous one

PARAMETERS
self
Cond<A, B>
The synchronous computation to convert
DECLARATION
[Pure]
public static CondAsync<A, B> ToAsync<A, B>(this Cond<A, B> self)
RETURNS
CondAsync<A, B>
Where<A, B>(Cond<A, B>, Func<B, Task<bool>>)
SUMMARY

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

PARAMETERS
self
Cond<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 Cond<A, B> self, Func<B, Task<bool>> pred)
RETURNS
CondAsync<A, B>
A conditional computation