OCaml Weekly News

Previous Week Up Next Week


Here is the latest OCaml Weekly News, for the week of January 25 to February 01, 2022.

Table of Contents

ppx_seq v0.1.1

hyphenrf announced

Hello everyone, my first contribution to opam-repository has just been merged and is waiting to hit the caches of opam.ocaml.org.

ppx_seq is a cute un-intrusive literal syntax for Seq. The rewriter is simple and has very small surface area: just [%seq x; y; z; ...] and [%seq.empty]. It tries to be maximally compatible with all OCaml releases from 4.07 (when Seq was introduced) to 4.14 and beyond

The reason I created this rewriter is to make it an easier choice to reach first for Seq as a general data structure (instead of e.g. list). That wasn't quite attractive before because of how minimal the Seq module was, it was mostly used as an intermediate step between two types of collections, but now with 4.14 about to be released, Seq is becoming a first-class data structure with a very versatile API.

I hope my little rewriter helps make it even more attractive to use. Check it out and maybe leave me some feedback. Thanks <3

OCaml Labs Joins Tarides

Thomas Gazagnaire announced

Gemma Gordon (@gemmag) and I are delighted to announce that OCaml Labs, a spinout from the University of Cambridge, is joining Tarides. After successfully collaborating on many OCaml projects over the last four years, this alliance will formally combine the expertise of both groups. Joining forces will accelerate OCaml development and its broader adoption, and enable us to continue with our shared goal of bringing OCaml into mainstream use. Furthermore, it will bring the security, portability and performance of OCaml to a large spectrum of use-cases: from academic endeavours such as formal methods and existing threats within cyber security, to real-world applications for climate change, sustainable agriculture, and even space exploration!

All of OCaml Labs’ existing responsibilities and open source commitments will migrate over to Tarides, and thanks to how closely the teams already work, business will continue without interruption to continuity or delivery. Gemma Gordon will step up as CEO of Tarides, and I will lead the technological vision and strategy as CTO.

The OCaml 5.0 release will support multicore and effects handlers, influencing every aspect of the language and its ecosystem. The update will significantly improve both performance and user experience, whilst maintaining existing features that the community loves. Using the teams’ combined experience and zest for innovation, Tarides is looking to the future of the OCaml language and community with excitement. Since Tarides’ inception we have envisioned a future where all OCaml applications are easily deployable as specialised, secure and energy-efficient MirageOS unikernels. We believe that this alliance is a step further in that direction.

_This alliance will complement the commercial offerings of Tarides and contribute to Tarides' mission: empowering developers, communities and organisations to adopt OCaml as their primary programming experience by providing training, expertise and development services around the OCaml language._

Read the full announcement here, including details of our goals and the focus for 2022. This alliance brings the headcount of Tarides up to 60+ people, all working towards making OCaml the best language for any, and every project. Join our team and reach out for commercial services at: https://tarides.com/

For Diversity and the OCaml Community: Get Involved in Outreachy Summer 2022

Sonja Heinze announced

As @patricoferris has mentioned previously, the Outreachy call for open-source communities and project submissions has started. As a reminder, Outreachy is an initiative that provides a framework through which open-source communities can offer three month internships directed at people from any kind of under-represented background in open source. With that, Outreachy helps open-source communities grow on several levels: diversity, experience, size, and popularity.

The OCaml community participated in Outreachy in summer 2019, summer 2020, summer 2021, and currently in winter 2021/22. All our interns have done and are doing really amazing jobs, and summer 2022 is just around the corner! The following timeline illustrates the process:


So let's start getting involved!

Ways to Get Involved

Community members can take on different roles in the Outreachy effort, and all of them are very important! Maybe the most important (and most involved) role is being a mentor.


Mentors have two responsibilities: leading the project and guiding the interns/applicants.

Leading the Project

One responsability is leading the project. Concretely, that means outlining an internship project, submitting a project description to Outreachy, making sure that the context repo for that project gets ready for the application/"contribution" phase, and guiding the project throughout the internship, including reacting to changes. All of that must match the Outreachy framework, which we explained in detail last round, based on the timeline structure shown above.

Guiding the Intern and the Applicants

Their other responsibility is personal guidance. During the application/"contribution" period, mentors answer questions and review code for multiple applicants. During the internship, they also offer pair-programming sessions and facilitate more specific guidance, and general support for their interns.

All of that is usually quite time-intensive, so it's important to have some support from other community members and strong support from a concrete co-mentor.


A co-mentor does the same job as described in the "Guiding the Intern and the Applicants" tasks above, so having a co-mentor is very important! Of course, if a co-mentor also wants to take part in the project's direction, that's great as well! This means that the line between co-mentoring and mentoring isn't always clear.

Volunteering (aka "Acting as a Joker :bat:")

Mentors and co-mentors receive a lot of general questions related to OCaml and programming in addition to specific questions about the project. That's where Outreachy volunteers can be very helpful! They help all applicants and interns across projects with (usually) project-unspecific questions and give a very important technical base support.

Point Out Potential Project Ideas

Apart from not having enough time, the main reason that stops folks from becoming a mentor is the lack of project ideas. So if you have potential project ideas, please point them out, even if you don't have time to mentor! Generally, a self-contained, uncontroversial, and incremental project makes the most suitable project for Outreachy. It's also important for a project to be associated with a repo that can serve as a basis for easy contributions during the application phase. When in doubt, don't keep your ideas to yourself. Any idea can be helpful!

Prepare Your Repos

In general, if you maintain a repo, it's really nice to be welcoming to new contributors. Concretely, that means having clear contributing guidelines, good newcomer issues, and well-labeled issues. As a nice side-effect, this also makes your project a better target for future Outreachy projects.

Ready to Get Involved?

If you've gotten interested in any of those roles or have any other comments, please just answer here in the thread. It would be super nice to get a discussion going and start our Outreachy efforts early!

Sudha Parimala then said

I along with @shakthimaan @gs0510 are submitting a project:

  • Extend OCaml 5's parallel benchmark suite.

The idea is to gather parallel benchmarks available elsewhere and make them available in our benchmark suite, to aid the development of the OCaml compiler and parallel programming libraries. Relevant repos: sandmark and current-bench.

Set up OCaml 2.0.0-beta13

Sora Morimoto announced


  • Do not install opam-depext if it's not enabled.


  • Print a proper error if the version not found in the .ocamlformat file.


First release of scfg

zapashcanon announced

I'm pleased to announce the first release of scfg on opam.

It provides a library and an executable to work with the scfg configuration file format. (disclaimer: scfg has been created by my good friend @emersion)

Here's an example of an scfg file taken from the specification:

train "Shinkansen" {
	model "E5" {
		max-speed 320km/h
		weight 453.5t

		lines-served "Tōhoku" "Hokkaido"

	model "E7" {
		max-speed 275km/h
		weight 540t

		lines-served "Hokuriku" "Jōetsu"

Scfg is a file format designed to be simple and indeed the implementation was really straightforward. I'm planning to use it in small tools I wrote (mostly sway tools written in OCaml) but never released because I couldn't stand having to use TOML, YAML or JSON for them…

The library provides an executable to validate and pretty-print an scfg file. It'll indent it properly, remove useless quoting and whitespaces:

$ scfg spec.scfg
train Shinkansen {
  model E5 {
    max-speed 320km/h
    weight 453.5t
    lines-served Tōhoku Hokkaido
  model E7 {
    max-speed 275km/h
    weight 540t
    lines-served Hokuriku Jōetsu

The library is made of four modules : Types, Parse, Pp and Query.

The Types module simply defines the following types, which are all you need to deal with scfg:

(** A directive has a name, a list of parameters and children (a list of directive). *)
type directive =
  { name : string
  ; params : string list
  ; children : directive list

(** A config is a list of directives. *)
type config = directive list

The others modules can be used as follow:

let file = {|
  train A-Train {
    bla bla bla
  train "John Col Train" {
    tut tut tut

(* parsing the file *)
let config =
  (* there's also a `Parse.from_file` function that should be more useful *)
  match Scfg.Parse.from_string file with
  | Error e ->
    Format.eprintf "error: %s@." e;
    exit 1
  | Ok config -> config

(* printing the file *)
let () =
  Format.printf "```scfg@.%a@.```@." Scfg.Pp.config config

(* querying the file *)
let () =
  (* gets the first directive with the name `train` *)
  match Scfg.Query.get_dir "train" config with
  | None -> Format.printf "No train found.@."
  | Some train -> (
    (* get the parameter at index 0 in the `train` directive *)
    match Scfg.Query.get_param 0 train with
    | Error _e -> Format.printf "Train has no name.@."
    | Ok name -> Format.printf "The first train is `%s`.@." name )

For more have a look at the project's README, the documentation or feel free to ask here ! :partying_face:

Brr 0.0.3, a toolkit for programming browsers

Daniel Bünzli announced

It's my pleasure to announce the release 0.0.3 of Brr, a toolkit for programming browsers in OCaml with the js_of_ocaml compiler.

Once it has made it to the repo, install with opam install brr and consult the API docs and manuals (or via odig doc brr).

Among small additions and fixes, this release brings support for js_of_ocaml 4.0.0. Thanks to Hugo Heuzard (@hhugo) who has made the ground work in js_of_ocaml this means that:

  1. Brr, js_of_ocaml and (soon) gen_js_api JavaScript bindings can now all be used in the same program without problems (issue #2).
  2. You no longer need to specify the -no-check-prim flag at bytecode link time. Linking against the brr library is sufficient, see the build instructions.

The release notes have all the details.

(anonymous?) polymorphic records

nrolland asked

Is there a way to avoid to create records only to preserve polymorphism ?

Say, for this, in haskell style

h :: (forall r. (r -> a) -> (f r -> f b)) -> f a -> f b
h malg = malg id

octachron replied

You can use objects, they can have polymorphic methods:

let f (id:<f:'a. 'a -> 'a>) = id#f 0, id#f "zero"

Maëlan also replied

The following doesn’t help reducing the syntactic noise, but note that when using a record for non-prenex polymorphism like this, your record has only one field and is immutable, so (with a recent enough OCaml) you can unbox it and get rid of the runtime overhead:

type ('a, 'b) fwrap = { f : 'r. ('r -> 'a) -> 'r list -> 'b list } [@@unboxed]

let apply_id : type a b. (a, b) fwrap -> a list -> b list =
  fun w xs -> w.f Fun.id xs
(* is compiled the same as just: *)
let apply_id_magic : type a b. (a, b) fwrap -> a list -> b list =
  fun w xs -> (Obj.magic w) Fun.id xs

let mwrap : type a. (a, a) fwrap = { f = List.map }
(* is compiled to nothing at all (alias of List.map). *)

2 postdoc positions on Runtime Verification at CEA LIST, Université Paris-Saclay, France

Julien Signoles announced

The Software Safety and Security Lab at CEA LIST, Université Paris-Saclay, France has 2 open postdoc positions in the area of runtime verification for code safety and security:

The candidates will:

  • solve challenging research problems;
  • implement their results in Frama-C, an industrial-strength open-source framework for analyses of C code;
  • evaluate their solutions on concrete benchmarks or/and use cases;
  • publish their results in international conferences and journals.

Strong knowledge in at least one of the following areas is welcome:

  • programming
    • OCaml and C
    • formal semantics
  • formal verification
    • runtime verification, static analysis, formal specification languages, …
  • compilation
    • code generation, program transformation, type system, …

Interested applicants should send a CV and a motivation letter to Julien Signoles (julien dot signoles at cea dot fr).


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.