Previous week Up Next week


Here is the latest OCaml Weekly News, for the week of July 22 to 29, 2014.

  1. ppx_deriving 0.1
  2. User criteria for dependency solvers
  3. OCaml tutorial in Sweden
  4. ppx_deriving 0.2, ppx_deriving_protobuf 1.0.0
  5. Other OCaml News

ppx_deriving 0.1


Peter Zotov announced:
I'm glad to announce an initial release of ppx_deriving,
a modular syntax extension for type-driven code generation.
It will be shortly available in OPAM.

I will introduce ppx_deriving with an example:

# #require "ppx_deriving";;
# type file = {
  kind : [ `File | `Dir ];
  name : string;
  perm : int [@printer fun fmt -> Format.fprintf fmt "0o%03o"];
} [@@deriving Show, Eq];;
type file = { kind : [ `Dir | `File ]; name : bytes; perm : int; }
val pp_file : Format.formatter -> file -> unit = <fun>
val show_file : file -> bytes = <fun>
val equal_file : file -> file -> bool = <fun>
# print_endline (show_file { kind = `Dir; name = "bin"; perm =
0o755 });;
{ kind = `Dir; name = "bin"; perm = 0o755 }
- : unit = ()

A more thorough description is available in README[1].

While I intend this release to primarily serve as a preview for
the community and a means to gather feedback, it is fully usable
and documented. Some of the planned features (marked "TBD" in README)
are not yet implemented.

I hope that ppx_deriving can serve as a future replacement to both
ocsigen's deriving and JaneStreet's type_conv. If you are responsible
for these libraries, please get in touch. The OCaml ecosystem would
benefit from a single type-driven code generation mechanism.

I welcome any comments.

Yotam Barnoy asked and Peter Zotov replied:
> Would it perhaps make sense to generate a
> module per derived type? For example a type t would generate a module
> T_ (the underscore or any other suffix would reduce mixups with
> pre-existing modules). You could then use code such as
> 'if T_.(a = b && b = c) ...'
> or  ' x ...'
> which allows you to keep the infix notation for = which is important
> IMO.
> You could even generate T_ as having internal Eq, Ord, and Show
> modules (as requested by the user), which would be included in the T_
> module. This would allow you to easily pass them as first class
> modules to functions accepting Eq, Ord or Show signatures.

I believe this is best left to the upcoming implicits, which will
hopefully be merged soon.

I have based the current design on existing patterns across OCaml
ecosystem; I don't want to change the way people structure their
modules, I want to reduce the amount of boilerplate to write.
Yotam Barnoy then asked and Peter Zotov replied:
> Any idea where I can find some info on ocaml's upcoming implicits? A
> google search was not particularly helpful.

There are two articles by Alain Frisch:

They get the general idea across, but do not represent the ongoing work.
The ongoing work is being done in this git repository:

As far as I know, it is not yet documented in any way and it is not
clear whether it will be merged in OCaml at all.  However, I have high
hopes for this feature.

User criteria for dependency solvers


Roberto Di Cosmo announced:
This is a gentle request for comments on the user criteria language accepted by
dependency solvers used by package managers like Opam (see [1] for more details).

You will find in [2] a summary of the current language, with some use cases, and
a few proposed extensions to it.

It would be particularly interesting to have feedback on the expressivity of the
language: if there is some feature that is really missing for some use case you
may have encountered or envisioned, this is the right moment to suggest it.

You may answer off-list, and we'll try to have a final proposal ready for the
OCaml meeting in september



OCaml tutorial in Sweden


Jeremy Yallop announced:
Leo White and I will be giving an OCaml tutorial at this year's CUFP in Sweden.

Where: Gothenburg, Sweden (affiliated with ICFP 2014)
When: September 05, 2014 9:00 AM - 12:30 PM

The tutorial is aimed at people with programming experience, but no
prior knowledge of OCaml is needed.  We'll introduce the basics of
OCaml and then show how to use some of the latest OCaml tools such as
OPAM and IOCaml to build OCaml programs, focusing on the construction
of a simple game.

You can find more details on the CUFP site:

You can register here:

Note the deadline for (discounted) early registration: 3rd August 2014.

Hope to see you there!

ppx_deriving 0.2, ppx_deriving_protobuf 1.0.0


Peter Zotov announced:
I'm glad to announce the releases of ppx_deriving and
ppx_deriving_protobuf (ex ppx_protobuf).


_deriving_ is a library simplifying type-driven code generation on
OCaml >=4.02.[1]


  * New plugins: Enum, Iter, Map, Fold.
  * All plugins: don't concatenate affix if type is named `t`.
  * Add [%derive.Foo:] shorthand.
  * Show, Eq, Ord: add support for list, array, option.
  * Show: include full module path in output, including for types with
  * A lot of changes in Ppx_deriving interface.


_deriving Protobuf_ is a _deriving_ plugin  that generates
Google Protocol Buffers serializers and deserializes.[2]


  * First stable release and initial release as _deriving Protobuf_.


Other OCaml News

From the ocamlcore planet blog:
Thanks to Alp Mestan, we now include in the OCaml Weekly News the links to the
recent posts from the ocamlcore planet blog at

My first unikernel:

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

Release of OCaml-safepass 1.3:

Cartesian product (redux):

Doing Nothing in Mirage:

Seventh OCaml compiler hacking session (at Citrix):

libguestfs now works on 64 bit ARM:

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