Difference in Layer Composition Approaches

what is the difference in behavior in these two options for creating layers?

// Option 1
export const LiveLayer1 = Layer.empty.pipe(
    Layer.provide(ContentIndex.layer),
    Layer.provide(Threads.layer),
    Layer.provide(DatabaseLive),
)

const ServerRuntime1 = ManagedRuntime.make(LiveLayer1)


// Option 2
const LiveLayer2 = Layer.mergeAll(
    Threads.layer.pipe(Layer.provide(DatabaseLive)),
    ContentIndex.layer.pipe(Layer.provide(DatabaseLive)),
)

export const ServerRuntime = ManagedRuntime.make(LiveLayer2)
Was this page helpful?