Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ


Choose your language

InfoQ Homepage News F# Type Providers – Why And How

F# Type Providers – Why And How

This item in japanese

Microsoft Research has published a white paper explaining how Type Providers makes F# useful for accessing and processing “internet scale” information sources.

What problems are Type Providers intended to solve?

  • Non-uniform schematization of data in various sources across the internet
  • Need to have a parsing layer (either auto-generated or manually written) for accessing each of these sources in a target language

Type Providers provide a standard mechanism to wrap an existing type of data source such that the data and matadata is available to the F# programmer – there is no need to create a separate wrapper for different data sources and schemas for that type once a provider is created. The data structure is inferred by the type provider by connecting to the data source at design time (assuming connectivity to the source).

This data can also be accessed by the the F# compiler and allows various IDE features such as intellisense and in-line documentation, with schema and metadata pulled from the data-source on demand.

Combined with LINQ, this makes F# extremely useful in manipulating data directly from various sources. You can have a look at this presentation by Joe Pamer for more details.

F# 3.0 was released along with .NET framework 4.5. Microsoft recently announced a Code-drop for it - you can now see how this feature is implemented under-the-hood.  

Rate this Article