Ready to dig deeper into F# 4.1? Jonathan Allen provides an in-depth look at these new F# features.

The Visual Studio 2017 release in early March included F# 4.1 and an update of the Visual F# tools. F# 4.1 brings improvements and interoperation with C# 7 while the tools are the first version supporting the Roslyn workspaces.

As previously covered, F# 4.1 brings improvements and interoperation with C# 7:

Struct tuples and support for C# value tuples

Struct annotations for records and discriminated unions

fixed keyword support

keyword support Underscores in numeric literals

Caller info argument attributes

Result type

Mutually referential types and modules within the same file

Byref returns and support for C# 7 ref-returning methods

Error message improvements

Implement IReadonlyCollection<’T> in list<’T>

Additional option module functions

Statically resolved type parameter improvements

Compiler performance improvements

An updated version of the Visual F# tools also shipped with Visual Studio 2017. A notable addition to the tools is the support of Roslyn Workspace APIs:

A workspace is an active representation of your solution as a collection of projects, each with a collection of documents. A workspace is typically tied to a host environment that is constantly changing as a user types or manipulates properties.

IDEs such as Visual Studio use the Roslyn workspace APIs to provide multiple features. While the compiler part of Roslyn is C#/VB specific, some APIs such as the workspaces sit at a higher level and are not tied to a particular language. Thus, implementing the API means an IDE feature can support F# directly instead of needing a distinct implementation for F#. The features refactored to use Roslyn workspaces include:

Find all references

Navigation bar support

Syntax and type colorization in hovers and signature help

IntelliSense filters and glyph improvements

Fuzzy matching on names in IntelliSense

Better colorization in the editor

Code Indentation improvements

Breakpoint resolution improvements

Go to definition improvements

Ability to trigger Lightbulbs for various code fixes

Semantic highlighting of tokens

Support of Go to All feature (ctrl+T)

Roslyn-style inline rename

The official announcement from Microsoft also acknowledges the many contributions of the F# community. Several community members were thanked for their contributions to the F# compiler, Visual F# tools and language design.