F# is a functional-first language for .NET, created by Don Syme at Microsoft Research Cambridge and first released in 2005. It is a member of the ML family, closely modeled on OCaml. The story of how F# brought ML-style programming to .NET starts with a less glamorous piece of work: adding generics to the .NET runtime itself.
Origins at Microsoft Research
When .NET launched in 2002, its runtime had no generics, which made efficient functional languages hard to build on it. Don Syme and Andrew Kennedy at Microsoft Research designed and implemented generics for the CLR, which shipped with .NET 2.0 in 2005. With that foundation in place, Syme built F# as a practical ML dialect for the platform. Early versions could compile a large subset of OCaml code.
The research project grew a user base in finance and data analysis, and Microsoft turned it into a product. F# 2.0 shipped in Visual Studio 2010, making it a supported Microsoft language next to C# and Visual Basic. The compiler was released as open source in 2010, and the community-run F# Software Foundation now works alongside Microsoft on the language.
How F# brought ML-style programming to .NET
F# keeps the ML essentials and adds what you need to live comfortably in the .NET world:
- Hindley-Milner style type inference, so most code has no type annotations but is still fully statically typed.
- Immutability by default, records, tuples and discriminated unions with exhaustive pattern matching.
- The pipe operator
|>, which makes data transformations read top to bottom. - Computation expressions for async code, sequences, tasks and custom workflows.
- Units of measure, based on Andrew Kennedy's research, which catch unit errors at compile time.
- Type providers (F# 3.0, 2012) that generate types from schemas such as CSV, JSON or SQL databases while you type.
- Full access to any .NET library, plus classes and interfaces when object-oriented code is the better fit.
F# uses significant whitespace and requires files to be ordered so that each file only depends on files above it. Newcomers often find this strict, but it keeps dependency graphs clear.
A short F# example
This script combines a discriminated union, units of measure, pattern matching and pipelines:
[<Measure>] type km
[<Measure>] type h
type Trip =
| Walk of distance: float<km>
| Drive of distance: float<km> * hours: float<h>
let describe trip =
match trip with
| Walk d -> sprintf "walk %.1f km" (float d)
| Drive (d, t) -> sprintf "drive at %.0f km/h" (float (d / t))
[ Walk 3.5<km>; Drive (120.0<km>, 1.5<h>) ]
|> List.map describe
|> List.iter (printfn "%s")
It prints walk 3.5 km and drive at 80 km/h. Dividing kilometers by hours produces a value of type float<km/h>, checked by the compiler.
Versions and milestones
| Year | Release | Highlights |
|---|---|---|
| 2005 | F# 1.0 | Research release from Microsoft Research |
| 2010 | F# 2.0 | Ships in Visual Studio 2010 |
| 2012 | F# 3.0 | Type providers, query expressions |
| 2015 | F# 4.0 | Constructors as functions, language polish |
| 2021 | F# 6.0 | Native task expressions |
Today F# ships with the .NET SDK, runs on Windows, Linux and macOS, and gets a new version alongside each yearly .NET release.
Influence on C# and beyond
F# introduced asynchronous workflows in 2007, years before C# 5.0 added async/await in 2012, and the C# design was directly informed by that experience. Many later C# features, including tuples, pattern matching, records and expression-bodied code, move C# toward ideas F# programmers already used. The pipe operator also spread to Elm and appears in proposals for JavaScript.
Where F# is used today
F# is a niche language with a strong presence in finance, insurance, energy trading and analytics, where correctness and concise domain modeling matter. Jet.com, the e-commerce company Walmart acquired in 2016, built much of its platform in F#. The community maintains tools such as Fable (F# to JavaScript), the Giraffe and Saturn web frameworks, the FAKE build system and the Ionide editor plugin.
Should you learn F#?
If you already work in .NET and want fewer null checks, clearer domain models and shorter code, F# is the easiest way to try typed functional programming without leaving your ecosystem. Its smaller job market is the honest drawback. Still, seeing how F# brought ML-style programming to .NET will make you a better C# developer, because so many of its ideas have already crossed over.
Frequently asked questions
Is F# the same as OCaml on .NET?
Not exactly. F# started close to OCaml and shares its core syntax, but it dropped OCaml's module functors and object system in favor of .NET classes, interfaces and generics. It also added features OCaml lacks, such as type providers, units of measure and computation expressions.
Can F# and C# be used in the same solution?
Yes. Both compile to .NET assemblies, so an F# project can reference a C# project and the other way around. A common pattern is writing domain logic in F# and keeping UI or existing code in C#.
Is F# still supported by Microsoft?
Yes. F# is part of the .NET SDK and receives new language versions alongside .NET releases. Development happens in the open, with contributions from Microsoft and the community.







