Welcome to MSDN Blogs Sign in | Join | Help

Visual Studio 2010 Beta1 with F# is now available, plus matching F# CTP Update for VS2008

The F# team are thrilled to announce that Visual Studio 2010 Beta1 is now available , including the latest version of F#. Today we are also releasing a matching F# May 2009 CTP for use with Visual Studio 2008 (MSI, ZIP). Further below is a screen shot, more here.

If you’re new to F#, consider watching the PDC presentation on F# by Luca Bolognese, and the live demo of F# and other new language technologies at JAOO by Anders Hejlsberg, Where are Programming Languages Going, or else download, start playing and take the MSDN walkthrough of F# in Visual Studio 2010.

This release is a landmark in the process of making F# a language officially supported by Microsoft, being the first release where F# installs as part of Visual Studio 2010. Using Visual Studio 2010 you can build F# applications for .NET 4.0 Beta1, which has been released today. Likewise, using the F# CTP Update for Visual Studio 2008, you can build F# applications for .NET 2.0/3.0 and 3.5. The F# language itself is the same in both releases, with some additional library functions (e.g. Array.Parallel.map) available with .NET 4.0/Visual Studio 2010 Beta1 (see the detailed release notes).  

As with our previous CTP release, one team focus of the last 6 months has been on refining the F# language and taking feedback from the wonderful and growing F# community. For example, we have now made the F# lightweight syntax option the default for the language (i.e. for .fs/.fsi/.fsx files). We have added support for custom numeric type literals, which allows F# to interoperate nicely with the BigInteger type on .NET 4.0, and have improved aspects of .NET interoperability such as smoother calling of .NET param array methods. You can also use F#'s support for units-of-measure with integer types, e.g. to qualify integer types by annotations such as <Pixels> or <Clicks>. Additionally, we have been focusing on the performance of F# language constructs in this release. In particular, we have made performance improvements to F# sequence expressions, using a state machine compilation for sequence expressions that provides substantial performance improvements for code that generates data using these constructs. Similarly, if you disassemble some F# code you will notice that F# classes have compact representations, and that some other constructs such as F# members taking arguments in curried form are compiled more efficiently. Taken together our aim has been to ensure a predictability in the performance characteristics of related language constructs. More detail in the detailed release notes.

One area we have done considerable work is the F# library, and existing users will notice this when they move their code to this release. The consistent feedback we've had is that the F# library support must be consistent , powerful and simple to use. As a result, we have completed an end-to-end review of the library and made some revisions to ensure standard naming conventions and standard, simpler operator names . The library also now uses uppercase type variable names. More details are available in the detailed release notes, including details of two small breaking changes and some simple ways to cope with these. The Visual Studio 2008 release also provides versions of FSharp.Core.dll to use when developing F# applications for Silverlight 2.0 and the .NET Compact Framework 2.0/3.5.  

This release also sees major improvements in F# debugging. First, in Visual Studio 2010 F# benefits from amazing new technology such as time-travel debugging (ok, it’s officially called historical debugging, but I grew up in the eighties). This a product-quality realization of a long term dream of many language implementations. Next, in both Visual Studio 2008 and Visual Studio 2010 you will see major improvements in data visualization for F# language constructs such as records and discriminated unions and F# library types such as lists, maps and sets. Breakpoint and stepping have also greatly improved, and in Visual Studio 2010 breakpoints can be more accurately positioned inside lambda functions. Some library support also aids in adhoc debugging, e.g. the printf format "%+A" can now be used to print the private, internals of and F# structured object (when running code as full-trust), and a width parameter can be specified to fit the formatted text within a visual display, e.g. "%+128A".  

We have not neglected the F# Language Service and F# Project System. For example, when you build from Visual Studio you will notice that the error list is now populated with errors from the build process. We have also made many performance and reactivity improvements to the F# language service, eliminating points where the Visual Studio user interface became less reactive due to background computations and increasing the number of cases where intellisense is made available. There are also nice additional touches for scripting with F#, such as hovering over a #r declaration now reveals the exact resolution of an assembly reference.

Next, we now have preliminary documentation for the F# language on the MSDN website (yippee!). These are preliminary, and yes there are glitches, so please have patience and send us your feedback J There is also a minor known bug in the walkthroughs where the code snippets all have extra leading whitespace.  Since F# is whitespace-significant by default, be sure to delete this leading whitespace when copying snippets.  These new docs are another good F# reference, as well as a resource for getting started with the language.

