View on GitHub

OCamlverse

Documenting everything about OCaml

Edit

Learning

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.

Beginner Books

  • Real World OCaml by Y. Minsky, A. Madhavapeddy and J. Hickey (free online): Functional programming for the masses. The latest, most up-to-date, 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: translation of the Async code examples in the book to use lwt.
  • Cornell OCaml Textbook (free online): Excellent free online book, covering both beginner and advanced topics.
  • 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.
  • OCaml from the Very Beginning by J. Whitington: A book for both new programmers and experienced programmers eager to explore functional languages such as OCaml.

Online Exercises for Beginners

Beginner Online Courses

Intermediate Topics

Deploying Apps

The Format Module

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

Tools

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 (free): 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

Polymorphism

Existential Types

GADTs

Phantom Types

Iterators

PPX (PreProcessor eXtensions)

See Metaprogramming for both libraries and articles.

FFI (Foreign Function Interface)

Monads

Concurrency

Multicore

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.