Building Type Providers for F#
Type Providers are an interesting feature of F#. From the developer’s perspective, they are like any of statically defined type. But rather than coming from the metadata of a CLR assembly, they are created as needed by code that is executed at design time. The source can be anything, with databases and REST or OData style web services being the most common option.
In a 2011 article, Ivan Towlson demonstrated how developers can create type providers to reduce boilerplate in code that doesn’t look at external services. His example created vector types of varying lengths, as well as the common operations that apply to the same.
FSharpx is an open source project offered under the Apache License, Version 2.0.
For those who rely on the statistical analysis language R, Blue Mountain is offering an F# R Type Provider. This type provider is also offered as an open source project, with a non-standard but very lenient license.
For more information on F# type providers see Joe Pamer’s video The Future of F#: Type Providers and the Microsoft Research paper F#3.0 - Strongly-Typed Language Support for Internet-Scale Information Sources.
It may also be useful to look at other languages that offer similar capabilities. One such language is Gosu. This JVM-based language uses what they call the Open Type System. Cédric Beust has a good introduction to the Open Type System with plenty of links to more in depth discussions.
F# Data Library
FSharpX is more general purpose package that contains "a bit of everything" and changes more organically. It has more features, but lacks some stability and documentation. However, FSharpX contains other type providers (including Xaml, Graph, Regex, etc.) that are not focused on data access and will not probably appear in F# Data (because they serve different purpose).
So, I think F# Data should be a better starting point for those interested in data access in F#.
Ruslan Meshenberg Sep 21, 2014