I want to use the following console program to get the type information (not the data) of Csv type provider. The file name will be passed as a command line argument. However, it seems the CsvProvider<>
only accept constant literal.
Is there a way to workaround it? Or is it possible to do it using F# script? Or can F# compiler service help?
Or is there any other project does this?
open FSharp.Data
open Microsoft.FSharp.Collections
open System
[<Literal>]
let fn = """C:\...\myfile.csv""" // Want to dynamically set the fn from arguments
[<EntryPoint>]
let main argv =
let myFile = CsvProvider<fn>.GetSample()
// The following doesn't work
let fn = argv.[0]
let myFile = CsvProvider<fn>.GetSample()
// code to get type information of myFile