LanguageExt.Core

LanguageExt.Core Concurrency Task

Contents

class TaskExtensions Source #

Methods

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

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

Use for pattern-matching the case of the target

Task succeeds = result is A
Task fails    = result is LanguageExt.Common.Error

method Task<A> AsFailedTask <A> (this Exception ex) Source #

method Task<A> AsTask <A> (this A self) Source #

Convert a value to a Task that completes immediately

method Task<A> ToRef <A> (this ValueTask<A> self) Source #

Convert a ValueTask to a Task

method Task<A> Flatten <A> (this Task<Task<A>> self) Source #

Flatten the nested Task type

method Task<A> Flatten <A> (this Task<Task<Task<A>>> self) Source #

Flatten the nested Task type

method Task<U> Select <T, U> (this Task<T> self, Func<T, U> map) Source #

Standard LINQ Select implementation for Task

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

Standard LINQ Where implementation for Task

method Task<U> SelectMany <T, U> (this Task<T> self, Func<T, Task<U>> bind) Source #

Standard LINQ SelectMany implementation for Task

method Task<V> SelectMany <T, U, V> (this Task<T> self, Func<T, Task<U>> bind, Func<T, U, V> project) Source #

Standard LINQ SelectMany implementation for Task

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

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

method Task<U> Bind <T, U> (this Task<T> self, Func<T, Task<U>> bind) Source #

Monadic bind operation for Task

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

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

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

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

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

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

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

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

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

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

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

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

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

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

method Task<Unit> Iter <T> (this Task<T> self, Action<T> f) Source #

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

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

Impure iteration of the bound value in the structure

Parameters

returns

Returns the original unmodified structure

method Task<U> Map <T, U> (this Task<T> self, Func<T, U> map) Source #

Returns map(Result) if not faulted or cancelled.

method Task<U> MapAsync <T, U> (this Task<T> self, Func<T, Task<U>> map) Source #

Returns map(Result) if not faulted or cancelled.

method 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) Source #

method 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) Source #

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

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

method Task<A> Cast <A> (this Task source) Source #

method Task<Unit> ToUnit (this Task source) Source #

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

Convert the structure to an Aff

Parameters

returns

An Aff representation of the structure

class Prelude Source #

Methods

method Task<A> TaskSucc <A> (A self) Source #

Convert a value to a Task that completes immediately

method Task<A> TaskFail <A> (Exception ex) Source #

Convert a value to a Task that completes immediately

method Task<A> flatten <A> (Task<Task<A>> self) Source #

Flatten the nested Task type

method Task<A> flatten <A> (Task<Task<Task<A>>> self) Source #

Flatten the nested Task type

method Task<int> count <A> (Task<A> self) Source #

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

method Task<B> bind <A, B> (Task<A> self, Func<A, Task<B>> bind) Source #

Monadic bind operation for Task

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

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

method Task<bool> existsAsync <A> (Task<A> self, Func<A, Task<bool>> pred) Source #

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

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

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

method Task<bool> forallAsync <A> (Task<A> self, Func<A, Task<bool>> pred) Source #

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

method Task<A> filter <A> (Task<A> self, Func<A, bool> pred) Source #

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

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

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

method Task<S> foldAsync <S, A> (Task<A> self, S state, Func<S, A, Task<S>> folder) Source #

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

method Task<Unit> iter <A> (Task<A> self, Action<A> f) Source #

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

method Task<B> map <A, B> (Task<A> self, Func<A, B> map) Source #

Returns map(Result) if not faulted or cancelled.

method Task<B> mapAsync <A, B> (Task<A> self, Func<A, Task<B>> map) Source #

Returns map(Result) if not faulted or cancelled.

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

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

method Task<A> choice <A> (Task<A> ma, params Task<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 Task<A> choice <A> (Seq<Task<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

method Task<B> apply <A, B> (Task<Func<A, B>> fab, Task<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 Task<B> apply <A, B> (Func<A, B> fab, Task<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 Task<C> apply <A, B, C> (Task<Func<A, B, C>> fabc, Task<A> fa, Task<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 Task<C> apply <A, B, C> (Func<A, B, C> fabc, Task<A> fa, Task<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 Task<Func<B, C>> apply <A, B, C> (Task<Func<A, B, C>> fabc, Task<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 Task<Func<B, C>> apply <A, B, C> (Func<A, B, C> fabc, Task<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 Task<Func<B, C>> apply <A, B, C> (Task<Func<A, Func<B, C>>> fabc, Task<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 Task<Func<B, C>> apply <A, B, C> (Func<A, Func<B, C>> fabc, Task<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>