FSharpPlus


Task Module

Additional operations on Task<'T>

Functions and values

Function or value Description

Task.apply f x

Full Usage: Task.apply f x

Parameters:
    f : Task<('T -> 'U)> - Task workflow returning a function
    x : Task<'T> - Task workflow returning a value

Returns: Task<'U>

Creates a task workflow that is the result of applying the resulting function of a task workflow to the resulting value of another task workflow

f : Task<('T -> 'U)>

Task workflow returning a function

x : Task<'T>

Task workflow returning a value

Returns: Task<'U>

Task.bind f source

Full Usage: Task.bind f source

Parameters:
Returns: Task<'U>

Creates a task workflow from 'source' workflow, mapping and flattening its result with 'f'.

f : 'T -> Task<'U>
source : Task<'T>
Returns: Task<'U>

Task.ignore task

Full Usage: Task.ignore task

Parameters:
Returns: Task<unit>

Creates a task that ignores the result of the source task.

It can be used to convert non-generic Task to unit Task.

task : Task
Returns: Task<unit>

Task.join source

Full Usage: Task.join source

Parameters:
Returns: Task<'T>

Flattens two nested tasks into one.

source : Task<Task<'T>>
Returns: Task<'T>

Task.lift2 f x y

Full Usage: Task.lift2 f x y

Parameters:
    f : 'T -> 'U -> 'V - The mapping function.
    x : Task<'T> - First task workflow.
    y : Task<'U> - Second task workflow.

Returns: Task<'V>

Creates a task workflow from two workflows 'x' and 'y', mapping its results with 'f'.

Workflows are run in sequence.

f : 'T -> 'U -> 'V

The mapping function.

x : Task<'T>

First task workflow.

y : Task<'U>

Second task workflow.

Returns: Task<'V>

Task.lift3 f x y z

Full Usage: Task.lift3 f x y z

Parameters:
    f : 'T -> 'U -> 'V -> 'W - The mapping function.
    x : Task<'T> - First task workflow.
    y : Task<'U> - Second task workflow.
    z : Task<'V> - Third task workflow.

Returns: Task<'W>

Creates a task workflow from three workflows 'x', 'y' and z, mapping its results with 'f'.

Workflows are run in sequence.

f : 'T -> 'U -> 'V -> 'W

The mapping function.

x : Task<'T>

First task workflow.

y : Task<'U>

Second task workflow.

z : Task<'V>

Third task workflow.

Returns: Task<'W>

Task.map f source

Full Usage: Task.map f source

Parameters:
    f : 'T -> 'U
    source : Task<'T>

Returns: Task<'U>

Creates a task workflow from 'source' another, mapping its result with 'f'.

f : 'T -> 'U
source : Task<'T>
Returns: Task<'U>

Task.map2 mapper task1 task2

Full Usage: Task.map2 mapper task1 task2

Parameters:
    mapper : 'T1 -> 'T2 -> 'U - The mapping function.
    task1 : Task<'T1> - First Task workflow.
    task2 : Task<'T2> - Second Task workflow.

Returns: Task<'U>

Creates a Task workflow from two workflows, mapping its results with a specified function.

Similar to lift2 but although workflows are started in sequence they might end independently in different order and all errors are collected.

mapper : 'T1 -> 'T2 -> 'U

The mapping function.

task1 : Task<'T1>

First Task workflow.

task2 : Task<'T2>

Second Task workflow.

Returns: Task<'U>

Task.map3 mapper task1 task2 task3

Full Usage: Task.map3 mapper task1 task2 task3

Parameters:
    mapper : 'T1 -> 'T2 -> 'T3 -> 'U - The mapping function.
    task1 : Task<'T1> - First Task workflow.
    task2 : Task<'T2> - Second Task workflow.
    task3 : Task<'T3> - Third Task workflow.

Returns: Task<'U>

Creates a Task workflow from three workflows, mapping its results with a specified function.

Similar to lift3 but although workflows are started in sequence they might end independently in different order and all errors are collected.

mapper : 'T1 -> 'T2 -> 'T3 -> 'U

The mapping function.

task1 : Task<'T1>

First Task workflow.

task2 : Task<'T2>

Second Task workflow.

task3 : Task<'T3>

Third Task workflow.

Returns: Task<'U>

Task.raise e

Full Usage: Task.raise e

Parameters:
    e : exn

Returns: Task<'U>

Raises an exception in the Task

e : exn
Returns: Task<'U>

Task.result value

Full Usage: Task.result value

Parameters:
    value : 'a

Returns: Task<'a>

Creates a Task from a value

value : 'a
Returns: Task<'a>

Task.tryFinally body compensation

Full Usage: Task.tryFinally body compensation

Parameters:
    body : unit -> Task<'T>
    compensation : unit -> unit

Returns: Task<'T>

Used to de-sugar try .. finally .. blocks in Computation Expressions.

body : unit -> Task<'T>
compensation : unit -> unit
Returns: Task<'T>

Task.tryWith body compensation

Full Usage: Task.tryWith body compensation

Parameters:
    body : unit -> Task<'T>
    compensation : exn -> Task<'T>

Returns: Task<'T>

Used to de-sugar try .. with .. blocks in Computation Expressions.

body : unit -> Task<'T>
compensation : exn -> Task<'T>
Returns: Task<'T>

Task.using disp body

Full Usage: Task.using disp body

Parameters:
    disp : 'a
    body : 'a -> Task<'a0>

Returns: Task<'a0>

Used to de-sugar use .. blocks in Computation Expressions.

disp : 'a
body : 'a -> Task<'a0>
Returns: Task<'a0>

Task.zip task1 task2

Full Usage: Task.zip task1 task2

Parameters:
Returns: Task<'T1 * 'T2>

Creates a task workflow from two workflows 'task1' and 'task2', tupling its results.

Similar to zipSequentially but although workflows are started in sequence they might end independently in different order and all errors are collected.

task1 : Task<'T1>
task2 : Task<'T2>
Returns: Task<'T1 * 'T2>

Task.zip3 task1 task2 task3

Full Usage: Task.zip3 task1 task2 task3

Parameters:
Returns: Task<'T1 * 'T2 * 'T3>

Creates a task workflow from two workflows 'task1', 'task2' and 'task3', tupling its results.

Similar to zipSequentially but although workflows are started in sequence they might end independently in different order and all errors are collected.

task1 : Task<'T1>
task2 : Task<'T2>
task3 : Task<'T3>
Returns: Task<'T1 * 'T2 * 'T3>

Task.zipSequentially x y

Full Usage: Task.zipSequentially x y

Parameters:
Returns: Task<'T * 'U>

Creates a task workflow from two workflows 'x' and 'y', tupling its results.

x : Task<'T>
y : Task<'U>
Returns: Task<'T * 'U>