Skip to content

Instantly share code, notes, and snippets.

@dmohl
Created September 17, 2011 03:25
Show Gist options
  • Save dmohl/1223596 to your computer and use it in GitHub Desktop.
Save dmohl/1223596 to your computer and use it in GitHub Desktop.
F# StackOverflow OData Type Provider Example
#r "FSharp.Data.TypeProviders"
#r "System.Data.Services.Client"
open Microsoft.FSharp.Data.TypeProviders
[<Generate>] // Only needed for the Developer Preview (this will be dropped before the official release of F# 3.0)
type stackoverflow =
ODataService<ServiceUri = @"http://data.stackexchange.com/stackoverflow/atom">
let dataContext = stackoverflow.GetDataContext()
query {
for post in dataContext.Posts do
where (post.Tags.Contains "fsharp")
count
} |> printfn "There are %i posts marked with the fsharp tag on SO"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment