View on GitHub


Documenting everything about OCaml



Beginner Topics

Some motivations for using OCaml can be found here, here, here and here.

Setting Up Your Editor for OCaml

OCaml can be edited conveniently with many different editors. See editor setup and code tools.

Using the OCaml Build Tools

Best Practices

Several guidelines for best practices have been established by the community. See Best Practices.



  • Cornell OCaml Textbook (free online): Excellent free online book, covering both beginner and advanced topics.
  • OCaml from the Very Beginning by J. Whitington (free online): A book for both new programmers and experienced programmers eager to explore functional languages such as OCaml.
  • Real World OCaml by Y. Minsky, A. Madhavapeddy and J. Hickey (free online): Functional programming for the masses. A book that discusses both beginner and advanced topics. Note that the book utilizies Jane Street libraries, but the material can be applied to non-Jane Street libraries as well.
    • RWO-lwt: translation of the Jane Street concurrency Async library code examples in the book to use the lwt library.
  • How to Think Like a (Functional) Programmer by Allen Downey and Nicholas Monje (free online): An introductory programming textbook using OCaml. It is a modified version of Think Python by Allen Downey. This book is intended for newcomers to programming and also those who know some programming but want to learn programming in the function-oriented paradigm, or those who simply want to learn OCaml.

Online Exercises for Beginners

Beginner Online Courses

Intermediate Topics


Parallel multicore OCaml programming: How to program OCaml in the new multicore-OCaml runtime. The OCaml multicore memory model

Deploying Apps

The Format Module

The Stdlib has the Format module for pretty printing. It’s a little tricky to get a hang of.


Functional Data Structures

  • Purely Functional Data Structures: A classic book focusing on various data structures in the functional programming world. Can be very useful for understanding functional data structures, though OCaml obviously supports imperative data structures as well.

Writing Efficient Code

See Optimizing OCaml Performance.

Intermediate Level Books

  • More OCaml: Algorithms, Methods, and Diversions by John Whitington: A meandering tour of functional programming with OCaml, introducing various language features and describing some classic algorithms. The book ends with a large worked example dealing with the production of PDF files. There are questions for each chapter together with worked answers and hints.
  • Pearls of Functional Algorithm Design by Richard Bird: Tackles 30 hard algorithm problems using function programming. Although it is writtern for Haskell, trying to solve the problems in OCaml also helps develop functional programming.
  • Scientific Computing in OCaml and Owl: Covers OCaml and using the Owl library, which is a heavy-duty library for scientific and numerical computation as well as machine learning.
  • Unix System Programming in OCaml by X. Leroy and D. Rémy (free): Introduction to Unix system programming, with an emphasis on communications between processes.
  • OCaml for Scientists by Jon Harrop

Advanced Topics

Modules and Functors


Existential Types


Phantom Types


PPX (PreProcessor eXtensions)

See Metaprogramming for both libraries and articles.

FFI (Foreign Function Interface)




Type Theory

Category Theory

Category Theory is a branch of abstract mathematics that discusses concepts that tend to pop up as patterns in functional programming.

Academic Papers

See academic papers relevant to OCaml.