Hyperlinkv0.8.0-beta.28

Effectable

Effectable.Prototypeconsteffect/Effectable.ts:31
<A extends Effect.Effect<any, any, any>>(options: {
  readonly label: string
  readonly evaluate: (
    this: A,
    fiber: Fiber.Fiber<any, any>
  ) => Effect.Effect<
    Effect.Success<A>,
    Effect.Error<A>,
    Effect.Services<A>
  >
}): Effect.Effect<Effect.Success<A>, Effect.Error<A>, Effect.Services<A>>

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.

prototypesClass
export const Prototype = <A extends Effect.Effect<any, any, any>>(options: {
  readonly label: string
  readonly evaluate: (
    this: A,
    fiber: Fiber.Fiber<any, any>
  ) => Effect.Effect<Effect.Success<A>, Effect.Error<A>, Effect.Services<A>>
}): Effect.Effect<Effect.Success<A>, Effect.Error<A>, Effect.Services<A>> =>
  makePrimitiveProto({
    op: options.label,
    [evaluate]: options.evaluate
  }) as any
Referenced by 1 symbols