effect 4.0.0-beta.17 → 4.0.0-beta.19

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 (164) hide show
  1. package/dist/Array.d.ts +127 -299
  2. package/dist/Array.d.ts.map +1 -1
  3. package/dist/Array.js +102 -62
  4. package/dist/Array.js.map +1 -1
  5. package/dist/Cache.d.ts.map +1 -1
  6. package/dist/Cache.js +5 -4
  7. package/dist/Cache.js.map +1 -1
  8. package/dist/Channel.d.ts +97 -11
  9. package/dist/Channel.d.ts.map +1 -1
  10. package/dist/Channel.js +72 -29
  11. package/dist/Channel.js.map +1 -1
  12. package/dist/Chunk.d.ts +54 -247
  13. package/dist/Chunk.d.ts.map +1 -1
  14. package/dist/Chunk.js +36 -67
  15. package/dist/Chunk.js.map +1 -1
  16. package/dist/Effect.d.ts +337 -437
  17. package/dist/Effect.d.ts.map +1 -1
  18. package/dist/Effect.js +118 -134
  19. package/dist/Effect.js.map +1 -1
  20. package/dist/Filter.d.ts +0 -33
  21. package/dist/Filter.d.ts.map +1 -1
  22. package/dist/Filter.js +0 -13
  23. package/dist/Filter.js.map +1 -1
  24. package/dist/HashMap.d.ts +15 -14
  25. package/dist/HashMap.d.ts.map +1 -1
  26. package/dist/HashMap.js +4 -4
  27. package/dist/HashMap.js.map +1 -1
  28. package/dist/Iterable.d.ts +40 -39
  29. package/dist/Iterable.d.ts.map +1 -1
  30. package/dist/Iterable.js +94 -22
  31. package/dist/Iterable.js.map +1 -1
  32. package/dist/Option.d.ts +22 -15
  33. package/dist/Option.d.ts.map +1 -1
  34. package/dist/Option.js +14 -7
  35. package/dist/Option.js.map +1 -1
  36. package/dist/Pull.d.ts.map +1 -1
  37. package/dist/Pull.js +1 -1
  38. package/dist/Pull.js.map +1 -1
  39. package/dist/Record.d.ts +24 -120
  40. package/dist/Record.d.ts.map +1 -1
  41. package/dist/Record.js +21 -41
  42. package/dist/Record.js.map +1 -1
  43. package/dist/Sink.d.ts +11 -11
  44. package/dist/Sink.d.ts.map +1 -1
  45. package/dist/Sink.js +53 -6
  46. package/dist/Sink.js.map +1 -1
  47. package/dist/Stream.d.ts +198 -386
  48. package/dist/Stream.d.ts.map +1 -1
  49. package/dist/Stream.js +103 -59
  50. package/dist/Stream.js.map +1 -1
  51. package/dist/Trie.d.ts +18 -17
  52. package/dist/Trie.d.ts.map +1 -1
  53. package/dist/Trie.js +5 -5
  54. package/dist/Trie.js.map +1 -1
  55. package/dist/TxChunk.d.ts +37 -37
  56. package/dist/TxChunk.d.ts.map +1 -1
  57. package/dist/TxChunk.js +3 -3
  58. package/dist/TxChunk.js.map +1 -1
  59. package/dist/TxDeferred.d.ts +328 -0
  60. package/dist/TxDeferred.d.ts.map +1 -0
  61. package/dist/TxDeferred.js +196 -0
  62. package/dist/TxDeferred.js.map +1 -0
  63. package/dist/TxHashMap.d.ts +84 -83
  64. package/dist/TxHashMap.d.ts.map +1 -1
  65. package/dist/TxHashMap.js +24 -24
  66. package/dist/TxHashMap.js.map +1 -1
  67. package/dist/TxHashSet.d.ts +35 -35
  68. package/dist/TxHashSet.d.ts.map +1 -1
  69. package/dist/TxHashSet.js +14 -14
  70. package/dist/TxHashSet.js.map +1 -1
  71. package/dist/TxPriorityQueue.d.ts +609 -0
  72. package/dist/TxPriorityQueue.d.ts.map +1 -0
  73. package/dist/TxPriorityQueue.js +415 -0
  74. package/dist/TxPriorityQueue.js.map +1 -0
  75. package/dist/TxPubSub.d.ts +585 -0
  76. package/dist/TxPubSub.d.ts.map +1 -0
  77. package/dist/TxPubSub.js +521 -0
  78. package/dist/TxPubSub.js.map +1 -0
  79. package/dist/TxQueue.d.ts +32 -32
  80. package/dist/TxQueue.d.ts.map +1 -1
  81. package/dist/TxQueue.js +26 -26
  82. package/dist/TxQueue.js.map +1 -1
  83. package/dist/TxReentrantLock.d.ts +523 -0
  84. package/dist/TxReentrantLock.d.ts.map +1 -0
  85. package/dist/TxReentrantLock.js +504 -0
  86. package/dist/TxReentrantLock.js.map +1 -0
  87. package/dist/TxRef.d.ts +34 -34
  88. package/dist/TxRef.d.ts.map +1 -1
  89. package/dist/TxRef.js +21 -14
  90. package/dist/TxRef.js.map +1 -1
  91. package/dist/TxSemaphore.d.ts +8 -8
  92. package/dist/TxSemaphore.d.ts.map +1 -1
  93. package/dist/TxSemaphore.js +7 -7
  94. package/dist/TxSemaphore.js.map +1 -1
  95. package/dist/TxSubscriptionRef.d.ts +508 -0
  96. package/dist/TxSubscriptionRef.d.ts.map +1 -0
  97. package/dist/TxSubscriptionRef.js +293 -0
  98. package/dist/TxSubscriptionRef.js.map +1 -0
  99. package/dist/index.d.ts +40 -0
  100. package/dist/index.d.ts.map +1 -1
  101. package/dist/index.js +40 -0
  102. package/dist/index.js.map +1 -1
  103. package/dist/internal/effect.js +99 -42
  104. package/dist/internal/effect.js.map +1 -1
  105. package/dist/internal/hashMap.js +3 -2
  106. package/dist/internal/hashMap.js.map +1 -1
  107. package/dist/internal/trie.js +5 -4
  108. package/dist/internal/trie.js.map +1 -1
  109. package/dist/unstable/ai/Tool.d.ts.map +1 -1
  110. package/dist/unstable/ai/Tool.js +0 -9
  111. package/dist/unstable/ai/Tool.js.map +1 -1
  112. package/dist/unstable/cli/Command.d.ts +1 -1
  113. package/dist/unstable/cli/Command.d.ts.map +1 -1
  114. package/dist/unstable/cli/Command.js +1 -1
  115. package/dist/unstable/cli/Command.js.map +1 -1
  116. package/dist/unstable/cluster/K8sHttpClient.js +4 -4
  117. package/dist/unstable/cluster/K8sHttpClient.js.map +1 -1
  118. package/dist/unstable/cluster/Sharding.js +1 -1
  119. package/dist/unstable/cluster/Sharding.js.map +1 -1
  120. package/dist/unstable/encoding/Sse.js +1 -1
  121. package/dist/unstable/encoding/Sse.js.map +1 -1
  122. package/dist/unstable/rpc/RpcServer.d.ts.map +1 -1
  123. package/dist/unstable/rpc/RpcServer.js +1 -2
  124. package/dist/unstable/rpc/RpcServer.js.map +1 -1
  125. package/dist/unstable/socket/Socket.d.ts.map +1 -1
  126. package/dist/unstable/socket/Socket.js +3 -3
  127. package/dist/unstable/socket/Socket.js.map +1 -1
  128. package/package.json +1 -1
  129. package/src/Array.ts +190 -342
  130. package/src/Cache.ts +6 -5
  131. package/src/Channel.ts +506 -102
  132. package/src/Chunk.ts +81 -268
  133. package/src/Effect.ts +437 -518
  134. package/src/Filter.ts +0 -57
  135. package/src/HashMap.ts +15 -14
  136. package/src/Iterable.ts +105 -50
  137. package/src/Option.ts +30 -20
  138. package/src/Pull.ts +1 -1
  139. package/src/Record.ts +43 -152
  140. package/src/Sink.ts +75 -23
  141. package/src/Stream.ts +442 -502
  142. package/src/Trie.ts +18 -17
  143. package/src/TxChunk.ts +72 -53
  144. package/src/TxDeferred.ts +394 -0
  145. package/src/TxHashMap.ts +332 -285
  146. package/src/TxHashSet.ts +111 -116
  147. package/src/TxPriorityQueue.ts +767 -0
  148. package/src/TxPubSub.ts +789 -0
  149. package/src/TxQueue.ts +241 -251
  150. package/src/TxReentrantLock.ts +753 -0
  151. package/src/TxRef.ts +50 -38
  152. package/src/TxSemaphore.ts +29 -32
  153. package/src/TxSubscriptionRef.ts +639 -0
  154. package/src/index.ts +45 -0
  155. package/src/internal/effect.ts +368 -163
  156. package/src/internal/hashMap.ts +7 -5
  157. package/src/internal/trie.ts +16 -9
  158. package/src/unstable/ai/Tool.ts +0 -9
  159. package/src/unstable/cli/Command.ts +6 -4
  160. package/src/unstable/cluster/K8sHttpClient.ts +4 -4
  161. package/src/unstable/cluster/Sharding.ts +1 -1
  162. package/src/unstable/encoding/Sse.ts +1 -1
  163. package/src/unstable/rpc/RpcServer.ts +1 -7
  164. package/src/unstable/socket/Socket.ts +9 -11
