A working project, first cut for comment
Spreadsheets, build systems, energy charts and insurance programmes are the same shape. They differ in the algebra carried on the wires. This is an attempt to say that in types, draw it with one renderer, and run it on whichever engine suits the scale.
Andrew Condon, with Claude. Written 26 November 2026 from the project's working notes. Everything described here exists and passes its own tests unless it says otherwise. Much of the code is private for now; excerpts are quoted below.
Many fields draw the same picture. There are things that hold a value, processes that compute, and connections between them. A spreadsheet has columns and formulas. A Makefile has files and rules. A life cycle assessment has materials and processes. A reinsurance programme has losses and terms.
A survey across about twenty fields found nearly one structure and only a handful of algebras over it. What a step is allowed to do, and what must hold afterwards, is what varies: mass is conserved, or money is split by "the lesser of", or nothing is conserved and only dependency matters.
If that is right, three things follow, and the project tests each.
The intended reader of the finished thing is someone who does not think of themselves as a programmer. They see tables sitting in a flow, with functions between them.
hylograph-flow is the shape as a PureScript value. A flow has items (what holds a value), steps (what computes, with named ports) and wires (a step reads an item, or writes one). There is no wire from item to item or from step to step. Whatever a domain knows rides in three type parameters that the library never inspects.
Three things are deliberately kept out of the value: what is drawn (a projection), run state (an overlay), and grouping (a group can be closed into one step and opened again).
hylograph-flow-render draws a projection. A layout engine is a value that names the laws it promises to keep, so any engine's output can be checked and measured in the same way. The package has a layered engine that is a plain graph when every edge is equal and a Sankey when a wire says how wide it is, a columns engine for nodes the caller sizes (a table of rows is one), and an engine that keeps order as groups open and close. A layout is data: boxes, ports and routes, from which the SVG is derived.


The taxonomy below is a synthesis of two literature surveys commissioned for the project. It should be read as a hypothesis. The surveys mark each claim as read or recalled, and several of the unifying statements are the surveyors' own inferences.
| Class | A step is | What holds | Fields | Natural engine |
|---|---|---|---|---|
| Linear recipes | so much of each thing per unit of activity | conservation of a projected quantity, often only approximately in real data | life cycle assessment, input-output economics, material flow, bills of materials, double-entry accounts | recursion with a cache, or a recursive query; with loops, a linear solve |
| Clamps | "the lesser of" and "the excess over" | conservation exactly; not proportionality, so order of aggregation is part of the meaning | insurance and reinsurance, securitisation waterfalls, clearing | a monotone fixed point |
| Nothing conserved | a dependency or a gate | outputs are determined by inputs; provenance propagates | build systems, lineage, software bills of materials, fault trees, spreadsheets | a query over a semiring |
| With time | a rate, or a step with state | a stock integrates its flows | system dynamics, epidemiology, a battery, a loan | a fold over steps; an integrator |
| Optimised | a technology with a capacity | balances as constraints | energy system models, dispatch | a linear programme |
Two findings from the surveys shaped the design. Real data does not balance, so an imbalance must be a value that is reported with a tolerance, not something the types forbid. And aggregation does not commute with solving: totals of a solved system can be grouped freely, but grouped recipes solved again give a different answer.
Each row of that table has a small working demonstration. All seven follow one pattern: the model is stated in PureScript, a reference engine evaluates it, a second engine evaluates the same tables, and the two are asserted equal. Each also has a law that is tested, with a spoiled case that must fail.
The pictures are drawn from each demonstration's own results with the project's libraries. Figures marked invented are invented.
The model, PureScript
type Exchange =
{ direction :: Direction -- Takes | Gives
, item :: ItemName
, perUnit :: Number }
type Recipe =
{ process :: ProcessName
, place :: Place
, reference :: ItemName
, role :: Role -- Makes | Treats
, exchanges :: Array Exchange }
type Demand = { item :: ItemName, quantity :: Number }
pull :: forall substance
. System substance
-> Array Demand
-> Either (Array Problem) Solved
The same engine, SQL
WITH RECURSIVE need(case_number, variant,
process, activity) AS (
SELECT demand.case_number, demand.variant,
recipe.process, demand.quantity
FROM demand
JOIN recipe ON recipe.variant = demand.variant
AND recipe.reference = demand.item
UNION ALL
SELECT need.case_number, need.variant,
asks.asked, need.activity * asks.per_unit
FROM need
JOIN asks ON asks.variant = need.variant
AND asks.asker = need.process
)
SELECT case_number, variant, process,
sum(activity) AS activity
FROM need
GROUP BY case_number, variant, process;


The terms, PureScript
data Term
= Deductible Cents
| Limit Cents
| Layer { attachment :: Cents, limit :: Cents }
| QuotaShare BasisPoints
| Franchise Cents
applyTerm :: Term -> Cents -> Split
-- Split = { taken :: Cents, left :: Cents }
The same, SQL
least( greatest(amount - attachment, 0), coalesce(lim, amount) ) * share // 10000




