I have a requirement to read a csv file and generate several different projections of the data from save to files. I'm using CsvProvider
to read the file and then map the data into other CsvProviders which I save to disk. Currently I have seperate save functions to save each of these projections. I'm wondering if I could create a generic saveCsv
function like this?
let saveCsv<'a when 'a :> CsvProvider> (csvType:'a) fileName data =
let csv = new csvType(data)
csv.Save(fileName)
I can't seem to get the type constraint correct and also how do I new up a instance of the csvtype?