Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TWith2Sugars/b51cc908f03ce61e521fb03c0150da96 to your computer and use it in GitHub Desktop.
Save TWith2Sugars/b51cc908f03ce61e521fb03c0150da96 to your computer and use it in GitHub Desktop.
type AsyncBuilder with
member __.Bind(computation: System.Threading.Tasks.Task<'a>, binder: 'a -> Async<'b>): Async<'b> =
async {
let! a = Async.AwaitTask computation
return! binder a
}
member __.Bind(computation: System.Threading.Tasks.Task, binder: unit -> Async<unit>): Async<unit> =
async {
do! Async.AwaitTask computation
return! binder ()
}
member __.ReturnFrom(computation: System.Threading.Tasks.Task<'a>): Async<'a> = Async.AwaitTask computation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment