import { Context, Effect, Layer } from 'effect'; import type { HarnessHook } from '../HarnessHook.ts'; export namespace HookSet { export interface Interface { readonly all: Effect.Effect>; } export class Service extends Context.Service()( 'pi-harness-kit/kernel/HookSet' ) {} export const empty = Layer.succeed( Service, Service.of({ all: Effect.succeed([]) }) ); export const of = (hooks: ReadonlyArray) => Layer.succeed(Service, Service.of({ all: Effect.succeed(hooks) })); export const fromEffect = ( build: Effect.Effect, E, R> ) => Layer.effect( Service, Effect.map(build, (hooks) => Service.of({ all: Effect.succeed(hooks) })) ); }