OCaml Weekly News

Previous Week Up Next Week

Hello

Here is the latest OCaml Weekly News, for the week of April 09 to 16, 2019.

Table of Contents

Dune 1.9.0

Rudi Grinberg announced

On behalf of the dune team, I'm pleased to announce the release of Dune 1.9.0. This release introduces a few exciting new features:

  • A tagging mechanism for implementations called variants
  • The ability to build libraries in the Coq proof assistant.
  • A new dune init command to help users quickly generate boilerplate and get start with dune projects (contributed by @shonfeder)

I would like to thank Lucas Pluvinage and @ejgallego for contributing the first two features respectively. They've also collaborated on a blog post to describe these features in detail.

As usual, the change log is replicated here for your convenience:

1.9.0 (09/04/2019)

  • Warn when generated .merlin does not reflect the preprocessing specification. This occurs when multiple stanzas in the same directory use different preprocessing specifications. This warning can now be disabled with allow_approx_merlin (#1947, fix #1946, @rgrinberg)
  • Watch mode: display "Success" in green and "Had errors" in red (#1956, @emillon)
  • Fix glob dependencies on installed directories (#1965, @rgrinberg)
  • Add support for library variants and default implementations. (#1900, @TheLortex)
  • Add experimental $ dune init command. This command is used to create or update project boilerplate. (#1448, fixes #159, @shonfeder)
  • Experimental Coq support (fix #1466, @ejgallego)
  • Install .cmi files of private modules in a .private directory (#1983, fix #1973 @rgrinberg)
  • Fix dune subst attempting to substitute on directories. (#2000, fix #1997, @rgrinberg)
  • Do not list private modules in the generated index. (#2009, fix #2008, @rgrinberg)
  • Warn instead of failing if an opam file fails to parse. This opam file can still be used to define scope. (#2023, @rgrinberg)
  • Do not crash if unable to read a directory when traversing to find root (#2024, @rgrinberg)
  • Do not exit dune if some source directories are unreadable. Instead, warn the user that such directories need to be ignored (#2004, fix #310, @rgrinberg)
  • Fix nested (binaries ..) fields in the env stanza. Previously, parent binaries fields would be ignored, but instead they should be combined. (#2029, @rgrinberg)
  • Allow "." in c_names and cxx_names (#2036, fix #2033, @rgrinberg)
  • Format rules: if a dune file uses OCaml syntax, do not format it. (#2014, fix #2012, @emillon)

Minisat-ml: a reimplementation of minisat in OCaml

Simon Cruanes announced

We at Imandra just open sourced minisat-ml , a reimplementation of Minisat 2.2 in OCaml. The goal is to experiment with the performance difference between C++ and (low level) OCaml that stays as close as possible to the original.

The report provides more detailed explanations on the porting process, as well as some experimental results. Personally I think it'd also be an interesting sample point for flambda and other performance tools of the ecosystem, since minisat 2.2 is a fixed target in a field known to require very high performance.

Opam packages and CI

Helmut Brandl asked

I would like to run some continuous integration like travis ci on my opam package. Unfortunately ocaml is not supported directly by travis. But I have found the GitHub repository ocaml/ocaml-ci-scripts and some instructions on how to use it.

My questions:

  • Is this a stable form on how to use travis with ocaml?
  • Are there experiences and are they good?
  • Why has this solution been chosen instead of integrating ocaml support directly into travis?
  • Isn’t the solution an overkill, because it requires a complete opam and ocaml installation on the travis machines in order to test an opam package? Isn’t there the risk that travis might block this form of usage in the future?
  • Is there a better method to use CI with ocaml?

Simon Cruanes replied

I've had good experiences with travis recently, using the docker script (an example here: https://github.com/c-cube/iter/blob/master/.travis.yml).

if your package is opam 2-friendly it's just a matter of a local pin and a few switches. there are other options (variables, really) to install extra deps or deal with optional deps.

It's not particularly overkill since it just starts with a docker image with pre-installed opam switches.

Louis Roché also replied

> - Is this a stable form on how to use travis with ocaml?

There is auto-ci that can be used to generate travis configuration relying on ocaml-ci-scripts.

https://github.com/yomimono/autoci

Anil Madhavapeddy also replied

> - Is this a stable form on how to use travis with ocaml?
>
> - Are there experiences and are they good?

Last I checked, there were over 400 repositories on GitHub using ocaml-ci-scripts. It's pretty stable.

> - Why has this solution been chosen instead of integrating ocaml support
> directly into travis?

Why do you need direct integration with Travis? The use of the Docker support has made the necessity for that essentially obsolete.

See, for example: https://github.com/mirage/ocaml-cohttp/blob/master/.travis.yml

in cohttp, which uses Travis and Docker to test the libraries on a variety of Linux distributions.

> - Isn’t the solution an overkill, because it requires a complete opam and
> ocaml installation on the travis machines in order to test an opam package?
> Isn’t there the risk that travis might block this form of usage in the future?
>
> - Is there a better method to use CI with ocaml?

This solution is pretty good for most people. I'd encourage you to give it a try, and to contribute back any improvements or feature requests you might have after trying it out for a while.

Helmut Brandl then said

Thanks for all the hints. Some experiences:

I have used the .travis.yaml file from the repo ocaml/ocaml-ci-scripts, reduced the build matrix to a minimum (only 4.07) and it worked out of the box. However to took approx 8 min for linux and 12 min for osx.

Therefore I have changed in the travis file ‘.travis-opam.sh’ to ‘.travis-docker.sh’ and added ’services: -docker’, because docker has been recommended by many.

Now the build failed after some seconds. Maybe there is more to do than this trivial change to switch to docker.

Is there some documentation on how to use docker? Is it worth the effort i.e. will it run faster or has it more features?

opam 2.0.4 release

R. Boujbel announced

We are pleased to announce the release of opam 2.0.4.

This new version contains mainly backported fixes, you can find more information in this blog post.

opam is a source-based package manager for OCaml. It supports multiple simultaneous compiler installations, flexible package constraints, and a Git-friendly development workflow.

Anil Madhavapeddy said

And for those of you using the Ubuntu PPA, it has been updated to the 2.0.4 release: https://launchpad.net/~avsm/+archive/ubuntu/ppa

Marek Kubica also said

Similarly the macOS brew package.

Perry E. Metzger also said

MacPorts has been updated as well, though it might take an hour or two for all the mirrors to adjust.

Other OCaml News

From the ocamlcore planet blog

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.