effect 3.12.7 → 3.12.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (117) hide show
  1. package/dist/cjs/BigDecimal.js +1 -1
  2. package/dist/cjs/BigDecimal.js.map +1 -1
  3. package/dist/cjs/Cause.js +630 -167
  4. package/dist/cjs/Cause.js.map +1 -1
  5. package/dist/cjs/Chunk.js +4 -8
  6. package/dist/cjs/Chunk.js.map +1 -1
  7. package/dist/cjs/ConfigProvider.js +1 -0
  8. package/dist/cjs/ConfigProvider.js.map +1 -1
  9. package/dist/cjs/Cron.js +26 -10
  10. package/dist/cjs/Cron.js.map +1 -1
  11. package/dist/cjs/Duration.js +7 -4
  12. package/dist/cjs/Duration.js.map +1 -1
  13. package/dist/cjs/Effect.js.map +1 -1
  14. package/dist/cjs/Either.js +5 -24
  15. package/dist/cjs/Either.js.map +1 -1
  16. package/dist/cjs/Layer.js.map +1 -1
  17. package/dist/cjs/Option.js +1042 -363
  18. package/dist/cjs/Option.js.map +1 -1
  19. package/dist/cjs/ParseResult.js +41 -18
  20. package/dist/cjs/ParseResult.js.map +1 -1
  21. package/dist/cjs/Schedule.js +8 -1
  22. package/dist/cjs/Schedule.js.map +1 -1
  23. package/dist/cjs/Schema.js +51 -10
  24. package/dist/cjs/Schema.js.map +1 -1
  25. package/dist/cjs/internal/cause.js +23 -108
  26. package/dist/cjs/internal/cause.js.map +1 -1
  27. package/dist/cjs/internal/core.js +4 -5
  28. package/dist/cjs/internal/core.js.map +1 -1
  29. package/dist/cjs/internal/layer.js.map +1 -1
  30. package/dist/cjs/internal/schedule.js.map +1 -1
  31. package/dist/cjs/internal/secret.js +6 -5
  32. package/dist/cjs/internal/secret.js.map +1 -1
  33. package/dist/cjs/internal/stream.js +21 -23
  34. package/dist/cjs/internal/stream.js.map +1 -1
  35. package/dist/cjs/internal/version.js +1 -1
  36. package/dist/dts/BigDecimal.d.ts.map +1 -1
  37. package/dist/dts/Cause.d.ts +1157 -304
  38. package/dist/dts/Cause.d.ts.map +1 -1
  39. package/dist/dts/Chunk.d.ts +3 -6
  40. package/dist/dts/Chunk.d.ts.map +1 -1
  41. package/dist/dts/ConfigProvider.d.ts.map +1 -1
  42. package/dist/dts/Cron.d.ts +25 -9
  43. package/dist/dts/Cron.d.ts.map +1 -1
  44. package/dist/dts/Duration.d.ts +1 -1
  45. package/dist/dts/Duration.d.ts.map +1 -1
  46. package/dist/dts/Effect.d.ts +3 -2
  47. package/dist/dts/Effect.d.ts.map +1 -1
  48. package/dist/dts/Either.d.ts.map +1 -1
  49. package/dist/dts/Layer.d.ts +1 -1
  50. package/dist/dts/Layer.d.ts.map +1 -1
  51. package/dist/dts/Option.d.ts +2288 -784
  52. package/dist/dts/Option.d.ts.map +1 -1
  53. package/dist/dts/ParseResult.d.ts +4 -4
  54. package/dist/dts/ParseResult.d.ts.map +1 -1
  55. package/dist/dts/Schedule.d.ts +7 -0
  56. package/dist/dts/Schedule.d.ts.map +1 -1
  57. package/dist/dts/Schema.d.ts +15 -4
  58. package/dist/dts/Schema.d.ts.map +1 -1
  59. package/dist/dts/internal/core.d.ts.map +1 -1
  60. package/dist/dts/internal/stream.d.ts +1 -1
  61. package/dist/dts/internal/stream.d.ts.map +1 -1
  62. package/dist/esm/BigDecimal.js +1 -1
  63. package/dist/esm/BigDecimal.js.map +1 -1
  64. package/dist/esm/Cause.js +630 -167
  65. package/dist/esm/Cause.js.map +1 -1
  66. package/dist/esm/Chunk.js +4 -8
  67. package/dist/esm/Chunk.js.map +1 -1
  68. package/dist/esm/ConfigProvider.js +1 -0
  69. package/dist/esm/ConfigProvider.js.map +1 -1
  70. package/dist/esm/Cron.js +27 -11
  71. package/dist/esm/Cron.js.map +1 -1
  72. package/dist/esm/Duration.js +7 -4
  73. package/dist/esm/Duration.js.map +1 -1
  74. package/dist/esm/Effect.js.map +1 -1
  75. package/dist/esm/Either.js +5 -24
  76. package/dist/esm/Either.js.map +1 -1
  77. package/dist/esm/Layer.js.map +1 -1
  78. package/dist/esm/Option.js +1041 -363
  79. package/dist/esm/Option.js.map +1 -1
  80. package/dist/esm/ParseResult.js +41 -18
  81. package/dist/esm/ParseResult.js.map +1 -1
  82. package/dist/esm/Schedule.js +7 -0
  83. package/dist/esm/Schedule.js.map +1 -1
  84. package/dist/esm/Schema.js +51 -10
  85. package/dist/esm/Schema.js.map +1 -1
  86. package/dist/esm/internal/cause.js +22 -108
  87. package/dist/esm/internal/cause.js.map +1 -1
  88. package/dist/esm/internal/core.js +4 -5
  89. package/dist/esm/internal/core.js.map +1 -1
  90. package/dist/esm/internal/layer.js.map +1 -1
  91. package/dist/esm/internal/schedule.js.map +1 -1
  92. package/dist/esm/internal/secret.js +5 -4
  93. package/dist/esm/internal/secret.js.map +1 -1
  94. package/dist/esm/internal/stream.js +21 -23
  95. package/dist/esm/internal/stream.js.map +1 -1
  96. package/dist/esm/internal/version.js +1 -1
  97. package/package.json +1 -1
  98. package/src/BigDecimal.ts +1 -1
  99. package/src/Cause.ts +1158 -304
  100. package/src/Chunk.ts +8 -11
  101. package/src/ConfigProvider.ts +1 -0
  102. package/src/Cron.ts +28 -11
  103. package/src/Duration.ts +10 -5
  104. package/src/Effect.ts +5 -2
  105. package/src/Either.ts +11 -28
  106. package/src/Layer.ts +1 -1
  107. package/src/Option.ts +2314 -820
  108. package/src/ParseResult.ts +53 -29
  109. package/src/Schedule.ts +8 -0
  110. package/src/Schema.ts +68 -12
  111. package/src/internal/cause.ts +38 -137
  112. package/src/internal/core.ts +4 -5
  113. package/src/internal/layer.ts +1 -1
  114. package/src/internal/schedule.ts +7 -6
  115. package/src/internal/secret.ts +6 -4
  116. package/src/internal/stream.ts +24 -37
  117. package/src/internal/version.ts +1 -1
@@ -37,106 +37,197 @@ import type * as Stream from "./Stream.js";
37
37
  import type { Span } from "./Tracer.js";
38
38
  import type { Covariant, NoInfer } from "./Types.js";
39
39
  /**
40
+ * A unique symbol identifying the `Cause` type.
41
+ *
42
+ * **Details**
43
+ *
44
+ * This provides a symbol that helps identify instances of the `Cause` data
45
+ * type. This can be used for advanced operations such as refining types or
46
+ * building internal utilities that check whether an unknown value is a `Cause`.
47
+ *
48
+ * @see {@link isCause} Check if a value is a `Cause`
40
49
  * @since 2.0.0
41
- * @category symbols
50
+ * @category Symbols
42
51
  */
43
52
  export declare const CauseTypeId: unique symbol;
44
53
  /**
45
54
  * @since 2.0.0
46
- * @category symbols
55
+ * @category Symbols
47
56
  */
48
57
  export type CauseTypeId = typeof CauseTypeId;
49
58
  /**
59
+ * A unique symbol identifying the `RuntimeException` type.
60
+ *
61
+ * **Details**
62
+ *
63
+ * This provides a symbol that identifies a `RuntimeException`. This is
64
+ * typically used internally by the library to recognize checked exceptions that
65
+ * occur during runtime.
66
+ *
67
+ * @see {@link RuntimeException} Create or work with a `RuntimeException`
68
+ *
50
69
  * @since 2.0.0
51
- * @category symbols
70
+ * @category Symbols
52
71
  */
53
72
  export declare const RuntimeExceptionTypeId: unique symbol;
54
73
  /**
55
74
  * @since 2.0.0
56
- * @category symbols
75
+ * @category Symbols
57
76
  */
58
77
  export type RuntimeExceptionTypeId = typeof RuntimeExceptionTypeId;
59
78
  /**
79
+ * A unique symbol identifying the `InterruptedException` type.
80
+ *
81
+ * **Details**
82
+ *
83
+ * This provides a symbol that identifies an `InterruptedException`. This is
84
+ * typically used internally to recognize when a fiber has been interrupted,
85
+ * helping the framework handle interruption logic correctly.
86
+ *
87
+ * @see {@link InterruptedException} Create or work with an `InterruptedException`
88
+ *
60
89
  * @since 2.0.0
61
- * @category symbols
90
+ * @category Symbols
62
91
  */
63
92
  export declare const InterruptedExceptionTypeId: unique symbol;
64
93
  /**
65
94
  * @since 2.0.0
66
- * @category symbols
95
+ * @category Symbols
67
96
  */
68
97
  export type InterruptedExceptionTypeId = typeof InterruptedExceptionTypeId;
69
98
  /**
99
+ * A unique symbol identifying the `IllegalArgumentException` type.
100
+ *
101
+ * **Details**
102
+ *
103
+ * This provides a symbol that identifies an `IllegalArgumentException`. This is
104
+ * often used in scenarios where invalid arguments are supplied to methods that
105
+ * expect specific input.
106
+ *
107
+ * @see {@link IllegalArgumentException} Create or work with an `IllegalArgumentException`
108
+ *
70
109
  * @since 2.0.0
71
- * @category symbols
110
+ * @category Symbols
72
111
  */
73
112
  export declare const IllegalArgumentExceptionTypeId: unique symbol;
74
113
  /**
75
114
  * @since 2.0.0
76
- * @category symbols
115
+ * @category Symbols
77
116
  */
78
117
  export type IllegalArgumentExceptionTypeId = typeof IllegalArgumentExceptionTypeId;
79
118
  /**
119
+ * A unique symbol identifying the `NoSuchElementException` type.
120
+ *
121
+ * **Details**
122
+ *
123
+ * This provides a symbol that identifies a `NoSuchElementException`. It helps
124
+ * differentiate cases where a required element is missing within a data
125
+ * structure.
126
+ *
127
+ * @see {@link NoSuchElementException} Create or work with a `NoSuchElementException`
128
+ *
80
129
  * @since 2.0.0
81
- * @category symbols
130
+ * @category Symbols
82
131
  */
83
132
  export declare const NoSuchElementExceptionTypeId: unique symbol;
84
133
  /**
85
134
  * @since 2.0.0
86
- * @category symbols
135
+ * @category Symbols
87
136
  */
88
137
  export type NoSuchElementExceptionTypeId = typeof NoSuchElementExceptionTypeId;
89
138
  /**
139
+ * A unique symbol identifying the `InvalidPubSubCapacityException` type.
140
+ *
141
+ * **Details**
142
+ *
143
+ * This provides a symbol that identifies an `InvalidPubSubCapacityException`.
144
+ * It indicates an error related to an invalid capacity passed to a `PubSub`
145
+ * structure.
146
+ *
147
+ * @see {@link InvalidPubSubCapacityException} Create or work with an `InvalidPubSubCapacityException`
148
+ *
90
149
  * @since 2.0.0
91
- * @category symbols
150
+ * @category Symbols
92
151
  */
93
152
  export declare const InvalidPubSubCapacityExceptionTypeId: unique symbol;
94
153
  /**
95
154
  * @since 2.0.0
96
- * @category symbols
155
+ * @category Symbols
97
156
  */
98
157
  export type InvalidPubSubCapacityExceptionTypeId = typeof InvalidPubSubCapacityExceptionTypeId;
