Handling Effect Dependencies and Propagation in TypeScript
Not sure if better here or in a effect-๐-like channel, but here we are:
I have an
I'd like to describe the steps (check, prepare, process) as a function
Those steps are then ran in order by some common logic. Of course an operation NEEDS to define all the steps in order to be run.
I thought about using an effect for the running bit, which needs those 3 steps as requirements. My problem is that propagating correctly the E, R channels of those steps seems like a painful thing to achieve in typescript. Is there a way around it? Is asking for an effect with error and requirement channels as a requirement of another effect something I shouldn't do, and use
I experimented with this approach because I wanted to try avoid builder pattern for example.
Example:
I have an
Operation which consists of a couple of named steps, like check --> prepare --> process. I do a bunch of things between every step which is always the same, no matter the step itself. The step itself can differ quite a lot between different "operations".I'd like to describe the steps (check, prepare, process) as a function
(input: A) => Effect<B, E, R>.Those steps are then ran in order by some common logic. Of course an operation NEEDS to define all the steps in order to be run.
I thought about using an effect for the running bit, which needs those 3 steps as requirements. My problem is that propagating correctly the E, R channels of those steps seems like a painful thing to achieve in typescript. Is there a way around it? Is asking for an effect with error and requirement channels as a requirement of another effect something I shouldn't do, and use
X instead?I experimented with this approach because I wanted to try avoid builder pattern for example.
Example:
