OCaml Weekly News

Previous Week Up Next Week


Here is the latest OCaml Weekly News, for the week of April 26 to May 03, 2022.

Table of Contents

ATD now supports TypeScript

Martin Jambon announced

ATD is a language for specifying typed interfaces for communicating across programming languages. It turns concrete type definitions ("schema") into code for each language. This code can read and write JSON safely, relieving the user of worrying about the structure of the JSON data.

Starting from version 2.5.0, ATD provides atdts, a single executable that turns a file foo.atd into foo.ts. See the tutorial for an introduction. The programming languages targeted by ATD are now:

  • Java
  • OCaml
  • Python + mypy
  • ReScript (BuckleScript)
  • Scala
  • TypeScript

For an expert overview of the features that are currently supported, check out the test data:

See also the announcement for atdpy that we made a month ago.

pp_loc 2.0

Armael announced

Do you know how OCaml now displays errors by quoting back part of the source, highlighting the faulty part? For instance, with a single-line error location:

File "foo.ml", line 1, characters 12-14:
1 | let foo x = yy + 1;;

or a multi-line location:

File "bar.ml", lines 3-5, characters 10-10:
3 | ..........function
4 |   | A -> 0
5 |   | B -> 1

Do you have your own language/configuration file/… parser or typechecker, that could benefit from nice, user-friendly error messages?

The pp_loc library provides an easy-to-use implementation of the same source-quoting mechanism that is used in the OCaml compiler. It provides a single function pp which will display the relevant part of the input given the location(s) of the error.

val pp :
  ?max_lines:int ->
  input:Input.t ->
  Format.formatter ->
  loc list ->

(As one can see from the signature, pp also supports displaying several locations at once on the same source snippet, for multi-location errors.)

The full documentation is available online, and the library is available on opam (opam install pp_loc).

This new version, thanks to the contribution of @c-cube, makes the loc type more flexible. It should now be easy to create source locations that can be passed to pp, however you represent them in your parser (be it as (line,column) pairs, offsets, or any combination of those…). For more details, see the Pp_loc.Position module.

I am completely open to more PRs or ideas for improving the library further, and displaying source locations in even nicer ways!

Happy error-message printing!

Windows-friendly OCaml 4.12 distribution - Diskuv OCaml 0.1.0

jbeckford announced

A single setup-*.exe executable is now all that is necessary to install the Diskuv OCaml distribution on 64-bit Windows!

Today you can use a prerelease of v0.4.0 which is available at https://github.com/diskuv/dkml-installer-ocaml/releases/download/v0.4.0-prerel11/setup-diskuv-ocaml-windows_x86_64-0.4.0.exe

The prerelease:

  • is for experienced Windows users only because the prerelease is not signed! You will have to fight with your browser, operating system and anti-virus software to run the setup executable
  • is not reproducible. Because many Diskuv packages have not yet made it into Opam, the builds need several opam pin of unstable branches.
  • has not been incorporated into the https://diskuv.gitlab.io/diskuv-ocaml documentation site. But the Beyond Basics documentation should still be accurate.

Once those items above are addressed, a real (non-prerelease) 0.4.0 will be announced.

Existing Diskuv OCaml users: Your existing Opam switches should be unaffected by the upgrade. But please make sure you can recreate your Opam switches (ie. use a .opam file) if something goes wrong.

Release notes, including details of the migration to the Apache 2.0 license, are at available at https://github.com/diskuv/dkml-installer-ocaml/releases/tag/v0.4.0-prerel11

V3.ocaml.org: we are live!

Thibaut Mattio announced

I am thrilled to announce that https://ocaml.org/ now serves version 3 of the site! Here's an overview of the major features in this new version:

Version 2 remains accessible at https://v2.ocaml.org/, and older URLs to ocaml.org will be redirected to the v2 URL from now on. Similarly, v3.ocaml.org URLs will continue to work.

