OCaml Weekly News

Previous Week Up Next Week


Here is the latest OCaml Weekly News, for the week of February 16 to 23, 2021.

Table of Contents

OCamlFormat 0.17.0

Guillaume Petiot announced

On behalf of the OCamlFormat development team I am pleased to announce the release of ocamlformat.0.17.0 :tada:.

OCamlformat is an auto-formatter for OCaml code, writing the parse tree and comments in a consistent style, so that you do not have to worry about formatting it by hand, and to speed up code review by focusing on the important parts.

OCamlFormat is beta software. We expect the program to change considerably before we reach version 1.0.0. In particular, upgrading the ocamlformat package will cause your program to get reformatted. Sometimes it is relatively pain-free, but sometimes it will make a diff in almost every file. We are working towards having a tool that pleases most usecases in the OCaml community, please bear with us!

To make sure your project uses the last version of ocamlformat, please set


in your .ocamlformat file.

Main changes in ocamlformat.0.17.0 are:

  • the let-open option, deprecated since 0.16.0, has been removed
  • support for OCaml 4.06 and 4.07 has been removed, minimal version requirement bumped to OCaml 4.08
  • the extension-sugar option, deprecated since 0.14.0, has been removed
  • the syntax of infix set/get operators is now preserved (String.get and similar calls used to be automatically rewritten to their corresponding infix form .(), that was incorrect when using the -unsafe compilation flag. Now the concrete syntax of these calls is preserved)
  • all sugared extension points are now preserved
  • injectivity type annotations (OCaml 4.12 feature) are now supported
  • various fixes about comments positions

We encourage you to try ocamlformat, that can be installed from opam directly ( opam install ocamlformat ), but please remember that it is still beta software. We have a FAQ for new users that should help you decide if ocamlformat is the right choice for you.

Set up OCaml 1.1.8

Sora Morimoto announced


  • The Windows opam wrapper is fractionally less-archaically named opam.cmd, with no loss in arcaneness.
  • Export CYGWIN_ROOT on the Windows runners, allowing bash to be invoked as %CYGWIN_ROOT%\bin\bash~/~$env:CYGWIN_ROOT\bin\bash (and similarly for Cygwin setup-x86_64.exe).
  • The Windows runner no longer prepends %CYGWIN_ROOT%\bin to PATH.


  • Switches in Unix are now properly initialized before running depext.


Set up OCaml 1.1.9

Sora Morimoto announced


  • Further fix to switch initialisation.


OCaml 4.12.0, first release candidate

octachron announced

The release of OCaml 4.12.0 is expected next week. We have created a release candidate that you can test. Most opam packages should work with this release candidate (without the need for an alpha repository).

Compared to the last beta, this new release only contains one fix for Solaris and illumos.

If you find any bugs, please report them here: https://github.com/ocaml/ocaml/issues

Happy hacking,

– Florian Angeletti for the OCaml team.

Installation instructions

The base compiler can be installed as an opam switch with the following commands

opam update
opam switch create 4.12.0~rc1 --repositories=default,beta=git+https://github.com/ocaml/ocaml-beta-repository.git

If you want to tweak the configuration of the compiler, you can pick configuration options with

opam update
opam switch create <switch_name> --packages=ocaml-variants.4.12.0~rc1+options,<option_list>

where <option_list> is a comma separated list of ocaml-option-* packages. For instance, for a flambda and afl enabled switch:

opam switch create 4.12.0~rc1+flambda+afl --packages=ocaml-variants.4.12.0~rc1+options,ocaml-option-flambda,ocaml-option-afl

All available options can be listed with opam search ocaml-option.

The source code is available at these addresses:

Ppxlib.0.22: an update on the state of ppx

Nathan Rebours announced

We're happy to announce the release of ppxlib.0.22.0, the fist release of ppxlib fully compatible with OCaml 4.12. The main and only feature of this release is the bump of the internal OCaml AST used by ppxlib from 4.11 to 4.12, allowing you to use 4.12 language features with ppxlib and any ppxlib-based ppx. Note that ppxlib was compatible with the 4.12 compiler since 0.19.0 but that you couldn't use 4.12 language features until now.

This is the third such AST bump release since we announced our plan to improve the state of the PPX ecosystem here and we though it'd be a good time to report back to you and tell you how things are going on this front.

