export const CalendarServiceLayerMap = LayerMap.Service<CalendarServiceLayerMap>()(
'CalendarServiceLayerMap',
{
layers: {
outlook: OutlookCalendarServiceLayer,
google: GoogleCalendarServiceLayer,
},
},
)
const listCalendars = Effect.gen(function(){
const calendar = yield* CalendarService
return yield* calendar.listCalendars()
})
const program = Effect.gen(function*() {
const googleCalendars = yield* listCalendars.pipe(Effect.provide(CalendarServiceLayerMap.get('google')))
const outlookCalendars = yield* listCalendars.pipe(Effect.provide(CalendarServiceLayerMap.get('outlook')))
console.log([...googleCalendars, ...outlookCalendars])
}).pipe(Effect.provide(CalendarServiceLayerMap.Default))
export const CalendarServiceLayerMap = LayerMap.Service<CalendarServiceLayerMap>()(
'CalendarServiceLayerMap',
{
layers: {
outlook: OutlookCalendarServiceLayer,
google: GoogleCalendarServiceLayer,
},
},
)
const listCalendars = Effect.gen(function(){
const calendar = yield* CalendarService
return yield* calendar.listCalendars()
})
const program = Effect.gen(function*() {
const googleCalendars = yield* listCalendars.pipe(Effect.provide(CalendarServiceLayerMap.get('google')))
const outlookCalendars = yield* listCalendars.pipe(Effect.provide(CalendarServiceLayerMap.get('outlook')))
console.log([...googleCalendars, ...outlookCalendars])
}).pipe(Effect.provide(CalendarServiceLayerMap.Default))