Previous week Up Next week


Here is the latest OCaml Weekly News, for the week of October 10 to 17, 2017.

  1. capnp-rpc 0.3: Unikernel support!
  2. Merlin 3.0.3: windows support
  3. Containers 1.4
  4. jbuilder 1.0+beta14
  5. OCaml 4.06.0+beta2
  6. OCaml's manual 4.06.0+beta2
  7. Jbuilder templates
  8. Immutable strings and the "More OCaml" textbook
  9. Databases and OCaml
  10. Camomile 0.8.6
  11. stdint 0.5.0
  12. Scalable and serverless media processing using BuckleScript/OCaml and AWS
  13. Other OCaml News

capnp-rpc 0.3: Unikernel support!


Thomas Leonard announced:
I'm pleased to announce the release of [capnp-rpc
0.3](, an OCaml
implementation of the Cap'n Proto RPC specification.

If you haven't used the library before, please see the [documentation and
tutorial]( Cap'n
Proto RPC aims to provide secure, efficient, typed communications between
multiple parties.

### Changes since v0.2

#### New features

This release adds a new `capnp-rpc-mirage` package, which provides support for
using the library within a MirageOS unikernel. See for

This makes use of the new [capnp
3.1.0]( release,
which removes all uses of `Core_kernel` and `Unix` from the runtime library.

#### Documentation and examples

- The documentation now includes some diagrams to clarify the various example scenarios.

- Fixed a ref-counting bug in the calculator example. Also, changed the service
ID to match what the C++ client expects. With these changes, the C++ client's
tests pass when used with the OCaml service.

#### API changes

There are a few minor API changes:

- `Capnp_rpc_unix.Vat_config.derived_id ?name config` is now
`Capnp_rpc_unix.Vat_config.derived_id config name`. If you weren't passing a
`~name` argument before, use `"main"` to get the same ID.

- `Capnp_rpc_unix.Network`'s `Socket_address` module is now called `Location`.

- There is an explicit network parameter in `Network.connect`, etc. This is
needed to support Mirage, where the network isn't a global.

#### Bug fixes

- Fix race when reconnecting. We notified the user that the capability had
broken while the old connection was still shutting down. If they immediately
tried to reconnect, we tried to reuse the old connection. Now, we wait for it to
be removed.

- Fix handling of leaks in switchable. If we detected the ref-count was invalid,
we tried to resolve to an error, but resolving now checks that the ref-count is
valid first so this failed.

#### Fuzzing

- Also test answering questions with errors or with a promise from another question.

#### Code cleanups

- Use a better way to get the client certificate from a TLS connection
(suggested by @hannes).

- Use `Alcotest_lwt` for unit-tests.

- Move `capnp://` URI handling to `Capnp_rpc_lwt.Capnp_address`. This allows it
to be shared with the Mirage code.

- Add `Capnp_rpc_lwt.VAT_NETWORK` with simpler signature than `S.VAT_NETWORK`.

- The address sub-module of `S.NETWORK` is now available separately as `S.ADDRESS`.

Merlin 3.0.3: windows support


Frédéric Bour announced:
I am pleased to announce the release of Merlin 3.0.3.

The release is already available on Opam.

The most significant change is the support for Windows platform that has been
contributed by David Allsop (@dra27). You can read more about this on his

This release also received a lot of external contributions in the form of bug
fixes and improved portability.

Thanks to David Allsop, Bernhard Schommer, Christophe Troestler, Fabian Hemmer,
Gregory Nisbet, Keigo Imai, Malcolm Matalka, Olivier Andrieu and Steve Purcell
for their contributions.
Thanks to OCaml Labs for their continued support.

Containers 1.4


Simon Cruanes announced:
I'm happy to announce a new release of containers! The library is maturing, so
releases are becoming smaller. This release contains some performance
improvements, including a new `` inspired from the thread started by
@antron, thanks to @bluddy, and a few bugfixes and new functions.

More informations at

jbuilder 1.0+beta14


Rudi Grinberg announced:
It is my pleasure to announce the release of the 14th beta of jbuilder 1.0.
Everyone is recommended to upgrade as the release contains no known breaking
changes and only bug fixes and new features.

Here's a copy of the change log for your convenience:

- Add (copy_files <glob>) and (copy_files# <glob>) stanzas. These
  stanzas setup rules for copying files from a sub-directory to the
  current directory. This provides a reasonable way to support
  multi-directory library/executables in jbuilder (#35, Francois Bobot)

- An empty `jbuild-workspace` file is now interpreted the same as one
  containing just `(context default)`

- Better support for on-demand utop toplevels on Windows and when the
  library has C stubs

- Print `Entering directory '...'` when the workspace root is not the
  current directory. This allows Emacs and Vim to know where relative
  filenames should be interpreted from. Fixes #138

- Fix a bug related to `menhir` stanzas: `menhir` stanzas with a
  `merge_into` field that were in `jbuild` files in sub-directories
  where incorectly interpreted (#264)

- Add support for locks in actions, for tests that can't be run
  concurrently (#263)

- Support `${..}` syntax in the `include` stanza. (#231)

OCaml 4.06.0+beta2


Gabriel Scherer announced:
We have created a second beta version of the upcoming OCaml 4.06.0
release for your repeated testing pleasure. It is available as opam
switches 4.06.0.+beta2 (or +beta2+flambda, etc.)

  opam switch 4.06.0+beta2

or as source archives at

The Changelog since 4.05.0 is available at

The more specific list of changes since 4.06.0+beta1 is included at
the end of this email.

Thanks to all of you who have been actively testing OCaml software and
making strings immutable.

Happy hacking,

-- Gabriel Scherer for the OCaml team.

(Changes that can break existing programs are marked with a "*")

### fixes of regressions introduced in 4.06

- the output of `ocamlc -config` in 4.06.0+beta1 did not include
  the 'bytecomp_c_compiler' and 'native_c_compiler' variables anymore,
  which broke some configuration/installation scripts. The variables
  are now restored. When possible, script authors are encouraged to
  use the new, more meaningful variables 'c_compiler' and
  (Jeremy Yallop and Sébastien Hinderer)

- GPR#1174 (Stop pushing default arguments when there is an
  unlabeled argument) was reverted, as it was causing an unplanned
  increase in allocations when defining functions with optional
  (Jacques Garrigue and Leo White)

- a compilation failure on the Frama-C and CIL codebases introduced in
  4.06.0+beta1 was fixed.
  (Gabriel Scherer and Jeremy Yallop)

### Code generation and optimizations:

- MPR#7642, GPR#1411: ARM port: wrong register allocation for integer
  multiply on ARMv4 and ARMv5; possible wrong register allocation for
  floating-point multiply and add on VFP and for floating-point
  negation and absolute value on soft FP emulation.
  (Xavier Leroy, report by Stéphane Glondu and Ximin Luo,
   review and additional sightings by Mark Shinwell)

### Tools:

- MPR#7048: ocamldoc, in -latex mode, don't escape Latin-1 accented letters
  (Xavier Leroy, report by Hugo Herbelin)

* MPR#7363, GPR#830: ocamldoc, start heading levels at {1 not {2 or {6.
  This change modifies the mapping between ocamldoc heading level and
  html heading level, breaking custom css style for ocamldoc.
  (Florian Angeletti, request and review by Daniel Bünzli)

- MPR#7635, GPR#1383: ocamldoc, add an identifier to module
  and module type elements
  (Florian Angeletti, review by Yawar Amin and Gabriel Scherer)

(this change was already in 4.06.0+beta1, but missing from the Changelgo)
- GPR#1231: improved printing of unicode texts in the toplevel,
  unless OCAMLTOP_UTF_8 is set to false.
  (Florian Angeletti, review by Daniel Bünzli, Xavier Leroy and
   Gabriel Scherer)

### Runtime system:

* GPR#1416: switch the Windows 10 Console to UTF-8 encoding.
  (David Allsopp, reviews by Nicolás Ojeda Bär and Xavier Leroy)

* MPR#7640, GPR#1414: reimplementation of Unix.execvpe to fix issues
  with the 4.05 implementation.  The main issue is that the current
  directory was always searched (last), even if the current directory
  is not listed in the PATH.
  (Xavier Leroy, report by Mantis users 'AltGr' and 'aalekseyev',
   review by Ivan Gotovchits)

### Bug fixes

- MPR#7612, GPR#1345: afl-instrumentation bugfix for classes.
  (Stephen Dolan, review by Gabriel Scherer and David Allsopp)

- GPR#1390: fix the [@@unboxed] type check to accept parametrized types
  (Leo White, review by Damien Doligez)

OCaml's manual 4.06.0+beta2


octachron announced:
With the upcoming release of OCaml 4.06, the reference manual at
will be updated.

As an experiment, a beta release of this new version of the
manual has been uploaded at .
(Note that the peculiar colour scheme is only there to mark this version as a
beta version.)

This new incarnation of the manual counts no less than two new chapters and
one new section:

- chapter 5, "Polymorphism and its limitation",
  details potential polymorphism related troubles and their solutions or
  workarounds; from weakly polymorphic types (the infamous "'_a" type variables)
  and their link with the relaxed value restriction, to polymorphic recursion and
  higher-ranked polymorphic function:

- section 10.6, "The native toplevel: ocamlnat",
  describes the experimental native toplevel and in particular how to build it:

- chapter 24, "Compiler plugins",
  covers briefly the basic of ocaml-side plugins with a basic hello-world plugin

Moreover, four sections of the language extension chapter have been (mostly)
integrated into the first part of the manual:

- field punning and functional update for records ("{ r with x = y }" and
  "{ x; y }"):

- local opens ("let open M in … " and "M.(…)"):

- overriding class definitions ("method!" and "val!"):

- explicit polymorphic type annotations ("f: 'a. 'a -> 'a") are now part of
  the new chapter 5, "Polymorphism and its limitation" .

Lastly, the "num" library will no longer be distributed with the compiler.
Consequently, its documentation has been replaced by links to the new "num"
repository and "Zarith" repository.

This release also includes also a lot of smaller bug fixes and documentations
for new features described in the full change logs for 4.06 .

All comments on this new iteration of the manual are more than welcome.

Best wishes,
Florian "octachron" Angeletti.

Jbuilder templates


Martin Jambon announced:
I made two series of templates to help myself and others get started with jbuilder:

The first one is for a simple OCaml library, meant to be distributed via opam.

The second series of templates is for an application made up of several folders
and several executables. I'm not quite sure if I did the right thing there.
Please let me know what can be improved. In particular, the requirement for
having one opam file per library seems unnecessary since I have no intention of
distributing these libraries. Maybe I'm doing it wrong and there's a simpler way
of having multiple folders with OCaml sources, which is really just what I want.
Rudi Grinberg then said:
> Please let me know what can be improved. In particular, the requirement for
> having one opam file per library seems unnecessary since I have no intention of
> distributing these libraries

There's no such requirement. You can simply omit the `public_name` for your
library and jbuilder will no longer require an .opam file. However, the library
will no longer build whenever you request the `@install` alias (`$ jbuilder
build` or `$ jbuilder build @install`). You may still depend on this library in
your libraries as usual.

> Maybe I’m doing it wrong and there’s a simpler way of having multiple folders
> with OCaml sources, which is really just what I want

This is now possible in beta14. Have a look at the


(copy_files# subfolder1/*)
(copy_files# sbufolder2/*.ml)

I just realized that the `copy_files#` is not that well documented. We should
probably add an example of this feature in the manual. Perhaps even start a FAQ.

Immutable strings and the "More OCaml" textbook


John Whitington announced:
As you know, strings are immutable by default in the upcoming OCaml 4.06.0.

I have updated the text of "More OCaml" to excise string mutation in favour of
the new bytes data type. Paper and Kindle copies purchased from Amazon starting
today will be up-to-date, as will PDF e-books from

This means that readers must now use OCaml 4.02 or later, and (I think) that no
reader will ever have to use -safe-string or -unsafe-string flags.

The examples and exercises at have been updated too.

If you have a paper copy of "More OCaml" and would like a free copy of the
updated PDF version, please email me. Customers of the PDF e-book should already
have received an automatic update email.

"OCaml from the Very Beginning" did not require any updates with regard to
immutable strings.

Databases and OCaml


Deep in this thread, Bobby Priambodo announced:
> I’m also trying to wrap postgresql-ocaml with a friendlier API, specifically
> Lwt/Async-friendly. Still in early stages, though.

So I managed to build something that I'm quite satisfied of (although still much
room for improvement), Ezpostgresql (name shamelessly inspired by Ezjsonm, as I
am bad at giving names):

At this point it's only compatible with Lwt since I'm not sure how to make one
that can work with both Async and Lwt. You can see the examples on the README
for more info. And yes, it also supports connection pooling out of the box via
Lwt_pool. Do note it's still WIP and by no means stable yet!

Feedbacks are welcome :slight_smile:
Petter A. Urkedal then said:
`postgresql-ocaml` also has async bindings which can be used to implement
concurrent interfaces without preemptive threading. This takes a bit more work,
of course, so it may be a second iteration. I'm using it for the PostgrSQL
driver of [Caqti]( On the other hand I
had to resort to preemptive threading for the SQLite3 driver.

Camomile 0.8.6


Yoriyuki Yamagata announced:
After a long hiatus, Camomile 0.8.6 is released! Camomile is a Unicode library
for OCaml. This is a preparation for OCaml 4.06 and a milestone to Camomile

stdint 0.5.0


Andre Nathan announced:
I'm happy to announce a new version of the stdint library. Version 0.5.0
implements `Hashtbl.hash` for `int128` and `uint128`, a contribution by @rixed.

For bug reports and contributions, please refer to the [Github

Scalable and serverless media processing using BuckleScript/OCaml and AWS


Romain Beauxis announced:
We've been having a lot of fun playing with BuckleScript at work recently. I
wrote this story to summarize some of the good tricks we've used with the OCaml

Link here:

Other OCaml News

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

How to render trees like the Unix tree command

"More OCaml" updated to support OCaml 4.06 immutable strings

Implementing the PowerPC backend for BAP - Part 0

Full Time: Senior Developer - Ruby / Rails / ELM at HubTran in remote

Full Time: Software Developer (Functional Programming) at Jane Street in New York, NY; London, UK; Hong Kong

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