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