Everything you'll ever need on the road to mastering OCaml.
A curated list of references to awesome OCaml tools, frameworks, libraries and articles. Additionally there is a collection of freely available books, papers and presentations.
A community-driven review of the current state of the OCaml ecosystem and its suitability for various programming domains and tasks can be found in:
Decompress18 6 - A pure OCaml implementation of Zlib
Application Libraries
Batteries Included309 104 – A community-maintained foundation library for your OCaml projects.
Cmdliner65 19 – Declarative definition of command line interfaces for OCaml.
Core586 74 – Jane Street Capital's full-fledged standard library overlay. A portable subset of Core is also available: Core_kernel120 43 .
Base132 18 - Jane Street Capital's dependency-free, quick-compiling, fully-portable across any environment that can run OCaml code standard library.
React – React is an OCaml module for functional reactive programming (FRP). It provides support to program with time varying values: declarative events and signals.
Minicli – Minimalist library for command line parsing.
ctypes183 53 – Library for binding to C libraries using pure OCaml.
easy-format16 12 – Pretty-printing library for OCaml.
ocaml-rpc40 19 – Light library to deal with RPCs in OCaml.
ocaml-containers186 44 – A lightweight, modular standard library extension, string library and interfaces to various libraries (bigarrays, unix, etc...). BSD license.
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.
Real World OCaml by Y. Minsky, A. Madhavapeddy and J. Hickey - Functional programming for the masses.
Unix System Programming in OCaml by X. Leroy and D. Rémy – Introduction to Unix system programming, with an emphasis on communications between processes.
Mascot - Mascot is a style-checker for OCaml sources
pfff2k 189 – pfff is a set of tools and APIs to perform some static analysis, dynamic analysis, code visualizations, code navigations, or style-preserving source-to-source transformations such as refactorings on source code.
infer8k 1k - infer is a static analyzer for Java, C and Objective-C
flow17k 2k - flow is a static type checker for JavaScript
Ocamllint57 3 - Ocamllint detects common errors in OCaml code
BetterErrors - BetterErrors improves error messages of the OCaml compiler (Make OCaml Errors Great Again.)
SLAyer - SLAyer is an automatic formal verification tool that uses separation logic to verify memory safety of C programs.
MemCAD8 4 - MemCAD is an abstract interpreter for shape analysis. MemCAD can verify C programs manipulating complex data structures.
BAP420 117 - BAP is a reverse engineering and program analysis platform that targets binary programs.
Compilers and Compiler Tools
Languages and Compilers:
cDuce - cDuce is a modern XML-oriented functional language with innovative features.
Compcert C Compiler - It is a C Compiler supporting most of the ISO C90 and C99 / ANSI C features.
Eff Programming Language - Eff is a functional language with handlers of not only exceptions, but also of other computational effects such as state or I/O.
Mezzo Programming Language - Mezzo is a programming language in the ML tradition, which places strong emphasis on the control of aliasing and access to mutable memory.
Two concurrency libraries exist in OCaml: Lwt and Async. They provide very similar functionality but make radically different decisions with regards to error handling and internal implementation details (see the links below for more details). Real World OCaml uses Async but a version of the code examples translated to Lwt29 2 is also available.
codingground – Compile and execute OCaml code online.
iocaml148 21 – An OCaml kernel for the IPython notebook.
utop392 53 – Universal toplevel for OCaml with support of multiline edition, history, real-time and context sensitive completion, colors, and more.
ocamlbrowser – A source and compiled interface browser, written using LablTk. Included in the standard distribution for ocaml <= 4.01 and with labltk for ocaml >= 4.02.
ghim12 1 – A command-line tool to manage Github Issues.
OCaml at Exercism – Exercism is your place to engage in thoughtful conversations about code. Explore simplicity, idiomatic language features, and expressive readable code. Solutions35 22 .
Formal Software Verification
Coq – Coq is a formal proof management system. It provides a formal language to write mathematical definitions, executable algorithms and theorems together with an environment for semi-interactive development of machine-checked proofs.
Why3 – Why3 is a platform for deductive program verification. It provides a rich language for specification and programming, called WhyML, and relies on external theorem provers, both automated and interactive, to discharge verification conditions.
Alt-Ergo – Alt-Ergo is an open-source SMT solver dedicated to the proof of mathematical formulas generated in the context of program verification.
labltk — Interface to the Tcl/Tk GUI framework. In the standard distribution for ocaml <= 4.01.
TSDL – Tsdl is an OCaml module providing thin bindings to the cross-platform SDL library.
Lambda-Term74 25 – Lambda-Term is a cross-platform library for manipulating the terminal. It provides an abstraction for keys, mouse events, colors, as well as a set of widgets to write curses-like applications.
Notty113 8 - Notty is a declarative terminal library for OCaml, structured around a notion of composable images.
MetaOCaml – an OCaml dialect for multi-stage programming.
Fan – Fan is a compile-time metaprogramming system for OCaml, originally inspired from Camlp4. It's a combination of OCaml and Lispy Macros. It shares the same concrete syntax with OCaml.
camlp5 - Camlp5 is a preprocessor-pretty-printer of OCaml.
camlp4 - Camlp4 is part of the standard OCaml distribution and is different from Camlp5.
Oasis - A tool to integrate a configure, build and install system in your OCaml project. It helps to create standard entry points in your build system and allows external tools to analyse your project easily.
oasis2opam24 9 — Tool to convert OASIS metadata to OPAM package descriptions.
obuild59 25 – Simple package build system for ocaml.
dune21 1 – A composable and opinionated build system for OCaml (former jbuilder)
jenga72 13 – Monadic build system from Jane Street.
ocamlbuild — Build system provided with the compiler.
ocaml-makefile13 4 — Easy to use Makefile for small to medium-sized OCaml-projects.
topkg51 19 — OPAM-aware packaging system using ocamlbuild.
Namespaces72 3 - ocamlbuild plugin that converts your directory tree into nested modules.
Bazel18 2 - OCaml rules for Bazel, Google's multi-language and platform build tool.
Parallelism
(Note: Sorted from the easier to use to the more flexible.)
Libraries:
Parmap — Provides easy-to-use parallel map and fold functions.
ForkWork10 0 — A simple library for forking child processes to perform work on multiple cores.
Functory — A distributed computing library which facilitates distributed execution of parallelizable computations in a seamless fashion.
Rpc.Parallel13 0 — A library for spawning processes on a cluster of machines, and passing typed messages between them.
Ocamlnet — An enhanced system platform library. Contains the netmulticore library to compute tasks on as many cores of the machine as needed.
Nproc23 3 – Process pool implementation for OCaml.
Parany2 1 – Parallelize computation over independent items, even if there is an infinite number of them.
Sklml – Functional parallel skeleton compiler and programming system for OCaml programs.
Digestif7 3 - Hash algorithms (like SHA* or BLAKE2*) in OCaml and C.
cryptokit2 1 – The Cryptokit library for OCaml provides a variety of cryptographic primitives that can be used to implement cryptographic protocols in security-sensitive applications.
nocrypto55 26 – A small cryptographic library behind the ocaml-tls project. It is built to be straightforward to use, adhere to functional programming principles and able to run in a Xen-based unikernel.
Mirage OS1k 142 – Mirage is a programming framework for constructing secure, high-performance network applications across a variety of cloud computing and mobile platforms.
ocaml-fat10 9 – Read and write FAT format filesystems from OCaml.
ocaml-git145 46 – Pure OCaml low-level git bindings.
ocaml-vchan26 17 – Pure OCaml implementation of the "vchan" shared-memory communication protocol.
Testing
Alcotest13 7 – A lightweight and colourful test framework.
OUnit – OUnit is a unit test framework for OCaml. It allows one to easily create unit-tests for OCaml code. It is based on HUnit, a unit testing framework for Haskell.
QCheck46 9 — QCheck is a property testing library inspired from Haskell's QuickCheck
iTeML35 8 (formerly known as qtest) — supports inline pragma's to generate tests.
Ocsigen Eliom – Eliom is a full-featured multi-tier framework, for developing multi-platform Web and mobile apps as 100% OCaml distributed applications. It can also be used for more traditional Web or mobile apps: Web sites, single page applications, REST API, etc.
Ohm - Ohm was an open source web framework for the OCaml language which is now dead.
webmachine107 12 – A REST toolkit for OCaml. OCaml webmachine is a layer on top of cohttp that implements a state-machine-based HTTP request processor. It's particularly well-suited for writing RESTful APIs. As the name suggests, this is an OCaml port of the webmachine project.
Tools:
COW77 20 – Caml on the Web (COW) is a set of parsers and syntax extensions to let you manipulate HTML, CSS, XML, JSON and Markdown directly from OCaml code.
Ocamlnet
has many relevant web libraries —
Nethtml
html parser,
Netasn1
for ASN.1 parsing,
Netencoding
for Base64, Quoted Printable, URL encoding and HTML escaping,
Netmime
for MIME processing, etc. See the list of
modules
in Ocamlnet's manual.
tyxml — Library to build valid (according to the W3C spec) Html and Svg trees.
js_of_ocaml – Js_of_ocaml is a compiler of OCaml bytecode to Javascript. It makes it possible to run Ocaml programs in a Web browser.
commonjs_of_ocaml9 2 - Easily import and export CommonJS modules from a js_of_ocaml project.
BuckleScript2k 166 - BuckleScript is backend for OCaml to generate debuggable Javascript. It enables OCaml to integrate Javascript platform in a seamless way.