OCaml Weekly News

Previous Week Up Next Week


Here is the latest OCaml Weekly News, for the week of July 23 to 30, 2019.

Table of Contents

Dune 1.11.0

Rudi Grinberg announced

On behalf of the dune team, I'm pleased to announce the release of dune 1.11.0. This release contains quite a few new interesting features such as custom dialects: anyone can define their own OCaml based syntax. Is anyone up to revive the revised syntax? :slight_smile: I'd also like to highlight the the re-launch of variants feature in a sounder form, a new build-info library that queries build information, and that dune init can initialize an entire project. But of course, by far the most important thing is that the compiler's colours are now back :champagne:

1.11.0 (23/07/2019)

  • Don't select all local implementations in dune utop. Instead, let the default implementation selection do its job. (#2327, fixes #2323, @TheLortex, review by @rgrinberg)
  • Check that selected implementations (either by variants or default implementations) are indeed implementations. (#2328, @TheLortex, review by @rgrinberg)
  • Don't reserve the Ppx toplevel module name for ppx rewriters (#2242, @diml)
  • Redesign of the library variant feature according to the #2134 proposal. The set of variants is now computed when the virtual library is installed. Introducing a new external_variant stanza. (#2169, fixes #2134, @TheLortex, review by @diml)
  • Add proper line directives when copying .cc and .cxx sources (#2275, @rgrinberg)
  • Fix error message for missing C++ sources. The .cc extension was always ignored before. (#2275, @rgrinberg)
  • Add $ dune init project subcommand to create project boilerplate according to a common template. (#2185, fixes #159, @shonfeder)
  • Allow to run inline tests in javascript with nodejs (#2266, @hhugo)
  • Build ppx.exe as compiling host binary. (#2286, fixes #2252, @toots, review by @rgrinberg and @diml)
  • Add a cinaps extension and stanza for better integration with the cinaps tool tool (#2269, @diml)
  • Allow to embed build info in executables such as version and list and version of statically linked libraries (#2224, @diml)
  • Set version in META and dune-package files to the one read from the vcs when no other version is available (#2224, @diml)
  • Add a variable %{target} to be used in situations where the context requires at most one word, so %{targets} can be confusing; stdout redirections and "-o" arguments of various tools are the main use case; also, introduce a separate field target that must be used instead of targets in those situations. (#2341, @aalekseyev)
  • Fix dependency graph of wrapped_compat modules. Previously, the dependency on the user written entry module was omitted. (#2305, @rgrinberg)
  • Allow to promote executables built with an executable stanza (#2379, @diml)
  • When instantiating an implementation with a variant, make sure it matches virtual library's list of known implementations. (#2361, fixes #2322, @TheLortex, review by @rgrinberg)
  • Add a variable %{ignoring_promoted_rules} that is true when --ingore-promoted-rules is passed on the command line and false otherwise (#2382, @diml)
  • Fix a bug in future_syntax where the characters @ and & were not distinguished in the names of binding operators (let@ was the same as let&) (#2376, @aalekseyev, @diml)
  • Workspaces with non unique project names are now supported. (#2377, fix #2325, @rgrinberg)
  • Improve opam generation to include the dune dependencies with the minimum constraint set based on the dune language version specified in the dune-project file. (2383, @avsm)
  • The order of fields in the generated opam file now follows order preferred in opam-lib. (@avsm, #2380)
  • Fix coloring of error messages from the compiler (@diml, #2384)
  • Add warning 66 to default set of warnings starting for dune projects with language verison >= 1.11 (@rgrinberg, @diml, fixes #2299)
  • Add (dialect …) stanza (@nojb, #2404)
  • Add a --context argument to dune install/uninstall (@diml, #2412)
  • Do not warn about merlin files pre 1.9. This warning can only be disabled in 1.9 (#2421, fixes #2399, @emillon)
  • Add a new inline_tests field in the env stanza to control inline_tests framework with a variable (#2313, @mlasson, original idea by @diml, review by @rgrinberg).
  • New binary kind js for executables in order to explicitly enable Javascript targets, and a switch (explicit_js_mode) to require this mode in order to declare JS targets corresponding to executables. (#1941, @nojb)

OCaml 4.08.1+rc2

Florian Angeletti announced

The release of OCaml version 4.08.1 is almost here, we have created a second release candidate that you can test.

This new release candidate combines the rc1 fix for compilation failures in presence of "-pack" reported by Fabian @copy (breaking nocrypto), with a new fix for dynlinking failures in bytecode mode reported by Andre Maroneze (breaking Frama-C).

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.1+rc2 --repositories=default,ocaml-beta=git+https://github.com/ocaml/ocaml-beta-repository.git


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

where you replace <VARIANT> with one of these:

  • afl
  • default-unsafe-string
  • force-safe-string
  • flambda
  • fp
  • fp+flambda

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

Happy hacking, Florian Angeletti, for the OCaml team.

OCaml 4.08.1 rc2:

  • Bug fixes:
    • #7887: ensure frame table is 8-aligned on ARM64 and PPC64   (Xavier Leroy, report by Mark Hayden, review by Mark Shinwell    and Gabriel Scherer)
    • #8751: fix bug that could result in misaligned data section when compiling to   native-code on amd64.  (observed with the mingw64 compiler)   (Nicolás Ojeda Bär, review by David Allsopp)
    • #8769, #8770: Fix assertion failure with -pack   (Leo White, review by Gabriel Scherer, report by Fabian @copy)
    • #8816, #8818: fix loading of packed modules with Dynlink (regression in #2176).   (Leo White, report by Andre Maroneze, review by Gabriel Scherer)

Down 0.0.1

Daniel Bünzli announced

It's my pleasure to announce the first release of Down:

Down is an unintrusive user experience upgrade for the ocaml toplevel (REPL).

Simply load the zero dependency Down library in the ocaml toplevel and you get line edition, history, session support and identifier completion and documentation (courtesy of ocp-index).

Add this to your ~/.ocamlinit:

#use "down.top"

Down is distributed under the ISC license.

Down has no library dependency hence it should be easy to get installed and working in more constrained environments. In particular it works with ocamlnat.

Down is also toplevel environmentally friendly: it just adds the Down module to your scope and installs a SIGWINCH signal handler.

The Down manual can be consulted here and is available to you locally via odig doc down.

Homepage: https://erratique.ch/software/down
Installation: opam install down

OpenAPI Generator now supports OCaml client generator

William Cheng announced

We've added the OCaml client generator to the OpenAPI Generator project. To generate an OCaml client given an OpenAPI/Swagger specification file, please follow 3 simple steps below:

  1. Download the Java JAR https://oss.sonatype.org/content/repositories/snapshots/org/openapitools/openapi-generator-cli/4.1.0-SNAPSHOT/openapi-generator-cli-4.1.0-20190729.024538-72.jar
  2. Rename the JAR as "openapi-generator-cli.jar"
  3. Run the following command to generate an OCaml API client for the Petstore API:


java -jar openapi-generator-cli.jar generate -g ocaml -i https://raw.githubusercontent.com/OpenAPITools/openapi-generator/master/modules/openapi-generator/src/test/resources/2_0/petstore.yaml -o /var/tmp/ocaml


java -jar openapi-generator-cli.jar generate -g ocaml -i https://raw.githubusercontent.com/OpenAPITools/openapi-generator/master/modules/openapi-generator/src/test/resources/2_0/petstore.yaml -o C:\tmp\ocaml

If you've any feedback or question, please let us know by opening an issue in the Github repo.

Thanks Christophe Gensoul for contributing the new generator (https://github.com/OpenAPITools/openapi-generator/pull/3446).


Gerd Stolpmann announced

findlib-1.8.1 is out:

  • fixes an issue with upcoming ocaml-4.09 (-vmthreads gone)
  • support for loading packages by prefix

For manual download, manuals, etc. see here:


An updated OPAM package will follow soon.

Sorry for the delay.

first release of nice_parser

Steffen Smolka announced

I’m pleased to announce the first release of nice_parser, a single functor library that wraps your {menhir, ocamlyacc}-generated parser with a nice, high-level interface with beautiful loaction-aware error messages:

opam install nice_parser
#use "topfind";;
#require “nice_parser”;;
#show_module Nice_parser.Make;;
module Make :
  functor (P : Nice_parser.RAW_PARSER) ->
      type token = P.token
      type result = P.result
      exception LexError of { msg : string; loc : Location.t; }
      exception ParseError of { token : token; loc : Location.t; }
      val pp_exceptions : unit -> unit
      val parse_string : ?pos:Lexing.position -> string -> result
      val parse_chan : ?pos:Lexing.position -> in_channel -> result
      val parse_file : string -> result

The library relies on OCaml 4.08's new source highlighting mechanism for pretty lexing and parsing errors,

File "examples/illegal.katbb", line 1, characters 10-17:
1 | this!; is illegal!; isntit?
Error: [parser] unexpected token

but can also be used with earlier versions of OCaml.

The nice_parser repository includes an example that helps you get started with your own parser in seconds. The API is documented here.

Happy parsing!

Other OCaml News

From the ocamlcore planet blog

Here are links from many OCaml blogs aggregated at OCaml Planet.


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.