AsyncBuilder (FSharp.Core)

Creates an asynchronous computation that runs computation, and when computation generates a result T, runs binder res.

computation : Async<'T>

The computation to provide an unbound result.

binder : 'T -> Async<'U>

The function to bind the result of computation.

Returns: Async<'U>

An asynchronous computation that performs a monadic bind on the result of computation.

Creates an asynchronous computation that first runs computation1 and then runs computation2, returning the result of computation2.

computation1 : Async<unit>

The first part of the sequenced computation.

computation2 : Async<'T>

The second part of the sequenced computation.

Returns: Async<'T>

An asynchronous computation that runs both of the computations sequentially.

Creates an asynchronous computation that runs generator.

generator : unit -> Async<'T>

The function to run.

Returns: Async<'T>

An asynchronous computation that runs generator.

Creates an asynchronous computation that enumerates the sequence seq on demand and runs body for each element.

sequence : 'T seq

The sequence to enumerate.

body : 'T -> Async<unit>

A function to take an item from the sequence and create an asynchronous computation. Can be seen as the body of the for expression.

Returns: Async<unit>

An asynchronous computation that will enumerate the sequence and run body for each element.

Creates an asynchronous computation that returns the result v.

value : 'T

The value to return from the computation.

Returns: Async<'T>

An asynchronous computation that returns value when executed.

Delegates to the input computation.

computation : Async<'T>

The input computation.

Returns: Async<'T>

The input computation.

Creates an asynchronous computation that runs computation. The action compensation is executed after computation completes, whether computation exits normally or by an exception. If compensation raises an exception itself the original exception is discarded and the new exception becomes the overall result of the computation.

computation : Async<'T>

The input computation.

compensation : unit -> unit

The action to be run after computation completes or raises an exception (including cancellation).

Returns: Async<'T>

An asynchronous computation that executes computation and compensation afterwards or when an exception is raised.

Creates an asynchronous computation that runs computation and returns its result. If an exception happens then catchHandler(exn) is called and the resulting computation executed instead.

computation : Async<'T>

The input computation.

catchHandler : exn -> Async<'T>

The function to run when computation throws an exception.

Returns: Async<'T>

An asynchronous computation that executes computation and calls catchHandler if an exception is thrown.

Creates an asynchronous computation that runs binder(resource). The action resource.Dispose() is executed as this computation yields its result or if the asynchronous computation exits by an exception or by cancellation.

resource : 'T

The resource to be used and disposed.

binder : 'T -> Async<'U>

The function that takes the resource and returns an asynchronous computation.

Returns: Async<'U>

An asynchronous computation that binds and eventually disposes resource.

Creates an asynchronous computation that runs computation repeatedly until guard() becomes false.

guard : unit -> bool

The function to determine when to stop executing computation.

computation : Async<unit>

The function to be executed. Equivalent to the body of a while expression.

Returns: Async<unit>

An asynchronous computation that behaves similarly to a while loop when run.

Creates an asynchronous computation that just returns ().

Returns: Async<unit>

An asynchronous computation that returns ().