awesome-ocaml
A curated collection of awesome OCaml tools, frameworks, libraries and articles.
https://github.com/ocaml-community/awesome-ocaml
Last synced: 11 days ago
JSON representation
Algorithms and Data Structures
- Comparing a Machine Learning Algorithm Implemented in F# and OCaml
- OCamlgraph - A generic graph library 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.
- Duff - Implementation of Rabin's fingerprint and delta compression by P. MacDonald in OCaml (same as libXdiff
- ORaft - Library of Raft consensus algorithm implemented in OCaml
- ODiff - Library of YIQ NTSC transmission image difference alghoritm implemented in OCaml and ReasonML.
- ods - A large collection of data structures and algorithms for OCaml.
Application Libraries
- 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.
- Minicli - Minimalist library for command-line parsing.
- 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
- 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
Books
- 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.
- OCaml for Scientists - by Jon Harrop.
- Purely Functional Data Structures - This is the first or only book focus on various data structures in FP world. A must-read one.
- 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.
- Using, Understanding, and Unraveling OCaml - This book describes both the OCaml language and the theoretical grounds behind its powerful type system.
- 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.
Code Analysis and Linters
- Infer - Infer is a static analyzer for Java, C and Objective-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.
Community
Compilers and Compiler Tools
- Caramel - Caramel is a functional language for building type-safe, scalable, and maintainable applications.
- Hack Programming Language
- Haxe Programming Language
- Neko Programming Language - Originally the compiler was written in OCaml.
- Rust Programming Language - Originally written in OCaml before bootstrapping.
- Mazeppa - A modern supercompiler for call-by-value functional languages.
- 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.
- OCaml-Java - OCaml to Java bytecode compiler.
- Opa Programming Language
- Rhine - A Lisp on LLVM written in OCaml.
- Liquid ML - Shopify's Liquid Templating language for OCaml.
- 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.
- Obelisk - , a neat project to produce readable LaTeX, HTML, or plain-text EBNF-style documentation for your grammar.
- Angstrom - Parser combinators built for speed and memory efficiency
- Quick C-- Target Language - It is now a dead project. Github Repo. Alternative website.
- Compcert C Compiler - It is a C Compiler supporting most of the ISO C90 and C99 / ANSI C features.
- cDuce - cDuce is a modern XML-oriented functional language with innovative features.
- ocamllex/ocamlyacc - lex and yacc implementation for OCaml.
Concurrency
- Async - A monadic concurrence library to go with the Core library.
- The blog post that introduced Async
- Eio - effects-based direct-style IO for multicore OCaml.
- Miou - a simple scheduler for OCaml 5.
- Lwt - A cooperative threads library for OCaml.
- A user gives up on Async
Databases
- Dbm - A binding to the NDBM/GDBM Unix "databases".
- Implementing the Binary Memcached Protocol with Ocaml and Bitstring
- Finally, Type-Safe, Extensible and Efficient Language Integrated Query - by Oleg and Co.The proposed approach is to describe SQL queries in type-safe manner and optimize them (using term rewriting or normalization-by evaluation) before sending to database engine. It potentially could optimize O(n^2) queries to O(n) ones.
- Mongo.ml - An OCaml driver for Mongodb
- 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 API
- pgx - A pure OCaml PostgreSQL client library.
- mysql_protocol - Implementation of MySQL Protocol with the Bitstring library.
- Irmin - A distributed database that follows the same design principles as Git.
- RunOrg - It is a WIP database server written in OCaml.
- dokeysto - dumb OCaml key-value store, string keys and stringvalues. Optional on-the-fly LZ4 compression of values or tokyocabinet backend.
- Sequoia - Sequoia is a type-safe query builder for MySQL/MariaDB and PostgreSQL
- Macaque - Macaque is a library for safe and flexible database queries using comprehensions on top of PG'OCaml.
- ORM - ORM for SQLite.
- Caqti - Cooperative-threaded access to relational data
- Caqti setence preparation, ppx_rapper
- Interfacing OCaml and PostgreSQL with Caqti
Datetime
Developer Tools
- Try OCaml - Try OCaml in your web browser.
- BetterOCaml - An efficient, intuitive, and cross-platform web IDE with your OCaml code interpreted and running in your browser!
- Modular foreign function bindings
- 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.
- 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.
- ghim - A command-line tool to manage Github Issues.
- puml2xml - A PlantUML (.puml) to XML (.xmi) converter.
- ocaml-main-program-in-c - Example build system for making mixed C/Ocaml binaries where the main program is in C.
- Py.ml - OCaml bindings for Python.
- 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 - Minor mode for Emacs that extends Tuareg and Merlin with menus to change or reset the opam switch in the ambient Emacs session.
- merlin-eldoc - Emacs package to provide merlin's features through eldoc.
- vscode-ocaml - extension that provides OCaml language support for VSCode
- OCaml Debugger - extension that provides OCaml Debugger for VSCode
- Sublime better ocaml - Better OCaml mode for Sublime Text.
-
ocp-index
- Easy access to the interface information of installed OCaml libraries. Provides standalone tools like
ocp-browserandocp-grep. - ocp-index-top - Toplevel directive for looking up documentation using ocp-index.
- ocp-indent - Indentation tool for OCaml, to be used from editors like Emacs and Vim.
- Bisect_ppx
- Vim plugin - .
- OCaml: Learn & Code iOS app - Learn and execute OCaml code from your iPhone/iPad/Mac.
- 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.
- ctypes - Library for binding to C libraries using pure OCaml.
Exercises and Short Examples
- learn-ocaml-corpus - . Corpus of beginner-to-advanced online exercises (including those from the OCaml MOOC) with automatic grading tests.
- Programming Language Examples Alike Cookbook - The OCaml section of the book is a free reference for solving common programming problems using OCaml.
- OCaml at Exercism - Exercism is your place to engage in thoughtful conversations about code. Explore simplicity, idiomatic language features, and expressive, readable code. Solutions.
Formal Software Verification
- Alt-Ergo - Alt-Ergo is an open-source SMT solver dedicated to the proof of mathematical formulas generated in the context of program verification.
- 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.
General
- Functional Programming with OCaml
- Monads are a class of hard drugs
- Python to OCaml: retrospective
- OCaml for the Masses
- Beginner's guide to OCaml
- A blog about game development in OCaml
- (Functional) Alternatives to inheritance
- camlPDF - OCaml library for reading, writing and modifying PDF files.
- slacko - A neat interface for Slack in OCaml.
- Xen – OCaml Coding Considerations
Graphics
- lablgl - Interface to OpenGL. Integrates well with lablgtk.
- cairo2 - Binding to Cairo, a 2D Vector Graphics Library. Integrates well with lablgtk.
- Vg - Declarative 2D vector graphics for OCaml.
- glMLite - OpenGL bindings for OCaml. Provides an (experimental) functional API. (homepage)
- archimedes - 2D plotting library.
Internationalization
- 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.
Language-related
- Higher-Rank Polymorphism in OCaml
- Inlined records in constructors
- Algebraic Data Types
- OCaml Style Guide (by Jane Street) - See also: [1], [2], [3].
- A safe but strange way of modifying OCaml compiler
- Fiddling with the OCaml Type System
- mikmatch - OCaml pattern-matching extended with regexps
- XEN – OCaml Best Practices for Developers
Large Source Code Examples
- frama-c - platform dedicated to the analysis of source code written in C
- WHY3 - platform for deductive program verification
- cil - C Intermediate Language
- 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.
- Tezos - a self-upgradable Proof of Stake blockchain
- xen-api - management stack that configures and controls Xen-enabled hosts and resource pools, and co-ordinates resources within the pool.
- coq - formal proof management system
Logging
Machine Learning
- Owl - Scientific library with neural networks, algorithmic differentiation and ONNX support.
- Deep Learning with OCaml (PyTorch bindings) - .
- Transfer Learning with OCaml (PyTorch bindings) - .
- Reinforcement Learning with OCaml (PyTorch bindings) - .
- Ocaml-NN - Fully functional monadic implementation of a Neural Network (FCNNs) in OCaml
- Ocaml-sklearn - scikit-learn for OCaml.
- Object detection convolutional neural network with OCaml (based on Owl) - .
- PyTorch bindings - OCaml bindings for PyTorch.
- Chatoyant - SDK for LLM providers (OpenAI, Anthropic, xAI, OpenRouter and local servers) built on Eio, with typed tool calling, structured outputs and streaming.
Messaging
- 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
- Syntax extensions without Camlp4: let's do it!
- Reading Camlp4 – Ambassador to the Computers
- camlp5 - Camlp5 is a preprocessor-pretty-printer of OCaml.
- ppx_import - Import is a syntax extension that allows to pull in types or signatures from other compiled interface files.
-
ppx_string_interpolate
- A simple ppx filter to support string interpolation like
[%str "value of foo is $(foo)"]. - ppx_monad - Monad syntax extension for OCaml.
- 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.
- ppx_deriving_yojson - A Yojson codec generator for OCaml.
- camlp4 - Camlp4 is part of the standard OCaml distribution and is different from Camlp5.
Metrics
- prometheus - OCaml client library for Prometheus monitoring.
Mobile Applications
- OCaml + Cordova = more secured, typed and hybrid mobile applications
- OCaml on iOS 7 Released
- Cordova plugins - List of bindings to Cordova plugins. Get access to native device components like accelerometer, SMS, geolocation, etc in OCaml.
Networking
- 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.