There are many OCaml stacks, but this one is mine.
curl -sSL https://get.riot.ml | sh what is riot?
Riot is my stack and tooling for building applications in OCaml. It is heavily opinionated, and designed from the ground up to get out of your way and help you ship great software with agents.
It comes with a single tool for all your needs, a modern package registry, a multi-core ready actor-model runtime, a whole new standard library, and first-class support for clankers.
A Single Tool
Riot is also a tool: riot — and it's the only tool you need in this stack.
It ships:
- automatic toolchain management — specify what version of OCaml you want, and what targets you want to compile to, and Riot does the rest
- zero-config formatter optimized for readability and minimizing diffs
- an extensible linter with support for automatic fixes,
- a procedural macros system,
- a unified testing and benchmarking runner with support for unit tests, property tests, and snapshot testing,
- a brand new OCaml parser optimized for helpful diagnostics,
- a new incremental, parallel typechecker and language server
- ...and more!
Modern Package Management
Riot ships with a modern package registry: pkgs.ml — allowing you to publish a package in seconds.
This registry is designed to be safe, fast and friendly, with Github login, and a simple API token system to publish new packages.
It also gives you tools to understand how your packages are being used (downloads per version, dependants, etc), and to make it discoverable via categories, and search.
You can also interact with it from your terminal.
Call riot add pkg to add new dependencies, riot update to update your dependencies, or even search for packages:
Actors
Riot runs on an actor-model multi-core runtime for OCaml
(formerly known as riot!). Like Erlang and Elixir, you build software
with actors that communicate via message passing. If you need
parallelism, just call spawn and the runtime does the
rest.
Spawning an actor and sending messages is designed to be very cheap (in the order of microseconds), allowing you to spawn hundreds of thousands of actors, and send millions of messages without batting an eye.
One cool property this runtime has, is symmetric multiprocessing, which is a fancy way of saying the runtime rebalances the work across your CPUs automatically. In practice this means that if you have 10 cores, and spawn 100 actors, eventually each core will be running 10 of them.
Standard Library
Riot also ships a modern, efficient, and comprehensive standard library designed for building _systems_.
Inspired by Elixir, Rust, Ruby, and Go, std has ~80% of
everything you'll ever need to build your app: core datatypes,
collections and iterators, date & time, file system, networking, data
formats, encodings, cryptography, actor management and supervsiion,
OS and command running, logging and telemetry, a tiered configuration
system, benchmarking, testing, unicode support, and more.
std really is foundational to this stack, since it gives
all your code not just a similar performance, concurrency, and safety
profile, but a cohesive vibe.
Clanker-friendly
Everything in Riot is built to be friendly to agents. In fact, almost everything here has been built with agents!
Every command can operate non-interactively, and emit JSONL evevent streams that are easy to process with tools like `jq`.
All the diagnostics have ids, and can be expanded or explained by the
tools themselves. rust fmt will give you syntax errors
with id's, and you can call rust fmt --explain E0007 to
get context on when it occurs, why it occurs, what people normally
mean by it, and how to fix it.
To achieve this, I've written a new lossless OCaml parser and concrete syntax tree, and am in the process of writing a new incremental, parallel typechecker that will allow us to get superb typing diagnostics.
Get Involved
You're welcome to install and use Riot, and publish packages to pkgs.ml, and have fun shipping great software with it. But this is still one big experiment, so I won't make any promises.
If you want to encourage me to burn more tokens into this stack and turn it into the Rails of OCaml, consider sponsoring me on Github.