Using Tags to Provide Services Based on Context in Effect Typescript

Hi, is it possible to pinpoint services that share common tag and pass service impl based on another tag?

i am trying to achieve something like this

const prog = Effect.gen(function* () {
  const effect1 = yield* Effect.gen(function* () {
    const svc1 = yield* MyService('effect1')
  })

  const svc0 = yield* MyService('root')

  const effect2 = yield* Effect.gen(function* () {
    const effect3 = yield* Effect.gen(function* () {
      const svc3 = yield* MyService('effect3')
    })
  })
}).pipe(
  Effect.provide(MyService.provideTo('effect1', impl1)),
  Effect.provide(MyService.provideTo('root', implRoot),
  Effect.provide(MyService.layer) // default
)


can it be achieved in typesafe manner?
Was this page helpful?