OCaml
Contents_Index
- COMMUNITY6
- ALGORITHMS AND DATA STRUCTURES9
- APPLICATION LIBRARIES9
- BENCHMARKING2
- BLOGS5
- BOOKS10
- CODE ANALYSIS AND LINTERS10
- PROGRAM ANALYSIS5
- COMPILERS AND COMPILER TOOLS3
- CONCURRENCY2
- DATABASES1
- DATETIME4
- DEVELOPER TOOLS16
- EXERCISES AND SHORT EXAMPLES5
- FORMAL SOFTWARE VERIFICATION3
- GENERAL13
- INTERNATIONALIZATION7
- USER INTERFACE7
- LANGUAGE-RELATED8
- LARGE SOURCE CODE EXAMPLES13
- LOGGING3
- MESSAGING7
- METAPROGRAMMING3
- METRICS1
- MOBILE APPLICATIONS2
- NETWORKING4
- ONLINE COURSES4
- PACKAGE MANAGEMENT2
- PARALLELISM2
- PRINTERS HELPERS13
- PROJECT STARTER TEMPLATES3
- QUESTIONS13
- REGULAR EXPRESSIONS4
- SECURITY AND CRYPTOGRAPHY5
- SEMANTIC TECHNOLOGY1
- SERIALIZATION8
- SYSTEM PROGRAMMING5
- TESTING8
- UTILITIES4
- WEB DEVELOPMENT3
Community
6_ENTRIESAlgorithms and Data Structures
9_ENTRIES- OCamlgraph
A generic graph library for OCaml.
- ods
A large collection of data structures and algorithms for OCaml.
- combine
OCaml library for combinatorics https://www.lri.fr/~filliatr/combine/.
- Decompress
A pure OCaml implementation of Zlib.
- Ke
Fast implementation of queue (FIFO) in OCaml.
- ORaft
Library of Raft consensus algorithm implemented in OCaml
- ODiff
Library of YIQ NTSC transmission image difference alghoritm implemented in OCaml and ReasonML.
Application Libraries
9_ENTRIES- Batteries Included
A community-maintained foundation library for your OCaml projects.
- Cmdliner
Declarative definition of command line interfaces for OCaml.
- Core
Jane Street Capital's full-fledged standard library overlay. A portable subset of Core is also available: Core_kernel.
- Base
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 for programs with time-varying values, declarative events, and signals.
- Minicli
Minimalist library for command-line parsing.
- easy-format
Pretty-printing library for OCaml.
- ocaml-rpc
Light library to deal with RPCs in OCaml.
- ocaml-containers
A lightweight, modular standard library extension, string library, and interfaces to various libraries (bigarrays, Unix, etc.) BSD license.
Benchmarking
2_ENTRIES- core_bench
Micro-benchmarking library for OCaml by Jane Street. - Getting Started with Core_bench
- benchmark
Benchmarking functions for measuring the run-time of functions using latency or throughput.
Blogs
5_ENTRIESBooks
10_ENTRIES- 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-scale example dealing with the production of PDF files. There are questions for each chapter, along with worked-out 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 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.
- 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 Systems 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
This is the first or only book focus on various data structures in FP world. A must-read one.
- OCaml for Scientists
by Jon Harrop.
- OCaml Programming: Correct + Efficient + Beautiful
Textbook on Functional Programming and Data Structures in OCaml - by Michael R. Clarkson et al.
Code Analysis and Linters
10_ENTRIES- Mascot
Mascot is a style-checker for OCaml sources.
- pfff
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.
- Infer
Infer is a static analyzer for Java, C and Objective-C
- Frama-C
Frama-C is a static analysis and formal proof framework for C and C++.
- flow
flow is a static type checker for JavaScript.
- SLAyer
SLAyer is an automatic formal verification tool that uses separation logic to verify memory safety of C programs.
- MemCAD
MemCAD is an abstract interpreter for shape analysis. MemCAD can verify C programs manipulating complex data structures.
- Camelot
Camelot is a modular and fully configurable OCaml linter and stylechecker.
- coq-of-ocaml
Translator from OCaml to Coq to formally verify OCaml code.
- MOPSA
MOPSA is a generic framework for building sound static analyzers based on the theory of abstract interpretation.
Program analysis
5_ENTRIES- BAP
BAP is a reverse engineering and program analysis platform that targets binary programs.
- BinCat
BinCat is a binary code static analysis toolkit.
- cwe_checker
cwe_checker finds vulnerable patterns in binary executables.
- Owi
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
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
3_ENTRIES- **Languages and Compilers**
Languages and Compilers:Caramel - Caramel is a functional language for building type-safe, scalable, and maintainable applications.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 noβ¦
- **Parser and Lexer Generators**
Parser and Lexer Generators:Opal β Self-contained monadic parser combinators for OCaml.Sedlex is a modern, encoding-agnostic (read: Unicode-supporting) lexer generator (the ppx-based successor to ulex.)Menhir β Menhir is a LR(1) parser generator for OCaml.See ocaml-parsing for a β¦
Concurrency
2_ENTRIESBefore OCaml 5.0, there were two libraries for concurrent programming: 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 Lwt is also available.
With the introduction of Effect Handlers in OCaml 5.0, a bunch of other libraries have been created for concurrent programming, replacing the monadic approaches of LWT and Async with direct-style ones.
- **Libraries**
Libraries:Eio β effects-based direct-style IO for multicore OCaml.Miou β a simple scheduler for OCaml 5.Lwt β A cooperative threads library for OCaml.Async β A monadic concurrence library to go with the Core library.
Databases
1_ENTRIES- BindingsDbm β A binding to the NDBM/GDBM Unix "databases".Mongo.ml β An OCaml driver for MongodbPG'OCaml β A type-safe interface to PostgreSQL in pure OCaml.ppx_pgsql β A syntax extension for embedded SQL queries using PG'OCaml.PostgreSQL-OCaml β An interface to PostgreSQL through the C API (
libpq).SQLite3 β OCaml bindings to the SQLite3 database.Sqlite3EZ β Thin wrapper for SQLite3 with a simplified interface.ocaml-redis β Redis bindings for OCaml.mariadb - Bindings to MariaDB/MySQL, supporting the nonblocking APIpgx β A pure OCaml PostgreSQL client library.[mysβ¦
- **Articles**
Articles:Implementing the Binary Memcached Protocol with Ocaml and BitstringInterfacing OCaml and PostgreSQL with CaqtiFinally, Type-Safe, Extensible and Efficient Language Integrated Query by Oleg and Co. The proposed approach is toβ¦
Datetime
4_ENTRIESDeveloper Tools
16_ENTRIES- Try OCaml
Try OCaml in your web browser.
- learn-ocaml
. 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.
- learn-ocaml.el
. Minor mode for Emacs that can display exercise topics and grade exercise solutions, after logging to a Learn-OCaml instance. MIT License.
- BetterOCaml
An efficient, intuitive, and cross-platform web IDE with your OCaml code interpreted and running in your browser!
- codingground
Compile and execute OCaml code online.
- OCaml: Learn & Code iOS app
Learn and execute OCaml code from your iPhone/iPad/Mac.
- Jupyter
An OCaml kernel for the Jupyter notebook.
- utop
Universal toplevel for OCaml with support for multiline edition, history, real-time and context-sensitive completion, colors, and more.
- ocamlformat
A command-line tool to format OCaml code.
- 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.
- ghim
A command-line tool to manage Github Issues.
- OCaml Yeoman Generator
Yeoman generator to scaffold OCaml modules.
- puml2xml
A PlantUML (.puml) to XML (.xmi) converter.
- **Foreign Function Interface**
Foreign Function Interface:ctypes β Library for binding to C libraries using pure OCaml.ocaml-main-program-in-c β Example build system for making mixed C/Ocaml binaries where the main program is in C.Modular foreign function bindingsPy.ml - OCaml bindings for Python.
- **Editor Integration**
Editor Integration:ocaml-lsp - An LSP language server for OCaml that integrates with any editor that understands LSP like VSCode, Vim and Emacs.merlin β Context sensitive completion for OCaml in Vim and Emacs.tuareg - OCaml mode for Emacs that can run the toplevel and the debugger within Emacs.[opam-switch-mode](https://github.com/ProofGeneral/opβ¦
- **Code coverage**
Code coverage:Bisect_ppx
Exercises and Short Examples
5_ENTRIES- 99 problems
. 99% of the solutions are here.
- learn-ocaml-corpus
. Corpus of beginner-to-advanced online exercises (including those from the OCaml MOOC) with automatic grading tests.
- OCaml at Exercism
Exercism is your place to engage in thoughtful conversations about code. Explore simplicity, idiomatic language features, and expressive, readable code. Solutions.
- Programming Language Examples Alike Cookbook
The OCaml section of the book is a free reference for solving common programming problems using OCaml.
Formal Software Verification
3_ENTRIES- 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.
General
13_ENTRIES- camlPDF
OCaml library for reading, writing and modifying PDF files.
- slacko
A neat interface for Slack in OCaml.
- Learn X in Y minutes
Where X=OCaml.
Internationalization
7_ENTRIES- Camomile
A Unicode library for OCaml.
- ocaml-m17n
Multilingualization for OCaml source code. Allows using Unicode identifiers in OCaml source code.
- Uucd
Unicode character database decoder for OCaml.
- Uucp
Unicode character properties for OCaml.
- Uunf
Unicode text normalization for OCaml.
- Uuseg
Unicode text segmentation for OCaml.
- Uutf
Non-blocking streaming Unicode codec for OCaml.
User Interface
7_ENTRIES- lablgtk
GTK2 and GTK3 bindings for OCaml with various higher-level facilities to define GUIs.
- lablqml
QML Qt5 bindings for OCaml.
- 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-Term
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
Notty is a declarative terminal library for OCaml, structured around the notion of composable images.
- ocaml-linenoise
Self-contained OCaml bindings to linenoise; easy high-level readline functionality in OCaml.
Large Source Code Examples
13_ENTRIES- Base
Standard library for OCaml
- cil
C Intermediate Language
- coq
formal proof management system
- frama-c
platform dedicated to the analysis of source code written in C
- libguestfs
library and tools for accessing and modifying virtual machine disk images
- Liquidsoap
a swiss-army knife for multimedia streaming, notably used for netradios and webtvs
- mirage
library operating system that constructs unikernels for secure, high-performance network applications across a variety of cloud computing and mobile platforms
- MLDonkey
cross-platform multi-network peer-to-peer daemon
- Oni2
Native, lightweight modal code editor.
- pfff
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.
- Tezos
a self-upgradable Proof of Stake blockchain
- WHY3
platform for deductive program verification
- xen-api
management stack that configures and controls Xen-enabled hosts and resource pools, and co-ordinates resources within the pool.
Logging
3_ENTRIESMessaging
7_ENTRIES- ocaml-zmq
ZeroMQ bindings for OCaml with Async and Lwt wrappers.
- onanomsg
nanomsg bindings for OCaml.
- Kafka
OCaml bindings for Apache Kafka.
- AMQP
AMQP client library for Async and Lwt.
- MPI
Message Passing Interface bindings for OCaml.
- MQTT
OCaml implementation of the MQTT pubsub protocol.
- capnp-ocaml
OCaml code generator plugin for the Cap'n Proto serialization framework.
Metaprogramming
3_ENTRIES- **Articles**
Articles:A Guide to Extension Points in OCamlExtension Points, or how OCaml is becoming more like LispSyntax extensions without Camlp4: let's do it"].ppx_monad β Monad syntax extension for OCaml.[ppx_deriving_yojson](https://github.com/whitequark/ppx_derivinβ¦ - **Tools and Language Extensions**
Tools and Language Extensions: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](http://caml.inria.fr/pub/docs/manual-camlp4/manuaβ¦
Metrics
1_ENTRIES- prometheus
OCaml client library for Prometheus monitoring.
Mobile Applications
2_ENTRIES- **Bindings**
Bindings:Cordova plugins β List of bindings to Cordova plugins. Get access to native device components like accelerometer, SMS, geolocation, etc in OCaml.
Networking
4_ENTRIES- **HTTP Tools**
HTTP Tools:ocaml-cohttp β Very lightweight HTTP server using Lwt or Async.ocurl β OCaml bindings to libcurl.httpaf β A high performance, memory efficient, and scalable web server written in OCaml.piaf - Client/server library for HTTP/1.X / HTTP/2 written entirely in OCaml.
- ocaml-dns
A pure OCaml implementation of the DNS protocol.
- fluent-logger
Fluentd logger for OCaml.
- charrua-unix
charrua-unix is a Unix DHCP daemon based on charrua-core.
Online Courses
4_ENTRIES- OCaml MOOC: Introduction to Functional Programming in OCaml
Videos available in this playlist of the OCaml Software Foundation YouTube channel.
- University of Illinois
Course that uses OCaml to teach functional programming and programming language design
Package Management
2_ENTRIES- **Distribution**
Distribution:OPAM β A flexible Git-friendly package manager with multiple compiler support.ocamlfind β Local OCaml library manager. Used by most of the OCaml ecosystem.OCaml for Windows - opam repository and experimental build for Windows (deprecated since 2021).Diskuv OCaml - Diskuv OCaml distribution fβ¦
- **Build Tools**
Build Tools:dune β A composable and opinionated build system for OCaml (former jbuilder)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.oasis2opam β Tool to convert OASIS metadata to OPAM package descriptions.[obuild](https://β¦
Parallelism
2_ENTRIES(Note: Sorted from the easier to use to the more flexible.)
- **Libraries**
Libraries:Parmap β Provides easy-to-use parallel map and fold functions.ForkWork β 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.Parallel β A library for spawning proβ¦
- **Articles**
Articles:What is the state of OCaml's parallelization abilities?Parallel programming in multicore OCamlParallelism programming from the officiel OCaml manualAwesome multicore OCaml. A compilatβ¦
Printers helpers
13_ENTRIES- Reason's native Console.log
- **ppx_deriving**
βs
[@@deriving show]. - **refl**
, a ppx_deriving-like.
- **lrt**
, another ppx_deriving-like.
- **tpf**
, again a ppx_deriving-like.
- **typerep**
, probably a ppx_deriving-like with ppx_typerep_conv.
- **repr**
, which appears to have the user build the type representation manually from combinators in addition to also having the user pass it where needed.
- **data-encoding**
, also fully manual.
- **cmon**
, fully manual.
- **dyn**
in Dune. It appears to also be fully manual.
Project Starter Templates
3_ENTRIES- drom
The drom tool is a wrapper over opam/dune in an attempt to provide a cargo-like user experience.
- spin
Reason and Ocaml project generator
- modern-ocaml
Template for an ocaml project with modern tooling
Questions
13_ENTRIES- biocaml
OCaml Bioinformatics Library http://biocaml.org.
- bistro
OCaml library for building bioinformatics pipelines.
- lacaml
OCaml bindings for BLAS/LAPACK (high-performance linear algebra Fortran libraries).
- obandit
OCaml library for multi-armed bandits.
- onumerical
Numerical library for OCaml.
- oml
OCaml library for general numerical work.
- ocephes
Bindings to frequently used
Cspecial functions library. - slap
A linear algebra library in OCaml with type-based static size checking for matrix operations.
- tensorflow-ocaml
OCaml bindings for TensorFlow.
- owl
OCaml numerical library: dense and sparse matrix, linear algebra, regressions, maths and stats functions.
- WHIZARD
A system designed for the efficient calculation of multi-particle scattering cross sections and simulated event samples.
Regular Expressions
4_ENTRIES- Re
a pure OCaml regular expressions library with combinators, supporting several formats (glob, posix, str, etc.).
- ocaml-pcre
bindings to the PCRE library (perl-compatible regular expressions)
- Humane-re
Humane-re attempts to provide an easy interface for 90% of your regex needs. Courtesy of ocaml-re.
- Tyre
Tyre is a set of combinators to build type-safe regular expressions, allowing automatic extraction and modification of matched groups.
Security and Cryptography
5_ENTRIES- ocaml-tls
TLS in pure OCaml.
- Digestif
Hash algorithms (like SHA* or BLAKE2*) in OCaml and C.
- cryptokit
The Cryptokit library for OCaml provides a variety of cryptographic primitives that can be used to implement cryptographic protocols in security-sensitive applications.
- nocoiner
A Commitment scheme library for Multi-party computations such as online auctions and gambling.
- nocrypto
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.
Semantic Technology
1_ENTRIES- OCaml-RDF
OCaml library to manipulate RDF graphs and execute Sparql queries.
Serialization
8_ENTRIES- atdgen
A serialization compiler for multiple languages (OCaml, Java, Python, Scala, Typescript) with a Binou or JSON format
- bencode
Bencode (.torrent file format) reader/writer.
- biniou
Extensible binary data format, like JSON but faster.
- jsonm
Non-blocking streaming JSON codec for OCaml.
- xmlm
A streaming codec to decode and encode the XML data format.
- yojson
An optimized parsing and printing library for the JSON format.
- sexplib
A S-expression parser and printer
System Programming
5_ENTRIES- Mirage OS
Mirage is a programming framework for constructing secure, high-performance network applications across a variety of cloud computing and mobile platforms.
- ocaml-fat
Read and write FAT-format filesystems from OCaml.
- ocaml-git
Pure OCaml low-level git bindings.
- ocaml-vchan
Pure OCaml implementation of the "vchan" shared-memory communication protocol.
- **Embedded systems**[OMicroB](https:/...
Embedded systemsOMicroB - A virtual machine designed to run OCaml bytecode on AVR (Arduino for instance) micro-controlers.OCaPIC - An OCaml virtual machine for PIC18 micro-controlers.ocaml-esp32 - A compiler for ESP32 SoC.
Testing
8_ENTRIES- Alcotest
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.
- QCheck
QCheck is a property testing library inspired from Haskell's QuickCheck
- Kaputt
comprehensive testing framework.
- Pa_test
General inline testing macro's.
- TestSimple
A lightweight unit testing framework compatible with the Test Anything Protocol.
- expect-test
A framework for writing tests in OCaml, similar to Cram, developed by JaneStreet.
Utilities
4_ENTRIES- ocaml-cuid
Collision-resistant IDs for server scalability & database performance.
- Validate
PPX deriver designed to streamline the process of validating records.
- Uuidm
Uuidm is an OCaml module implementing 128-bit universally unique identifiers version 3, 5 (name based with MD5, SHA-1 hashing) and 4 (random based) according to RFC 4122.
- sqids-ocaml
Official OCaml port of Sqids. Generate short unique IDs from numbers.
Web Development
3_ENTRIESInspired by awesome projects line. Discover more awesomeness .
- **Frameworks**
Frameworks:Opium β Sinatra like web toolkit for OCaml.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.Dream - Tidy Web framework for OCaml and ReasonML[webmachine](https://gitβ¦
- **Open Source Projects**
Open Source Projects:Cumulus β Hacker news like website with the OCaml framework Ocsigen