Task Module
Contains camelCase module-level functions for Task computations.
Functions and values
| Function or value |
Description
|
|
Creates a task that passes the result of the given task to the binder function.
Example
val t: obj
|
|
Creates a
Example
val safeDiv: x: int -> y: int -> 'a
val x: int
val y: int
val task: TaskBuilder
Multiple items
module Result from Microsoft.FSharp.Core -------------------- type Result<'T,'TError> = | Ok of ResultValue: 'T | Error of ErrorValue: 'TError |
Full Usage:
Task.catchWith handler task
Parameters:
exn -> 'T
-
A function to handle (non-cancellation) exceptions, yielding a recovery value based on the exception.
Any exception thrown by handler will propagate.
task : Task<'T>
-
The input Task.
Returns: Task<'T>
A Task that yields the result of task on success, or handler exn on failure.
Propagates the underlying cancellation exception when task is canceled.
Modifiers: inline Type parameters: 'T |
Creates a
Example
val safeDiv: x: int -> y: int -> 'a
val x: int
val y: int
val task: TaskBuilder
Multiple items
module Result from Microsoft.FSharp.Core -------------------- type Result<'T,'TError> = | Ok of ResultValue: 'T | Error of ErrorValue: 'TError |
|
|
|
Creates a task that runs the given task and ignores its result.
Example
val t: obj
type unit = Unit
Multiple items
val int: value: 'T -> int (requires member op_Explicit) -------------------- type int = int32 -------------------- type int<'Measure> = int |
|
Creates a task that applies the mapping function to the result of the given task.
Example
val t: obj
|
|
Example
val vt: obj
Multiple items
val int: value: 'T -> int (requires member op_Explicit) -------------------- type int = int32 -------------------- type int<'Measure> = int val t: obj
|
Full Usage:
Task.parallelDoLimit maxDegreeOfParallelism ct computations
Parameters:
int
-
The maximum number of tasks to run concurrently. Must be > 0.
ct : CancellationToken
-
An outer cancellation token used to cancel the parallel request.
When multiple tasks can run concurrently, task factories receive a linked token that is also canceled if a sibling faults;
otherwise they receive ct directly.
computations : (CancellationToken -> Task<unit>) seq
-
A sequence of unit task start functions accepting a CancellationToken.
Returns: Task<unit>
A task that runs all inputs with the specified parallelism limit and returns unit.
|
Creates a task that executes the
The relative start and completion order per computation is arbitrary. If any of the computations Fault, the governing CancellationToken of its siblings will be Canceled. Where multiple computations Fault, a single exception is propagated.
Example
val task: TaskBuilder
Multiple items
val seq: sequence: 'T seq -> 'T seq -------------------- type 'T seq = System.Collections.Generic.IEnumerable<'T> val i: int
val _ct: obj
val printfn: format: Printf.TextWriterFormat<'T> -> 'T
|
Full Usage:
Task.parallelLimit maxDegreeOfParallelism ct computations
Parameters:
int
-
The maximum number of tasks to run concurrently. Must be > 0.
ct : CancellationToken
-
An outer cancellation token used to cancel the parallel request.
When multiple tasks can run concurrently, task factories receive a linked token that is also canceled if a sibling faults;
otherwise they receive ct directly.
computations : (CancellationToken -> Task<'T>) seq
-
A sequence of task start functions accepting a CancellationToken.
Returns: Task<'T[]>
A task yielding an array of the results of computations in the order they were supplied.
Type parameters: 'T |
Creates a task that executes each of the
The relative start and completion order per computation is arbitrary. If any of the computations Fault, the governing CancellationToken of its siblings will be Canceled. Where multiple computations Fault, a single exception is propagated.
Example
val task: TaskBuilder
Multiple items
val seq: sequence: 'T seq -> 'T seq -------------------- type 'T seq = System.Collections.Generic.IEnumerable<'T> val i: int
val _ct: obj
|
Full Usage:
Task.result value
Parameters:
'T
-
The value to return.
Returns: Task<'T>
A completed task that returns value.
Modifiers: inline Type parameters: 'T |
Creates a task that returns the given value.
Example
val t: obj
|
Full Usage:
Task.sequential ct computations
Parameters:
CancellationToken
-
A cancellation token to pass to each task factory.
computations : (CancellationToken -> Task<'T>) seq
-
A sequence of task start functions accepting a CancellationToken.
Returns: Task<'T[]>
A task yielding an array of the results of computations in the order they were supplied.
Type parameters: 'T |
Creates a task that executes each of the
Example
val task: TaskBuilder
Multiple items
val seq: sequence: 'T seq -> 'T seq -------------------- type 'T seq = System.Collections.Generic.IEnumerable<'T> val i: int
val _ct: obj
|
Full Usage:
Task.sequentialDo ct computations
Parameters:
CancellationToken
-
A cancellation token to pass to each task factory.
computations : (CancellationToken -> Task<unit>) seq
-
A sequence of unit task start functions accepting a CancellationToken.
Returns: Task<unit>
A task that runs all inputs in sequence and returns unit.
|
Creates a task that executes each of the
Example
val task: TaskBuilder
Multiple items
val seq: sequence: 'T seq -> 'T seq -------------------- type 'T seq = System.Collections.Generic.IEnumerable<'T> val i: int
val _ct: obj
val printfn: format: Printf.TextWriterFormat<'T> -> 'T
|
Full Usage:
Task.startAsyncImmediate ct computation
Parameters:
CancellationToken
-
A cancellation token to use for computation.
computation : Async<'T>
-
The async computation to start.
Returns: Task<'T>
A task representing the result of computation.
Type parameters: 'T |
Starts the
The computation begins executing synchronously on the calling thread, offloading only at the point
where it first suspends (mirroring Async.StartImmediateAsTask).
Example
val cts: obj
val task: TaskBuilder
val async: AsyncBuilder
|
FSharp.Core