The dune playground

← back to the course

The lectures run OCaml snippets in a toplevel, one expression at a time. Real projects are built with dune, OCaml's build system: source files in a project tree, a build command, a test runner. This page gives you that experience without installing anything: pressing Start boots a tiny Linux machine inside your browser tab with OCaml 5.4, dune, and the bisect_ppx coverage tool preinstalled. It is a real shell: everything you type runs locally in your browser, and your work disappears when you close the page.

Things to try

Three sample projects live in the home directory: hello, morse, and bowling.

CommandWhat it does
cd hello && dune buildbuild your first project
dune exec ./hello.exerun the executable
cd ~/morse && dune runtestbuild a library and run its tests
nano lib/morse.mledit code (Ctrl-O save, Ctrl-X exit), then rebuild
cd ~/bowling && dune runtest --instrument-with bisect_ppxrun tests with coverage instrumentation (bowling comes pre-built; instrumenting a project from scratch takes a minute or two)
bisect-ppx-report summaryhow much did the tests cover?
bisect-ppx-report html && syncthen press the terminal's coverage report button to view it in a new tab

The first build fetches compiler files on demand, so it is slower than the ones after it. No code or telemetry leaves your browser from this page.