effect 3.1.1 → 3.1.2

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 (257) hide show
  1. package/dist/cjs/Array.js +10 -13
  2. package/dist/cjs/Array.js.map +1 -1
  3. package/dist/cjs/BigDecimal.js +14 -17
  4. package/dist/cjs/BigDecimal.js.map +1 -1
  5. package/dist/cjs/BigInt.js +41 -46
  6. package/dist/cjs/BigInt.js.map +1 -1
  7. package/dist/cjs/Boolean.js +13 -13
  8. package/dist/cjs/Brand.js +2 -2
  9. package/dist/cjs/Chunk.js +3 -3
  10. package/dist/cjs/Context.js +15 -20
  11. package/dist/cjs/Context.js.map +1 -1
  12. package/dist/cjs/Cron.js +3 -6
  13. package/dist/cjs/Cron.js.map +1 -1
  14. package/dist/cjs/Data.js +8 -13
  15. package/dist/cjs/Data.js.map +1 -1
  16. package/dist/cjs/Duration.js +1 -1
  17. package/dist/cjs/Effect.js +77 -9
  18. package/dist/cjs/Effect.js.map +1 -1
  19. package/dist/cjs/Either.js +117 -59
  20. package/dist/cjs/Either.js.map +1 -1
  21. package/dist/cjs/FiberHandle.js.map +1 -1
  22. package/dist/cjs/FiberMap.js.map +1 -1
  23. package/dist/cjs/FiberSet.js.map +1 -1
  24. package/dist/cjs/Function.js +2 -2
  25. package/dist/cjs/Function.js.map +1 -1
  26. package/dist/cjs/Iterable.js +10 -13
  27. package/dist/cjs/Iterable.js.map +1 -1
  28. package/dist/cjs/List.js +2 -2
  29. package/dist/cjs/Metric.js +5 -7
  30. package/dist/cjs/Metric.js.map +1 -1
  31. package/dist/cjs/Number.js +20 -21
  32. package/dist/cjs/Number.js.map +1 -1
  33. package/dist/cjs/Option.js +223 -164
  34. package/dist/cjs/Option.js.map +1 -1
  35. package/dist/cjs/Order.js +1 -2
  36. package/dist/cjs/Order.js.map +1 -1
  37. package/dist/cjs/Ordering.js +2 -2
  38. package/dist/cjs/Predicate.js +9 -12
  39. package/dist/cjs/Predicate.js.map +1 -1
  40. package/dist/cjs/Readable.js.map +1 -1
  41. package/dist/cjs/Record.js +35 -47
  42. package/dist/cjs/Record.js.map +1 -1
  43. package/dist/cjs/RegExp.js +1 -1
  44. package/dist/cjs/Request.js +2 -2
  45. package/dist/cjs/Request.js.map +1 -1
  46. package/dist/cjs/Stream.js +82 -4
  47. package/dist/cjs/Stream.js.map +1 -1
  48. package/dist/cjs/String.js +81 -111
  49. package/dist/cjs/String.js.map +1 -1
  50. package/dist/cjs/Struct.js +13 -19
  51. package/dist/cjs/Struct.js.map +1 -1
  52. package/dist/cjs/Subscribable.js.map +1 -1
  53. package/dist/cjs/Symbol.js +3 -3
  54. package/dist/cjs/TestAnnotation.js.map +1 -1
  55. package/dist/cjs/TestAnnotationMap.js.map +1 -1
  56. package/dist/cjs/TestAnnotations.js.map +1 -1
  57. package/dist/cjs/TestClock.js.map +1 -1
  58. package/dist/cjs/TestLive.js.map +1 -1
  59. package/dist/cjs/TestSized.js.map +1 -1
  60. package/dist/cjs/Trie.js +28 -44
  61. package/dist/cjs/Trie.js.map +1 -1
  62. package/dist/cjs/Utils.js.map +1 -1
  63. package/dist/cjs/internal/core-effect.js +4 -11
  64. package/dist/cjs/internal/core-effect.js.map +1 -1
  65. package/dist/cjs/internal/doNotation.js +23 -0
  66. package/dist/cjs/internal/doNotation.js.map +1 -0
  67. package/dist/cjs/internal/groupBy.js.map +1 -1
  68. package/dist/cjs/internal/stream.js +3 -7
  69. package/dist/cjs/internal/stream.js.map +1 -1
  70. package/dist/cjs/internal/version.js +1 -1
  71. package/dist/dts/Array.d.ts +10 -13
  72. package/dist/dts/Array.d.ts.map +1 -1
  73. package/dist/dts/BigDecimal.d.ts +14 -17
  74. package/dist/dts/BigDecimal.d.ts.map +1 -1
  75. package/dist/dts/BigInt.d.ts +41 -46
  76. package/dist/dts/BigInt.d.ts.map +1 -1
  77. package/dist/dts/Boolean.d.ts +13 -13
  78. package/dist/dts/Brand.d.ts +3 -3
  79. package/dist/dts/Chunk.d.ts +3 -3
  80. package/dist/dts/Context.d.ts +15 -20
  81. package/dist/dts/Context.d.ts.map +1 -1
  82. package/dist/dts/Cron.d.ts +3 -6
  83. package/dist/dts/Cron.d.ts.map +1 -1
  84. package/dist/dts/Data.d.ts +10 -16
  85. package/dist/dts/Data.d.ts.map +1 -1
  86. package/dist/dts/Duration.d.ts +1 -1
  87. package/dist/dts/Effect.d.ts +120 -26
  88. package/dist/dts/Effect.d.ts.map +1 -1
  89. package/dist/dts/Either.d.ts +155 -64
  90. package/dist/dts/Either.d.ts.map +1 -1
  91. package/dist/dts/FiberHandle.d.ts.map +1 -1
  92. package/dist/dts/FiberMap.d.ts.map +1 -1
  93. package/dist/dts/FiberSet.d.ts.map +1 -1
  94. package/dist/dts/Function.d.ts +4 -2
  95. package/dist/dts/Function.d.ts.map +1 -1
  96. package/dist/dts/HashMap.d.ts +2 -2
  97. package/dist/dts/Iterable.d.ts +10 -13
  98. package/dist/dts/Iterable.d.ts.map +1 -1
  99. package/dist/dts/List.d.ts +2 -2
  100. package/dist/dts/Metric.d.ts +5 -7
  101. package/dist/dts/Metric.d.ts.map +1 -1
  102. package/dist/dts/Number.d.ts +20 -21
  103. package/dist/dts/Number.d.ts.map +1 -1
  104. package/dist/dts/Option.d.ts +245 -155
  105. package/dist/dts/Option.d.ts.map +1 -1
  106. package/dist/dts/Order.d.ts +1 -2
  107. package/dist/dts/Order.d.ts.map +1 -1
  108. package/dist/dts/Ordering.d.ts +2 -2
  109. package/dist/dts/Predicate.d.ts +9 -12
  110. package/dist/dts/Predicate.d.ts.map +1 -1
  111. package/dist/dts/Readable.d.ts.map +1 -1
  112. package/dist/dts/Record.d.ts +35 -47
  113. package/dist/dts/Record.d.ts.map +1 -1
  114. package/dist/dts/RegExp.d.ts +1 -1
  115. package/dist/dts/Request.d.ts +2 -2
  116. package/dist/dts/Request.d.ts.map +1 -1
  117. package/dist/dts/Stream.d.ts +136 -31
  118. package/dist/dts/Stream.d.ts.map +1 -1
  119. package/dist/dts/String.d.ts +81 -111
  120. package/dist/dts/String.d.ts.map +1 -1
  121. package/dist/dts/Struct.d.ts +13 -19
  122. package/dist/dts/Struct.d.ts.map +1 -1
  123. package/dist/dts/Subscribable.d.ts.map +1 -1
  124. package/dist/dts/Symbol.d.ts +3 -3
  125. package/dist/dts/TestAnnotation.d.ts.map +1 -1
  126. package/dist/dts/TestAnnotationMap.d.ts.map +1 -1
  127. package/dist/dts/TestAnnotations.d.ts.map +1 -1
  128. package/dist/dts/TestClock.d.ts +1 -5
  129. package/dist/dts/TestClock.d.ts.map +1 -1
  130. package/dist/dts/TestLive.d.ts.map +1 -1
  131. package/dist/dts/TestSized.d.ts.map +1 -1
  132. package/dist/dts/Trie.d.ts +28 -44
  133. package/dist/dts/Trie.d.ts.map +1 -1
  134. package/dist/dts/Types.d.ts +10 -10
  135. package/dist/dts/Utils.d.ts.map +1 -1
  136. package/dist/dts/internal/doNotation.d.ts +2 -0
  137. package/dist/dts/internal/doNotation.d.ts.map +1 -0
  138. package/dist/dts/internal/stream.d.ts.map +1 -1
  139. package/dist/esm/Array.js +10 -13
  140. package/dist/esm/Array.js.map +1 -1
  141. package/dist/esm/BigDecimal.js +14 -17
  142. package/dist/esm/BigDecimal.js.map +1 -1
  143. package/dist/esm/BigInt.js +41 -46
  144. package/dist/esm/BigInt.js.map +1 -1
  145. package/dist/esm/Boolean.js +13 -13
  146. package/dist/esm/Brand.js +2 -2
  147. package/dist/esm/Chunk.js +3 -3
  148. package/dist/esm/Context.js +15 -20
  149. package/dist/esm/Context.js.map +1 -1
  150. package/dist/esm/Cron.js +3 -6
  151. package/dist/esm/Cron.js.map +1 -1
  152. package/dist/esm/Data.js +9 -15
  153. package/dist/esm/Data.js.map +1 -1
  154. package/dist/esm/Duration.js +1 -1
  155. package/dist/esm/Effect.js +101 -11
  156. package/dist/esm/Effect.js.map +1 -1
  157. package/dist/esm/Either.js +141 -61
  158. package/dist/esm/Either.js.map +1 -1
  159. package/dist/esm/FiberHandle.js.map +1 -1
  160. package/dist/esm/FiberMap.js.map +1 -1
  161. package/dist/esm/FiberSet.js.map +1 -1
  162. package/dist/esm/Function.js +2 -2
  163. package/dist/esm/Function.js.map +1 -1
  164. package/dist/esm/Iterable.js +10 -13
  165. package/dist/esm/Iterable.js.map +1 -1
  166. package/dist/esm/List.js +2 -2
  167. package/dist/esm/Metric.js +5 -7
  168. package/dist/esm/Metric.js.map +1 -1
  169. package/dist/esm/Number.js +20 -21
  170. package/dist/esm/Number.js.map +1 -1
  171. package/dist/esm/Option.js +249 -164
  172. package/dist/esm/Option.js.map +1 -1
  173. package/dist/esm/Order.js +1 -2
  174. package/dist/esm/Order.js.map +1 -1
  175. package/dist/esm/Ordering.js +2 -2
  176. package/dist/esm/Predicate.js +9 -12
  177. package/dist/esm/Predicate.js.map +1 -1
  178. package/dist/esm/Readable.js.map +1 -1
  179. package/dist/esm/Record.js +35 -47
  180. package/dist/esm/Record.js.map +1 -1
  181. package/dist/esm/RegExp.js +1 -1
  182. package/dist/esm/Request.js +2 -2
  183. package/dist/esm/Request.js.map +1 -1
  184. package/dist/esm/Stream.js +107 -6
  185. package/dist/esm/Stream.js.map +1 -1
  186. package/dist/esm/String.js +81 -111
  187. package/dist/esm/String.js.map +1 -1
  188. package/dist/esm/Struct.js +13 -19
  189. package/dist/esm/Struct.js.map +1 -1
  190. package/dist/esm/Subscribable.js.map +1 -1
  191. package/dist/esm/Symbol.js +3 -3
  192. package/dist/esm/TestAnnotation.js.map +1 -1
  193. package/dist/esm/TestAnnotationMap.js.map +1 -1
  194. package/dist/esm/TestAnnotations.js.map +1 -1
  195. package/dist/esm/TestClock.js.map +1 -1
  196. package/dist/esm/TestLive.js.map +1 -1
  197. package/dist/esm/TestSized.js.map +1 -1
  198. package/dist/esm/Trie.js +28 -44
  199. package/dist/esm/Trie.js.map +1 -1
  200. package/dist/esm/Utils.js.map +1 -1
  201. package/dist/esm/internal/core-effect.js +4 -11
  202. package/dist/esm/internal/core-effect.js.map +1 -1
  203. package/dist/esm/internal/doNotation.js +14 -0
  204. package/dist/esm/internal/doNotation.js.map +1 -0
  205. package/dist/esm/internal/groupBy.js.map +1 -1
  206. package/dist/esm/internal/stream.js +3 -7
  207. package/dist/esm/internal/stream.js.map +1 -1
  208. package/dist/esm/internal/version.js +1 -1
  209. package/package.json +1 -1
  210. package/src/Array.ts +10 -13
  211. package/src/BigDecimal.ts +14 -17
  212. package/src/BigInt.ts +41 -46
  213. package/src/Boolean.ts +13 -13
  214. package/src/Brand.ts +3 -3
  215. package/src/Chunk.ts +3 -3
  216. package/src/Context.ts +15 -20
  217. package/src/Cron.ts +3 -6
  218. package/src/Data.ts +10 -16
  219. package/src/Duration.ts +1 -1
  220. package/src/Effect.ts +122 -32
  221. package/src/Either.ts +161 -94
  222. package/src/FiberHandle.ts +1 -1
  223. package/src/FiberMap.ts +1 -1
  224. package/src/FiberSet.ts +1 -1
  225. package/src/Function.ts +4 -2
  226. package/src/HashMap.ts +2 -2
  227. package/src/Iterable.ts +10 -13
  228. package/src/List.ts +2 -2
  229. package/src/Metric.ts +5 -7
  230. package/src/Number.ts +20 -21
  231. package/src/Option.ts +250 -172
  232. package/src/Order.ts +1 -2
  233. package/src/Ordering.ts +2 -2
  234. package/src/Predicate.ts +9 -12
  235. package/src/Readable.ts +1 -1
  236. package/src/Record.ts +35 -47
  237. package/src/RegExp.ts +1 -1
  238. package/src/Request.ts +3 -3
  239. package/src/Stream.ts +137 -36
  240. package/src/String.ts +81 -111
  241. package/src/Struct.ts +13 -19
  242. package/src/Subscribable.ts +1 -1
  243. package/src/Symbol.ts +3 -3
  244. package/src/TestAnnotation.ts +1 -1
  245. package/src/TestAnnotationMap.ts +1 -1
  246. package/src/TestAnnotations.ts +1 -1
  247. package/src/TestClock.ts +1 -5
  248. package/src/TestLive.ts +1 -1
  249. package/src/TestSized.ts +1 -1
  250. package/src/Trie.ts +28 -44
  251. package/src/Types.ts +10 -10
  252. package/src/Utils.ts +2 -2
  253. package/src/internal/core-effect.ts +29 -45
  254. package/src/internal/doNotation.ts +77 -0
  255. package/src/internal/groupBy.ts +16 -16
  256. package/src/internal/stream.ts +34 -58
  257. package/src/internal/version.ts +1 -1
package/src/Order.ts CHANGED
@@ -318,8 +318,7 @@ export const max = <A>(O: Order<A>): {
318
318
  * Clamp a value between a minimum and a maximum.
319
319
  *
320
320
  * @example
321
- * import * as Order from "effect/Order"
322
- * import * as Number from "effect/Number"
321
+ * import { Order, Number } from "effect"
323
322
  *
324
323
  * const clamp = Order.clamp(Number.Order)({ minimum: 1, maximum: 5 })
325
324
  *
package/src/Ordering.ts CHANGED
@@ -35,10 +35,10 @@ export const reverse = (o: Ordering): Ordering => (o === -1 ? 1 : o === 1 ? -1 :
35
35
  * @param onGreaterThan - A function that will be called if the `Ordering` parameter is `1`.
36
36
  *
37
37
  * @example
38
- * import { match } from "effect/Ordering"
38
+ * import { Ordering } from "effect"
39
39
  * import { constant } from "effect/Function"
40
40
  *
41
- * const toMessage = match({
41
+ * const toMessage = Ordering.match({
42
42
  * onLessThan: constant('less than'),
43
43
  * onEqual: constant('equal'),
44
44
  * onGreaterThan: constant('greater than')
package/src/Predicate.ts CHANGED
@@ -35,10 +35,9 @@ export interface Refinement<in A, out B extends A> {
35
35
  * @param f - a function to transform `B` to `A`.
36
36
  *
37
37
  * @example
38
- * import * as P from "effect/Predicate"
39
- * import * as N from "effect/Number"
38
+ * import { Predicate, Number } from "effect"
40
39
  *
41
- * const minLength3 = P.mapInput(N.greaterThan(2), (s: string) => s.length)
40
+ * const minLength3 = Predicate.mapInput(Number.greaterThan(2), (s: string) => s.length)
42
41
  *
43
42
  * assert.deepStrictEqual(minLength3("a"), false)
44
43
  * assert.deepStrictEqual(minLength3("aa"), false)
@@ -59,7 +58,7 @@ export const mapInput: {
59
58
  * @param input - The value to test.
60
59
  *
61
60
  * @example
62
- * import { isTruthy } from 'effect/Predicate'
61
+ * import { isTruthy } from "effect/Predicate"
63
62
  *
64
63
  * assert.deepStrictEqual(isTruthy(1), true)
65
64
  * assert.deepStrictEqual(isTruthy(0), false)
@@ -658,10 +657,9 @@ export const struct = <R extends Record<string, Predicate<any>>>(
658
657
  * @param self - A predicate.
659
658
  *
660
659
  * @example
661
- * import * as P from "effect/Predicate"
662
- * import * as N from "effect/Number"
660
+ * import { Predicate, Number } from "effect"
663
661
  *
664
- * const isPositive = P.not(N.lessThan(0))
662
+ * const isPositive = Predicate.not(Number.lessThan(0))
665
663
  *
666
664
  * assert.deepStrictEqual(isPositive(-1), false)
667
665
  * assert.deepStrictEqual(isPositive(0), true)
@@ -679,10 +677,9 @@ export const not = <A>(self: Predicate<A>): Predicate<A> => (a) => !self(a)
679
677
  * @param that - A predicate.
680
678
  *
681
679
  * @example
682
- * import * as P from "effect/Predicate"
683
- * import * as N from "effect/Number"
680
+ * import { Predicate, Number } from "effect"
684
681
  *
685
- * const nonZero = P.or(N.lessThan(0), N.greaterThan(0))
682
+ * const nonZero = Predicate.or(Number.lessThan(0), Number.greaterThan(0))
686
683
  *
687
684
  * assert.deepStrictEqual(nonZero(-1), true)
688
685
  * assert.deepStrictEqual(nonZero(0), false)
@@ -703,12 +700,12 @@ export const or: {
703
700
  * @param that - A predicate.
704
701
  *
705
702
  * @example
706
- * import * as P from "effect/Predicate"
703
+ * import { Predicate } from "effect"
707
704
  *
708
705
  * const minLength = (n: number) => (s: string) => s.length >= n
709
706
  * const maxLength = (n: number) => (s: string) => s.length <= n
710
707
  *
711
- * const length = (n: number) => P.and(minLength(n), maxLength(n))
708
+ * const length = (n: number) => Predicate.and(minLength(n), maxLength(n))
712
709
  *
713
710
  * assert.deepStrictEqual(length(2)("aa"), true)
714
711
  * assert.deepStrictEqual(length(2)("a"), false)
package/src/Readable.ts CHANGED
@@ -12,7 +12,7 @@ import type { NoInfer } from "./Types.js"
12
12
  * @since 2.0.0
13
13
  * @category type ids
14
14
  */
15
- export const TypeId = Symbol.for("effect/Readable")
15
+ export const TypeId: unique symbol = Symbol.for("effect/Readable")
16
16
 
17
17
  /**
18
18
  * @since 2.0.0
package/src/Record.ts CHANGED
@@ -292,13 +292,12 @@ export const has: {
292
292
  * @param key - Key to retrieve from record.
293
293
  *
294
294
  * @example
295
- * import { get } from "effect/Record"
296
- * import { some, none } from "effect/Option"
295
+ * import { Record as R, Option } from "effect"
297
296
  *
298
297
  * const person: Record<string, unknown> = { name: "John Doe", age: 35 }
299
298
  *
300
- * assert.deepStrictEqual(get(person, "name"), some("John Doe"))
301
- * assert.deepStrictEqual(get(person, "email"), none())
299
+ * assert.deepStrictEqual(R.get(person, "name"), Option.some("John Doe"))
300
+ * assert.deepStrictEqual(R.get(person, "email"), Option.none())
302
301
  *
303
302
  * @since 2.0.0
304
303
  */
@@ -320,17 +319,16 @@ export const get: {
320
319
  * @param f - The function to apply to the element.
321
320
  *
322
321
  * @example
323
- * import { modify } from "effect/Record"
324
- * import { some, none } from "effect/Option"
322
+ * import { Record as R } from "effect"
325
323
  *
326
324
  * const f = (x: number) => x * 2
327
325
  *
328
326
  * assert.deepStrictEqual(
329
- * modify({ a: 3 }, 'a', f),
327
+ * R.modify({ a: 3 }, 'a', f),
330
328
  * { a: 6 }
331
329
  * )
332
330
  * assert.deepStrictEqual(
333
- * modify({ a: 3 } as Record<string, number>, 'b', f),
331
+ * R.modify({ a: 3 } as Record<string, number>, 'b', f),
334
332
  * { a: 3 }
335
333
  * )
336
334
  *
@@ -361,18 +359,17 @@ export const modify: {
361
359
  * @param f - The function to apply to the element.
362
360
  *
363
361
  * @example
364
- * import { modifyOption } from "effect/Record"
365
- * import { some, none } from "effect/Option"
362
+ * import { Record as R, Option } from "effect"
366
363
  *
367
364
  * const f = (x: number) => x * 2
368
365
  *
369
366
  * assert.deepStrictEqual(
370
- * modifyOption({ a: 3 }, 'a', f),
371
- * some({ a: 6 })
367
+ * R.modifyOption({ a: 3 }, 'a', f),
368
+ * Option.some({ a: 6 })
372
369
  * )
373
370
  * assert.deepStrictEqual(
374
- * modifyOption({ a: 3 } as Record<string, number>, 'b', f),
375
- * none()
371
+ * R.modifyOption({ a: 3 } as Record<string, number>, 'b', f),
372
+ * Option.none()
376
373
  * )
377
374
  *
378
375
  * @since 2.0.0
@@ -409,14 +406,13 @@ export const modifyOption: {
409
406
  * @param b - The new value to replace the existing value with.
410
407
  *
411
408
  * @example
412
- * import { empty, replaceOption } from "effect/Record"
413
- * import { some, none } from "effect/Option"
409
+ * import { Record, Option } from "effect"
414
410
  *
415
411
  * assert.deepStrictEqual(
416
- * replaceOption({ a: 1, b: 2, c: 3 }, 'a', 10),
417
- * some({ a: 10, b: 2, c: 3 })
412
+ * Record.replaceOption({ a: 1, b: 2, c: 3 }, 'a', 10),
413
+ * Option.some({ a: 10, b: 2, c: 3 })
418
414
  * )
419
- * assert.deepStrictEqual(replaceOption(empty<string>(), 'a', 10), none())
415
+ * assert.deepStrictEqual(Record.replaceOption(Record.empty<string>(), 'a', 10), Option.none())
420
416
  *
421
417
  * @since 2.0.0
422
418
  */
@@ -477,11 +473,10 @@ export const remove: {
477
473
  * @param key - The key of the property to retrieve.
478
474
  *
479
475
  * @example
480
- * import { pop } from "effect/Record"
481
- * import { some, none } from 'effect/Option'
476
+ * import { Record as R, Option } from "effect"
482
477
  *
483
- * assert.deepStrictEqual(pop({ a: 1, b: 2 }, "a"), some([1, { b: 2 }]))
484
- * assert.deepStrictEqual(pop({ a: 1, b: 2 } as Record<string, number>, "c"), none())
478
+ * assert.deepStrictEqual(R.pop({ a: 1, b: 2 }, "a"), Option.some([1, { b: 2 }]))
479
+ * assert.deepStrictEqual(R.pop({ a: 1, b: 2 } as Record<string, number>, "c"), Option.none())
485
480
  *
486
481
  * @category record
487
482
  * @since 2.0.0
@@ -610,12 +605,11 @@ export const mapEntries: {
610
605
  * @param f - The transformation function.
611
606
  *
612
607
  * @example
613
- * import { filterMap } from "effect/Record"
614
- * import { some, none } from 'effect/Option'
608
+ * import { Record, Option } from "effect"
615
609
  *
616
610
  * const x = { a: 1, b: 2, c: 3 }
617
- * const f = (a: number, key: string) => a > 2 ? some(a * 2) : none()
618
- * assert.deepStrictEqual(filterMap(x, f), { c: 6 })
611
+ * const f = (a: number, key: string) => a > 2 ? Option.some(a * 2) : Option.none()
612
+ * assert.deepStrictEqual(Record.filterMap(x, f), { c: 6 })
619
613
  *
620
614
  * @since 2.0.0
621
615
  */
@@ -696,11 +690,10 @@ export const filter: {
696
690
  * @param self - A record with `Option` values.
697
691
  *
698
692
  * @example
699
- * import { getSomes } from "effect/Record"
700
- * import { some, none } from "effect/Option"
693
+ * import { Record, Option } from "effect"
701
694
  *
702
695
  * assert.deepStrictEqual(
703
- * getSomes({ a: some(1), b: none(), c: some(2) }),
696
+ * Record.getSomes({ a: Option.some(1), b: Option.none(), c: Option.some(2) }),
704
697
  * { a: 1, c: 2 }
705
698
  * )
706
699
  *
@@ -717,11 +710,10 @@ export const getSomes: <K extends string, A>(
717
710
  * Given a record with `Either` values, returns a new record containing only the `Left` values, preserving the original keys.
718
711
  *
719
712
  * @example
720
- * import { getLefts } from "effect/Record"
721
- * import { right, left } from "effect/Either"
713
+ * import { Record, Either } from "effect"
722
714
  *
723
715
  * assert.deepStrictEqual(
724
- * getLefts({ a: right(1), b: left("err"), c: right(2) }),
716
+ * Record.getLefts({ a: Either.right(1), b: Either.left("err"), c: Either.right(2) }),
725
717
  * { b: "err" }
726
718
  * )
727
719
  *
@@ -746,11 +738,10 @@ export const getLefts = <K extends string, R, L>(
746
738
  * Given a record with `Either` values, returns a new record containing only the `Right` values, preserving the original keys.
747
739
  *
748
740
  * @example
749
- * import { getRights } from "effect/Record"
750
- * import { right, left } from "effect/Either"
741
+ * import { Record, Either } from "effect"
751
742
  *
752
743
  * assert.deepStrictEqual(
753
- * getRights({ a: right(1), b: left("err"), c: right(2) }),
744
+ * Record.getRights({ a: Either.right(1), b: Either.left("err"), c: Either.right(2) }),
754
745
  * { a: 1, c: 2 }
755
746
  * )
756
747
  *
@@ -778,12 +769,11 @@ export const getRights = <K extends string, R, L>(
778
769
  * @param f - The predicate function to apply to each element.
779
770
  *
780
771
  * @example
781
- * import { partitionMap } from "effect/Record"
782
- * import { left, right } from 'effect/Either'
772
+ * import { Record, Either } from "effect"
783
773
  *
784
774
  * const x = { a: 1, b: 2, c: 3 }
785
- * const f = (n: number) => (n % 2 === 0 ? right(n) : left(n))
786
- * assert.deepStrictEqual(partitionMap(x, f), [{ a: 1, c: 3 }, { b: 2}])
775
+ * const f = (n: number) => (n % 2 === 0 ? Either.right(n) : Either.left(n))
776
+ * assert.deepStrictEqual(Record.partitionMap(x, f), [{ a: 1, c: 3 }, { b: 2}])
787
777
  *
788
778
  * @category filtering
789
779
  * @since 2.0.0
@@ -825,11 +815,10 @@ export const partitionMap: {
825
815
  * @param self - the record to partition.
826
816
  *
827
817
  * @example
828
- * import { separate } from "effect/Record"
829
- * import { left, right } from 'effect/Either'
818
+ * import { Record, Either } from "effect"
830
819
  *
831
820
  * assert.deepStrictEqual(
832
- * separate({ a: left("e"), b: right(1) }),
821
+ * Record.separate({ a: Either.left("e"), b: Either.right(1) }),
833
822
  * [{ a: "e" }, { b: 1 }]
834
823
  * )
835
824
  *
@@ -962,11 +951,10 @@ export const set: {
962
951
  * @param value - The new value to associate with the key.
963
952
  *
964
953
  * @example
965
- * import { replace } from "effect/Record"
966
- * import { some, none } from "effect/Option"
954
+ * import { Record } from "effect"
967
955
  *
968
- * assert.deepStrictEqual(replace("a", 3)({ a: 1, b: 2 }), { a: 3, b: 2 });
969
- * assert.deepStrictEqual(replace("c", 3)({ a: 1, b: 2 }), { a: 1, b: 2 });
956
+ * assert.deepStrictEqual(Record.replace("a", 3)({ a: 1, b: 2 }), { a: 3, b: 2 });
957
+ * assert.deepStrictEqual(Record.replace("c", 3)({ a: 1, b: 2 }), { a: 1, b: 2 });
970
958
  *
971
959
  * @since 2.0.0
972
960
  */
package/src/RegExp.ts CHANGED
@@ -8,7 +8,7 @@
8
8
  * Escapes special characters in a regular expression pattern.
9
9
  *
10
10
  * @example
11
- * import * as RegExp from "effect/RegExp"
11
+ * import { RegExp } from "effect"
12
12
  *
13
13
  * assert.deepStrictEqual(RegExp.escape("a*b"), "a\\*b")
14
14
  *
package/src/Request.ts CHANGED
@@ -125,7 +125,7 @@ export const tagged: <R extends Request<any, any> & { _tag: string }>(
125
125
  * Provides a constructor for a Request Class.
126
126
  *
127
127
  * @example
128
- * import * as Request from "effect/Request"
128
+ * import { Request } from "effect"
129
129
  *
130
130
  * type Success = string
131
131
  * type Error = never
@@ -146,7 +146,7 @@ export const Class: new<Success, Error, A extends Record<string, any>>(
146
146
  * Provides a Tagged constructor for a Request Class.
147
147
  *
148
148
  * @example
149
- * import * as Request from "effect/Request"
149
+ * import { Request } from "effect"
150
150
  *
151
151
  * type Success = string
152
152
  * type Error = never
@@ -283,7 +283,7 @@ export const makeCache = (
283
283
  * @since 2.0.0
284
284
  * @category symbols
285
285
  */
286
- export const EntryTypeId = Symbol.for("effect/RequestBlock.Entry")
286
+ export const EntryTypeId: unique symbol = Symbol.for("effect/RequestBlock.Entry")
287
287
 
288
288
  /**
289
289
  * @since 2.0.0
package/src/Stream.ts CHANGED
@@ -29,7 +29,7 @@ import type * as Emit from "./StreamEmit.js"
29
29
  import type * as HaltStrategy from "./StreamHaltStrategy.js"
30
30
  import type * as Take from "./Take.js"
31
31
  import type * as Tracer from "./Tracer.js"
32
- import type { Covariant, MergeRecord, NoInfer } from "./Types.js"
32
+ import type { Covariant, NoInfer } from "./Types.js"
33
33
  import type * as Unify from "./Unify.js"
34
34
 
35
35
  /**
@@ -4440,86 +4440,187 @@ export const zipWithIndex: <A, E, R>(self: Stream<A, E, R>) => Stream<[A, number
4440
4440
  // -------------------------------------------------------------------------------------
4441
4441
 
4442
4442
  /**
4443
- * @since 2.0.0
4443
+ * The "do simulation" in allows you to write code in a more declarative style, similar to the "do notation" in other programming languages. It provides a way to define variables and perform operations on them using functions like `bind` and `let`.
4444
+ *
4445
+ * Here's how the do simulation works:
4446
+ *
4447
+ * 1. Start the do simulation using the `Do` value
4448
+ * 2. Within the do simulation scope, you can use the `bind` function to define variables and bind them to `Stream` values
4449
+ * 3. You can accumulate multiple `bind` statements to define multiple variables within the scope
4450
+ * 4. Inside the do simulation scope, you can also use the `let` function to define variables and bind them to simple values
4451
+ *
4452
+ * @see {@link bindTo}
4453
+ * @see {@link bind}
4454
+ * @see {@link bindEffect}
4455
+ * @see {@link let_ let}
4456
+ *
4457
+ * @example
4458
+ * import { Chunk, Effect, pipe, Stream } from "effect"
4459
+ *
4460
+ * const result = pipe(
4461
+ * Stream.Do,
4462
+ * Stream.bind("x", () => Stream.succeed(2)),
4463
+ * Stream.bind("y", () => Stream.succeed(3)),
4464
+ * Stream.let("sum", ({ x, y }) => x + y)
4465
+ * )
4466
+ * assert.deepStrictEqual(Effect.runSync(Stream.runCollect(result)), Chunk.of({ x: 2, y: 3, sum: 5 }))
4467
+ *
4444
4468
  * @category do notation
4469
+ * @since 2.0.0
4445
4470
  */
4446
4471
  export const Do: Stream<{}> = internal.Do
4447
4472
 
4448
4473
  /**
4449
- * Binds a value from a stream in a `do` scope
4474
+ * The "do simulation" in allows you to write code in a more declarative style, similar to the "do notation" in other programming languages. It provides a way to define variables and perform operations on them using functions like `bind` and `let`.
4475
+ *
4476
+ * Here's how the do simulation works:
4477
+ *
4478
+ * 1. Start the do simulation using the `Do` value
4479
+ * 2. Within the do simulation scope, you can use the `bind` function to define variables and bind them to `Stream` values
4480
+ * 3. You can accumulate multiple `bind` statements to define multiple variables within the scope
4481
+ * 4. Inside the do simulation scope, you can also use the `let` function to define variables and bind them to simple values
4482
+ *
4483
+ * @see {@link Do}
4484
+ * @see {@link bindTo}
4485
+ * @see {@link bindEffect}
4486
+ * @see {@link let_ let}
4487
+ *
4488
+ * @example
4489
+ * import { Chunk, Effect, pipe, Stream } from "effect"
4490
+ *
4491
+ * const result = pipe(
4492
+ * Stream.Do,
4493
+ * Stream.bind("x", () => Stream.succeed(2)),
4494
+ * Stream.bind("y", () => Stream.succeed(3)),
4495
+ * Stream.let("sum", ({ x, y }) => x + y)
4496
+ * )
4497
+ * assert.deepStrictEqual(Effect.runSync(Stream.runCollect(result)), Chunk.of({ x: 2, y: 3, sum: 5 }))
4450
4498
  *
4451
- * @since 2.0.0
4452
4499
  * @category do notation
4500
+ * @since 2.0.0
4453
4501
  */
4454
4502
  export const bind: {
4455
- <N extends string, K, A, E2, R2>(
4456
- tag: Exclude<N, keyof K>,
4457
- f: (_: K) => Stream<A, E2, R2>,
4503
+ <N extends string, A, B, E2, R2>(
4504
+ tag: Exclude<N, keyof A>,
4505
+ f: (_: A) => Stream<B, E2, R2>,
4458
4506
  options?:
4459
4507
  | { readonly concurrency?: number | "unbounded" | undefined; readonly bufferSize?: number | undefined }
4460
4508
  | undefined
4461
- ): <E, R>(self: Stream<K, E, R>) => Stream<MergeRecord<K, { [k in N]: A }>, E2 | E, R2 | R>
4462
- <K, E, R, N extends string, A, E2, R2>(
4463
- self: Stream<K, E, R>,
4464
- tag: Exclude<N, keyof K>,
4465
- f: (_: K) => Stream<A, E2, R2>,
4509
+ ): <E, R>(self: Stream<A, E, R>) => Stream<{ [K in N | keyof A]: K extends keyof A ? A[K] : B }, E2 | E, R2 | R>
4510
+ <A, E, R, N extends string, B, E2, R2>(
4511
+ self: Stream<A, E, R>,
4512
+ tag: Exclude<N, keyof A>,
4513
+ f: (_: A) => Stream<B, E2, R2>,
4466
4514
  options?:
4467
4515
  | { readonly concurrency?: number | "unbounded" | undefined; readonly bufferSize?: number | undefined }
4468
4516
  | undefined
4469
- ): Stream<MergeRecord<K, { [k in N]: A }>, E | E2, R | R2>
4517
+ ): Stream<{ [K in N | keyof A]: K extends keyof A ? A[K] : B }, E | E2, R | R2>
4470
4518
  } = internal.bind
4471
4519
 
4472
4520
  /**
4473
4521
  * Binds an effectful value in a `do` scope
4474
4522
  *
4523
+ * @see {@link Do}
4524
+ * @see {@link bindTo}
4525
+ * @see {@link bind}
4526
+ * @see {@link let_ let}
4527
+ *
4475
4528
  * @since 2.0.0
4476
4529
  * @category do notation
4477
4530
  */
4478
4531
  export const bindEffect: {
4479
- <N extends string, K, A, E2, R2>(
4480
- tag: Exclude<N, keyof K>,
4481
- f: (_: K) => Effect.Effect<A, E2, R2>,
4532
+ <N extends string, A, B, E2, R2>(
4533
+ tag: Exclude<N, keyof A>,
4534
+ f: (_: A) => Effect.Effect<B, E2, R2>,
4482
4535
  options?:
4483
4536
  | { readonly concurrency?: number | "unbounded" | undefined; readonly bufferSize?: number | undefined }
4484
4537
  | undefined
4485
- ): <E, R>(self: Stream<K, E, R>) => Stream<MergeRecord<K, { [k in N]: A }>, E2 | E, R2 | R>
4486
- <K, E, R, N extends string, A, E2, R2>(
4487
- self: Stream<K, E, R>,
4488
- tag: Exclude<N, keyof K>,
4489
- f: (_: K) => Effect.Effect<A, E2, R2>,
4538
+ ): <E, R>(self: Stream<A, E, R>) => Stream<{ [K in N | keyof A]: K extends keyof A ? A[K] : B }, E2 | E, R2 | R>
4539
+ <A, E, R, N extends string, B, E2, R2>(
4540
+ self: Stream<A, E, R>,
4541
+ tag: Exclude<N, keyof A>,
4542
+ f: (_: A) => Effect.Effect<B, E2, R2>,
4490
4543
  options?:
4491
4544
  | { readonly concurrency?: number | "unbounded" | undefined; readonly unordered?: boolean | undefined }
4492
4545
  | undefined
4493
- ): Stream<MergeRecord<K, { [k in N]: A }>, E | E2, R | R2>
4546
+ ): Stream<{ [K in N | keyof A]: K extends keyof A ? A[K] : B }, E | E2, R | R2>
4494
4547
  } = _groupBy.bindEffect
4495
4548
 
4496
4549
  /**
4497
- * @since 2.0.0
4550
+ * The "do simulation" in allows you to write code in a more declarative style, similar to the "do notation" in other programming languages. It provides a way to define variables and perform operations on them using functions like `bind` and `let`.
4551
+ *
4552
+ * Here's how the do simulation works:
4553
+ *
4554
+ * 1. Start the do simulation using the `Do` value
4555
+ * 2. Within the do simulation scope, you can use the `bind` function to define variables and bind them to `Stream` values
4556
+ * 3. You can accumulate multiple `bind` statements to define multiple variables within the scope
4557
+ * 4. Inside the do simulation scope, you can also use the `let` function to define variables and bind them to simple values
4558
+ *
4559
+ * @see {@link Do}
4560
+ * @see {@link bind}
4561
+ * @see {@link bindEffect}
4562
+ * @see {@link let_ let}
4563
+ *
4564
+ * @example
4565
+ * import { Chunk, Effect, pipe, Stream } from "effect"
4566
+ *
4567
+ * const result = pipe(
4568
+ * Stream.Do,
4569
+ * Stream.bind("x", () => Stream.succeed(2)),
4570
+ * Stream.bind("y", () => Stream.succeed(3)),
4571
+ * Stream.let("sum", ({ x, y }) => x + y)
4572
+ * )
4573
+ * assert.deepStrictEqual(Effect.runSync(Stream.runCollect(result)), Chunk.of({ x: 2, y: 3, sum: 5 }))
4574
+ *
4498
4575
  * @category do notation
4576
+ * @since 2.0.0
4499
4577
  */
4500
4578
  export const bindTo: {
4501
- <N extends string>(tag: N): <A, E, R>(self: Stream<A, E, R>) => Stream<Record<N, A>, E, R>
4502
- <A, E, R, N extends string>(self: Stream<A, E, R>, tag: N): Stream<Record<N, A>, E, R>
4579
+ <N extends string>(name: N): <A, E, R>(self: Stream<A, E, R>) => Stream<{ [K in N]: A }, E, R>
4580
+ <A, E, R, N extends string>(self: Stream<A, E, R>, name: N): Stream<{ [K in N]: A }, E, R>
4503
4581
  } = internal.bindTo
4504
4582
 
4505
4583
  const let_: {
4506
- <N extends string, K, A>(
4507
- tag: Exclude<N, keyof K>,
4508
- f: (_: K) => A
4509
- ): <E, R>(self: Stream<K, E, R>) => Stream<MergeRecord<K, { [k in N]: A }>, E, R>
4510
- <K, E, R, N extends string, A>(
4511
- self: Stream<K, E, R>,
4512
- tag: Exclude<N, keyof K>,
4513
- f: (_: K) => A
4514
- ): Stream<MergeRecord<K, { [k in N]: A }>, E, R>
4584
+ <N extends string, A extends object, B>(
4585
+ name: Exclude<N, keyof A>,
4586
+ f: (a: A) => B
4587
+ ): <E, R>(self: Stream<A, E, R>) => Stream<{ [K in N | keyof A]: K extends keyof A ? A[K] : B }, E, R>
4588
+ <A extends object, E, R, N extends string, B>(
4589
+ self: Stream<A, E, R>,
4590
+ name: Exclude<N, keyof A>,
4591
+ f: (a: A) => B
4592
+ ): Stream<{ [K in N | keyof A]: K extends keyof A ? A[K] : B }, E, R>
4515
4593
  } = internal.let_
4516
4594
 
4517
4595
  export {
4518
4596
  /**
4519
- * Bind a value in a `do` scope
4597
+ * The "do simulation" in allows you to write code in a more declarative style, similar to the "do notation" in other programming languages. It provides a way to define variables and perform operations on them using functions like `bind` and `let`.
4598
+ *
4599
+ * Here's how the do simulation works:
4600
+ *
4601
+ * 1. Start the do simulation using the `Do` value
4602
+ * 2. Within the do simulation scope, you can use the `bind` function to define variables and bind them to `Stream` values
4603
+ * 3. You can accumulate multiple `bind` statements to define multiple variables within the scope
4604
+ * 4. Inside the do simulation scope, you can also use the `let` function to define variables and bind them to simple values
4605
+ *
4606
+ * @see {@link Do}
4607
+ * @see {@link bindTo}
4608
+ * @see {@link bind}
4609
+ * @see {@link bindEffect}
4610
+ *
4611
+ * @example
4612
+ * import { Chunk, Effect, pipe, Stream } from "effect"
4613
+ *
4614
+ * const result = pipe(
4615
+ * Stream.Do,
4616
+ * Stream.bind("x", () => Stream.succeed(2)),
4617
+ * Stream.bind("y", () => Stream.succeed(3)),
4618
+ * Stream.let("sum", ({ x, y }) => x + y)
4619
+ * )
4620
+ * assert.deepStrictEqual(Effect.runSync(Stream.runCollect(result)), Chunk.of({ x: 2, y: 3, sum: 5 }))
4520
4621
  *
4521
- * @since 2.0.0
4522
4622
  * @category do notation
4623
+ * @since 2.0.0
4523
4624
  */
4524
4625
  let_ as let
4525
4626
  }