OCaml Weekly News

Previous Week Up Next Week

Hello

Here is the latest OCaml Weekly News, for the week of October 07 to 14, 2025.

Table of Contents

opam-publish 2.7.0

Kate announced

Hi everyone,

We are happy to announce the release of opam-publish 2.7.0 (and 2.6.0), which together brought the ability to more easily publish your releases automatically, thanks to @filipeom:

  • A new OPAM_PUBLISH_GH_TOKEN environment variable and --token argument are now available to pass the GitHub token
  • SSH keys aren't used to push the branch to the user's fork anymore. Instead the token we already require is used.
  • If undefined, the git config variables user.name and user.email are automatically filled with the github username and username@opam-publish as a backup

An example of the new automated setup can be found in this CI job.

Other minor changes include:

  • The addition of a message after the PR is open, to notify users that they can re-run opam-publish to update the PR. Thanks to @punchagan
  • The switch from lwt_ssl to tls-lwt which avoid one dependency and avoid depending on the system libssl

Happy publishing!

<> <> The opam team <> <> :camel:

OCaml.org: Introducing Backstage OCaml - Separate Feeds for Stable and Experimental Features

Sabine Schmaltz announced

We're pleased to announce that OCaml.org now has dedicated RSS feeds and pages for stable and experimental announcements, introduced in PR #3278!

What's new:

  • OCaml Changelog at ocaml.org/changelog — Official stable release announcements and updates from the OCaml compiler, OCaml infrastructure, and the OCaml Platform Tools
  • Backstage OCaml at ocaml.org/backstage — Updates on experimental releases, work-in-progress, and opportunities to contribute to the development of the OCaml Platform and its infrastructure

This separation helps keep the main changelog focused on production-ready releases while providing a dedicated space for those interested in experimental work, early testing, and contributing to OCaml's development.

Both pages have their own RSS feeds, so you can subscribe to whichever matches your needs—or both!

We welcome your feedback as we continue improving OCaml.org.

LexiFi at FUN OCaml 2025

Nicolas Ojeda Bar announced

Dear OCaml enthusiasts,

LexiFi participated in this year's FUN OCaml that took place in Warsaw this past September 15 and 16. The event was a great success, thanks to the efforts of the organizers and the other participants. Hopefully the event will continue to take place and develop in the future.

LexiFi both sponsored and contributed (two) presentations to the event: a 30-minute retrospective on 25 years of using OCaml at LexiFi, and a 2-hour workshop on implementing a toy version of our type-reflection extension to the compiler.

If you are interested, we wrote a short blog post https://www.lexifi.com/blog/ocaml/fun-ocaml-2025/ where you will find the slides and the video for the 30-minute presentation, as well as the code and the slides for the 2-hour workshop (the video recording for this part is not yet available).

Enjoy!

Best wishes, Nicolas

Introducing oui

Nathan Rebours announced

At OCamlPro we're happy to announce our new ongoing project funded by the CEA-List: ocaml-universal-installer or oui!

oui's goal is to help teams developping applications in OCaml to package them for their users outside the OCaml World by building binary installers for all major platforms: Linux, Windows and macOS.

oui builds standalone installers: you just need to download and run the file. No need to install OCaml, Opam and to compile anything on the target system anymore.

The tool will be used to package and distribute Frama-C and its plugins to non opam users.

It is still in development but we'd like to present it to the community with the hope that it will prove helpful to you as well.

How it works

You take care of building your application and provide oui the list of your binaries and extra files you'd like installed alongside them and it will assemble an installer from those.

It uses different tools and build different types of installers for all three main platfoms:

  • on Linux, we build self extracting archives using makeself.
  • on Windows, we build MSI using the Wix6 toolset
  • on macOS, we build regular OSX installers using pkgbuild~/~productbuild

We started oui on top of an older but very similar project: opam-wix. opam-wix was an opam plugin used to build a Windows MSI from a locally installed opam package. This feature, though not the core focus of the early development, is still available via opam-oui and will be extended with the ability to build installers for the other supported platforms.

A tool for the community

Though it is initially developped for Frama-C's distribution, both the CEA-List and ourselves at OCamlPro would like to make oui a community tool that can help open source OCaml developpers ship their applications easily.

