Skip to content

Instantly share code, notes, and snippets.

@dungpa
Created September 13, 2012 19:47
Show Gist options
  • Save dungpa/3717085 to your computer and use it in GitHub Desktop.
Save dungpa/3717085 to your computer and use it in GitHub Desktop.
Common mistake
async {
let wc = new WebClient()
let html = wc.DownloadString(uri)
printfn "%s" html }
// To make code in F# async workflow actually asynchronous,
// we need to use a primitive operation of type Async<'T>
// (implemented usually in the F# library as an extension) and call it using let! or do!:
async {
let wc = new WebClient()
let! html = wc.AsyncDownloadString(uri) // Asynchronous call here!
printfn "%s" html }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment