Effect CommunityEC
Effect Community4w ago
6 replies
rnau

Layers composition dynamically

I have trade updater service. It takes like stock and options trades, and gets the context first.

Then it evaluates outcomes: if it reached thresholds, dates, etc.
I have all of them split into Effect.Service working together nicely.

The flow goes like this

context -> eval -> outcome -> persist

The thing i'm struggling is how to design eval service to be trade type specific.
But without a mess of routing and branching inside of it. I figured layers i the way to go since they make it super easy to swap implementaitons.

Question. Is there anything I should use to have layers dynamic at the runtime?
I don't ahead of time trade type, that comes out of context. But it means I already have all the layers provided to the app.
Was this page helpful?