class A extends Context.Tag("A")<A, {}>() {
static layer = Layer.succeed(this, {})
}
class B extends Context.Tag("B")<B, {}>() {
static layer = Layer.succeed(this, {})
}
class C extends Context.Tag("C")<C, {}>() {}
const builder = (rt: Runtime.Runtime<A | B | C>) => {
return () => Effect.gen(function*(){
const a = yield* A
const b = yield* B
const c = yield* C
}).pipe(rt.runPromise)
})
class TheService extends Effect.Service<TheService>()(
"TheService",
{
dependencies: [
A.layer,
B.layer
],
effect: Effect.gen(function*() {
const runtime = yield* Effect.runtime<
| A
| B
>()
const buildThings = Effect.fn("buildThings")(function*() {
// Here is where I need to build the C service
return { x: builder(runtime) }
})
return { buildThings }
})
}
) {}
class A extends Context.Tag("A")<A, {}>() {
static layer = Layer.succeed(this, {})
}
class B extends Context.Tag("B")<B, {}>() {
static layer = Layer.succeed(this, {})
}
class C extends Context.Tag("C")<C, {}>() {}
const builder = (rt: Runtime.Runtime<A | B | C>) => {
return () => Effect.gen(function*(){
const a = yield* A
const b = yield* B
const c = yield* C
}).pipe(rt.runPromise)
})
class TheService extends Effect.Service<TheService>()(
"TheService",
{
dependencies: [
A.layer,
B.layer
],
effect: Effect.gen(function*() {
const runtime = yield* Effect.runtime<
| A
| B
>()
const buildThings = Effect.fn("buildThings")(function*() {
// Here is where I need to build the C service
return { x: builder(runtime) }
})
return { buildThings }
})
}
) {}