Learn OCaml

Get Started

Learn how to get OCaml set up in your project.
Start Now

Solve Exercises

Learning by doing, or do by learning!
I'm Ready

Language Manual

Acquire a deeper understanding!
Take Me There


Aspiring towards greater understanding of the language? Want to push the limits and discover brand new things? Check out papers written by leading OCaml researchers:
Retrofitting effect handlers onto OCaml
Effect handlers have been gathering momentum as a mechanism for modular programming with user-defined effects. Effect handlers allow for non-local control flow mechanisms such as generators, async/await, lightweight threads and coroutines to be composably expressed. We present a design and evaluate a full-fledged efficient implementation of effect handlers for OCaml, an industrial-strength multi-paradigm programming language. Our implementation strives to maintain the backwards compatibility and performance profile of existing OCaml code. Retrofitting effect handlers onto OCaml is challenging since OCaml does not currently have any non-local control flow mechanisms other than exceptions. Our implementation of effect handlers for OCaml: (i) imposes a mean 1% overhead on a comprehensive macro benchmark suite that does not use effect handlers; (ii) remains compatible with program analysis tools that inspect the stack; and (iii) is efficient for new code that makes use of effect handlers.
K. C. Sivaramakrishnan, Stephen Dolan, Leo White, Tom Kelly, Sadiq Jaffer, Anil Madhavapeddy
Extending OCaml's `open`
We propose a harmonious extension of OCaml's `open` construct. OCaml's existing construct `open M` imports the names exported by the module `M` into the current scope. At present `M` is required to be the path to a module. We propose extending `open` to instead accept an arbitrary module expression, making it possible to succinctly address a number of existing scope-related difficulties that arise when writing OCaml programs.
Runhang Li, Jeremy Yallop
Bounding data races in space and time
We propose a new semantics for shared-memory parallel programs that gives strong guarantees even in the presence of data races. Our local data race freedom property guar- antees that all data-race-free portions of programs exhibit sequential semantics. We provide a straightforward oper- ational semantics and an equivalent axiomatic model, and evaluate an implementation for the OCaml programming language. Our evaluation demonstrates that it is possible to balance a comprehensible memory model with a reasonable (no overhead on x86, ~0.6% on ARM) sequential performance trade-off in a mainstream programming language
Stephen Dolan, KC Sivaramakrishnan, Anil Madhavapeddy
View all papers


The history of OCaml releases with a summary and a complete changelog, as well as the manual at that time.
Recent Release

5.0.0 (2022-12-16)

OCaml 5.0.0 introduces a completely new runtime system with support for shared memory parallelism and effect handlers.

See all Releases

Recommended Books

What experts programmers and researchers are saying about OCaml, from the beginner level to the more advanced topics.
See all Books