F# 4.6 and F# Tools For Visual Studio 2019 Are Now Generally Available

Along with a new record type 'Anonymous Records' in the language, there are several updates in the F# Core library.

Recently, Microsoft announced the general availability of F# 4.6 and F# tools for Visual Studio 2019.
This release is introducing a new record type called Anonymous Records, and there are several updates in the F# Core library. The company said that for the updates and development of new features in F# 4.6, the team followed an open RFC process.
Writing named record types in F# has not been easy in previous versions and to address that a new type is introduced called Anonymous Records. According to the company, Anonymous Records are F# record types that do not have explicit names and can be declared in an ad-hoc fashion. These Records will fill various smaller gaps F# programmers have encountered over time, and can be used for succinct data manipulation that was not previously possible.
  1. open System  
  3. let circleStats radius =  
  4. let d = radius * 2.0  
  5. let a = Math.PI * (radius ** 2.0)  
  6. let c = 2.0 * Math.PI * radius  
  8. {| Diameter=d; Area=a; Circumference=c |}  
  10. let r = 2.0  
  11. let stats = circleStats r  
  12. printfn "Circle with radius: %f has diameter %f, area %f, and circumference %f"  
  13. r stats.Diameter stats.Area stats.Circumference  
Source: Microsoft
The F# Core library has updates in the ‘ValueOption’ type. A new attribute called DebuggerDisplay has been added that helps in debugging. And also the IsNone, IsSome, None, Some, op_Implicit, and ToString members have been added. Moreover, there is now a ‘ValueOption’ module, which contains the same functions the Option module has.
According to the company a lot of effort has been put on improving the performance of F# tools for Visual Studio, especially around performance for larger solutions. There are improvements in the F# parser, significant reductions in cache sizes, significant reductions in allocations when processing format strings and more.
The new release also brings a new feature that intelligently idents pasted code based on where your cursor is. To use this feature you will need to turn on Smart Indent via Tools > Options > Text Editor > F# > Tabs > Smart .
To read the full list of updates in F# 4.6 and F# tools for Visual Studio 2019 you can visit official announcement.