Effectable
Low-level helpers for making custom values behave like Effects. The module
exposes a prototype builder and an abstract base class that let
domain-specific values, such as service keys or configuration descriptions,
be evaluated by Effect and yielded inside Effect.gen.
Constructors
Provides an abstract class that can be extended to create an Effect.
When to use
Use as an abstract base class to define custom classes whose instances behave
as Effect values.
See
- Prototype for a lower-level primitive approach to creating custom Effect-like values without a class
Signature
declare class Class<A, E = never, R = never> extends Base<A, E, R> { constructor<A, E = never, R = never>(); abstract override: Effect<A, E, R>;}Prototypes
Create a low-level Effect prototype.
When to use
Use when you need to create a custom Effect-like value without extending a class, by providing a label and an evaluate function that receives the current fiber.
Details
When the effect is evaluated, it calls evaluate with the current fiber.
See
- Class for a class-based approach to defining custom Effect values
Signature
declare function Prototype<A extends Effect<any, any, any>>(options: { readonly evaluate: (this: A, fiber: Fiber<any, any>) => Effect<Success<A>, Error<A>, Services<A>>; readonly label: string;}): Effect<Success<A>, Error<A>, Services<A>>