OCaml Weekly News

Previous Week Up Next Week


Here is the latest OCaml Weekly News, for the week of January 14 to 21, 2020.

Table of Contents

How does the compiler check for exhaustive pattern matching?

Dylan Irlbeck asked

Hi all. I'm relatively new to OCaml, and I was curious on how the compiler is able to give a warning when a case list is non-exhaustive - both from a high-level and, if possible, the implementation of this check. I have some ideas about how one could do this, but none of my ideas seem like they'd be nearly as efficient as the OCaml compiler is.

gasche replied

The canonical reference for exhaustivity-checking in OCaml is the scientific publication

Warnings for pattern matching Luc Maranget 2007

The general idea is to consider all the patterns of a given pattern-matching at once, generalize this structure to a "matrix" of patterns (matching on several values in parallel), and devise an algorithm to "explore" these pattern matrices in such a way that you eventually tell if a given pattern-matrix is exhaustive, or can propose a counter-example.

(I guess we should write a high-level/accessible blog post about this.)

resto 0.2 released

Raphaƫl Proust announced

On behalf on Nomadic Labs, I'm happy to announce the release of version 0.2 of resto, a library to create type-safe HTTP/JSON services.

The library is available through opam (opam install resto), distributed under LGPL, and hosted on https://gitlab.com/nomadic-labs/resto.

resto was previously released as ocplib-resto maintained by OCamlPro. The project is now maintained by Nomadic Labs.

Along with many bugfixes and a few added features, the main change of this release is that the library is split into multiple packages with fine-grained dependencies.

opam 2.0.6 release

R. Boujbel announced

We are pleased to announce the minor release of opam 2.0.6.

This new version contains mainly build update & 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.

soupault: a static website generator based on HTML rewriting

Daniil Baturin announced

soupault 1.8.0 is released along with Lua-ML 0.9.1.

Lua-ML now raises Failure when Lua code execution fails. There's much room for improvement in that area, for now I've just done something that is better than just displaying errors on stderr but otherwise allowing syntax and runtime errors pass silently.

If you have any ideas how perfect interpreter error reporting should work, please share!

As of improvements in soupault itself, there's now:

  • A way for plugins to specify their minimum supported soupault version like Plugin.require_version("1.8.0")
  • TARGET_DIR environment variable and target_dir Lua global that contains the directory where the rendered page will be written, to make it easier for plugins/scripts to place processed assets together with pages.
  • "Build profiles": if you add profile = "production" or similar to widget config, that widget will be ignored unless you run soupault --profile production.
  • A bunch of new utility functions for plugins.

Spin: Project scaffolding tool and set of templates for Reason and OCaml

Mohamed Elsharnouby announced


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.