effect 4.0.0-beta.83 → 4.0.0-beta.84

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 (195) hide show
  1. package/dist/Array.d.ts +64 -64
  2. package/dist/Array.js +26 -26
  3. package/dist/Cache.d.ts +1 -1
  4. package/dist/Cache.js +1 -1
  5. package/dist/Cause.d.ts +68 -68
  6. package/dist/Cause.js +47 -47
  7. package/dist/Channel.d.ts +5 -5
  8. package/dist/Channel.js +3 -3
  9. package/dist/Clock.d.ts +1 -1
  10. package/dist/Clock.js +1 -1
  11. package/dist/Combiner.d.ts +9 -9
  12. package/dist/Combiner.js +8 -8
  13. package/dist/Config.d.ts +15 -94
  14. package/dist/Config.d.ts.map +1 -1
  15. package/dist/Config.js +22 -70
  16. package/dist/Config.js.map +1 -1
  17. package/dist/ConfigProvider.d.ts +58 -74
  18. package/dist/ConfigProvider.d.ts.map +1 -1
  19. package/dist/ConfigProvider.js +66 -41
  20. package/dist/ConfigProvider.js.map +1 -1
  21. package/dist/Console.d.ts +1 -1
  22. package/dist/Console.js +1 -1
  23. package/dist/Data.d.ts +15 -15
  24. package/dist/Data.js +3 -3
  25. package/dist/DateTime.d.ts +6 -6
  26. package/dist/DateTime.js +2 -2
  27. package/dist/Duration.d.ts +3 -3
  28. package/dist/Duration.js +3 -3
  29. package/dist/Effect.d.ts +84 -45
  30. package/dist/Effect.d.ts.map +1 -1
  31. package/dist/Effect.js +72 -33
  32. package/dist/Effect.js.map +1 -1
  33. package/dist/Equal.d.ts +7 -7
  34. package/dist/Equal.js +5 -5
  35. package/dist/Equivalence.d.ts +17 -17
  36. package/dist/Equivalence.js +13 -13
  37. package/dist/Exit.d.ts +3 -3
  38. package/dist/Exit.js +3 -3
  39. package/dist/Formatter.d.ts +5 -5
  40. package/dist/Formatter.js +4 -4
  41. package/dist/Function.d.ts +10 -10
  42. package/dist/Function.js +3 -3
  43. package/dist/HashMap.d.ts +3 -3
  44. package/dist/HashMap.js +1 -1
  45. package/dist/Iterable.d.ts +6 -6
  46. package/dist/Iterable.js +2 -2
  47. package/dist/JsonPatch.d.ts +2 -2
  48. package/dist/Layer.d.ts +1 -1
  49. package/dist/Layer.js +1 -1
  50. package/dist/Logger.d.ts +1 -1
  51. package/dist/Logger.js +1 -1
  52. package/dist/Match.d.ts +8 -8
  53. package/dist/Match.js +8 -8
  54. package/dist/Metric.d.ts +3 -3
  55. package/dist/Metric.js +3 -3
  56. package/dist/Optic.d.ts +30 -30
  57. package/dist/Optic.js +12 -12
  58. package/dist/Option.d.ts +7 -7
  59. package/dist/Option.js +7 -7
  60. package/dist/Order.d.ts +23 -23
  61. package/dist/Order.js +20 -20
  62. package/dist/Pool.d.ts +1 -1
  63. package/dist/Pool.js +1 -1
  64. package/dist/Predicate.d.ts +88 -88
  65. package/dist/Predicate.js +47 -47
  66. package/dist/PubSub.d.ts +3 -3
  67. package/dist/PubSub.js +3 -3
  68. package/dist/Reducer.d.ts +1 -1
  69. package/dist/Reducer.js +1 -1
  70. package/dist/Result.d.ts +18 -18
  71. package/dist/Result.js +8 -8
  72. package/dist/Runtime.d.ts +1 -1
  73. package/dist/Runtime.js +1 -1
  74. package/dist/Schema.d.ts +265 -120
  75. package/dist/Schema.d.ts.map +1 -1
  76. package/dist/Schema.js +285 -116
  77. package/dist/Schema.js.map +1 -1
  78. package/dist/SchemaAST.d.ts +1 -1
  79. package/dist/SchemaAST.d.ts.map +1 -1
  80. package/dist/SchemaAST.js +13 -9
  81. package/dist/SchemaAST.js.map +1 -1
  82. package/dist/SchemaGetter.d.ts +48 -48
  83. package/dist/SchemaGetter.js +44 -44
  84. package/dist/SchemaIssue.d.ts +3 -3
  85. package/dist/SchemaIssue.js +3 -3
  86. package/dist/SchemaParser.d.ts +122 -22
  87. package/dist/SchemaParser.d.ts.map +1 -1
  88. package/dist/SchemaParser.js +186 -50
  89. package/dist/SchemaParser.js.map +1 -1
  90. package/dist/SchemaRepresentation.d.ts +1 -1
  91. package/dist/SchemaRepresentation.d.ts.map +1 -1
  92. package/dist/SchemaRepresentation.js +96 -2
  93. package/dist/SchemaRepresentation.js.map +1 -1
  94. package/dist/SchemaTransformation.d.ts +20 -20
  95. package/dist/SchemaTransformation.js +18 -18
  96. package/dist/Stream.d.ts +3 -3
  97. package/dist/Stream.js +2 -2
  98. package/dist/Stream.js.map +1 -1
  99. package/dist/String.d.ts +1 -1
  100. package/dist/String.js +1 -1
  101. package/dist/Struct.d.ts +1 -1
  102. package/dist/Struct.js +1 -1
  103. package/dist/Types.d.ts +13 -13
  104. package/dist/internal/effect.js +23 -10
  105. package/dist/internal/effect.js.map +1 -1
  106. package/dist/internal/schema/cause.d.ts +2 -0
  107. package/dist/internal/schema/cause.d.ts.map +1 -0
  108. package/dist/internal/schema/cause.js +24 -0
  109. package/dist/internal/schema/cause.js.map +1 -0
  110. package/dist/internal/schema/schema.d.ts +8 -4
  111. package/dist/internal/schema/schema.d.ts.map +1 -1
  112. package/dist/internal/schema/schema.js +21 -8
  113. package/dist/internal/schema/schema.js.map +1 -1
  114. package/dist/testing/TestSchema.d.ts +3 -3
  115. package/dist/testing/TestSchema.js +1 -1
  116. package/dist/unstable/ai/AiError.d.ts +1 -1
  117. package/dist/unstable/ai/AiError.js +1 -1
  118. package/dist/unstable/ai/Chat.d.ts +1 -1
  119. package/dist/unstable/ai/Chat.js +1 -1
  120. package/dist/unstable/cli/Prompt.js +2 -2
  121. package/dist/unstable/cli/Prompt.js.map +1 -1
  122. package/dist/unstable/httpapi/HttpApiScalar.d.ts +2 -2
  123. package/dist/unstable/rpc/Rpc.d.ts +1 -1
  124. package/dist/unstable/rpc/Rpc.js +1 -1
  125. package/dist/unstable/rpc/RpcGroup.d.ts.map +1 -1
  126. package/dist/unstable/rpc/RpcGroup.js +3 -4
  127. package/dist/unstable/rpc/RpcGroup.js.map +1 -1
  128. package/dist/unstable/sql/SqlResolver.d.ts.map +1 -1
  129. package/dist/unstable/sql/SqlResolver.js +15 -2
  130. package/dist/unstable/sql/SqlResolver.js.map +1 -1
  131. package/dist/unstable/workflow/Activity.d.ts +1 -0
  132. package/dist/unstable/workflow/Activity.d.ts.map +1 -1
  133. package/dist/unstable/workflow/Activity.js +1 -0
  134. package/dist/unstable/workflow/Activity.js.map +1 -1
  135. package/dist/unstable/workflow/WorkflowEngine.js +1 -1
  136. package/dist/unstable/workflow/WorkflowEngine.js.map +1 -1
  137. package/package.json +1 -1
  138. package/src/Array.ts +65 -65
  139. package/src/Cache.ts +1 -1
  140. package/src/Cause.ts +68 -68
  141. package/src/Channel.ts +5 -5
  142. package/src/Clock.ts +1 -1
  143. package/src/Combiner.ts +9 -9
  144. package/src/Config.ts +40 -108
  145. package/src/ConfigProvider.ts +139 -100
  146. package/src/Console.ts +1 -1
  147. package/src/Data.ts +15 -15
  148. package/src/DateTime.ts +6 -6
  149. package/src/Duration.ts +3 -3
  150. package/src/Effect.ts +89 -45
  151. package/src/Equal.ts +7 -7
  152. package/src/Equivalence.ts +17 -17
  153. package/src/Exit.ts +3 -3
  154. package/src/Formatter.ts +5 -5
  155. package/src/Function.ts +10 -10
  156. package/src/HashMap.ts +3 -3
  157. package/src/Iterable.ts +6 -6
  158. package/src/JsonPatch.ts +2 -2
  159. package/src/Layer.ts +1 -1
  160. package/src/Logger.ts +1 -1
  161. package/src/Match.ts +8 -8
  162. package/src/Metric.ts +3 -3
  163. package/src/Optic.ts +30 -30
  164. package/src/Option.ts +7 -7
  165. package/src/Order.ts +23 -23
  166. package/src/Pool.ts +1 -1
  167. package/src/Predicate.ts +88 -88
  168. package/src/PubSub.ts +3 -3
  169. package/src/Reducer.ts +1 -1
  170. package/src/Result.ts +20 -20
  171. package/src/Runtime.ts +1 -1
  172. package/src/Schema.ts +314 -131
  173. package/src/SchemaAST.ts +20 -11
  174. package/src/SchemaGetter.ts +48 -48
  175. package/src/SchemaIssue.ts +3 -3
  176. package/src/SchemaParser.ts +197 -58
  177. package/src/SchemaRepresentation.ts +73 -3
  178. package/src/SchemaTransformation.ts +20 -20
  179. package/src/Stream.ts +4 -4
  180. package/src/String.ts +1 -1
  181. package/src/Struct.ts +1 -1
  182. package/src/Types.ts +13 -13
  183. package/src/internal/effect.ts +29 -10
  184. package/src/internal/schema/cause.ts +26 -0
  185. package/src/internal/schema/schema.ts +36 -10
  186. package/src/testing/TestSchema.ts +3 -3
  187. package/src/unstable/ai/AiError.ts +1 -1
  188. package/src/unstable/ai/Chat.ts +1 -1
  189. package/src/unstable/cli/Prompt.ts +1 -1
  190. package/src/unstable/httpapi/HttpApiScalar.ts +2 -2
  191. package/src/unstable/rpc/Rpc.ts +1 -1
  192. package/src/unstable/rpc/RpcGroup.ts +3 -4
  193. package/src/unstable/sql/SqlResolver.ts +15 -2
  194. package/src/unstable/workflow/Activity.ts +2 -0
  195. package/src/unstable/workflow/WorkflowEngine.ts +1 -1