99
158
  /**
159
+ * A unique symbol identifying the `ExceededCapacityException` type.
160
+ *
161
+ * **Details**
162
+ *
163
+ * This provides a symbol that identifies an `ExceededCapacityException`. It
164
+ * denotes situations where a resource has exceeded its configured capacity
165
+ * limit.
166
+ *
167
+ * @see {@link ExceededCapacityException} Create or work with an `ExceededCapacityException`
168
+ *
100
169
  * @since 3.5.0
101
- * @category symbols
170
+ * @category Symbols
102
171
  */
103
172
  export declare const ExceededCapacityExceptionTypeId: unique symbol;
104
173
  /**
105
174
  * @since 3.5.0
106
- * @category symbols
175
+ * @category Symbols
107
176
  */
108
177
  export type ExceededCapacityExceptionTypeId = typeof ExceededCapacityExceptionTypeId;
109
178
  /**
179
+ * A unique symbol identifying the `TimeoutException` type.
180
+ *
181
+ * **Details**
182
+ *
183
+ * This provides a symbol that identifies a `TimeoutException`. It helps the
184
+ * framework recognize errors related to operations that fail to complete within
185
+ * a given timeframe.
186
+ *
187
+ * @see {@link TimeoutException} Create or work with a `TimeoutException`
188
+ *
110
189
  * @since 2.0.0
111
- * @category symbols
190
+ * @category Symbols
112
191
  */
113
192
  export declare const TimeoutExceptionTypeId: unique symbol;
114
193
  /**
115
194
  * @since 2.0.0
116
- * @category symbols
195
+ * @category Symbols
117
196
  */
118
197
  export type TimeoutExceptionTypeId = typeof TimeoutExceptionTypeId;
119
198
  /**
199
+ * A unique symbol identifying the `UnknownException` type.
200
+ *
201
+ * **Details**
202
+ *
203
+ * This provides a symbol that identifies an `UnknownException`. It is typically
204
+ * used for generic or unexpected errors that do not fit other specific
205
+ * exception categories.
206
+ *
207
+ * @see {@link UnknownException} Create or work with an `UnknownException`
208
+ *
120
209
  * @since 2.0.0
121
- * @category symbols
210
+ * @category Symbols
122
211
  */
123
212
  export declare const UnknownExceptionTypeId: unique symbol;
124
213
  /**
125
214
  * @since 2.0.0
126
- * @category symbols
215
+ * @category Symbols
127
216
  */
128
217
  export type UnknownExceptionTypeId = typeof UnknownExceptionTypeId;
129
218
  /**
130
- * A `Cause` represents the full history of a failure resulting from running an
131
- * `Effect` workflow.
219
+ * Represents the full history of a failure within an `Effect`.
132
220
  *
133
- * Effect-TS uses a data structure from functional programming called a semiring
134
- * to represent the `Cause` data type. This allows us to take a base type `E`
135
- * (which represents the error type of an `Effect`) and capture the sequential
136
- * and parallel composition of errors in a fully lossless fashion.
221
+ * **Details**
222
+ *
223
+ * This type is a data structure that captures all information about why and how
224
+ * an effect has failed, including parallel errors, sequential errors, defects,
225
+ * and interruptions. It enables a "lossless" error model: no error-related
226
+ * information is discarded, which helps in debugging and understanding the root
227
+ * cause of failures.
137
228
  *
138
229
  * @since 2.0.0
139
- * @category models
230
+ * @category Models
140
231
  */
141
232
  export type Cause<E> = Empty | Fail<E> | Die | Interrupt | Sequential<E> | Parallel<E>;
142
233
  /**
@@ -144,8 +235,10 @@ export type Cause<E> = Empty | Fail<E> | Die | Interrupt | Sequential<E> | Paral
144
235
  */
