BT

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

by Roopesh Shenoy on Sep 20, 2011 |

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.

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Tell us what you think

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Don Syme's Build Conference talk on F# 3.0 is also worth a look by Faisal Waris

More resources by Werner Schuster

Tomas Petricek also has a good overview:
tomasp.net/blog/goto-loosely-structured-data.aspx

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

2 Discuss

Educational Content

General Feedback
Bugs
Advertising
Editorial
InfoQ.com and all content copyright © 2006-2014 C4Media Inc. InfoQ.com hosted at Contegix, the best ISP we've ever worked with.
Privacy policy
BT