effect 3.13.8 → 3.13.9

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 (333) hide show
  1. package/dist/cjs/Array.js +460 -431
  2. package/dist/cjs/Array.js.map +1 -1
  3. package/dist/cjs/BigDecimal.js +31 -89
  4. package/dist/cjs/BigDecimal.js.map +1 -1
  5. package/dist/cjs/BigInt.js +27 -71
  6. package/dist/cjs/BigInt.js.map +1 -1
  7. package/dist/cjs/Boolean.js +12 -10
  8. package/dist/cjs/Boolean.js.map +1 -1
  9. package/dist/cjs/Brand.js +2 -0
  10. package/dist/cjs/Brand.js.map +1 -1
  11. package/dist/cjs/Channel.js +0 -2
  12. package/dist/cjs/Channel.js.map +1 -1
  13. package/dist/cjs/Chunk.js +4 -0
  14. package/dist/cjs/Chunk.js.map +1 -1
  15. package/dist/cjs/Config.js +0 -5
  16. package/dist/cjs/Config.js.map +1 -1
  17. package/dist/cjs/Context.js +14 -24
  18. package/dist/cjs/Context.js.map +1 -1
  19. package/dist/cjs/Cron.js +11 -25
  20. package/dist/cjs/Cron.js.map +1 -1
  21. package/dist/cjs/Data.js +6 -0
  22. package/dist/cjs/Data.js.map +1 -1
  23. package/dist/cjs/DateTime.js +2 -0
  24. package/dist/cjs/DateTime.js.map +1 -1
  25. package/dist/cjs/Duration.js +2 -2
  26. package/dist/cjs/Effect.js +122 -53
  27. package/dist/cjs/Effect.js.map +1 -1
  28. package/dist/cjs/Either.js +21 -25
  29. package/dist/cjs/Either.js.map +1 -1
  30. package/dist/cjs/Encoding.js +1 -1
  31. package/dist/cjs/Equivalence.js +1 -1
  32. package/dist/cjs/Function.js +21 -24
  33. package/dist/cjs/Function.js.map +1 -1
  34. package/dist/cjs/HashMap.js +0 -3
  35. package/dist/cjs/HashMap.js.map +1 -1
  36. package/dist/cjs/Iterable.js +9 -2
  37. package/dist/cjs/Iterable.js.map +1 -1
  38. package/dist/cjs/List.js +2 -0
  39. package/dist/cjs/List.js.map +1 -1
  40. package/dist/cjs/Logger.js +0 -2
  41. package/dist/cjs/Logger.js.map +1 -1
  42. package/dist/cjs/Mailbox.js +1 -0
  43. package/dist/cjs/Mailbox.js.map +1 -1
  44. package/dist/cjs/ManagedRuntime.js +0 -2
  45. package/dist/cjs/ManagedRuntime.js.map +1 -1
  46. package/dist/cjs/Metric.js +6 -12
  47. package/dist/cjs/Metric.js.map +1 -1
  48. package/dist/cjs/Number.js +22 -61
  49. package/dist/cjs/Number.js.map +1 -1
  50. package/dist/cjs/Option.js +5 -0
  51. package/dist/cjs/Option.js.map +1 -1
  52. package/dist/cjs/Order.js +1 -0
  53. package/dist/cjs/Order.js.map +1 -1
  54. package/dist/cjs/Ordering.js +2 -7
  55. package/dist/cjs/Ordering.js.map +1 -1
  56. package/dist/cjs/Pool.js +1 -1
  57. package/dist/cjs/Predicate.js +36 -77
  58. package/dist/cjs/Predicate.js.map +1 -1
  59. package/dist/cjs/Random.js +1 -2
  60. package/dist/cjs/Random.js.map +1 -1
  61. package/dist/cjs/RcMap.js +5 -2
  62. package/dist/cjs/RcMap.js.map +1 -1
  63. package/dist/cjs/Record.js +28 -107
  64. package/dist/cjs/Record.js.map +1 -1
  65. package/dist/cjs/Redacted.js +3 -0
  66. package/dist/cjs/Redacted.js.map +1 -1
  67. package/dist/cjs/RegExp.js +2 -2
  68. package/dist/cjs/RegExp.js.map +1 -1
  69. package/dist/cjs/STM.js +3 -5
  70. package/dist/cjs/STM.js.map +1 -1
  71. package/dist/cjs/Schedule.js +2 -2
  72. package/dist/cjs/Schema.js +14 -13
  73. package/dist/cjs/Schema.js.map +1 -1
  74. package/dist/cjs/SchemaAST.js +0 -2
  75. package/dist/cjs/SchemaAST.js.map +1 -1
  76. package/dist/cjs/Sink.js +14 -10
  77. package/dist/cjs/Sink.js.map +1 -1
  78. package/dist/cjs/Stream.js +24 -25
  79. package/dist/cjs/Stream.js.map +1 -1
  80. package/dist/cjs/String.js +31 -2
  81. package/dist/cjs/String.js.map +1 -1
  82. package/dist/cjs/Struct.js +6 -0
  83. package/dist/cjs/Struct.js.map +1 -1
  84. package/dist/cjs/Symbol.js +1 -2
  85. package/dist/cjs/Symbol.js.map +1 -1
  86. package/dist/cjs/TestClock.js.map +1 -1
  87. package/dist/cjs/Trie.js +28 -0
  88. package/dist/cjs/Trie.js.map +1 -1
  89. package/dist/cjs/Tuple.js +9 -24
  90. package/dist/cjs/Tuple.js.map +1 -1
  91. package/dist/cjs/internal/matcher.js +1 -1
  92. package/dist/cjs/internal/matcher.js.map +1 -1
  93. package/dist/cjs/internal/version.js +1 -1
  94. package/dist/dts/Array.d.ts +1235 -1188
  95. package/dist/dts/Array.d.ts.map +1 -1
  96. package/dist/dts/BigDecimal.d.ts +61 -189
  97. package/dist/dts/BigDecimal.d.ts.map +1 -1
  98. package/dist/dts/BigInt.d.ts +57 -165
  99. package/dist/dts/BigInt.d.ts.map +1 -1
  100. package/dist/dts/Boolean.d.ts +28 -18
  101. package/dist/dts/Boolean.d.ts.map +1 -1
  102. package/dist/dts/Brand.d.ts +3 -3
  103. package/dist/dts/Brand.d.ts.map +1 -1
  104. package/dist/dts/Channel.d.ts +0 -6
  105. package/dist/dts/Channel.d.ts.map +1 -1
  106. package/dist/dts/Chunk.d.ts +15 -0
  107. package/dist/dts/Chunk.d.ts.map +1 -1
  108. package/dist/dts/Config.d.ts +0 -5
  109. package/dist/dts/Config.d.ts.map +1 -1
  110. package/dist/dts/Context.d.ts +26 -54
  111. package/dist/dts/Context.d.ts.map +1 -1
  112. package/dist/dts/Cron.d.ts +9 -23
  113. package/dist/dts/Cron.d.ts.map +1 -1
  114. package/dist/dts/Data.d.ts +8 -0
  115. package/dist/dts/Data.d.ts.map +1 -1
  116. package/dist/dts/DateTime.d.ts +6 -0
  117. package/dist/dts/DateTime.d.ts.map +1 -1
  118. package/dist/dts/Duration.d.ts +2 -2
  119. package/dist/dts/Effect.d.ts +153 -71
  120. package/dist/dts/Effect.d.ts.map +1 -1
  121. package/dist/dts/Either.d.ts +44 -57
  122. package/dist/dts/Either.d.ts.map +1 -1
  123. package/dist/dts/Encoding.d.ts +1 -1
  124. package/dist/dts/Equivalence.d.ts +1 -1
  125. package/dist/dts/Function.d.ts +55 -59
  126. package/dist/dts/Function.d.ts.map +1 -1
  127. package/dist/dts/HashMap.d.ts +0 -9
  128. package/dist/dts/HashMap.d.ts.map +1 -1
  129. package/dist/dts/Iterable.d.ts +13 -2
  130. package/dist/dts/Iterable.d.ts.map +1 -1
  131. package/dist/dts/List.d.ts +10 -0
  132. package/dist/dts/List.d.ts.map +1 -1
  133. package/dist/dts/Logger.d.ts +0 -6
  134. package/dist/dts/Logger.d.ts.map +1 -1
  135. package/dist/dts/Mailbox.d.ts +1 -0
  136. package/dist/dts/Mailbox.d.ts.map +1 -1
  137. package/dist/dts/ManagedRuntime.d.ts +0 -2
  138. package/dist/dts/ManagedRuntime.d.ts.map +1 -1
  139. package/dist/dts/Metric.d.ts +14 -20
  140. package/dist/dts/Metric.d.ts.map +1 -1
  141. package/dist/dts/Micro.d.ts +1 -1
  142. package/dist/dts/Number.d.ts +52 -155
  143. package/dist/dts/Number.d.ts.map +1 -1
  144. package/dist/dts/Option.d.ts +12 -0
  145. package/dist/dts/Option.d.ts.map +1 -1
  146. package/dist/dts/Order.d.ts +1 -0
  147. package/dist/dts/Order.d.ts.map +1 -1
  148. package/dist/dts/Ordering.d.ts +4 -17
  149. package/dist/dts/Ordering.d.ts.map +1 -1
  150. package/dist/dts/Pool.d.ts +1 -1
  151. package/dist/dts/Predicate.d.ts +56 -133
  152. package/dist/dts/Predicate.d.ts.map +1 -1
  153. package/dist/dts/Random.d.ts +1 -2
  154. package/dist/dts/Random.d.ts.map +1 -1
  155. package/dist/dts/RcMap.d.ts +15 -6
  156. package/dist/dts/RcMap.d.ts.map +1 -1
  157. package/dist/dts/Record.d.ts +68 -279
  158. package/dist/dts/Record.d.ts.map +1 -1
  159. package/dist/dts/Redacted.d.ts +3 -0
  160. package/dist/dts/Redacted.d.ts.map +1 -1
  161. package/dist/dts/RegExp.d.ts +2 -2
  162. package/dist/dts/RegExp.d.ts.map +1 -1
  163. package/dist/dts/STM.d.ts +5 -7
  164. package/dist/dts/STM.d.ts.map +1 -1
  165. package/dist/dts/Schedule.d.ts +7 -7
  166. package/dist/dts/Schema.d.ts +31 -25
  167. package/dist/dts/Schema.d.ts.map +1 -1
  168. package/dist/dts/SchemaAST.d.ts +0 -2
  169. package/dist/dts/SchemaAST.d.ts.map +1 -1
  170. package/dist/dts/Sink.d.ts +14 -10
  171. package/dist/dts/Sink.d.ts.map +1 -1
  172. package/dist/dts/Stream.d.ts +58 -62
  173. package/dist/dts/Stream.d.ts.map +1 -1
  174. package/dist/dts/String.d.ts +47 -2
  175. package/dist/dts/String.d.ts.map +1 -1
  176. package/dist/dts/Struct.d.ts +12 -0
  177. package/dist/dts/Struct.d.ts.map +1 -1
  178. package/dist/dts/Symbol.d.ts +1 -2
  179. package/dist/dts/Symbol.d.ts.map +1 -1
  180. package/dist/dts/TestClock.d.ts +2 -1
  181. package/dist/dts/TestClock.d.ts.map +1 -1
  182. package/dist/dts/Trie.d.ts +66 -0
  183. package/dist/dts/Trie.d.ts.map +1 -1
  184. package/dist/dts/Tuple.d.ts +21 -62
  185. package/dist/dts/Tuple.d.ts.map +1 -1
  186. package/dist/dts/Utils.d.ts +8 -8
  187. package/dist/esm/Array.js +474 -442
  188. package/dist/esm/Array.js.map +1 -1
  189. package/dist/esm/BigDecimal.js +31 -89
  190. package/dist/esm/BigDecimal.js.map +1 -1
  191. package/dist/esm/BigInt.js +27 -71
  192. package/dist/esm/BigInt.js.map +1 -1
  193. package/dist/esm/Boolean.js +12 -10
  194. package/dist/esm/Boolean.js.map +1 -1
  195. package/dist/esm/Brand.js +2 -0
  196. package/dist/esm/Brand.js.map +1 -1
  197. package/dist/esm/Channel.js +0 -2
  198. package/dist/esm/Channel.js.map +1 -1
  199. package/dist/esm/Chunk.js +4 -0
  200. package/dist/esm/Chunk.js.map +1 -1
  201. package/dist/esm/Config.js +0 -5
  202. package/dist/esm/Config.js.map +1 -1
  203. package/dist/esm/Context.js +14 -24
  204. package/dist/esm/Context.js.map +1 -1
  205. package/dist/esm/Cron.js +11 -25
  206. package/dist/esm/Cron.js.map +1 -1
  207. package/dist/esm/Data.js +7 -0
  208. package/dist/esm/Data.js.map +1 -1
  209. package/dist/esm/DateTime.js +2 -0
  210. package/dist/esm/DateTime.js.map +1 -1
  211. package/dist/esm/Duration.js +2 -2
  212. package/dist/esm/Effect.js +123 -53
  213. package/dist/esm/Effect.js.map +1 -1
  214. package/dist/esm/Either.js +22 -25
  215. package/dist/esm/Either.js.map +1 -1
  216. package/dist/esm/Encoding.js +1 -1
  217. package/dist/esm/Equivalence.js +1 -1
  218. package/dist/esm/Function.js +21 -24
  219. package/dist/esm/Function.js.map +1 -1
  220. package/dist/esm/HashMap.js +0 -3
  221. package/dist/esm/HashMap.js.map +1 -1
  222. package/dist/esm/Iterable.js +9 -2
  223. package/dist/esm/Iterable.js.map +1 -1
  224. package/dist/esm/List.js +2 -0
  225. package/dist/esm/List.js.map +1 -1
  226. package/dist/esm/Logger.js +0 -2
  227. package/dist/esm/Logger.js.map +1 -1
  228. package/dist/esm/Mailbox.js +1 -0
  229. package/dist/esm/Mailbox.js.map +1 -1
  230. package/dist/esm/ManagedRuntime.js +0 -2
  231. package/dist/esm/ManagedRuntime.js.map +1 -1
  232. package/dist/esm/Metric.js +6 -12
  233. package/dist/esm/Metric.js.map +1 -1
  234. package/dist/esm/Micro.js +1 -1
  235. package/dist/esm/Number.js +22 -61
  236. package/dist/esm/Number.js.map +1 -1
  237. package/dist/esm/Option.js +6 -0
  238. package/dist/esm/Option.js.map +1 -1
  239. package/dist/esm/Order.js +1 -0
  240. package/dist/esm/Order.js.map +1 -1
  241. package/dist/esm/Ordering.js +2 -7
  242. package/dist/esm/Ordering.js.map +1 -1
  243. package/dist/esm/Pool.js +1 -1
  244. package/dist/esm/Predicate.js +36 -77
  245. package/dist/esm/Predicate.js.map +1 -1
  246. package/dist/esm/Random.js +1 -2
  247. package/dist/esm/Random.js.map +1 -1
  248. package/dist/esm/RcMap.js +5 -2
  249. package/dist/esm/RcMap.js.map +1 -1
  250. package/dist/esm/Record.js +28 -107
  251. package/dist/esm/Record.js.map +1 -1
  252. package/dist/esm/Redacted.js +3 -0
  253. package/dist/esm/Redacted.js.map +1 -1
  254. package/dist/esm/RegExp.js +2 -2
  255. package/dist/esm/RegExp.js.map +1 -1
  256. package/dist/esm/STM.js +3 -5
  257. package/dist/esm/STM.js.map +1 -1
  258. package/dist/esm/Schedule.js +2 -2
  259. package/dist/esm/Schema.js +14 -13
  260. package/dist/esm/Schema.js.map +1 -1
  261. package/dist/esm/SchemaAST.js +0 -2
  262. package/dist/esm/SchemaAST.js.map +1 -1
  263. package/dist/esm/Sink.js +14 -10
  264. package/dist/esm/Sink.js.map +1 -1
  265. package/dist/esm/Stream.js +25 -25
  266. package/dist/esm/Stream.js.map +1 -1
  267. package/dist/esm/String.js +31 -2
  268. package/dist/esm/String.js.map +1 -1
  269. package/dist/esm/Struct.js +6 -0
  270. package/dist/esm/Struct.js.map +1 -1
  271. package/dist/esm/Symbol.js +1 -2
  272. package/dist/esm/Symbol.js.map +1 -1
  273. package/dist/esm/TestClock.js.map +1 -1
  274. package/dist/esm/Trie.js +28 -0
  275. package/dist/esm/Trie.js.map +1 -1
  276. package/dist/esm/Tuple.js +11 -30
  277. package/dist/esm/Tuple.js.map +1 -1
  278. package/dist/esm/internal/matcher.js +1 -1
  279. package/dist/esm/internal/matcher.js.map +1 -1
  280. package/dist/esm/internal/version.js +1 -1
  281. package/package.json +1 -1
  282. package/src/Array.ts +1235 -1188
  283. package/src/BigDecimal.ts +61 -189
  284. package/src/BigInt.ts +57 -165
  285. package/src/Boolean.ts +28 -18
  286. package/src/Brand.ts +3 -3
  287. package/src/Channel.ts +0 -6
  288. package/src/Chunk.ts +16 -0
  289. package/src/Config.ts +0 -5
  290. package/src/Context.ts +26 -54
  291. package/src/Cron.ts +11 -25
  292. package/src/Data.ts +8 -0
  293. package/src/DateTime.ts +6 -0
  294. package/src/Duration.ts +2 -2
  295. package/src/Effect.ts +153 -71
  296. package/src/Either.ts +45 -58
  297. package/src/Encoding.ts +1 -1
  298. package/src/Equivalence.ts +1 -1
  299. package/src/Function.ts +55 -59
  300. package/src/HashMap.ts +0 -9
  301. package/src/Iterable.ts +13 -2
  302. package/src/List.ts +12 -0
  303. package/src/Logger.ts +0 -6
  304. package/src/Mailbox.ts +1 -0
  305. package/src/ManagedRuntime.ts +0 -2
  306. package/src/Metric.ts +14 -20
  307. package/src/Micro.ts +1 -1
  308. package/src/Number.ts +52 -155
  309. package/src/Option.ts +12 -0
  310. package/src/Order.ts +1 -0
  311. package/src/Ordering.ts +4 -17
  312. package/src/Pool.ts +1 -1
  313. package/src/Predicate.ts +56 -133
  314. package/src/Random.ts +1 -2
  315. package/src/RcMap.ts +15 -6
  316. package/src/Record.ts +68 -279
  317. package/src/Redacted.ts +3 -0
  318. package/src/RegExp.ts +2 -2
  319. package/src/STM.ts +5 -7
  320. package/src/Schedule.ts +7 -7
  321. package/src/Schema.ts +31 -25
  322. package/src/SchemaAST.ts +0 -2
  323. package/src/Sink.ts +14 -10
  324. package/src/Stream.ts +56 -61
  325. package/src/String.ts +47 -2
  326. package/src/Struct.ts +12 -0
  327. package/src/Symbol.ts +1 -2
  328. package/src/TestClock.ts +2 -1
  329. package/src/Trie.ts +66 -0
  330. package/src/Tuple.ts +21 -62
  331. package/src/Utils.ts +8 -8
  332. package/src/internal/matcher.ts +1 -1
  333. package/src/internal/version.ts +1 -1
package/src/Effect.ts CHANGED
@@ -858,7 +858,7 @@ export const once: <A, E, R>(self: Effect<A, E, R>) => Effect<Effect<void, E, R>
858
858
  *
859
859
  * For instance, if the input is a tuple:
860
860
  *
861
- * ```ts
861
+ * ```ts skip-type-checking
862
862
  * // ┌─── a tuple of effects
863
863
  * // ▼
864
864
  * Effect.all([effect1, effect2, ...])
@@ -9558,7 +9558,7 @@ export const flipWith: {
9558
9558
  *
9559
9559
  * **Syntax**
9560
9560
  *
9561
- * ```ts
9561
+ * ```ts skip-type-checking
9562
9562
  * const mappedEffect = pipe(myEffect, Effect.map(transformation))
9563
9563
  * // or
9564
9564
  * const mappedEffect = Effect.map(myEffect, transformation)
@@ -9605,7 +9605,7 @@ export const map: {
9605
9605
  *
9606
9606
  * **Syntax**
9607
9607
  *
9608
- * ```ts
9608
+ * ```ts skip-type-checking
9609
9609
  * const mappedEffect = pipe(myEffect, Effect.map(transformation))
9610
9610
  * // or
9611
9611
  * const mappedEffect = Effect.map(myEffect, transformation)
@@ -9652,7 +9652,7 @@ export const map: {
9652
9652
  *
9653
9653
  * **Syntax**
9654
9654
  *
9655
- * ```ts
9655
+ * ```ts skip-type-checking
9656
9656
  * const mappedEffect = pipe(myEffect, Effect.map(transformation))
9657
9657
  * // or
9658
9658
  * const mappedEffect = Effect.map(myEffect, transformation)
@@ -15234,6 +15234,7 @@ export const updateService: {
15234
15234
  *
15235
15235
  * @example
15236
15236
  * ```ts
15237
+ * import * as assert from "node:assert"
15237
15238
  * import { Effect, pipe } from "effect"
15238
15239
  *
15239
15240
  * const result = pipe(
@@ -15266,6 +15267,7 @@ export const Do: Effect<{}> = effect.Do
15266
15267
  *
15267
15268
  * @example
15268
15269
  * ```ts
15270
+ * import * as assert from "node:assert"
15269
15271
  * import { Effect, pipe } from "effect"
15270
15272
  *
15271
15273
  * const result = pipe(
@@ -15297,6 +15299,7 @@ export const bind: {
15297
15299
  *
15298
15300
  * @example
15299
15301
  * ```ts
15302
+ * import * as assert from "node:assert"
15300
15303
  * import { Effect, pipe } from "effect"
15301
15304
  *
15302
15305
  * const result = pipe(
@@ -15328,6 +15331,7 @@ export const bind: {
15328
15331
  *
15329
15332
  * @example
15330
15333
  * ```ts
15334
+ * import * as assert from "node:assert"
15331
15335
  * import { Effect, pipe } from "effect"
15332
15336
  *
15333
15337
  * const result = pipe(
@@ -15356,6 +15360,7 @@ export const bind: {
15356
15360
  *
15357
15361
  * @example
15358
15362
  * ```ts
15363
+ * import * as assert from "node:assert"
15359
15364
  * import { Effect, Either, pipe } from "effect"
15360
15365
  *
15361
15366
  * const result = pipe(
@@ -15380,6 +15385,7 @@ export const bindAll: {
15380
15385
  *
15381
15386
  * @example
15382
15387
  * ```ts
15388
+ * import * as assert from "node:assert"
15383
15389
  * import { Effect, Either, pipe } from "effect"
15384
15390
  *
15385
15391
  * const result = pipe(
@@ -15424,6 +15430,7 @@ export const bindAll: {
15424
15430
  *
15425
15431
  * @example
15426
15432
  * ```ts
15433
+ * import * as assert from "node:assert"
15427
15434
  * import { Effect, Either, pipe } from "effect"
15428
15435
  *
15429
15436
  * const result = pipe(
@@ -15485,6 +15492,7 @@ export const bindAll: {
15485
15492
  *
15486
15493
  * @example
15487
15494
  * ```ts
15495
+ * import * as assert from "node:assert"
15488
15496
  * import { Effect, pipe } from "effect"
15489
15497
  *
15490
15498
  * const result = pipe(
@@ -15516,6 +15524,7 @@ export const bindTo: {
15516
15524
  *
15517
15525
  * @example
15518
15526
  * ```ts
15527
+ * import * as assert from "node:assert"
15519
15528
  * import { Effect, pipe } from "effect"
15520
15529
  *
15521
15530
  * const result = pipe(
@@ -15547,6 +15556,7 @@ export const bindTo: {
15547
15556
  *
15548
15557
  * @example
15549
15558
  * ```ts
15559
+ * import * as assert from "node:assert"
15550
15560
  * import { Effect, pipe } from "effect"
15551
15561
  *
15552
15562
  * const result = pipe(
@@ -15593,6 +15603,7 @@ export {
15593
15603
  *
15594
15604
  * @example
15595
15605
  * ```ts
15606
+ * import * as assert from "node:assert"
15596
15607
  * import { Effect, pipe } from "effect"
15597
15608
  *
15598
15609
  * const result = pipe(
@@ -17385,7 +17396,8 @@ export const whenRef: {
17385
17396
  * operations that depend on previous results.
17386
17397
  *
17387
17398
  * **Syntax**
17388
- * ```ts
17399
+ *
17400
+ * ```ts skip-type-checking
17389
17401
  * const flatMappedEffect = pipe(myEffect, Effect.flatMap(transformation))
17390
17402
  * // or
17391
17403
  * const flatMappedEffect = Effect.flatMap(myEffect, transformation)
@@ -17446,7 +17458,8 @@ export const flatMap: {
17446
17458
  * operations that depend on previous results.
17447
17459
  *
17448
17460
  * **Syntax**
17449
- * ```ts
17461
+ *
17462
+ * ```ts skip-type-checking
17450
17463
  * const flatMappedEffect = pipe(myEffect, Effect.flatMap(transformation))
17451
17464
  * // or
17452
17465
  * const flatMappedEffect = Effect.flatMap(myEffect, transformation)
@@ -17507,7 +17520,8 @@ export const flatMap: {
17507
17520
  * operations that depend on previous results.
17508
17521
  *
17509
17522
  * **Syntax**
17510
- * ```ts
17523
+ *
17524
+ * ```ts skip-type-checking
17511
17525
  * const flatMappedEffect = pipe(myEffect, Effect.flatMap(transformation))
17512
17526
  * // or
17513
17527
  * const flatMappedEffect = Effect.flatMap(myEffect, transformation)
@@ -17570,7 +17584,8 @@ export const flatMap: {
17570
17584
  * first.
17571
17585
  *
17572
17586
  * **Syntax**
17573
- * ```ts
17587
+ *
17588
+ * ```ts skip-type-checking
17574
17589
  * const transformedEffect = pipe(myEffect, Effect.andThen(anotherEffect))
17575
17590
  * // or
17576
17591
  * const transformedEffect = Effect.andThen(myEffect, anotherEffect)
@@ -17645,7 +17660,8 @@ export const andThen: {
17645
17660
  * first.
17646
17661
  *
17647
17662
  * **Syntax**
17648
- * ```ts
17663
+ *
17664
+ * ```ts skip-type-checking
17649
17665
  * const transformedEffect = pipe(myEffect, Effect.andThen(anotherEffect))
17650
17666
  * // or
17651
17667
  * const transformedEffect = Effect.andThen(myEffect, anotherEffect)
@@ -17724,7 +17740,8 @@ export const andThen: {
17724
17740
  * first.
17725
17741
  *
17726
17742
  * **Syntax**
17727
- * ```ts
17743
+ *
17744
+ * ```ts skip-type-checking
17728
17745
  * const transformedEffect = pipe(myEffect, Effect.andThen(anotherEffect))
17729
17746
  * // or
17730
17747
  * const transformedEffect = Effect.andThen(myEffect, anotherEffect)
@@ -17803,7 +17820,8 @@ export const andThen: {
17803
17820
  * first.
17804
17821
  *
17805
17822
  * **Syntax**
17806
- * ```ts
17823
+ *
17824
+ * ```ts skip-type-checking
17807
17825
  * const transformedEffect = pipe(myEffect, Effect.andThen(anotherEffect))
17808
17826
  * // or
17809
17827
  * const transformedEffect = Effect.andThen(myEffect, anotherEffect)
@@ -17880,7 +17898,8 @@ export const andThen: {
17880
17898
  * first.
17881
17899
  *
17882
17900
  * **Syntax**
17883
- * ```ts
17901
+ *
17902
+ * ```ts skip-type-checking
17884
17903
  * const transformedEffect = pipe(myEffect, Effect.andThen(anotherEffect))
17885
17904
  * // or
17886
17905
  * const transformedEffect = Effect.andThen(myEffect, anotherEffect)
@@ -18520,13 +18539,13 @@ export const raceAll: <Eff extends Effect<any, any, any>>(
18520
18539
  *
18521
18540
  * If you want a quicker return, you can disconnect the interrupt signal for both effects. Instead of calling:
18522
18541
  *
18523
- * ```ts
18542
+ * ```ts skip-type-checking
18524
18543
  * Effect.raceFirst(task1, task2)
18525
18544
  * ```
18526
18545
  *
18527
18546
  * You can use:
18528
18547
  *
18529
- * ```ts
18548
+ * ```ts skip-type-checking
18530
18549
  * Effect.raceFirst(Effect.disconnect(task1), Effect.disconnect(task2))
18531
18550
  * ```
18532
18551
  *
@@ -18657,13 +18676,13 @@ export const raceFirst: {
18657
18676
  *
18658
18677
  * If you want a quicker return, you can disconnect the interrupt signal for both effects. Instead of calling:
18659
18678
  *
18660
- * ```ts
18679
+ * ```ts skip-type-checking
18661
18680
  * Effect.raceFirst(task1, task2)
18662
18681
  * ```
18663
18682
  *
18664
18683
  * You can use:
18665
18684
  *
18666
- * ```ts
18685
+ * ```ts skip-type-checking
18667
18686
  * Effect.raceFirst(Effect.disconnect(task1), Effect.disconnect(task2))
18668
18687
  * ```
18669
18688
  *
@@ -18794,13 +18813,13 @@ export const raceFirst: {
18794
18813
  *
18795
18814
  * If you want a quicker return, you can disconnect the interrupt signal for both effects. Instead of calling:
18796
18815
  *
18797
- * ```ts
18816
+ * ```ts skip-type-checking
18798
18817
  * Effect.raceFirst(task1, task2)
18799
18818
  * ```
18800
18819
  *
18801
18820
  * You can use:
18802
18821
  *
18803
- * ```ts
18822
+ * ```ts skip-type-checking
18804
18823
  * Effect.raceFirst(Effect.disconnect(task1), Effect.disconnect(task2))
18805
18824
  * ```
18806
18825
  *
@@ -20399,7 +20418,7 @@ export const forever: <A, E, R>(self: Effect<A, E, R>) => Effect<never, E, R> =
20399
20418
  * This function provides a way to implement effectful loops, similar to a
20400
20419
  * `while` loop in JavaScript.
20401
20420
  *
20402
- * ```ts
20421
+ * ```ts skip-type-checking
20403
20422
  * let result = initial
20404
20423
  *
20405
20424
  * while (options.while(result)) {
@@ -20457,7 +20476,7 @@ export const iterate: {
20457
20476
  * This function provides a way to implement effectful loops, similar to a
20458
20477
  * `while` loop in JavaScript.
20459
20478
  *
20460
- * ```ts
20479
+ * ```ts skip-type-checking
20461
20480
  * let result = initial
20462
20481
  *
20463
20482
  * while (options.while(result)) {
@@ -20521,7 +20540,7 @@ export const iterate: {
20521
20540
  * This function provides a way to implement effectful loops, similar to a
20522
20541
  * `while` loop in JavaScript.
20523
20542
  *
20524
- * ```ts
20543
+ * ```ts skip-type-checking
20525
20544
  * let result = initial
20526
20545
  *
20527
20546
  * while (options.while(result)) {
@@ -20588,7 +20607,7 @@ export const iterate: {
20588
20607
  * iterating as long as the `while` condition evaluates to `true`, similar to a
20589
20608
  * `while` loop in JavaScript.
20590
20609
  *
20591
- * ```ts
20610
+ * ```ts skip-type-checking
20592
20611
  * let state = initial
20593
20612
  * const result = []
20594
20613
  *
@@ -20684,7 +20703,7 @@ export const loop: {
20684
20703
  * iterating as long as the `while` condition evaluates to `true`, similar to a
20685
20704
  * `while` loop in JavaScript.
20686
20705
  *
20687
- * ```ts
20706
+ * ```ts skip-type-checking
20688
20707
  * let state = initial
20689
20708
  * const result = []
20690
20709
  *
@@ -20788,7 +20807,7 @@ export const loop: {
20788
20807
  * iterating as long as the `while` condition evaluates to `true`, similar to a
20789
20808
  * `while` loop in JavaScript.
20790
20809
  *
20791
- * ```ts
20810
+ * ```ts skip-type-checking
20792
20811
  * let state = initial
20793
20812
  * const result = []
20794
20813
  *
@@ -20892,7 +20911,7 @@ export const loop: {
20892
20911
  * iterating as long as the `while` condition evaluates to `true`, similar to a
20893
20912
  * `while` loop in JavaScript.
20894
20913
  *
20895
- * ```ts
20914
+ * ```ts skip-type-checking
20896
20915
  * let state = initial
20897
20916
  * const result = []
20898
20917
  *
@@ -20996,7 +21015,7 @@ export const loop: {
20996
21015
  * iterating as long as the `while` condition evaluates to `true`, similar to a
20997
21016
  * `while` loop in JavaScript.
20998
21017
  *
20999
- * ```ts
21018
+ * ```ts skip-type-checking
21000
21019
  * let state = initial
21001
21020
  * const result = []
21002
21021
  *
@@ -27732,77 +27751,140 @@ export namespace fn {
27732
27751
  }
27733
27752
 
27734
27753
  /**
27735
- * Creates a function that returns an Effect, which includes a stack trace
27736
- * with relevant location information if an error occurs and is automatically
27737
- * traced with a span pointing to the call site.
27754
+ * The `Effect.fn` function allows you to create traced functions that return an
27755
+ * effect. It provides two key features:
27738
27756
  *
27739
- * The name passed as the first argument is used as a span.
27757
+ * - **Stack traces with location details** if an error occurs.
27758
+ * - **Automatic span creation** for tracing when a span name is provided.
27740
27759
  *
27741
- * The name is optional; if not provided, the span won't be added, but the stack trace will still be present.
27760
+ * If a span name is passed as the first argument, the function's execution is
27761
+ * tracked using that name. If no name is provided, stack tracing still works,
27762
+ * but spans are not created.
27742
27763
  *
27743
- * The function can be created using either a generator function that can yield
27744
- * effects or a normal function that returns an effect.
27764
+ * A function can be defined using either:
27745
27765
  *
27746
- * `Effect.fn` also acts as a `pipe` function, allowing you to create a pipeline
27747
- * after the function definition using the effect returned by the generator
27748
- * function as the starting value of the pipeline.
27766
+ * - A generator function, allowing the use of `yield*` for effect composition.
27767
+ * - A regular function that returns an `Effect`.
27749
27768
  *
27750
- * @see {@link fnUntraced} for a version of this function that doesn't add a span.
27769
+ * **Example** (Creating a Traced Function with a Span Name)
27751
27770
  *
27752
- * @example
27753
27771
  * ```ts
27754
- * // Title: Creating a traced function with a generator function
27755
27772
  * import { Effect } from "effect"
27756
27773
  *
27757
- * const logExample = Effect.fn("logExample")( // Definition location: 4
27758
- * function*<N extends number>(n: N) {
27759
- * yield* Effect.annotateCurrentSpan("n", n)
27760
- * console.log(`got: ${n}`)
27761
- * yield* Effect.fail(new Error()) // Raise location: 8
27762
- * }
27763
- * )
27774
+ * const myfunc = Effect.fn("myspan")(function* <N extends number>(n: N) {
27775
+ * yield* Effect.annotateCurrentSpan("n", n) // Attach metadata to the span
27776
+ * console.log(`got: ${n}`)
27777
+ * yield* Effect.fail(new Error("Boom!")) // Simulate failure
27778
+ * })
27764
27779
  *
27765
- * // Effect.runFork(
27766
- * // logExample(100).pipe( // Call location: 13
27767
- * // Effect.catchAllCause(Effect.logError)
27768
- * // )
27769
- * // )
27780
+ * Effect.runFork(myfunc(100).pipe(Effect.catchAllCause(Effect.logError)))
27770
27781
  * // Output:
27771
27782
  * // got: 100
27772
- * // timestamp=... level=ERROR fiber=#0 cause="Error: An error has occurred
27773
- * // at <anonymous> (/.../index.ts:8:24) <= Raise location
27774
- * // at logExample (/.../index.ts:4:27) <= Definition location
27775
- * // at logExample (/.../index.ts:13:3)" <= Call location
27783
+ * // timestamp=... level=ERROR fiber=#0 cause="Error: Boom!
27784
+ * // at <anonymous> (/.../index.ts:6:22) <= Raise location
27785
+ * // at myspan (/.../index.ts:3:23) <= Definition location
27786
+ * // at myspan (/.../index.ts:9:16)" <= Call location
27776
27787
  * ```
27777
27788
  *
27778
- * @example
27779
- * ```ts
27780
- * // Title: Creating a traced function with a function
27789
+ * `Effect.fn` automatically creates spans. The spans capture information about
27790
+ * the function execution, including metadata and error details.
27791
+ *
27792
+ * **Example** (Exporting Spans to the Console)
27793
+ *
27794
+ * ```ts skip-type-checking
27781
27795
  * import { Effect } from "effect"
27796
+ * import { NodeSdk } from "@effect/opentelemetry"
27797
+ * import {
27798
+ * ConsoleSpanExporter,
27799
+ * BatchSpanProcessor
27800
+ * } from "@opentelemetry/sdk-trace-base"
27801
+ *
27802
+ * const myfunc = Effect.fn("myspan")(function* <N extends number>(n: N) {
27803
+ * yield* Effect.annotateCurrentSpan("n", n)
27804
+ * console.log(`got: ${n}`)
27805
+ * yield* Effect.fail(new Error("Boom!"))
27806
+ * })
27782
27807
  *
27783
- * const logExample = Effect.fn("logExample")(
27784
- * function(n: number) {
27785
- * console.log(`got: ${n}`)
27786
- * return Effect.fail(new Error(`An error has occurred`))
27787
- * }
27788
- * )
27808
+ * const program = myfunc(100)
27809
+ *
27810
+ * const NodeSdkLive = NodeSdk.layer(() => ({
27811
+ * resource: { serviceName: "example" },
27812
+ * // Export span data to the console
27813
+ * spanProcessor: new BatchSpanProcessor(new ConsoleSpanExporter())
27814
+ * }))
27815
+ *
27816
+ * Effect.runFork(program.pipe(Effect.provide(NodeSdkLive)))
27817
+ * // Output:
27818
+ * // got: 100
27819
+ * // {
27820
+ * // resource: {
27821
+ * // attributes: {
27822
+ * // 'service.name': 'example',
27823
+ * // 'telemetry.sdk.language': 'nodejs',
27824
+ * // 'telemetry.sdk.name': '@effect/opentelemetry',
27825
+ * // 'telemetry.sdk.version': '1.30.1'
27826
+ * // }
27827
+ * // },
27828
+ * // instrumentationScope: { name: 'example', version: undefined, schemaUrl: undefined },
27829
+ * // traceId: '22801570119e57a6e2aacda3dec9665b',
27830
+ * // parentId: undefined,
27831
+ * // traceState: undefined,
27832
+ * // name: 'myspan',
27833
+ * // id: '7af530c1e01bc0cb',
27834
+ * // kind: 0,
27835
+ * // timestamp: 1741182277518402.2,
27836
+ * // duration: 4300.416,
27837
+ * // attributes: {
27838
+ * // n: 100,
27839
+ * // 'code.stacktrace': 'at <anonymous> (/.../index.ts:8:23)\n' +
27840
+ * // 'at <anonymous> (/.../index.ts:14:17)'
27841
+ * // },
27842
+ * // status: { code: 2, message: 'Boom!' },
27843
+ * // events: [
27844
+ * // {
27845
+ * // name: 'exception',
27846
+ * // attributes: {
27847
+ * // 'exception.type': 'Error',
27848
+ * // 'exception.message': 'Boom!',
27849
+ * // 'exception.stacktrace': 'Error: Boom!\n' +
27850
+ * // ' at <anonymous> (/.../index.ts:11:22)\n' +
27851
+ * // ' at myspan (/.../index.ts:8:23)\n' +
27852
+ * // ' at myspan (/.../index.ts:14:17)'
27853
+ * // },
27854
+ * // time: [ 1741182277, 522702583 ],
27855
+ * // droppedAttributesCount: 0
27856
+ * // }
27857
+ * // ],
27858
+ * // links: []
27859
+ * // }
27789
27860
  * ```
27790
27861
  *
27791
- * @example
27862
+ * `Effect.fn` also acts as a pipe function, allowing you to create a pipeline
27863
+ * after the function definition using the effect returned by the generator
27864
+ * function as the starting value of the pipeline.
27865
+ *
27866
+ * **Example** (Creating a Traced Function with a Delay)
27867
+ *
27792
27868
  * ```ts
27793
- * // Title: Creating a traced function and a pipeline
27794
27869
  * import { Effect } from "effect"
27795
27870
  *
27796
- * const logExample = Effect.fn("logExample")(
27797
- * function(n: number) {
27871
+ * const myfunc = Effect.fn(
27872
+ * function* (n: number) {
27798
27873
  * console.log(`got: ${n}`)
27799
- * return Effect.fail(new Error(`An error has occurred`))
27874
+ * yield* Effect.fail(new Error("Boom!"))
27800
27875
  * },
27801
- * // Add a delay to the effect
27802
- * Effect.delay("1 second")
27876
+ * // You can access both the created effect and the original arguments
27877
+ * (effect, n) => Effect.delay(effect, `${n / 100} seconds`)
27803
27878
  * )
27879
+ *
27880
+ * Effect.runFork(myfunc(100).pipe(Effect.catchAllCause(Effect.logError)))
27881
+ * // Output:
27882
+ * // got: 100
27883
+ * // timestamp=... level=ERROR fiber=#0 cause="Error: Boom! (<= after 1 second)
27804
27884
  * ```
27805
27885
  *
27886
+ * @see {@link fnUntraced} for a version of this function that doesn't add a span.
27887
+ *
27806
27888
  * @since 3.11.0
27807
27889
  * @category Tracing
27808
27890
  */