News

What's New in F# 4.7

Functional programming devotees welcomed the general availability of F# 4.7 yesterday (Sept. 23) along with the release of .NET Core 3.0 and its associated tooling.

The open source F#, developed entirely via an open requests for comments (RFC) process, sees compiler and core library infrastructure changes and syntax tweaking.

One notable change in the new release is that FSharp.Core now targets .NET Standard 2.0. Microsoft's .NET Standard provides a spec of .NET APIs that should be available on all .NET implementations. "Starting with FSharp.Core 4.7.0 and F# 4.7, we're officially dropping support for .NET Standard 1.6," said Phillip Carter, program manager for .NET and Languages, in an announcement post. "Now that FSharp.Core targets .NET Standard 2.0, you can enjoy a few new goodies on .NET Core:
  • Simpler dependencies, especially if using a tool like Paket
  • FromConverter and ToConverter static methods on FSharpFunc<'t, 'tresult="">
  • Implicit conversions between FSharpFunc<'t, 'tresult=""> and Converter<'t, 'tresult="">
  • The FuncConvert.ToFSharpFunc<'t> method
  • Access to the MatchFailureException type
  • The WebExtensions namespace for working with older web APIs in an F#-friendly way

Also, the F# interactive (FSI) can be used from .NET Core in a preview. It enables developers to run F# code interactively in the console, or to execute F# scripts.

"The FSI experience for .NET Core is now a very, very stable preview," Carter said. "There are still some quirks with dependency resolution when pulling in packages and their transitive references. We're addressing these by adding #r "nuget:package-name" support for FSI, and we're hoping that you'll transition away from manually referencing third-party .dlls and instead using packages as the unit of reference for FSI."

Other highlights of F# 4.7 include:

  • Support for LangVersion: "F# 4.7 introduces the ability to tune your effective language version with your compiler."
  • Implicit yields: "In the spirit of making things easier, F# 4.7 introduces implicit yields for lists, arrays, sequences, and any Computation Expression that defines the Yield, Combine, Delay, and Zero members."
  • Syntax relaxations: "There are two major relaxations for F# syntax added in F# 4.7. Both should make F# code easier to write, especially for beginners."
  • Indentation relaxations for parameters passed to constructors and static methods.
  • A couple of preview features: Nameof and open static classes.

Going forward toward F# 5 and .NET 5, a unification of all the fragmented .NET implementations, Carter noted work on making F# a first-class language for Jupyter Notebooks via the .NET Kernel and emphasizing language features to make it easier to work with data collections.

"As .NET undergoes a monumental shift towards .NET 5, F# will also feature a bit of a shift," Carter said. "While F# is a general-purpose language -- the functional programming language for .NET -- it also has a strong heritage of being used for 'analytical' workloads: processing data, doing numerical work, data science and machine learning, etc. We feel that F# is positioned extremely well to continue this path, and we intend on emphasizing features that can align with these workloads more."

About the Author

David Ramel is an editor and writer at Converge 360.

comments powered by Disqus

Featured

  • Mastering Blazor Authentication and Authorization

    At the Visual Studio Live! @ Microsoft HQ developer conference set for August, Rockford Lhotka will explain the ins and outs of authentication across Blazor Server, WebAssembly, and .NET MAUI Hybrid apps, and show how to use identity and claims to customize application behavior through fine-grained authorization.

  • Linear Support Vector Regression from Scratch Using C# with Evolutionary Training

    Dr. James McCaffrey from Microsoft Research presents a complete end-to-end demonstration of the linear support vector regression (linear SVR) technique, where the goal is to predict a single numeric value. A linear SVR model uses an unusual error/loss function and cannot be trained using standard simple techniques, and so evolutionary optimization training is used.

  • Low-Code Report Says AI Will Enhance, Not Replace DIY Dev Tools

    Along with replacing software developers and possibly killing humanity, advanced AI is seen by many as a death knell for the do-it-yourself, low-code/no-code tooling industry, but a new report belies that notion.

  • Vibe Coding with Latest Visual Studio Preview

    Microsoft's latest Visual Studio preview facilitates "vibe coding," where developers mainly use GitHub Copilot AI to do all the programming in accordance with spoken or typed instructions.

  • Steve Sanderson Previews AI App Dev: Small Models, Agents and a Blazor Voice Assistant

    Blazor creator Steve Sanderson presented a keynote at the recent NDC London 2025 conference where he previewed the future of .NET application development with smaller AI models and autonomous agents, along with showcasing a new Blazor voice assistant project demonstrating cutting-edge functionality.

Subscribe on YouTube