Modelling Layers in Effect Veterans: Challenges and Patterns
How are Effect veterans modelling layers?
The recent change to some of the
Example:
We have a
None of the 3 repos are configurable, so they all export a layer like this:
...continued below
The recent change to some of the
Layer APIs prompted me to revisit how we're modelling layers in our app, and I'm finding it hard to come up with a good pattern that let's us keep services configurable without ending up with a big mess of Layer.provide, Layer.provideMerge and Layer.mergeAll to mash together at the execution boundary.Example:
We have a
FulfillmentService which depends on OrderRepo, ProductRepo and CustomerRepo, all three of which depend on Database. The Database service is configurable, so the module exports a makeLayer function as follows:None of the 3 repos are configurable, so they all export a layer like this:
FulfillmentService is configurable in a similar way to Database, so we have:...continued below