The goal of this early announcement is to gather data and feedback on other use cases for binary installers across the OCaml Ecosystem to help us shape oui into the right tool from the start.

This is an ongoing project, if you'd like to follow the development, it is publicly hosted here.

OCaml 5.4.0 released

octachron announced

We have the pleasure of celebrating the birthdays of Camille Saint-Saëns and Karl Schwarzschild by announcing the release of OCaml version 5.4.0.

Some of the highlights of OCaml 5.4.0 are:

Labelled tuples

It is now possible to add labels on tuple fields

let ( * ) (x,~dx) (y, ~dy) =
  x*.y, ~dx:(x *. dy +. y *. dx )

Those labeled tuples are equivalent to SML records: they are an ordered and structurally-typed variants of records. In particular this implies that partial pattern matching on tuples is only possible for labelled tuples with a known type:

type t = float * dx:float
let v (x_and_dx:t) = let (x,..) = x_and_dx in x

Those types are mostly intended for local types where previous code was using tuples.

Array literal syntax support for immutable arrays and ~floatarray~s

The array literal syntax is now shared by array-like primitive types, like 'a array, floatarray and immutable array iarray. For instance, this code

let x = Float.Array.of_list [0.;1.;2.]

can now be written

let x : floatarray = [|0.; 1.; 2.|]

This also supported in patterns

let one = match x with
  | [|_;y;_|] -> Some y
  | _ -> None

However array indexing still needs to go through user-defined indexing operators

let (.$()) = Float.Array.get
let (.$()<-) = Float.Array.set
let () = x.$(0) <- x.$(1)

Immutable arrays

Along with shared array literals, OCaml 5.4 adds support for immutable arrays.

let v: int iarray = [| 0; 1; 2 |]

Immutable arrays are covariant in the type of their elements, it is thus possible to coerce immutable arrays with no costs at runtime:

let i1: _ iarray = [|object method m = 0 end|]
let i2 = ( i1 :> < > iarray)

Atomic record fields

It is now possible to mark a field of a record as atomic. Atomic operations on those fields require to use the new Atomic.Loc submodule after accessing the location with the [%atomic.loc ...] builtin extension. For instance,

type 'a mpsc_list = { mutable head:'a list; mutable tail: 'a list [@atomic] }

let rec push t x =
  let before = Atomic.Loc.get [%atomic.loc t.tail] in
  let after = x :: before in
  if not (Atomic.Loc.compare_and_set [%atomic.loc t.tail] before after) then
    push t x
  ...

Moreover, it is forbidden to pattern match on atomic fields:

let f { head; tail } = tail
Error: Atomic fields (here tail) are forbidden in patterns,
       as it is difficult to reason about when the atomic read
       will happen during pattern matching: the field may be read
       zero, one or several times depending on the patterns around it.

in order to make all reads on those atomic fields explicit.

Four new standard library modules: Pair, Pqueue, Repr, and Iarray

The standard library has been extended with four new modules:

  • Pair: functions for working on pairs
let ones = Pair.map_fst succ (0,1)
  • Pqueue: priority queues, generic or not
module Int_pqueue = Pqueue.MakeMin(Int)
let q = Int_pqueue.of_list [4;0;5;7]
let some_zero = Int_pqueue.pop_min q
  • Repr: physical and structural equality, comparison function, more generically all functions dependent on the memory representation of values.
let f = Repr.phys_equal (ref 0) (ref 0)
  • Iarray: functions on immutable arrays
let a = Iarray.init 10 Fun.id
let b = Iarray.map succ a

Restored "memory cleanup upon exit" mode

This mode allows to restart many time the OCaml runtime in C-driven programs that interact with OCaml libraries. It is also useful to reduce noise when tracking memory leaks in C code running the OCaml runtime. To get around cancellation issues, the restored mode currently assumes that all domains are joined before exiting the OCaml runtime.

A new section in the reference manual on profiling OCaml programs on Linux and macOS

A new section in the reference manual explains how to use OS specific profiling tools to profile native OCaml programs.