Finally, we have done considerable work towards aligning F# with .NET 4.0 additions , with the aim of ensuring a long, bright, compatible future for functional, reactive and parallel programming on the .NET platform. For example, you will see that when using .NET 4.0, F# record, tuple and union types now implement the .NET 4.0 standard types IStructuralEquatable and IStructuralComparable. Furthermore F# tuples are compiled using the standard .NET 4.0 type System.Tuple. We've also added some lovely operators to the F# library for .NET 4.0, in the Microsoft.FSharp.Collections.Array.Parallel module, building on the .NET Parallel Extensions library. For example Array.Parallel.map can be used to perform a parallel map of a function over a large data array. Finally, you'll notice the addition of Async.CreateAsTask and the extension property .AwaitTask as ways to create and wait for .NET 4.0 tasks, meaning you can program .NET tasks directly using the F# asynchronous programming support!  

 Screen Shot VS2010 Beta1

Details of all this and more is in the detailed release notes, and look for more blogging by the F# team and community about all this and more. As always we are very glad to hear your feedback on all aspects of F#, and the above updates especially. We trust you enjoy your F# programming!

Don Syme, for the F# team

Commercial Users of Functional Programming Workshop, Edinburgh, Scotland, 4 September 2009

CUFP is a workshop for presenting case studies in commercial uses of functional programming. Run alongside the more theoretical ICFP (this year in Edinburgh), it provides an interesting interface between the academic and commercial worlds.

If you are using F# or the functional parts of C# (e.g. LINQ) in industry, or have interesting thoughts or perspectives on functional programming in practice, do consider submitting a proprosal for a presentation.

Commercial Users of Functional Programming Workshop (CUFP) 2009

 

Functional Programming As a Means, Not an End

 

Call for Presentations

Sponsored by SIGPLAN

Co-located with ICFP 2009

Edinburgh, Scotland, 4 September 2009

 

 

Presentation proposals due 15 May 2009

http://cufp.galois.com/2009/call.html

 

Posted by dsyme | 1 Comments
Filed under:

Talks I'm Giving This Week: Göteborg, Aarhus, Copenhagen

I’ve a busy week ahead!

 

Tuesday (tomorrow!), 10am: Informal talk at Chalmers University, Göteborg: F# in Visual Studio 2010, courtesy of John Hughes

 

Tuesday (tomorrow!), 1pm: SDC 2009, Scandinavian Developers Conference, Göteborg: Functional and Parallel Programming with F#

                                                                                                                                                                                                                                        

Wednesday, 12noon-2pm: Aarhus University: Why is Microsoft Investing in Functional Programming? And A Look at Some Technical Aspects of F#

 

Thursday, 10am: Copenhagen University: likewise

 

Thursday, 3pm-5pm: Microsoft Copenhagen Development Center: open talk on F# for Developers

 

The last will be recorded!

 

If you’re in the area and can make it to a talk, then do introduce yourself. Hope to see you there!

 

Kind regards

don

Posted by dsyme | 8 Comments

The Maestro team have a blog!

The Maestro team are a Microsoft incubation group looking at Isolation, Agents and Message Passing on .NET. Niklas, from the team, has been very helpful as a reviewer of F# asynchronous workflows and whenever I'm in Redmond we get together to discuss associated topics.

It's great to see the team get a blog, and I'm sure you'll enjoy reading it!

DIsclaimer (from the Maestro blog): "Maestro is an incubation technology and Microsoft has not committed to shipping it"

 

Posted by dsyme | 1 Comments

The basic syntax of F#, by Brian

Brian has two very nice posts on the basic syntax of F#.

The basic syntax of F# - keywords and constructs

The basic syntax of F# - classes, interfaces, and members

I have written lots of blog entries about F#, but I haven't yet described the basic syntax of the language!  So today I'll try to remedy that, describing about a dozen keywords/syntactic-forms that you will most commonly encounter when reading F# code.  This blog entry won't cover all the syntax, but it covers perhaps the most common 75% or so...

and then

Today's blog entry covers the F# syntax for authoring classes, interfaces, and members.  Together with the previous blog entry, this probably covers the most common 90% or so of the language.

 

Posted by dsyme | 1 Comments

Adding Parallel Extensions to F#, from Matt Podwysocki

Matt has a lovely post showing how to define parallel sequences in F#:

