We have some new F# features to announce in this Beta release, including portable library support, enhancements to type providers, improved IntelliSense, and an AnyCPU version of FSI. We’ve also updated the F# 3.0 sample pack for Beta.
F# now has support for portable libraries, which allows you to create assemblies that work on more than one .NET platform, without requiring recompilation. You can put your analytical code in an F# portable library and reference it from a WPF, Silverlight 5, or Win8 Metro application.
For example, you could create a spreadsheet program with both a Silverlight 5 and Metro front-end (see screenshots below). All of the spreadsheet logic, such as parsing and executing formulas, can be factored into an F# portable library, and the front-end projects contain only UI code.
Like the example? We’ll soon be publishing the source code to Codeplex—stay tuned for details.
On the type provider front, we’ve improved our New Item templates for type providers. There are templates for a SQL database connection (using either LINQ to SQL or LINQ to Entities), an OData connection, or a WSDL connection. If you’re new to type providers, these templates are a great way to get started.
The WSDL type provider now supports configuration files and named endpoints, to handle the case when one service offers multiple endpoints. Most of the providers also have the parameters ConnectionString and ConnectionStringName which let you use configuration files more easily. There are also additional parameters that make it easier to work with relative directories.
We’ve also made type providers easier to use. The built-in type providers no longer require the “[<Generate>]” attribute, and now you can clear a type provider’s cache by cleaning the project or closing the script file.
For type provider authors, we’ve expanded the set of language constructs that are supported in provided members, such as lambdas. This was made possible by changing the type provider infrastructure to use Microsoft.FSharp.Quotations.Exprs rather than System.Linq.Expressions.
In this release, we’ve added even more IntelliSense enhancements—in addition to the ones you’ve already seen, such as parameter help. IntelliSense now does more context-sensitive filtering (for instance, after the inherit keyword), and now supports camel-case filtering. For instance, Console.WL will auto-complete to Console.WriteLine.
Type providers don’t always provide IntelliSense immediately—such as when querying a web service—so in these situations, the IDE will show a progress icon, as in the screenshots below:
The F# Interactive executable (FSI.exe), is a 32-bit program, so only 32-bit assemblies can be used in it. Since 64-bit assemblies are becoming more common (such as in the new Cloud Numerics library), we have created an AnyCPU version of FSI, which is located in “C:\Program Files (x86)\Microsoft SDKs\F#\3.0\Framework\v4.0\FsiAnyCPU.exe” by default. To use this version of FSI, set a different path in the F# Tools options:
On the topic of F# Interactive, sadly the Beta release has a bug–you can’t bring up the interactive window from the View menu. But, there’s an easy workaround: open a .fs or .fsx file and either press Alt+Enter, or select Execute in Interactive from the context menu. We’ve fixed this issue in our local builds, and the bug will be fixed in the next release.
You can install Visual Studio 11 Beta on Windows 7 to get up and running quickly, or set it up on top of the Windows 8 Consumer Preview, which has also just been released. Read more about F# 3.0 features in our previous blog post about the Developer Preview release. Be sure to check out some of our videos, the F# 3.0 Sample Pack, the F# Developer Center, or our MSDN pages. As always, we look forward to your feedback—post on the F# forums or UserVoice.
Visual Studio F# Program Manager