OCaml, originally released in 1996 as Objective Caml, was created at INRIA, the French national research institute for computer science, by Xavier Leroy, Jérôme Vouillon, Damien Doligez, Didier Rémy and Ascánder Suárez. It is a member of the ML family with a fast native-code compiler, and that combination is the heart of why Jane Street uses OCaml for trading: the type system catches mistakes before code reaches production, while compiled programs run close to C++ speed.

Origins: ML, Caml and Caml Light

ML was created by Robin Milner and colleagues at the University of Edinburgh in the 1970s as the meta-language for the LCF theorem prover. In 1985 French researchers at INRIA and École Normale Supérieure started Caml, originally an acronym of "Categorical Abstract Machine Language", after the abstract machine used to implement it. Gérard Huet and Guy Cousineau were central to that early work.

In 1990 Xavier Leroy and Damien Doligez wrote Caml Light, a lightweight bytecode implementation that ran well on ordinary PCs and became popular in French universities. Caml Special Light (1995) added a native-code compiler and a powerful module system. A year later, Didier Rémy and Jérôme Vouillon's object system was added, and the result was named Objective Caml. The name was officially shortened to OCaml in 2011.

Design and key features

  • Hindley–Milner type inference: strong static types, few annotations.
  • Algebraic data types and pattern matching, with exhaustiveness checks that warn about missing cases.
  • A rich module system: signatures, functors (modules parameterised by modules) and first-class modules.
  • Pragmatism: mutable references, arrays, exceptions and loops are available when functional style is not the right tool.
  • Fast compilation and native code for many architectures, plus a portable bytecode compiler.
  • Polymorphic variants and GADTs for advanced type-level designs.

A short OCaml example

type order =
  | Buy of string * int
  | Sell of string * int

let describe = function
  | Buy (sym, qty) -> Printf.sprintf "BUY %d %s" qty sym
  | Sell (sym, qty) -> Printf.sprintf "SELL %d %s" qty sym

let () =
  [ Buy ("ACME", 100); Sell ("INIT", 50) ]
  |> List.map describe
  |> List.iter print_endline

If a new kind of order is added to the type, the compiler flags every match that does not handle it.

Why Jane Street uses OCaml for trading

Jane Street, the quantitative trading firm, began moving to OCaml in the mid-2000s after Yaron Minsky, who had used ML-family languages in his academic work, joined the company. Minsky explained the reasoning in his 2011 ACM Queue article "OCaml for the Masses". The main arguments were:

  • Correctness: in trading, a bug can cost real money in seconds, and the type system rules out entire categories of error.
  • Readability: concise code makes careful review by many people practical.
  • Performance: native code with a predictable, low-latency garbage collector.
  • Refactoring: changing a type tells you exactly which code needs updating.

Jane Street has since become one of OCaml's biggest contributors, releasing the Core standard library replacement, the Async concurrency library and the Dune build system, and co-writing the book Real World OCaml.

Other notable users

OCaml is especially popular for tools that analyse or transform programs. The Coq proof assistant, now renamed Rocq, is written in OCaml, as are Meta's Flow type checker, the Infer static analyzer and the original Hack type checker. The first Rust compiler was written in OCaml before Rust became self-hosting. MirageOS builds unikernels in OCaml, Docker Desktop's VPNKit networking component uses it, and the Tezos blockchain and Semgrep code scanner are also OCaml projects.

Versions timeline

YearReleaseNotable change
1985CamlOriginal implementation at INRIA
1990Caml LightLightweight bytecode system
1996Objective Caml 1.00Objects added to Caml Special Light
2012OCaml 4.00GADTs
2022OCaml 5.0Multicore runtime, effect handlers

OCaml 5.0, released in December 2022, was the result of years of research into a multicore garbage collector and introduced effect handlers for lightweight concurrency.

Influence and legacy

Microsoft's F#, designed by Don Syme, began as an OCaml dialect for .NET, and Reason and ReScript put a JavaScript-friendly syntax on OCaml. Rust's enums, pattern matching and early compiler all trace back to it, and Elm's design reflects ML-family thinking. The question of why Jane Street uses OCaml for trading has a broader answer too: when mistakes are expensive, a language that makes the compiler a reliable second reviewer pays for itself.

Frequently asked questions

Does Jane Street still use OCaml for most of its code?

Yes, OCaml remains Jane Street's primary language for trading systems, tools and infrastructure. The firm employs a team that works on the OCaml compiler itself. It publishes much of its library code as open source.

What is the difference between OCaml and F#?

F# started as an OCaml-inspired language for the .NET platform and shares much of its core syntax. F# lacks OCaml's functors and full module system but integrates tightly with .NET libraries. OCaml compiles to native code through its own toolchain and runtime.

Is OCaml hard to learn for programmers who know Python?

The syntax and type inference take some getting used to, especially pattern matching and immutable data. Most programmers become productive within a few weeks. Free resources like Real World OCaml and the ocaml.org tutorials help a lot.