145
236
  export declare namespace Cause {
146
237
  /**
238
+ * This interface is used internally to manage the type variance of `Cause`.
239
+ *
147
240
  * @since 2.0.0
148
- * @category models
241
+ * @category Models
149
242
  */
150
243
  interface Variance<out E> {
151
244
  readonly [CauseTypeId]: {
@@ -154,11 +247,21 @@ export declare namespace Cause {
154
247
  }
155
248
  }
156
249
  /**
157
- * Represents a set of methods that can be used to reduce a `Cause<E>` to a
158
- * specified value of type `Z` with access to a context of type `C`.
250
+ * Describes methods for reducing a `Cause<E>` into a value of type `Z` with
251
+ * access to contextual information.
252
+ *
253
+ * **Details**
254
+ *
255
+ * This interface is meant for advanced transformations of `Cause`. By
256
+ * implementing each method, you can define how different parts of the `Cause`
257
+ * structure (like `Fail`, `Die`, or `Interrupt`) should be transformed into a
258
+ * final type `Z`. The `context` parameter carries additional data needed during
259
+ * this reduction.
260
+ *
261
+ * @see {@link reduceWithContext} Apply a `CauseReducer` to transform a `Cause`
159
262
  *
160
263
  * @since 2.0.0
161
- * @category models
264
+ * @category Models
162
265
  */
163
266
  export interface CauseReducer<in C, in E, in out Z> {
164
267
  emptyCase(context: C): Z;
@@ -169,8 +272,10 @@ export interface CauseReducer<in C, in E, in out Z> {
169
272
  parallelCase(context: C, left: Z, right: Z): Z;
170
273
  }
171
274
  /**
275
+ * Represents an error object that can be yielded in `Effect.gen`.
276
+ *
172
277
  * @since 2.0.0
173
- * @category models
278
+ * @category Models
174
279
  */
175
280
  export interface YieldableError extends Pipeable, Inspectable, Readonly<Error> {
176
281
  readonly [Effect.EffectTypeId]: Effect.Effect.VarianceStruct<never, this, never>;
@@ -180,93 +285,117 @@ export interface YieldableError extends Pipeable, Inspectable, Readonly<Error> {
180
285
  [Symbol.iterator](): Effect.EffectGenerator<Effect.Effect<never, this, never>>;
181
286
  }
182
287
  /**
183
- * Represents a generic checked exception which occurs at runtime.
288
+ * Creates an error that occurs at runtime, extendable for other exception
289
+ * types.
184
290
  *
185
291
  * @since 2.0.0
186
- * @category errors
292
+ * @category Errors
187
293
  */
188
294
  export declare const YieldableError: new (message?: string | undefined) => YieldableError;
189
295
  /**
190
- * Represents a generic checked exception which occurs at runtime.
296
+ * An error representing a runtime error.
297
+ *
298
+ * **Details**
299
+ *
300
+ * This interface is used for errors that occur at runtime but are still
301
+ * considered recoverable or typed.
191
302
  *
192
303
  * @since 2.0.0
193
- * @category models
304
+ * @category Models
194
305
  */
195
306
  export interface RuntimeException extends YieldableError {
196
307
  readonly _tag: "RuntimeException";
197
308
  readonly [RuntimeExceptionTypeId]: RuntimeExceptionTypeId;
198
309
  }
199
310
  /**
200
- * Represents a checked exception which occurs when a `Fiber` is interrupted.
311
+ * An error representing fiber interruption.
312
+ *
313
+ * **Details**
314
+ *
315
+ * This interface represents errors that occur when a fiber is forcefully
316
+ * interrupted. Interruption can happen for various reasons, including
317
+ * cancellations or system directives to halt operations. Code that deals with
318
+ * concurrency might need to catch or handle these to ensure proper cleanup.
201
319
  *
202
320
  * @since 2.0.0
203
- * @category models
321
+ * @category Models
204
322
  */
205
323
  export interface InterruptedException extends YieldableError {
206
324
  readonly _tag: "InterruptedException";
207
325
  readonly [InterruptedExceptionTypeId]: InterruptedExceptionTypeId;
208
326
  }
209
327
  /**
210
- * Represents a checked exception which occurs when an invalid argument is
211
- * provided to a method.
328
+ * An error representing an invalid argument passed to a method.
329
+ *
330
+ * **Details**
331
+ *
332
+ * This interface is used for signaling that a function or method received an
333
+ * argument that does not meet its preconditions.
212
334
  *
213
335
  * @since 2.0.0
214
- * @category models
336
+ * @category Models
215
337
  */
216
338
  export interface IllegalArgumentException extends YieldableError {
217
339
  readonly _tag: "IllegalArgumentException";
218
340
  readonly [IllegalArgumentExceptionTypeId]: IllegalArgumentExceptionTypeId;
219
341
  }
220
342
  /**
221
- * Represents a checked exception which occurs when an expected element was
222
- * unable to be found.
343
+ * An error that occurs when an expected element is missing.
344
+ *
345
+ * **Details**
346
+ *
347
+ * This interface indicates scenarios like looking up an item in a collection
348
+ * or searching for data that should be present but isn't. It helps your code
349
+ * signal a more specific issue rather than a general error.
223
350
  *
224
351
  * @since 2.0.0
225
- * @category models
352
+ * @category Models
226
353
  */
227
354
  export interface NoSuchElementException extends YieldableError {
228
355
  readonly _tag: "NoSuchElementException";
229
356
  readonly [NoSuchElementExceptionTypeId]: NoSuchElementExceptionTypeId;
230
357
  }
231
358
  /**
232
- * Represents a checked exception which occurs when attempting to construct a
233
- * `PubSub` with an invalid capacity.
359
+ * An error indicating invalid capacity for a `PubSub`.
234
360
  *
235
361
  * @since 2.0.0
236
- * @category models
362
+ * @category Models
237
363
  */
238
364
  export interface InvalidPubSubCapacityException extends YieldableError {
239
365
  readonly _tag: "InvalidPubSubCapacityException";
240
366
  readonly [InvalidPubSubCapacityExceptionTypeId]: InvalidPubSubCapacityExceptionTypeId;
241
367
  }
242
368
  /**
243
- * Represents a checked exception which occurs when a resources capacity has
244
- * been exceeded.
369
+ * An error that occurs when resource capacity is exceeded.
245
370
  *
246
371
  * @since 3.5.0
247
- * @category models
372
+ * @category Models
248
373
  */
249
374
  export interface ExceededCapacityException extends YieldableError {
250
375
  readonly _tag: "ExceededCapacityException";
251
376
  readonly [ExceededCapacityExceptionTypeId]: ExceededCapacityExceptionTypeId;
252
377
  }
253
378
  /**
254
- * Represents a checked exception which occurs when a computation doesn't
255
- * finish on schedule.
379
+ * An error representing a computation that timed out.
256
380
  *
257
381
  * @since 2.0.0
258
- * @category models
382
+ * @category Models
259
383
  */
260
384
  export interface TimeoutException extends YieldableError {
261
385
  readonly _tag: "TimeoutException";
262
386
  readonly [TimeoutExceptionTypeId]: TimeoutExceptionTypeId;
263
387
  }
264
388
  /**
265
- * Represents a checked exception which occurs when an unknown error is thrown, such as
266
- * from a rejected promise.
389
+ * A checked exception for handling unknown or unexpected errors.
390
+ *
391
+ * **Details**
392
+ *
393
+ * This interface captures errors that don't fall under known categories. It is
394
+ * especially helpful for wrapping low-level or third-party library errors that
395
+ * might provide little or no context, such as from a rejected promise.
267
396
  *
268
397
  * @since 2.0.0
269
- * @category models
398
+ * @category Models
270
399
  */
271
400
  export interface UnknownException extends YieldableError {
272
401
  readonly _tag: "UnknownException";
@@ -274,60 +403,89 @@ export interface UnknownException extends YieldableError {
274
403
  readonly error: unknown;
275
404
  }
276
405
  /**
277
- * The `Empty` cause represents a lack of errors.
406
+ * Represents a lack of errors within a `Cause`.
407
+ *
408
+ * @see {@link empty} Construct a new `Empty` cause
409
+ * @see {@link isEmptyType} Check if a `Cause` is an `Empty` type
278
410
  *
279
411
  * @since 2.0.0
280
- * @category models
412
+ * @category Models
281
413
  */
282
414
  export interface Empty extends Cause.Variance<never>, Equal.Equal, Pipeable, Inspectable {
283
415
  readonly _tag: "Empty";
284
416
  }
285
417
  /**
286
- * The `Fail` cause represents a `Cause` which failed with an expected error of
287
- * type `E`.
418
+ * Represents an expected error within a `Cause`.
419
+ *
420
+ * **Details**
421
+ *
422
+ * This interface models a `Cause` that carries an expected or known error of
423
+ * type `E`. For example, if you validate user input and find it invalid, you
424
+ * might store that error within a `Fail`.
425
+ *
426
+ * @see {@link fail} Construct a `Fail` cause
427
+ * @see {@link isFailType} Check if a `Cause` is a `Fail`
288
428
  *
289
429
  * @since 2.0.0
290
- * @category models
430
+ * @category Models
291
431
  */
292
432
  export interface Fail<out E> extends Cause.Variance<E>, Equal.Equal, Pipeable, Inspectable {
293
433
  readonly _tag: "Fail";
294
434
  readonly error: E;
295
435
  }
296
436
  /**
297
- * The `Die` cause represents a `Cause` which failed as a result of a defect, or
298
- * in other words, an unexpected error.
437
+ * Represents an unexpected defect within a `Cause`.
438
+ *
439
+ * **Details**
440
+ *
441
+ * This interface models a `Cause` for errors that are typically unrecoverable or
442
+ * unanticipated—like runtime exceptions or bugs. When code "dies," it indicates a
443
+ * severe failure that wasn't accounted for.
444
+ *
445
+ * @see {@link die} Construct a `Die` cause
446
+ * @see {@link isDieType} Check if a `Cause` is a `Die`
299
447
  *
300
- * type `E`.
301
448
  * @since 2.0.0
302
- * @category models
449
+ * @category Models
303
450
  */
304
451
  export interface Die extends Cause.Variance<never>, Equal.Equal, Pipeable, Inspectable {
305
452
  readonly _tag: "Die";
306
453
  readonly defect: unknown;
307
454
  }
308
455
  /**
309
- * The `Interrupt` cause represents failure due to `Fiber` interruption, which
310
- * contains the `FiberId` of the interrupted `Fiber`.
456
+ * Represents fiber interruption within a `Cause`.
457
+ *
458
+ * **Details**
459
+ *
460
+ * This interface models a scenario where an effect was halted by an external
461
+ * signal, carrying a `FiberId` that identifies which fiber was interrupted.
462
+ * Interruption is a normal part of concurrency, used for cancellation or
463
+ * resource cleanup.
464
+ *
465
+ * @see {@link interrupt} Construct an `Interrupt` cause
466
+ * @see {@link isInterruptType} Check if a `Cause` is an `Interrupt`
311
467
  *
312
468
  * @since 2.0.0
313
- * @category models
469
+ * @category Models
314
470
  */
315
471
  export interface Interrupt extends Cause.Variance<never>, Equal.Equal, Pipeable, Inspectable {
316
472
  readonly _tag: "Interrupt";
317
473
  readonly fiberId: FiberId.FiberId;
318
474
  }
319
475
  /**
320
- * The `Parallel` cause represents the composition of two causes which occurred
321
- * in parallel.
476
+ * Represents parallel composition of two `Cause`s.
477
+ *
478
+ * **Details**
479
+ *
480
+ * This interface captures failures that happen simultaneously. In scenarios
481
+ * with concurrency, more than one operation can fail in parallel. Instead of
482
+ * losing information, this structure stores both errors together.
322
483
  *
323
- * In Effect-TS programs, it is possible that two operations may be performed in
324
- * parallel. In these cases, the `Effect` workflow can fail for more than one
325
- * reason. If both computations fail, then there are actually two errors which
326
- * occurred in parallel. In these cases, the errors can be represented by the
327
- * `Parallel` cause.
484
+ * @see {@link parallel} Combine two `Cause`s in parallel
485
+ * @see {@link isParallelType} Check if a `Cause` is a `Parallel`
328
486
  *
329
487
  * @since 2.0.0
330
- * @category models
488
+ * @category Models
331
489
  */
332
490
  export interface Parallel<out E> extends Cause.Variance<E>, Equal.Equal, Pipeable, Inspectable {
333
491
  readonly _tag: "Parallel";
@@ -335,16 +493,19 @@ export interface Parallel<out E> extends Cause.Variance<E>, Equal.Equal, Pipeabl
335
493
  readonly right: Cause<E>;
336
494
  }
337
495
  /**
338
- * The `Sequential` cause represents the composition of two causes which occurred
339
- * sequentially.
496
+ * Represents sequential composition of two `Cause`s.
340
497
  *
341
- * For example, if we perform Effect-TS's analog of `try-finally` (i.e.
342
- * `Effect.ensuring`), and both the `try` and `finally` blocks fail, we have two
343
- * errors which occurred sequentially. In these cases, the errors can be
344
- * represented by the `Sequential` cause.
498
+ * **Details**
499
+ *
500
+ * This interface models the scenario where one error follows another in
501
+ * sequence, such as when a main effect fails and then a finalizer also fails.
502
+ * It ensures both errors are retained in the final `Cause`.
503
+ *
504
+ * @see {@link sequential} Combine two `Cause`s sequentially
505
+ * @see {@link isSequentialType} Check if a `Cause` is a `Sequential`
345
506
  *
346
507
  * @since 2.0.0
347
- * @category models
508
+ * @category Models
348
509
  */
349
510
  export interface Sequential<out E> extends Cause.Variance<E>, Equal.Equal, Pipeable, Inspectable {
350
511
  readonly _tag: "Sequential";
@@ -352,488 +513,1000 @@ export interface Sequential<out E> extends Cause.Variance<E>, Equal.Equal, Pipea
352
513
  readonly right: Cause<E>;
353
514
  }
354
515
  /**
355
- * Constructs a new `Empty` cause.
516
+ * Creates an `Empty` cause.
517
+ *
518
+ * **Details**
519
+ *
520
+ * This function returns a cause that signifies "no error." It's commonly used
521
+ * to represent an absence of failure conditions.
522
+ *
523
+ * @see {@link isEmpty} Check if a `Cause` is empty
356
524
  *
357
525
  * @since 2.0.0
358
- * @category constructors
526
+ * @category Constructors
359
527
  */
360
528
  export declare const empty: Cause<never>;
361
529
  /**
362
- * Constructs a new `Fail` cause from the specified `error`.
530
+ * Creates a `Fail` cause from an expected error.
531
+ *
532
+ * **Details**
533
+ *
534
+ * This function constructs a `Cause` carrying an error of type `E`. It's used
535
+ * when you want to represent a known or anticipated failure in your effectful
536
+ * computations.
537
+ *
538
+ * @see {@link isFailure} Check if a `Cause` contains a failure
363
539
  *
364
540
  * @since 2.0.0
365
- * @category constructors
541
+ * @category Constructors
366
542
  */
367
543
  export declare const fail: <E>(error: E) => Cause<E>;
368
544
  /**
369
- * Constructs a new `Die` cause from the specified `defect`.
545
+ * Creates a `Die` cause from an unexpected error.
546
+ *
547
+ * **Details**
548
+ *
549
+ * This function wraps an unhandled or unknown defect (like a runtime crash)
550
+ * into a `Cause`. It's useful for capturing unforeseen issues in a structured
551
+ * way.
552
+ *
553
+ * @see {@link isDie} Check if a `Cause` contains a defect
370
554
  *
371
555
  * @since 2.0.0
372
- * @category constructors
556
+ * @category Constructors
373
557
  */
374
558
  export declare const die: (defect: unknown) => Cause<never>;
375
559
  /**
376
- * Constructs a new `Interrupt` cause from the specified `fiberId`.
560
+ * Creates an `Interrupt` cause from a `FiberId`.
561
+ *
562
+ * **Details**
563
+ *
564
+ * This function represents a fiber that has been interrupted. It stores the
565
+ * identifier of the interrupted fiber, enabling precise tracking of concurrent
566
+ * cancellations.
567
+ *
568
+ * @see {@link isInterrupted} Check if a `Cause` contains an interruption
377
569
  *
378
570
  * @since 2.0.0
379
- * @category constructors
571
+ * @category Constructors
380
572
  */
381
573
  export declare const interrupt: (fiberId: FiberId.FiberId) => Cause<never>;
382
574
  /**
383
- * Constructs a new `Parallel` cause from the specified `left` and `right`
384
- * causes.
575
+ * Combines two `Cause`s in parallel.
576
+ *
577
+ * **Details**
578
+ *
579
+ * This function merges two errors that occurred simultaneously. Instead of
580
+ * discarding one error, both are retained, allowing for richer error reporting
581
+ * and debugging.
582
+ *
583
+ * @see {@link isParallelType} Check if a `Cause` is a `Parallel`
385
584
  *
386
585
  * @since 2.0.0
387
- * @category constructors
586
+ * @category Constructors
388
587
  */
389
588
  export declare const parallel: <E, E2>(left: Cause<E>, right: Cause<E2>) => Cause<E | E2>;
390
589
  /**
391
- * Constructs a new `Sequential` cause from the specified pecified `left` and
392
- * `right` causes.
590
+ * Combines two `Cause`s sequentially.
591
+ *
592
+ * **Details**
593
+ *
594
+ * This function merges two errors that occurred in sequence, such as a main
595
+ * error followed by a finalization error. It preserves both errors for complete
596
+ * failure information.
597
+ *
598
+ * @see {@link isSequentialType} Check if a `Cause` is a `Sequential`
393
599
  *
394
600
  * @since 2.0.0
395
- * @category constructors
601
+ * @category Constructors
396
602
  */
397
603
  export declare const sequential: <E, E2>(left: Cause<E>, right: Cause<E2>) => Cause<E | E2>;
398
604
  /**
399
- * Returns `true` if the specified value is a `Cause`, `false` otherwise.
605
+ * Checks if a value is a `Cause`.
400
606
  *
401
607
  * @since 2.0.0
402
- * @category refinements
608
+ * @category Guards
403
609
  */
404
610
  export declare const isCause: (u: unknown) => u is Cause<unknown>;
405
611
  /**
406
- * Returns `true` if the specified `Cause` is an `Empty` type, `false`
407
- * otherwise.
612
+ * Checks if a `Cause` is an `Empty` type.
613
+ *
614
+ * @see {@link empty} Create a new `Empty` cause
408
615
  *
409
616
  * @since 2.0.0
410
- * @category refinements
617
+ * @category Guards
411
618
  */
412
619
  export declare const isEmptyType: <E>(self: Cause<E>) => self is Empty;
413
620
  /**
414
- * Returns `true` if the specified `Cause` is a `Fail` type, `false`
415
- * otherwise.
621
+ * Checks if a `Cause` is a `Fail` type.
622
+ *
623
+ * @see {@link fail} Create a new `Fail` cause
416
624
  *
417
625
  * @since 2.0.0
418
- * @category refinements
626
+ * @category Guards
419
627
  */
420
628
  export declare const isFailType: <E>(self: Cause<E>) => self is Fail<E>;
421
629
  /**
422
- * Returns `true` if the specified `Cause` is a `Die` type, `false`
423
- * otherwise.
630
+ * Checks if a `Cause` is a `Die` type.
631
+ *
632
+ * @see {@link die} Create a new `Die` cause
424
633
  *
425
634
  * @since 2.0.0
426
- * @category refinements
635
+ * @category Guards
427
636
  */
428
637
  export declare const isDieType: <E>(self: Cause<E>) => self is Die;
429
638
  /**
430
- * Returns `true` if the specified `Cause` is an `Interrupt` type, `false`
431
- * otherwise.
639
+ * Checks if a `Cause` is an `Interrupt` type.
640
+ *
641
+ * @see {@link interrupt} Create an `Interrupt` cause
432
642
  *
433
643
  * @since 2.0.0
434
- * @category refinements
644
+ * @category Guards
435
645
  */
436
646
  export declare const isInterruptType: <E>(self: Cause<E>) => self is Interrupt;
437
647
  /**
438
- * Returns `true` if the specified `Cause` is a `Sequential` type, `false`
439
- * otherwise.
648
+ * Checks if a `Cause` is a `Sequential` type.
649
+ *
650
+ * @see {@link sequential} Combine two `Cause`s sequentially
440
651
  *
441
652
  * @since 2.0.0
442
- * @category refinements
653
+ * @category Guards
443
654
  */
444
655
  export declare const isSequentialType: <E>(self: Cause<E>) => self is Sequential<E>;
445
656
  /**
446
- * Returns `true` if the specified `Cause` is a `Parallel` type, `false`
447
- * otherwise.
657
+ * Checks if a `Cause` is a `Parallel` type.
658
+ *
659
+ * @see {@link parallel} Combine two `Cause`s in parallel
448
660
  *
449
661
  * @since 2.0.0
450
- * @category refinements
662
+ * @category Guards
451
663
  */
452
664
  export declare const isParallelType: <E>(self: Cause<E>) => self is Parallel<E>;
453
665
  /**
454
- * Returns the size of the cause, calculated as the number of individual `Cause`
455
- * nodes found in the `Cause` semiring structure.
666
+ * Calculates the size of a `Cause`.
667
+ *
668
+ * **Details**
669
+ *
670
+ * This function returns the total number of `Cause` nodes in the semiring
671
+ * structure, reflecting how many individual error elements are recorded.
456
672
  *
457
673
  * @since 2.0.0
458
- * @category getters
674
+ * @category Getters
459
675
  */
460
676
  export declare const size: <E>(self: Cause<E>) => number;
461
677
  /**
462
- * Returns `true` if the specified cause is empty, `false` otherwise.
678
+ * Checks if a `Cause` is entirely empty.
679
+ *
680
+ * **Details**
681
+ *
682
+ * This function returns `true` if the `Cause` contains no errors, defects, or
683
+ * interruptions. It's helpful for verifying if a computation truly had no
684
+ * failures.
463
685
  *
464
686
  * @since 2.0.0
465
- * @category getters
687
+ * @category Getters
466
688
  */
467
689
  export declare const isEmpty: <E>(self: Cause<E>) => boolean;
468
690
  /**
469
- * Returns `true` if the specified cause contains a failure, `false` otherwise.
691
+ * Checks if a `Cause` contains a failure.
692
+ *
693
+ * **Details**
694
+ *
695
+ * This function returns `true` if the `Cause` includes any `Fail` error. It's
696
+ * commonly used to confirm whether a workflow encountered an anticipated error
697
+ * versus just defects or interruptions.
470
698
  *
471
699
  * @since 2.0.0
472
- * @category getters
700
+ * @category Getters
473
701
  */
474
702
  export declare const isFailure: <E>(self: Cause<E>) => boolean;
475
703
  /**
476
- * Returns `true` if the specified cause contains a defect, `false` otherwise.
704
+ * Checks if a `Cause` contains a defect.
705
+ *
706
+ * **Details**
707
+ *
708
+ * This function returns `true` if the `Cause` includes any unexpected or
709
+ * unhandled errors (`Die`). It's useful for differentiating known failures from
710
+ * unexpected ones.
477
711
  *
478
712
  * @since 2.0.0
479
- * @category getters
713
+ * @category Getters
480
714
  */
481
715
  export declare const isDie: <E>(self: Cause<E>) => boolean;
482
716
  /**
483
- * Returns `true` if the specified cause contains an interruption, `false`
484
- * otherwise.
717
+ * Checks if a `Cause` contains an interruption.
718
+ *
719
+ * **Details**
720
+ *
721
+ * This function returns `true` if the `Cause` includes any fiber interruptions.
485
722
  *
486
723
  * @since 2.0.0
487
- * @category getters
724
+ * @category Getters
488
725
  */
489
726
  export declare const isInterrupted: <E>(self: Cause<E>) => boolean;
490
727
  /**
491
- * Returns `true` if the specified cause contains only interruptions (without
492
- * any `Die` or `Fail` causes), `false` otherwise.
728
+ * Checks if a `Cause` contains only interruptions.
729
+ *
730
+ * **Details**
731
+ *
732
+ * This function returns `true` if the `Cause` has been interrupted but does not
733
+ * contain any other failures, such as `Fail` or `Die`. It's helpful for
734
+ * verifying purely "cancellation" scenarios.
493
735
  *
494
736
  * @since 2.0.0
495
- * @category getters
737
+ * @category Getters
496
738
  */
497
739
  export declare const isInterruptedOnly: <E>(self: Cause<E>) => boolean;
498
740
  /**
499
- * Returns a `List` of all recoverable errors of type `E` in the specified
500
- * cause.
741
+ * Extracts all recoverable errors of type `E` from a `Cause`.
742
+ *
743
+ * **Details**
744
+ *
745
+ * This function returns a chunk of errors, providing a list of all `Fail`
746
+ * values found in the cause. It's useful for collecting all known failures for
747
+ * logging or combined error handling.
501
748
  *
502
749
  * @since 2.0.0
503
- * @category getters
750
+ * @category Getters
504
751
  */
505
752
  export declare const failures: <E>(self: Cause<E>) => Chunk.Chunk<E>;
506
753
  /**
507
- * Returns a `List` of all unrecoverable defects in the specified cause.
754
+ * Extracts all unrecoverable defects from a `Cause`.
755
+ *
756
+ * **Details**
757
+ *
758
+ * This function returns a chunk of values representing unexpected errors
759
+ * (`Die`). It's handy for capturing or logging unanticipated failures that
760
+ * might need special handling, such as bug reports.
508
761
  *
509
762
  * @since 2.0.0
510
- * @category getters
763
+ * @category Getters
511
764
  */
512
765
  export declare const defects: <E>(self: Cause<E>) => Chunk.Chunk<unknown>;
513
766
  /**
514
- * Returns a `HashSet` of `FiberId`s for all fibers that interrupted the fiber
515
- * described by the specified cause.
767
+ * Collects all `FiberId`s responsible for interrupting a fiber.
768
+ *
769
+ * **Details**
770
+ *
771
+ * This function returns a set of IDs indicating which fibers caused
772
+ * interruptions within this `Cause`. It's useful for debugging concurrency
773
+ * issues or tracing cancellations.
516
774
  *
517
775
  * @since 2.0.0
518
- * @category getters
776
+ * @category Getters
519
777
  */
520
778
  export declare const interruptors: <E>(self: Cause<E>) => HashSet.HashSet<FiberId.FiberId>;
521
779
  /**
522
- * Returns the `E` associated with the first `Fail` in this `Cause`, if one
523
- * exists.
780
+ * Retrieves the first `Fail` error in a `Cause`, if present.
781
+ *
782
+ * **Details**
783
+ *
784
+ * This function returns an `Option` containing the first recoverable error
785
+ * (`E`) from the cause. It's often used to quickly check if there's a primary
786
+ * error to handle or display.
524
787
  *
525
788
  * @since 2.0.0
526
- * @category getters
789
+ * @category Getters
527
790
  */
528
791
  export declare const failureOption: <E>(self: Cause<E>) => Option.Option<E>;
529
792
  /**
530
- * Returns the first checked error on the `Left` if available, if there are
531
- * no checked errors return the rest of the `Cause` that is known to contain
532
- * only `Die` or `Interrupt` causes.
793
+ * Splits a `Cause` into either its first `Fail` error or the rest of the cause
794
+ * (which might only contain `Die` or `Interrupt`).
795
+ *
796
+ * **Details**
797
+ *
798
+ * This function either returns the checked error (`E`) or the remaining
799
+ * `Cause<never>` with defects/interruptions. It helps you decide if there's a
800
+ * recoverable path or if only unhandled issues remain.
533
801
  *
534
802
  * @since 2.0.0
535
- * @category getters
803
+ * @category Getters
536
804
  */
537
805
  export declare const failureOrCause: <E>(self: Cause<E>) => Either.Either<Cause<never>, E>;
538
806
  /**
539
- * Converts the specified `Cause<Option<E>>` to an `Option<Cause<E>>` by
540
- * recursively stripping out any failures with the error `None`.
807
+ * Strips out failures with an error of `None` from a `Cause<Option<E>>`.
808
+ *
809
+ * **Details**
810
+ *
811
+ * This function turns a `Cause<Option<E>>` into an `Option<Cause<E>>`. If the
812
+ * cause only contains failures of `None`, it becomes `None`; otherwise, it
813
+ * returns a `Cause` of the remaining errors. It's helpful when working with
814
+ * optional errors and filtering out certain error paths.
541
815
  *
542
816
  * @since 2.0.0
543
- * @category getters
817
+ * @category Getters
544
818
  */
545
819
  export declare const flipCauseOption: <E>(self: Cause<Option.Option<E>>) => Option.Option<Cause<E>>;
546
820
  /**
547
- * Returns the defect associated with the first `Die` in this `Cause`, if one
548
- * exists.
821
+ * Retrieves the first `Die` defect in a `Cause`, if present.
822
+ *
823
+ * **Details**
824
+ *
825
+ * This function returns an `Option` containing the first unexpected failure
826
+ * (`Die`) discovered. It's helpful for diagnosing the primary defect in a chain
827
+ * of errors.
549
828
  *
550
829
  * @since 2.0.0
551
- * @category getters
830
+ * @category Getters
552
831
  */
553
832
  export declare const dieOption: <E>(self: Cause<E>) => Option.Option<unknown>;
554
833
  /**
555
- * Returns the `FiberId` associated with the first `Interrupt` in the specified
556
- * cause, if one exists.
834
+ * Retrieves the first `Interrupt` in a `Cause`, if present.
835
+ *
836
+ * **Details**
837
+ *
838
+ * This function returns an `Option` with the first fiber interruption
839
+ * discovered. This is particularly useful for concurrency analysis or debugging
840
+ * cancellations.
557
841
  *
558
842
  * @since 2.0.0
559
- * @category getters
843
+ * @category Getters
560
844
  */
561
845
  export declare const interruptOption: <E>(self: Cause<E>) => Option.Option<FiberId.FiberId>;
562
846
  /**
563
- * Remove all `Fail` and `Interrupt` nodes from the specified cause, and return
564
- * a cause containing only `Die` cause/finalizer defects.
847
+ * Removes all `Fail` and `Interrupt` nodes, keeping only defects (`Die`) in a
848
+ * `Cause`.
849
+ *
850
+ * **Details**
851
+ *
852
+ * This function strips a cause of recoverable errors and interruptions, leaving
853
+ * only unexpected failures. If no defects remain, it returns `None`. It's
854
+ * valuable for focusing only on unanticipated problems when both known errors
855
+ * and defects could occur.
565
856
  *
566
857
  * @since 2.0.0
567
- * @category getters
858
+ * @category Getters
568
859
  */
569
860
  export declare const keepDefects: <E>(self: Cause<E>) => Option.Option<Cause<never>>;
570
861
  /**
571
- * Linearizes the specified cause into a `HashSet` of parallel causes where each
572
- * parallel cause contains a linear sequence of failures.
862
+ * Linearizes a `Cause` into a set of parallel causes, each containing a
863
+ * sequential chain of failures.
864
+ *
865
+ * **Details**
866
+ *
867
+ * This function reorganizes the cause structure so that you can analyze each
868
+ * parallel branch separately, even if they have multiple sequential errors.
573
869
  *
574
870
  * @since 2.0.0
575
- * @category getters
871
+ * @category Getters
576
872
  */
577
873
  export declare const linearize: <E>(self: Cause<E>) => HashSet.HashSet<Cause<E>>;
578
874
  /**
579
- * Remove all `Fail` and `Interrupt` nodes from the specified cause, and return
580
- * a cause containing only `Die` cause/finalizer defects.
875
+ * Removes `Fail` and `Interrupt` nodes from a `Cause`, keeping only defects
876
+ * (`Die`).
877
+ *
878
+ * **Details**
879
+ *
880
+ * This function is similar to `keepDefects` but returns a `Cause<never>`
881
+ * directly, which can still store `Die` or finalizer-related defects. It's
882
+ * helpful for analyzing only the irrecoverable portion of the error.
581
883
  *
582
884
  * @since 2.0.0
583
- * @category getters
885
+ * @category Getters
584
886
  */
585
887
  export declare const stripFailures: <E>(self: Cause<E>) => Cause<never>;
586
888
  /**
587
- * Remove all `Die` causes that the specified partial function is defined at,
588
- * returning `Some` with the remaining causes or `None` if there are no
589
- * remaining causes.
889
+ * Removes matching defects from a `Cause` using a partial function, returning
890
+ * the remainder.
891
+ *
892
+ * **Details**
893
+ *
894
+ * This function applies a user-defined extraction function to each defect
895
+ * (`Die`). If the function matches the defect, that defect is removed. If all
896
+ * defects match, the result is `None`. Otherwise, you get a `Cause` with the
897
+ * unmatched defects.
590
898
  *
591
899
  * @since 2.0.0
592
- * @category getters
900
+ * @category Getters
593
901
  */
594
902
  export declare const stripSomeDefects: {
595
903
  /**
596
- * Remove all `Die` causes that the specified partial function is defined at,
597
- * returning `Some` with the remaining causes or `None` if there are no
598
- * remaining causes.
904
+ * Removes matching defects from a `Cause` using a partial function, returning
905
+ * the remainder.
906
+ *
907
+ * **Details**
908
+ *
909
+ * This function applies a user-defined extraction function to each defect
910
+ * (`Die`). If the function matches the defect, that defect is removed. If all
911
+ * defects match, the result is `None`. Otherwise, you get a `Cause` with the
912
+ * unmatched defects.
599
913
  *
600
914
  * @since 2.0.0
601
- * @category getters
915
+ * @category Getters
602
916
  */
603
917
  (pf: (defect: unknown) => Option.Option<unknown>): <E>(self: Cause<E>) => Option.Option<Cause<E>>;
604
918
  /**
605
- * Remove all `Die` causes that the specified partial function is defined at,
606
- * returning `Some` with the remaining causes or `None` if there are no
607
- * remaining causes.
919
+ * Removes matching defects from a `Cause` using a partial function, returning
920
+ * the remainder.
921
+ *
922
+ * **Details**
923
+ *
924
+ * This function applies a user-defined extraction function to each defect
925
+ * (`Die`). If the function matches the defect, that defect is removed. If all
926
+ * defects match, the result is `None`. Otherwise, you get a `Cause` with the
927
+ * unmatched defects.
608
928
  *
609
929
  * @since 2.0.0
610
- * @category getters
930
+ * @category Getters
611
931
  */
612
932
  <E>(self: Cause<E>, pf: (defect: unknown) => Option.Option<unknown>): Option.Option<Cause<E>>;
613
933
  };
614
934
  /**
935
+ * Replaces any errors in a `Cause` with a provided constant error.
936
+ *
937
+ * **Details**
938
+ *
939
+ * This function transforms all `Fail` errors into the specified error value,
940
+ * preserving the structure of the `Cause`. It's useful when you no longer need
941
+ * the original error details but still want to keep the cause shape.
942
+ *
943
+ * @see {@link map} Apply a custom transformation to `Fail` errors
944
+ *
615
945
  * @since 2.0.0
616
- * @category mapping
946
+ * @category Mapping
617
947
  */
618
948
  export declare const as: {
619
949
  /**
950
+ * Replaces any errors in a `Cause` with a provided constant error.
951
+ *
952
+ * **Details**
953
+ *
954
+ * This function transforms all `Fail` errors into the specified error value,
955
+ * preserving the structure of the `Cause`. It's useful when you no longer need
956
+ * the original error details but still want to keep the cause shape.
957
+ *
958
+ * @see {@link map} Apply a custom transformation to `Fail` errors
959
+ *
620
960
  * @since 2.0.0
621
- * @category mapping
961
+ * @category Mapping
622
962
  */
623
963
  <E2>(error: E2): <E>(self: Cause<E>) => Cause<E2>;
624
964
  /**
965
+ * Replaces any errors in a `Cause` with a provided constant error.
966
+ *
967
+ * **Details**
968
+ *
969
+ * This function transforms all `Fail` errors into the specified error value,
970
+ * preserving the structure of the `Cause`. It's useful when you no longer need
971
+ * the original error details but still want to keep the cause shape.
972
+ *
973
+ * @see {@link map} Apply a custom transformation to `Fail` errors
974
+ *
625
975
  * @since 2.0.0
626
- * @category mapping
976
+ * @category Mapping
627
977
  */
628
978
  <E, E2>(self: Cause<E>, error: E2): Cause<E2>;
629
979
  };
630
980
  /**
981
+ * Transforms the errors in a `Cause` using a user-provided function.
982
+ *
983
+ * **Details**
984
+ *
985
+ * This function applies `f` to each `Fail` error while leaving defects (`Die`)
986
+ * and interruptions untouched. It's useful for changing or simplifying error
987
+ * types in your effectful workflows.
988
+ *
989
+ * @see {@link as} Replace errors with a single constant
990
+ *
631
991
  * @since 2.0.0
632
- * @category mapping
992
+ * @category Mapping
633
993
  */
634
994
  export declare const map: {
635
995
  /**
996
+ * Transforms the errors in a `Cause` using a user-provided function.
997
+ *
998
+ * **Details**
999
+ *
1000
+ * This function applies `f` to each `Fail` error while leaving defects (`Die`)
1001
+ * and interruptions untouched. It's useful for changing or simplifying error
1002
+ * types in your effectful workflows.
1003
+ *
1004
+ * @see {@link as} Replace errors with a single constant
1005
+ *
636
1006
  * @since 2.0.0
637
- * @category mapping
1007
+ * @category Mapping
638
1008
  */
639
1009
  <E, E2>(f: (e: E) => E2): (self: Cause<E>) => Cause<E2>;
640
1010
  /**
1011
+ * Transforms the errors in a `Cause` using a user-provided function.
1012
+ *
1013
+ * **Details**
1014
+ *
1015
+ * This function applies `f` to each `Fail` error while leaving defects (`Die`)
1016
+ * and interruptions untouched. It's useful for changing or simplifying error
1017
+ * types in your effectful workflows.
1018
+ *
1019
+ * @see {@link as} Replace errors with a single constant
1020
+ *
641
1021
  * @since 2.0.0
642
- * @category mapping
1022
+ * @category Mapping
643
1023
  */
644
1024
  <E, E2>(self: Cause<E>, f: (e: E) => E2): Cause<E2>;
645
1025
  };
646
1026
  /**
1027
+ * Transforms errors in a `Cause` into new causes.
1028
+ *
1029
+ * **Details**
1030
+ *
1031
+ * This function applies a function `f` to each `Fail` error, converting it into
1032
+ * a new `Cause`. This is especially powerful for merging or restructuring error
1033
+ * types while preserving or combining cause information.
1034
+ *
1035
+ * @see {@link map} Apply a simpler transformation to errors
1036
+ *
647
1037
  * @since 2.0.0
648
- * @category sequencing
1038
+ * @category Sequencing
649
1039
  */
650
1040
  export declare const flatMap: {
651
1041
  /**
1042
+ * Transforms errors in a `Cause` into new causes.
1043
+ *
1044
+ * **Details**
1045
+ *
1046
+ * This function applies a function `f` to each `Fail` error, converting it into
1047
+ * a new `Cause`. This is especially powerful for merging or restructuring error
1048
+ * types while preserving or combining cause information.
1049
+ *
1050
+ * @see {@link map} Apply a simpler transformation to errors
1051
+ *
652
1052
  * @since 2.0.0
653
- * @category sequencing
1053
+ * @category Sequencing
654
1054
  */
655
1055
  <E, E2>(f: (e: E) => Cause<E2>): (self: Cause<E>) => Cause<E2>;
656
1056
  /**
1057
+ * Transforms errors in a `Cause` into new causes.
1058
+ *
1059
+ * **Details**
1060
+ *
1061
+ * This function applies a function `f` to each `Fail` error, converting it into
1062
+ * a new `Cause`. This is especially powerful for merging or restructuring error
1063
+ * types while preserving or combining cause information.
1064
+ *
1065
+ * @see {@link map} Apply a simpler transformation to errors
1066
+ *
657
1067
  * @since 2.0.0
658
- * @category sequencing
1068
+ * @category Sequencing
659
1069
  */
660
1070
  <E, E2>(self: Cause<E>, f: (e: E) => Cause<E2>): Cause<E2>;
661
1071
  };
662
1072
  /**
663
- * Executes a sequence of two `Cause`s. The second `Cause` can be dependent on the result of the first `Cause`.
1073
+ * Sequences two `Cause`s. The second `Cause` can be dependent on the result of
1074
+ * the first `Cause`.
664
1075
  *
665
1076
  * @since 2.0.0
666
- * @category sequencing
1077
+ * @category Sequencing
667
1078
  */
668
1079
  export declare const andThen: {
669
1080
  /**
670
- * Executes a sequence of two `Cause`s. The second `Cause` can be dependent on the result of the first `Cause`.
1081
+ * Sequences two `Cause`s. The second `Cause` can be dependent on the result of
1082
+ * the first `Cause`.
671
1083
  *
672
1084
  * @since 2.0.0
673
- * @category sequencing
1085
+ * @category Sequencing
674
1086
  */
675
1087
  <E, E2>(f: (e: E) => Cause<E2>): (self: Cause<E>) => Cause<E2>;
676
1088
  /**
677
- * Executes a sequence of two `Cause`s. The second `Cause` can be dependent on the result of the first `Cause`.
1089
+ * Sequences two `Cause`s. The second `Cause` can be dependent on the result of
1090
+ * the first `Cause`.
678
1091
  *
679
1092
  * @since 2.0.0
680
- * @category sequencing
1093
+ * @category Sequencing
681
1094
  */
682
1095
  <E2>(f: Cause<E2>): <E>(self: Cause<E>) => Cause<E2>;
683
1096
  /**
684
- * Executes a sequence of two `Cause`s. The second `Cause` can be dependent on the result of the first `Cause`.
1097
+ * Sequences two `Cause`s. The second `Cause` can be dependent on the result of
1098
+ * the first `Cause`.
685
1099
  *
686
1100
  * @since 2.0.0
687
- * @category sequencing
1101
+ * @category Sequencing
688
1102
  */
689
1103
  <E, E2>(self: Cause<E>, f: (e: E) => Cause<E2>): Cause<E2>;
690
1104
  /**
691
- * Executes a sequence of two `Cause`s. The second `Cause` can be dependent on the result of the first `Cause`.
1105
+ * Sequences two `Cause`s. The second `Cause` can be dependent on the result of
1106
+ * the first `Cause`.
692
1107
  *
693
1108
  * @since 2.0.0
694
- * @category sequencing
1109
+ * @category Sequencing
695
1110
  */
696
1111
  <E, E2>(self: Cause<E>, f: Cause<E2>): Cause<E2>;
697
1112
  };
698
1113
  /**
1114
+ * Flattens a nested `Cause` structure.
1115
+ *
1116
+ * **Details**
1117
+ *
1118
+ * This function takes a `Cause<Cause<E>>` and merges the layers into a single
1119
+ * `Cause<E>`. It's useful for eliminating additional nesting created by
1120
+ * repeated transformations or compositions.
1121
+ *
1122
+ * @see {@link flatMap} Compose nested causes
1123
+ *
699
1124
  * @since 2.0.0
700
- * @category sequencing
1125
+ * @category Sequencing
701
1126
  */
702
1127
  export declare const flatten: <E>(self: Cause<Cause<E>>) => Cause<E>;
703
1128
  /**
704
- * Returns `true` if the `self` cause contains or is equal to `that` cause,
705
- * `false` otherwise.
1129
+ * Checks if the current `Cause` contains or is equal to another `Cause`.
1130
+ *
1131
+ * **Details**
1132
+ *
1133
+ * This function returns `true` if `that` cause is part of or the same as
1134
+ * the current `Cause`. It's useful when you need to check for specific
1135
+ * error patterns or deduplicate repeated failures.
706
1136
  *
707
1137
  * @since 2.0.0
708
- * @category elements
1138
+ * @category Elements
709
1139
  */
710
1140
  export declare const contains: {
711
1141
  /**
712
- * Returns `true` if the `self` cause contains or is equal to `that` cause,
713
- * `false` otherwise.
1142
+ * Checks if the current `Cause` contains or is equal to another `Cause`.
1143
+ *
1144
+ * **Details**
1145
+ *
1146
+ * This function returns `true` if `that` cause is part of or the same as
1147
+ * the current `Cause`. It's useful when you need to check for specific
1148
+ * error patterns or deduplicate repeated failures.
714
1149
  *
715
1150
  * @since 2.0.0
716
- * @category elements
1151
+ * @category Elements
717
1152
  */
718
1153
  <E2>(that: Cause<E2>): <E>(self: Cause<E>) => boolean;
719
1154
  /**
720
- * Returns `true` if the `self` cause contains or is equal to `that` cause,
721
- * `false` otherwise.
1155
+ * Checks if the current `Cause` contains or is equal to another `Cause`.
1156
+ *
1157
+ * **Details**
1158
+ *
1159
+ * This function returns `true` if `that` cause is part of or the same as
1160
+ * the current `Cause`. It's useful when you need to check for specific
1161
+ * error patterns or deduplicate repeated failures.
722
1162
  *
723
1163
  * @since 2.0.0
724
- * @category elements
1164
+ * @category Elements
725
1165
  */
726
1166
  <E, E2>(self: Cause<E>, that: Cause<E2>): boolean;
727
1167
  };
728
1168
  /**
729
- * Squashes a `Cause` down to a single defect, chosen to be the "most important"
730
- * defect.
1169
+ * Extracts the most "important" defect from a `Cause`.
1170
+ *
1171
+ * **Details**
1172
+ *
1173
+ * This function reduces a `Cause` to a single, prioritized defect. It evaluates
1174
+ * the `Cause` in the following order of priority:
1175
+ *
1176
+ * 1. If the `Cause` contains a failure (e.g., from `Effect.fail`), it returns
1177
+ * the raw error value.
1178
+ * 2. If there is no failure, it looks for the first defect (e.g., from
1179
+ * `Effect.die`).
1180
+ * 3. If neither of the above is present, and the `Cause` stems from an
1181
+ * interruption, it creates and returns an `InterruptedException`.
1182
+ *
1183
+ * This function ensures you can always extract a meaningful representation of
1184
+ * the primary issue from a potentially complex `Cause` structure.
1185
+ *
1186
+ * **When to Use**
1187
+ *
1188
+ * Use this function when you need to extract the most relevant error or defect
1189
+ * from a `Cause`, especially in scenarios where multiple errors or defects may
1190
+ * be present. It's particularly useful for simplifying error reporting or
1191
+ * logging.
1192
+ *
1193
+ * @see {@link squashWith} Allows transforming failures into defects when squashing.
731
1194
  *
732
1195
  * @since 2.0.0
733
- * @category destructors
1196
+ * @category Destructors
734
1197
  */
735
1198
  export declare const squash: <E>(self: Cause<E>) => unknown;
736
1199
  /**
737
- * Squashes a `Cause` down to a single defect, chosen to be the "most important"
738
- * defect. If a recoverable error is found, the provided function will be used
739
- * to map the error a defect, and the resulting value will be returned.
1200
+ * Extracts the most "important" defect from a `Cause`, transforming failures
1201
+ * into defects using a provided function.
1202
+ *
1203
+ * **Details**
1204
+ *
1205
+ * This function reduces a `Cause` to a single, prioritized defect, while
1206
+ * allowing you to transform recoverable failures into defects through a custom
1207
+ * function. It processes the `Cause` in the following order:
1208
+ *
1209
+ * 1. If the `Cause` contains a failure (e.g., from `Effect.fail`), it applies
1210
+ * the provided function `f` to the error to transform it into a defect.
1211
+ * 2. If there is no failure, it looks for the first defect (e.g., from
1212
+ * `Effect.die`) and returns it.
1213
+ * 3. If neither is present and the `Cause` stems from an interruption, it
1214
+ * returns an `InterruptedException`.
1215
+ *
1216
+ * This function is particularly useful when you need custom handling or
1217
+ * transformation of errors while processing a `Cause`.
1218
+ *
1219
+ * @see {@link squash} Extracts the most "important" defect without transforming failures.
740
1220
  *
741
1221
  * @since 2.0.0
742
- * @category destructors
1222
+ * @category Destructors
743
1223
  */
744
1224
  export declare const squashWith: {
745
1225
  /**
746
- * Squashes a `Cause` down to a single defect, chosen to be the "most important"
747
- * defect. If a recoverable error is found, the provided function will be used
748
- * to map the error a defect, and the resulting value will be returned.
1226
+ * Extracts the most "important" defect from a `Cause`, transforming failures
1227
+ * into defects using a provided function.
1228
+ *
1229
+ * **Details**
1230
+ *
1231
+ * This function reduces a `Cause` to a single, prioritized defect, while
1232
+ * allowing you to transform recoverable failures into defects through a custom
1233
+ * function. It processes the `Cause` in the following order:
1234
+ *
1235
+ * 1. If the `Cause` contains a failure (e.g., from `Effect.fail`), it applies
1236
+ * the provided function `f` to the error to transform it into a defect.
1237
+ * 2. If there is no failure, it looks for the first defect (e.g., from
1238
+ * `Effect.die`) and returns it.
1239
+ * 3. If neither is present and the `Cause` stems from an interruption, it
1240
+ * returns an `InterruptedException`.
1241
+ *
1242
+ * This function is particularly useful when you need custom handling or
1243
+ * transformation of errors while processing a `Cause`.
1244
+ *
1245
+ * @see {@link squash} Extracts the most "important" defect without transforming failures.
749
1246
  *
750
1247
  * @since 2.0.0
751
- * @category destructors
1248
+ * @category Destructors
752
1249
  */
753
1250
  <E>(f: (error: E) => unknown): (self: Cause<E>) => unknown;
754
1251
  /**
755
- * Squashes a `Cause` down to a single defect, chosen to be the "most important"
756
- * defect. If a recoverable error is found, the provided function will be used
757
- * to map the error a defect, and the resulting value will be returned.
1252
+ * Extracts the most "important" defect from a `Cause`, transforming failures
1253
+ * into defects using a provided function.
1254
+ *
1255
+ * **Details**
1256
+ *
1257
+ * This function reduces a `Cause` to a single, prioritized defect, while
1258
+ * allowing you to transform recoverable failures into defects through a custom
1259
+ * function. It processes the `Cause` in the following order:
1260
+ *
1261
+ * 1. If the `Cause` contains a failure (e.g., from `Effect.fail`), it applies
1262
+ * the provided function `f` to the error to transform it into a defect.
1263
+ * 2. If there is no failure, it looks for the first defect (e.g., from
1264
+ * `Effect.die`) and returns it.
1265
+ * 3. If neither is present and the `Cause` stems from an interruption, it
1266
+ * returns an `InterruptedException`.
1267
+ *
1268
+ * This function is particularly useful when you need custom handling or
1269
+ * transformation of errors while processing a `Cause`.
1270
+ *
1271
+ * @see {@link squash} Extracts the most "important" defect without transforming failures.
758
1272
  *
759
1273
  * @since 2.0.0
760
- * @category destructors
1274
+ * @category Destructors
761
1275
  */
762
1276
  <E>(self: Cause<E>, f: (error: E) => unknown): unknown;
763
1277
  };
764
1278
  /**
765
- * Uses the provided partial function to search the specified cause and attempt
766
- * to extract information from it.
1279
+ * Searches a `Cause` using a partial function to extract information.
1280
+ *
1281
+ * **Details**
1282
+ *
1283
+ * This function allows you to search through a `Cause` using a custom partial
1284
+ * function. The partial function is applied to the `Cause`, and if it matches,
1285
+ * the result is returned wrapped in a `Some`. If no match is found, the result
1286
+ * is `None`.
1287
+ *
1288
+ * This is particularly useful when you are only interested in specific types of
1289
+ * errors, defects, or interruption causes within a potentially complex `Cause`
1290
+ * structure. By leveraging a partial function, you can focus on extracting only
1291
+ * the relevant information you care about.
1292
+ *
1293
+ * The partial function should return an `Option` indicating whether it matched
1294
+ * and the value it extracted.
767
1295
  *
768
1296
  * @since 2.0.0
769
- * @category elements
1297
+ * @category Elements
770
1298
  */
771
1299
  export declare const find: {
772
1300
  /**
773
- * Uses the provided partial function to search the specified cause and attempt
774
- * to extract information from it.
1301
+ * Searches a `Cause` using a partial function to extract information.
1302
+ *
1303
+ * **Details**
1304
+ *
1305
+ * This function allows you to search through a `Cause` using a custom partial
1306
+ * function. The partial function is applied to the `Cause`, and if it matches,
1307
+ * the result is returned wrapped in a `Some`. If no match is found, the result
1308
+ * is `None`.
1309
+ *
1310
+ * This is particularly useful when you are only interested in specific types of
1311
+ * errors, defects, or interruption causes within a potentially complex `Cause`
1312
+ * structure. By leveraging a partial function, you can focus on extracting only
1313
+ * the relevant information you care about.
1314
+ *
1315
+ * The partial function should return an `Option` indicating whether it matched
1316
+ * and the value it extracted.
775
1317
  *
776
1318
  * @since 2.0.0
777
- * @category elements
1319
+ * @category Elements
778
1320
  */
779
1321
  <E, Z>(pf: (cause: Cause<E>) => Option.Option<Z>): (self: Cause<E>) => Option.Option<Z>;
780
1322
  /**
781
- * Uses the provided partial function to search the specified cause and attempt
782
- * to extract information from it.
1323
+ * Searches a `Cause` using a partial function to extract information.
1324
+ *
1325
+ * **Details**
1326
+ *
1327
+ * This function allows you to search through a `Cause` using a custom partial
1328
+ * function. The partial function is applied to the `Cause`, and if it matches,
1329
+ * the result is returned wrapped in a `Some`. If no match is found, the result
1330
+ * is `None`.
1331
+ *
1332
+ * This is particularly useful when you are only interested in specific types of
1333
+ * errors, defects, or interruption causes within a potentially complex `Cause`
1334
+ * structure. By leveraging a partial function, you can focus on extracting only
1335
+ * the relevant information you care about.
1336
+ *
1337
+ * The partial function should return an `Option` indicating whether it matched
1338
+ * and the value it extracted.
783
1339
  *
784
1340
  * @since 2.0.0
785
- * @category elements
1341
+ * @category Elements
786
1342
  */
787
1343
  <E, Z>(self: Cause<E>, pf: (cause: Cause<E>) => Option.Option<Z>): Option.Option<Z>;
788
1344
  };
789
1345
  /**
790
- * Filters causes which match the provided predicate out of the specified cause.
1346
+ * Preserves parts of a `Cause` that match a given predicate.
1347
+ *
1348
+ * **Details**
1349
+ *
1350
+ * This function allows you to retain only the parts of a `Cause` structure that
1351
+ * match a specified predicate or refinement. Any parts of the `Cause` that do
1352
+ * not match the provided condition are excluded from the result.
1353
+ *
1354
+ * You can use this function in two ways:
1355
+ * - With a `Predicate`: A function that evaluates whether a `Cause` should be
1356
+ * retained based on its value.
1357
+ * - With a `Refinement`: A more specific predicate that can refine the type of
1358
+ * the `Cause`.
1359
+ *
1360
+ * This is useful when you need to extract specific types of errors, defects, or
1361
+ * interruptions from a `Cause` while discarding unrelated parts.
791
1362
  *
792
1363
  * @since 2.0.0
793
- * @category filtering
1364
+ * @category Filtering
794
1365
  */
795
1366
  export declare const filter: {
796
1367
  /**
797
- * Filters causes which match the provided predicate out of the specified cause.
1368
+ * Preserves parts of a `Cause` that match a given predicate.
1369
+ *
1370
+ * **Details**
1371
+ *
1372
+ * This function allows you to retain only the parts of a `Cause` structure that
1373
+ * match a specified predicate or refinement. Any parts of the `Cause` that do
1374
+ * not match the provided condition are excluded from the result.
1375
+ *
1376
+ * You can use this function in two ways:
1377
+ * - With a `Predicate`: A function that evaluates whether a `Cause` should be
1378
+ * retained based on its value.
1379
+ * - With a `Refinement`: A more specific predicate that can refine the type of
1380
+ * the `Cause`.
1381
+ *
1382
+ * This is useful when you need to extract specific types of errors, defects, or
1383
+ * interruptions from a `Cause` while discarding unrelated parts.
798
1384
  *
799
1385
  * @since 2.0.0
800
- * @category filtering
1386
+ * @category Filtering
801
1387
  */
802
1388
  <E, EB extends E>(refinement: Refinement<Cause<NoInfer<E>>, Cause<EB>>): (self: Cause<E>) => Cause<EB>;
803
1389
  /**
804
- * Filters causes which match the provided predicate out of the specified cause.
1390
+ * Preserves parts of a `Cause` that match a given predicate.
1391
+ *
1392
+ * **Details**
1393
+ *
1394
+ * This function allows you to retain only the parts of a `Cause` structure that
1395
+ * match a specified predicate or refinement. Any parts of the `Cause` that do
1396
+ * not match the provided condition are excluded from the result.
1397
+ *
1398
+ * You can use this function in two ways:
1399
+ * - With a `Predicate`: A function that evaluates whether a `Cause` should be
1400
+ * retained based on its value.
1401
+ * - With a `Refinement`: A more specific predicate that can refine the type of
1402
+ * the `Cause`.
1403
+ *
1404
+ * This is useful when you need to extract specific types of errors, defects, or
1405
+ * interruptions from a `Cause` while discarding unrelated parts.
805
1406
  *
806
1407
  * @since 2.0.0
807
- * @category filtering
1408
+ * @category Filtering
808
1409
  */
809
1410
  <E>(predicate: Predicate<Cause<NoInfer<E>>>): (self: Cause<E>) => Cause<E>;
810
1411
  /**
811
- * Filters causes which match the provided predicate out of the specified cause.
1412
+ * Preserves parts of a `Cause` that match a given predicate.
1413
+ *
1414
+ * **Details**
1415
+ *
1416
+ * This function allows you to retain only the parts of a `Cause` structure that
1417
+ * match a specified predicate or refinement. Any parts of the `Cause` that do
1418
+ * not match the provided condition are excluded from the result.
1419
+ *
1420
+ * You can use this function in two ways:
1421
+ * - With a `Predicate`: A function that evaluates whether a `Cause` should be
1422
+ * retained based on its value.
1423
+ * - With a `Refinement`: A more specific predicate that can refine the type of
1424
+ * the `Cause`.
1425
+ *
1426
+ * This is useful when you need to extract specific types of errors, defects, or
1427
+ * interruptions from a `Cause` while discarding unrelated parts.
812
1428
  *
813
1429
  * @since 2.0.0
814
- * @category filtering
1430
+ * @category Filtering
815
1431
  */
816
1432
  <E, EB extends E>(self: Cause<E>, refinement: Refinement<Cause<E>, Cause<EB>>): Cause<EB>;
817
1433
  /**
818
- * Filters causes which match the provided predicate out of the specified cause.
1434
+ * Preserves parts of a `Cause` that match a given predicate.
1435
+ *
1436
+ * **Details**
1437
+ *
1438
+ * This function allows you to retain only the parts of a `Cause` structure that
1439
+ * match a specified predicate or refinement. Any parts of the `Cause` that do
1440
+ * not match the provided condition are excluded from the result.
1441
+ *
1442
+ * You can use this function in two ways:
1443
+ * - With a `Predicate`: A function that evaluates whether a `Cause` should be
1444
+ * retained based on its value.
1445
+ * - With a `Refinement`: A more specific predicate that can refine the type of
1446
+ * the `Cause`.
1447
+ *
1448
+ * This is useful when you need to extract specific types of errors, defects, or
1449
+ * interruptions from a `Cause` while discarding unrelated parts.
819
1450
  *
820
1451
  * @since 2.0.0
821
- * @category filtering
1452
+ * @category Filtering
822
1453
  */
823
1454
  <E>(self: Cause<E>, predicate: Predicate<Cause<E>>): Cause<E>;
824
1455
  };
825
1456
  /**
826
- * Folds the specified cause into a value of type `Z`.
1457
+ * Transforms a `Cause` into a single value using custom handlers for each
1458
+ * possible case.
1459
+ *
1460
+ * **Details**
1461
+ *
1462
+ * This function processes a `Cause` by applying a set of custom handlers to
1463
+ * each possible type of cause: `Empty`, `Fail`, `Die`, `Interrupt`,
1464
+ * `Sequential`, and `Parallel`. The result of this function is a single value
1465
+ * of type `Z`. This function allows you to define exactly how to handle each
1466
+ * part of a `Cause`, whether it's a failure, defect, interruption, or a
1467
+ * combination of these.
1468
+ *
1469
+ * The options parameter provides handlers for:
1470
+ * - `onEmpty`: Handles the case where the cause is `Empty`, meaning no errors
1471
+ * occurred.
1472
+ * - `onFail`: Processes a failure with an error of type `E`.
1473
+ * - `onDie`: Processes a defect (unexpected error).
1474
+ * - `onInterrupt`: Handles a fiber interruption, providing the `FiberId` of the
1475
+ * interruption.
1476
+ * - `onSequential`: Combines two sequential causes into a single value of type
1477
+ * `Z`.
1478
+ * - `onParallel`: Combines two parallel causes into a single value of type `Z`.
827
1479
  *
828
1480
  * @since 2.0.0
829
- * @category folding
1481
+ * @category Matching
830
1482
  */
831
1483
  export declare const match: {
832
1484
  /**
833
- * Folds the specified cause into a value of type `Z`.
1485
+ * Transforms a `Cause` into a single value using custom handlers for each
1486
+ * possible case.
1487
+ *
1488
+ * **Details**
1489
+ *
1490
+ * This function processes a `Cause` by applying a set of custom handlers to
1491
+ * each possible type of cause: `Empty`, `Fail`, `Die`, `Interrupt`,
1492
+ * `Sequential`, and `Parallel`. The result of this function is a single value
1493
+ * of type `Z`. This function allows you to define exactly how to handle each
1494
+ * part of a `Cause`, whether it's a failure, defect, interruption, or a
1495
+ * combination of these.
1496
+ *
1497
+ * The options parameter provides handlers for:
1498
+ * - `onEmpty`: Handles the case where the cause is `Empty`, meaning no errors
1499
+ * occurred.
1500
+ * - `onFail`: Processes a failure with an error of type `E`.
1501
+ * - `onDie`: Processes a defect (unexpected error).
1502
+ * - `onInterrupt`: Handles a fiber interruption, providing the `FiberId` of the
1503
+ * interruption.
1504
+ * - `onSequential`: Combines two sequential causes into a single value of type
1505
+ * `Z`.
1506
+ * - `onParallel`: Combines two parallel causes into a single value of type `Z`.
834
1507
  *
835
1508
  * @since 2.0.0
836
- * @category folding
1509
+ * @category Matching
837
1510
  */
838
1511
  <Z, E>(options: {
839
1512
  readonly onEmpty: Z;
@@ -844,10 +1517,31 @@ export declare const match: {
844
1517
  readonly onParallel: (left: Z, right: Z) => Z;
845
1518
  }): (self: Cause<E>) => Z;
846
1519
  /**
847
- * Folds the specified cause into a value of type `Z`.
1520
+ * Transforms a `Cause` into a single value using custom handlers for each
1521
+ * possible case.
1522
+ *
1523
+ * **Details**
1524
+ *
1525
+ * This function processes a `Cause` by applying a set of custom handlers to
1526
+ * each possible type of cause: `Empty`, `Fail`, `Die`, `Interrupt`,
1527
+ * `Sequential`, and `Parallel`. The result of this function is a single value
1528
+ * of type `Z`. This function allows you to define exactly how to handle each
1529
+ * part of a `Cause`, whether it's a failure, defect, interruption, or a
1530
+ * combination of these.
1531
+ *
1532
+ * The options parameter provides handlers for:
1533
+ * - `onEmpty`: Handles the case where the cause is `Empty`, meaning no errors
1534
+ * occurred.
1535
+ * - `onFail`: Processes a failure with an error of type `E`.
1536
+ * - `onDie`: Processes a defect (unexpected error).
1537
+ * - `onInterrupt`: Handles a fiber interruption, providing the `FiberId` of the
1538
+ * interruption.
1539
+ * - `onSequential`: Combines two sequential causes into a single value of type
1540
+ * `Z`.
1541
+ * - `onParallel`: Combines two parallel causes into a single value of type `Z`.
848
1542
  *
849
1543
  * @since 2.0.0
850
- * @category folding
1544
+ * @category Matching
851
1545
  */
852
1546
  <Z, E>(self: Cause<E>, options: {
853
1547
  readonly onEmpty: Z;
@@ -859,123 +1553,250 @@ export declare const match: {
859
1553
  }): Z;
860
1554
  };
861
1555
  /**
862
- * Reduces the specified cause into a value of type `Z`, beginning with the
863
- * provided `zero` value.
1556
+ * Combines all parts of a `Cause` into a single value by starting with an
1557
+ * initial value.
1558
+ *
1559
+ * **Details**
1560
+ *
1561
+ * This function processes a `Cause` by starting with an initial value (`zero`)
1562
+ * and applying a custom function (`pf`) to combine all elements of the `Cause`
1563
+ * into a single result of type `Z`. The custom function determines how each
1564
+ * part of the `Cause` contributes to the final result. The function can return
1565
+ * an `Option` to either continue combining values or skip specific parts of the
1566
+ * `Cause`.
1567
+ *
1568
+ * This function is useful for tasks such as:
1569
+ * - Aggregating error messages from a `Cause` into a single string.
1570
+ * - Summarizing the structure of a `Cause` into a simplified result.
1571
+ * - Filtering or processing only specific parts of a `Cause`.
1572
+ *
1573
+ * The reduction proceeds in a top-down manner, visiting all nodes in the
1574
+ * `Cause` structure. This gives you complete control over how each part of the
1575
+ * `Cause` contributes to the final result.
864
1576
  *
865
1577
  * @since 2.0.0
866
- * @category folding
1578
+ * @category Reducing
867
1579
  */
868
1580
  export declare const reduce: {
869
1581
  /**
870
- * Reduces the specified cause into a value of type `Z`, beginning with the
871
- * provided `zero` value.
1582
+ * Combines all parts of a `Cause` into a single value by starting with an
1583
+ * initial value.
1584
+ *
1585
+ * **Details**
1586
+ *
1587
+ * This function processes a `Cause` by starting with an initial value (`zero`)
1588
+ * and applying a custom function (`pf`) to combine all elements of the `Cause`
1589
+ * into a single result of type `Z`. The custom function determines how each
1590
+ * part of the `Cause` contributes to the final result. The function can return
1591
+ * an `Option` to either continue combining values or skip specific parts of the
1592
+ * `Cause`.
1593
+ *
1594
+ * This function is useful for tasks such as:
1595
+ * - Aggregating error messages from a `Cause` into a single string.
1596
+ * - Summarizing the structure of a `Cause` into a simplified result.
1597
+ * - Filtering or processing only specific parts of a `Cause`.
1598
+ *
1599
+ * The reduction proceeds in a top-down manner, visiting all nodes in the
1600
+ * `Cause` structure. This gives you complete control over how each part of the
1601
+ * `Cause` contributes to the final result.
872
1602
  *
873
1603
  * @since 2.0.0
874
- * @category folding
1604
+ * @category Reducing
875
1605
  */
876
1606
  <Z, E>(zero: Z, pf: (accumulator: Z, cause: Cause<E>) => Option.Option<Z>): (self: Cause<E>) => Z;
877
1607
  /**
878
- * Reduces the specified cause into a value of type `Z`, beginning with the
879
- * provided `zero` value.
1608
+ * Combines all parts of a `Cause` into a single value by starting with an
1609
+ * initial value.
1610
+ *
1611
+ * **Details**
1612
+ *
1613
+ * This function processes a `Cause` by starting with an initial value (`zero`)
1614
+ * and applying a custom function (`pf`) to combine all elements of the `Cause`
1615
+ * into a single result of type `Z`. The custom function determines how each
1616
+ * part of the `Cause` contributes to the final result. The function can return
1617
+ * an `Option` to either continue combining values or skip specific parts of the
1618
+ * `Cause`.
1619
+ *
1620
+ * This function is useful for tasks such as:
1621
+ * - Aggregating error messages from a `Cause` into a single string.
1622
+ * - Summarizing the structure of a `Cause` into a simplified result.
1623
+ * - Filtering or processing only specific parts of a `Cause`.
1624
+ *
1625
+ * The reduction proceeds in a top-down manner, visiting all nodes in the
1626
+ * `Cause` structure. This gives you complete control over how each part of the
1627
+ * `Cause` contributes to the final result.
880
1628
  *
881
1629
  * @since 2.0.0
882
- * @category folding
1630
+ * @category Reducing
883
1631
  */
884
1632
  <Z, E>(self: Cause<E>, zero: Z, pf: (accumulator: Z, cause: Cause<E>) => Option.Option<Z>): Z;
885
1633
  };
886
1634
  /**
887
- * Reduces the specified cause into a value of type `Z` using a `Cause.Reducer`.
888
- * Also allows for accessing the provided context during reduction.
1635
+ * Combines all parts of a `Cause` into a single value using a custom reducer
1636
+ * and a context.
1637
+ *
1638
+ * **Details**
1639
+ *
1640
+ * This function allows you to reduce a `Cause` into a single value of type `Z`
1641
+ * using a custom `CauseReducer`. A `CauseReducer` provides methods to handle
1642
+ * specific parts of the `Cause`, such as failures, defects, or interruptions.
1643
+ * Additionally, this function provides access to a `context` value, which can
1644
+ * be used to carry information or maintain state during the reduction process.
1645
+ *
1646
+ * This is particularly useful when the reduction process needs additional
1647
+ * context or configuration, such as:
1648
+ * - Aggregating error details with dynamic formatting.
1649
+ * - Collecting logs or statistics about the `Cause`.
1650
+ * - Performing stateful transformations based on the `context`.
1651
+ *
1652
+ * @see {@link reduce} To reduce a `Cause` without additional context.
889
1653
  *
890
1654
  * @since 2.0.0
891
- * @category folding
1655
+ * @category Reducing
892
1656
  */
893
1657
  export declare const reduceWithContext: {
894
1658
  /**
895
- * Reduces the specified cause into a value of type `Z` using a `Cause.Reducer`.
896
- * Also allows for accessing the provided context during reduction.
1659
+ * Combines all parts of a `Cause` into a single value using a custom reducer
1660
+ * and a context.
1661
+ *
1662
+ * **Details**
1663
+ *
1664
+ * This function allows you to reduce a `Cause` into a single value of type `Z`
1665
+ * using a custom `CauseReducer`. A `CauseReducer` provides methods to handle
1666
+ * specific parts of the `Cause`, such as failures, defects, or interruptions.
1667
+ * Additionally, this function provides access to a `context` value, which can
1668
+ * be used to carry information or maintain state during the reduction process.
1669
+ *
1670
+ * This is particularly useful when the reduction process needs additional
1671
+ * context or configuration, such as:
1672
+ * - Aggregating error details with dynamic formatting.
1673
+ * - Collecting logs or statistics about the `Cause`.
1674
+ * - Performing stateful transformations based on the `context`.
1675
+ *
1676
+ * @see {@link reduce} To reduce a `Cause` without additional context.
897
1677
  *
898
1678
  * @since 2.0.0
899
- * @category folding
1679
+ * @category Reducing
900
1680
  */
901
1681
  <C, E, Z>(context: C, reducer: CauseReducer<C, E, Z>): (self: Cause<E>) => Z;
902
1682
  /**
903
- * Reduces the specified cause into a value of type `Z` using a `Cause.Reducer`.
904
- * Also allows for accessing the provided context during reduction.
1683
+ * Combines all parts of a `Cause` into a single value using a custom reducer
1684
+ * and a context.
1685
+ *
1686
+ * **Details**
1687
+ *
1688
+ * This function allows you to reduce a `Cause` into a single value of type `Z`
1689
+ * using a custom `CauseReducer`. A `CauseReducer` provides methods to handle
1690
+ * specific parts of the `Cause`, such as failures, defects, or interruptions.
1691
+ * Additionally, this function provides access to a `context` value, which can
1692
+ * be used to carry information or maintain state during the reduction process.
1693
+ *
1694
+ * This is particularly useful when the reduction process needs additional
1695
+ * context or configuration, such as:
1696
+ * - Aggregating error details with dynamic formatting.
1697
+ * - Collecting logs or statistics about the `Cause`.
1698
+ * - Performing stateful transformations based on the `context`.
1699
+ *
1700
+ * @see {@link reduce} To reduce a `Cause` without additional context.
905
1701
  *
906
1702
  * @since 2.0.0
907
- * @category folding
1703
+ * @category Reducing
908
1704
  */
909
1705
  <C, E, Z>(self: Cause<E>, context: C, reducer: CauseReducer<C, E, Z>): Z;
910
1706
  };
911
1707
  /**
912
- * Represents a checked exception which occurs when a `Fiber` is interrupted.
1708
+ * Creates an error that indicates a `Fiber` was interrupted.
1709
+ *
1710
+ * **Details**
1711
+ *
1712
+ * This function constructs an `InterruptedException` recognized by the Effect
1713
+ * runtime. It is usually thrown or returned when a fiber's execution is
1714
+ * interrupted by external events or by another fiber. This is particularly
1715
+ * helpful in concurrent programs where fibers may halt each other before
1716
+ * completion.
913
1717
  *
914
1718
  * @since 2.0.0
915
- * @category errors
1719
+ * @category Errors
916
1720
  */
917
1721
  export declare const InterruptedException: new (message?: string | undefined) => InterruptedException;
918
1722
  /**
919
- * Returns `true` if the specified value is an `InterruptedException`, `false`
920
- * otherwise.
1723
+ * Checks if a given unknown value is an `InterruptedException`.
921
1724
  *
922
1725
  * @since 2.0.0
923
- * @category refinements
1726
+ * @category Guards
924
1727
  */
925
1728
  export declare const isInterruptedException: (u: unknown) => u is InterruptedException;
926
1729
  /**
927
- * Represents a checked exception which occurs when an invalid argument is
928
- * provided to a method.
1730
+ * Creates an error indicating an invalid method argument.
1731
+ *
1732
+ * **Details**
1733
+ *
1734
+ * This function constructs an `IllegalArgumentException`. It is typically
1735
+ * thrown or returned when an operation receives improper inputs, such as
1736
+ * out-of-range values or invalid object states.
929
1737
  *
930
1738
  * @since 2.0.0
931
- * @category errors
1739
+ * @category Errors
932
1740
  */
933
1741
  export declare const IllegalArgumentException: new (message?: string | undefined) => IllegalArgumentException;
934
1742
  /**
935
- * Returns `true` if the specified value is an `IllegalArgumentException`, `false`
936
- * otherwise.
1743
+ * Checks if a given unknown value is an `IllegalArgumentException`.
937
1744
  *
938
1745
  * @since 2.0.0
939
- * @category refinements
1746
+ * @category Guards
940
1747
  */
941
1748
  export declare const isIllegalArgumentException: (u: unknown) => u is IllegalArgumentException;
942
1749
  /**
943
- * Represents a checked exception which occurs when an expected element was
944
- * unable to be found.
1750
+ * Creates an error indicating a missing element.
1751
+ *
1752
+ * **Details**
1753
+ *
1754
+ * This function constructs a `NoSuchElementException`. It helps you clearly
1755
+ * communicate that a required element is unavailable.
945
1756
  *
946
1757
  * @since 2.0.0
947
- * @category errors
1758
+ * @category Errors
948
1759
  */
949
1760
  export declare const NoSuchElementException: new (message?: string | undefined) => NoSuchElementException;
950
1761
  /**
951
- * Returns `true` if the specified value is an `NoSuchElementException`, `false`
952
- * otherwise.
1762
+ * Checks if a given unknown value is a `NoSuchElementException`.
953
1763
  *
954
1764
  * @since 2.0.0
955
- * @category refinements
1765
+ * @category Guards
956
1766
  */
957
1767
  export declare const isNoSuchElementException: (u: unknown) => u is NoSuchElementException;
958
1768
  /**
959
- * Represents a generic checked exception which occurs at runtime.
1769
+ * Creates an error for general runtime errors.
1770
+ *
1771
+ * **Details**
1772
+ *
1773
+ * This function constructs a `RuntimeException`, for errors that occur at
1774
+ * runtime but are not specifically typed or categorized as interruptions,
1775
+ * missing elements, or invalid arguments. It helps unify a wide range of
1776
+ * unexpected conditions under a single, recognizable error type.
960
1777
  *
961
1778
  * @since 2.0.0
962
- * @category errors
1779
+ * @category Errors
963
1780
  */
964
1781
  export declare const RuntimeException: new (message?: string | undefined) => RuntimeException;
965
1782
  /**
966
- * Returns `true` if the specified value is an `RuntimeException`, `false`
967
- * otherwise.
1783
+ * Checks if a given unknown value is a `RuntimeException`.
968
1784
  *
969
1785
  * @since 2.0.0
970
- * @category refinements
1786
+ * @category Guards
971
1787
  */
972
1788
  export declare const isRuntimeException: (u: unknown) => u is RuntimeException;
973
1789
  /**
974
- * Represents a checked exception which occurs when a computation doesn't
975
- * finish on schedule.
1790
+ * Creates an error for operations that exceed their expected time.
1791
+ *
1792
+ * **Details**
1793
+ *
1794
+ * This function constructs a `TimeoutException`. It is typically used to signal
1795
+ * that an operation or fiber did not complete within a designated time limit,
1796
+ * allowing you to handle slow or hanging processes.
976
1797
  *
977
1798
  * @since 2.0.0
978
- * @category errors
1799
+ * @category Errors
979
1800
  */
980
1801
  export declare const TimeoutException: new (message?: string | undefined) => TimeoutException;
981
1802
  /**
@@ -1007,61 +1828,93 @@ export declare const TimeoutException: new (message?: string | undefined) => Tim
1007
1828
  * promises or external APIs.
1008
1829
  *
1009
1830
  * @since 2.0.0
1010
- * @category errors
1831
+ * @category Errors
1011
1832
  */
1012
1833
  export declare const UnknownException: new (error: unknown, message?: string | undefined) => UnknownException;
1013
1834
  /**
1014
- * Returns `true` if the specified value is an `UnknownException`, `false`
1015
- * otherwise.
1835
+ * Checks if a given unknown value is an `UnknownException`.
1016
1836
  *
1017
1837
  * @since 2.0.0
1018
- * @category refinements
1838
+ * @category Guards
1019
1839
  */
1020
1840
  export declare const isUnknownException: (u: unknown) => u is UnknownException;
1021
1841
  /**
1022
- * Represents a checked exception which occurs when a resources capacity has
1023
- * been exceeded.
1842
+ * Creates an error indicating resource capacity has been exceeded.
1843
+ *
1844
+ * **Details**
1845
+ *
1846
+ * This function constructs an `ExceededCapacityException`, signifying that an
1847
+ * operation or resource usage surpassed established limits. This can be
1848
+ * essential for concurrency or resource management situations, ensuring your
1849
+ * application doesn't go beyond acceptable thresholds.
1024
1850
  *
1025
1851
  * @since 3.5.0
1026
- * @category errors
1852
+ * @category Errors
1027
1853
  */
1028
1854
  export declare const ExceededCapacityException: new (message?: string | undefined) => ExceededCapacityException;
1029
1855
  /**
1030
- * Returns `true` if the specified value is an `ExceededCapacityException`, `false`
1031
- * otherwise.
1856
+ * Checks if a given unknown value is an `ExceededCapacityException`.
1032
1857
  *
1033
1858
  * @since 3.5.0
1034
- * @category refinements
1859
+ * @category Guards
1035
1860
  */
1036
1861
  export declare const isExceededCapacityException: (u: unknown) => u is ExceededCapacityException;
1037
1862
  /**
1038
- * Returns the specified `Cause` as a pretty-printed string.
1863
+ * Converts a `Cause` into a human-readable string.
1864
+ *
1865
+ * **Details**
1866
+ *
1867
+ * This function pretty-prints the entire `Cause`, including any failures,
1868
+ * defects, and interruptions. It can be especially helpful for logging,
1869
+ * debugging, or displaying structured errors to users.
1870
+ *
1871
+ * You can optionally pass `options` to configure how the error cause is
1872
+ * rendered. By default, it includes essential details of all errors in the
1873
+ * `Cause`.
1874
+ *
1875
+ * @see {@link prettyErrors} Get a list of `PrettyError` objects instead of a single string.
1039
1876
  *
1040
1877
  * @since 2.0.0
1041
- * @category rendering
1878
+ * @category Formatting
1042
1879
  */
1043
1880
  export declare const pretty: <E>(cause: Cause<E>, options?: {
1044
1881
  readonly renderErrorCause?: boolean | undefined;
1045
1882
  }) => string;
1046
1883
  /**
1884
+ * A shape for prettified errors, optionally including a source span.
1885
+ *
1047
1886
  * @since 3.2.0
1048
- * @category models
1887
+ * @category Models
1049
1888
  */
1050
1889
  export interface PrettyError extends Error {
1051
1890
  readonly span: Span | undefined;
1052
1891
  }
1053
1892
  /**
1054
- * Returns the specified `Cause` as a pretty-printed string.
1893
+ * Returns a list of prettified errors (`PrettyError`) from a `Cause`.
1894
+ *
1895
+ * **Details**
1896
+ *
1897
+ * This function inspects the entire `Cause` and produces an array of
1898
+ * `PrettyError` objects. Each object may include additional metadata, such as a
1899
+ * `Span`, to provide deeper insights into where and how the error occurred.
1055
1900
  *
1056
1901
  * @since 3.2.0
1057
- * @category rendering
1902
+ * @category Formatting
1058
1903
  */
1059
1904
  export declare const prettyErrors: <E>(cause: Cause<E>) => Array<PrettyError>;
1060
1905
  /**
1061
- * Returns the original, unproxied, instance of a thrown error
1906
+ * Retrieves the original, unproxied error instance from an error object.
1907
+ *
1908
+ * **Details**
1909
+ *
1910
+ * This function returns the underlying error object without any
1911
+ * library-specific wrapping or proxying that might occur during error handling.
1912
+ * This can be essential if you need direct access to the error's native
1913
+ * properties, such as stack traces or custom data fields, for detailed
1914
+ * debugging or integration with external systems.
1062
1915
  *
1063
1916
  * @since 2.0.0
1064
- * @category errors
1917
+ * @category Errors
1065
1918
  */
1066
1919
  export declare const originalError: <E>(obj: E) => E;
1067
1920
  //# sourceMappingURL=Cause.d.ts.map