In many of my presentations lately, I’ve been using the Parallel Extensions for .NET as part of my heavy computations in F#.  By doing so, I’m able to speed up some of my heavier computations by several fold and take full advantage of my machine.  Over time, with the help of others, I’ve translated many of the functions from the ParallelEnumerable class into those that can easily be consumed by F# in a meaningful way. 

<insert some lovely code>

That’s it.  That’s all there is to it.  Now we can do such simple examples as the following:

> pseq [1..1000] |> PSeq.map ((*) 2) 
    |> PSeq.filter(fun x -> x % 3 = 0) 
    |> PSeq.sum_by_int;;
 
val it : int = 333666
 
 

Specify your C# and F# code using NaturalSpec, from the Dynamics NAV team

Some members of the Dynamics NAV team have announced NaturalSpec, a DSL/language/tool/methodology you can use to specify and test .NET code, e.g. code written in C# or F#. The tool is implemented in F#, and looks like a great addition to the .NET ecosystem.

The idea of NaturalSpec is to give domain experts the possibility to express their scenarios directly in compilable Unit Test scenarios by using a Domain-specific language (DSL) for Unit Tests. NaturalSpec is completely written in F# – but you don’t have to learn F# to use it. You don’t even have to learn programming at all.

...

Of course you can use NaturalSpec to specify C# objects. I see my post "Using NaturalSpec to create a spec for C# projects" for a small sample.

You can download NaturalSpec at GoogleCode and follow the “Getting started” tutorial in order to write your first automatically testable spec.

I am very interested in your feedback. Do you like the syntax? What should I change? Do you consider using a spec tool like NaturalSpec?

 

Posted by dsyme | 0 Comments

Excel Financial functions in F#, version 2.0 released

When Luca Bolognese does a 2.0 release, he only fixes one bug - amazing! If you take a look at the testing he did for this library (with F# Interactive), you can see why.

I simply fixed a bug related to the Rate function (wrong name for parameters).

It is here: http://code.msdn.microsoft.com/FinancialFunctions

 

Posted by dsyme | 0 Comments
Filed under:

New version of FParsec now available

Stephan has updated FParsec, the parser combinator library for F#.

A new version of FParsec (v. 0.7.3.1) has been released fixing a bug in the `normalizeNewlines` function which also affected the `skipped` and `manyTillString` parsers. Everyone is recommended to update.

Best regards,
    Stephan




 

Posted by dsyme | 1 Comments
Filed under:

F# on the Surface?

Gavin wants to be the first to write F# code for the Surface using the Microsoft Surface SDK. Or can you get there first? :-)
Posted by dsyme | 0 Comments
Filed under:

F# Programming Contest, by Kean at AutoDesk

Kean over at AutoDesk (think AutoCAD etc.) is running an F# programming contest!

I've included his post below:

F# programming contest

...

So to start 2009 with a bang (or a pop, at least) I'm going to run a programming contest. The basic idea is to generate some cool examples of using functional programming (more specifically F#) with design applications (more specifically those developed by Autodesk :-). See below for some ideas on what areas people might be interested in looking into.Expert F#

Up for grabs are three copies of Don Syme's book, Expert F#, which have been kindly donated by Apress, its publisher. I've mentioned this excellent book in the past, when I introduced my interview with Don (the interview itself is here). With any luck I'll find a way to get Don to sign the books before sending them to the lucky winners.

So, now for some ground-rules...

  • To enter the contest you need to email me a source project which uses F# for a particular task within one or more of Autodesk's products.
    • The project should be accompanied with a description of what it does and how to use it. Please provide sample models, if they're needed to make the code work.
      • I do need to see the full source, as I can't assess the quality of the code otherwise.
    • There's no limit on the size, as long as I can get the code to work easily.
      • F# code has the potential to be extremely succinct, so please don't assume that bigger means better. Code will be assessed for its elegance as well as what it does.
  • The code submitted must be considered non-confidential and license-free.
    • Which means it can be published (with appropriate credit) via this blog and potentially used by people in commercial applications.
  • I will act as the sole judge, although I may include other people if assessing the use of APIs with which I'm unfamiliar. The judge's decision is final.
    • I can feel the power coursing through my fingertips as I write this... :-)
  • Each of the best three entries will win a copy of "Expert F#".
  • Absolutely anyone can enter, including Autodesk employees, their family members and pets.
    • I'll be publishing the winners' names and probably some information provided by them, so please don't expect to remain completely anonymous if you enter the competition.
  • The closing date for the contest is February 28th, 2009.

