Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
F# async worflow example
open System.IO
open System.Net
open System.Text
async {
let file = File.OpenRead("Program.fs")
let! stuff = file.AsyncRead(250)
printfn "%A" (Encoding.Default.GetString(stuff))
let req = WebRequest.Create("http://www.google.com/search?q=node.js")
let! resp = req.AsyncGetResponse()
printfn "%i headers recieved." resp.Headers.Count
} |> Async.RunSynchronously
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment