OCaml Weekly News

Previous Week Up Next Week


Here is the latest OCaml Weekly News, for the week of March 21 to 28, 2023.

Table of Contents

VOCaml: add and remove type annotations in VS Code

Lukasz Stafiniak announced

A new version of VOCaml – 1.1.1 is out (Marketplace). Multiline types work now, also labeled arguments (and optional without defaults), unit value pattern.

new versions of VS Code extensions Alcotest and Expect and Inline tests, now on Open VSX too

Roland Csaszar announced

New versions for both extensions that fix a critical bug: until now if there had been more than one test runner the tests from all other runners had been deleted during test discovery.

Important feature added to the Expect and Inline extension: on startup and Refresh Tests now the tests are not run, but only a list of tests is generated. This speeds up test discovery significantly (and now both extensions work the same).

Alcotest Test Explorer Version 0.6.0

  • Changelog
    • Make the path to the Dune executable configurable. Can now be either an absolute path, a path relative to the project root or just dune, which is looked up in the local Opam environment or the PATH.
    • Add a message window to ask for a reload if a configuration value has changed.
    • Update documentation
  • Bugfixes
    • Do not delete the test groups of all other test runners if there exists more than one test runner.

Expect and Inline Tests Version 0.5.0

  • Changelog
    • No need to run all tests at startup or refresh. Use the -list-test-names argument of the inline test runners.
    • New configuration values:
      • expectppx.discoverInSources - Whether to parse source files on open and save for tests and update the Test Explorer tree. Should be set to true if expectppx.discoverOnStartup is false.
      • expectppx.dunePath - Set an absolute path or a path relative to the project root of the Dune executable. Default: dune - use the one in the local Opam environment or in PATH. See Issue #3.
      • expectppx.excludeRunners - A list of inline test runner names to be excluded from test discovery an startup or refresh, e.g. because they take too long to finish.
    • Add a message window to ask for a reload if a configuration value has changed.
    • Disable ANSI color escape sequences in output of test failures.
    • Update the documentation.
  • Bugfixes
    • Fix bug when tests from other test runners are deleted on startup or refresh having more than one inline test runner. See Issue #3.
  • Internal Changes
    • Remove ANSI escape sequences from test fixtures.
    • Add yarn target for the Open VSX Registry.

Roland Csaszar later announced

I’ve just released a new version of the Expect testing extension. The Expect test result of a failed test now uses VS Code’s diff view. The actual result output of the test can be displayed by hovering the stanza let%expect_test.

Expect and Inline Tests Version 0.6.0

  • Changelog
    • Show the expected and actual values of Expect tests in VS Codes’ diff view. See Issue #6.

Roland Csaszar finally announced

These releases of both extensions provide better handling of Dune locks.

The new versions fix a bug where a dune process waiting to acquire the lock couldn’t be cancelled. And after 30s of not acquiring the Dune lock an error message is displayed.

Alcotest Test Explorer Version 0.7.0

  • Changelog
    • If the dune lock can’t be acquired for 30s, raise an error window and ask the user what to do.
    • Update the documentation.
  • Bugfixes
    • Make Cancel Test Run stop Dune processes waiting for the lock too. See Issue #9.
  • Internal Changes
    • Add yarn target for the Open VSX Registry.

Expect and Inline Tests Version 0.7.0

  • Changelog
    • If the dune lock can’t be acquired for 30s, raise an error window and ask the user what to do.
    • Update the documentation.
  • Bugfixes
    • Make Cancel Test Run stop Dune processes waiting for the lock too. See Issue #9.

Docfd: TUI fuzzy document finder 0.2.3

Darren announced

Docfd 0.2.6 has just been released.

  • Some limits were put in places to speed up content search and avoid it becoming very slow in large documents
  • Adjusted the command line to accept multiple paths, each path can be file or directory
  • Single file mode is added (see screenshots below)

Searching is left after docfd README.md


Searching [github] after docfd README.md


Feel free to leave feedback!

Camomile 2.0.0 is out!

Romain Beauxis announced

Camomile 2.0.0 is out and should be available in the opam repository. 🎉

This releases brings compatibility with OCaml 5 to camomile and all projects using it as well as a cleanup of the API and build system.

We have used camomile for years with liquidsoap and, after OCaml 5 came out, the library was not building with it and appeared unmaintained. However, after looking for alternatives, it appeared that there were ⚠️ no alternatives to convert from UTF-8 to outdated string encodings such as ISO-8859-1 ⚠️

While there are modules that allow to do the opposite, we believe that, in order to be successful and widespread, the OCaml ecosystem needs to be able to accommodate to legacy computer systems and protocols and, in particular, be able to output strings to legacy string encodings so we decided to see about bringing camomile up-to speed with the latest OCaml compiler and tooling.

The fork is currently located at https://github.com/savonet/Camomile and was approved by the original author yoriyuki. We are immensely grateful for his work up-to this point.

Make no mistake, though: the module is still in dire need of maintainers. Ideally, we would like to move the module to ocaml-community and bring more people onboard to help with it.

To reflect back to the last actual release, things that should be worked on next are are least:

  • split the module into several libraries, so that a user do not need to install the entire (several megabytes) libraries
  • support latest Unicode standard (it is very outdated)

If you are interested in helping with it, please feel free to contact us or send some PRs our way!

cid 0.1.0 - Content Identifiers in OCaml

Patrick Ferris announced

I’m happy to announce the initial release of cid, an OCaml library for working with Content Identifiers. These are like your usual hash-based identifiers used in content-addressable stores, but are built on multiformat libraries. See https://discuss.ocaml.org/t/ann-multicodec-multibase-multihash-and-multihash-digestif/10686 for the initial release of the OCaml versions of these libraries.

The main takeaway is that the identifiers are self-describing helping build more permanent and interoperable content-addressed systems (e.g. they are used in the IPFS protocol).

let () =
  let s = "foo" in
  let hash =
    Multihash_digestif.of_cstruct `Sha3_256 (Cstruct.of_string s)
    |> Result.get_ok
  let cid = Cid.v ~version:`Cidv1 ~codec:`Raw ~base:`Base32 ~hash in
  Format.printf "Base encoded: %s\nHuman: %a"
    (Cid.to_string cid) Cid.pp_human cid

Base encoded: bafkrmidw2o6edspvrd37zugvx5drr6hyjmoedmqiqjydcafz5okbhad4ae
Human: cidv1 - base32 - raw - ident(sha3-256) length(32) digest(
76 d3 bc 41 c9 f5 88 f7  fc d0 d5 bf 47 18 f8 f8
4b 1c 41 b2 08 82 70 31  00 b9 eb 94 13 80 7c 01

There’s also a small example the repository of replacing Irmin’s default hash implementation to use cid.

Happy Hacking :camel:

Stk 0.1.0 (SDL-based GUI toolkit) and Chamo 4.0

Zoggy announced

I am pleased to announce the first release of Stk, a SDL-based graphical user interface toolkit. Its interface is inspired by Gtk and should look familiar to developers using Lablgtk. The project page: https://zoggy.frama.io/ocaml-stk/

Chamo, a development-oriented text editor, is now based on Stk rather than Lablgtk since release 4.0. Chamo homepage: https://zoggy.frama.io/chamo/ .

Cyber-hackathon Frama-C + Binsec near Paris

amaro announced

(* This is an event related to tools developed in OCaml, although the tools themselves are applied to C and assembly. *)

If you are near Paris, come to the Cyber-hackathon Frama-C + Binsec, on 28/04 from 9h to 17h, at CEA List, in the Paris-Saclay campus (Nano-Innov, 2 bd Thomas Gobert, 91120 Palaiseau)!

This is an event dedicated to formal methods, code analysis, cybersecurity and reverse engineering, with the help of the Frama-C and Binsec frameworks.

During this day, you will be able to:

  • Bring your own C code to have it analyzed by the Frama-C team;
  • Participate in the tutorials and code analysis challenges with Frama-C;
  • Participate in the crackme and reverse challenges with the Binsec tool;
  • Learn how to use Frama-C/Binsec, or become proficient with them;
  • Participate in the development of these open-source platforms, developed mainly in OCaml.

Please register here: https://framaforms.org/inscription-cyber-hackathon-frama-c-binsec-1678815370 (the form is in French, but feel free to contact us directly in English if you prefer).

By the way, the Frama-C and Binsec teams are hiring! Interns, PhDs, postdocs, temporary- and fixed-term researchers… drop by if you are interested!

Zanuda – OCaml linter experiment

Kakadu announced

I developed a linter for my FP course in my local university. It analyzed (mostly) typed tree and performs various checks (a.k.a. lints). The list of available lints could be found here.

The discussion about a absence of litner arise from time to time How possible is a clippy-like linter for OCaml? and somewhere in What are the biggest reasons newcomers give up on OCaml? I’m not sure that usage of OCaml linter for non-teaching purposes is wise, but if my work will gain some traction, nobody will be able to accuse OCaml that it doesn’t have a linter.

Questions, user reports and PRs will be appreciated.


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.