Seeking Cleaner Representation for Layered Service Dependencies in Code

Hi guys. However, I'm having trouble with representing my services/layers in a... prettier way. To be more precise, I have these services:

- Service A
- Service B
- Service C

Where C depends on B, and B also depends on A. However, I also need some method from A and B as well. provideMerge serves this purpose well, but the end result does not... look good. Do you think there is a "cleaner" way to do this?

const program = Effect.provide(
  ServiceCLive.pipe(
    Layer.provideMerge(
      ServiceBLive.pipe(
        Layer.provideMerge(ServiceALive),
      )
    ),
  ),
);
Was this page helpful?