iconAnil Madhavapeddy, Professor of Planetary Computing

Solving Package Management via Hypergraph Dependency Resolution / Jun 2025

# 1st Jun 2025 iconpapers ocaml os packaging preprint systems

Webassembly on exotic architectures (a 2025 roundup) / Apr 2025

It's about the time of the academic year to come up with project ideas! KC Sivaramakrishnan, Andy Ray and I have been looking into FPGA/OCaml matters recently so I thought I'd review the latest in the land of Webassembly for non-traditional hardware targets. It turns out that there are very fun systems projects going on to turn wasm into a "real" target architecture on several fronts: a native port of Linux to run in wasm, a port of wasm to run in kernel space, a POSIX mapping of wasm, and fledgling wasm-CPUs-on-FPGAs.

[…1130 words]
# 16th Apr 2025 iconnotes fpga ocaml systems wasm

Unikernels wins the ASPLOS most influential paper award / Apr 2025

I was gobsmacked to get a note from the SIGARCH ASPLOS steering committee that our 2013 paper "Unikernels: library operating systems for the cloud" won the most influential paper award at the conference last week! I couldn't make it to Rotterdam myself due to the travel time, but Richard Mortier was already there and so accepted the award on the whole team's behalf!

[…1524 words]
# 12th Apr 2025 iconnotes awards ocaml systems unikernels

Runtimes à la carte: crossloading native and bytecode OCaml / Apr 2025

This is an idea proposed as a good starter project, and is currently being worked on by Jeremy Chen. It is co-supervised with David Allsopp.

In 1998, Fabrice le Fessant released Efuns ("Emacs for Functions"), an implementation of an Emacs-like editor entire in OCaml and which included a library for loading bytecode within native code programs[^1].

This nearly a decade before OCaml 3.11 would introduce Alain Frisch's native Dynlink support to OCaml. Natdynlink means that this original work has been largely forgotten, but there remain two interesting applications for being able to "cross-load" code compiled for the OCaml bytecode runtime in an OCaml native code application and vice versa:

  1. Native code OCaml applications could use OCaml as a scripting language without needing to include an assembler toolchain or solutions such as ocaml-jit.
  2. The existing bytecode REPL could use OCaml natdynlink plugins (.cmxs files) directly, allowing more dynamic programming and exploration of high-performance libraries with the ease of the bytecode interpreter, but retaining the runtime performance of the libraries themselves.
[…310 words]
# 1st Apr 2025 iconideas effects functional idea-beginner idea-ongoing ocaml urop

Effects based scheduling for the OCaml compiler pipeline / Apr 2025

This is an idea proposed as a good starter project, and is currently being worked on by Lucas Ma. It is co-supervised with David Allsopp.

In order to compile the OCaml program foo.ml containing:

Stdlib.print_endline "Hello, world"

the OCaml compilers only require the compiled stdlib.cmi interface to exist in order to determine the type of Stdlib.print_endline. This separate compilation technique allows modules of code to be compiled before the code they depend on has necessarily been compiled. When OCaml was first written, this technique was critical to reduce recompilation times. As CPU core counts increased through the late nineties and early 2000s, separate compilation also provided a parallelisation benefit, where modules which did not depend on each other could be compiled at the same time as each other benefitting compilation as well as recompilation.

For OCaml, as in many programming languages, the compilation of large code bases is handled by a separate build system (for example, dune, make or ocamlbuild) with the compiler driver (ocamlc or ocamlopt) being invoked by that build system as required. In this project, we'll investigate how to get the OCaml compiler itself to be responsible for exploiting available parallelism.

[…697 words]
# 1st Apr 2025 iconideas effects functional idea-beginner idea-ongoing ocaml urop

Bidirectional Hazel to OCaml programming / Apr 2025

This is an idea proposed as a good starter project, and is currently being worked on by Max Carroll. It is co-supervised with Patrick Ferris and Cyrus Omar.

Hazel is a pure subset of OCaml with a live functional programming environment that is able to typecheck, manipulate, and even run incomplete programs. As a pure language with no effects, Hazel is a great choice for domains such as configuration languages where some control flow is needed, but not the full power of a general purpose programming language. On the other hand, Hazel only currently has an interpreter and so is fairly slow to evaluate compared to a full programming language such as OCaml.

[…277 words]
# 1st Apr 2025 iconideas functional hazel idea-beginner idea-ongoing javascript ocaml types urop wasm

Socially self-hosting source code with Tangled on Bluesky / Mar 2025

I've been an avid user of GitHub since its launch, and it really has revolutionised how communities come together to work on open source. In recent years though, I find myself utterly overwhelmed by its notifications and want to experiment with alternative workflows. This experimentation also has a more serious undertone due to the increasing need for data sovereignty and so I'm starting to move my source code to self-hosted solutions that are less reliant on centralised services.

This has also come up persistently over the years in the OCaml community, with questions over why participation in packaging requires a GitHub account ever since the early days of opam. I've never found a good answer... until now, with the launch of an exciting new service that's built over the same protocol that Bluesky uses. As I noted a few weeks ago, the ATProto can be used for more than just microblogging. It can also be an identity layer, across which other applications can be built which reuse the social fabric from Bluesky accounts.

"Tangled" is a new service launched (just yesterday!) by opilli and icyphox to manage Git repositories. I'm having a lot of fun trying it out, even in its early alpha stages! The coolest thing about Tangled is that you can self-host your own knots, which control where the source code repositories are actually stored.

[…1104 words]
# 8th Mar 2025 iconnotes bluesky distributed docker identity ocaml security selfhosting

Are you still using OCaml 4.08 or earlier? If so, we need to know (via ocaml.org)/ Mar 2025

I started pushing OCaml Docker images over to the Docker Hub in around 2017, to support the burgeoning automated build infrastructure around the use of the language. Back then, OCaml 4.06 was the latest release, and so I wrote an ocaml-version library to track the release metadata. It has been a bit of a success disaster, as that library now tracks every release of OCaml in the modern era, and also backs the automatic building of a huge array of compiler versions and variants across Linux and Windows.

The problem is...we're now building the full set of images from OCaml 4.02 onwards through to the latest OCaml 5.3.0 release, which is unsustainable for obvious reasons; despite the hosting being kindly sponsored by Docker, we must also consider the carbon footprint of our infrastructure. So the question for the OCaml community: are there are any remaining users who still need images earlier than OCaml 4.08 or can we can stop pushing those now?

[…313 words]
# 5th Mar 2025 iconnotes ocaml opensource

Oh my Claude, we need agentic copilot sandboxing right now / Mar 2025

Yaron Minsky nerdsniped me last week into getting OCaml to drive the 80s-retro RGB Matrix displays. I grabbed one from the local Pi Store and soldered it together with help from Michael Dales. But instead of writing OCaml bindings by hand, we thought we'd try out the latest agentic CLI called Claude Code released last week to see if we could entirely autogenerate the bindings.

TL;DR: Claude Coder generated working OCaml code almost from scratch, ranging from C bindings to high-level OCaml interface files and even Cmdliner terms, but needs a more sophisticated sandboxing model before something goes horribly wrong. So much potential and so much danger awaits us. Coincidentally Cyrus Omar and Patrick Ferris and I wrote about this a few months ago. Read on...

[…2125 words]
# 2nd Mar 2025 iconnotes ai hardware llm ocaml

A hardware description language using OCaml effects / Mar 2025

This is an idea proposed as a Cambridge Computer Science Part III or MPhil project, and is available for being worked on. It may be co-supervised with KC Sivaramakrishnan and Andy Ray.

Programming FPGAs using functional programming languages is a very good fit for the problem domain. OCaml has the HardCaml ecosystem to express hardware designs in OCaml, make generic designs using the power of the language, then simulate designs and convert them to Verilog or VHDL.

HardCaml is very successfully used in production at places like Jane Street, but needs quite a lot of prerequisite knowledge about the full OCaml language. In particular, it makes very heavy use of the module system in order to build up the circuit description as an OCaml data structure.

