View on GitHub


Documenting everything about OCaml




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.


Deploying Apps

The Format Module

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


  • ocamlunix: Great introduction to systems programming in OCaml



Modules and Functors



Phantom Types


PPX (PreProcessor eXtensions)

FFI (Foreign Function Interface)


Category Theory

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

Writing Efficient Code

See Optimizing OCaml Performance.


See Papers on OCaml.



A list of projects that can be used as examples or for inspiration.

See Projects


  • 99 problems: classic 99 problems, with solutions.
  • Rosetta Code
  • OCaml at Exercism – Exercism is your place to engage in thoughtful conversations about code. Explore simplicity, idiomatic language features, and expressive readable code. Solutions.


  • Real World OCaml by Y. Minsky, A. Madhavapeddy and J. Hickey - Functional programming for the masses. The latest, and arguably the most readable book on OCaml. Note that the book uses only Jane Street libraries, but the material can be applied to other libraries.
    • RWO-lwt : translating the Async code examples from Real World OCaml to lwt.
  • Free Cornell OCaml Textbook: Great free online book, covering both beginner and advanced topics.
  • More OCaml: Algorithms, Methods, and Diversions – In More OCaml John Whitington takes 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.
  • How to Think Like a (Functional) Programmer by Allen Downey and Nicholas Monje – How to Think Like a Computer Scientist is an introductory programming textbook based on the OCaml language. It is a modified version of Think Python by Allen Downey. It 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.
  • OCaml from the Very Beginning by J. Whitington - OCaml from the Very Beginning will appeal both to new programmers, and experienced programmers eager to explore functional languages such as OCaml.
  • Pearls of Functional Algorithm Design by Richard Bird - It summaries 30 hard algorithm problems in function programming world. Although it is for Haskell, the algorithm problems are very interesting and trying to solve them in OCaml also helps the thinking of functional programming. Partial solutions in OCaml are [ here].
  • Unix System Programming in OCaml by X. Leroy and D. Rémy – Introduction to Unix system programming, with an emphasis on communications between processes.
  • Using, Understanding, and Unraveling OCaml – This book describes both the OCaml language and the theoretical grounds behind its powerful type system.
  • 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.
  • OCaml for Scientists - by Jon Harrop.
  • Types and Programming Languages by Benjamin C. Pierce - A friendly but serious book on types, type checking, etc. Much of what’s covered is relevant to OCaml. Several chapters present OCaml implementations of the concepts covered in preceding chapters, and the examples in the book have been typechecked using OCaml programs that are available at the author’s site. (As of mid-2018, the Kindle version can be difficult to read on small devices because the pages are images of the hardcover’s pages. The iBook version is a standard e-book with resizable fonts, though.)
  • Advanced Topics in Types and Programming Languages is an anthology edited by Benjamine C. Pierce. It includes some articles that are relevant to OCaml.

Online Courses