Community feedback was instrumental and has been driving the direction of the project since day one. For instance, having a centralized package documentation site; or facilitating the hiring of OCaml developers and finding OCaml jobs were major concerns that were highlighted in the last OCaml Survey. They were what prompted us to work on the documentation site and the job board respectively.

We've also listened to the community feedback we received along the way, and in particular, here's an overview of everything we've been doing to address the feedback we received after our last Discuss post: https://hackmd.io/IniIM_p3Qs2UB74cuKK7UQ.

Given how critical your input is to drive the project, I am deeply grateful to every one who took the time to share insights, suggestions and bug reports. Some of the suggestions will need more work and couldn't happen before launch, but we've listened to every one and will keep working on improving OCaml.org to address pain points of the community. Thank you, and keep the feedback coming!

We're also starting to see a lot of contributions from external contributors. OCaml.org is open source, and contributions from anyone are extremely welcome! Never hesitate to open a PR if you see something you'd like to improve! You can read our Contributing Guide to learn how to contribute.

Ecosystem Contributions

As the storefront of the OCaml ecosystem, we couldn't develop the next version of OCaml.org without contributing back! As a result, we've published several packages on opam that we're using for OCaml.org:

  • dream-accept: Accept headers parsing for Dream
  • dream-encoding: Encoding primitives for Dream.
  • hilite: Generate HTML ready for syntax-highlighting with CSS by parsing markdown documents.

Other packages that are yet to be released are:

We've also made contributions downstream:

A huge thank you to the community for your constant effort in making OCaml such a great language to work with! In particular, here are some amazing community projects we are building upon: Dream, Brr and Omd and many more

What's next?

Launching the website is the first step on our roadmap to improve OCaml’s online presence.

As mentioned above, the immediate goal is to be ready for this OCaml 5.00.0 release. With this in mind, we want to focus on improving the documentation and ensuring it includes good user pathways to learn about Domains, Effects, and generally how to write concurrent programs in OCaml.

In addition to the documentation, some of the other projects on our roadmap are:

  • Toplevels for all the packages that compile to JavaScript.
  • Including OCaml Weekly News in the OCaml blog.
  • A better search through packages, documentation, and packages' documentation.

This is an exciting time! Stay tuned!

Call for maintainers

There's a lot of ways to contribute if you'd like to help. Our contributing guide should be a good entry point to learn what you can do as a community contributor.

We're also looking for maintainers. As we're completing the first milestone with the launch and will start working on new projects, now is a great time to get involved!

If you'd like to help on the initiatives on our roadmap above (or others!), feel free to reach out to me by email at thibaut@tarides.com, or by replying to this post.


This project was a huge effort that started over a year ago, and the result of dozens of contributors. We want to thank every one who contributed to the site.

In particular, for the groundwork on rethinking the sitemap, user flows, new content, design, and frontend and package docs, we thank Ashish Agarwal, Kanishka Azimi, Richard Davison, Patrick Ferris, Gemma Gordon, Isabella Leandersson, Thibaut Mattio and Anil Madhavapeddy.

For the work on the package site infrastructure and UI, we thank Jon Ludlam, Jules Aguillon and Lucas Pluvinage. And for the work on the designs and bringing them to life on the frontend, we thank Isabella Leandersson and Asaad Mahmood.

For the work on the new content and reviewing the existing one, we thank Christine Rose and Isabella Leandersson.

For the contributions on the content for Ahrefs, Jane Street and LexiFi respectively, we thank Louis Roché, James Somers, Nicolás Ojeda Bär.

We’d also like to thank the major funders who supported the work on revamping the website: grants from the Tezos Foundation, Jane Street and Tarides facilitated the bulk of the work. Thank you, and if anyone else wishes to help support it on an ongoing basis then donations to the OCaml Software Foundation and grants to the maintenance teams mentioned above are always welcomed.

Remaking an Old Game in OCaml

Yotam Barnoy announced

I've starting blogging about a side-project of mine. Hopefully I'll find the time to write some further entries in the series, including about reverse engineering a binary with IDA.


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.