ITADN
dowdiness/incr · 文件 下载 ZIP
文件最后提交记录最后更新时间
README.md

incr

CI

incr is a MoonBit library for computations that must stay fresh as their inputs change. It records what each derived value reads, verifies those records on demand, and recomputes only what changed — use it where "recalculate everything" is too expensive: editor state, language tooling, reactive models, spreadsheet cells, build-like pipelines.

This page is the repository front door. The library guide — incr/README.mbt.md — has installation, a quick-start example, the mental model, and the mode-selection table. Read it before using the library seriously.

Core API in one paragraph

Write to Input[T], compute with Derived[T] (memoized, auto-tracked dependencies), and use DerivedMap[K, V] when you need one cached value per key. Start with Derived; reach for the push-reactive (EagerDerived, Effect), hybrid (ReachableDerived), or relational (Relation, MapRelation) layers only when the library guide's "Which mode should I use?" table says so. Backdating, durability, batching, and cycle-safe reads come with the pull engine by default.

Repository layout

You want to...Go to
Use the published dowdiness/incr packageincr/ + incr/README.mbt.md
Learn the model step by stepdocs/getting-started.mbt.md, then docs/concepts.mbt.md
Look up a type, method, or patterndocs/api-reference.mbt.md, docs/cookbook.mbt.md
Browse all docs (architecture, decisions, performance)docs/README.md
See runnable demos and spikesexamples/
Contribute or run validation commandsAGENTS.md
Track released changesCHANGELOG.md

Live demo

Edit one cell of the typed spreadsheet and watch only the necessary work happen: formulas record the cells they read, and the trace panels show which formulas recomputed, which values changed, and where recomputation produced the same result (backdating). Source: examples/typed_spreadsheet_rabbita_demo/.

Workspace commands

Run from the repository root:

moon check    # type-check; run after every edit
moon test     # full workspace test suite
moon fmt      # format
moon info     # regenerate pkg.generated.mbti interfaces

Release validation for the published package:

moon -C incr publish --dry-run

License

Apache-2.0