OCaml Weekly News

Previous Week Up Next Week


Here is the latest OCaml Weekly News, for the week of July 16 to 23, 2019.

Table of Contents

MirageOS retreat September 23rd - 29th

Hannes Mehnert announced

Hey, the next MirageOS retreat will take place again in Marrakesh at the end of September. Reports from earlier retreats and more details are available at http://retreat.mirage.io – everybody welcome! please sign up rather sooner than later :)

Some MirageOS unikernels: DNS servers, CalDAV

Hannes Mehnert announced

Hi, apart from libraries and development tools, we've been working quite a bit on more realistic MirageOS applications which may be useful for you. Namely DNS authoritative servers (primary that has their zones in a git remote, secondaries, let's encrypt provisioning (all done via DNS)) and a CalDAV server. In addition, we are doing some monitoring (Grafana + influx) of the running unikernels (themselves and the host system), and are positive that we are spending less CPU ticks (~x4) and less memory (easily an order of magnitude) by replacing our Unix-based CalDAV server (same OCaml code base) with a MirageOS virtual machine / unikernel. Thanks to all who made this possible.

If you're interested in this line of work (including installation instructions which use an opam overlay for unreleased packages - let us know if it works or does not work for you), please have a look at https://hannes.nqsb.io/Posts/Summer2019

OCaml 4.08.1+rc1

Florian Angeletti announced

The release of OCaml version 4.08.1 is imminent. This new bugfix release fixes some compilation failures in presence of "-pack", and some native-code alignment issues on ARM64, PPC64 and amd64. We have created a release candidate that you can test.

The source code is available at these addresses:


The compiler can also be installed as an OPAM switch with one of the following commands:

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


opam switch create ocaml-variants.4.08.1+rc1+<VARIANT> --repositories=default,ocaml-beta=git+https://github.com/ocaml/ocaml-beta-repository.git

where you replace <VARIANT> with one of these:

  • afl
  • default-unsafe-string
  • force-safe-string
  • flambda
  • fp
  • fp+flambda

We want to know about all bugs. Please report them here: https://github.com/ocaml/ocaml/issues

Happy hacking, — Florian Angeletti, for the OCaml team.

OCaml 4.08.1 changes:

  • Bug fixes:
    • #7887: ensure frame table is 8-aligned on ARM64 and PPC64

    (Xavier Leroy, report by Mark Hayden, review by Mark Shinwell and Gabriel Scherer)

    • #8751: fix bug that could result in misaligned data section when compiling to

    native-code on amd64. (observed with the mingw64 compiler) (Nicolás Ojeda Bär, review by David Allsopp)

    • #8769, #8770: Fix assertion failure with -pack

    (Leo White, review by Gabriel Scherer, report by Fabian @copy)

Anil Madhavapeddy then said

The Docker containers in the opam repository CI [1,2] have all now been rebuilt to reflect the latest contents of the 4.08 branch as per Florian's message. This means that your 4.08 CI tests will now reflect the bug fixes below, and so (for example) nocrypto should be installable now.

[1] https://hub.docker.com/r/ocaml/opam2/
[2] https://github.com/ocaml/infrastructure/wiki/Containers

soupault: a static website generator based on HTML rewriting

Daniil Baturin announced


Soupault is the first (to my knowledge) website generator that exploits the fact that well-formed HTML is machine readable and transformable (and thanks to @aantron's lambdasoup it's quite easy to do).

It can do things like "use the first <h1> for the page title" or "insert output of date -R into the <time> element no matter where it's in the page".


  • No templates, no themes, no front matter. You tell it where to insert stuff or what to extract using CSS selectors.
  • Built-in ToC, footnotes, and breadcrumbs.
  • Directories are site sections and can be nested.
  • Extracted metadata can be exported to JSON and fed to external scripts for creating section indices or custom taxonomies.
  • Configurable preprocessors for pages in formats other than HTML.

Soupault can be a drop-in automation tool for existing websites: the directory structure is fully configurable, clean URLs are optional, and it can preserve paths down to file extensions.

Genprint - general value printing

progman announced

Genprint is now available as a library. It uses a PPX extension. Working with OCaml versions from 4.02.

http://github.com/progman1/genprintlib (general value printing in compiled code)

Available through the official opam repository.

Printing arbitrary data in OCaml?

Zeroexcuses asked

For OCaml, is there a way to print arbitrary data, or do I need to write a custom printer for every object?

In Rust, I can do something like

struct ...

and then it will auto derive a way to print the data for me.

In Clojure, most objects can be printed as is.

In OCaml, is there a way to print objects without writing a custom printer function?

Thierry Martinez replied

There exist some deriving mechanisms in OCaml quite similar to those you know in Rust (or Haskell): they are implemented by PPX syntax extensions, namely ppxlib or ppx_deriving. With such extensions, you may write for instance:

type example = A | B [@@deriving show]

and two functions pp_example : Formatter.formatter -> example -> unit and show_example : example -> string will be automatically generated next to the type declaration. (show comes as a standard plugin with ppx_deriving; if you prefer to use ppxlib, you will need an additional plugin for show: you may use my ppx_show plugin.)

Chet Murthy also replied

You may have seen "genprint" announced just today; it's also a way to print arbitrary values, via a different pathway.

Other OCaml News

From the ocamlcore planet blog

Here are links from many OCaml blogs aggregated at OCaml Planet.


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.