OCaml Weekly News

Previous Week Up Next Week

Hello

Here is the latest OCaml Weekly News, for the week of November 11 to 18, 2025.

Table of Contents

opam 2.5.0~beta1

Kate announced

Hi everyone,

We are happy to announce the first beta release of opam 2.5.0.

This version is a beta, we invite users to test it to spot previously unnoticed bugs as we head towards the stable release.

Changes

  • :red_apple: Allow the macOS sandbox to write in the /var/folders/ and /var/db/mds/ directories as it is required by some of macOS core tools (#4389, #6460)
  • Stop opam switch create --dry-run from creating any directory. Thanks to @hannes for this contribution. (#5918)
  • :ocean: A couple more changes were made and minor regressions were fixed

:open_book: You can read our blog post for more information about these changes and more, and for even more details you can take a look at the release note or the changelog.

Try it!

The upgrade instructions are unchanged:

For Unix systems

bash -c "sh <(curl -fsSL https://opam.ocaml.org/install.sh) --version 2.5.0~beta1"

or from PowerShell for Windows systems

Invoke-Expression "& { $(Invoke-RestMethod https://opam.ocaml.org/install.ps1) } -Version 2.5.0~beta1"

Please report any issues to the bug-tracker.

Happy hacking, <> <> The opam team <> <> :camel:

Announcing the first release of Alice, a radical OCaml build system

Steve Sherratt announced

I’m pleased to announce the initial release of Alice, a radical, experimental OCaml build system, package manager, and environment manager for Windows, macOS, and Linux. Its goal is to allow anyone to program in OCaml with as little friction as possible.

To build your first program with Alice, run:

$ alice tools install   # Skip this if you already have an OCaml compiler!
$ alice new hello
$ cd hello
$ alice run
 Compiling hello v0.1.0
   Running hello/build/packages/hello-0.1.0/debug/executable/hello

Hello, World!

The UI is heavily inspired by Cargo.

An important distinction between Alice's and Opam's packaging philosophies is that in Alice, the OCaml compiler and development tools are not packages. The alice tools install command will install a pre-compiled (relocatable!) OCaml compiler, a compatible ocamllsp, and ocamlformat user-wide, similar to how rustup installs the Rust compiler and LSP server. This lets you go from zero to OCaml really fast because you don't have to build the compiler from source. This speedup is particularly noticeable on Windows where building the compiler can take upwards of 10 minutes.

Alice supports building packages with dependencies on other packages, but currently only local packages are supported, and it can only build Alice packages, not Opam packages. See an example here. I'll probably add Opam compatibility in the future.

It's still early days and a lot is missing before Alice could feasibly be used for real projects.

If you want to try it out anyway, install the alice Opam package, the github:alicecaml/alice Nix flake, or run the interactive install script:

curl -fsSL https://alicecaml.org/install.sh | sh

More details about installing Alice are here.

If you want read more, check out the blog.

First release of ppx_deriving_jsont

vds announced

I am happy to announce the first release of ppx_deriving_jsont.

As the name implies, it is a tool that automates some of the burden inherent to writing Jsont descriptions. Jsont is a fairly novel library for declarative JSON data manipulation, created by @dbuenzli.

This ppx can manage most of the basic types, tuples, variants and records, but still lacks a lot of features and control. It is also quite bad at error reporting. The current roadmap, which highlights existing and missing features can be found in the project’s readme along with many examples. I focused on generating readable and reusable code, close to the cookbook illustrations.

Note that Jsont offers much finer control and many more features than what that you can achieve using this crude ppx. Please take some time to read about all of its intricacies:

When precision and good error handling are required, such as when interacting with external json sources, thoughtfully crafted descriptions should still be considered. But I do believe this ppx to be very useful for bootstrapping, prototyping or when both the encoders and decoders are entirely under the app’s control. I wrote it to that intent and already use it in several personal projects. I hope you will find it useful too! (and not too non-sensical :slightly_smiling_face:)

crypt 2.0 - unix crypt function

Mikhail announced

Hi there!

I'm happy to announce the release of a new major version (i.e., 2.0) of the crypt library (bindings to the [Unix crypt](https://en.wikipedia.org/wiki/Crypt_(Unix)) function). The previous version, 1.3, was outdated, since the last commit was six years ago. This version does not support correct compilation on various Unix platforms (Linux, FreeBSD, macOS), and uses deprecated tools. However, the new version addresses these issues: it supports Linux, FreeBSD and macOS, uses modern tools, has safe C stubs, provides excellent documentation, and features an idiomatic high-level wrapper.

Installation

by OPAM package manager:

$ opam install crypt.2.0  

Example of usage

# #require "crypt";;

# Crypt.crypt ~salt:"GUBv0xjJ" "hello";;
- : string = "GUpsIDCLVu8AY"

# Crypt.crypt ~derivation:Md5 ~salt:"GUBv0xjJ" "hello";;
- : string = "$1$GUBv0xjJ$rQSvX8r6cT7H/NItzzVNQ/"

If you don't provide any salt, a new salt will be generated every time the function is called.

# Crypt.crypt "hello";;
- : string = "QwD.wi5nLT/0s"

# Crypt.crypt "hello";;
- : string = "MYM.5hv5Lk2Mg"

But for a deterministic generation, you should use one salt that you can generate using the Crypt.Salt module or another external module.

# let salt = Crypt.Salt.gen_base64 9;;
val salt : string = "dHiPl3q99"

# Crypt.crypt ~salt "hello";;
- : string = "dHDdeFGUWcGyQ"

P.S.

Project that uses crypt:

Artisanal Coding Is Dead, Long Live Artisanal Coding!

Joel Reymont announced

I wrote a blog post about adding command history browsing and editing, as well as tab completion, to ocamldebug, without typing a single line of code. I challenge you to review the PR for fun and to try to find holes in it!

I’m going to add DWARF debugging information to OCaml next. I think it’s almost ready to go but needs double and triple checking. Commits look like this

Date:   Thu Nov 13 14:55:24 2025 +0200


Add DWARF tests for basic functionality

Add minimal tests to verify DWARF emission works correctly with -g flag.
Tests compile OCaml programs with debugging enabled and verify correct
execution.

and

Date:   Thu Nov 13 14:54:30 2025 +0200

Implement DWARF v4 debugging support for OCaml

Add complete DWARF version 4 debugging information generation for OCaml
native code. The implementation generates debug info for functions, types,
and line numbers, enabling debugger support for OCaml programs.

Key components:
- Low-level DWARF primitives (tags, attributes, forms, encodings)
- Debug Information Entries (DIE) construction
- Line number program generation
- String table management with offset tracking
- Code address tracking and relocation
- Integration with OCaml compilation pipeline
- Configuration flags to enable/disable DWARF emission

The implementation follows the DWARF 4 specification and generates
valid debug sections (.debug_info, .debug_line, .debug_str, .debug_abbrev)
that can be consumed by standard debuggers like gdb and lldb.

Moonpool 0.10, and a blogpost about Moonpool at Imandra

Simon Cruanes announced

Good morning,

A couple of news about Moonpool. Moonpool is a concurrency and parallelism library that provides a Runner.t abstraction, implemented mostly by thread pools, as a way to run lightweight tasks possibly on multiple cores.

First, I just wrote a blog post about our use of Moonpool at Imandra. The post discusses our experience with using Moonpool and some lessons learned over time.

Secondly, Moonpool 0.10 was just released. It contains a few bugfixes, and removes some deprecated modules. It also removes moonpool.fib (fibers with structured concurrency) as they have turned out, over the years, to be somewhat hard to use properly (they assume the existence of a parent fiber, making code highly context-dependent). Lightweight thread-safe futures (based on Picos') with per-future local-storage are still there and serve mostly the same purpose. The release and change notes can be found here.

libdrm - OCaml bindings for Linux mode setting, etc

Thomas Leonard announced

I'm pleased to announce the first release of libdrm-ocaml (OCaml bindings for the libdrm C library).

libdrm is used by applications such as Wayland compositors to control the physical graphics hardware.

For example, you can use the library to enumerate graphics devices:

utop # Drm.Device.list ();;
- : Drm.Device.Info.t list =
[{primary_node = Some "/dev/dri/card0";
  render_node = Some "/dev/dri/renderD128";
  info = PCI {bus = {domain = 0; bus = 1; dev = 0; func = 0};
              dev = {vendor_id = 0x1002;
                     device_id = 0x67ff;
                     subvendor_id = 0x1458;
                     subdevice_id = 0x230b;
                     revision_id = 0xff}}}]

utop # let dev = Unix.openfile "/dev/dri/card0" [O_CLOEXEC; O_RDWR] 0;;

utop # Drm.Device.Version.get dev;;
- : Drm.Device.Version.t =
{version = 3.61.0; name = "amdgpu"; date = "0"; desc = "AMD GPU"}

Here's an excerpt configuring a hardware plane to present a framebuffer on a CRT controller:

plane.%{ K.Plane.fb_id } <- Some fb;
(* Source region on frame-buffer: *)
plane.%{ K.Plane.src_x } <- Drm.Ufixed.of_int 0;
plane.%{ K.Plane.src_y } <- Drm.Ufixed.of_int 0;
plane.%{ K.Plane.src_w } <- Drm.Ufixed.of_int (fst size);
plane.%{ K.Plane.src_h } <- Drm.Ufixed.of_int (snd size);
(* Destination region on CRTC: *)
plane.%{ K.Plane.crtc_x } <- 0;
plane.%{ K.Plane.crtc_y } <- 0;
plane.%{ K.Plane.crtc_w } <- fst size;
plane.%{ K.Plane.crtc_h } <- snd size;

For a proper tutorial, see Linux mode setting, from the comfort of OCaml.

New release of visitors

François Pottier announced

I am pleased to announce a new release of visitors, a tool that automatically generates visitor classes for algebraic data types.

The new features of this release are as follows:

  • visitors now decorates every generated method with a type annotation. This can help understand the generated code. More importantly, this enables type-directed disambiguation, so visitors now supports situations where two distinct types have a field or a data constructor by the same name. (Reported by Guillaume Boisseau. Contributed by Sacha Élie-Ayoun.)
  • Install a new executable command, visitors_preprocess, to preprocess an OCaml source file and see the result.
  • Update Makefile.preprocess to use visitors_preprocess.
  • Require ppxlib version 0.37.0 or newer.

MirageOS on Unikraft

Continuing this thread, shym announced

Just a short update to let you know that OCaml/Unikraft 1.1.0 has been released with support for OCaml 5.4 and Unikraft 0.20.0.

Happy hacking!

Old CWN

If you happen to miss a CWN, you can send me a message and I'll mail it to you, or go take a look at the archive or the RSS feed of the archives.

If you also wish to receive it every week by mail, you may subscribe to the caml-list.