Here are some thoughts on areas that might prove interesting...

Data-centric problems

Functional programming is very good at managing (parsing, analysing, even creating) large sets of data. One previous, simple example was to gather and sort all the words found in an AutoCAD drawing. Here's the original post showing this, but an update was provided in my F# AU handouts.

Control flow-centric problems

If you have tasks that can easily be parallelized - in that they can safely be run asynchronously and/or concurrently - then functional programming provides a clean way to capture and execute the logic behind them. An example being a simple application that went away and queried RSS feeds asynchronously, using the results to generate AutoCAD entities. Here are the original posts showing this, but an update was provided in my F# AU handouts.

Domain Specific Languages (DSLs)

Implementing new, custom-purpose programming languages can be an efficient way to control the subset of language features used by a non-programmers to implement code. An example of this was the 3D LOGO implementation inside AutoCAD.

Units of measure

One F# language feature that I also see as being very relevant to our domain is the units of measure implementation. I haven't yet worked with this, myself, but I have certainly been meaning to.

I think that's everything... if I've missed something or you need clarification, please email me or post a comment and I'll respond. Hopefully some of you find this a fun challenge for the (often quite gloomy) start of the year.

F# to ship as part of Visual Studio 2010

Last year, the head of the Microsoft’s Developer Division, S. Somasegar, announced that Microsoft had begun investing in F# as one of Microsoft’s supported languages on the .NET platform. I am now thrilled to announce one result of this investment: F# will ship as part of Visual Studio 2010! Since the September 2008 CTP of F#, the F# team has been working hard on integrating F# into the main development branch of Visual Studio 2010. Below I show a screen shot of using the F# development tools in the 2010 shell, with the new editor and the new look-back-in-time "Debug History" window.

 

Over the last year we’ve seen amazing growth in the F# developer community, and great excitement at conferences and user groups. Two of the recent highlights have been the PDC presentation on F# by Luca Bolognese, and the live demo of F# and other new language technologies at JAOO by Anders Hejlsberg, Where are Programming Languages Going. If you’d like to learn why Microsoft is adding a functional programming language to its Visual Studio and .NET development tools, and the kind of scenarios where this language gives particular productivity benefits, then I can’t think of any better place to start than these two presentations by two of Microsoft’s most experienced development and language experts.

 

In this first supported release, our aim has to be to focus on the core strengths of F# for exploratory programming with F# Interactive, programming with data and implementing parallel and asynchronous components. As we’ve talked to people privately about adding F# to Visual Studio 2010, some questions naturally arise, and I’ve attempted to answer those below. If you have more questions, please ask on the comments below!

 

Early screen shot of F# in Visual Studio 2010

 

 

 

Q. When will the next release of F# be? Will I be able to continue to use F# with VS2008?

o   Our next major release of F# will be as part of the first beta of Visual Studio 2010, and at around the same time we will make available a matching update release of the Visual Studio 2008/.NET2.0 F# compiler and tools.

 

Q. What about shared source?

Our plan is to make both the F# compiler and the core F# library available as shared source on CodePlex in the Visual Studio 2010 timeframe, most likely at the time Visual Studio 2010 ships. We also plan an active CodePlex project called the "F# Power Pack" which will contain tools such as the F# parser and lexer generators. We outlined these plans in a post to the F# mailing list in October.

Q.     Is F# in .NET 4.0?

o   The current plan of record is that the F# core libraries and compiler will ship as an additional component, not in the .NET Framework itself.  We expect this to be available as an F# redistributable package. Referencing this package from a Visual Studio setup project will be sufficient to deploy the core library DLL(s) it to a client machine.

 

Q.     What level of tool support should I expect?

o   As outlined above, our focus in this release of F# is in areas I like to characterize as data-rich and control-flow-rich programming, tackled using a functional programming approach (think algorithms, data manipulations, data transformations, parallel programming, and reactive programming components). The tool support we plan is thus based around editing, scripting, interactive evaluation, the project system, debugging, profiling and great integration with C# and Visual Basic.

 

Q.     Will this release include designer tools?

