EffectTalk

Layer.merge to compose services

Layers describe how to build services. Use Layer.merge to combine multiple layers into one that provides all their services.

Instead of manually wiring dependencies, compose layers and provide them at the edge.

  • Use Layer.merge(layerA, layerB) to combine layers
  • The merged layer provides all services from both
  • Use Effect.provide(program, layer) to run with the layer
Loading code editor...