AsyncExtensions Module

For F# 3.0, you can open this module to get extensions for Async<'a>: - Support for bind on Task<'a> in async{} - Async.WithTimeout : TimeSpan * Async<'a> -> _ - Async.AsyncRaise : exn -> _ - Async.AwaitTask : Task -> _ For F# 4.0 these things are mostly implemented, so you can choose not to open this module.

Type extensions

Type extension Description

Async.AsyncRaise(e)

Full Usage: Async.AsyncRaise(e)

Parameters:
    e : exn

Returns: Async<'a>

Raise an exception on the async computation/workflow.

Extended Type: Async

e : exn
Returns: Async<'a>

Async.AwaitTask(t)

Full Usage: Async.AwaitTask(t)

Parameters:
Returns: Async<unit>

Await a task asynchronously

Extended Type: Async

t : Task
Returns: Async<unit>

this.Bind

Full Usage: this.Bind

Parameters:
Returns: Async<'R>

An extension method that overloads the standard 'Bind' of the 'async' builder. The new overload awaits on a standard .NET task

Extended Type: AsyncBuilder

t : Task<'T>
f : 'T -> Async<'R>
Returns: Async<'R>

this.Bind

Full Usage: this.Bind

Parameters:
Returns: Async<'R>

An extension method that overloads the standard 'Bind' of the 'async' builder. The new overload awaits on a standard .NET task which does not commpute a value

Extended Type: AsyncBuilder

t : Task
f : unit -> Async<'R>
Returns: Async<'R>

this.Bind

Full Usage: this.Bind

Parameters:
Returns: Async<'R>

Extended Type: AsyncBuilder

t : ValueTask
f : unit -> Async<'R>
Returns: Async<'R>

this.Bind

Full Usage: this.Bind

Parameters:
Returns: Async<'R>

Extended Type: AsyncBuilder

t : ValueTask<'T>
f : 'T -> Async<'R>
Returns: Async<'R>

Task.ToIAsyncResult(task, callback, state)

Full Usage: Task.ToIAsyncResult(task, callback, state)

Parameters:
Returns: IAsyncResult

From Task-based asynchronous model to Begin/End pattern

Extended Type: Task

task : Task<'T>
callback : AsyncCallback
state : obj
Returns: IAsyncResult

Async.WithTimeout(timeout, computation)

Full Usage: Async.WithTimeout(timeout, computation)

Parameters:
Returns: Async<'T>

Spawn an async with a timeout, throwing after the timeout.

Extended Type: Async

timeout : TimeSpan
computation : Async<'T>
Returns: Async<'T>