OCaml Libraries


A lot of my personal projects are about improving the developer experience when working with the OCaml programming language. Or to diversify the kind of applications that can be developed with it.

The project I spent the most time on is Merlin, a “Language Server” before this term was coined. It grew in scope and is now developed by Tarides.

I am interested in multimedia applications – GUI, audio processing, video games. In particular, I want to explore alternatives to the popular object-oriented software architectures in these domains.

Beside, I enjoy logic, programming language theory, algorithmic and data structures. You will find developments related to these topics below.

GUI and interactive applications

A few personal projects where I wander in the design space of graphical applications.

Lwd – “Lightweight documents”, a functional DOM [www]

Mixing reactive, functional and procedural programmings.

Nottui – A terminal UI library [www]

Built on top of Lwd and Notty.

Wall – OpenGL-based 2d vector graphics renderer [www]

Wall is a small rendering library. It targets OpenGL but represents the scene as pure data. It is a functional port of NanoVG.

Cuite – tentative bindings to Qt 5 [www]

Qt is one of the two major UI toolkit used by free operating systems. The other, Gtk, can already be accessed from OCaml with LablGtk.

However, Qt has better support for proprietary platforms and covers a larger spectrum of desktop UI idioms. It is one of the best library for developing traditional “productivity” applications (Ultimatepp and Lazarus are interesting alternatives).

Cuite brings Qt Gui library to OCaml and provides foundations to bind other Qt libraries. Most of the code is generated from an (E)DSL that describes Qt object hierarchies:

This design permits to reuse the description to connect to other programming languages, by porting the runtime support and adding a new backend to the compiler. The main benefit is that this work is independent of the size of the QObject hierarchy, which constitutes the majority of Qt.

Ibutsu – OCaml bindings to some self-contained media libraries [www]

Ibutsu (foreign body in Japanese) is an OCaml package to decode and sometimes encode:

It also provides a few image processing and resizing filters as well as efficient perlin noise implementation.

The core processing is done by C code, most coming from Sean Barret’s Stb libraries and also from Minimp3. These are reasonably fast implementations. Even more important, they are self-contained, portable C files. Therefore this package has no system dependency. It uses the same C compiler as used by OCaml installation and behaves like a portable OCaml package.

Other libraries

Ztl – a typed interface to Z3 prover [www]

Z3 is a powerful automated theorem proving tool but its API is tricky to use. Most of the work is done by manipulating values of type Z3.Expr.expr that denote expressions of different, often incompatible, sorts.

The main benefit of Ztl is leveraging the type system to enforce well-sorted manipulations. If an OCaml expression types, the Z3 term it evaluates to is well-sorted.

Ztl also offers a simplified, purely functional, interface to Z3 solvers and contexts. For a moderate overhead, it will take care of snapshotting and backtracking for you. No need to bother with global state anymore.

Grenier – a collection of algorithms and data structures [www]

Grenier regroups implementations of self-contained algorithms – too small to justify the overhead of having a separate package.

There are implementations of algorithms for manipulating binary trees, solving order maintenance, bin packing, minimizing automata, etc.