Skip to content

Instantly share code, notes, and snippets.

@chaliy
Created July 27, 2010 15:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save chaliy/492365 to your computer and use it in GitHub Desktop.
Save chaliy/492365 to your computer and use it in GitHub Desktop.
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