in a client library, or a domain logic, there might be different apis. broken at various levels of granularity and atomicity.
this is to say that an atomic computation, might be actually atomic, when it is packaged in such a manner, that doesn't matter its sequential, parallel, concurrent execution,
but sometimes the domain logic / client api, might introduce apis which make an atomic sense, only when chained strictly sequentially with other apis. such that if we, the callers, don't pay due attention to calling those apis in the right order, to move from one consistent state to only the next, and not get stranded somewhere in between.
so when we wrap these apis, in zio effects, and then compose bigger effects, by flatmapping along, we can obtain strong guarantees about having chained them in the right order, such that, even though if the execution might be suspended-released at arbitrary points in an execution, the results won't change, because whatever it needs to compute, is with itself, and the next method is called with well defined results, in sequence.
when we factor out as much of domain computation as possible, and model them only as pure functions, we get an entire new category of canvas to think about program design. like an earthworm doing FIFO soil digestion.
in a client library, or a domain logic, there might be different apis. broken at various levels of granularity and atomicity.
this is to say that an atomic computation, might be actually atomic, when it is packaged in such a manner, that doesn't matter its sequential, parallel, concurrent execution,
but sometimes the domain logic / client api, might introduce apis which make an atomic sense, only when chained strictly sequentially with other apis. such that if we, the callers, don't pay due attention to calling those apis in the right order, to move from one consistent state to only the next, and not get stranded somewhere in between.
so when we wrap these apis, in zio effects, and then compose bigger effects, by flatmapping along, we can obtain strong guarantees about having chained them in the right order, such that, even though if the execution might be suspended-released at arbitrary points in an execution, the results won't change, because whatever it needs to compute, is with itself, and the next method is called with well defined results, in sequence.
when we factor out as much of domain computation as possible, and model them only as pure functions, we get an entire new category of canvas to think about program design. like an earthworm doing FIFO soil digestion.