Composition
Part 2 taught the atoms — concepts, properties, rules, computations, mutations, the type system. This part teaches what to do with them.
- 3.1 Patterns and Pattern-Matching —
matchover data and over reasoning outcomes. - 3.2 State Machines — modeling lifecycle via the
lifecycle { … }block. - 3.3 Tests and Verification —
testblocks and@[theorem]. - 3.4 Diagrams — turning the model into pictures.
Two threads run through this part. The first is composition in the obvious sense: putting the atoms together to model real lifecycles, real rules, real interactions. The second is verification: pinning the meaning of the model down with tests and diagrams that double as living documentation.
By the end of Part 3 the lease tutorial has a state machine for Lease, a test suite that exercises it, and a set of diagrams you can hand to a non-technical stakeholder.