Created
May 6, 2015 19:12
-
-
Save brodyberg/f865d19616a9df93358b to your computer and use it in GitHub Desktop.
Getting AST for F# Type-Provider action
This file contains 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
#I @"..\packages\FSharp.Data.2.2.0\lib\net40" | |
#r @"..\packages\FSharp.Data.2.2.0\lib\net40\FSharp.Data.dll" | |
open FSharp.Data | |
type Stocks = CsvProvider<"msft.csv"> | |
let stockData = Stocks.Load("msft.csv") | |
// Show AST of Rows getter | |
<@ stockData.Rows @>.Raw | |
// Normal usage of Rows | |
stockData.Rows | |
|> Seq.iter (fun row -> printfn "Date: %A Open: %A" row.Date row.Open) | |
// Iterate through Rows again, but this time show the AST provided | |
// that gets the strongly-typed tuple value for the 'Low' column | |
stockData.Rows | |
|> Seq.iter (fun row -> printfn "%A" <@ row.Low @>) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment