The Adapton bonsai.

adapton

Programming language abstractions for incremental computation: a program's run leaves behind a graph of what it named, read and demanded, and that graph is what the next run repairs instead of redoing.

Adapton is not one implementation. It is a recipe — a handful of primitives and the rules for running them — set down in papers since 2014 and cooked in several languages since.

Where the recipe is cooking#

A recipe outlives its kitchens. Fumola is the one it is cooking in now — the fullest expression of Adapton so far, and by a distance the most written down.

Fumola is an experimental language whose surface is ordinary — functions, records, variants, modules, borrowed from Motoko — and whose execution model is Adapton. Its incremental primitives are this project's, extended with symbolic space and time, and a program can read back the graph its own run left behind, as ordinary data.

Its page is the one to read: the primitives one at a time, the two modes a program runs in, the two semantics the runtime implements, the papers underneath, and a console running the whole thing, compiled to WebAssembly, in the browser. Fumola also runs inside Hazel, a live programming environment, where editing a program re-forces the same named thunk — which is what an incremental edit was always meant to be.

The recipe, in short#

A program is run so that changing its input does not mean running it again. As it executes it builds a demanded computation graph: cells, which hold values, and thunks, which are suspended computations, with an edge for every action a thunk took — every cell it wrote, every cell it read, every thunk it forced — kept in the order it took them.

The graph exists so that a later run can be repaired rather than redone. When a cell changes, the thunks that read it are the ones whose results are in question; the rest of the graph is still good, and is reused as it stands. What makes this addressable at all is that every cell and thunk has a name: the run after the edit has to recognise the node it is about to recompute as the same node as last time, and a name is how it does.

thunk { e }                // suspend a computation
`n := e                    // put: write the cell named `n
@p                         // get: read a cell, recording the edge
force(p)                   // demand a thunk, recording the edge

force(`n := thunk { e })   // the idiom: name it, store it, demand it.
                           // running it again with the same name is an edit

Two papers are between them the whole of that: the first is the machinery, the second is what makes it addressable. Everything after them has been a matter of saying it more precisely, or building it somewhere new.

Papers#

Drafts, on typing these programs rather than only running them: Fungi: typed incremental computation with names (2018), and its predecessor Refinement types for precisely named cache locations (2017). Further back, Adapton descends from self-adjusting computation, whose root is Adaptive functional programming (Acar, Blelloch, Harper, POPL 2002). A talk from March 2015 covers the first two papers.

Implementations#

Kitchens, in order of use. Only the first is current; the others are left standing because the papers point at them.

The first two prototypes, in OCaml and Python circa 2014, were Mercurial repositories on Bitbucket and did not survive its removal of Mercurial hosting.

People and funding#

Adapton is the work of Matthew A. Hammer, Jana Dunfield, Michael Hicks, Jeffrey S. Foster, David Van Horn, Kyle Headley, Monal Narasimhamurthy, Dimitrios J. Economou, Nicholas Labich, Khoo Yit Phang, James Parker, Jared Wright and Ryan Vandersmith — begun in the programming languages groups at the University of Maryland and the University of Colorado Boulder, and continued since 2023 as independent research.

Ryan Vandersmith built Human-Fungi Interface, the web interface to Fungi: it pretty-printed the code and its traces, ran the program in the browser, and drew the type-and-effect derivations themselves. It is the first of the three interfaces this work has had, and the only one so far to have shown the types.

The academic work was funded by a Facebook Faculty Research Award (2017), the NSF project Online Verification-Validation (2016–2019), and a Mozilla Research Grant (2015).