A Pure Calculation Inside an Effectful Program
A program can acquire data and publish results at its edges while a predictable core computes from explicit inputs.
- Source
- Anbloq
- Language
- English
- Created
- Updated
- Chapters
- 2
- Reading time
- 1 min
In this article2 chapters
Trace a report command
Open a local settings file, parse its values, compute the report text, and write the completed result. The core function can receive typed settings and records. See pure functions for how this reduces test dependencies.
Retain checks at the real boundary
A mock reader cannot prove the command used the declared encoding or closed its file correctly. Exercise the real components in an integration test.[1]