There have been a lot of rumours, and lots of demos that gave hints about the type providers that were to become available in F# 3.0. At last, a developer preview is here, and they do indeed look like a very powerful technology.
Type providers allow the user to register a provider, which will be called by the F# compiler at compile-time in order for the compiler to get information about types in the F# code that it is compiling. We’ve had tools in the past that you can point at a data source and which generate a .NET assembly of suitable types, but this has always been disconnected from the compiler running. With F# type providers, it is the compiler that drives the discovery process, making it possible to dynamically generate types of the right shape and avoid the need to generate data about types that aren’t called.
This post contains the best example of a type provider implementation that I have seen so far, showing how vector types could be provided for n-dimensional vectors where the n is specified in the source code.