OCaml Weekly News

Previous Week Up Next Week


Here is the latest OCaml Weekly News, for the week of June 04 to 11, 2019.

Table of Contents

Dune 1.10.0

Rudi Grinberg announced

On behalf of the dune team, I'm pleased to announce the 1.10.0 release of dune. This release is packed with bug fixes, but it also introduces a few interesting features. I'll highlight one important feature that we've introduced and plan to improve in future versions:

Dune allows you to specify package metadata in the dune project file and generate an appropriate opam file. This is advantageous to writing opam files manually as dune will correctly fill in some boilerplate such as the build command:

Here's a snippet from dune's own project file as a demonstration:

(generate_opam_files true) ;; necessary to enbale the generation

(license MIT)
(maintainers "Jane Street Group, LLC <opensource@janestreet.com>")
(authors "Jane Street Group, LLC <opensource@janestreet.com>")
(source (github ocaml/dune))
(documentation "https://dune.readthedocs.io/")

 (name dune)
  (ocaml (>= 4.02))
  (jbuilder (<> "transition"))
  (odoc (< 1.3.0))
  (dune-release (< 1.3.0)))
 (synopsis "Fast, portable and opinionated build system")
 (description "<redacted>"))

Generating the opam file is done via $ dune build @check (the @install, and @all aliases will also work).

Later, we plan to have dune do some sanity checks on the depends field. In the more distant future, we might even skip the generation step altogether by having opam invoke dune to get the generated opam file directly.

As usual, the change log is replicated here for your convenience:

1.10.0 (04/06/2019)

  • Restricted the set of variables available for expansion in the destination filename of install stanza to simplify implementation and avoid dependency cycles. (#2073, @aalekseyev, @diml)
  • [menhir] call menhir from context root build_dir (#2067, @ejgallego, review by @diml, @rgrinberg)
  • [coq] Add coq.pp stanza to help with pre-processing of grammar files (#2054, @ejgallego, review by @rgrinberg)
  • Add a new more generic form for the promote mode: (promote (until-clean) (into <dir>)) (#2068, @diml)
  • Allow to promote only a subset of the targets via (promote (only <pred>)). For instance: (promote (only *.mli)) (#2068, @diml)
  • Improve the behavior when a strict subset of the targets of a rule is already in the source tree for projects using the dune language < 1.10 (#2068, fixes #2061, @diml)
  • With lang dune >= 1.10, rules in standard mode are no longer allowed to produce targets that are present in the source tree. This has been a warning for long enough (#2068, @diml)
  • Allow %{…} variables in pps flags (#2076, @mlasson review by @diml and @aalekseyev).
  • Add a 'cookies' option to ppx_rewriter/deriver flags in library stanzas. This allow to specify cookie requests from variables expanded at each invocation of the preprocessor. (#2106, @mlasson @diml)
  • Add more opam metadata and use it to generate .opam files. In particular, a package field has been added to specify package specific information. (#2017, #2091, @avsm, @jonludlam, @rgrinberg)
  • Clean up the special support for findlib.dynload. Before, Dune would simply match on the library name. Now, we only match on the findlib package name when the library doesn't come from Dune. Someone writing a library called findlib.dynload with Dune would have to add (special_builtin_support findlib_dynload) to trigger the special behavior. (#2115, @diml)
  • Install the future_syntax preprocessor as ocaml-syntax-shims.exe (#2125, @rgrinberg)
  • Hide full command on errors and warnings in development and show them in CI. (detected using the CI environment variable). Commands for which the invocation might be omitted must output an error prefixed with File ~. Add an ~--always-show-command-line option to disable this behavior and always show the full command. (#2120, fixes #1733, @rgrinberg)
  • In dune-workspace files, add the ability to choose the host context and to create duplicates of the default context with different settings. (#2098, @TheLortex, review by @diml, @rgrinberg and @aalekseyev)
  • Add support for hg in dune subst (#2135, @diml)
  • Don't build documentation for implementations of virtual libraries (#2141, fixes #2138, @jonludlam)
  • Fix generation of the -pp flag in .merlin (#2142, @rgrinberg)
  • Make dune subst add a (version ...) field to the dune-project file (#2148, @diml)
  • Add the %{os_type} variable, which is a short-hand for %{ocaml-config:os_type} (#1764, @diml)
  • Allow enabled_if fields in library stanzas, restricted to the %{os_type}, %{model}, %{architecture}, %{system} variables (#1764, #2164 @diml, @rgrinberg)
  • Fix chdir on external and source paths. Dune will also fail gracefully if the external or source path does not exist (#2165, fixes #2158, @rgrinberg)
  • Support the .cc extension fro C++ sources (#2195, fixes #83, @rgrinberg)
  • Run ocamlformat relative to the context root. This improves the locations of errors. (#2196, fixes #1370, @rgrinberg)
  • Fix detection of README, LICENSE, CHANGE, and HISTORY files. These would be undetected whenever the project was nested in another workspace. (#2194, @rgrinberg)
  • Fix generation of .merlin whenever there's more than one stanza with the same ppx preprocessing specification (#2209 ,fixes #2206, @rgrinberg)
  • Fix generation of .merlin in the presence of the copy_files stanza and preprocessing specifications of other stanazs. (#2211, fixes #2206, @rgrinberg)
  • Run refmt from the context's root directory. This improves error messages in case of syntax errors. (#2223, @rgrinberg)
  • In .merlin files, don't pass -dump-ast to the future_syntax preprocessor. Merlin doesn't seem to like it when binary AST is generated by a -pp preprocessor. (#2236, @aalekseyev)
  • dune install will verify that all files mentioned in all .install files exist before trying to install anything. This prevents partial installation of packages (#2230, @rgrinberg)

OCaml 4.08.0+rc2

Damien Doligez announced

The release of OCaml version 4.08.0 is imminent. We have created a second 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.0+rc2 --repositories=default,beta=git+https://github.com/ocaml/ocaml-beta-repository.git


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

where you replace <VARIANT> with one of these:

  • afl
  • default_unsafe_string
  • flambda
  • fp
  • fp+flambda

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

Happy hacking,

– Damien Doligez for the OCaml team.

The only change from rc1 is the bug fix for #8705:

Editor's note: please follow the archive link for the full changelog from 4.07.1.

hdf5 0.1.5

Vladimir Brankov announced

hdf5 0.1.5 is not available in OPAM. Since the version 0.1.2 it mostly got bug fixes.



2-year Postdoc Position on Frama-C/E-ACSL

Julien Signoles announced

The Software Reliability and Security Lab at CEA LIST (Paris Saclay, France) is hiring a 2-year postdoctoral researcher who will improve E-ACSL, the runtime verification plug-in of Frama-C.

Frama-C is an opensource framework providing several analyzers for C code. The analyzed programs can be annotated by formal specifications written in the ACSL specification language. E-ACSL is one of the existing Frama-C analyzers. It converts ACSL annotations into C code in order to verify their validity at runtime, when the program is being executed.

The goal of this postdoctoral position is twofolds: on the one hand, the postdoctoral researcher shall propose new compilation schemes to support additional ACSL constructs; on the other hand (s)he shall define new compilation techniques (or adapt existing ones) in order to optimize the generated code for reducing the time overhead and the memory footprint of the generated program. The work will be guided by and evaluated on case studies providing by a few of our academic and industrial partners.

Knowledge in at least one of the following fields is required:

  • functional programming (ideally OCaml)
  • C programming
  • compilation
  • static analysis
  • semantics of programming languages
  • runtime verification
  • formal specification

A full description of the position is available online:


Feel free to contact me for additional details.

Category theory for Programmers book - OCaml flavor

Anton Kochkov announced

There is an amazing book called Category Theory for Programmers by Bartosz Milewski. At first it was focused on Haskell mostly, added Scala support after. But then someone stepped in to add the OCaml variant of this book. So writing this message as both recommendation for the book itself, and to be aware (and even better - to help) of the ongoing effort to make it OCaml-friendly.


See the current progress at https://github.com/ArulselvanMadhavan/ocaml-ctfp.

Genprint - general value printing

progman announced

This is a patch/switch for basic printing of any value (excepting abstract and polymorphic elements) exactly as printed by the toplevel for a final result.

It's appropriate for debug purposes where custom crafted or ppx-deriving printers are overkill/inconvenient.



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.