Utilities
Use one typed failure vocabulary and the standard library's ordinary transforms.
Composition and reuse
Why
Untyped composition can obscure a pipeline's failure contract even when each individual function is annotated.
Rules
MUST use returnsmapfor pure successful-value transforms andbindfor Result-returning stages.[review]
MUST inspect returnsflowandpipebefore writing a generic composition helper.[review]
MUST use standard-library iterators, comprehensions, itertools, and functools when they express the transformation clearly.[review]
MUST preserve failure types across composition rather than weaken them to Any.[review]
MUST prefer explicit injected dependencies before introducing context containers.[review]
MUST bound asynchronous resource concurrency and preserve cancellation.[review]
MAY adopt Toolz for a demonstrated collection gap after maintenance and strict-typing checks.[review]
MUST keep library installation subject to the consumer's approval rules.[review]
Example
This complete example requires returns in the consumer environment.
[review]
Strict typing with the returns plugin and behavioral tests establish pipeline contracts. Review checks generic helper duplication and concurrency limits.
Enforcement
Strict typing with the returns plugin and behavioral tests establish pipeline contracts. Review checks generic helper duplication and concurrency limits.