package/src/Effect.ts CHANGED
@@ -1305,8 +1305,8 @@ export const promise: <A>(
1305
1305
  ) => Effect<A> = internal.promise
1306
1306
 
1307
1307
  /**
1308
- * Creates an `Effect` that represents an asynchronous computation that might
1309
- * fail.
1308
+ * Creates an `Effect` from an asynchronous computation that may throw or
1309
+ * reject, mapping failures into the error channel.
1310
1310
  *
1311
1311
  * **When to use**
1312
1312
  *
@@ -1316,19 +1316,24 @@ export const promise: <A>(
1316
1316
  *
1317
1317
  * **Details**
1318
1318
  *
1319
- * Error Handling:
1319
+ * The promise thunk is evaluated when the effect runs. If it returns a promise
1320
+ * that resolves, the resolved value becomes the success value. If the thunk
1321
+ * throws before returning a promise, or if the returned promise rejects, the
1322
+ * thrown or rejected value is mapped into the error channel.
1320
1323
  *
1321
- * There are two ways to handle errors with `tryPromise`:
1324
+ * Passing the thunk directly maps failures to {@link Cause.UnknownError}.
1325
+ * Passing `{ try, catch }` uses `catch` to map failures to an error of type
1326
+ * `E`.
1322
1327
  *
1323
- * 1. If you don't provide a `catch` function, the error is caught and the
1324
- * effect fails with an `UnknownError`.
1325
- * 2. If you provide a `catch` function, the error is caught and the `catch`
1326
- * function maps it to an error of type `E`.
1328
+ * The thunk receives an `AbortSignal` that is aborted if the effect is
1329
+ * interrupted. The underlying asynchronous operation only stops if it observes
1330
+ * that signal.
1327
1331
  *
1328
- * Interruptions:
1332
+ * **Gotchas**
1329
1333
  *
1330
- * An optional `AbortSignal` can be provided to allow for interruption of the
1331
- * wrapped `Promise` API.
1334
+ * If `catch` throws while mapping the error, that thrown value is treated as a
1335
+ * defect. Return the error value you want in the error channel instead of
1336
+ * throwing it.
1332
1337
  *
1333
1338
  * **Example** (Wrapping a fetch request that may fail)
1334
1339
  *
@@ -2190,7 +2195,7 @@ export const failCauseSync: <E>(
2190
2195
  * The error channel of the resulting effect is of type `never`, indicating that
2191
2196
  * it cannot recover from this failure.
2192
2197
  *
2193
- * **Example** (Failing when division by zero)
2198
+ * **Example** (Failing on division by zero)
2194
2199
  *
2195
2200
  * ```ts
2196
2201
  * import { Effect } from "effect"
@@ -2215,53 +2220,56 @@ export const failCauseSync: <E>(
2215
2220
  */
