Created
July 27, 2010 15:16
-
-
Save chaliy/492365 to your computer and use it in GitHub Desktop.
F# async worflow example
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
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