package/src/TxHashSet.ts CHANGED
@@ -66,7 +66,7 @@ const TxHashSetProto = {
66
66
  * console.log(hasApple) // true
67
67
  *
68
68
  * // Multi-step atomic operations
69
- * yield* Effect.atomic(
69
+ * yield* Effect.transaction(
70
70
  * Effect.gen(function*() {
71
71
  * const hasCherry = yield* TxHashSet.has(txSet, "cherry")
72
72
  * if (hasCherry) {
@@ -165,7 +165,7 @@ const makeTxHashSet = <V>(ref: TxRef.TxRef<HashSet.HashSet<V>>): TxHashSet<V> =>
165
165
  * @since 2.0.0
166
166
  * @category constructors
167
167
  */
168
- export const empty = <V = never>(): Effect.Effect<TxHashSet<V>> =>
168
+ export const empty = <V = never>(): Effect.Effect<TxHashSet<V>, never, Effect.Transaction> =>
169
169
  Effect.gen(function*() {
170
170
  const ref = yield* TxRef.make(HashSet.empty<V>())
171
171
  return makeTxHashSet(ref)
@@ -195,7 +195,7 @@ export const empty = <V = never>(): Effect.Effect<TxHashSet<V>> =>
195
195
  */
196
196
  export const make = <Values extends ReadonlyArray<any>>(
197
197
  ...values: Values
198
- ): Effect.Effect<TxHashSet<Values[number]>> =>
198
+ ): Effect.Effect<TxHashSet<Values[number]>, never, Effect.Transaction> =>
199
199
  Effect.gen(function*() {
200
200
  const hashSet = HashSet.make(...values)
201
201
  const ref = yield* TxRef.make(hashSet)
@@ -225,7 +225,7 @@ export const make = <Values extends ReadonlyArray<any>>(
225
225
  * @since 2.0.0
226
226
  * @category constructors
227
227
  */
228
- export const fromIterable = <V>(values: Iterable<V>): Effect.Effect<TxHashSet<V>> =>
228
+ export const fromIterable = <V>(values: Iterable<V>): Effect.Effect<TxHashSet<V>, never, Effect.Transaction> =>
229
229
  Effect.gen(function*() {
230
230
  const hashSet = HashSet.fromIterable(values)
231
231
  const ref = yield* TxRef.make(hashSet)
@@ -257,7 +257,7 @@ export const fromIterable = <V>(values: Iterable<V>): Effect.Effect<TxHashSet<V>
257
257
  * @since 2.0.0
258
258
  * @category constructors
259
259
  */
260
- export const fromHashSet = <V>(hashSet: HashSet.HashSet<V>): Effect.Effect<TxHashSet<V>> =>
260
+ export const fromHashSet = <V>(hashSet: HashSet.HashSet<V>): Effect.Effect<TxHashSet<V>, never, Effect.Transaction> =>
261
261
  Effect.gen(function*() {
262
262
  const ref = yield* TxRef.make(hashSet)
263
263
  return makeTxHashSet(ref)
@@ -341,7 +341,7 @@ export const add: {
341
341
  * @since 2.0.0
342
342
  * @category mutations
343
343
  */
344
- <V>(value: V): (self: TxHashSet<V>) => Effect.Effect<void>
344
+ <V>(value: V): (self: TxHashSet<V>) => Effect.Effect<void, never, Effect.Transaction>
345
345
  /**
346
346
  * Adds a value to the TxHashSet. If the value already exists, the operation has no effect.
347
347
  *
@@ -368,7 +368,7 @@ export const add: {
368
368
  * @since 2.0.0
369
369
  * @category mutations
370
370
  */
371
- <V>(self: TxHashSet<V>, value: V): Effect.Effect<void>
371
+ <V>(self: TxHashSet<V>, value: V): Effect.Effect<void, never, Effect.Transaction>
372
372
  } = dual<
373
373
  /**
374
374
  * Adds a value to the TxHashSet. If the value already exists, the operation has no effect.
@@ -396,7 +396,7 @@ export const add: {
396
396
  * @since 2.0.0
397
397
  * @category mutations
398
398
  */
399
- <V>(value: V) => (self: TxHashSet<V>) => Effect.Effect<void>,
399
+ <V>(value: V) => (self: TxHashSet<V>) => Effect.Effect<void, never, Effect.Transaction>,
400
400
  /**
401
401
  * Adds a value to the TxHashSet. If the value already exists, the operation has no effect.
402
402
  *
@@ -423,7 +423,7 @@ export const add: {
423
423
  * @since 2.0.0
424
424
  * @category mutations
425
425
  */
426
- <V>(self: TxHashSet<V>, value: V) => Effect.Effect<void>
426
+ <V>(self: TxHashSet<V>, value: V) => Effect.Effect<void, never, Effect.Transaction>
427
427
  >(2, <V>(self: TxHashSet<V>, value: V) => TxRef.update(self.ref, (set) => HashSet.add(set, value)))
428
428
 
429
429
  /**
@@ -481,7 +481,7 @@ export const remove: {
481
481
  * @since 2.0.0
482
482
  * @category mutations
483
483
  */
484
- <V>(value: V): (self: TxHashSet<V>) => Effect.Effect<boolean>
484
+ <V>(value: V): (self: TxHashSet<V>) => Effect.Effect<boolean, never, Effect.Transaction>
485
485
  /**
486
486
  * Removes a value from the TxHashSet.
487
487
  *
@@ -509,7 +509,7 @@ export const remove: {
509
509
  * @since 2.0.0
510
510
  * @category mutations
511
511
  */
512
- <V>(self: TxHashSet<V>, value: V): Effect.Effect<boolean>
512
+ <V>(self: TxHashSet<V>, value: V): Effect.Effect<boolean, never, Effect.Transaction>
513
513
  } = dual<
514
514
  /**
515
515
  * Removes a value from the TxHashSet.
@@ -538,7 +538,7 @@ export const remove: {
538
538
  * @since 2.0.0
539
539
  * @category mutations
540
540
  */
541
- <V>(value: V) => (self: TxHashSet<V>) => Effect.Effect<boolean>,
541
+ <V>(value: V) => (self: TxHashSet<V>) => Effect.Effect<boolean, never, Effect.Transaction>,
542
542
  /**
543
543
  * Removes a value from the TxHashSet.
544
544
  *
@@ -566,18 +566,16 @@ export const remove: {
566
566
  * @since 2.0.0
567
567
  * @category mutations
568
568
  */
569
- <V>(self: TxHashSet<V>, value: V) => Effect.Effect<boolean>
569
+ <V>(self: TxHashSet<V>, value: V) => Effect.Effect<boolean, never, Effect.Transaction>
570
570
  >(2, <V>(self: TxHashSet<V>, value: V) =>
571
- Effect.atomic(
572
- Effect.gen(function*() {
573
- const currentSet = yield* TxRef.get(self.ref)
574
- const existed = HashSet.has(currentSet, value)
575
- if (existed) {
576
- yield* TxRef.set(self.ref, HashSet.remove(currentSet, value))
577
- }
578
- return existed
579
- })
580
- ))
571
+ Effect.gen(function*() {
572
+ const currentSet = yield* TxRef.get(self.ref)
573
+ const existed = HashSet.has(currentSet, value)
574
+ if (existed) {
575
+ yield* TxRef.set(self.ref, HashSet.remove(currentSet, value))
576
+ }
577
+ return existed
578
+ }))
581
579
 
582
580
  /**
583
581
  * Checks if the TxHashSet contains the specified value.
@@ -648,7 +646,7 @@ export const has: {
648
646
  * @since 2.0.0
649
647
  * @category elements
650
648
  */
651
- <V>(value: V): (self: TxHashSet<V>) => Effect.Effect<boolean>
649
+ <V>(value: V): (self: TxHashSet<V>) => Effect.Effect<boolean, never, Effect.Transaction>
652
650
  /**
653
651
  * Checks if the TxHashSet contains the specified value.
654
652
  *
@@ -683,7 +681,7 @@ export const has: {
683
681
  * @since 2.0.0
684
682
  * @category elements
685
683
  */
686
- <V>(self: TxHashSet<V>, value: V): Effect.Effect<boolean>
684
+ <V>(self: TxHashSet<V>, value: V): Effect.Effect<boolean, never, Effect.Transaction>
687
685
  } = dual<
688
686
  /**
689
687
  * Checks if the TxHashSet contains the specified value.
@@ -719,7 +717,7 @@ export const has: {
719
717
  * @since 2.0.0
720
718
  * @category elements
721
719
  */
722
- <V>(value: V) => (self: TxHashSet<V>) => Effect.Effect<boolean>,
720
+ <V>(value: V) => (self: TxHashSet<V>) => Effect.Effect<boolean, never, Effect.Transaction>,
723
721
  /**
724
722
  * Checks if the TxHashSet contains the specified value.
725
723
  *
@@ -754,7 +752,7 @@ export const has: {
754
752
  * @since 2.0.0
755
753
  * @category elements
756
754
  */
757
- <V>(self: TxHashSet<V>, value: V) => Effect.Effect<boolean>
755
+ <V>(self: TxHashSet<V>, value: V) => Effect.Effect<boolean, never, Effect.Transaction>
758
756
  >(2, <V>(self: TxHashSet<V>, value: V) =>
759
757
  Effect.gen(function*() {
760
758
  const set = yield* TxRef.get(self.ref)
@@ -783,7 +781,7 @@ export const has: {
783
781
  * @since 2.0.0
784
782
  * @category getters
785
783
  */
786
- export const size = <V>(self: TxHashSet<V>): Effect.Effect<number> =>
784
+ export const size = <V>(self: TxHashSet<V>): Effect.Effect<number, never, Effect.Transaction> =>
787
785
  Effect.gen(function*() {
788
786
  const set = yield* TxRef.get(self.ref)
789
787
  return HashSet.size(set)
@@ -808,7 +806,7 @@ export const size = <V>(self: TxHashSet<V>): Effect.Effect<number> =>
808
806
  * @since 2.0.0
809
807
  * @category getters
810
808
  */
811
- export const isEmpty = <V>(self: TxHashSet<V>): Effect.Effect<boolean> =>
809
+ export const isEmpty = <V>(self: TxHashSet<V>): Effect.Effect<boolean, never, Effect.Transaction> =>
812
810
  Effect.gen(function*() {
813
811
  const set = yield* TxRef.get(self.ref)
814
812
  return HashSet.isEmpty(set)
@@ -837,7 +835,8 @@ export const isEmpty = <V>(self: TxHashSet<V>): Effect.Effect<boolean> =>
837
835
  * @since 2.0.0
838
836
  * @category mutations
839
837
  */
840
- export const clear = <V>(self: TxHashSet<V>): Effect.Effect<void> => TxRef.set(self.ref, HashSet.empty<V>())
838
+ export const clear = <V>(self: TxHashSet<V>): Effect.Effect<void, never, Effect.Transaction> =>
839
+ TxRef.set(self.ref, HashSet.empty<V>())
841
840
 
842
841
  /**
843
842
  * Creates the union of two TxHashSets, returning a new TxHashSet.
@@ -882,7 +881,7 @@ export const union: {
882
881
  * @since 2.0.0
883
882
  * @category combinators
884
883
  */
885
- <V1>(that: TxHashSet<V1>): <V0>(self: TxHashSet<V0>) => Effect.Effect<TxHashSet<V1 | V0>>
884
+ <V1>(that: TxHashSet<V1>): <V0>(self: TxHashSet<V0>) => Effect.Effect<TxHashSet<V1 | V0>, never, Effect.Transaction>
886
885
  /**
887
886
  * Creates the union of two TxHashSets, returning a new TxHashSet.
888
887
  *
@@ -904,7 +903,7 @@ export const union: {
904
903
  * @since 2.0.0
905
904
  * @category combinators
906
905
  */
907
- <V0, V1>(self: TxHashSet<V0>, that: TxHashSet<V1>): Effect.Effect<TxHashSet<V0 | V1>>
906
+ <V0, V1>(self: TxHashSet<V0>, that: TxHashSet<V1>): Effect.Effect<TxHashSet<V0 | V1>, never, Effect.Transaction>
908
907
  } = dual<
909
908
  /**
910
909
  * Creates the union of two TxHashSets, returning a new TxHashSet.
@@ -927,7 +926,7 @@ export const union: {
927
926
  * @since 2.0.0
928
927
  * @category combinators
929
928
  */
930
- <V1>(that: TxHashSet<V1>) => <V0>(self: TxHashSet<V0>) => Effect.Effect<TxHashSet<V1 | V0>>,
929
+ <V1>(that: TxHashSet<V1>) => <V0>(self: TxHashSet<V0>) => Effect.Effect<TxHashSet<V1 | V0>, never, Effect.Transaction>,
931
930
  /**
932
931
  * Creates the union of two TxHashSets, returning a new TxHashSet.
933
932
  *
@@ -949,16 +948,14 @@ export const union: {
949
948
  * @since 2.0.0
950
949
  * @category combinators
951
950
  */
952
- <V0, V1>(self: TxHashSet<V0>, that: TxHashSet<V1>) => Effect.Effect<TxHashSet<V0 | V1>>
951
+ <V0, V1>(self: TxHashSet<V0>, that: TxHashSet<V1>) => Effect.Effect<TxHashSet<V0 | V1>, never, Effect.Transaction>
953
952
  >(2, <V0, V1>(self: TxHashSet<V0>, that: TxHashSet<V1>) =>
954
- Effect.atomic(
955
- Effect.gen(function*() {
956
- const set1 = yield* TxRef.get(self.ref)
957
- const set2 = yield* TxRef.get(that.ref)
958
- const combined = HashSet.union(set1, set2)
959
- return yield* fromHashSet(combined)
960
- })
961
- ))
953
+ Effect.gen(function*() {
954
+ const set1 = yield* TxRef.get(self.ref)
955
+ const set2 = yield* TxRef.get(that.ref)
956
+ const combined = HashSet.union(set1, set2)
957
+ return yield* fromHashSet(combined)
958
+ }))
962
959
 
963
960
  /**
964
961
  * Creates the intersection of two TxHashSets, returning a new TxHashSet.
@@ -1003,7 +1000,7 @@ export const intersection: {
1003
1000
  * @since 2.0.0
1004
1001
  * @category combinators
1005
1002
  */
1006
- <V1>(that: TxHashSet<V1>): <V0>(self: TxHashSet<V0>) => Effect.Effect<TxHashSet<V1 & V0>>
1003
+ <V1>(that: TxHashSet<V1>): <V0>(self: TxHashSet<V0>) => Effect.Effect<TxHashSet<V1 & V0>, never, Effect.Transaction>
1007
1004
  /**
1008
1005
  * Creates the intersection of two TxHashSets, returning a new TxHashSet.
1009
1006
  *
@@ -1025,7 +1022,7 @@ export const intersection: {
1025
1022
  * @since 2.0.0
1026
1023
  * @category combinators
1027
1024
  */
1028
- <V0, V1>(self: TxHashSet<V0>, that: TxHashSet<V1>): Effect.Effect<TxHashSet<V0 & V1>>
1025
+ <V0, V1>(self: TxHashSet<V0>, that: TxHashSet<V1>): Effect.Effect<TxHashSet<V0 & V1>, never, Effect.Transaction>
1029
1026
  } = dual<
1030
1027
  /**
1031
1028
  * Creates the intersection of two TxHashSets, returning a new TxHashSet.
@@ -1048,7 +1045,7 @@ export const intersection: {
1048
1045
  * @since 2.0.0
1049
1046
  * @category combinators
1050
1047
  */
1051
- <V1>(that: TxHashSet<V1>) => <V0>(self: TxHashSet<V0>) => Effect.Effect<TxHashSet<V1 & V0>>,
1048
+ <V1>(that: TxHashSet<V1>) => <V0>(self: TxHashSet<V0>) => Effect.Effect<TxHashSet<V1 & V0>, never, Effect.Transaction>,
1052
1049
  /**
1053
1050
  * Creates the intersection of two TxHashSets, returning a new TxHashSet.
1054
1051
  *
@@ -1070,16 +1067,14 @@ export const intersection: {
1070
1067
  * @since 2.0.0
1071
1068
  * @category combinators
1072
1069
  */
1073
- <V0, V1>(self: TxHashSet<V0>, that: TxHashSet<V1>) => Effect.Effect<TxHashSet<V0 & V1>>
1070
+ <V0, V1>(self: TxHashSet<V0>, that: TxHashSet<V1>) => Effect.Effect<TxHashSet<V0 & V1>, never, Effect.Transaction>
1074
1071
  >(2, <V0, V1>(self: TxHashSet<V0>, that: TxHashSet<V1>) =>
1075
- Effect.atomic(
1076
- Effect.gen(function*() {
1077
- const set1 = yield* TxRef.get(self.ref)
1078
- const set2 = yield* TxRef.get(that.ref)
1079
- const common = HashSet.intersection(set1, set2)
1080
- return yield* fromHashSet(common)
1081
- })
1082
- ))
1072
+ Effect.gen(function*() {
1073
+ const set1 = yield* TxRef.get(self.ref)
1074
+ const set2 = yield* TxRef.get(that.ref)
1075
+ const common = HashSet.intersection(set1, set2)
1076
+ return yield* fromHashSet(common)
1077
+ }))
1083
1078
 
1084
1079
  /**
1085
1080
  * Creates the difference of two TxHashSets (elements in the first set that are not in the second), returning a new TxHashSet.
@@ -1124,7 +1119,7 @@ export const difference: {
1124
1119
  * @since 2.0.0
1125
1120
  * @category combinators
1126
1121
  */
1127
- <V1>(that: TxHashSet<V1>): <V0>(self: TxHashSet<V0>) => Effect.Effect<TxHashSet<V0>>
1122
+ <V1>(that: TxHashSet<V1>): <V0>(self: TxHashSet<V0>) => Effect.Effect<TxHashSet<V0>, never, Effect.Transaction>
1128
1123
  /**
1129
1124
  * Creates the difference of two TxHashSets (elements in the first set that are not in the second), returning a new TxHashSet.
1130
1125
  *
@@ -1146,7 +1141,7 @@ export const difference: {
1146
1141
  * @since 2.0.0
1147
1142
  * @category combinators
1148
1143
  */
1149
- <V0, V1>(self: TxHashSet<V0>, that: TxHashSet<V1>): Effect.Effect<TxHashSet<V0>>
1144
+ <V0, V1>(self: TxHashSet<V0>, that: TxHashSet<V1>): Effect.Effect<TxHashSet<V0>, never, Effect.Transaction>
1150
1145
  } = dual<
1151
1146
  /**
1152
1147
  * Creates the difference of two TxHashSets (elements in the first set that are not in the second), returning a new TxHashSet.
@@ -1169,7 +1164,7 @@ export const difference: {
1169
1164
  * @since 2.0.0
1170
1165
  * @category combinators
1171
1166
  */
1172
- <V1>(that: TxHashSet<V1>) => <V0>(self: TxHashSet<V0>) => Effect.Effect<TxHashSet<V0>>,
1167
+ <V1>(that: TxHashSet<V1>) => <V0>(self: TxHashSet<V0>) => Effect.Effect<TxHashSet<V0>, never, Effect.Transaction>,
1173
1168
  /**
1174
1169
  * Creates the difference of two TxHashSets (elements in the first set that are not in the second), returning a new TxHashSet.
1175
1170
  *
@@ -1191,16 +1186,14 @@ export const difference: {
1191
1186
  * @since 2.0.0
1192
1187
  * @category combinators
1193
1188
  */
1194
- <V0, V1>(self: TxHashSet<V0>, that: TxHashSet<V1>) => Effect.Effect<TxHashSet<V0>>
1189
+ <V0, V1>(self: TxHashSet<V0>, that: TxHashSet<V1>) => Effect.Effect<TxHashSet<V0>, never, Effect.Transaction>
1195
1190
  >(2, <V0, V1>(self: TxHashSet<V0>, that: TxHashSet<V1>) =>
1196
- Effect.atomic(
1197
- Effect.gen(function*() {
1198
- const set1 = yield* TxRef.get(self.ref)
1199
- const set2 = yield* TxRef.get(that.ref)
1200
- const diff = HashSet.difference(set1, set2)
1201
- return yield* fromHashSet(diff)
1202
- })
1203
- ))
1191
+ Effect.gen(function*() {
1192
+ const set1 = yield* TxRef.get(self.ref)
1193
+ const set2 = yield* TxRef.get(that.ref)
1194
+ const diff = HashSet.difference(set1, set2)
1195
+ return yield* fromHashSet(diff)
1196
+ }))
1204
1197
 
1205
1198
  /**
1206
1199
  * Checks if a TxHashSet is a subset of another TxHashSet.
@@ -1247,7 +1240,7 @@ export const isSubset: {
1247
1240
  * @since 2.0.0
1248
1241
  * @category elements
1249
1242
  */
1250
- <V1>(that: TxHashSet<V1>): <V0>(self: TxHashSet<V0>) => Effect.Effect<boolean>
1243
+ <V1>(that: TxHashSet<V1>): <V0>(self: TxHashSet<V0>) => Effect.Effect<boolean, never, Effect.Transaction>
1251
1244
  /**
1252
1245
  * Checks if a TxHashSet is a subset of another TxHashSet.
1253
1246
  *
@@ -1270,7 +1263,7 @@ export const isSubset: {
1270
1263
  * @since 2.0.0
1271
1264
  * @category elements
1272
1265
  */
1273
- <V0, V1>(self: TxHashSet<V0>, that: TxHashSet<V1>): Effect.Effect<boolean>
1266
+ <V0, V1>(self: TxHashSet<V0>, that: TxHashSet<V1>): Effect.Effect<boolean, never, Effect.Transaction>
1274
1267
  } = dual<
1275
1268
  /**
1276
1269
  * Checks if a TxHashSet is a subset of another TxHashSet.
@@ -1294,7 +1287,7 @@ export const isSubset: {
1294
1287
  * @since 2.0.0
1295
1288
  * @category elements
1296
1289
  */
1297
- <V1>(that: TxHashSet<V1>) => <V0>(self: TxHashSet<V0>) => Effect.Effect<boolean>,
1290
+ <V1>(that: TxHashSet<V1>) => <V0>(self: TxHashSet<V0>) => Effect.Effect<boolean, never, Effect.Transaction>,
1298
1291
  /**
1299
1292
  * Checks if a TxHashSet is a subset of another TxHashSet.
1300
1293
  *
@@ -1317,15 +1310,13 @@ export const isSubset: {
1317
1310
  * @since 2.0.0
1318
1311
  * @category elements
1319
1312
  */
1320
- <V0, V1>(self: TxHashSet<V0>, that: TxHashSet<V1>) => Effect.Effect<boolean>
1313
+ <V0, V1>(self: TxHashSet<V0>, that: TxHashSet<V1>) => Effect.Effect<boolean, never, Effect.Transaction>
1321
1314
  >(2, <V0, V1>(self: TxHashSet<V0>, that: TxHashSet<V1>) =>
1322
- Effect.atomic(
1323
- Effect.gen(function*() {
1324
- const set1 = yield* TxRef.get(self.ref)
1325
- const set2 = yield* TxRef.get(that.ref)
1326
- return HashSet.isSubset(set1, set2)
1327
- })
1328
- ))
1315
+ Effect.gen(function*() {
1316
+ const set1 = yield* TxRef.get(self.ref)
1317
+ const set2 = yield* TxRef.get(that.ref)
1318
+ return HashSet.isSubset(set1, set2)
1319
+ }))
1329
1320
 
1330
1321
  /**
1331
1322
  * Tests whether at least one value in the TxHashSet satisfies the predicate.
@@ -1370,7 +1361,7 @@ export const some: {
1370
1361
  * @since 2.0.0
1371
1362
  * @category elements
1372
1363
  */
1373
- <V>(predicate: Predicate<V>): (self: TxHashSet<V>) => Effect.Effect<boolean>
1364
+ <V>(predicate: Predicate<V>): (self: TxHashSet<V>) => Effect.Effect<boolean, never, Effect.Transaction>
1374
1365
  /**
1375
1366
  * Tests whether at least one value in the TxHashSet satisfies the predicate.
1376
1367
  *
@@ -1392,7 +1383,7 @@ export const some: {
1392
1383
  * @since 2.0.0
1393
1384
  * @category elements
1394
1385
  */
1395
- <V>(self: TxHashSet<V>, predicate: Predicate<V>): Effect.Effect<boolean>
1386
+ <V>(self: TxHashSet<V>, predicate: Predicate<V>): Effect.Effect<boolean, never, Effect.Transaction>
1396
1387
  } = dual<
1397
1388
  /**
1398
1389
  * Tests whether at least one value in the TxHashSet satisfies the predicate.
@@ -1415,7 +1406,7 @@ export const some: {
1415
1406
  * @since 2.0.0
1416
1407
  * @category elements
1417
1408
  */
1418
- <V>(predicate: Predicate<V>) => (self: TxHashSet<V>) => Effect.Effect<boolean>,
1409
+ <V>(predicate: Predicate<V>) => (self: TxHashSet<V>) => Effect.Effect<boolean, never, Effect.Transaction>,
1419
1410
  /**
1420
1411
  * Tests whether at least one value in the TxHashSet satisfies the predicate.
1421
1412
  *
@@ -1437,7 +1428,7 @@ export const some: {
1437
1428
  * @since 2.0.0
1438
1429
  * @category elements
1439
1430
  */
1440
- <V>(self: TxHashSet<V>, predicate: Predicate<V>) => Effect.Effect<boolean>
1431
+ <V>(self: TxHashSet<V>, predicate: Predicate<V>) => Effect.Effect<boolean, never, Effect.Transaction>
1441
1432
  >(2, <V>(self: TxHashSet<V>, predicate: Predicate<V>) =>
1442
1433
  Effect.gen(function*() {
1443
1434
  const set = yield* TxRef.get(self.ref)
@@ -1487,7 +1478,7 @@ export const every: {
1487
1478
  * @since 2.0.0
1488
1479
  * @category elements
1489
1480
  */
1490
- <V>(predicate: Predicate<V>): (self: TxHashSet<V>) => Effect.Effect<boolean>
1481
+ <V>(predicate: Predicate<V>): (self: TxHashSet<V>) => Effect.Effect<boolean, never, Effect.Transaction>
1491
1482
  /**
1492
1483
  * Tests whether all values in the TxHashSet satisfy the predicate.
1493
1484
  *
@@ -1509,7 +1500,7 @@ export const every: {
1509
1500
  * @since 2.0.0
1510
1501
  * @category elements
1511
1502
  */
1512
- <V>(self: TxHashSet<V>, predicate: Predicate<V>): Effect.Effect<boolean>
1503
+ <V>(self: TxHashSet<V>, predicate: Predicate<V>): Effect.Effect<boolean, never, Effect.Transaction>
1513
1504
  } = dual<
1514
1505
  /**
1515
1506
  * Tests whether all values in the TxHashSet satisfy the predicate.
@@ -1532,7 +1523,7 @@ export const every: {
1532
1523
  * @since 2.0.0
1533
1524
  * @category elements
1534
1525
  */
1535
- <V>(predicate: Predicate<V>) => (self: TxHashSet<V>) => Effect.Effect<boolean>,
1526
+ <V>(predicate: Predicate<V>) => (self: TxHashSet<V>) => Effect.Effect<boolean, never, Effect.Transaction>,
1536
1527
  /**
1537
1528
  * Tests whether all values in the TxHashSet satisfy the predicate.
1538
1529
  *
@@ -1554,7 +1545,7 @@ export const every: {
1554
1545
  * @since 2.0.0
1555
1546
  * @category elements
1556
1547
  */
1557
- <V>(self: TxHashSet<V>, predicate: Predicate<V>) => Effect.Effect<boolean>
1548
+ <V>(self: TxHashSet<V>, predicate: Predicate<V>) => Effect.Effect<boolean, never, Effect.Transaction>
1558
1549
  >(2, <V>(self: TxHashSet<V>, predicate: Predicate<V>) =>
1559
1550
  Effect.gen(function*() {
1560
1551
  const set = yield* TxRef.get(self.ref)
@@ -1614,7 +1605,7 @@ export const map: {
1614
1605
  * @since 2.0.0
1615
1606
  * @category mapping
1616
1607
  */
1617
- <V, U>(f: (value: V) => U): (self: TxHashSet<V>) => Effect.Effect<TxHashSet<U>>
1608
+ <V, U>(f: (value: V) => U): (self: TxHashSet<V>) => Effect.Effect<TxHashSet<U>, never, Effect.Transaction>
1618
1609
  /**
1619
1610
  * Maps each value in the TxHashSet using the provided function, returning a new TxHashSet.
1620
1611
  *
@@ -1641,7 +1632,7 @@ export const map: {
1641
1632
  * @since 2.0.0
1642
1633
  * @category mapping
1643
1634
  */
1644
- <V, U>(self: TxHashSet<V>, f: (value: V) => U): Effect.Effect<TxHashSet<U>>
1635
+ <V, U>(self: TxHashSet<V>, f: (value: V) => U): Effect.Effect<TxHashSet<U>, never, Effect.Transaction>
1645
1636
  } = dual<
1646
1637
  /**
1647
1638
  * Maps each value in the TxHashSet using the provided function, returning a new TxHashSet.
@@ -1669,7 +1660,7 @@ export const map: {
1669
1660
  * @since 2.0.0
1670
1661
  * @category mapping
1671
1662
  */
1672
- <V, U>(f: (value: V) => U) => (self: TxHashSet<V>) => Effect.Effect<TxHashSet<U>>,
1663
+ <V, U>(f: (value: V) => U) => (self: TxHashSet<V>) => Effect.Effect<TxHashSet<U>, never, Effect.Transaction>,
1673
1664
  /**
1674
1665
  * Maps each value in the TxHashSet using the provided function, returning a new TxHashSet.
1675
1666
  *
@@ -1696,15 +1687,13 @@ export const map: {
1696
1687
  * @since 2.0.0
1697
1688
  * @category mapping
1698
1689
  */
1699
- <V, U>(self: TxHashSet<V>, f: (value: V) => U) => Effect.Effect<TxHashSet<U>>
1690
+ <V, U>(self: TxHashSet<V>, f: (value: V) => U) => Effect.Effect<TxHashSet<U>, never, Effect.Transaction>
1700
1691
  >(2, <V, U>(self: TxHashSet<V>, f: (value: V) => U) =>
1701
- Effect.atomic(
1702
- Effect.gen(function*() {
1703
- const currentSet = yield* TxRef.get(self.ref)
1704
- const mappedSet = HashSet.map(currentSet, f)
1705
- return yield* fromHashSet(mappedSet)
1706
- })
1707
- ))
1692
+ Effect.gen(function*() {
1693
+ const currentSet = yield* TxRef.get(self.ref)
1694
+ const mappedSet = HashSet.map(currentSet, f)
1695
+ return yield* fromHashSet(mappedSet)
1696
+ }))
1708
1697
 
1709
1698
  /**
1710
1699
  * Filters the TxHashSet keeping only values that satisfy the predicate, returning a new TxHashSet.
@@ -1747,7 +1736,7 @@ export const filter: {
1747
1736
  * @since 2.0.0
1748
1737
  * @category filtering
1749
1738
  */
1750
- <V, U extends V>(refinement: Refinement<NoInfer<V>, U>): (self: TxHashSet<V>) => Effect.Effect<TxHashSet<U>>
1739
+ <V, U extends V>(refinement: Refinement<NoInfer<V>, U>): (self: TxHashSet<V>) => Effect.Effect<TxHashSet<U>, never, Effect.Transaction>
1751
1740
  /**
1752
1741
  * Filters the TxHashSet keeping only values that satisfy the predicate, returning a new TxHashSet.
1753
1742
  *
@@ -1768,7 +1757,7 @@ export const filter: {
1768
1757
  * @since 2.0.0
1769
1758
  * @category filtering
1770
1759
  */
1771
- <V>(predicate: Predicate<NoInfer<V>>): (self: TxHashSet<V>) => Effect.Effect<TxHashSet<V>>
1760
+ <V>(predicate: Predicate<NoInfer<V>>): (self: TxHashSet<V>) => Effect.Effect<TxHashSet<V>, never, Effect.Transaction>
1772
1761
  /**
1773
1762
  * Filters the TxHashSet keeping only values that satisfy the predicate, returning a new TxHashSet.
1774
1763
  *
@@ -1789,7 +1778,7 @@ export const filter: {
1789
1778
  * @since 2.0.0
1790
1779
  * @category filtering
1791
1780
  */
1792
- <V, U extends V>(self: TxHashSet<V>, refinement: Refinement<V, U>): Effect.Effect<TxHashSet<U>>
1781
+ <V, U extends V>(self: TxHashSet<V>, refinement: Refinement<V, U>): Effect.Effect<TxHashSet<U>, never, Effect.Transaction>
1793
1782
  /**
1794
1783
  * Filters the TxHashSet keeping only values that satisfy the predicate, returning a new TxHashSet.
1795
1784
  *
@@ -1810,7 +1799,7 @@ export const filter: {
1810
1799
  * @since 2.0.0
1811
1800
  * @category filtering
1812
1801
  */
1813
- <V>(self: TxHashSet<V>, predicate: Predicate<V>): Effect.Effect<TxHashSet<V>>
1802
+ <V>(self: TxHashSet<V>, predicate: Predicate<V>): Effect.Effect<TxHashSet<V>, never, Effect.Transaction>
1814
1803
  } = dual<
1815
1804
  /**
1816
1805
  * Filters the TxHashSet keeping only values that satisfy the predicate, returning a new TxHashSet.
@@ -1833,8 +1822,12 @@ export const filter: {
1833
1822
  * @category filtering
1834
1823
  */
1835
1824
  {
1836
- <V, U extends V>(refinement: Refinement<NoInfer<V>, U>): (self: TxHashSet<V>) => Effect.Effect<TxHashSet<U>>;
1837
- <V>(predicate: Predicate<NoInfer<V>>): (self: TxHashSet<V>) => Effect.Effect<TxHashSet<V>>;
1825
+ <V, U extends V>(
1826
+ refinement: Refinement<NoInfer<V>, U>
1827
+ ): (self: TxHashSet<V>) => Effect.Effect<TxHashSet<U>, never, Effect.Transaction>;
1828
+ <V>(
1829
+ predicate: Predicate<NoInfer<V>>
1830
+ ): (self: TxHashSet<V>) => Effect.Effect<TxHashSet<V>, never, Effect.Transaction>;
1838
1831
  },
1839
1832
  /**
1840
1833
  * Filters the TxHashSet keeping only values that satisfy the predicate, returning a new TxHashSet.
@@ -1857,17 +1850,18 @@ export const filter: {
1857
1850
  * @category filtering
1858
1851
  */
1859
1852
  {
1860
- <V, U extends V>(self: TxHashSet<V>, refinement: Refinement<V, U>): Effect.Effect<TxHashSet<U>>;
1861
- <V>(self: TxHashSet<V>, predicate: Predicate<V>): Effect.Effect<TxHashSet<V>>;
1853
+ <V, U extends V>(
1854
+ self: TxHashSet<V>,
1855
+ refinement: Refinement<V, U>
1856
+ ): Effect.Effect<TxHashSet<U>, never, Effect.Transaction>;
1857
+ <V>(self: TxHashSet<V>, predicate: Predicate<V>): Effect.Effect<TxHashSet<V>, never, Effect.Transaction>;
1862
1858
  }
1863
1859
  >(2, <V>(self: TxHashSet<V>, predicate: Predicate<V>) =>
1864
- Effect.atomic(
1865
- Effect.gen(function*() {
1866
- const currentSet = yield* TxRef.get(self.ref)
1867
- const filteredSet = HashSet.filter(currentSet, predicate)
1868
- return yield* fromHashSet(filteredSet)
1869
- })
1870
- ))
1860
+ Effect.gen(function*() {
1861
+ const currentSet = yield* TxRef.get(self.ref)
1862
+ const filteredSet = HashSet.filter(currentSet, predicate)
1863
+ return yield* fromHashSet(filteredSet)
1864
+ }))
1871
1865
 
1872
1866
  /**
1873
1867
  * Reduces the TxHashSet to a single value by iterating through the values and applying an accumulator function.
@@ -1914,7 +1908,7 @@ export const reduce: {
1914
1908
  * @since 2.0.0
1915
1909
  * @category folding
1916
1910
  */
1917
- <V, U>(zero: U, f: (accumulator: U, value: V) => U): (self: TxHashSet<V>) => Effect.Effect<U>
1911
+ <V, U>(zero: U, f: (accumulator: U, value: V) => U): (self: TxHashSet<V>) => Effect.Effect<U, never, Effect.Transaction>
1918
1912
  /**
1919
1913
  * Reduces the TxHashSet to a single value by iterating through the values and applying an accumulator function.
1920
1914
  *
@@ -1937,7 +1931,7 @@ export const reduce: {
1937
1931
  * @since 2.0.0
1938
1932
  * @category folding
1939
1933
  */
1940
- <V, U>(self: TxHashSet<V>, zero: U, f: (accumulator: U, value: V) => U): Effect.Effect<U>
1934
+ <V, U>(self: TxHashSet<V>, zero: U, f: (accumulator: U, value: V) => U): Effect.Effect<U, never, Effect.Transaction>
1941
1935
  } = dual<
1942
1936
  /**
1943
1937
  * Reduces the TxHashSet to a single value by iterating through the values and applying an accumulator function.
@@ -1961,7 +1955,7 @@ export const reduce: {
1961
1955
  * @since 2.0.0
1962
1956
  * @category folding
1963
1957
  */
1964
- <V, U>(zero: U, f: (accumulator: U, value: V) => U) => (self: TxHashSet<V>) => Effect.Effect<U>,
1958
+ <V, U>(zero: U, f: (accumulator: U, value: V) => U) => (self: TxHashSet<V>) => Effect.Effect<U, never, Effect.Transaction>,
1965
1959
  /**
1966
1960
  * Reduces the TxHashSet to a single value by iterating through the values and applying an accumulator function.
1967
1961
  *
@@ -1984,7 +1978,7 @@ export const reduce: {
1984
1978
  * @since 2.0.0
1985
1979
  * @category folding
1986
1980
  */
1987
- <V, U>(self: TxHashSet<V>, zero: U, f: (accumulator: U, value: V) => U) => Effect.Effect<U>
1981
+ <V, U>(self: TxHashSet<V>, zero: U, f: (accumulator: U, value: V) => U) => Effect.Effect<U, never, Effect.Transaction>
1988
1982
  >(3, <V, U>(self: TxHashSet<V>, zero: U, f: (accumulator: U, value: V) => U) =>
1989
1983
  Effect.gen(function*() {
1990
1984
  const set = yield* TxRef.get(self.ref)
@@ -2016,4 +2010,5 @@ export const reduce: {
2016
2010
  * @since 2.0.0
2017
2011
  * @category conversions
2018
2012
  */
2019
- export const toHashSet = <V>(self: TxHashSet<V>): Effect.Effect<HashSet.HashSet<V>> => TxRef.get(self.ref)
2013
+ export const toHashSet = <V>(self: TxHashSet<V>): Effect.Effect<HashSet.HashSet<V>, never, Effect.Transaction> =>
2014
+ TxRef.get(self.ref)