diff --git "a/.opencode/node_modules/effect/src/Effect.ts" "b/.opencode/node_modules/effect/src/Effect.ts"
--- "a/.opencode/node_modules/effect/src/Effect.ts"
+++ "b/.opencode/node_modules/effect/src/Effect.ts"
@@ -1,70 +1,12 @@
/**
- * The `Effect` module is the core of the Effect library, providing a powerful and expressive
- * way to model and compose asynchronous, concurrent, and effectful computations.
+ * Describes workflows that run only when executed by the Effect runtime.
*
- * An `Effect` represents a computation that:
- * - May succeed with a value of type `A`
- * - May fail with an error of type `E`
- * - Requires a context/environment of type `R`
- *
- * Effects are lazy and immutable - they describe computations that can be executed later.
- * This allows for powerful composition, error handling, resource management, and concurrency
- * patterns.
- *
- * ## Key Features
- *
- * - **Type-safe error handling**: Errors are tracked in the type system
- * - **Resource management**: Automatic cleanup with scoped resources
- * - **Structured concurrency**: Safe parallel and concurrent execution
- * - **Composable**: Effects can be combined using operators like `flatMap`, `map`, `zip`
- * - **Testable**: Built-in support for testing with controlled environments
- * - **Interruptible**: Effects can be safely interrupted and cancelled
- *
- * @example
- * ```ts
- * import { Console, Effect } from "effect"
- *
- * // Creating a simple effect
- * const hello = Effect.succeed("Hello, World!")
- *
- * // Composing effects
- * const program = Effect.gen(function*() {
- * const message = yield* hello
- * yield* Console.log(message)
- * return message.length
- * })
- *
- * // Running the effect
- * Effect.runPromise(program).then(console.log) // 13
- * ```
- *
- * @example
- * ```ts
- * import { Data, Effect } from "effect"
- *
- * class DiscountRateError extends Data.TaggedError("DiscountRateError")<{}> {}
- *
- * // Effect that may fail
- * const divide = (a: number, b: number) =>
- * b === 0
- * ? Effect.fail(new DiscountRateError())
- * : Effect.succeed(a / b)
- *
- * // Error handling
- * const program = Effect.gen(function*() {
- * const result = yield* divide(10, 2)
- * console.log("Result:", result) // Result: 5
- * return result
- * })
- *
- * // Handle errors
- * const safeProgram = program.pipe(
- * Effect.match({
- * onFailure: (error) => -1,
- * onSuccess: (value) => value
- * })
- * )
- * ```
+ * An `Effect` can succeed with an `A`, fail with an `E`, and require
+ * services `R`. Creating an effect does not perform the work; it builds a value
+ * that can be composed, provided with services, retried, interrupted, run
+ * concurrently, or inspected by the runtime. This module is the main API for
+ * creating effects, combining them, handling failures, managing resources, and
+ * running effect programs.
*
* @since 2.0.0
*/
@@ -129,15 +71,36 @@ import type {
unassigned
} from "./Types.ts"
import type * as Unify from "./Unify.ts"
-import { internalCall, SingleShotGen } from "./Utils.ts"
+import { internalCall } from "./Utils.ts"
-const TypeId = core.EffectTypeId
+/**
+ * Type-level identifier for `Effect` values.
+ *
+ * @category type IDs
+ * @since 4.0.0
+ */
+export type TypeId = "~effect/Effect"
+
+/**
+ * Runtime identifier used to recognize `Effect` values.
+ *
+ * @category type IDs
+ * @since 4.0.0
+ */
+export const TypeId: TypeId = core.EffectTypeId
/**
* The `Effect` interface defines a value that lazily describes a workflow or
* job. The workflow requires some context `R`, and may fail with an error of
* type `E`, or succeed with a value of type `A`.
*
+ * **When to use**
+ *
+ * Use when you need to represent a lazy, composable workflow that can require
+ * services, fail with a typed error, or succeed with a typed value.
+ *
+ * **Details**
+ *
* `Effect` values model resourceful interaction with the outside world,
* including synchronous, asynchronous, concurrent, and parallel interaction.
* They use a fiber-based concurrency model, with built-in support for
@@ -147,96 +110,22 @@ const TypeId = core.EffectTypeId
* To run an `Effect` value, you need a `Runtime`, which is a type that is
* capable of executing `Effect` values.
*
- * @example
- * ```ts
- * import { Data, Effect } from "effect"
- *
- * class TaskError extends Data.TaggedError("TaskError")<{ readonly message: string }> {}
- *
- * // A simple effect that succeeds with a value
- * const success = Effect.succeed(42)
- *
- * // An effect that will always fail
- * const risky = Effect.fail(new TaskError({ message: "Something went wrong" }))
- *
- * // Effects can be composed using generator functions
- * const program = Effect.gen(function*() {
- * const value = yield* success
- * console.log(value) // 42
- * return value * 2
- * })
- * ```
- *
+ * @category models
* @since 2.0.0
- * @category Models
*/
-export interface Effect
- extends Pipeable, Inspectable, Yieldable, A, E, R>
-{
+export interface Effect extends Pipeable, Inspectable {
readonly [TypeId]: Variance
+ [Symbol.iterator](): EffectIterator>
[Unify.typeSymbol]?: unknown
[Unify.unifySymbol]?: EffectUnify
[Unify.ignoreSymbol]?: {}
}
/**
- * A type that can be yielded in an Effect generator function.
- *
- * The `Yieldable` interface allows values to be used with the `yield*` syntax
- * in Effect generator functions, providing a clean way to sequence effectful operations.
- *
- * @example
- * ```ts
- * import { Effect } from "effect"
+ * Type-level unification support for `Effect` values.
*
- * // Effects implement Yieldable and can be used with yield*
- * const effect1 = Effect.succeed(10)
- * const effect2 = Effect.succeed(20)
- *
- * const program = Effect.gen(function*() {
- * const a = yield* effect1 // yields the Effect which implements Yieldable
- * const b = yield* effect2
- * return a + b
- * })
- *
- * Effect.runPromise(program).then(console.log) // 30
- * ```
- *
- * @since 4.0.0
- * @category Yieldable
- */
-export interface Yieldable<
- out Self extends Yieldable,
- out A,
- out E = never,
- out R = never
-> {
- asEffect(): Effect
- [Symbol.iterator](): EffectIterator
-}
-
-/**
- * @since 4.0.0
- * @category Yieldable
- */
-export abstract class YieldableClass implements Yieldable {
- [Symbol.iterator](): EffectIterator {
- return new SingleShotGen(this) as any
- }
- abstract asEffect(): Effect
-}
-
-/**
- * @category Models
+ * @category models
* @since 2.0.0
- * @example
- * ```ts
- * import type { Effect } from "effect"
- *
- * // EffectUnify is used internally for type unification
- * // It enables automatic unification of Effect types in unions
- * declare const unified: Effect.EffectUnify
- * ```
*/
export interface EffectUnify {
Effect?: () => A[Unify.typeSymbol] extends
@@ -246,16 +135,10 @@ export interface EffectUnify {
}
/**
- * @category Type Lambdas
- * @since 2.0.0
- * @example
- * ```ts
- * import type { Effect } from "effect"
+ * Type lambda used to represent `Effect` in higher-kinded APIs.
*
- * // EffectTypeLambda is used for higher-kinded type operations
- * // It defines the type structure for Effect in higher-kinded contexts
- * declare const lambda: Effect.EffectTypeLambda
- * ```
+ * @category type lambdas
+ * @since 2.0.0
*/
export interface EffectTypeLambda extends TypeLambda {
readonly type: Effect
@@ -264,8 +147,8 @@ export interface EffectTypeLambda extends TypeLambda {
/**
* Variance interface for Effect, encoding the type parameters' variance.
*
+ * @category models
* @since 2.0.0
- * @category Models
*/
export interface Variance {
_A: Covariant
@@ -274,82 +157,65 @@ export interface Variance {
}
/**
- * @since 2.0.0
- * @category Models
- * @example
- * ```ts
- * import type { Effect } from "effect"
+ * Extracts the success type from an `Effect`.
*
- * // Extract the success type from an Effect
- * declare const myEffect: Effect.Effect
- * // This type utility extracts the success type A from Effect
- * ```
+ * **When to use**
+ *
+ * Use to derive the value produced by an existing effect when declaring
+ * reusable type aliases, service interfaces, or function signatures.
+ *
+ * @see {@link Error} for extracting the failure type from the same `Effect`
+ * @see {@link Services} for extracting the required services from the same `Effect`
+ *
+ * @category models
+ * @since 2.0.0
*/
export type Success = T extends Effect ? _A
: never
/**
- * @since 2.0.0
- * @category Models
- * @example
- * ```ts
- * import type { Effect } from "effect"
+ * Extracts the error type from an `Effect`.
*
- * // Extract the error type from an Effect
- * declare const myEffect: Effect.Effect
- * // This type utility extracts the error type E from Effect
- * ```
+ * **When to use**
+ *
+ * Use to derive the error type from an existing `Effect` type when declaring
+ * helper types, wrappers, or APIs that preserve the effect's failure channel.
+ *
+ * **Details**
+ *
+ * Non-`Effect` inputs resolve to `never`.
+ *
+ * @see {@link Success} for extracting the success value type instead
+ * @see {@link Services} for extracting the required services type instead
+ *
+ * @category models
+ * @since 2.0.0
*/
export type Error = T extends Effect ? _E
: never
/**
- * @since 2.0.0
- * @category Models
- * @example
- * ```ts
- * import type { Effect } from "effect"
+ * Extracts the required services type from an `Effect`.
*
- * // Extract the context/services type from an Effect
- * declare const myEffect: Effect.Effect
- * // This type utility extracts the context type R from Effect
- * ```
+ * **When to use**
+ *
+ * Use to derive the context requirements of a generic or inferred `Effect`
+ * without restating its `R` type parameter.
+ *
+ * @see {@link Success} for extracting the success value type instead
+ * @see {@link Error} for extracting the failure type instead
+ *
+ * @category models
+ * @since 4.0.0
*/
export type Services = T extends Effect ? _R
: never
/**
- * Namespace containing type utilities for Yieldable values.
+ * Checks whether a value is an `Effect`.
*
- * @since 4.0.0
- * @category Yieldable
- */
-export declare namespace Yieldable {
- /**
- * @since 4.0.0
- * @category Yieldable
- */
- export type Any = Yieldable
-
- /**
- * @since 4.0.0
- * @category Yieldable
- * @example
- * ```ts
- * import type { Effect } from "effect"
- *
- * // Extract the success type from a Yieldable
- * type SuccessType = Effect.Yieldable.Success> // string
- * ```
- */
- export type Success = T extends Yieldable ? _A
- : never
-}
-
-/**
- * Tests if a value is an `Effect`.
+ * **Example** (Checking whether a value is an Effect)
*
- * @example
* ```ts
* import { Effect } from "effect"
*
@@ -357,37 +223,28 @@ export declare namespace Yieldable {
* console.log(Effect.isEffect("hello")) // false
* ```
*
+ * @category guards
* @since 2.0.0
- * @category Guards
*/
export const isEffect: (u: unknown) => u is Effect = core.isEffect
/**
* Iterator interface for Effect generators, enabling Effect values to work with generator functions.
*
- * @example
- * ```ts
- * import { Effect } from "effect"
+ * **When to use**
*
- * // Effects are iterable and work with generator functions
- * const program = Effect.gen(function*() {
- * const effect: Effect.Effect = Effect.succeed(42)
+ * Use when defining or typing `[Symbol.iterator]()` for values typed as
+ * `Effect`s so `yield*` can pass their success type back into `Effect.gen`.
*
- * // The effect's iterator is used internally by yield*
- * const result = yield* effect
- * return result * 2
- * })
+ * @see {@link gen} for writing generator-based `Effect` programs that consume this iterator protocol
*
- * Effect.runPromise(program).then(console.log) // 84
- * ```
- *
- * @since 2.0.0
- * @category Models
+ * @category models
+ * @since 4.0.0
*/
-export interface EffectIterator> {
+export interface EffectIterator> {
next(
...args: ReadonlyArray
- ): IteratorResult>
+ ): IteratorResult>
}
// ========================================================================
@@ -398,59 +255,22 @@ export interface EffectIterator> {
* Namespace containing type utilities for the `Effect.all` function, which handles
* collecting multiple effects into various output structures.
*
- * @example
- * ```ts
- * import { Effect } from "effect"
- *
- * // All namespace types are used when working with Effect.all
- * const effects = [
- * Effect.succeed(1),
- * Effect.succeed("hello"),
- * Effect.succeed(true)
- * ] as const
- *
- * const program = Effect.all(effects).pipe(
- * Effect.map(([num, str, bool]) => ({ num, str, bool }))
- * )
- *
- * Effect.runPromise(program).then(console.log) // { num: 1, str: "hello", bool: true }
- * ```
- *
* @since 2.0.0
- * @category Models
*/
export declare namespace All {
/**
- * @since 2.0.0
- * @category Models
- * @example
- * ```ts
- * import { Data, Effect } from "effect"
- *
- * class OopsError extends Data.TaggedError("OopsError")<{}> {}
+ * Alias for any `Effect` value accepted by `Effect.all`.
*
- * // EffectAny represents an Effect with any type parameters
- * const effects: Array = [
- * Effect.succeed(42),
- * Effect.succeed("hello"),
- * Effect.fail(new OopsError())
- * ]
- * ```
+ * @category utility types
+ * @since 2.0.0
*/
export type EffectAny = Effect
/**
- * @since 2.0.0
- * @category Models
- * @example
- * ```ts
- * import type { Effect } from "effect"
+ * Computes the return type for `Effect.all` when collecting an iterable.
*
- * // ReturnIterable computes the return type for Effect.all with iterables
- * type EffectArray = Array>
- * type Result = Effect.All.ReturnIterable
- * // Result: Effect, string, never>
- * ```
+ * @category utility types
+ * @since 2.0.0
*/
export type ReturnIterable<
T extends Iterable,
@@ -464,20 +284,10 @@ export declare namespace All {
: never
/**
- * @since 2.0.0
- * @category Models
- * @example
- * ```ts
- * import type { Effect } from "effect"
+ * Computes the return type for `Effect.all` when collecting a tuple.
*
- * // ReturnTuple computes the return type for Effect.all with tuples
- * type EffectTuple = [
- * Effect.Effect,
- * Effect.Effect
- * ]
- * type Result = Effect.All.ReturnTuple
- * // Result: Effect<[string, number], Error, never>
- * ```
+ * @category utility types
+ * @since 2.0.0
*/
export type ReturnTuple<
T extends ReadonlyArray,
@@ -505,20 +315,10 @@ export declare namespace All {
: never
/**
- * @since 2.0.0
- * @category Models
- * @example
- * ```ts
- * import type { Effect } from "effect"
+ * Computes the return type for `Effect.all` when collecting a record.
*
- * // ReturnObject computes the return type for Effect.all with objects
- * type EffectRecord = {
- * a: Effect.Effect
- * b: Effect.Effect
- * }
- * type Result = Effect.All.ReturnObject
- * // Result: Effect<{ a: string, b: number }, Error, never>
- * ```
+ * @category utility types
+ * @since 2.0.0
*/
export type ReturnObject = [T] extends [
Record
@@ -541,18 +341,10 @@ export declare namespace All {
: never
/**
- * @since 2.0.0
- * @category Models
- * @example
- * ```ts
- * import type { Effect } from "effect"
+ * Detects whether `Effect.all` should discard collected values.
*
- * // IsDiscard checks if options have discard flag set to true
- * type DiscardOptions = { discard: true }
- * type NoDiscardOptions = { discard: false }
- * type WithDiscard = Effect.All.IsDiscard // true
- * type WithoutDiscard = Effect.All.IsDiscard // false
- * ```
+ * @category utility types
+ * @since 2.0.0
*/
export type IsDiscard = [Extract] extends [
never
@@ -560,24 +352,18 @@ export declare namespace All {
: true
/**
+ * Detects whether `Effect.all` should collect results in `Result` mode.
+ *
+ * @category utility types
* @since 4.0.0
- * @category Models
*/
export type IsResult = [Extract] extends [never] ? false : true
/**
- * @since 2.0.0
- * @category Models
- * @example
- * ```ts
- * import type { Effect } from "effect"
+ * Computes the return type for `Effect.all` from its input and options.
*
- * // Return determines the result type based on input and options
- * type EffectArray = Array>
- * type Options = { discard: false }
- * type Result = Effect.All.Return
- * // Result: Effect, string, never>
- * ```
+ * @category utility types
+ * @since 2.0.0
*/
export type Return<
Arg extends Iterable | Record,
@@ -593,49 +379,30 @@ export declare namespace All {
}
/**
- * Combines multiple effects into one, returning results based on the input
- * structure.
- *
- * **Details**
- *
- * Use this function when you need to run multiple effects and combine their
- * results into a single output. It supports tuples, iterables, structs, and
- * records, making it flexible for different input types.
- *
- * For instance, if the input is a tuple:
+ * Combines an iterable or record of effects into one effect whose success shape
+ * follows the input.
*
- * ```ts skip-type-checking
- * // ┌─── a tuple of effects
- * // ▼
- * Effect.all([effect1, effect2, ...])
- * ```
- *
- * the effects are executed sequentially, and the result is a new effect
- * containing the results as a tuple. The results in the tuple match the order
- * of the effects passed to `Effect.all`.
+ * **When to use**
*
- * **Concurrency**
+ * Use to run a known collection of effects and collect results in the same
+ * tuple, iterable, or record shape.
*
- * You can control the execution order (e.g., sequential vs. concurrent) using
- * the `concurrency` option.
+ * **Details**
*
- * **Short-Circuiting Behavior**
+ * Tuple and iterable inputs collect results in order. Record inputs collect
+ * results under the same keys. By default, the combined effect fails on the
+ * first failure; with concurrent execution, effects that have already started
+ * may be interrupted, while effects not yet started are skipped.
*
- * This function stops execution on the first error it encounters, this is
- * called "short-circuiting". If any effect in the collection fails, the
- * remaining effects will not run, and the error will be propagated. To change
- * this behavior, you can use the `mode` option, which allows all effects to run
- * and collect every success / failure as `Result` values.
+ * Options:
*
- * **The `mode` option**
+ * Use `concurrency` to control sequential or concurrent execution. Use
+ * `mode: "result"` to run every effect and collect each success or failure as a
+ * `Result` in the same output shape. Use `discard: true` to ignore successful
+ * values and return `void`.
*
- * The `{ mode: "result" }` option changes the behavior of `Effect.all` to
- * ensure all effects run, even if some fail. Instead of stopping on the first
- * failure, this mode collects both successes and failures, returning an array
- * of `Result` instances where each result is either an `Ok` (success) or a
- * `Err` (failure).
+ * **Example** (Collecting tuple results in order)
*
- * @example Combining Effects in Tuples
* ```ts
* import { Console, Effect } from "effect"
*
@@ -655,7 +422,8 @@ export declare namespace All {
* // [ 42, 'Hello' ]
* ```
*
- * @example Combining Effects in Iterables
+ * **Example** (Collecting iterable results in order)
+ *
* ```ts
* import { Console, Effect } from "effect"
*
@@ -675,7 +443,8 @@ export declare namespace All {
* // [ 1, 2, 3 ]
* ```
*
- * @example Combining Effects in Structs
+ * **Example** (Collecting struct results by key)
+ *
* ```ts
* import { Console, Effect } from "effect"
*
@@ -695,7 +464,8 @@ export declare namespace All {
* // { a: 42, b: 'Hello' }
* ```
*
- * @example Combining Effects in Records
+ * **Example** (Collecting record results by key)
+ *
* ```ts
* import { Console, Effect } from "effect"
*
@@ -715,7 +485,8 @@ export declare namespace All {
* // { key1: 1, key2: 2 }
* ```
*
- * @example Short-Circuiting Behavior
+ * **Example** (Stopping on the first failure)
+ *
* ```ts
* import { Console, Effect } from "effect"
*
@@ -737,9 +508,8 @@ export declare namespace All {
* ```
*
* @see {@link forEach} for iterating over elements and applying an effect.
- *
+ * @category collecting
* @since 2.0.0
- * @category Collecting
*/
export const all: <
const Arg extends
@@ -759,15 +529,16 @@ export const all: <
* Applies an effectful function to each element and partitions failures and
* successes.
*
- * The returned tuple is `[excluded, satisfying]`, where:
+ * **Details**
*
- * - `excluded` contains all failures.
- * - `satisfying` contains all successes.
+ * The returned tuple is `[excluded, satisfying]`, where `excluded` contains
+ * all failures and `satisfying` contains all successes.
*
* This function runs every effect and never fails. Use `concurrency` to control
* parallelism.
*
- * @example
+ * **Example** (Separating successes and failures)
+ *
* ```ts
* import { Effect } from "effect"
*
@@ -779,23 +550,24 @@ export const all: <
* // [ ["0 is even", "2 is even"], [1, 3] ]
* ```
*
- * @since 3.0.0
- * @category Collecting
+ * @category collecting
+ * @since 2.0.0
*/
export const partition: {
/**
* Applies an effectful function to each element and partitions failures and
* successes.
*
- * The returned tuple is `[excluded, satisfying]`, where:
+ * **Details**
*
- * - `excluded` contains all failures.
- * - `satisfying` contains all successes.
+ * The returned tuple is `[excluded, satisfying]`, where `excluded` contains
+ * all failures and `satisfying` contains all successes.
*
* This function runs every effect and never fails. Use `concurrency` to control
* parallelism.
*
- * @example
+ * **Example** (Separating successes and failures)
+ *
* ```ts
* import { Effect } from "effect"
*
@@ -807,8 +579,8 @@ export const partition: {
* // [ ["0 is even", "2 is even"], [1, 3] ]
* ```
*
- * @since 3.0.0
- * @category Collecting
+ * @category collecting
+ * @since 2.0.0
*/
(
f: (a: A, i: number) => Effect,
@@ -818,15 +590,16 @@ export const partition: {
* Applies an effectful function to each element and partitions failures and
* successes.
*
- * The returned tuple is `[excluded, satisfying]`, where:
+ * **Details**
*
- * - `excluded` contains all failures.
- * - `satisfying` contains all successes.
+ * The returned tuple is `[excluded, satisfying]`, where `excluded` contains
+ * all failures and `satisfying` contains all successes.
*
* This function runs every effect and never fails. Use `concurrency` to control
* parallelism.
*
- * @example
+ * **Example** (Separating successes and failures)
+ *
* ```ts
* import { Effect } from "effect"
*
@@ -838,8 +611,8 @@ export const partition: {
* // [ ["0 is even", "2 is even"], [1, 3] ]
* ```
*
- * @since 3.0.0
- * @category Collecting
+ * @category collecting
+ * @since 2.0.0
*/
(
elements: Iterable,
@@ -851,6 +624,8 @@ export const partition: {
/**
* Applies an effectful function to each element and accumulates all failures.
*
+ * **Details**
+ *
* This function always evaluates every element. If at least one effect fails,
* all failures are returned as a non-empty array and successes are discarded.
* If all effects succeed, it returns all collected successes.
@@ -858,7 +633,8 @@ export const partition: {
* Use `discard: true` to ignore successful values while still validating all
* elements.
*
- * @example
+ * **Example** (Validating every element)
+ *
* ```ts
* import { Effect } from "effect"
*
@@ -880,13 +656,15 @@ export const partition: {
* // }
* ```
*
- * @since 4.0.0
- * @category Error Accumulation
+ * @category error accumulation
+ * @since 2.0.0
*/
export const validate: {
/**
* Applies an effectful function to each element and accumulates all failures.
*
+ * **Details**
+ *
* This function always evaluates every element. If at least one effect fails,
* all failures are returned as a non-empty array and successes are discarded.
* If all effects succeed, it returns all collected successes.
@@ -894,7 +672,8 @@ export const validate: {
* Use `discard: true` to ignore successful values while still validating all
* elements.
*
- * @example
+ * **Example** (Validating every element)
+ *
* ```ts
* import { Effect } from "effect"
*
@@ -916,8 +695,8 @@ export const validate: {
* // }
* ```
*
- * @since 4.0.0
- * @category Error Accumulation
+ * @category error accumulation
+ * @since 2.0.0
*/
(
f: (a: A, i: number) => Effect,
@@ -929,6 +708,8 @@ export const validate: {
/**
* Applies an effectful function to each element and accumulates all failures.
*
+ * **Details**
+ *
* This function always evaluates every element. If at least one effect fails,
* all failures are returned as a non-empty array and successes are discarded.
* If all effects succeed, it returns all collected successes.
@@ -936,7 +717,8 @@ export const validate: {
* Use `discard: true` to ignore successful values while still validating all
* elements.
*
- * @example
+ * **Example** (Validating every element)
+ *
* ```ts
* import { Effect } from "effect"
*
@@ -958,8 +740,8 @@ export const validate: {
* // }
* ```
*
- * @since 4.0.0
- * @category Error Accumulation
+ * @category error accumulation
+ * @since 2.0.0
*/
(
f: (a: A, i: number) => Effect,
@@ -971,6 +753,8 @@ export const validate: {
/**
* Applies an effectful function to each element and accumulates all failures.
*
+ * **Details**
+ *
* This function always evaluates every element. If at least one effect fails,
* all failures are returned as a non-empty array and successes are discarded.
* If all effects succeed, it returns all collected successes.
@@ -978,7 +762,8 @@ export const validate: {
* Use `discard: true` to ignore successful values while still validating all
* elements.
*
- * @example
+ * **Example** (Validating every element)
+ *
* ```ts
* import { Effect } from "effect"
*
@@ -1000,8 +785,8 @@ export const validate: {
* // }
* ```
*
- * @since 4.0.0
- * @category Error Accumulation
+ * @category error accumulation
+ * @since 2.0.0
*/
(
elements: Iterable,
@@ -1014,6 +799,8 @@ export const validate: {
/**
* Applies an effectful function to each element and accumulates all failures.
*
+ * **Details**
+ *
* This function always evaluates every element. If at least one effect fails,
* all failures are returned as a non-empty array and successes are discarded.
* If all effects succeed, it returns all collected successes.
@@ -1021,7 +808,8 @@ export const validate: {
* Use `discard: true` to ignore successful values while still validating all
* elements.
*
- * @example
+ * **Example** (Validating every element)
+ *
* ```ts
* import { Effect } from "effect"
*
@@ -1043,8 +831,8 @@ export const validate: {
* // }
* ```
*
- * @since 4.0.0
- * @category Error Accumulation
+ * @category error accumulation
+ * @since 2.0.0
*/
(
elements: Iterable,
@@ -1059,10 +847,13 @@ export const validate: {
/**
* Returns the first element that satisfies an effectful predicate.
*
+ * **Details**
+ *
* The predicate receives the element and its index. Evaluation short-circuits
* as soon as an element matches.
*
- * @example
+ * **Example** (Finding the first successful match)
+ *
* ```ts
* import { Effect } from "effect"
*
@@ -1072,17 +863,20 @@ export const validate: {
* // { _id: 'Option', _tag: 'Some', value: 3 }
* ```
*
+ * @category collecting
* @since 2.0.0
- * @category Collecting
*/
export const findFirst: {
/**
* Returns the first element that satisfies an effectful predicate.
*
+ * **Details**
+ *
* The predicate receives the element and its index. Evaluation short-circuits
* as soon as an element matches.
*
- * @example
+ * **Example** (Finding the first successful match)
+ *
* ```ts
* import { Effect } from "effect"
*
@@ -1092,17 +886,20 @@ export const findFirst: {
* // { _id: 'Option', _tag: 'Some', value: 3 }
* ```
*
+ * @category collecting
* @since 2.0.0
- * @category Collecting
*/
(predicate: (a: NoInfer, i: number) => Effect): (elements: Iterable) => Effect