TaskExtensions Class

DECLARATION
public static class TaskExtensions
NAMESPACE

Methods

AsFailedTask<A>(Exception)
PARAMETERS
ex
Exception
DECLARATION
public static Task<A> AsFailedTask<A>(this Exception ex)
RETURNS
Task<A>
AsTask<T>(T)
SUMMARY

Convert a value to a Task that completes immediately

PARAMETERS
self
T
DECLARATION
public static Task<T> AsTask<T>(this T self)
RETURNS
Task<T>
Bind<T, U>(Task<T>, Func<T, Task<U>>)
SUMMARY

Monadic bind operation for Task

PARAMETERS
self
Task<T>
bind
Func<T, Task<U>>
DECLARATION
public static Task<U> Bind<T, U>(this Task<T> self, Func<T, Task<U>> bind)
RETURNS
Task<U>
Cast<T>(Task)
PARAMETERS
source
Task
DECLARATION
public static async Task<T> Cast<T>(this Task source)
RETURNS
Task<T>
Count<T>(Task<T>)
SUMMARY

Get the Count of a Task T. Returns either 1 or 0 if cancelled or faulted.

PARAMETERS
self
Task<T>
DECLARATION
public static int Count<T>(this Task<T> self)
RETURNS
int
Exists<T>(Task<T>, Func<T, bool>)
SUMMARY

Returns false if the Task is cancelled or faulted, otherwise it returns the result of pred(Result)

PARAMETERS
self
Task<T>
pred
Func<T, bool>
DECLARATION
public static bool Exists<T>(this Task<T> self, Func<T, bool> pred)
RETURNS
bool
Filter<T>(Task<T>, Func<T, bool>)
SUMMARY

Filters the task. This throws a BottomException when pred(Result) returns false

PARAMETERS
self
Task<T>
pred
Func<T, bool>
DECLARATION
public static Task<T> Filter<T>(this Task<T> self, Func<T, bool> pred)
RETURNS
Task<T>
Fold<T, S>(Task<T>, S, Func<S, T, S>)
SUMMARY

Folds the Task. Returns folder(state,Result) if not faulted or cancelled. Returns state otherwise.

PARAMETERS
self
Task<T>
state
S
folder
Func<S, T, S>
DECLARATION
public static S Fold<T, S>(this Task<T> self, S state, Func<S, T, S> folder)
RETURNS
S
ForAll<T>(Task<T>, Func<T, bool>)
SUMMARY

Returns false if the Task is cancelled or faulted, otherwise it returns the result of pred(Result)

PARAMETERS
self
Task<T>
pred
Func<T, bool>
DECLARATION
public static bool ForAll<T>(this Task<T> self, Func<T, bool> pred)
RETURNS
bool
GroupJoin<T, U, K, V>(Task<T>, Task<U>, Func<T, K>, Func<U, K>, Func<T, Task<U>, V>)
PARAMETERS
source
Task<T>
inner
Task<U>
outerKeyMap
Func<T, K>
innerKeyMap
Func<U, K>
project
Func<T, Task<U>, V>
DECLARATION
public static async Task<V> GroupJoin<T, U, K, V>(this Task<T> source, Task<U> inner, Func<T, K> outerKeyMap, Func<U, K> innerKeyMap, Func<T, Task<U>, V> project)
RETURNS
Task<V>
Iter<T>(Task<T>, Action<T>)
SUMMARY

Iterates the Task. Invokes f(Result) if not faulted or cancelled

PARAMETERS
self
Task<T>
f
Action<T>
DECLARATION
public static Unit Iter<T>(this Task<T> self, Action<T> f)
Join<T, U, K, V>(Task<T>, Task<U>, Func<T, K>, Func<U, K>, Func<T, U, V>)
PARAMETERS
source
Task<T>
inner
Task<U>
outerKeyMap
Func<T, K>
innerKeyMap
Func<U, K>
project
Func<T, U, V>
DECLARATION
public static async Task<V> Join<T, U, K, V>(this Task<T> source, Task<U> inner, Func<T, K> outerKeyMap, Func<U, K> innerKeyMap, Func<T, U, V> project)
RETURNS
Task<V>
Map<T, U>(Task<T>, Func<T, U>)
SUMMARY

Returns map(Result) if not faulted or cancelled.

PARAMETERS
self
Task<T>
map
Func<T, U>
DECLARATION
public static Task<U> Map<T, U>(this Task<T> self, Func<T, U> map)
RETURNS
Task<U>
Select<T, U>(Task<T>, Func<T, U>)
SUMMARY

Standard LINQ Select implementation for Task

PARAMETERS
self
Task<T>
map
Func<T, U>
DECLARATION
public static async Task<U> Select<T, U>(this Task<T> self, Func<T, U> map)
RETURNS
Task<U>
SelectMany<T, U, V>(Task<T>, Func<T, Task<U>>, Func<T, U, V>)
SUMMARY

Standard LINQ SelectMany implementation for Task

PARAMETERS
self
Task<T>
bind
Func<T, Task<U>>
project
Func<T, U, V>
DECLARATION
public static async Task<V> SelectMany<T, U, V>(this Task<T> self, Func<T, Task<U>> bind, Func<T, U, V> project)
RETURNS
Task<V>
SelectMany<T, U>(Task<T>, Func<T, Task<U>>)
SUMMARY

Standard LINQ SelectMany implementation for Task

PARAMETERS
self
Task<T>
bind
Func<T, Task<U>>
DECLARATION
public static async Task<U> SelectMany<T, U>(this Task<T> self, Func<T, Task<U>> bind)
RETURNS
Task<U>
Sum(Task<int>)
SUMMARY

Get the Sum of a Task int. Returns either the wrapped value or 0 if cancelled or faulted.

PARAMETERS
self
Task<int>
DECLARATION
public static int Sum(this Task<int> self)
RETURNS
int
Where<T>(Task<T>, Func<T, bool>)
SUMMARY

Standard LINQ Where implementation for Task

PARAMETERS
self
Task<T>
pred
Func<T, bool>
DECLARATION
public static async Task<T> Where<T>(this Task<T> self, Func<T, bool> pred)
RETURNS
Task<T>