Introducing Visual F# 3.0 Beta!

Introducing Visual F# 3.0 Beta!

  • Comments 9

As announced on Jason Zander’s blog, Visual Studio 11 Beta is now available for download! The release includes the Beta version of F# 3.0, which introduces F# Information Rich Programming.

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.

 

Portable Libraries

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.

1

Silverlight

2

Metro

Like the example? We’ll soon be publishing the source code to Codeplex—stay tuned for details.

 

Type Providers

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.

 

IDE

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:

clip_image006                  clip_image008

 

FSI AnyCPU

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:

image

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.

Resources

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.


Donna Malayeri
Visual Studio F# Program Manager

Leave a Comment
  • Please add 4 and 4 and type the answer here:
  • Post
  • Very good addition on the set of langage constructs for provided types. The previous one was too limited. and the subject is tedious enough already.

  • is there RESX FILE type privider in the F# 3.0 beta?it seems removed right?

  • Seems like LINQ-to-Entities provider uses the old EF 4.0. Is there a way to use (faster and simpler) EF4.3 or EF5-beta POCO approach?

  • The F# Portable Libraries can't work with the silverlight,it will throw out a exception:System.Windows.Markup.XamlParseException:  [Line: 0 Position: 0]

  • Weixiong: the Resx type provider has indeed been dropped, even though it was in the Developer Preview. We decided to limit the number of built-in providers so that we could add the enhancements I mentioned in the post. We may later release the Resx provider as a sample.

    Regarding Silverlight, could you please send a detailed description of the bug (and your source code) to fsbugs@microsoft.com?  Also, make sure you are using Silverlight 5.

  • Congratulations!

    Since query expression nicely style as below,

    let source:System.Data.Objects.ObjectSet<TableAType>=context.TableA

    query {

     for n in source do

     where (n.ColumnA)

     sortBy n.ColumnA

     skip 10

     take 20

    }

    |>Seq.iter (fun a->printfn "%s" (string a.ColumnA))

    but sometimes, I'd like to seen the query style as below

    source

    |>query.Where (fun a->a.ColumnA)

    |>query.SortBy (fun a->a.ColumnA)

    |>query.Skip 10

    |>query.Take 20

    |>query.Run

    |>Seq.iter (fun a->printfn "%s" (string a.ColumnA))

    Is it possible?

  • Zhoutao,

    The other query style is also possible, and has the same behavior. It's just a matter of preference.

  • It's really good news! Thanks for your hard work!

  • When are you guys actually going to do something about the cryptic error "internal error: The lists had different lengths. Parameter name: xs2"

    I really enjoy F# concepts and would love to learn it and use it, but the above error just happens randomly.

    thanks

Page 1 of 1 (9 items)