make -n says it will run, exactly the planned files are rewritten, and the output equals a build from nothing.make. They agree, and are wrong together. See Builds.The spreadsheet work asks the question once asked of goto. If positional references are simply left out, is the result a toy, or a system that is sound on real work?
The law: every reference is to a whole column of a whole table, or of a declared sequence of tables. No constructor takes a row number, an offset or a count. A formula is written once on a column and applies to every row.
The test is an importer. It reads a real workbook, makes it legal, evaluates the legal form by its structure, and compares every computed cell with the value Excel stored.
| 400 workbooks of the Enron sample, 515,878 formula cells | Cells | Share |
|---|---|---|
| Legal, as one expression for its column | 302,998 | 58.7% |
| Legal, but said cell by cell | 62,014 | 12.0% |
| Legal, a declared import from another workbook | 36,951 | 7.2% |
| Entered: a formula that reads no cell | 2,628 | 0.5% |
| Refused by design (a cell that reads itself, indirect addressing) | 10,696 | 2.1% |
| Gap: the model cannot yet say it | 100,591 | 19.5% |
Where the model computes a value it equals Excel's in 362,291 cells and differs in 5,349. Eighty workbooks are reproduced completely. So about 78% of real formula cells are legal with no positional construct at all. A fifth are still gaps, which is why this is not yet an answer.
A workbook of our own, written with Excel tables and SUMIFS, now imports with 540 of 865 formula cells equal to Excel's and none different.
A sheet is drawn as tables joined by ribbons. A ribbon is as wide as the rows it feeds. There are three distances: every row, rows hidden in the middle, and an x-ray with no values at all, where each table is a record of its columns. The x-ray is the type signature of the sheet.
Everything ordinary is grey. Colour is kept for what a reader should ask about.


None of these is called an error. A value typed over a formula is "set by hand", and it carries a reason or the words "no reason given". The principle is that a column a hand has touched is a different type from one that no hand has, so the two cannot be mistaken for each other.
The loan as types (a sketch of where the model is heading, not yet the model)
data Cell a
= AsComputed a
| SetByHand { reason :: Reason, value :: a, formulaGave :: a }
type Rates = Since Month (Rate Year) -- a value in force from each key until the next
type Payments = Series Month
( rate :: Stepped (Rate Year) -- two ranges, from Rates
, opening :: Resting (Money EUR) -- reads closing, which rests on a hand
, interest :: Overridden (Money EUR) -- one cell set by hand
, paid :: Entered (Money EUR)
, closing :: Resting (Money EUR) )
type Loan =
{ principal :: One (Money EUR), rates :: Rates, paid :: …, byHand :: ByHand Month ( interest :: Money EUR ) }
-> { payments :: Payments, totalInterest :: One (Resting (Money EUR)) }
Two constructs were added this week. A conditional fold can hold several tests, which is SUMIFS. And an entered value can be held to a declared choice, either listed values or the keys of another table's column. A lookup by such a value cannot miss, so #N/A is removed by construction for that lookup.
A build is the same picture. Targets are rows of a table keyed by name, a pattern rule is one formula for every row, and a rule written out for one target is an override. What one run did to each row is a value with a reason: kept, or rebuilt because its source changed or because a prerequisite was rebuilt.
The seventh proof left one failure standing: a file a recipe reads without declaring it. A companion store records what each step actually read during a run. With that record the undeclared read shows in the picture, with no build from nothing.

make nor the plan can see it. Scroll sideways: fitting a wide picture to the page is not solved.The same picture is drawn for a real PureScript build, from the journal of a run. The pieces have names: Warrant keeps the journal of what each run read and did, Güell makes the picture from it, and Brunel, an operations application, shows it on its Build tab. The subject below is Minard, one of our own codebases.

What that build showed (932 modules, 103 of them ours):
Two surveys were written for the project, one of the physical and economic sciences and one of finance, risk, accounting and software. They were written by Claude and each claim in them is marked as read from the source or recalled. Nothing below has been independently verified, and the notes say where a source turned out to fit less well than hoped.
| Source | Why it matters here | Status |
|---|---|---|
| Rick Lupton, "Flow programming" (preprint, 2025) | Recipes per unit of activity, "pull production" and "push consumption", and a marked non-linear step. The nearest existing thing to the recipes above. | read |
| Lupton and Allwood, hybrid Sankey diagrams (2017), and floWeaver | The dataset and the diagram definition kept apart, with conservation written down. | read |
| ledger-semantics (Lean 4) | Accounting with the balance law as a theorem, held to a production tool by bisimulation. The method of holding two engines equal is the same. | read |
| Green, Karvounarakis and Tannen, provenance semirings (2007) | "One graph, many algebras" for the class where nothing is conserved. The fourth proof found the fit is loose: it evaluates paths, where the paper's objects are derivations. | recalled |
| Baez and others, stock and flow diagrams, and AlgebraicJulia | The same idea with time: one structure, several semantics, composed. | read |
| Bain, "Insurance Spirals and the Lloyd's Market" (1999); Eisenberg and Noe on clearing | Cessions in a circle as a fixed point. That the two are one form is the surveyor's inference. | read inferred |
| Mokhov, Mitchell and Peyton Jones, "Build Systems à la Carte" | The taxonomy of build systems, and correctness as "equals a build from scratch". | recalled |
| Hermans and others on spreadsheet smells | What existing linters look for, as a baseline for the importer. | surveyed |
The claim we most want tested by someone who knows these fields: that insurance terms, securitisation waterfalls and clearing are one algebra of clamps. The surveyor found no source that states it across all three.
Everything is PureScript, with SQL for DuckDB and one Julia script. The two libraries are public and published to the PureScript registry. The rest is private while it is unsettled; ask for access.
| Piece | What it is | State |
|---|---|---|
hylograph-flow | The shape: items, steps, wires, projections, groupings | Public, 0.2.0 |
hylograph-flow-render | Layout engines as values with laws; measures; one drawing | Public, 0.7.1 |
flow-engines | The seven proofs and their gallery | Private |
| Sheets model, importer and tables picture | The law, the evaluator, the measure against Excel, the x-ray | Private |
| Build picture and run journal | A build as tables in a flow, with what each step read | Private |
What would help most from a reader: where an idea did not come across, which claim you do not believe, and which field you know that does not fit the table.