BT

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Topics

Choose your language

InfoQ Homepage News F# 3.0 – LINQ + Type Providers = Information Rich Programming

F# 3.0 – LINQ + Type Providers = Information Rich Programming

This item in japanese

Bookmarks

Microsoft recently announced a developer preview release of F# 3.0 – new features include LINQ-support through Query expressions and a Type Provider System along with a set of built-in providers that allow succinct programming against a variety of data sources.

Information Rich Programming features in F# 3.0 lets you program directly against databases, web services, web data feeds and data brokers. For instance, you will now be able to do this -

[<Generate>]
type Northwind = ODataService<"http://services.odata.org/Northwind/Northwind.svc/">
let db = Northwind.GetDataContext()

query { for cat in db.Categories do
select (cat.CategoryID, cat.CategoryName, cat.Description) }
|> Seq.iter (fun (id, name, description) –>
printfn "ID: %d\nCategory: %s\nDescription: %s\n" id name description)

There are already Type Providers for commonly accessed data source types - OData Services, Database connections, Database Schema, Data specified by the Entity Data Model, Web services and Resource files. Also the Type System is open and pluggable which will allow developers as well as third parties to create their own providers.

A brief of what else new -

  • Auto-Implemented Properties to allow properties without backend stores
  • Parameter Help and Enhanced Intellisense
  • Library Support for nullable types, including conversion operators and arithmetic operators
  • Units of measure types for the International System of Units (SI). This was formerly in the F# PowerPack but has been promoted to the F# Core Library.

You can read details in the MSDN documentation. You can also download the F# Sample pack from CodePlex to see these features in action.

F# is a multi-paradigm programming language, targeting the .NET Framework, that encompasses functional programming as well as imperative and object-oriented programming disciplines.

Rate this Article

Adoption
Style

BT