Less to migrate, less to maintain, and I'll never swap these out as components; might as well get the ease of managing them all in one project.
17 lines
685 B
Forth
17 lines
685 B
Forth
[<AutoOpen>]
|
|
module MyWebLog.Data.RethinkDB.Extensions
|
|
|
|
open System.Threading.Tasks
|
|
|
|
// H/T: Suave
|
|
type AsyncBuilder with
|
|
/// An extension method that overloads the standard 'Bind' of the 'async' builder. The new overload awaits on
|
|
/// a standard .NET task
|
|
member x.Bind(t : Task<'T>, f:'T -> Async<'R>) : Async<'R> = async.Bind(Async.AwaitTask t, f)
|
|
|
|
/// 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
|
|
member x.Bind(t : Task, f : unit -> Async<'R>) : Async<'R> = async.Bind(Async.AwaitTask t, f)
|
|
|
|
member x.ReturnFrom(t : Task<'T>) = Async.AwaitTask t
|