The flow file (.flow): a plain-text form for a
hylograph-flow
value — items that hold quantities, steps that move them, the wires
between, and the ways of grouping them — that declares its own
conservation law. The law is in the file, so it cannot be lost or fall
out of step with the figures it governs, and a reader checks the declared
law rather than guessing one.
flow-file 1
flow "Two steps and a transfer"
law conserves energy within 0.05 quads
source chart "The chart, 2024" link "https://example.org/chart.png"
quantity energy unit quads places 2
item "Coal > Power" holds 7.01 quads
step "Coal" supplies 7.87 quads
step "Power" keeps 7.01 quads
wire step "Coal" -> item "Coal > Power"
wire item "Coal > Power" -> step "Power"
grouping "by kind"
group "Fossil"
step "Coal"
One of a closed set. At every step and every item, what enters (what is written to it, and what it supplies) equals what leaves (what is read from it, and what it keeps):
| Law | Meaning | For |
|---|---|---|
conserves X within T |
to within a tolerance, quantity by quantity | real data printed rounded: an energy chart, a car's mass |
conserves X exactly |
in whole steps of each quantity | money in cents: a journal, a reinsurance programme |
conserves nothing |
a dependency only: everything read has a writer or is given from outside | a build, a git history, a pipeline run |
Every figure is an amount of a declared quantity, in its unit, written to exactly the places the quantity declares, and may cite the source it was read from. A transfer from one step to the next is one figure on one line, so changing it changes one line of the file.
| Module | What |
|---|---|
Hylograph.Flow.File |
the types: FlowFile, Law, quantities, sources, items, steps, wires, groupings, an optional run (a mark and times per step) |
Hylograph.Flow.File.Text |
parse and print (one canonical printing; parse (print f) == Right f), lawText, lawInWords, amountText |
Hylograph.Flow.File.Law |
the check: each step's and item's residual and whether it is within the law, the total, the worst residual; throughCut and invariance, that no cut of any grouping changes the total |
Hylograph.Flow.File.Convert |
to and from a hylograph-flow Flow, and groupings to its collapses |
Hylograph.Flow.File.Json |
the same value as JSON (codec values) |
Hylograph.Flow.File.Amount |
exact amounts, as whole numbers of a quantity's smallest step |
Nothing here draws; hylograph-flow-render draws what Convert.toFlow
gives.
Every file begins flow-file 1. This version of the package reads version
1 and refuses any other by name, so a file says which grammar it was
written in.
make test: 400 generated files, covering every law, clause and mark,
each printed and read back to the same value, and through JSON and through
Flow and back; the law's total unchanged under 40,325 cuts of 300
generated flows.
The repository also holds four worked files in subjects/ (Lawrence
Livermore's 2024 US energy chart, two cars as flows of mass, an invented
household journal, and a loss through a small reinsurance programme), and,
in converters/, the unpublished package that writes them from their
sources and holds each to its source (make check).
MIT.