Instead of building up a circuit as the output of the OCaml program, it would be very cool if we could directly implement the circuit as OCaml code by evaluating it. This is an approach that works very successfully in the Clash Haskell HDL, as described in this thesis. Clash uses a number of advanced Haskell type-level features to encode fixed-length vectors (very convenient for hardware description) and has an interactive REPL that allows for exploration without requiring a separate test bench.

[…296 words]
# 1st Mar 2025 iconideas fpga idea-available idea-hard ocaml systems

Using AT Proto for more than just Bluesky posts / Feb 2025

While Bluesky is taking off like a rocket, a number of us moving towards self sovereign digital infrastructure have been looking at how to use the Bluesky network for other uses than just short-form notes. This is possible because of my colleague Martin Kleppmann's hard work on the "AT Protocol" that underpins the Bluesky network. Martin recently gave us a deep-dive into the AT proto in the Cambridge security group, which made me look into other uses of it more closely. As background, you may wish to read his paper on the subject which explains the technical architecture extremely clearly.

[…684 words]
# 11th Feb 2025 iconnotes bluesky distributed fediverse ocaml selfhosting

Programming FPGAs using OCaml / Feb 2025

With the vast amount of data we have these days for our planetary computing processing, it's naturally tempting to use more hardware offload. The obvious choice, GPGPUs, are not a great fit for the problem due to the difficulty of unlocking high data parallelism for geospatial data. So it's back to an old technology I worked on twelve years ago in the form of FPGAs!

FPGAs are a very flexible way to execute boolean combinatorial logic, but are notoriously difficult to program. We have two possible angles to explore to address this. One is to design more declarative DSLs for data processing that compile to the FPGAs, such as Michael Dales work on Yirgacheffe or Omar Tanner's work on in-memory compressive computation. The other angle is to work on the low-level API to programming the FPGAs, to get away from Verilog and program in our favourite high-level language...OCaml! KC Sivaramakrishnan and I have started making a list of resources for programming FPGAs in OCaml for our own education.

[…1214 words]
# 7th Feb 2025 iconnotes embedded fpga hardware networking ocaml

How to publish custom Homebrew taps for OCaml / Jan 2025

Now that I've switched to a new website, I'm working on open-sourcing its components. I've got a lot of small OCaml scripts that are all work-in-progress, and so not quite suitable to be published to the central opam-repository but I still need be able to run them conveniently on my own self-hosted infrastructure.

I mainly use a variety of macOS and Linux hosts[^1] and I want a workflow as simple as "brew install avsm/ocaml/srcsetter" and have it install a working binary version of my CLI utility. In this case, it's srcsetter, a simple tool I knocked up to generate the responsive images on this website. Luckily, Homebrew has made this really easy for us! They have a BrewTestBot that integrates with GitHub Actions to automate the compilation of binary packages for us, all from a convenient PR-like workflow.

[…658 words]
# 31st Jan 2025 iconnotes bushel homebrew ocaml packaging testing til

Foundations of Computer Science / Jan 2025

Here are the various repos used to create the interactive teaching environment we use for 1A Foundations of Computer Science in Cambridge. It may be useful to other professors who are using OCaml in their courses.

[…186 words]
# 3rd Jan 2025 iconnotes cambridge compsci computerlab ocaml pembroke teaching

Parallel traversal effect handlers for OCaml / Sep 2024

This is an idea proposed as a Cambridge Computer Science Part II project, and has been completed by Sky Batchelor. It was co-supervised with Patrick Ferris.

Most existing uses of effect handlers perform synchronous execution of handled effects. Xie et al proposed a traverse handler for parallelisation of independent effectful computations whose effect handlers are outside the parallel part of the program. The paper [^1] gives a sample implementation as a Haskell library with an associated λp calculus that formalises the parallel handlers.

[…199 words]
# 1st Sep 2024 iconideas effects fp idea-done idea-medium multicore ocaml scheduling

Displaying the 15 most recent news items out of 124 in total (see all the items)