Previous week Up Next week


Here is the latest OCaml Weekly News, for the week of February 13 to 20, 2018.

  1. Scala Vector-like structure in OCaml
  2. Caqti 0.9.0 release - Compatibility layer for database clients
  3. Changes of Jbuilder's user interface
  4. Release 4.06.1
  5. Examples of using Base Map
  6. Logarion - static website generation
  7. Other OCaml News

Scala Vector-like structure in OCaml


vladb asked:
Hello everyone! I'm new to Ocaml and I was wondering if it has any data
structure similar to Scala's immutable vector:
(idea behind it here: It's basically a
more powerful List, when you can append at both ends, concatenate, split, or
change elements, all in O(logN). In Scala I was using it a lot and find it much
more useful than Lists. I couldn't find anything similar in ocaml, but maybe I
wasn't searching for the right keywords. External libraries would also be
useful. Thanks!
Yawar Amin replied:
Hi, it looks like the Batteries Included library indeed has a vector

There is also a mutable, array-backed vector available at
Simon Cruanes replied:
So I started writing something based on trees with up to 32 values and 32
children. It should be called
and should provide roughly the same interface as a mutable vector (fast append
on the right, fast lookup).

first benchmark (comparing it to
which is based on Okasaki's "purely functional random access lists", i.e. a list
of complete binary trees of increasing size):
It's already significantly faster than RAL!
IndiscriminateCoding then said:
And there is my
of RRB-trees in OCaml.
UnixJunkie and Simon Cruanes replied:
> Hi Simon, how does your thing compares to the batteries' stuff?

The algorithm is different from BatVec's underlying rope. I wrote a kind of
HAMT-like structure where all nodes contain an array of up to 32 values, and up
to 32 subnodes, and filled in increasing index order. [Benchmarks with

I expect it to be quite fast in practice for batch operations by using
_transient_ mutability to diminish the number of intermediate structures
allocated. Right now it's only a first draft.

I didn't compare to clarity (it needs 4.04 :confused: and I'm testing on 4.03 —
also no flambda because my benchmarks trigger a bug in the compiler).

Caqti 0.9.0 release - Compatibility layer for database clients


Petter A. Urkedal announced:
I released Caqti 0.10.0 with the following changes:

- Added `-linkall` flags to driver libraries to fix direct linking (thanks to
- Added convenience functions `collect_list` and `rev_collect_list`.
- Renamed `template` to `query` and related function, leaving deprecated
- Added `ptime_span` field type mapping to SQL intervals.
- Be more permissive about types of data returned from MariaDB when
  expecting numerical results.

Changes of Jbuilder's user interface


Jérémie Dimino announced:
The next release of Jbuilder will change a few things in the way Jbuilder runs
and reports information to the user, so I thought it was important to
communicate about it before the release.

Report all errors

The first change is that Jbuilder now continues and reports all errors instead
of stopping as soon as an error is encountered. The old behavior wasn't
deterministic; several consecutive run of Jbuilder without changing the code
might have reported different errors. This was especially annoying when running
a big testsuite.

For instance, consider the following project:

$ cat jbuild
(library ((name foo)))
$ cat
let x = 1 + "e"
$ cat
let y = List.hd "foo"

Both `` and `` contain a typing error. Jbuilder until version 1.0+beta17
would report either:

- the error in ``
- the error in ``
- both

depending on the selected number of jobs and other things such as the position
of the moon.

With Jbuilder starting from 1.0+beta18, both errors will always be reported.
Note that the order in which they will be reported is still non-deterministic
except with `-j1`.

Display modes

Until now, Jbuilder only supported two display modes:

- the default one, where Jbuilder would print one line per command being run
- the verbose one, selected with `--verbose`, where Jbuilder would print the
full command lines with lots of colors

There was a request to support a more quiet mode and reporting all errors made
it even more relevant. This is because errors ended up being drown in a sea of
commands being run.

So we added two new display modes to Jbuilder:

- a quiet mode, where Jbuilder only reports errors
- one where Jbuilder displays a status line showing:
  + the number of goals reached
  + the total number of goals to reach to build the requested targets
  + the number of jobs currrently running in parallel

The latter one is the new default. It is possible to change the display mode
with the new `--display` command line option:

- use `--display short` for the old default
- use `--display verbose` for the verbose mode
- use `--display quiet` for the quiet mode
- use `--display progress` for the new default

Configuration file

Since things such as the display mode are often a global user setting, we added
support for a configuration file.

The configuration is `~/.config/dune/config` on Unix systems and `Local
Settings/dune/config` in the user directory on Windows systems.

You can put the two following settings in the configuration file:

;; same as --display MODE
(display MODE)

;; Same as -jN
(jobs N)

You can get more information with `jbuilder help config`.

Other news

We have settled on what the new files and project layout will be for Dune, you
can look at [this ticket]( for more
details. As a result we should be able to start working on the migration from
Jbuilder to Dune relatively soon.

We also have a much better idea of how plugins will work, so we should be able
to start working on adding support for plugins as soon as the migration to Dune
is complete. The main concern being to provide a clean, easy to use, well
documented and future proof enough build API for users to write plugins.

The main topics we are working on at the moment are good support for inline and
expectation tests, as well as doing the necessary changes in Jbuilder to support
tools such as `ppx_import` or features such as `menhir --infer`.

Release 4.06.1


Damien Doligez announced:
We have the pleasure of celebrating the anniversary of the founding
of the Red Cross by announcing the release of OCaml version 4.06.1.
This is mainly a bug-fix release, see the list of changes below.

It is available as an OPAM switch and as a source download from:

Happy hacking,

-- Damien Doligez for the OCaml team.

OCaml 4.06.1 (16 Feb 2018):

### Bug fixes

- MPR#7661, GPR#1459: fix faulty compilation of patterns
  using extensible variants constructors
  (Luc Maranget, review by Thomas Refis and Gabriel Scherer, report
  by Abdelraouf Ouadjaout and Thibault Suzanne)

- MPR#7702, GPR#1553: refresh raise counts when inlining a function
  (Vincent Laviron, Xavier Clerc, report by Cheng Sun)

- MPR#7704, GPR#1559: Soundness issue with private rows and pattern-matching
  (Jacques Garrigue, report by Jeremy Yallop, review by Thomas Refis)

- MPR#7705, GPR#1558: add missing bounds check in Bigarray.Genarray.nth_dim.
  (Nicolás Ojeda Bär, report by Jeremy Yallop, review by Gabriel Scherer)

- MPR#7713, GPR#1587: Make pattern matching warnings more robust
  to ill-typed columns; this is a backport of GPR#1550 from 4.07+dev
  (Thomas Refis, review by Gabriel Scherer, report by Andreas Hauptmann)

- GPR#1470: Don't commute negation with float comparison
  (Leo White, review by Xavier Leroy)

- GPR#1538: Make pattern matching compilation more robust to ill-typed columns
  (Gabriel Scherer and Thomas Refis, review by Luc Maranget)

Examples of using Base Map


trefis announced:
Note that the docs for v0.10 are now up, and that core_kernel's doc for Map
includes some examples:

Logarion - static website generation


Orbifx announced:
For anyone watching this, it looks like I will be skipping `0.3` and going
straight for `0.4` after some testing.

Website is now at and Git at Join the mailing list for more news and

Other OCaml News

From the ocamlcore planet blog:
Here are links from many OCaml blogs aggregated at OCaml Planet,

frama-clang 0.0.5, fixing compatibility issue with
   Debian/Ubuntu, is out. Download ithere.

Coq 8.7.2 is out

Release of a first version of, a Tezos block explorer

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

Alan Schmitt