OCaml Weekly News

Previous Week Up Next Week

Hello

Here is the latest OCaml Weekly News, for the week of October 03 to 10, 2023.

Table of Contents

Interesting OCaml Articles

Dmitrii Kovanikov said

Today I’ve read a nice beginner-friendly blog post about pattern matching in OCaml with lots of examples:

bindings to the PARI algebra library

Julien announced

I wrote ocaml-pari, an OCaml library providing bindings to the PARI algebra library. The bindings are automatically generated from the library’s header files. In addition, a light wrapper offers a thin layer of static typing to not only encode part of the written documentation into types by means of phantom types, but to encode actual invariants to prevent mismatches between functions and arguments. E.g., to prevent from multiplying a group element by a polynomial. One can find code samples in the examples directory, notably cryptographic polynomial commitments (kzg.ml) and an attack on a knapsack cryptosystem (knapsack_lll.ml).

The underlying library, PARI, is written in C and relies on a single recursive type to represent all objects. With the wrapper, this type is (‘kind, ‘structure) t so as to annotate it with its kind and the operations it supports. It is thus possible to write a generic algorithm that works with group elements (‘a, group) t for instance. The library will be available on OPAM once its cache is synchronized (so tomorrow): opam install ocaml-pari.

OCaml compiler project/contribution ideas

gasche announced

We compiler maintainers were recently approached by students looking for a contribution to the OCaml compiler that would be appropriate for their final year project. We thought of a couple contribution topics, but in the end the students decided to work on something else. I turned our project ideas into github/ocaml issues; if you were looking for a medium-size project to contribute to the OCaml compiler codebase, you may be interested in some of them.

Let me use this occasion to remind people that we have tagged some issues as “newcomer jobs”, which may be good entry point to contribute to the compiler.

  • newcomer jobs for relatively easy tasks
  • advanced newcomer jobs for harder tasks (more work, or requires good expertise in the language or learning technical aspects of how the compiler works)

Please feel free of course to ask any question, make suggestions etc.

Ppxlib 0.31.0

Sonja Heinze announced

We’re happy to announce the release of Ppxlib 0.31.0.

This Ppxlib release fixes a bug in the support of OCaml 5.1.0. Before that bug fix, the warnings about a generative/applicative mismatch between a functor creation and its application introduced by OCaml 5.1.0 were also triggered when that mismatch didn’t exist.

Furthermore, the release contains a couple of bug fixes in the context of attributes.

We’re also excited about two main enhancements. One allows authors of extension node rewriters to add a path argument to the extension node. That’s excellent for hygiene since it allows the PPX to be explicit about modules rather than depending on its scope.

The other main enhancement allows an opt-in for compiler warnings about unused code generated by derivers (warnings w32 and w60). That opting in needs to happen on both sides of the deriver, the writer side and the user side. Opting in to those code warnings will help to clean up unused code, leading to performance improvements in compilation and editor support.

  • Fix support for OCaml 5.1: migrated code preserves generative functor warnings, without creating more. Locations are better preserved. (#432, @pitag-ha, @panglesd)
  • Driver: Add -unused-code-warnings command-line flag. (#444, @ceastlund)
  • Add ?warning flag to Deriving.Generator.make. (#440, @jacksonzou123 via @ceastlund)
  • Restore the “path_arg” functionality in the V3 API (#431, @ELLIOTTCABLE)
  • Expose migration/copying/etc. functions for all AST types needed by Pprintast (#454, @antalsz)
  • Preserve quoted attributes on antiquotes in metaquot (#441, @ncik-roberts)
  • Attribute namespaces: Fix semantics of reserving multi-component namespaces (#443, @ncik-roberts)

PD: You can also find these release notes on the ocaml.org changelog.

dune 3.11.0

Etienne Millon announced

The Dune team is pleased to announce the release of Dune 3.11 “for workgroups”.

Here is the changelog:

Added

  • enabled_if now supports arch_sixtyfour variable (#8023, fixes #7997, @Alizter)
  • Experimental: Added a $ dune monitor command that can connect to a running dune build in watch mode and display the errors and progress. (#8152, @Alizter)
  • The progress RPC procedure now has an extra field for the In_progress constructor for the number of failed jobs. (#8212, @Alizter)
  • Add a --preview flag to dune fmt which causes it to print out the changes it would make without applying them (#8289, @gridbugs)
  • Introduce (source_trees ..) to the install stanza to allow installing entire source trees. (#8349, @rgrinberg)
  • Add --stop-on-first-error option to dune build which will terminate the build when the first error is encountered. (#8400, @pmwhite and @Alizter)
  • Dune now displays the number of errors when waiting for changes in watch mode. (#8408, fixes #6889, @Alizter)
  • Add with_prefix keyword for changing the prefix of the destination of installed files matched by globs. (#8416, @gridbugs)
  • Added experimental --display tui option for Dune that opens an interactive Terminal User Interface (TUI) when Dune is running. Press ’?’ to open up a help screen when running for more information. (#8429, @Alizter and @rgrinberg)
  • Add a warnings field to dune-project files as a unified mechanism to enable or disable dune warnings (@rgrinberg, 8448)
  • dune exec: support syntax like %{bin:program}. This can appear anywhere in the command line, so things like dune exec time %{bin:program} now work. (#6035, #8474, fixes #2691, @emillon, @Leonidas-from-XIV)
  • Add a new alias @doc-json to build odoc documentation in JSON format. This output can be consumed by external tools. (#8178, @emillon)

Changed and fixed

  • Use posix_spawn instead of fork on MacOS. This gives us a performance boost and allows us to re-enable thread. (#8090, @rgrinberg)
  • Modules that were declared in (modules_without_implementation), (private_modules) or (virtual_modules) but not declared in (modules) will raise an error. (#7674, @Alizter)
  • No longer emit linkopts(javascript) in META files (#8168, @hhugo)
  • RPC message styles are now serialised meaning that RPC diagnostics keep their Ansi styling. (#8516, fixes #6921, @Alizter)
  • Truncate output from actions that produce too much output (@tov, #8351)
  • Allow libraries to shadow OCaml builtin libraries. Previously, builtin libraries would always take precedence. (@rgrinberg, #8558)
  • dune utop no longer links utop in “custom” mode, which should make this command considerably faster. (#8631, fixes #6894, @nojb)
  • Ensure that package names in dune-project are valid opam package names. (#8331, @emillon)
  • init: check that module names are valid (#8644, fixes #8252, @emillon)
  • dune init: parse --public as a public name (#8603, fixes #7108, @emillon)
  • Stop signing source files with substitutions. Sign only binaries instead (#8361, fixes #8360, @anmonteiro)
  • Make copy sandbox support directory targets. (#8705, fixes #7724, @emillon)

Deprecated and removed

  • Deprecate install destination paths beginning with “..” to prevent packages escaping their designated installation directories. (#8350, @gridbugs)
  • Remove warning against .dune files generated by pre dune 2.0 (#8611, @rgrinberg)
  • Remove versions 0.1 and 0.2 of the experimental ctypes extension. (#8293, @emillon)

Arrakis: A new RISC-V simulator

Valoran announced

I’ve been working with a friend on a new RISC-V simulator called Arrakis, and we just did our first release!

Most of the features are listed in the README, but if you are interested, here is a quick summary:

  • Full RV32IM Instruction set
  • Different type of environmental call support (UNIX and Venus)
  • Partial GNU as assembler directive
  • A debugging system using breakpoint

There is currently only a terminal interface, but we have already implemented a UNIX socket to make it easy to develop plugin to integrate it to other development environment (We are currently working on a Vim plugin)

As it is our first release, they may still be some issue, but the simulator is already quite usable.

The complete documentation for the project is available here

We would be more than happy to receive any feedback, so please feel free to test it and open an issue if you find something!

Web Analytics on OCaml.org

Thibaut Mattio said, starting a discussion

As you’ve witnessed, the OCaml.org team has been hard at work to make the site the best resource to learn OCaml and discover the ecosystem.

Since the launch of V3 in April last year, we’ve revamped the centralised documentation site based on community feedback, and we’re currently doing the same for the Learn area and the documentation. We’re planning to revisit the Blog and Community sections next.

While we’re receiving tons of qualitative feedback that indicates that we’re moving in the right direction, it’s been a challenge to measure the impact of the decisions we take. Are users of the site able to find the Standard Library documentation more easily? How many users who install OCaml end up reading the documentation? Are people using the new OCaml Changelog and the Job board? A lot of questions are currently difficult to answer and would allow us to make better decisions to improve the experience on the site.

When we launched the site, we made a strong commitment to protect users’ privacy. We refuse to use cookies, we are not using any external service that might collect your data, we’re vendoring every JavaScript and asset so as to not use external CDN, and we’re not running any web analytics.

We’re still unwaveringly committed to protecting OCaml.org’s visitors’ privacy. To address our lack of data on the site’s usage while respecting the principles we’ve adopted, we’ve selected Plausible as a possible way to get usage statistics.

Plausible is a privacy-focused web analytics service. It doesn’t use cookies, doesn’t collect any personal data, and is fully compliant with GDPR, CCPA and PECR.

We plan on rolling out Plausible for OCaml.org in the coming weeks.

Do you have any questions or concerns with using Plausible on OCaml.org?

A Roadmap for the OCaml Platform - Seeking Your Feedback

Deep in this thread, Xavier Leroy said and Anil Madhavapeddy replied

I agree that an integrated tool can have better performance than a collection of standalone tools used via their CLIs. But this is not a valid reason to kill the standalone tools and their CLIs! It’s for end-users to choose between the fast integrated tool with its fixed workflow and the perhaps slower but more flexible standalone tools that support the users’ preferred workflow.

I fear I may be partly responsible for the ’killing the CLI’ part of this, as I first demonstrated a really early integrated prototype back in a Oxford OCaml Workshop presentation. Allow me to be really clear on my position here today: any CLI that is released as part of OCaml Platform tooling and has users is one we try really hard to maintain, as that CLI is very often already integrated into build scripts (and will thus break some opam packages that are already released, and we do try so hard to keep those building over time without upper bounds).

Back when I started prototyping the integrated CLI in 2017, OCaml was possibly at its lowest point in terms of the Platform tooling, since almost no industrial users actually used the publicly released tools! Jane Street had Jenga, Coq had Makefiles, Xen still used omake, the OCaml compiler itself had backed away from using ocamlbuild, and every project I talked to didn’t because they cited slow performance and difficult debuggability to the then-recommended stack of Oasis/ocamlbuild/ocamlfind. How did this happen? A fateful decision back in 2012 resulted in Oasis wrapping the ocamlbuild CLI, which in turn had a special mode that wrapped ocamlfind, and every single compiler invocation went through 5 forks before it ever got to ocamlopt.opt. If instead Oasis had instead linked to ocamlbuild as a library, we may have avoided this, but we’ll never find out. And I’m not criticising the authors of Oasis for their decision either – it was a very pragmatic one to get us past having to write direct ocamlbuild _tags files.

What I underestimated with the integrated CLI is the sheer amount of time any migrations take for downstream projects, and also what Xavier points out above about multi-language builds and the flexibility of Makefiles. So my own thinking has evolved on it too: what we need from our tools is a OCaml library interface, with the CLIs being as thin as possible. And by and large, that’s mostly how the active tools in the Platform operate today. We have a number of CLI tools that interoperate via opam-libs or the more lightweight opam-file-format. Dune itself is just vendoring in big chunks of opam for its own integration, which means that it can be upgraded with the same core logic as used in future versions of the opam CLI. Dune’s also got a library reimplementation of ocamlfind, so that it doesn’t need to shell out to that but still retains strong compatibility.

This also points to a possible good toplevel metric for the OCaml Platform: what proportion of the community are using the tools that we recommend? This proportion is clearly increasing (opam, dune, merlin, lsp-server and odoc are now widely adopted both in open source and in monolithic codebases that use OCaml), but I think we’re less clear on others like ocamlformat, dune-release vs opam-publish, and mdx. Suggestions for improvements on this metric, and for ways to measure it more systematically, are welcome.

producer 0.2.0

Trent Small announced

Hi everyone!

I’m pleased to announce a new release of producer, v0.2.0.

This release allows a Producer graph to be specified for Monads with more than one type parameter (e.g. Result.t). The previous release of this library only allowed Monads with one type parameter (e.g. Lwt.t).

Feel free to take a look and let me know what you think – contributions are also welcome if you find this idea intriguing and want to improve upon it.

Happy coding!

Call for Contributions: BOB 2024, Berlin [March 15, Deadline Nov 17]

Michael Sperber announced

OCaml-related material is very much welcome at BOB!

Web version of call is here:

https://bobkonf.de/2024/cfc.html

================================================================================
                         BOB Conference 2024
         "What happens when we use what's best for a change?"
                  https://bobkonf.de/2024/cfc.html
                         Berlin, Mar 17
                        Call for Contributions
                     Deadline: November 17, 2023
================================================================================

You are actively engaged in advanced software engineering methods,
solve ambitious problem with software and are open to cutting-edge
innovation? Attend this conference, meet people that share your goals,
and get to know the best software tools and technologies available
today. We strive to offer a day full of new experiences and
impressions that you can use to immediately improve your daily life as
a software developer.

If you share our vision and want to contribute, submit a proposal for
a talk or tutorial!

NOTE: The conference fee will be waived for presenters. Travel
expenses will not be covered (for exceptions see "Speaker Grants").

Shepherding
-----------

The program committee offers shepherding to all speakers. Shepherding
provides speakers assistance with preparing their
sessions. Specifically:

- advice on structure and presentation
- review of talk slides
- assistance with recording
- review of recording, if applicable

Speaker Grants
--------------

BOB has Speaker Grants available to support speakers from groups
under-represented in technology. We specifically seek women speakers,
speakers of color, and speakers who are not able to attend the
conference for financial reasons.

Topics
------

We are looking for talks about best-of-breed software technology, e.g.:

- functional programming
- persistent data structures and databases
- event-based modelling and architecture
- "fancy types" (dependent types, gradual typing, linear types, ...)
- formal methods for correctness and robustness
- abstractions for concurrency and parallelism
- metaprogramming
- probabilistic programming
- math and programming
- controlled side effects
- program synthesis
- next-generation IDEs
- effective abstractions for data analytics
- … everything really that isn’t mainstream, but you think should be
- … includeing rough ideas worth discussing.

Presenters should provide the audience with information that is
practically useful for software developers.

Challenges
----------

Furthermore, we seek contributions on successful approaches for
solving hard problems, for example:

- bias in machine-learning systems
- digital transformation in difficult settings
- accessibiltity
- systems with critical reliability requirements
- ecologically sustainable software development

We're especially interested in experience reports.
Other topics are also relevant, e.g.:

- introductory talks on technical background
- overviews of a given field
- demos and how-tos

Requirements
------------

We accept proposals for presentations of 45 minutes (40 minutes talk +
5 minutes questions), as well as 90 minute tutorials for
beginners. The language of presentation should be either English or
German.

Your proposal should include (in your presentation language of choice):

- An abstract of max. 1500 characters.
- A short bio/cv
- Contact information (including at least email address)
- A list of 3-5 concrete ideas of how your work can be applied in a developer's daily life
- additional material (websites, blogs, slides, videos of past presentations, …)

Organisation
------------

- Direct questions to konferenz at bobkonf dot de
- Proposal deadline: November 17, 2023
- Notification: December 5, 2023
- Program: December 12, 2023

Submit here:

https://pretalx.com/bob-2024/submit/

Program Committee
-----------------

(more information here: https://bobkonf.de/2024/programmkomitee.html)

- Matthias Fischmann, Wire
- Matthias Neubauer, SICK AG
- Nicole Rauch, Softwareentwicklung und Entwicklungscoaching
- Michael Sperber, Active Group
- Stefan Wehr, Hochschule Offenburg

Scientific Advisory Board

- Annette Bieniusa, TU Kaiserslautern
- Torsten Grust, Uni Tübingen
- Peter Thiemann, Uni Freiburg

A little article about Miou

Dinosaure said

I just published a little article about Miou, a scheduler for #OCaml 5 in my blog: https://blog.osau.re/articles/miou.html. You can also check my last experimentation about it, an HTTP client which is able to run things in parallel: https://github.com/robur-coop/httpcats

Old CWN

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.