o   Our focus on delivering high-quality F# core tools is designed to augment Visual Studio’s amazing strengths as a presentation-rich object-oriented programming environment. As a result, we have made an explicit decision to leverage the strengths of C# and Visual Basic as presentational and designer-rich programming languages in this release. This means that F# users should use the Visual Studio designer tools to generate C# or Visual Basic code and incorporate those components into their F# applications. In Visual Studio 2010, we expect F# applications which include components built with designers (e.g. WinForms, ASP.NET, Silverlight and WPF applications with a designer front-end) will normally be authored as mixed language applications. We'll be providing templates that guide F# developers through this process.

 

Q.     What about Mono?

o   The F# compiler and tools will continue to provide a means for Mono users to develop F# applications, initiall through the Visual Studio 2008/.NET2.0 tool chain (see above).

 

Q. F# began as an “OCaml-like language for .NET”? Will it stay that way?

o   F# shares core language constructs with the excellent OCaml  language, from INRIA. This was an early design decision that acknowledged the importance of the Caml language family as a pragmatic realization of functional programming and as a basis for language innovation.  F# itself has now matured to include constructs such as F# object oriented programming, units of measure in F#, F# reflective programming and F# computation expressions.  Looking ahead, our plan of record is to continue to allow the use of F# in a mode that supports cross-compilation of a common subset of F# and OCaml, much as is done today. This will normally require the use of the F# Power Pack components, which will be available separately from the Visual Studio 2010 integration.

 

Q.     Will Microsoft Research stay involved?

o   Yes indeed! F# is a joint advanced development project between Microsoft Research, Cambridge and the Microsoft Developer Division. I am very glad to be staying involved as the language architect and will remain at Microsoft Research. Our awesome team includes people in Cambridge, Redmond, Vancouver and China, and some team members operate from Germany and New York. I am continually amazed at the people I get to work with on this project and the skills they bring, and we hope to make it a prime example of innovative development at Microsoft.

 

Many thanks to everyone in the F# and broader .NET, MSR and language communities for their support and assistance in getting F# to this point. We have exciting times ahead, and we trust this development will make the use of F# compelling and realistic in all its key usage domains.

 

Happy programming and development!

Don

 

 

 

What does this C# code look like in F#? (part one: expressions and statements)

A great blog from Brian McNamara on What does this C# code look like in F#?  

...when you are new to a language (F#), it is sometimes useful to know how to transliterate from a well-known language (C#) for those cases where you just don't know the idioms yet, but don't want that to prevent you from making progress. So today's blog entry takes the general form of "here's some C# code, how do I write the same thing in F#". It is intended to be used as a reference or as casual reading to discover some little-used or lesser-known F# syntax/operators/functions. Don't use this blog post as a way to learn the language, instead use the many useful F# tutorials and samples on the web (start here), and just use this blog post to "fill in the gaps" if needed.

Posted by dsyme | 1 Comments
Filed under:

F# for Scientists online book club

So, it's quite fun to stumble across the F# for Scientists online book club! And the next meeting is tonight!

Welcome to the F# for Scientists Book Club!  Our next meeting is Monday, December 8th @ 7pm PST. We'll be discussing Chapter 2: Program Structure Anyone can join you just need the following:

Posted by dsyme | 1 Comments
Filed under:

.NET Implementations of Excel Financial Functions, in F#

The one and only Luca Bolognese has released his model .NET implementations of Excel financial functions in F#. You can get it from here.

What is it?
This is a .NET library that provides the full set of financial functions from Excel. The main goal for the library is compatibility with Excel, by providing the same functions, with the same behaviour. Note though that this is not a wrapper over the Excel library; the functions have been re-implemented in managed code so that you do not need to have Excel installed to use this library. 
 
Where I can find documentation on these functions?

Just open Excel and click on Formulas/Financial or go to
this

...


How do I use the library?

Just add Financial.dll to the references in your project. The functions are provided as static methods on a Financial class in the System.Numeric namespace


I see the library was implemented with F#. But I don’t want to redistribute F# along with my application. What should I do?
There are two versions of the library. One of them statically links the F# libraries so that there is no dependency on F#. However, this assembly larger, so if you have F# installed, you can use the FinancialNotStandalone.dll instead.

How do I run the tests?

Run FinancialTests.exe. You need Excel 12 for the tests to work because they use Excel to test that the results are correct. You don't need Excel 12 to use the library in your own application.

...

Have you run performance tests on it?
Not at all. The only thing I checked is that all the recursive functions are tail recursive. Feel free to let me know if they are slow.

 

Posted by dsyme | 1 Comments
More Posts Next page »
 
Page view tracker