For those of you who aren't familiar with this plan, the goal is to upstream a minimal, stable, ocaml-migrate-parsetree-like API on top of the compiler-libs called Astlib. It will allow us to keep ppxlib and any ppx based on ppxlib compatible with OCaml trunk at all time. To allow better performances and a clear compisition semantic, all the ppxlib-based ppx-es need to use the same AST (as opposed to ocaml-migrate-parsetree based ppx-es) so from a certain perspective, this plan simply moves the breaking API up one step, from compiler-libs to ppxlib. In order to greatly ease the maintainenance of ppx-es and to prevent opam-universe splits we decided that everytime we cut a breaking ppxlib release, we will send patches to keep the existing ppx-es compatible with the latest version and therefore with the latest OCaml compilers and language features.

While this seems like a tremendous task and a huge amount of work, dune and other tools that raised in its wake such as opam-monorepo incredibly simplified this kind of work.

Ahead of OCaml releases, we prepare a branch of ppxlib with the upgraded AST. We then fetch opam-repository to gather a list of sensible reverse dependencies (i.e. packages whose latest version depends on ppxlib and is compatible with ppxlib's latest version) and assemble a dune workspace with a clone of each of those reverse dependencies, our ppxlib branch and all of their dependencies thanks to opam-monorepo. We then use dune to build all the packages we're interested in and simply follow the compilation errors until everything builds successfully with the new ppxlib. What remains is to create PRs on the relevant repositories to upstream those changes, after which maintainers have everything they need to cut a new compatible release.

Most of this process is automated using scripts but it still requires a bit of handiwork. We aim at extracting tools to further improve this workflow and reduce the time and effort required but it has been surprisingly smooth. Our experience with the 4.10, 4.11 and 4.12 upgrades so far is that most reverse dependencies don't need an upgrade and that it's far less demanding for one person to upgrade all the packages that need it than it would be for each individual maintainers to understand the changes in the AST and do the upgrade themselves.

It's worth noting that for this to work well, the ppx-es and all their dependencies have to build with dune. We do maitain a separate opam-repository with dune ports of commonly used packages so in practice most projects fall into this category but a few exceptions remain and they are therefore not taken into account for this upgrade process.

We're also trying to improve the tracking of the upgrade's progress and for the 4.12 compatible release we created a github project to have a list of all the packages we considered and see where they are. We also keep track of the packages we had to exclude and why. During this upgrade, we considered 80 opam packages, out of which only 4 needed to be patched and 6 had to be excluded from the process as we couldn't reasonably get them to build in our workspace.

Once we have a better idea of what makes a package easy to upgrade we plan on releasing a set of reasonable rules to follow to benefit from those upgrades, we'll keep you updated on this!

All in all we're pretty happy with this new process and although it needs to be refined, we're confident it can grow into something sustainable by creating tools and CI to support it. Hopefully these will also benefit the wider community and help grow a healthier Opam universe.

Jason Nielsen asked

Curious about the current status of Astlib. I was closely following ppx at one point but it hasn't seen much activity recently. Thanks for all your hard work.

Jérémie Dimino

It's in progress. Not much happened in the past couple of months while we were finishing the port of a few projects to ppxlib and doing the 4.12 upgrade. But @pitag re-started working Astlib as of a week ago. You can follow our progression via the public meeting notes.

Note however that the ppx project was for our original goal or providing a "forever stable" API for ppx rewriters. It has been in pause since August 2020 while were trying the "upgrade the world" method, which as @NathanReb pointed out is working pretty well practice. At this point, it's looking more and more likely that we won't resurect the ppx project.

OCaml-based trading firm is hiring remote devs

Michael Bacarella announced

BTG is a trading firm founded by ex-Jane Street devs looking to hire some more devs.

The role is primarily remote, working with the rest of our mostly remote team, though we hope to resume regular on-sites in Puerto Rico.

We operate 24/7 and will consider employees anywhere in the world.

Prior experience with OCaml is a plus, though any solid programming experience with an interest in functional programming and strong static types is also fine.

Comfort navigating Linux is essential.

Shoot me a message with a copy of your résumé or C.V. to discuss the opportunity further: michael.bacarella@gmail.com

Feel free to re-post this elsewhere.

ocamlearlybird 1.0.0 beta1

文宇祥 announced

Hi, all. All the issues of beta1 have been fixed. Beta2 will be released soon.


OCaml for ARM MacOS

Aaron L. Zeng announced

I noticed that opam 2.08 is now available for ARM Macs using Homebrew, and I was able to confirm on my machine.

brew install opam away :)


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 online.