Understanding Layer Composition in TypeScript

Wrapping my head around layer composition—I think I'm close but I'm trying to understand the benefits of the example merging ConfigLive and LoggerLive to build an AppConfigLive

const AppConfigLive = Layer.merge(ConfigLive, LoggerLive)
 
const MainLive = DatabaseLive.pipe(
  // provides the config and logger to the database
  Layer.provide(AppConfigLive),
  // provides the config to AppConfigLive
  Layer.provide(ConfigLive)
)


What is the benefit here over doing:

const MainLive = DatabaseLive.pipe(
  Layer.provide(LoggerLive),
  Layer.provide(ConfigLive),
)


I'm guessing that the compositional benefits due to the type signature of AppConfigLive becomes more obvious in a larger example, but having a bit of trouble making that jump with the current docs. Would appreciate any clarity!
Was this page helpful?