Previous week Up Next week


Here is the latest OCaml Weekly News, for the week of March 22 to 29, 2016.

  1. opam-builder bot and opam-file website
  2. Is it possible to get back some OCaml code after ppx processing ?
  3. gen_js_api 1.0, easy OCaml bindings for Javascript libraries
  4. Other OCaml News

opam-builder bot and opam-file website


Fabrice Le Fessant announced:
I am pleased to announce that the "opam-builder" service 1.0 is
online and running on:

opam-builder is a bot, that compiles all the versions of all the
packages in the OPAM repository on a Linux Debian 8 amd64 computer,
for OCaml 3.12.1, 4.00.1, 4.01.0, 4.02.3 and 4.03.0+beta1.

If you maintain an OPAM package, you should check there from time to
time to verify that your package can still be compiled.

It tries to keep up with the OPAM repository, in a best effort way,
given that the server running it is not very powerful (4-core, no
hyper-threads, standard SATA disks). Compiling the full repository on
one OCaml version can take one or two days, but next compilations are
incremental (only impacted packages are recompiled, and binary
archives are used to re-use previous compilations), so a report for
every commit should be available after only a few minutes/hours,
depending on the number of packages that need to be recompiled.

Using the archives built by opam-builder, we have also set up a
simple website (an opam-file like) showing the modules installed by
all packages. If you wonder which package provides a given module or
from which version a function is available, it might help you:

The availability of a module or function in a given package is shown, with its
type, in a file called @PACKAGE.VERSION.txt.

The sources of opam-builder are available on Github, if you want to
start it on a different hardware/OS:

Feedback and PRs are welcome !

Is it possible to get back some OCaml code after ppx processing ?


Francois Berenger asked:
I am completely new to the -ppx option of the compiler, so please
forgive in advance my (probably stupid) two questions.

Here is some example code:
type t = {
  i: int;
  f: float
} [@@deriving sexp]

1) I'd like to see all the functions automatically created
by the magical spell "[@@deriving sexp]".
At least their names and type signatures would be nice.
How to do that?

2) If that's not possible, I'd like to get back some
OCaml code corresponding to the AST after ppx processing.
If that's possible, how to do that?
Louis Roché suggested:
1) With utop, you will get what you want:

utop # type t = {
i: int;
f: float
} [@@deriving eq,show];;
type t = { i : int; f : float; }
val equal : t -> t -> bool = <fun>
val pp : Format.formatter -> t -> unit = <fun>
val show : t -> bytes = <fun>

2) I believe that you are looking for an option like -dsource for ocamlc
Goswin von Brederlow added:
'ocamlc -i' should work too.
Jeremie Dimino also replied:
For the case of Jane Street ppx rewriters (assuming you are using
ppx_sexp_conv), you can install ppx_jane and do:

Nicolas Ojeda Bar also replied:
You can use ppx_tools ( to do it:

ocamlfind ppx_tools/rewriter ./my_ppx_rewriter

gen_js_api 1.0, easy OCaml bindings for Javascript libraries


Alain Frisch announced:
It's my pleasure to announce the first public release of gen_js_api, a new FFI
tool to bind to Javascript code from OCaml.

gen_js_api relies on js_of_ocaml's compiler and runtime system, but *not* its
standard library nor its camlp4/ppx language extension.  In the future
gen_js_api could support (with the same binding definitions) alternatives ways
to combine OCaml and Javascript, such as Bucklescript or direct embedding of a
JS engine into a native OCaml application.

The tool has been developed at LexiFi mostly by Sebastien Briais and me; it has
been used internally for several months in production.

Project page:

Available in OPAM:

  opam install gen_js_api

(Note: gen_js_api requires OCaml 4.03.)

Enjoy, and please drop us a note if you use this tool!  We'd love to hear some

Other OCaml News

From the ocamlcore planet blog:
Here are links from many OCaml blogs aggregated at OCaml Planet, NOT reported as unsafe anymore reported as unsafe in Firefox/Chrome


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