OCaml Weekly News

Previous Week Up Next Week


Here is the latest OCaml Weekly News, for the week of February 13 to 20, 2024.

Table of Contents

List of protected keyword in OCaml

Muzimuzhi announced

Here's the latest link, with working anchor: https://v2.ocaml.org/manual/lex.html#sss:keywords

The OCaml manual also provides an Index of keywords which is helpful in reading syntaxes and mentions of keywords in detail. https://v2.ocaml.org/manual/manual074.html

ocaml.codes, code search for OPAM packages

prgbln announced

I recently started using a local instance of livegrep to easily search through a bunch of OCaml repositories. It's been helpful for looking at examples of how others use certain functions or libraries where documentation is scarce.

I thought I'd set up a public instance in case others would find this handy too. You can now search through the code of most OPAM packages on https://ocaml.codes/.

Here are some things to keep in mind:

  • I'm currently only indexing GitHub repositories from the dev-repo field of OPAM packages, as most are hosted there (2375 repositories). I plan on indexing the remaining repositories if there's interest (e.g., stuff on GitLab, Bitbucket, personal domains).
  • There's no automated re-indexing to keep up with the addition of new packages yet, but this could be implemented fairly easily.
  • The livegrep instance is running on a low-end VPS, so the performance isn't optimal. However, it still feels snappy and perfectly usable to me.

I'm looking forward to any feedback.

dune 3.14

Etienne Millon announced

We're happy to announce that Dune 3.14.0 is now available. This feature has many fixes and new features that you can find in the changelog.

There are a few new features that we would like to specially highlight.

Dynamic dune files with (dynamic_include)

It is common for some parts of a build to be dynamic: for example a source file can be generated, or some parts of the configuration like C flags can be generated from a Dune rule. But until now it was not possible to generate rules dynamically.

For example, one might want to do it is to set up one rule per input file. This is a common pattern in test suites and is easy to do with Make. But Dune does not have a concept of parameterized rules, so it is necessary to set up one rule per input file.

The pattern to do this with Dune is to:

  • Write a generator that lists the input files and emits Dune stanzas (as text);
  • Add a rule that makes a dune.inc file using this generator;
  • Add (include dune.inc) in the main dune file,

However, this requires checking in the generated dune.inc file in the repository. Another drawback is that when modifying the list of input files, it is necessary to run tests twice: one to update dune.inc, one to run the new test.

This release of Dune adds a new (dynamic_include) stanza that lifts these restrictions: dune.inc does not have to be part of the source tree, it can be generated transparently. This comes with some restrictions: some stanzas can not be generated, in particular the ones that define public libraries. And due to how rule loading works, the generated stanza needs to be defined in a different directory.

Still, this should be useful for many users that rely on the generate-include-commit bpattern described above.

Sherlodoc integration

Sherlodoc is a search engine for OCaml documentation, which supports search by name, documentation and fuzzy type search (similar to Hoogle in the Haskell world). It can be obtained from opam using opam install sherlodoc.

When it is available, Dune commands that produce HTML documentation, such as dune build @doc and dune build @doc-new, will include a search bar in the generated output.


  • Added
    • Introduce a (dynamic_include ..) stanza. This is like (include foo) but allows foo to be the target of a rule. Currently, there are some limitations on the stanzas that can be generated. For example, public executables, libraries are currently forbidden. (#9913, @rgrinberg)
    • Introduce $ dune promotion list to print the list of available promotions. (#9705, @moyodiallo)
    • If Sherlodoc is installed, add a search bar in generated HTML docs (#9772, @EmileTrotignon)
    • Add only_sources field to copy_files stanza (#9827, fixes #9709, @jchavarri)
    • The (foreign_library) stanza now supports the (enabled_if) field. (#9914, @nojb)
  • Fixed
    • Fix $ dune install -p incorrectly recognizing packages that are supposed to be filtered (#9879, fixes #4814, @rgrinberg)
    • subst: correctly handle opam files in opam/ subdirectory (#9895, fixes #9862, @emillon)
    • Odoc private rules are not set up if a library is not available due to enabled_if (#9897, @rgrinberg and @jchavarri)
  • Changed
    • When dune language 3.14 is enabled, resolve the binary in (run %{bin:..} ..) from where the binary is built. (#9708, @rgrinberg)
    • boot: remove single-command bootstrap. This was an alternative bootstrap strategy that was used in certain conditions. Removal makes the bootstrap a bit slower on Linux when only a single core is available, but bootstrap is now reproducible in all cases. (#9735, fixes #9507, @emillon)

Learn-OCaml 1.0 is out!

Louis Gesbert announced

Hello all,

Learn-OCaml 1.0 is finally out :tada:

Learn-OCaml is a web platform for exercises in OCaml programming, with automated grading that was originally developped for the OCaml MOOC. The interface features a code editor and client-side evaluation and grading ; it can be served statically, but if running the bundled server there are also server-side saves, facilities for teachers to follow the progress of students, give assignments, get grades, etc.

Get me there!

There is a live demo at ocaml-sf.org.

Although most changes will be mostly meaningful for teachers running their instances, this already shows the growing corpus of exercises.

To run your own instance, see the guide.

What's new

This first major release, along with a lot of quality-of-life improvements, features a significant rewrite of the evaluation engine. The main visible consequences are:

  • a nice speedup to the grading of exercises in the browser
  • a huge (x100) speedup to the pre-processing of the exercises (when running learn-ocaml build)
  • exercise solutions can no longer leak (the server only provides the already compiled jsoo version to the client), making the platform more suitable for evaluations
  • error messages when compiling exercises are much, much better

A few other most-wanted features have also been added, like a reworked exercise choice page, and the ability to update a running instance with minimal downtime (learn-ocaml build serve --replace) ; as well as lots of QoL improvements, like bugfixes and integrated documentation in the teacher interface.

What's coming

A proper login system with choice between email/password or a Moodle server is in the works ; we expect it to land shortly in 1.1, once we work on the remaining rough edges.

Porting to more recent versions of OCaml is also planned.


Feedback is very welcome here or on Github.

— Louis Gesbert (OCamlPro), on behalf of the Learn-OCaml team

With thanks to the OCaml Foundation for funding the major part of this work.

Melange 3.0

Antonio Nuno Monteiro announced

Dear OCaml users,

the Melange team is proud to announce the release of Melange 3.0.

Melange is a backend for the OCaml compiler that emits JavaScript. This release focuses on:

  • Improved OCaml version support: we're releasing Melange v3 with full support for OCaml 4.14 and OCaml 5.1, similar to Merlin's recent versioning scheme (3.0.0-414 and 3.0.0-51).
  • Better JavaScript interop: we support more combinations in our Foreign Function Interface layer, allowing to output more JavaScript constructs without resorting to %mel.raw
  • Made Melange leaner and more robust:
    • in the compiler core, we fixed a few crashes, removed unused code and made other code faster;
    • in the Melange runtime libraries, we unified APIs that were duplicated or inconsistent
  • Implemented more runtime primitives and enabled additional Stdlib functions

With the release of Melange 3, we're also introducing a redesign of our documentation website. We added an overall new design, snappier navigation and real-time search.

I wrote a more comprehensive release announcement in the following post:


As always, feedback is very much appreciated.

This release of Melange is sponsored by Ahrefs and the OCaml Software Foundation .

Docfd: TUI multiline fuzzy document finder 2.2.0

Darren announced

I am happy to share a new release of Docfd, 2.2.0.

Repo. Also packaged on opam, AUR, and Nix (as docfd),

Think interactive grep for both text files and PDFs, but word/token based instead of regex and line based, so you can search across lines easily.

Docfd aims to provide good UX via integration with common text editors and PDF viewers, so you can jump directly to a search result with a single key press.


Navigating repo:


Navigating "OCaml Programming: Correct + Efficient + Beautiful" book PDF and opening it to the closest location to the selected search result via PDF viewer integration:


Major changes since last announcement

  • Search expression is added (and properly documented more recently). A search expression is one of:
    • Search phrase, e.g. fuzzy search
    • ?expression (optional)
    • (expression)
    • expression | expression (or), e.g. go ( left | right )
  • Search results with balanced opening and closing symbols ((), [], {}) are ranked higher to reduce visual noise when searching
  • Added file selection support via fzf
  • Added support for jed~/~xjed
  • Restored behaviour of skipping file extension checks for top-level user specified files. This behaviour was likely removed during some previous overhaul.

Re: Ppxlib dev meetings

Sonja Heinze announced

Thanks everyone who has participated in the poll! :heart: It seems like a few people do appreciate the monthly posts, so I/we'll keep on doing them. If anyone has any comment, just let us know. However, according to the current state of the poll, there's also one person who finds this thread a bit spammy - and there might be more. I'll leave the poll open for as long as discuss allows me, so that I can see if that number increases in the future. In the meantime: I'm sorry for the inconvenience for the very few who find the posts spammy!

This month, we're having the meeting on Monday instead of Tuesday, same time as always: [date=2024-02-19 time=18:00:00 timezone="Europe/Madrid"] . That's also reflected in the public calendar event. Here's our agenda. Remember that everyone is welcome to add things:

  • 5.2 support
    • Let's discuss the complicated compiler AST changes for 5.2, among others, if we're testing their support enough.
      • Syntactic support for functions with arity > 1
      • Have there been more complicated AST changes this time?
    • The compiler ocaml.ppx.context change
      • This affects the PPX world iff people want to build their project with a different OCaml version than their PPX is built with. Do we want to keep on supporting that workflow?
      • Why was the change of ocaml.ppx.context in the compiler done in a breaking way? Is it worth for us to discuss that with them?
    • The ppxlib ~preview release with 5.2 support
  • Upcoming things to do on ppxlib
    • When to start with the work to bump ppxlib's AST to 5.2?
    • When to start with the upstream Astlib efforts?
  • In case we have time, let's also discuss how to improve the repo for people to get involved easier (issue labels, contribution guidelines etc)

Owl project concluding

solitary_crow announced

more at owl project github repo

Owl project is concluding after 8 years of development.

Other OCaml News


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 to the caml-list.