ValueTask Module
Contains camelCase module-level functions for ValueTask computations.
Functions and values
| Function or value |
Description
|
Full Usage:
ValueTask.bind binder task
Parameters:
'T -> ValueTask<'U>
-
A function that takes the result of the value task and returns a new value task.
task : ValueTask<'T>
-
The input value task.
Returns: ValueTask<'U>
A value task that performs a monadic bind on the result of task.
Modifiers: inline Type parameters: 'T, 'U |
Creates a value task that passes the result of the given value task to the binder function.
Example
val vt: obj
|
Full Usage:
ValueTask.catch task
Parameters:
ValueTask<'T>
-
The input ValueTask.
Returns: ValueTask<Result<'T, exn>>
A ValueTask that yields a Result: Ok with the outcome on success,
or Error with the exception on failure.
Propagates the underlying cancellation exception when task is canceled.
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 |
Full Usage:
ValueTask.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 : ValueTask<'T>
-
The input ValueTask.
Returns: ValueTask<'T>
A ValueTask 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 value task that runs the given value task and ignores its result.
When the value task is already synchronously complete, this avoids allocating a
Example
val vt: obj
type unit = Unit
Multiple items
val int: value: 'T -> int (requires member op_Explicit) -------------------- type int = int32 -------------------- type int<'Measure> = int |
|
Creates a value task that applies the mapping function to the result of the given value task.
Example
val vt: obj
|
|
|
Full Usage:
ValueTask.result value
Parameters:
'T
-
The value to return.
Returns: ValueTask<'T>
A completed value task that returns value.
Modifiers: inline Type parameters: 'T |
Creates a value task that returns the given value.
Example
val vt: obj
|
FSharp.Core