2216
2221
  export const die: (defect: unknown) => Effect<never> = internal.die
2217
2222
 
2218
- const try_: <A, E>(options: {
2219
- try: LazyArg<A>
2220
- catch: (error: unknown) => E
2221
- }) => Effect<A, E> = internal.try
2223
+ const try_: <A, E = Cause.UnknownError>(
2224
+ options: {
2225
+ readonly try: LazyArg<A>
2226
+ readonly catch: (error: unknown) => E
2227
+ } | LazyArg<A>
2228
+ ) => Effect<A, E> = internal.try
2222
2229
 
2223
2230
  export {
2224
2231
  /**
2225
- * Creates an `Effect` that represents a synchronous computation that might
2226
- * fail.
2232
+ * Creates an `Effect` from a synchronous computation that may throw, mapping
2233
+ * thrown values into the error channel.
2227
2234
  *
2228
2235
  * **When to use**
2229
2236
  *
2230
2237
  * Use when you need to perform synchronous operations that might throw, such
2231
- * as parsing JSON, and convert thrown exceptions into typed Effect failures.
2238
+ * as parsing JSON, and want thrown exceptions captured as Effect errors.
2232
2239
  *
2233
2240
  * **Details**
2234
2241
  *
2235
- * Error Handling:
2242
+ * The thunk is evaluated when the effect runs. If it returns normally, the
2243
+ * returned value becomes the success value. If it throws, the thrown value is
2244
+ * mapped into the error channel.
2236
2245
  *
2237
- * There are two ways to handle errors with `try`:
2246
+ * Passing the thunk directly maps failures to {@link Cause.UnknownError}.
2247
+ * Passing `{ try, catch }` uses `catch` to map failures to an error of type
2248
+ * `E`.
2238
2249
  *
2239
- * 1. If you don't provide a `catch` function, the error is caught and the
2240
- * effect fails with an `UnknownError`.
2241
- * 2. If you provide a `catch` function, the error is caught and the `catch`
2242
- * function maps it to an error of type `E`.
2250
+ * **Gotchas**
2251
+ *
2252
+ * If `catch` throws while mapping the error, that thrown value is treated as
2253
+ * a defect. Return the error value you want in the error channel instead of
2254
+ * throwing it.
2243
2255
  *
2244
- * **Example** (Parsing JSON with typed error mapping)
2256
+ * **Example** (Parsing JSON)
2245
2257
  *
2246
2258
  * ```ts
2247
2259
  * import { Effect } from "effect"
2248
2260
  *
2249
2261
  * const parseJSON = (input: string) =>
2250
- * Effect.try({
2251
- * try: () => JSON.parse(input),
2252
- * catch: (error) => error as Error
2253
- * })
2262
+ * Effect.try(() => JSON.parse(input))
2254
2263
  *
2255
2264
  * // Success case
2256
2265
  * Effect.runPromise(parseJSON("{\"name\": \"Alice\"}")).then(console.log)
2257
2266
  * // Output: { name: "Alice" }
2258
2267
  *
2259
- * // Failure case
2268
+ * // Failure case maps the thrown value to UnknownError
2260
2269
  * Effect.runPromiseExit(parseJSON("invalid json")).then(console.log)
2261
- * // Output: Exit.failure with Error
2262
2270
  * ```
2263
2271
  *
2264
- * **Example** (Mapping synchronous exceptions to a tagged error)
2272
+ * **Example** (Mapping exceptions to a tagged error)
2265
2273
  *
2266
2274
  * ```ts
2267
2275
  * import { Data, Effect } from "effect"
@@ -2417,6 +2425,42 @@ export const fromOption: <A>(
2417
2425
  option: Option<A>
2418
2426
  ) => Effect<A, Cause.NoSuchElementError> = internal.fromOption
2419
2427
 
2428
+ /**
2429
+ * Converts an `Option` of an `Effect` into an `Effect` of an `Option`.
2430
+ *
2431
+ * **When to use**
2432
+ *
2433
+ * Use when an effect should run only when an optional value is present, while
2434
+ * preserving absence as a successful `None`.
2435
+ *
2436
+ * **Details**
2437
+ *
2438
+ * - `None` becomes an effect that succeeds with `None`
2439
+ * - `Some(effect)` runs the inner effect and wraps its success value in `Some`
2440
+ * - Inner failures are preserved in the resulting effect
2441
+ *
2442
+ * **Example** (Transposing an Option of an Effect)
2443
+ *
2444
+ * ```ts
2445
+ * import { Effect, Option } from "effect"
2446
+ *
2447
+ * const some = Option.some(Effect.succeed(42))
2448
+ *
2449
+ * // ┌─── Effect<Option<number>, never, never>
2450
+ * // ▼
2451
+ * const program = Effect.transposeOption(some)
2452
+ *
2453
+ * Effect.runPromise(program).then(console.log)
2454
+ * // Output: { _id: 'Option', _tag: 'Some', value: 42 }
2455
+ * ```
2456
+ *
2457
+ * @category converting
2458
+ * @since 3.13.0
2459
+ */
2460
+ export const transposeOption: <A = never, E = never, R = never>(
2461
+ self: Option<Effect<A, E, R>>
2462
+ ) => Effect<Option<A>, E, R> = internal.transposeOption
2463
+
2420
2464
  /**
2421
2465
  * Converts a nullable value to an `Effect`, failing with a `NoSuchElementError`
2422
2466
  * when the value is `null` or `undefined`.
@@ -2468,7 +2512,7 @@ export const fromNullishOr: <A>(value: A) => Effect<NonNullable<A>, Cause.NoSuch
2468
2512
  * Since effects are immutable, `flatMap` always returns a new effect instead of
2469
2513
  * changing the original one.
2470
2514
  *
2471
- * **Example** (Syntax)
2515
+ * **Example** (Choosing flatMap syntax variants)
2472
2516
  *
2473
2517
  * ```ts
2474
2518
  * import { Effect, pipe } from "effect"
@@ -2539,7 +2583,7 @@ export const flatMap: {
2539
2583
  * Since effects are immutable, `flatMap` always returns a new effect instead of
2540
2584
  * changing the original one.
2541
2585
  *
2542
- * **Example** (Syntax)
2586
+ * **Example** (Choosing flatMap syntax variants)
2543
2587
  *
2544
2588
  * ```ts
2545
2589
  * import { Effect, pipe } from "effect"
@@ -2610,7 +2654,7 @@ export const flatMap: {
2610
2654
  * Since effects are immutable, `flatMap` always returns a new effect instead of
2611
2655
  * changing the original one.
2612
2656
  *
2613
- * **Example** (Syntax)
2657
+ * **Example** (Choosing flatMap syntax variants)
2614
2658
  *
2615
2659
  * ```ts
2616
2660
  * import { Effect, pipe } from "effect"
@@ -2701,7 +2745,7 @@ export const flatten: <A, E, R, E2, R2>(self: Effect<Effect<A, E, R>, E2, R2>) =
2701
2745
  * Failures or requirements from either effect are preserved in the returned
2702
2746
  * effect.
2703
2747
  *
2704
- * **Example** (Syntax)
2748
+ * **Example** (Choosing andThen syntax variants)
2705
2749
  *
2706
2750
  * ```ts
2707
2751
  * import { Effect, pipe } from "effect"
@@ -2777,7 +2821,7 @@ export const andThen: {
2777
2821
  * Failures or requirements from either effect are preserved in the returned
2778
2822
  * effect.
2779
2823
  *
2780
- * **Example** (Syntax)
2824
+ * **Example** (Choosing andThen syntax variants)
2781
2825
  *
2782
2826
  * ```ts
2783
2827
  * import { Effect, pipe } from "effect"
@@ -2853,7 +2897,7 @@ export const andThen: {
2853
2897
  * Failures or requirements from either effect are preserved in the returned
2854
2898
  * effect.
2855
2899
  *
2856
- * **Example** (Syntax)
2900
+ * **Example** (Choosing andThen syntax variants)
2857
2901
  *
2858
2902
  * ```ts
2859
2903
  * import { Effect, pipe } from "effect"
@@ -2929,7 +2973,7 @@ export const andThen: {
2929
2973
  * Failures or requirements from either effect are preserved in the returned
2930
2974
  * effect.
2931
2975
  *
2932
- * **Example** (Syntax)
2976
+ * **Example** (Choosing andThen syntax variants)
2933
2977
  *
2934
2978
  * ```ts
2935
2979
  * import { Effect, pipe } from "effect"
@@ -3005,7 +3049,7 @@ export const andThen: {
3005
3049
  * Failures or requirements from either effect are preserved in the returned
3006
3050
  * effect.
3007
3051
  *
3008
- * **Example** (Syntax)
3052
+ * **Example** (Choosing andThen syntax variants)
3009
3053
  *
3010
3054
  * ```ts
3011
3055
  * import { Effect, pipe } from "effect"
@@ -3498,7 +3542,7 @@ export const exit: <A, E, R>(
3498
3542
  * effect is not modified. Instead, a new effect is returned with the updated
3499
3543
  * value.
3500
3544
  *
3501
- * **Example** (Syntax)
3545
+ * **Example** (Choosing map syntax variants)
3502
3546
  *
3503
3547
  * ```ts
3504
3548
  * import { Effect, pipe } from "effect"
@@ -3554,7 +3598,7 @@ export const map: {
3554
3598
  * effect is not modified. Instead, a new effect is returned with the updated
3555
3599
  * value.
3556
3600
  *
3557
- * **Example** (Syntax)
3601
+ * **Example** (Choosing map syntax variants)
3558
3602
  *
3559
3603
  * ```ts
3560
3604
  * import { Effect, pipe } from "effect"
@@ -3610,7 +3654,7 @@ export const map: {
3610
3654
  * effect is not modified. Instead, a new effect is returned with the updated
3611
3655
  * value.
3612
3656
  *
3613
- * **Example** (Syntax)
3657
+ * **Example** (Choosing map syntax variants)
3614
3658
  *
3615
3659
  * ```ts
3616
3660
  * import { Effect, pipe } from "effect"
@@ -12879,7 +12923,7 @@ export const acquireDisposable: <A extends AsyncDisposable | Disposable, E, R>(
12879
12923
  * is not desired, errors produced by the `release` `Effect` value can be caught
12880
12924
  * and ignored.
12881
12925
  *
12882
- * **Example** (Using a resource with cleanup)
12926
+ * **Example** (Acquiring resources with cleanup)
12883
12927
  *
12884
12928
  * ```ts
12885
12929
  * import { Console, Effect, Exit } from "effect"
package/src/Equal.ts CHANGED
@@ -26,7 +26,7 @@ import { hasProperty } from "./Predicate.ts"
26
26
  *
27
27
  * This is a pure constant with no allocation or side effects.
28
28
  *
29
- * **Example** (Implementing Equal on a Class)
29
+ * **Example** (Implementing Equal on a class)
30
30
  *
31
31
  * ```ts
32
32
  * import { Equal, Hash } from "effect"
@@ -74,7 +74,7 @@ export const symbol = "~effect/interfaces/Equal"
74
74
  * - {@link equals} delegates to this method when both operands implement it.
75
75
  * If only one operand implements `Equal`, they are considered unequal.
76
76
  *
77
- * **Example** (Coordinate with Value Equality)
77
+ * **Example** (Comparing coordinates by value)
78
78
  *
79
79
  * ```ts
80
80
  * import { Equal, Hash } from "effect"
@@ -137,7 +137,7 @@ export interface Equal extends Hash.Hash {
137
137
  * mutated after their first comparison.**
138
138
  * - Map and Set comparisons are O(n²) in size.
139
139
  *
140
- * **Example** (Comparing Values)
140
+ * **Example** (Comparing values)
141
141
  *
142
142
  * ```ts
143
143
  * import { Equal } from "effect"
@@ -404,7 +404,7 @@ const compareSets = makeCompareSet(compareBoth)
404
404
  * {@link symbol}.
405
405
  * - Acts as a TypeScript type guard, narrowing the input to {@link Equal}.
406
406
  *
407
- * **Example** (Type Guard)
407
+ * **Example** (Checking Equal values)
408
408
  *
409
409
  * ```ts
410
410
  * import { Equal, Hash } from "effect"
@@ -445,7 +445,7 @@ export const isEqual = (u: unknown): u is Equal => hasProperty(u, symbol)
445
445
  * {@link equals}.
446
446
  * - Pure; allocates a thin wrapper on each call.
447
447
  *
448
- * **Example** (Deduplicating with Equal Semantics)
448
+ * **Example** (Deduplicating with Equal semantics)
449
449
  *
450
450
  * ```ts
451
451
  * import { Array, Equal } from "effect"
@@ -479,7 +479,7 @@ export const asEquivalence: <A>() => Equivalence<A> = () => equals
479
479
  * - Each call creates a **new** proxy, so `byReference(x) !== byReference(x)`.
480
480
  * - Does **not** mutate the original object (unlike {@link byReferenceUnsafe}).
481
481
  *
482
- * **Example** (Opting Out of Structural Equality)
482
+ * **Example** (Opting out of structural equality)
483
483
  *
484
484
  * ```ts
485
485
  * import { Equal } from "effect"
@@ -524,7 +524,7 @@ export const byReference = <T extends object>(obj: T): T => byReferenceUnsafe(ne
524
524
  *
525
525
  * The marking is irreversible for the lifetime of the object.
526
526
  *
527
- * **Example** (Marking an Object for Reference Equality)
527
+ * **Example** (Marking an object for reference equality)
528
528
  *
529
529
  * ```ts
530
530
  * import { Equal } from "effect"
@@ -25,7 +25,7 @@ import * as Reducer from "./Reducer.ts"
25
25
  * - Returns `boolean`: `true` if values are equivalent, `false` otherwise
26
26
  * - Must satisfy reflexive, symmetric, and transitive properties
27
27
  *
28
- * **Example** (Simple number equivalence)
28
+ * **Example** (Defining simple number equivalence)
29
29
  *
30
30
  * ```ts
31
31
  * import type { Equivalence } from "effect"
@@ -36,7 +36,7 @@ import * as Reducer from "./Reducer.ts"
36
36
  * console.log(numberEq(1, 2)) // false
37
37
  * ```
38
38
  *
39
- * **Example** (Custom object equivalence)
39
+ * **Example** (Defining custom object equivalence)
40
40
  *
41
41
  * ```ts
42
42
  * import type { Equivalence } from "effect"
@@ -128,7 +128,7 @@ export interface EquivalenceTypeLambda extends TypeLambda {
128
128
  * console.log(caseInsensitive(str, str)) // true (fast path)
129
129
  * ```
130
130
  *
131
- * **Example** (Numeric tolerance equivalence)
131
+ * **Example** (Comparing numbers with tolerance)
132
132
  *
133
133
  * ```ts
134
134
  * import { Equivalence } from "effect"
@@ -167,7 +167,7 @@ const isStrictEquivalent = (x: unknown, y: unknown) => x === y
167
167
  *
168
168
  * `NaN !== NaN`, so `NaN` values are never considered equivalent.
169
169
  *
170
- * **Example** (Primitive types)
170
+ * **Example** (Comparing primitive types)
171
171
  *
172
172
  * ```ts
173
173
  * import { Equivalence } from "effect"
@@ -179,7 +179,7 @@ const isStrictEquivalent = (x: unknown, y: unknown) => x === y
179
179
  * console.log(strictEq(NaN, NaN)) // false (NaN !== NaN)
180
180
  * ```
181
181
  *
182
- * **Example** (Reference equality for objects)
182
+ * **Example** (Comparing objects by reference)
183
183
  *
184
184
  * ```ts
185
185
  * import { Equivalence } from "effect"
@@ -486,7 +486,7 @@ export const combine: {
486
486
  * console.log(point3DEq(point1, point3)) // false (different z)
487
487
  * ```
488
488
  *
489
- * **Example** (Empty collection edge case)
489
+ * **Example** (Handling empty collections)
490
490
  *
491
491
  * ```ts
492
492
  * import { Equivalence } from "effect"
@@ -527,7 +527,7 @@ export const combineAll = <A>(collection: Iterable<Equivalence<A>>): Equivalence
527
527
  * - Useful for comparing by one property or normalizing values before
528
528
  * comparison, such as case-insensitive strings
529
529
  *
530
- * **Example** (Equivalence based on object property)
530
+ * **Example** (Deriving equivalence from an object property)
531
531
  *
532
532
  * ```ts
533
533
  * import { Equivalence } from "effect"
@@ -588,7 +588,7 @@ export const mapInput: {
588
588
  * - Useful for comparing by one property or normalizing values before
589
589
  * comparison, such as case-insensitive strings
590
590
  *
591
- * **Example** (Equivalence based on object property)
591
+ * **Example** (Deriving equivalence from an object property)
592
592
  *
593
593
  * ```ts
594
594
  * import { Equivalence } from "effect"
@@ -649,7 +649,7 @@ export const mapInput: {
649
649
  * - Useful for comparing by one property or normalizing values before
650
650
  * comparison, such as case-insensitive strings
651
651
  *
652
- * **Example** (Equivalence based on object property)
652
+ * **Example** (Deriving equivalence from an object property)
653
653
  *
654
654
  * ```ts
655
655
  * import { Equivalence } from "effect"
@@ -715,7 +715,7 @@ export const mapInput: {
715
715
  * respective equivalences, and it also satisfies reflexive, symmetric, and
716
716
  * transitive properties.
717
717
  *
718
- * **Example** (Homogeneous tuple equivalence)
718
+ * **Example** (Comparing homogeneous tuples)
719
719
  *
720
720
  * ```ts
721
721
  * import { Equivalence } from "effect"
@@ -734,7 +734,7 @@ export const mapInput: {
734
734
  * console.log(stringTupleEq(tuple1, tuple3)) // false (different third element)
735
735
  * ```
736
736
  *
737
- * **Example** (Tuple with custom equivalences)
737
+ * **Example** (Comparing tuples with custom equivalences)
738
738
  *
739
739
  * ```ts
740
740
  * import { Equivalence } from "effect"
@@ -804,7 +804,7 @@ export {
804
804
  * - Empty arrays are considered equivalent
805
805
  * - The result is also an equivalence that satisfies reflexive, symmetric, and transitive properties
806
806
  *
807
- * **Example** (Number array equivalence)
807
+ * **Example** (Comparing number arrays)
808
808
  *
809
809
  * ```ts
810
810
  * import { Equivalence } from "effect"
@@ -856,7 +856,7 @@ export {
856
856
  * are equivalent according to their equivalences, and it also satisfies
857
857
  * reflexive, symmetric, and transitive properties.
858
858
  *
859
- * **Example** (Struct with different equivalences per field)
859
+ * **Example** (Comparing structs with different equivalences per field)
860
860
  *
861
861
  * ```ts
862
862
  * import { Equivalence } from "effect"
@@ -886,7 +886,7 @@ export {
886
886
  * console.log(personEq(person1, person3)) // false (different age)
887
887
  * ```
888
888
  *
889
- * **Example** (Partial equivalence for specific fields)
889
+ * **Example** (Comparing specific fields)
890
890
  *
891
891
  * ```ts
892
892
  * import { Equivalence } from "effect"
@@ -937,7 +937,7 @@ export function Struct<R extends Record<string, Equivalence<any>>>(
937
937
  * - Empty objects are considered equivalent
938
938
  * - The result is also an equivalence that satisfies reflexive, symmetric, and transitive properties
939
939
  *
940
- * **Example** (Record with string values)
940
+ * **Example** (Defining records with string values)
941
941
  *
942
942
  * ```ts
943
943
  * import { Equivalence } from "effect"
@@ -954,7 +954,7 @@ export function Struct<R extends Record<string, Equivalence<any>>>(
954
954
  * console.log(stringRecordEq(record1, record4)) // false (different keys)
955
955
  * ```
956
956
  *
957
- * **Example** (Record with number values)
957
+ * **Example** (Defining records with number values)
958
958
  *
959
959
  * ```ts
960
960
  * import { Equivalence } from "effect"
@@ -1064,7 +1064,7 @@ export function makeReducer<A>() {
1064
1064
  * console.log(Equivalence.Date(invalidDate1, d1)) // false
1065
1065
  * ```
1066
1066
  *
1067
- * **Example** (Reference vs value equality)
1067
+ * **Example** (Comparing reference and value equality)
1068
1068
  *
1069
1069
  * ```ts
1070
1070
  * import { Equivalence } from "effect"
package/src/Exit.ts CHANGED
@@ -356,7 +356,7 @@ export {
356
356
  * Equivalent to `Exit.succeed(undefined)` but shared as a single instance,
357
357
  * avoiding allocation for a common case.
358
358
  *
359
- * **Example** (Using the void Exit)
359
+ * **Example** (Referencing the void Exit)
360
360
  *
361
361
  * ```ts
362
362
  * import { Exit } from "effect"
@@ -382,7 +382,7 @@ export {
382
382
  * Use as a type guard to narrow `Exit<A, E>` to `Success<A, E>` and access the
383
383
  * `value` property.
384
384
  *
385
- * **Example** (Narrowing to Success)
385
+ * **Example** (Narrowing to success)
386
386
  *
387
387
  * ```ts
388
388
  * import { Exit } from "effect"
@@ -410,7 +410,7 @@ export const isSuccess: <A, E>(self: Exit<A, E>) => self is Success<A, E> = effe
410
410
  * Use as a type guard to narrow `Exit<A, E>` to `Failure<A, E>` and access the
411
411
  * `cause` property.
412
412
  *
413
- * **Example** (Narrowing to Failure)
413
+ * **Example** (Narrowing to failure)
414
414
  *
415
415
  * ```ts
416
416
  * import { Exit } from "effect"
package/src/Formatter.ts CHANGED
@@ -23,7 +23,7 @@ import { getRedacted, redact, symbolRedactable } from "./Redactable.ts"
23
23
  *
24
24
  * This is a pure callable type and carries no runtime implementation. It is contravariant in `Value` and covariant in `Format`.
25
25
  *
26
- * **Example** (Define a custom formatter)
26
+ * **Example** (Defining a custom formatter)
27
27
  *
28
28
  * ```ts
29
29
  * import type { Formatter } from "effect"
@@ -73,7 +73,7 @@ export interface Formatter<in Value, out Format = string> {
73
73
  * `"\t"`). Defaults to `0` (compact).
74
74
  * - `ignoreToString` — skip calling `toString()`. Defaults to `false`.
75
75
  *
76
- * **Example** (Compact output)
76
+ * **Example** (Formatting compact output)
77
77
  *
78
78
  * ```ts
79
79
  * import { Formatter } from "effect"
@@ -97,7 +97,7 @@ export interface Formatter<in Value, out Format = string> {
97
97
  * // }
98
98
  * ```
99
99
  *
100
- * **Example** (Circular reference handling)
100
+ * **Example** (Handling circular references)
101
101
  *
102
102
  * ```ts
103
103
  * import { Formatter } from "effect"
@@ -257,7 +257,7 @@ function safeToString(input: any): string {
257
257
  * `Symbol`, `undefined`, and functions, follow standard `JSON.stringify`
258
258
  * behavior. The `space` parameter controls indentation and defaults to `0`.
259
259
  *
260
- * **Example** (Compact JSON)
260
+ * **Example** (Formatting compact JSON)
261
261
  *
262
262
  * ```ts
263
263
  * import { Formatter } from "effect"
@@ -266,7 +266,7 @@ function safeToString(input: any): string {
266
266
  * // {"name":"Alice","age":30}
267
267
  * ```
268
268
  *
269
- * **Example** (Circular reference handling)
269
+ * **Example** (Handling circular references)
270
270
  *
271
271
  * ```ts
272
272
  * import { Formatter } from "effect"
package/src/Function.ts CHANGED
@@ -51,7 +51,7 @@ export interface FunctionTypeLambda extends TypeLambda {
51
51
  * whether the current call is data-first. Arity is the common case. Use a
52
52
  * predicate when optional arguments make arity ambiguous.
53
53
  *
54
- * **Example** (Using arity to determine data-first or data-last style)
54
+ * **Example** (Selecting data-first or data-last style by arity)
55
55
  *
56
56
  * ```ts
57
57
  * import { Function, pipe } from "effect"
@@ -65,7 +65,7 @@ export interface FunctionTypeLambda extends TypeLambda {
65
65
  * console.log(pipe(2, sum(3))) // 5
66
66
  * ```
67
67
  *
68
- * **Example** (Using call signatures to define the overloads)
68
+ * **Example** (Defining overloads with call signatures)
69
69
  *
70
70
  * ```ts
71
71
  * import { Function, pipe } from "effect"
@@ -79,7 +79,7 @@ export interface FunctionTypeLambda extends TypeLambda {
79
79
  * console.log(pipe(2, sum(3))) // 5
80
80
  * ```
81
81
  *
82
- * **Example** (Using a predicate to determine data-first or data-last style)
82
+ * **Example** (Selecting data-first or data-last style with a predicate)
83
83
  *
84
84
  * ```ts
85
85
  * import { Function, pipe } from "effect"
@@ -115,7 +115,7 @@ export const dual: {
115
115
  * whether the current call is data-first. Arity is the common case. Use a
116
116
  * predicate when optional arguments make arity ambiguous.
117
117
  *
118
- * **Example** (Using arity to determine data-first or data-last style)
118
+ * **Example** (Selecting data-first or data-last style by arity)
119
119
  *
120
120
  * ```ts
121
121
  * import { Function, pipe } from "effect"
@@ -129,7 +129,7 @@ export const dual: {
129
129
  * console.log(pipe(2, sum(3))) // 5
130
130
  * ```
131
131
  *
132
- * **Example** (Using call signatures to define the overloads)
132
+ * **Example** (Defining overloads with call signatures)
133
133
  *
134
134
  * ```ts
135
135
  * import { Function, pipe } from "effect"
@@ -143,7 +143,7 @@ export const dual: {
143
143
  * console.log(pipe(2, sum(3))) // 5
144
144
  * ```
145
145
  *
146
- * **Example** (Using a predicate to determine data-first or data-last style)
146
+ * **Example** (Selecting data-first or data-last style with a predicate)
147
147
  *
148
148
  * ```ts
149
149
  * import { Function, pipe } from "effect"
@@ -179,7 +179,7 @@ export const dual: {
179
179
  * whether the current call is data-first. Arity is the common case. Use a
180
180
  * predicate when optional arguments make arity ambiguous.
181
181
  *
182
- * **Example** (Using arity to determine data-first or data-last style)
182
+ * **Example** (Selecting data-first or data-last style by arity)
183
183
  *
184
184
  * ```ts
185
185
  * import { Function, pipe } from "effect"
@@ -193,7 +193,7 @@ export const dual: {
193
193
  * console.log(pipe(2, sum(3))) // 5
194
194
  * ```
195
195
  *
196
- * **Example** (Using call signatures to define the overloads)
196
+ * **Example** (Defining overloads with call signatures)
197
197
  *
198
198
  * ```ts
199
199
  * import { Function, pipe } from "effect"
@@ -207,7 +207,7 @@ export const dual: {
207
207
  * console.log(pipe(2, sum(3))) // 5
208
208
  * ```
209
209
  *
210
- * **Example** (Using a predicate to determine data-first or data-last style)
210
+ * **Example** (Selecting data-first or data-last style with a predicate)
211
211
  *
212
212
  * ```ts
213
213
  * import { Function, pipe } from "effect"
@@ -760,7 +760,7 @@ export const untupled = <A extends ReadonlyArray<unknown>, B>(f: (a: A) => B): (
760
760
  * Each function passed after the initial value must accept a single argument,
761
761
  * because `pipe` calls each step with only the previous result.
762
762
  *
763
- * **Example** (Using pipeline syntax)
763
+ * **Example** (Piping values through functions)
764
764
  *
765
765
  * In this example, `1` is passed to the first function, and each result becomes
766
766
  * the input for the next function.
package/src/HashMap.ts CHANGED
@@ -1867,7 +1867,7 @@ export const map: {
1867
1867
  *
1868
1868
  * The hash and equality behavior of both maps have to be the same.
1869
1869
  *
1870
- * **Example** (FlatMapping values)
1870
+ * **Example** (Flat mapping values)
1871
1871
  *
1872
1872
  * ```ts
1873
1873
  * import { HashMap } from "effect"
@@ -1894,7 +1894,7 @@ export const flatMap: {
1894
1894
  *
1895
1895
  * The hash and equality behavior of both maps have to be the same.
1896
1896
  *
1897
- * **Example** (FlatMapping values)
1897
+ * **Example** (Flat mapping values)
1898
1898
  *
1899
1899
  * ```ts
1900
1900
  * import { HashMap } from "effect"
@@ -1921,7 +1921,7 @@ export const flatMap: {
1921
1921
  *
1922
1922
  * The hash and equality behavior of both maps have to be the same.
1923
1923
  *
1924
- * **Example** (FlatMapping values)
1924
+ * **Example** (Flat mapping values)
1925
1925
  *
1926
1926
  * ```ts
1927
1927
  * import { HashMap } from "effect"