A lot of incremental changes:

  • Many runtime and code generation improvements
  • More than thirty new standard library functions
  • Nearly a dozen improved error messages
  • Around fifty bug fixes

Please report any unexpected behaviours on the OCaml issue tracker and post any questions or comments you might have on our discussion forums.

The full list of changes can be found in the full changelog. Editor note: please follow the archive link above for the installation instructions and the full changelog

Happy hacking, Florian Angeletti for the OCaml team.

OCaml compiler office hours

Continuing this thread, gasche announced

The meeting went well – see the collaborative pad for notes.

I propose to have another meeting about a month from now:

on November 7th at 15:30–17:00 UTC

(I picked a different time slot from the current one, that also looks reasonable given previous poll results. If extra people would like to join, please feel free to participate to the time-slot poll in the first post so that I can tell when are good meeting times.)

@giltho thanks for noticing the language issue on the online-meeting service I proposed; this is a new issue that looks like it comes from a version upgrade, it of course had a fine English interface when I adopted the service. Let's keep jitsi.meet for now.

tutorial about compiling ocaml-5 on a ChromBook with Crostini

Florent Monnier announced

Hello dear list, I wrote another mini-tutorial to explain how to compile ocaml-5 on a chromebook with crostini: http://decapode314.free.fr/ocaml2/tut/tut-ocaml-5/tut-ocaml-5.html The trick to compile ocaml-5 in this environement was the same than to compile ocaml-4 in the same environement because ln -s doesn't seem to produce the expected result. At the beginning I edited the Makefile to replace the ln -s commands by cp commands, but an easier way is to use the make feature that permits you to change the value of one of the variable from the command line which invokes make, like this make LN=cp.

With this trick everything was producing the expected ocaml tools with ocaml-4, but with ocaml-5, I have only been able to get ocamlnat and ocamlopt tools (which is enough.)

ocamlopt was installed as expected by the make install command, but ocamlnat had to be copied by hand.

If the command ocaml produces an error (cannot execute), in scripts I can still replace:

#!/usr/bin/env ocaml

by:

#!/usr/bin/env ocamlnat

By defining the same environement variables than opam I can get two different ocaml version usable at the same time, one 4 version, and a 5 version, next to each other at the same time, without using opam because opam grew up a lot, and in crostini environement we quickly lack of space.

PS: If someone want to help finding how to get the ocaml and ocamlc commands functioning, the help will be wellcome, and I will update this mini-tutorial.

dune-release-action: Automate your opam package releases with GitHub Actions

David Sancho announced

Hi everyone 👋

I'm excited to share a new GitHub Action I've been working on: dune-release-action

If you maintain OCaml packages, you know the drill: every release involves a ritual of commands and manual steps. You need to:

  1. Ensure your CHANGES.md is properly formatted
  2. Tag your release
  3. Run dune-release lint + distrib + submit
  4. Create a GitHub release with the correct changelog section
  5. Check the opam-repository's PR
  6. Oh shit, github token is expired
  7. Create new token without expiration (??)
  8. Retry

For me, was following this guide https://gist.github.com/anmonteiro/abd9275456888740758aa9f772d1992a by @anmonteiro, but it typically took around an hour per release.

dune-release-action

dune-release-action automates the entire release workflow in GitHub Actions. Push a git tag, and the action runs dune-release for you with:

  • Handles all the dune-release orchestration
  • Validates your changelog format (right tag exists, etc)
  • Creates a GitHub release with proper description (from your changelog section (!!))
  • Submits a PR to opam-repository
name: Release

on:
  push:
    tags:
      - '*'

permissions:
  contents: write
  pull-requests: write

jobs:
  release:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
        with:
          fetch-depth: 0

      - uses: ocaml/setup-ocaml@v3
        with:
          ocaml-compiler: 5.3.0

      - run: opam install dune-release -y

      - uses: davesnx/dune-release-action@v1
        with:
          package-name: 'your-package'
          github-token: ${{ secrets.GH_TOKEN }}

This is very much a one-day half vibe-coded project and it's hard to test in many use cases, I'm sure there are edge cases and workflows I haven't considered.

Looking forward to hearing your thoughts!

Other OCaml News

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.