OCaml
Contents
Algorithms and Data Structures
A generic graph library for OCaml.
A large collection of data structures and algorithms for OCaml.
OCaml library for combinatorics <https://www.lri.fr/~filliatr/combine/>.
A pure OCaml implementation of Zlib.
Fast implementation of queue (FIFO) in OCaml.
Implementation of Rabin's fingerprint and delta compression by P. MacDonald in OCaml (same as libXdiff
Library of Raft consensus algorithm implemented in OCaml
Library of YIQ NTSC transmission image difference alghoritm implemented in OCaml and ReasonML.
Application Libraries
A community-maintained foundation library for your OCaml projects.
Declarative definition of command line interfaces for OCaml.
Jane Street Capital's full-fledged standard library overlay. A portable subset of Core is also available: Core_kernel.
Minimalist library for command-line parsing.
Pretty-printing library for OCaml.
Light library to deal with RPCs in OCaml.
A lightweight, modular standard library extension, string library, and interfaces to various libraries (bigarrays, Unix, etc.) BSD license.
Large Source Code Examples
Standard library for OCaml
an OCaml API to write static analysis, dynamic analysis, code visualizations, code navigations, or style-preserving source-to-source transformations such as refactorings on source code.
C Intermediate Language
formal proof management system
library and tools for accessing and modifying virtual machine disk images
a swiss-army knife for multimedia streaming, notably used for netradios and webtvs
cross-platform multi-network peer-to-peer daemon
Native, lightweight modal code editor.
management stack that configures and controls Xen-enabled hosts and resource pools, and co-ordinates resources within the pool.
Benchmarking
Books
by Richard Bird - It summarizes 30 hard algorithmic problems in the 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.
Introduction to Unix Systems Programming, with an emphasis on communications between processes.
Code Analysis and Linters
Infer is a static analyzer for Java, C and Objective-C
flow is a static type checker for JavaScript.
SLAyer is an automatic formal verification tool that uses separation logic to verify memory safety of C programs.
MemCAD is an abstract interpreter for shape analysis. MemCAD can verify C programs manipulating complex data structures.
Camelot is a modular and fully configurable OCaml linter and stylechecker.
Translator from OCaml to Coq to formally verify OCaml code.
MOPSA is a generic framework for building sound static analyzers based on the theory of abstract interpretation.
Program analysis
BAP is a reverse engineering and program analysis platform that targets binary programs.
BinCat is a binary code static analysis toolkit.
cwe_checker finds vulnerable patterns in binary executables.
Owi is a toolchain for working with WebAssembly (Wasm) in OCaml, featuring a powerful, parallel symbolic execution engine for Wasm. It also provides frontends for compiling and analyzing C and Rust programs.
Smt.ml is a frontend OCaml library that interfaces with multiple SMT solvers, enabling seamless integration of solvers like Z3, cvc5, Colibri2, Bitwuzla, and Alt-Ergo within OCaml programs.
Compilers and Compiler Tools
A modern supercompiler for call-by-value functional languages.
A Lisp on LLVM written in OCaml.
It is now a dead project. Github Repo. Alternative website.
An interpreter for finding subtle bugs in programs written in standard C
Shopify's Liquid Templating language for OCaml.
Parser and Lexer Generators
Self-contained monadic parser combinators for OCaml.
is a modern, encoding-agnostic (read: Unicode-supporting) lexer generator (the ppx-based successor to ulex.)
for a clearer example of using Menhir and Sedlex to produce a useful parser,
a neat project to produce readable LaTeX, HTML, or plain-text EBNF-style documentation for your grammar.
Parser combinators built for speed and memory efficiency
Concurrency
Databases
Bindings
A syntax extension for embedded SQL queries using PG'OCaml.
OCaml bindings to the SQLite3 database.
Thin wrapper for SQLite3 with a simplified interface.
Redis bindings for OCaml.
Bindings to MariaDB/MySQL, supporting the nonblocking API
A pure OCaml PostgreSQL client library.
Implementation of MySQL Protocol with the Bitstring library.
New Implementations
A distributed database that follows the same design principles as Git.
It is a WIP database server written in OCaml.
dumb OCaml key-value store, string keys and string values. Optional on-the-fly LZ4 compression of values or tokyocabinet backend.
Overlays
Sequoia is a type-safe query builder for MySQL/MariaDB and PostgreSQL
Macaque is a library for safe and flexible database queries using comprehensions on top of PG'OCaml.
ORM for SQLite.
Cooperative-threaded access to relational data
Developer Tools
Web app (written in OCaml) underlying the learn-ocaml-corpus. Can be customized to serve lectures (with Markdown slides), playgrounds (with a toplevel prelude), and interactive exercises (with OCaml tests). MIT License.
Minor mode for Emacs that can display exercise topics and grade exercise solutions, after logging to a Learn-OCaml instance. MIT License.
An OCaml kernel for the Jupyter notebook.
Universal toplevel for OCaml with support for multiline edition, history, real-time and context-sensitive completion, colors, and more.
A command-line tool to format OCaml code.
A command-line tool to manage Github Issues.
Yeoman generator to scaffold OCaml modules.
A PlantUML (.puml) to XML (.xmi) converter.
Foreign Function Interface
Editor Integration
An LSP language server for OCaml that integrates with any editor that understands LSP like VSCode, Vim and Emacs.
Context sensitive completion for OCaml in Vim and Emacs.
OCaml mode for Emacs that can run the toplevel and the debugger within Emacs.
Minor mode for Emacs that extends Tuareg and Merlin with menus to change or reset the opam switch in the ambient Emacs session.
Emacs package to provide merlin's features through eldoc.
extension that provides OCaml language support for VSCode
extension that provides OCaml Debugger for VSCode
Better OCaml mode for Sublime Text.
Toplevel directive for looking up documentation using ocp-index.
Exercises and Short Examples
General
Graphics
2D
Internationalization
A Unicode library for OCaml.
Multilingualization for OCaml source code. Allows using Unicode identifiers in OCaml source code.
Unicode character database decoder for OCaml.
Unicode character properties for OCaml.
Unicode text normalization for OCaml.
Unicode text segmentation for OCaml.
Non-blocking streaming Unicode codec for OCaml.
User Interface
Lambda-Term is a cross-platform library for manipulating the terminal. It provides an abstraction for keys, mouse events, and colors, as well as a set of widgets to write curses-like applications.
Notty is a declarative terminal library for OCaml, structured around the notion of composable images.
Self-contained OCaml bindings to linenoise; easy high-level readline functionality in OCaml.
QML Qt5 bindings for OCaml.
System Programming
Mirage is a programming framework for constructing secure, high-performance network applications across a variety of cloud computing and mobile platforms.
Read and write FAT-format filesystems from OCaml.
Pure OCaml low-level git bindings.
Pure OCaml implementation of the "vchan" shared-memory communication protocol.
Logging
Machine Learning
Libraries
scikit-learn for OCaml.
OCaml bindings for PyTorch.
Fully functional monadic implementation of a Neural Network (FCNNs) in OCaml
Messaging
ZeroMQ bindings for OCaml with Async and Lwt wrappers.
nanomsg bindings for OCaml.
OCaml bindings for Apache Kafka.
AMQP client library for Async and Lwt.
Message Passing Interface bindings for OCaml.
OCaml implementation of the MQTT pubsub protocol.
OCaml code generator plugin for the Cap'n Proto serialization framework.
Metaprogramming
Syntax Extensions
Import is a syntax extension that allows to pull in types or signatures from other compiled interface files.
A simple ppx filter to support string interpolation like [%str "value of foo is $(foo)"].
Monad syntax extension for OCaml.
A Yojson codec generator for OCaml.
Tools and Language Extensions
Mobile Applications
Networking
HTTP Tools
Very lightweight HTTP server using Lwt or Async.
OCaml bindings to libcurl.
A high performance, memory efficient, and scalable web server written in OCaml.
Client/server library for HTTP/1.X / HTTP/2 written entirely in OCaml.
Package Management
Distribution
opam repository and experimental build for Windows (deprecated since 2021).
Diskuv OCaml distribution for Windows.
Release OPAM packages easily.
package.json workflow for native development with Reason/OCaml.
Build Tools
Tool to convert OASIS metadata to OPAM package descriptions.
Simple package build system for ocaml.
Easy to use Makefile for small to medium-sized OCaml-projects.
OPAM-aware packaging system using ocamlbuild.
OCaml rules for Bazel, Google's multi-language and platform build tool.
Printers helpers
in Dune. It appears to also be fully manual.
Reason's native
’s [@@deriving show].
a ppx_deriving-like.
another ppx_deriving-like.
again a ppx_deriving-like.
probably a ppxderiving-like with ppxtyperep_conv.
, fully manual.
Parallelism
Libraries
A simple library for forking child processes to perform work on multiple cores.
A library for spawning processes on a cluster of machines, and passing typed messages between them.
Process pool implementation for OCaml.
Parallelize computation over independent items, even if there is an infinite number of them.
Libraries and syntax extensions to offload intensive computations to parallel accelerators (multicore CPUs, GPUs and other accelerators compatible with GPGPU frameworks).
Project Starter Templates
Science and Technical Computing
OCaml Bioinformatics Library <http://biocaml.org>.
OCaml library for building bioinformatics pipelines.
Numerical library for OCaml.
OCaml library for general numerical work.
Bindings to frequently used C special functions library.
A linear algebra library in OCaml with type-based static size checking for matrix operations.
OCaml bindings for TensorFlow.
OCaml numerical library: dense and sparse matrix, linear algebra, regressions, maths and stats functions.
Regular Expressions
a pure OCaml regular expressions library with combinators, supporting several formats (glob, posix, str, etc.).
bindings to the PCRE library (perl-compatible regular expressions)
Humane-re attempts to provide an easy interface for 90% of your regex needs. Courtesy of ocaml-re.
Tyre is a set of combinators to build type-safe regular expressions, allowing automatic extraction and modification of matched groups.
Security and Cryptography
TLS in pure OCaml.
Hash algorithms (like SHA or BLAKE2) in OCaml and C.
The Cryptokit library for OCaml provides a variety of cryptographic primitives that can be used to implement cryptographic protocols in security-sensitive applications.
A Commitment scheme library for Multi-party computations such as online auctions and gambling.
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.
Serialization
A serialization compiler for multiple languages (OCaml, Java, Python, Scala, Typescript) with a Binou or JSON format
Bencode (.torrent file format) reader/writer.
Extensible binary data format, like JSON but faster.
OCaml native CBOR decoder/encoder.
An optimized parsing and printing library for the JSON format.
A S-expression parser and printer
Testing
A lightweight and colourful test framework.
QCheck is a property testing library inspired from Haskell's QuickCheck
(formerly known as qtest) — supports inline pragma's to generate tests.
A lightweight unit testing framework compatible with the Test Anything Protocol.
A framework for writing tests in OCaml, similar to Cram, developed by JaneStreet.
Utilities
Web Development
Sinatra like web toolkit for OCaml.
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.
A library for building dynamic webapps, using Jsofocaml
Elm architecture and (V)DOM for OCaml
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.
Easily import and export CommonJS modules from a jsofocaml project.
RFC3986 URI parsing library.
An OCaml bindings generator for JavaScript libraries.
RSS and Atom feed parsing
mustache.js logic-less templates in OCaml.
atd code generator (serialization) for OCaml/jsofocaml.
OCaml template engine almost compatible with jinja2.
Path-based dispatching for client- and server-side applications.
Functional HTML scraping and manipulation with CSS selectors, à la Python's Beautiful Soup.
Error-recovering streaming HTML5 and XML parsers, serializers.
genjsapi aims at simplifying the creation of OCaml bindings for Javascript libraries.
Typed routes for OCaml/ReasonML web applications.
Hacker news like website with the OCaml framework Ocsigen