const makeX = <T, A, R extends Context.Tag<any, T>>(r: R) => <E>(eff: Effect.Effect<A, E, R | SomeOther>) => (event: T, other: String) => eff.pipe(
Effect.provide(SomeOther, other),
Effect.provide(r, event),
Effect.runPromise
)
// usage:
class Event extends Context.Tag('@foobar/some-event')<
Event,
number
>() {}
const x = makeX(Event)
const handler = Event.pipe(Effect.flatMap(Effect.logInfo))
handler(2, 'foobar') // should log out 2
const makeX = <T, A, R extends Context.Tag<any, T>>(r: R) => <E>(eff: Effect.Effect<A, E, R | SomeOther>) => (event: T, other: String) => eff.pipe(
Effect.provide(SomeOther, other),
Effect.provide(r, event),
Effect.runPromise
)
// usage:
class Event extends Context.Tag('@foobar/some-event')<
Event,
number
>() {}
const x = makeX(Event)
const handler = Event.pipe(Effect.flatMap(Effect.logInfo))
handler(2, 'foobar') // should log out 2