Hacker News new | past | comments | ask | show | jobs | submit login

Will you please share your insight? What are Type Providers? What is their advantage over, say, naively dumping type definitions from pre-processing a CSV file?



The user could certainly dump a type definition, but for users who just want to point to some data in one go, the F# type provider[0] works with just:

    CsvProvider<"trades.csv">.Load("trades.csv")
I personally didn't like having to list the file twice, so in Empirical[1] it's just:

    load$("trades.csv")
My current version requires the dollar sign to tell the compiler that the parameter will be static (known at compile time). I'm planning on an updated version[2] that will eliminate the dollar from the function call:

    load("trades.csv")
Basically, it means that users can just load the file like in a dynamically typed language, except that Empirical is statically typed.

[0] https://fsharp.github.io/FSharp.Data/library/CsvProvider.htm...

[1] https://www.empirical-soft.com

[2] https://github.com/empirical-soft/empirical-lang/issues/23


https://docs.microsoft.com/en-us/dotnet/fsharp/tutorials/typ...

It’s not perfect though. When I tried to use them I ended up with problem so I parsed the data in more traditional way.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: