1 people like it.

F# Data type providers

Reading the F# snippets RSS feed using the F# Data XML type provider. Look, you now get tool tips for type providers too!

 1: 
 2: 
 3: 
 4: 
 5: 
 6: 
 7: 
 8: 
 9: 
10: 
11: 
12: 
#r "System.Xml.Linq.dll"
open FSharp.Data

type Rss = XmlProvider<"http://fssnip.net/pages/Rss">
let snippets = Rss.GetSample()

// Title.Value is a property returning string 
printfn "%s" snippets.Channel.Title.Value

// Get all item nodes and print title with link
for item in snippets.Channel.Items do
  printfn " - %s (%s)" item.Title.Value item.Link
namespace Microsoft.FSharp
namespace Microsoft.FSharp.Data
type Rss = obj

Full name: Script.Rss
val snippets : obj

Full name: Script.snippets
val printfn : format:Printf.TextWriterFormat<'T> -> 'T

Full name: Microsoft.FSharp.Core.ExtraTopLevelOperators.printfn
val item : obj

More information

Link:http://fssnip.net/tO
Posted:7 years ago
Author:Tomas Petricek
Tags: type providers , f# data