Created
January 20, 2016 21:17
-
-
Save chamook/93eebe1c484ecee5c3db to your computer and use it in GitHub Desktop.
F# makes it easy to go from Task to Async and back again
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| let anAsyncFunction thing = | |
| async { | |
| //a task becomes an async | |
| return! Task.FromResult(thing) |> Async.AwaitTask | |
| } | |
| //and back again! | |
| let nowItsATask = | |
| "yo" |> anAsyncFunction |> Async.StartAsTask |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment