OCaml Weekly News

Previous Week Up Next Week


Here is the latest OCaml Weekly News, for the week of January 23 to 30, 2024.

Table of Contents

Prefaculty/postdoc research position at Jane Street (New York or London)

Richard Eisenberg announced

I’m excited to share that Jane Street has opened up a visiting position to work with our type systems team to improve and formalize various aspects of our extensions to OCaml. This position is envisioned to sit between graduation from a PhD program and the start of a tenure-track professorship at a research institution. Candidates might already have a faculty offer in hand and be taking a gap year, or they might be seeking a more traditional postdoc. The visit can last one or two years. It will be research-focused, with a goal of publishing several papers in top venues. The visitor will be able to see firsthand how language improvements affect the users all around us in our office. This will be a great opportunity at combining the theoretical and practical aspects of research in our field.

Full details and next steps are at https://www.janestreet.com/join-jane-street/programs-and-events/visiting-researcher-prefaculty/

I’ll be supervising this position. Happy to answer any questions over email at reisenberg@janestreet.com.

Vg 9.5.0 – Declarative 2D vector graphics

Daniel Bünzli announced


It’s my pleasure to announce the release 0.9.5 of Vg:

Vg is a declarative 2D vector graphics library. Images are values that denote functions mapping points of the cartesian plane to colors and combinators are provided to define and compose them.

Renderers for PDF, SVG, Cairo and the HTML canvas are distributed with the library. An API allows to implement new renderers.

Vg is distributed under the ISC license.

Except for the addition of combinators to smoothly stitch Bézier paths by François Thiré, this is mostly a bureaucratic and maintenance release.

At the library level, the Vgr_svg module is now part of the vg library and the vg.svg library is deprecated. The Vgr_htmlc canvas renderer has been rewritten with brr which becomes an optional dependency of the package while the dependencies on js_of_ocaml and js_of_ocaml-ppx are dropped for good.

Ten years ago neither dark themes nor .mld files did exist so the tutorial, the semantics and the image howto have been slightly reworked and moved out of the Vg module documentation to their own pages and the doc images have been fixed to work in dark themes.

Read the release notes for all the other changes.



A big thanks to my donators.

OCaml Platform Newsletter: November and December 2023

Thibaut Mattio announced

Welcome to the eighth edition of the OCaml Platform newsletter!

In this November and December edition, we are excited to bring you the latest on the OCaml Platform, continuing our tradition of highlighting recent developments as seen in previous editions. To understand the direction we’re headed, especially regarding development workflows and user experience improvements, check out our roadmap.


  • The odoc team is starting work on improving odoc performances. After shipping important features, including a link to source code, syntax for tables, and recent support for search, they are turning their focus on consolidating the full documentation generation stack (including Dune rules and integration with OCaml.org package docs) and improving performances.
  • opam 2.2~alpha3 is out! It is the last alpha release, and the opam team plans to start the beta release next cycle.
  • Anticipating on the January update, the compiler PR necessary for Merlin project-wide references has been merged! This will be part of OCaml 5.2, meaning that starting with the next compiler version, OCaml developers will be able to query for project-wide references (and limited support for project-wide rename!) in their projects. Read more here to know how you can test the feature.


[Dune] Exploring Package Management in Dune (W4)

Contributed by: @rgrinberg (Tarides), @Leonidas-from-XIV (Tarides), @gridbugs (Tarides), @kit-ty-kate (Tarides), @Alizter

Why: Unify OCaml tooling under a single command line for all development workflows. This addresses one of the most important pain points reported by the community.

What: Prototyping the integration of package management into Dune using opam as a library. We’re introducing a dune pkg lock command to generate a lock file and enhancing dune build to handle dependencies in the lock file. More details in the Dune RFC.


  • Introduced a locking mechanism to prevent conflicts in multiple repositories and fixed a bug in Dune’s locking code. – ocaml/dune#9140
  • Enabled project locking without a network connection using locally cached opam-repository. – ocaml/dune#9202
  • Enhanced handling of opam-repositories with non-standard contents (non-file objects). – ocaml/dune#9352
  • Added a feature where users can set arbitrary variables which can be referred to by opam packages while solving a project’s dependencies. This gives users more control over decisions made by the solver and which dependencies their project ends up having in its lockdir. – ocaml/dune#9325
  • Ensured lockdir contains all dependencies of local packages for consistency. This prevents Dune from presenting inconsistent information to users who have changed their project’s dependencies after creating a lockdir. Instead, they’ll be prompted to recompute their lockdir. – ocaml/dune#9156
  • Ability to detect which dependencies in the lockdir are only needed when building tests. This will be necessary to allow users to skip downloading and building packages that are only needed for testing unless they are running tests. – ocaml/dune#9095
  • Improved support for Windows, focusing on better Curl integration and opam library adjustments for Windows architectures. – ocaml/dune#9252, ocaml/dune#9048
  • Refined context/lock file handling in Dune package management. – ocaml/dune#9343
  • Refined context/lock file handling. Before each context had an associated lock file so lock files were selected via context arguments. Now the context middlemen have been removed and the users selects lock files by specifying the lockfile itself. This applies to most pkg related commands. – ocaml/dune#9343
  • Added support for the conflicts field in opam files – ocaml/dune#9340
  • Looked into solutions to add support for deptops – ocaml/dune#9430
  • Writing the PID of process that created the lock file ocaml/dune#9295 to be able to easily determine which process is holding the revision store lock
  • Avoid Git translating its CLI ocaml/dune#9390. Since we use the Git binary under the hood, users with different locales might get translated Git output. Since our Git output is not shown to the user, we disable translation.
  • Remove opam-repository-url option ocaml/dune#9373 Removes all CLI options that deal with repositories. All opam-repositories are now controlled in the dune-workspace file.
  • Support for specifying particular branches/commits for repos ocaml/dune#9241 adds support for specifying branches and commits as opam-repository sources, so the user can fix one particular state of opam-repository
  • Enable checking out tags ocaml/dune#9471 adds the same support as above but for tags. It does so by saving the tags in per-remote namespaces, thus it works very much like branches.
  • Implement downloading sources via Git ocaml/dune#9506 enables cloning source directories via the rev store, thus caching most commits when working with multiple projects from the same repo, etc.
  • Read the main branch correctly even if tags exist ocaml/dune#9549 fixes an issue where the code that determines the tracking branch got confused in the presence of namespaced tags.
  • Dune will compute checksums for lock files of packages which don’t already have checksums in their opam metadata. – ocaml/dune#9384
  • Package metadata for a Dune project can be read from .opam files rather than dune-projectocaml/dune#9418
  • Support for conflict classes in opam files for the solver – ocaml/dune#9442
  • The ability to add additional constraints to feed the solver – ocaml/dune#9337

[opam] Native Support for Windows in opam 2.2 (W5)

Contributed by: @rjbou (OCamlPro), @kit-ty-kate (Tarides), @dra27 (Tarides), @AltGr (OCamlPro)

Why: Enhance OCaml’s viability on Windows by integrating native opam and opam-repository support, fostering a larger community and more Windows-friendly packages.

What: Releasing opam 2.2 with native Windows support, making the official opam-repository usable on Windows platforms.

Activities: FROM KATE

  • We’ve released opam 2.2.0~alpha3, a culmination of the last 4 months of work. This release, amongst other fixes and improvements, adds a new x-env-path-rewrite field necessary for Windows support. - #5636
  • We’ve also fixed a number of issues on Windows:
    • Fix issues in the C stubs for Windows - #5714
    • Fix incorrect error message in configure on Windows - #5667
    • Always resolve the fullpath to the cygpath executable - #5716

[​odoc​] Add Search Capabilities to odoc (W25)

Contributed by: @panglesd (Tarides), @EmileTrotignon (Tarides), @julow (Tarides), @jonludlam (Tarides)

Why: Improve usability and navigability in OCaml packages documentation, both locally and on OCaml.org, by offering advanced search options like type-based queries.

What: Implementing a search engine interface in odoc, complete with a UI and a search index. Additionally, we’re developing a default client-side search engine based on Sherlodoc.

Activities: FROM EMILE

  • After merging the PR that added support for search to odoc in October, we continued work on building an odoc-compatible search engine based on Sherlodoc. This will give a search engine with type-based search for every package that uses odoc. The plan is to make Sherlodoc the search engine in Dune’s documentation generation. You can try an early demo on Varray’s docart-w/sherlodoc#4
  • Buiding on odoc’s support for search, we merged a PR that adds occurrences information to the search index. This will allows odoc search engines to improve the order of search results by using the number of occurences. – ocaml/odoc#976

[​odoc​] Syntax for Images and Assets in odoc (W25)

Contributed by: @panglesd (Tarides), @jonludlam (Tarides), @dbuenzli, @gpetiot (Tarides)

Why: Empower package authors to create rich, engaging documentation by enabling the integration of multimedia elements directly into OCaml package documentation.

What: We’re introducing new syntax and support for embedding media (images, audio, videos) and handling assets within the odoc environment.


  • Added assets in the environment to treat them similarly as other resolvable elements. This addressed the remaining feedback from reviews, and if no other blocker is found, the PR should be ready to merge. – ocaml/odoc#1002

[​odoc​] Improving odoc Performance (W25)

Contributed by: @jonludlam (Tarides), @julow (Tarides), @gpetiot (Tarides)

Why: Address performance issues in odoc, particularly for large-scale documentation, to enhance efficiency and user experience, and unlock local documentation generation in large code bases.

What: Profiling odoc to identify the main performance bottlenecks, and optimising odoc with the findings.


  • Experimented with different data structures and algorithms for more efficient documentation generation on large files. --ocaml/odoc#1033, ocaml/odoc#1036, ocaml/odoc#1049
  • Implemented item lookup improvements in signatures for faster processing. – ocaml/odoc#1049
  • Developed a fix for memory issues caused by module type of expressions, with promising results from testing at Jane Street. – ocaml/odoc#1042

[Dune] Generate Dependencies Documentation with Dune (W25)

Contributed by: @jonludlam (Tarides)

Why: Enhance the usability of locally-generated documentation by providing direct access to dependencies’ documentation.

What: Implementing new Dune rules for odoc to enable efficient documentation generation and access to documentation for all opam packages in your switch.


  • The new Dune rules have been merged and are available in the newest release of Dune 3.12.1. Try running dune build @doc-new to generate your documentation and tell us what you think! – ocaml/dune#8803
  • Shortly after the release, we noticed an issues with dependency handling. We’re working on a fix that should be released – ocaml/dune#9461

[Merlin] Support for Project-Wide References in Merlin (W19)

Contributed by: @voodoos (Tarides), @trefis (Tarides), @Ekdohibs (OCamlPro), @gasche (INRIA)

Why: Enhance code navigation and refactoring for developers by providing project-wide reference editor features, aligning OCaml with the editor experience found in other languages.

What: Introducing merlin single occurrences and LSP textDocument/references support, extending compiler’s Shapes for global occurrences, and integrating these features in Dune, Merlin, and OCaml LSP.


  • The first iteration on project-wide occurrences is closing-in, and we made a custom opam-repository to test the feature while the changes make their way into the upstream compiler. This gave us the opportunity to test the feature on more real projects, and after another round of bug-fixing and UI improvement we opened it to the community for wider testing.
  • Anticipating the January update, the compiler PR has been merged! :tada: The next steps are to revisit the patches on the other projects and to open PRs upstream. Dune is the next in line. – ocaml/ocaml#12508

[Merlin] Improving Merlin’s Performance (W19)

Contributed by: @pitag (Tarides), @Engil (Tarides), @3Rafal (Tarides)

Why: Some Merlin queries have been shown to scale poorly in large codebases, making the editor experience subpar, and users report that they sometimes must wait a few seconds to get the answer. This is obviously a major issue that hurts developer experience, so we’re working on improving Merlin performance when it falls short.

What: Developing benchmarking tools and optimising Merlin’s performance through targeted improvements based on profiling and analysis of benchmark results.


  • We’ve made the file cache lifetime configurable. Varying the lifetime will allow experimenting with Merlin’s time/space trade-off. Before, it was constantly set to 5 min. -#1698
    • Introduced a config that lets users set a file cache lifespan. When modified to a larger value it should improve performance for large repositories – ocaml/merlin#1698
    • Introduced the file cache lifespan flag to ocaml-lsp, so it can be used for all LSP clients – ocaml/ocaml-lsp#1210
  • We’ve enriched the telemetry that comes embedded in the ocamlmerlin responses:
    • We’ve added information about cache hits and misses of the various Merlin caches: cmi-files cache, cmt-files cache, typer phase cache, PPX phase cache, and reader phase cache. - #1711
    • We’ve added information about the size of the major heap at the end of an ocamlmerlin query - #1717 - We’ve finished up Merlin’s new Fuzzy CI, a by-product of the performance work.
      • We’ve opened the PRs - #1716 (and #1719)
      • We’ve written a GitHub wiki entry with a high-level description about it. - Merlin Fuzzy CI

Upcoming Caqti Release - TLS, Packaging, and minor breakage

Petter A. Urkedal announced

The next Caqti release is almost ready if I proceed as planned, though I would like to lift plans in advance in case anyone has feedback.

While Caqti 2 brought support for MirageOS (using PGX), it is missing TLS, which limits its usability in practise. Patching that hole will be the main delivery for the upcoming release. This involved a revision of the network abstraction and better performance under EIO.

Some more minor changes can be seen in the preliminary change log.

Minor Breaking Changes

My plan is the make the upcoming one a minor release, but there will be two breaking changes, so we could discuss whether a minor release is reasonable:

  • There will be a new optional ?config parameter for all functions which connect to a database or create a connection pool, which can break code which makes higher-order calls or aliases those parts of the signatures.
  • The Caqti_query.t type will have one additional constructor (V), which breaks any code which alias the type along with its constructors.

Packaging and TLS

TL;DR: This is mostly a request for comments about packaging.

The Caqti project currently has 11 packages in the official OPAM repository. With the current plan, there will be an additional 4 TLS packages:

packages description assessment
caqti core functionality required
caqti-dynload dynamic linking could be merged into caqti
caqti-driver-mariadb, caqti-driver-pgx, caqti-driver-postgresql, caqti-driver-sqlite required
caqti-async, caqti-eio, caqti-lwt, caqti-mirage required
caqti-type-calendar convenience could be retired
caqti-tls core TLS package see below
caqti-tls-async, caqti-tls-eio, caqti-tls-lwt specialized TLS engines see below

(For caqti-mirage, TLS is included, since the tls library is the only option to encrypt PostgreSQL communication for unikernels, if not implemented at the network level, AFAIK.)

As indicated above there could be options to eliminate two existing packages, but I’ll leave that for later. The alternatives I’ve considered for the TLS implementation and packaging is:

  1. The implemented choice is to use the tls-async, tls-eio, tls-lwt, and tls-mirage instantiations of the TLS engine, thus adding one package per flavour.
  2. TLS support for Async, EIO, and LWT could instead be merged as sublibraries of caqti-async, caqti-eio, and caqti-lwt, and caqti-tls could be merged into caqti. The main reason for not doing this, is the C bindings for MariaDB and PostgreSQL already have TLS built-in, so in most cases the tls dependency would be redundant. The dependencies could be made optional, though I have the impression many consider optional dependencies harmful.
  3. The Caqti network abstractions could use the pure TLS engine directly, thus requiring only one extra package, caqti-tls. This would be a elegant solution, except that it will not work with the ssl library should we want to support it, since it is tied to the network stack.

While switching to the second option is simple, switching to the third option would require more work on my part, delaying the release, but I could be convinced if we feel strongly for the end result.

The caqti-tls package is (currently) only needed to define a shared configuration key which depends on the tls library.

Developing Web and mobile applications in OCaml

Vincent Balat announced

Here is a (re-)recording of a talk I gave a few weeks ago at Tarides, about Ocsigen and Be Sport.


This presentation gives an overview of the Ocsigen framework, which is used in particular to develop the Be Sport social network. Ocsigen is a set a tools to develop Web sites and applications. Amongst other things, it contains js_of_ocaml, a compiler to Javascript, and Eliom, a powerful Web framework that can be used for traditional server-side Web programming, but also to develop client-server Web and mobile distributed applications, entirely in OCaml, using multi-tier programming. We will try to show how this programming style can save a huge amount of time.



dream-html 2.0.0

Yawar Amin announced

[ANN] dream-html 2.1.0

  • Deprecate Hx.on and introduce new Hx.on_ event handler attribute style used by htmx
  • Add form [method_ `dialog] new attribute value for pure HTML modals

Discussions on the future of the opam repository

Continuing this thread, Raphaël Proust announced

Along with other volunteers, we have taken notes during the meeting. They are available on the github issue.


  • There was a general consensus to create an “archive” repository where we can move broken, unmaintained, obsolete packages (specific characterisation still to be defined)
  • There is another meeting planned on 2024-02-07 to discuss the specifics further

If this topic is important to you: Please leave comments on the github thread. Please attend the meeting.

Request for Feedback: Take the OCaml.org Learn Area User Satisfaction Survey

Sabine Schmaltz announced

Give us Feedback on the Improved OCaml Learning Experience!

Over the past six months, our team has been hard at work refining the OCaml learning area. Through an UX process, including surveys, user interview calls, video sessions, and in-depth analysis to identify pain points and user needs, we have created a brand-new user experience and interface.

Now, we are looking for your feedback on our work. Your perspective is invaluable as we strive to improve OCaml.org.

What we have done:

  • Enhanced UX: Updated navigation based on user surveys with interviews and analysis.
  • Revamped UI: A fresh interface designed with your needs in mind.
  • Better Landing Page on the Learn Area: We provide a window into the documentation, from beginner to expert. This should make the content more discoverable.

Why Your Feedback Matters: Your insights are critical in shaping the future of OCaml’s learning area. We use your feedback to prioritize and implement improvements.

How to Share Your Thoughts: Explore the new design at https://ocaml.org/docs and share your feedback with us here


Thank you for being a part of the OCaml community.

Middleware 1.0.0 – Composable functions which respond to inner calls

Trent Small announced

Hey folks!

I’m happy to announce the first release of middleware, a utility for composing functions which need to respond to inner calls.

See our GitHub for examples and more details: https://github.com/skolemlabs/middleware

This package was developed internally at Skolem Technologies, and we’ve decided to open-source it. More such packages are coming soon!

Announcing validate 1.0.0 - Enhanced Data Validation in OCaml!

Mateusz Ledwoń announced

Hello OCaml Community!

I’m excited to share the release of validate version 1.0.0 with you all! This version is a significant milestone in my journey to provide a robust data validation library for OCaml.

In this release, I’ve introduced some exciting features. Variant support is now available, enabling more complex data types to be handled with ease. I’ve also implemented support for recursive and circular recursive types, allowing validation of nested and interconnected data structures. Here’s a quick peek at how it works:

type tree =
  | Leaf of (int[@greater_than 0])
  | Node of {
    (*Annotation can be on type or label declaration, both works*)
    left : tree; [@dive]
    right : (tree[@dive])
  } [@@deriving validate, show, eq]

let my_tree = Node { left = Leaf 1; right = Leaf 2 }
let validation_result = validate_tree my_tree

I’m also excited to announce that the validate API is now stable. While I plan to keep enhancing the library by adding new annotations for different validators over time, I assure you of consistent and reliable functionality in future updates.

If you have suggestions for new validators or features, we’d love to hear them. Your feedback is crucial in shaping the future of validate .

To dive deeper into validate 1.0.0, check out our GitHub page: https://github.com/Axot017/validate

Happy Coding!

Congratulation to the OCaml team for the 2023 SIGPLAN programming languages software award! 🏆

Xavier Leroy announced

To follow up on @spdegabrielle’s nice message: the SIGPLAN PL Software Award 2023 was formally given to the OCaml development team last week at POPL 2024 in London, and I was very pleased and honored to give the reception speech on behalf of the team. For the record, I’ll post the speech next.

Xavier Leroy then said

It’s an honor for the whole OCaml development team to receive such a prestigious award. Some of us are here tonight: Gabriel Scherer, Damien Doligez, Florian Angeletti, Luc Maranget, David Allsopp, Stephen Dolan, Nicolas Ojeda Bär, and I’m Xavier Leroy. It’s two, almost three generations of computer scientists and developers that are being honored…

There is no denying that OCaml has been a long-term project. I released the first version of OCaml, then called Objective Caml, in 1996, almost 28 years ago. But it was already the consolidation of much earlier work, going back more than 50 years from now:

  • Robin Milner’s work on “ML”, the Meta Language (scripting language) of his LCF proof assistant, which introduced the lovely type system and type inference algorithm we all know.
  • Then Gérard Huet brought LCF ML back home to Rocquencourt on a magnetic tape, and liked it so much that with Guy Cousineau and their students, they developed CAML, an implementation of Milner’s ML using the CAM (the Categorical Abstract Machine) as intermediate language – hence the CAML name. And they used it as the implementation language for what was to become the Coq proof assistant.
  • Then, two students of Cousineau at ENS, Damien Doligez and I, fell in love with the CAML language and developed Caml Light, a lightweight, open-source implementation of CAML suitable for teaching and popularizing the language.

So, the 1996 1.0 release of OCaml was already a consolidation of the CAML language, the memory management and virtual machine from Caml Light, my early 1990’s work on native compilation and Standard ML-style module systems, and Jérôme Vouillon’s PhD work on type systems and type inference for objects.

Since then, OCaml has continued to pick up new features arising from PL research, such as Generalized Algebraic Data Types in the late 2000’s, or very recently user-defined effects and effect handlers, making OCaml one of the first non-experimental languages to support effects. This arose from the Multicore OCaml project, along with support for shared-memory parallelism, at long last!, and a new relaxed memory model.

But that’s not the only way in which OCaml has served and continues to serve research in programming languages. If you look at previous recipients for this SIGPLAN software system award, you’ll find the Coq proof assistant, which is implemented in OCaml; the CompCert C compiler, which also uses OCaml for its non-verified parts; as well as WebAssembly, whose reference interpreter is written in OCaml. And looking at possible future recipients, you’ll find Rust, whose first compiler was written in OCaml; STAN, the probabilistic programming language whose compiler was recently rewritten in OCaml; and JSCert, the Javascript formalization that also uses OCaml for its reference interpreter.

Of course, these are not the only uses of OCaml! For something completely different: how many of you took the Eurostar train to come here? or flew an Airbus plane? Chances are that a good chunk of the software embedded in your plane or in your train was generated from SCADE block diagrams by an OCaml program, the SCADE KCG 6 compiler.

So, we’re very proud of our greater user community and all they do with OCaml, both in classic application areas for ML languages such as theorem provers, proof assistants, static analyzers, verification tools, compilers, code generators, etc.; and in more unusual areas such as systems programming.

When Damien and I were hacking Caml Light in 1990, we had no idea that 10 years later the Ensemble people at Cornell and IBM would reimplement a whole network and protocol stack for distributed applications in OCaml and get better latency than their previous C++ implementation. Then came real-time trading, web radios and audio streaming, the Irmin distributed database, Mirage unikernels that boot on a bare hypervisor, and more.

What made that possible? Not just fancy types and nice modules – even though systems programmers value type safety and modularity highly – but also basic properties of OCaml:

  • a language with a simple cost model, where it’s easy to track how much time and how much space is used;
  • a compiler that produces efficient code that looks like the source code, with only predictable optimizations;
  • a low-latency garbage collector, usable for soft real-time applications. To us PL folks, this doesn’t sound like much. Good luck getting a paper accepted at POPL or PLDI based on these ideas! Yet, that’s crucial to open the way to many exciting applications.

Will there be other chance encounters with new application areas like this for OCaml in the future? I have no idea – and that’s what makes PL research exciting, even after all these years!

At any rate, we, the recipients of this award, are proud of the achievements of the OCaml user community, and deeply honored to see our efforts recognized by this award. Thank you!

Participate in OCaml.org Learn Area User Testing

Sabine Schmaltz announced

We need some help with usability testing on the OCaml.org Learn area!

What’s it all about?

We’re conducting user testing sessions to enhance the UX/UI and content of the OCaml.org learning area. This is an opportunity for individuals with no prior knowledge of OCaml.

We will do a 1:1 video call with you where we present you with a GitHub codespace that gives you a set of programming tasks to solve. We want to learn from you solving (or trying to solve) the tasks in order to improve the documentation.

We will share relevant documents or materials before the session.

Key Criteria for Participants:

  • No previous experience with OCaml
  • Interested in learning OCaml
  • Be available for a 1 hour video call

How to Participate: Simply express your interest through this Google Form. Spots are limited!

Obviously, most people here reading this will not meet the criteria (because of previous OCaml knowledge), however, in this case, we ask you to reach out and share this invitation with friends or acquaintances who might be willing and qualified to participate.

Other OCaml News

From the ocaml.org blog


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.