effect 4.0.0-beta.16 → 4.0.0-beta.18

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 (78) hide show
  1. package/dist/Effect.d.ts +33 -101
  2. package/dist/Effect.d.ts.map +1 -1
  3. package/dist/Effect.js +33 -108
  4. package/dist/Effect.js.map +1 -1
  5. package/dist/Schema.d.ts.map +1 -1
  6. package/dist/Schema.js +3 -2
  7. package/dist/Schema.js.map +1 -1
  8. package/dist/TxChunk.d.ts +37 -37
  9. package/dist/TxChunk.d.ts.map +1 -1
  10. package/dist/TxChunk.js +3 -3
  11. package/dist/TxChunk.js.map +1 -1
  12. package/dist/TxDeferred.d.ts +328 -0
  13. package/dist/TxDeferred.d.ts.map +1 -0
  14. package/dist/TxDeferred.js +196 -0
  15. package/dist/TxDeferred.js.map +1 -0
  16. package/dist/TxHashMap.d.ts +59 -59
  17. package/dist/TxHashMap.d.ts.map +1 -1
  18. package/dist/TxHashMap.js +16 -16
  19. package/dist/TxHashMap.js.map +1 -1
  20. package/dist/TxHashSet.d.ts +35 -35
  21. package/dist/TxHashSet.d.ts.map +1 -1
  22. package/dist/TxHashSet.js +14 -14
  23. package/dist/TxHashSet.js.map +1 -1
  24. package/dist/TxPriorityQueue.d.ts +609 -0
  25. package/dist/TxPriorityQueue.d.ts.map +1 -0
  26. package/dist/TxPriorityQueue.js +415 -0
  27. package/dist/TxPriorityQueue.js.map +1 -0
  28. package/dist/TxPubSub.d.ts +585 -0
  29. package/dist/TxPubSub.d.ts.map +1 -0
  30. package/dist/TxPubSub.js +521 -0
  31. package/dist/TxPubSub.js.map +1 -0
  32. package/dist/TxQueue.d.ts +32 -32
  33. package/dist/TxQueue.d.ts.map +1 -1
  34. package/dist/TxQueue.js +26 -26
  35. package/dist/TxQueue.js.map +1 -1
  36. package/dist/TxReentrantLock.d.ts +523 -0
  37. package/dist/TxReentrantLock.d.ts.map +1 -0
  38. package/dist/TxReentrantLock.js +504 -0
  39. package/dist/TxReentrantLock.js.map +1 -0
  40. package/dist/TxRef.d.ts +34 -34
  41. package/dist/TxRef.d.ts.map +1 -1
  42. package/dist/TxRef.js +21 -14
  43. package/dist/TxRef.js.map +1 -1
  44. package/dist/TxSemaphore.d.ts +8 -8
  45. package/dist/TxSemaphore.d.ts.map +1 -1
  46. package/dist/TxSemaphore.js +7 -7
  47. package/dist/TxSemaphore.js.map +1 -1
  48. package/dist/TxSubscriptionRef.d.ts +508 -0
  49. package/dist/TxSubscriptionRef.d.ts.map +1 -0
  50. package/dist/TxSubscriptionRef.js +293 -0
  51. package/dist/TxSubscriptionRef.js.map +1 -0
  52. package/dist/index.d.ts +40 -0
  53. package/dist/index.d.ts.map +1 -1
  54. package/dist/index.js +40 -0
  55. package/dist/index.js.map +1 -1
  56. package/dist/unstable/ai/Tool.d.ts.map +1 -1
  57. package/dist/unstable/ai/Tool.js +0 -9
  58. package/dist/unstable/ai/Tool.js.map +1 -1
  59. package/dist/unstable/cli/Command.d.ts +1 -1
  60. package/dist/unstable/cli/Command.d.ts.map +1 -1
  61. package/dist/unstable/cli/Command.js.map +1 -1
  62. package/package.json +1 -1
  63. package/src/Effect.ts +38 -117
  64. package/src/Schema.ts +3 -2
  65. package/src/TxChunk.ts +72 -53
  66. package/src/TxDeferred.ts +394 -0
  67. package/src/TxHashMap.ts +307 -261
  68. package/src/TxHashSet.ts +111 -116
  69. package/src/TxPriorityQueue.ts +767 -0
  70. package/src/TxPubSub.ts +789 -0
  71. package/src/TxQueue.ts +241 -251
  72. package/src/TxReentrantLock.ts +753 -0
  73. package/src/TxRef.ts +50 -38
  74. package/src/TxSemaphore.ts +29 -32
  75. package/src/TxSubscriptionRef.ts +639 -0
  76. package/src/index.ts +45 -0
  77. package/src/unstable/ai/Tool.ts +0 -9
  78. package/src/unstable/cli/Command.ts +4 -2
package/src/TxHashMap.ts CHANGED
@@ -53,7 +53,7 @@ const TxHashMapProto = {
53
53
  * console.log(user) // Option.some("Alice")
54
54
  *
55
55
  * // Multi-step atomic operations
56
- * yield* Effect.atomic(
56
+ * yield* Effect.transaction(
57
57
  * Effect.gen(function*() {
58
58
  * const currentUser = yield* TxHashMap.get(txMap, "user1")
59
59
  * if (Option.isSome(currentUser)) {
@@ -236,7 +236,7 @@ export declare namespace TxHashMap {
236
236
  * @since 2.0.0
237
237
  * @category constructors
238
238
  */
239
- export const empty = <K, V>(): Effect.Effect<TxHashMap<K, V>> =>
239
+ export const empty = <K, V>(): Effect.Effect<TxHashMap<K, V>, never, Effect.Transaction> =>
240
240
  Effect.gen(function*() {
241
241
  const ref = yield* TxRef.make(HashMap.empty<K, V>())
242
242
  return Object.assign(Object.create(TxHashMapProto), { ref })
@@ -273,7 +273,9 @@ export const empty = <K, V>(): Effect.Effect<TxHashMap<K, V>> =>
273
273
  * @since 2.0.0
274
274
  * @category constructors
275
275
  */
276
- export const make = <K, V>(...entries: Array<readonly [K, V]>): Effect.Effect<TxHashMap<K, V>> =>
276
+ export const make = <K, V>(
277
+ ...entries: Array<readonly [K, V]>
278
+ ): Effect.Effect<TxHashMap<K, V>, never, Effect.Transaction> =>
277
279
  Effect.gen(function*() {
278
280
  const hashMap = HashMap.make(...entries)
279
281
  const ref = yield* TxRef.make(hashMap)
@@ -314,7 +316,9 @@ export const make = <K, V>(...entries: Array<readonly [K, V]>): Effect.Effect<Tx
314
316
  * @since 2.0.0
315
317
  * @category constructors
316
318
  */
317
- export const fromIterable = <K, V>(entries: Iterable<readonly [K, V]>): Effect.Effect<TxHashMap<K, V>> =>
319
+ export const fromIterable = <K, V>(
320
+ entries: Iterable<readonly [K, V]>
321
+ ): Effect.Effect<TxHashMap<K, V>, never, Effect.Transaction> =>
318
322
  Effect.gen(function*() {
319
323
  const hashMap = HashMap.fromIterable(entries)
320
324
  const ref = yield* TxRef.make(hashMap)
@@ -384,7 +388,7 @@ export const get: {
384
388
  * @since 2.0.0
385
389
  * @category combinators
386
390
  */
387
- <K1 extends K, K>(key: K1): <V>(self: TxHashMap<K, V>) => Effect.Effect<Option.Option<V>>
391
+ <K1 extends K, K>(key: K1): <V>(self: TxHashMap<K, V>) => Effect.Effect<Option.Option<V>, never, Effect.Transaction>
388
392
  /**
389
393
  * Safely lookup the value for the specified key in the TxHashMap.
390
394
  *
@@ -416,10 +420,10 @@ export const get: {
416
420
  * @since 2.0.0
417
421
  * @category combinators
418
422
  */
419
- <K1 extends K, K, V>(self: TxHashMap<K, V>, key: K1): Effect.Effect<Option.Option<V>>
423
+ <K1 extends K, K, V>(self: TxHashMap<K, V>, key: K1): Effect.Effect<Option.Option<V>, never, Effect.Transaction>
420
424
  } = dual(
421
425
  2,
422
- <K1 extends K, K, V>(self: TxHashMap<K, V>, key: K1): Effect.Effect<Option.Option<V>> =>
426
+ <K1 extends K, K, V>(self: TxHashMap<K, V>, key: K1): Effect.Effect<Option.Option<V>, never, Effect.Transaction> =>
423
427
  Effect.gen(function*() {
424
428
  const map = yield* TxRef.get(self.ref)
425
429
  return HashMap.get(map, key)
@@ -495,7 +499,7 @@ export const set: {
495
499
  * @since 2.0.0
496
500
  * @category combinators
497
501
  */
498
- <K, V>(key: K, value: V): (self: TxHashMap<K, V>) => Effect.Effect<void>
502
+ <K, V>(key: K, value: V): (self: TxHashMap<K, V>) => Effect.Effect<void, never, Effect.Transaction>
499
503
  /**
500
504
  * Sets the value for the specified key in the TxHashMap.
501
505
  *
@@ -530,10 +534,10 @@ export const set: {
530
534
  * @since 2.0.0
531
535
  * @category combinators
532
536
  */
533
- <K, V>(self: TxHashMap<K, V>, key: K, value: V): Effect.Effect<void>
537
+ <K, V>(self: TxHashMap<K, V>, key: K, value: V): Effect.Effect<void, never, Effect.Transaction>
534
538
  } = dual(
535
539
  3,
536
- <K, V>(self: TxHashMap<K, V>, key: K, value: V): Effect.Effect<void> =>
540
+ <K, V>(self: TxHashMap<K, V>, key: K, value: V): Effect.Effect<void, never, Effect.Transaction> =>
537
541
  TxRef.update(self.ref, (map) => HashMap.set(map, key, value))
538
542
  )
539
543
 
@@ -598,7 +602,7 @@ export const has: {
598
602
  * @since 2.0.0
599
603
  * @category combinators
600
604
  */
601
- <K1 extends K, K>(key: K1): <V>(self: TxHashMap<K, V>) => Effect.Effect<boolean>
605
+ <K1 extends K, K>(key: K1): <V>(self: TxHashMap<K, V>) => Effect.Effect<boolean, never, Effect.Transaction>
602
606
  /**
603
607
  * Checks if the specified key exists in the TxHashMap.
604
608
  *
@@ -629,10 +633,10 @@ export const has: {
629
633
  * @since 2.0.0
630
634
  * @category combinators
631
635
  */
632
- <K1 extends K, K, V>(self: TxHashMap<K, V>, key: K1): Effect.Effect<boolean>
636
+ <K1 extends K, K, V>(self: TxHashMap<K, V>, key: K1): Effect.Effect<boolean, never, Effect.Transaction>
633
637
  } = dual(
634
638
  2,
635
- <K1 extends K, K, V>(self: TxHashMap<K, V>, key: K1): Effect.Effect<boolean> =>
639
+ <K1 extends K, K, V>(self: TxHashMap<K, V>, key: K1): Effect.Effect<boolean, never, Effect.Transaction> =>
636
640
  Effect.gen(function*() {
637
641
  const map = yield* TxRef.get(self.ref)
638
642
  return HashMap.has(map, key)
@@ -714,7 +718,7 @@ export const remove: {
714
718
  * @since 2.0.0
715
719
  * @category combinators
716
720
  */
717
- <K1 extends K, K>(key: K1): <V>(self: TxHashMap<K, V>) => Effect.Effect<boolean>
721
+ <K1 extends K, K>(key: K1): <V>(self: TxHashMap<K, V>) => Effect.Effect<boolean, never, Effect.Transaction>
718
722
  /**
719
723
  * Removes the specified key from the TxHashMap.
720
724
  *
@@ -752,20 +756,18 @@ export const remove: {
752
756
  * @since 2.0.0
753
757
  * @category combinators
754
758
  */
755
- <K1 extends K, K, V>(self: TxHashMap<K, V>, key: K1): Effect.Effect<boolean>
759
+ <K1 extends K, K, V>(self: TxHashMap<K, V>, key: K1): Effect.Effect<boolean, never, Effect.Transaction>
756
760
  } = dual(
757
761
  2,
758
- <K1 extends K, K, V>(self: TxHashMap<K, V>, key: K1): Effect.Effect<boolean> =>
759
- Effect.atomic(
760
- Effect.gen(function*() {
761
- const currentMap = yield* TxRef.get(self.ref)
762
- const existed = HashMap.has(currentMap, key)
763
- if (existed) {
764
- yield* TxRef.set(self.ref, HashMap.remove(currentMap, key))
765
- }
766
- return existed
767
- })
768
- )
762
+ <K1 extends K, K, V>(self: TxHashMap<K, V>, key: K1): Effect.Effect<boolean, never, Effect.Transaction> =>
763
+ Effect.gen(function*() {
764
+ const currentMap = yield* TxRef.get(self.ref)
765
+ const existed = HashMap.has(currentMap, key)
766
+ if (existed) {
767
+ yield* TxRef.set(self.ref, HashMap.remove(currentMap, key))
768
+ }
769
+ return existed
770
+ })
769
771
  )
770
772
 
771
773
  /**
@@ -804,7 +806,8 @@ export const remove: {
804
806
  * @since 2.0.0
805
807
  * @category combinators
806
808
  */
807
- export const clear = <K, V>(self: TxHashMap<K, V>): Effect.Effect<void> => TxRef.set(self.ref, HashMap.empty<K, V>())
809
+ export const clear = <K, V>(self: TxHashMap<K, V>): Effect.Effect<void, never, Effect.Transaction> =>
810
+ TxRef.set(self.ref, HashMap.empty<K, V>())
808
811
 
809
812
  /**
810
813
  * Returns the number of entries in the TxHashMap.
@@ -838,7 +841,7 @@ export const clear = <K, V>(self: TxHashMap<K, V>): Effect.Effect<void> => TxRef
838
841
  * @since 2.0.0
839
842
  * @category combinators
840
843
  */
841
- export const size = <K, V>(self: TxHashMap<K, V>): Effect.Effect<number> =>
844
+ export const size = <K, V>(self: TxHashMap<K, V>): Effect.Effect<number, never, Effect.Transaction> =>
842
845
  Effect.gen(function*() {
843
846
  const map = yield* TxRef.get(self.ref)
844
847
  return HashMap.size(map)
@@ -872,7 +875,7 @@ export const size = <K, V>(self: TxHashMap<K, V>): Effect.Effect<number> =>
872
875
  * @since 2.0.0
873
876
  * @category combinators
874
877
  */
875
- export const isEmpty = <K, V>(self: TxHashMap<K, V>): Effect.Effect<boolean> =>
878
+ export const isEmpty = <K, V>(self: TxHashMap<K, V>): Effect.Effect<boolean, never, Effect.Transaction> =>
876
879
  Effect.gen(function*() {
877
880
  const map = yield* TxRef.get(self.ref)
878
881
  return HashMap.isEmpty(map)
@@ -901,7 +904,7 @@ export const isEmpty = <K, V>(self: TxHashMap<K, V>): Effect.Effect<boolean> =>
901
904
  * @since 2.0.0
902
905
  * @category combinators
903
906
  */
904
- export const isNonEmpty = <K, V>(self: TxHashMap<K, V>): Effect.Effect<boolean> =>
907
+ export const isNonEmpty = <K, V>(self: TxHashMap<K, V>): Effect.Effect<boolean, never, Effect.Transaction> =>
905
908
  Effect.map(isEmpty(self), (empty) => !empty)
906
909
 
907
910
  /**
@@ -991,7 +994,7 @@ export const modify: {
991
994
  * @since 2.0.0
992
995
  * @category combinators
993
996
  */
994
- <K, V>(key: K, f: (value: V) => V): (self: TxHashMap<K, V>) => Effect.Effect<Option.Option<V>>
997
+ <K, V>(key: K, f: (value: V) => V): (self: TxHashMap<K, V>) => Effect.Effect<Option.Option<V>, never, Effect.Transaction>
995
998
  /**
996
999
  * Updates the value for the specified key if it exists.
997
1000
  *
@@ -1035,22 +1038,24 @@ export const modify: {
1035
1038
  * @since 2.0.0
1036
1039
  * @category combinators
1037
1040
  */
1038
- <K, V>(self: TxHashMap<K, V>, key: K, f: (value: V) => V): Effect.Effect<Option.Option<V>>
1041
+ <K, V>(self: TxHashMap<K, V>, key: K, f: (value: V) => V): Effect.Effect<Option.Option<V>, never, Effect.Transaction>
1039
1042
  } = dual(
1040
1043
  3,
1041
- <K, V>(self: TxHashMap<K, V>, key: K, f: (value: V) => V): Effect.Effect<Option.Option<V>> =>
1042
- Effect.atomic(
1043
- Effect.gen(function*() {
1044
- const currentMap = yield* TxRef.get(self.ref)
1045
- const currentValue = HashMap.get(currentMap, key)
1046
- if (Option.isSome(currentValue)) {
1047
- const newValue = f(currentValue.value)
1048
- yield* TxRef.set(self.ref, HashMap.set(currentMap, key, newValue))
1049
- return currentValue
1050
- }
1051
- return Option.none()
1052
- })
1053
- )
1044
+ <K, V>(
1045
+ self: TxHashMap<K, V>,
1046
+ key: K,
1047
+ f: (value: V) => V
1048
+ ): Effect.Effect<Option.Option<V>, never, Effect.Transaction> =>
1049
+ Effect.gen(function*() {
1050
+ const currentMap = yield* TxRef.get(self.ref)
1051
+ const currentValue = HashMap.get(currentMap, key)
1052
+ if (Option.isSome(currentValue)) {
1053
+ const newValue = f(currentValue.value)
1054
+ yield* TxRef.set(self.ref, HashMap.set(currentMap, key, newValue))
1055
+ return currentValue
1056
+ }
1057
+ return Option.none()
1058
+ })
1054
1059
  )
1055
1060
 
1056
1061
  /**
@@ -1140,7 +1145,7 @@ export const modifyAt: {
1140
1145
  * @since 2.0.0
1141
1146
  * @category combinators
1142
1147
  */
1143
- <K, V>(key: K, f: (value: Option.Option<V>) => Option.Option<V>): (self: TxHashMap<K, V>) => Effect.Effect<void>
1148
+ <K, V>(key: K, f: (value: Option.Option<V>) => Option.Option<V>): (self: TxHashMap<K, V>) => Effect.Effect<void, never, Effect.Transaction>
1144
1149
  /**
1145
1150
  * Updates the value for the specified key using an Option-based update function.
1146
1151
  *
@@ -1188,23 +1193,25 @@ export const modifyAt: {
1188
1193
  self: TxHashMap<K, V>,
1189
1194
  key: K,
1190
1195
  f: (value: Option.Option<V>) => Option.Option<V>
1191
- ): Effect.Effect<void>
1196
+ ): Effect.Effect<void, never, Effect.Transaction>
1192
1197
  } = dual(
1193
1198
  3,
1194
- <K, V>(self: TxHashMap<K, V>, key: K, f: (value: Option.Option<V>) => Option.Option<V>): Effect.Effect<void> =>
1195
- Effect.atomic(
1196
- Effect.gen(function*() {
1197
- const currentMap = yield* TxRef.get(self.ref)
1198
- const currentValue = HashMap.get(currentMap, key)
1199
- const newValue = f(currentValue)
1199
+ <K, V>(
1200
+ self: TxHashMap<K, V>,
1201
+ key: K,
1202
+ f: (value: Option.Option<V>) => Option.Option<V>
1203
+ ): Effect.Effect<void, never, Effect.Transaction> =>
1204
+ Effect.gen(function*() {
1205
+ const currentMap = yield* TxRef.get(self.ref)
1206
+ const currentValue = HashMap.get(currentMap, key)
1207
+ const newValue = f(currentValue)
1200
1208
 
1201
- if (Option.isSome(newValue)) {
1202
- yield* TxRef.set(self.ref, HashMap.set(currentMap, key, newValue.value))
1203
- } else if (Option.isSome(currentValue)) {
1204
- yield* TxRef.set(self.ref, HashMap.remove(currentMap, key))
1205
- }
1206
- })
1207
- )
1209
+ if (Option.isSome(newValue)) {
1210
+ yield* TxRef.set(self.ref, HashMap.set(currentMap, key, newValue.value))
1211
+ } else if (Option.isSome(currentValue)) {
1212
+ yield* TxRef.set(self.ref, HashMap.remove(currentMap, key))
1213
+ }
1214
+ })
1208
1215
  )
1209
1216
 
1210
1217
  /**
@@ -1237,7 +1244,7 @@ export const modifyAt: {
1237
1244
  * @since 2.0.0
1238
1245
  * @category combinators
1239
1246
  */
1240
- export const keys = <K, V>(self: TxHashMap<K, V>): Effect.Effect<Array<K>> =>
1247
+ export const keys = <K, V>(self: TxHashMap<K, V>): Effect.Effect<Array<K>, never, Effect.Transaction> =>
1241
1248
  Effect.gen(function*() {
1242
1249
  const map = yield* TxRef.get(self.ref)
1243
1250
  return Array.from(HashMap.keys(map))
@@ -1274,7 +1281,7 @@ export const keys = <K, V>(self: TxHashMap<K, V>): Effect.Effect<Array<K>> =>
1274
1281
  * @since 2.0.0
1275
1282
  * @category combinators
1276
1283
  */
1277
- export const values = <K, V>(self: TxHashMap<K, V>): Effect.Effect<Array<V>> =>
1284
+ export const values = <K, V>(self: TxHashMap<K, V>): Effect.Effect<Array<V>, never, Effect.Transaction> =>
1278
1285
  Effect.gen(function*() {
1279
1286
  const map = yield* TxRef.get(self.ref)
1280
1287
  return HashMap.toValues(map)
@@ -1311,7 +1318,9 @@ export const values = <K, V>(self: TxHashMap<K, V>): Effect.Effect<Array<V>> =>
1311
1318
  * @since 2.0.0
1312
1319
  * @category combinators
1313
1320
  */
1314
- export const entries = <K, V>(self: TxHashMap<K, V>): Effect.Effect<Array<readonly [K, V]>> =>
1321
+ export const entries = <K, V>(
1322
+ self: TxHashMap<K, V>
1323
+ ): Effect.Effect<Array<readonly [K, V]>, never, Effect.Transaction> =>
1315
1324
  Effect.gen(function*() {
1316
1325
  const map = yield* TxRef.get(self.ref)
1317
1326
  return HashMap.toEntries(map)
@@ -1351,7 +1360,9 @@ export const entries = <K, V>(self: TxHashMap<K, V>): Effect.Effect<Array<readon
1351
1360
  * @since 2.0.0
1352
1361
  * @category combinators
1353
1362
  */
1354
- export const snapshot = <K, V>(self: TxHashMap<K, V>): Effect.Effect<HashMap.HashMap<K, V>> => TxRef.get(self.ref)
1363
+ export const snapshot = <K, V>(
1364
+ self: TxHashMap<K, V>
1365
+ ): Effect.Effect<HashMap.HashMap<K, V>, never, Effect.Transaction> => TxRef.get(self.ref)
1355
1366
 
1356
1367
  /**
1357
1368
  * Merges another HashMap into this TxHashMap. If both maps contain the same key,
@@ -1448,7 +1459,7 @@ export const union: {
1448
1459
  * @since 2.0.0
1449
1460
  * @category combinators
1450
1461
  */
1451
- <K1 extends K, K, V1 extends V, V>(other: HashMap.HashMap<K1, V1>): (self: TxHashMap<K, V>) => Effect.Effect<void>
1462
+ <K1 extends K, K, V1 extends V, V>(other: HashMap.HashMap<K1, V1>): (self: TxHashMap<K, V>) => Effect.Effect<void, never, Effect.Transaction>
1452
1463
  /**
1453
1464
  * Merges another HashMap into this TxHashMap. If both maps contain the same key,
1454
1465
  * the value from the other map will be used.
@@ -1496,11 +1507,13 @@ export const union: {
1496
1507
  * @since 2.0.0
1497
1508
  * @category combinators
1498
1509
  */
1499
- <K1 extends K, K, V1 extends V, V>(self: TxHashMap<K, V>, other: HashMap.HashMap<K1, V1>): Effect.Effect<void>
1510
+ <K1 extends K, K, V1 extends V, V>(self: TxHashMap<K, V>, other: HashMap.HashMap<K1, V1>): Effect.Effect<void, never, Effect.Transaction>
1500
1511
  } = dual(
1501
1512
  2,
1502
- <K1 extends K, K, V1 extends V, V>(self: TxHashMap<K, V>, other: HashMap.HashMap<K1, V1>): Effect.Effect<void> =>
1503
- TxRef.update(self.ref, (map) => HashMap.union(map, other))
1513
+ <K1 extends K, K, V1 extends V, V>(
1514
+ self: TxHashMap<K, V>,
1515
+ other: HashMap.HashMap<K1, V1>
1516
+ ): Effect.Effect<void, never, Effect.Transaction> => TxRef.update(self.ref, (map) => HashMap.union(map, other))
1504
1517
  )
1505
1518
 
1506
1519
  /**
@@ -1588,7 +1601,7 @@ export const removeMany: {
1588
1601
  * @since 2.0.0
1589
1602
  * @category combinators
1590
1603
  */
1591
- <K1 extends K, K>(keys: Iterable<K1>): <V>(self: TxHashMap<K, V>) => Effect.Effect<void>
1604
+ <K1 extends K, K>(keys: Iterable<K1>): <V>(self: TxHashMap<K, V>) => Effect.Effect<void, never, Effect.Transaction>
1592
1605
  /**
1593
1606
  * Removes multiple keys from the TxHashMap.
1594
1607
  *
@@ -1631,10 +1644,10 @@ export const removeMany: {
1631
1644
  * @since 2.0.0
1632
1645
  * @category combinators
1633
1646
  */
1634
- <K1 extends K, K, V>(self: TxHashMap<K, V>, keys: Iterable<K1>): Effect.Effect<void>
1647
+ <K1 extends K, K, V>(self: TxHashMap<K, V>, keys: Iterable<K1>): Effect.Effect<void, never, Effect.Transaction>
1635
1648
  } = dual(
1636
1649
  2,
1637
- <K1 extends K, K, V>(self: TxHashMap<K, V>, keys: Iterable<K1>): Effect.Effect<void> =>
1650
+ <K1 extends K, K, V>(self: TxHashMap<K, V>, keys: Iterable<K1>): Effect.Effect<void, never, Effect.Transaction> =>
1638
1651
  TxRef.update(self.ref, (map) => HashMap.removeMany(map, keys))
1639
1652
  )
1640
1653
 
@@ -1753,7 +1766,7 @@ export const setMany: {
1753
1766
  * @since 2.0.0
1754
1767
  * @category combinators
1755
1768
  */
1756
- <K1 extends K, K, V1 extends V, V>(entries: Iterable<readonly [K1, V1]>): (self: TxHashMap<K, V>) => Effect.Effect<void>
1769
+ <K1 extends K, K, V1 extends V, V>(entries: Iterable<readonly [K1, V1]>): (self: TxHashMap<K, V>) => Effect.Effect<void, never, Effect.Transaction>
1757
1770
  /**
1758
1771
  * Sets multiple key-value pairs in the TxHashMap.
1759
1772
  *
@@ -1811,13 +1824,13 @@ export const setMany: {
1811
1824
  * @since 2.0.0
1812
1825
  * @category combinators
1813
1826
  */
1814
- <K1 extends K, K, V1 extends V, V>(self: TxHashMap<K, V>, entries: Iterable<readonly [K1, V1]>): Effect.Effect<void>
1827
+ <K1 extends K, K, V1 extends V, V>(self: TxHashMap<K, V>, entries: Iterable<readonly [K1, V1]>): Effect.Effect<void, never, Effect.Transaction>
1815
1828
  } = dual(
1816
1829
  2,
1817
1830
  <K1 extends K, K, V1 extends V, V>(
1818
1831
  self: TxHashMap<K, V>,
1819
1832
  entries: Iterable<readonly [K1, V1]>
1820
- ): Effect.Effect<void> => TxRef.update(self.ref, (map) => HashMap.setMany(map, entries))
1833
+ ): Effect.Effect<void, never, Effect.Transaction> => TxRef.update(self.ref, (map) => HashMap.setMany(map, entries))
1821
1834
  )
1822
1835
 
1823
1836
  /**
@@ -1926,7 +1939,7 @@ export const getHash: {
1926
1939
  * @since 2.0.0
1927
1940
  * @category combinators
1928
1941
  */
1929
- <K1 extends K, K>(key: K1, hash: number): <V>(self: TxHashMap<K, V>) => Effect.Effect<Option.Option<V>>
1942
+ <K1 extends K, K>(key: K1, hash: number): <V>(self: TxHashMap<K, V>) => Effect.Effect<Option.Option<V>, never, Effect.Transaction>
1930
1943
  /**
1931
1944
  * Lookup the value for the specified key in the TxHashMap using a custom hash.
1932
1945
  * This can provide performance benefits when the hash is precomputed.
@@ -1963,10 +1976,14 @@ export const getHash: {
1963
1976
  * @since 2.0.0
1964
1977
  * @category combinators
1965
1978
  */
1966
- <K1 extends K, K, V>(self: TxHashMap<K, V>, key: K1, hash: number): Effect.Effect<Option.Option<V>>
1979
+ <K1 extends K, K, V>(self: TxHashMap<K, V>, key: K1, hash: number): Effect.Effect<Option.Option<V>, never, Effect.Transaction>
1967
1980
  } = dual(
1968
1981
  3,
1969
- <K1 extends K, K, V>(self: TxHashMap<K, V>, key: K1, hash: number): Effect.Effect<Option.Option<V>> =>
1982
+ <K1 extends K, K, V>(
1983
+ self: TxHashMap<K, V>,
1984
+ key: K1,
1985
+ hash: number
1986
+ ): Effect.Effect<Option.Option<V>, never, Effect.Transaction> =>
1970
1987
  TxRef.get(self.ref).pipe(Effect.map((map) => HashMap.getHash(map, key, hash)))
1971
1988
  )
1972
1989
 
@@ -2061,7 +2078,7 @@ export const hasHash: {
2061
2078
  * @since 2.0.0
2062
2079
  * @category combinators
2063
2080
  */
2064
- <K1 extends K, K>(key: K1, hash: number): <V>(self: TxHashMap<K, V>) => Effect.Effect<boolean>
2081
+ <K1 extends K, K>(key: K1, hash: number): <V>(self: TxHashMap<K, V>) => Effect.Effect<boolean, never, Effect.Transaction>
2065
2082
  /**
2066
2083
  * Checks if the specified key has an entry in the TxHashMap using a custom hash.
2067
2084
  * This can provide performance benefits when the hash is precomputed.
@@ -2107,10 +2124,14 @@ export const hasHash: {
2107
2124
  * @since 2.0.0
2108
2125
  * @category combinators
2109
2126
  */
2110
- <K1 extends K, K, V>(self: TxHashMap<K, V>, key: K1, hash: number): Effect.Effect<boolean>
2127
+ <K1 extends K, K, V>(self: TxHashMap<K, V>, key: K1, hash: number): Effect.Effect<boolean, never, Effect.Transaction>
2111
2128
  } = dual(
2112
2129
  3,
2113
- <K1 extends K, K, V>(self: TxHashMap<K, V>, key: K1, hash: number): Effect.Effect<boolean> =>
2130
+ <K1 extends K, K, V>(
2131
+ self: TxHashMap<K, V>,
2132
+ key: K1,
2133
+ hash: number
2134
+ ): Effect.Effect<boolean, never, Effect.Transaction> =>
2114
2135
  TxRef.get(self.ref).pipe(Effect.map((map) => HashMap.hasHash(map, key, hash)))
2115
2136
  )
2116
2137
 
@@ -2205,7 +2226,7 @@ export const map: {
2205
2226
  * @since 2.0.0
2206
2227
  * @category combinators
2207
2228
  */
2208
- <A, V, K>(f: (value: V, key: K) => A): (self: TxHashMap<K, V>) => Effect.Effect<TxHashMap<K, A>>
2229
+ <A, V, K>(f: (value: V, key: K) => A): (self: TxHashMap<K, V>) => Effect.Effect<TxHashMap<K, A>, never, Effect.Transaction>
2209
2230
  /**
2210
2231
  * Transforms all values in the TxHashMap using the provided function, preserving keys.
2211
2232
  *
@@ -2251,17 +2272,18 @@ export const map: {
2251
2272
  * @since 2.0.0
2252
2273
  * @category combinators
2253
2274
  */
2254
- <K, V, A>(self: TxHashMap<K, V>, f: (value: V, key: K) => A): Effect.Effect<TxHashMap<K, A>>
2275
+ <K, V, A>(self: TxHashMap<K, V>, f: (value: V, key: K) => A): Effect.Effect<TxHashMap<K, A>, never, Effect.Transaction>
2255
2276
  } = dual(
2256
2277
  2,
2257
- <K, V, A>(self: TxHashMap<K, V>, f: (value: V, key: K) => A): Effect.Effect<TxHashMap<K, A>> =>
2258
- Effect.atomic(
2259
- Effect.gen(function*() {
2260
- const currentMap = yield* TxRef.get(self.ref)
2261
- const mappedMap = HashMap.map(currentMap, f)
2262
- return yield* fromHashMap(mappedMap)
2263
- })
2264
- )
2278
+ <K, V, A>(
2279
+ self: TxHashMap<K, V>,
2280
+ f: (value: V, key: K) => A
2281
+ ): Effect.Effect<TxHashMap<K, A>, never, Effect.Transaction> =>
2282
+ Effect.gen(function*() {
2283
+ const currentMap = yield* TxRef.get(self.ref)
2284
+ const mappedMap = HashMap.map(currentMap, f)
2285
+ return yield* fromHashMap(mappedMap)
2286
+ })
2265
2287
  )
2266
2288
 
2267
2289
  /**
@@ -2361,7 +2383,7 @@ export const filter: {
2361
2383
  * @since 2.0.0
2362
2384
  * @category combinators
2363
2385
  */
2364
- <K, V, B extends V>(predicate: (value: V, key: K) => value is B): (self: TxHashMap<K, V>) => Effect.Effect<TxHashMap<K, B>>
2386
+ <K, V, B extends V>(predicate: (value: V, key: K) => value is B): (self: TxHashMap<K, V>) => Effect.Effect<TxHashMap<K, B>, never, Effect.Transaction>
2365
2387
  /**
2366
2388
  * Filters the TxHashMap to keep only entries that satisfy the provided predicate.
2367
2389
  *
@@ -2410,7 +2432,7 @@ export const filter: {
2410
2432
  * @since 2.0.0
2411
2433
  * @category combinators
2412
2434
  */
2413
- <K, V>(predicate: (value: V, key: K) => boolean): (self: TxHashMap<K, V>) => Effect.Effect<TxHashMap<K, V>>
2435
+ <K, V>(predicate: (value: V, key: K) => boolean): (self: TxHashMap<K, V>) => Effect.Effect<TxHashMap<K, V>, never, Effect.Transaction>
2414
2436
  /**
2415
2437
  * Filters the TxHashMap to keep only entries that satisfy the provided predicate.
2416
2438
  *
@@ -2459,7 +2481,7 @@ export const filter: {
2459
2481
  * @since 2.0.0
2460
2482
  * @category combinators
2461
2483
  */
2462
- <K, V, B extends V>(self: TxHashMap<K, V>, predicate: (value: V, key: K) => value is B): Effect.Effect<TxHashMap<K, B>>
2484
+ <K, V, B extends V>(self: TxHashMap<K, V>, predicate: (value: V, key: K) => value is B): Effect.Effect<TxHashMap<K, B>, never, Effect.Transaction>
2463
2485
  /**
2464
2486
  * Filters the TxHashMap to keep only entries that satisfy the provided predicate.
2465
2487
  *
@@ -2508,17 +2530,18 @@ export const filter: {
2508
2530
  * @since 2.0.0
2509
2531
  * @category combinators
2510
2532
  */
2511
- <K, V>(self: TxHashMap<K, V>, predicate: (value: V, key: K) => boolean): Effect.Effect<TxHashMap<K, V>>
2533
+ <K, V>(self: TxHashMap<K, V>, predicate: (value: V, key: K) => boolean): Effect.Effect<TxHashMap<K, V>, never, Effect.Transaction>
2512
2534
  } = dual(
2513
2535
  2,
2514
- <K, V>(self: TxHashMap<K, V>, predicate: (value: V, key: K) => boolean): Effect.Effect<TxHashMap<K, V>> =>
2515
- Effect.atomic(
2516
- Effect.gen(function*() {
2517
- const currentMap = yield* TxRef.get(self.ref)
2518
- const filteredMap = HashMap.filter(currentMap, predicate)
2519
- return yield* fromHashMap(filteredMap)
2520
- })
2521
- )
2536
+ <K, V>(
2537
+ self: TxHashMap<K, V>,
2538
+ predicate: (value: V, key: K) => boolean
2539
+ ): Effect.Effect<TxHashMap<K, V>, never, Effect.Transaction> =>
2540
+ Effect.gen(function*() {
2541
+ const currentMap = yield* TxRef.get(self.ref)
2542
+ const filteredMap = HashMap.filter(currentMap, predicate)
2543
+ return yield* fromHashMap(filteredMap)
2544
+ })
2522
2545
  )
2523
2546
 
2524
2547
  /**
@@ -2630,7 +2653,7 @@ export const reduce: {
2630
2653
  * @since 2.0.0
2631
2654
  * @category combinators
2632
2655
  */
2633
- <A, V, K>(zero: A, f: (accumulator: A, value: V, key: K) => A): (self: TxHashMap<K, V>) => Effect.Effect<A>
2656
+ <A, V, K>(zero: A, f: (accumulator: A, value: V, key: K) => A): (self: TxHashMap<K, V>) => Effect.Effect<A, never, Effect.Transaction>
2634
2657
  /**
2635
2658
  * Reduces the TxHashMap entries to a single value by applying a reducer function.
2636
2659
  * Iterates over all key-value pairs and accumulates them into a final result.
@@ -2685,10 +2708,14 @@ export const reduce: {
2685
2708
  * @since 2.0.0
2686
2709
  * @category combinators
2687
2710
  */
2688
- <K, V, A>(self: TxHashMap<K, V>, zero: A, f: (accumulator: A, value: V, key: K) => A): Effect.Effect<A>
2711
+ <K, V, A>(self: TxHashMap<K, V>, zero: A, f: (accumulator: A, value: V, key: K) => A): Effect.Effect<A, never, Effect.Transaction>
2689
2712
  } = dual(
2690
2713
  3,
2691
- <K, V, A>(self: TxHashMap<K, V>, zero: A, f: (accumulator: A, value: V, key: K) => A): Effect.Effect<A> =>
2714
+ <K, V, A>(
2715
+ self: TxHashMap<K, V>,
2716
+ zero: A,
2717
+ f: (accumulator: A, value: V, key: K) => A
2718
+ ): Effect.Effect<A, never, Effect.Transaction> =>
2692
2719
  TxRef.get(self.ref).pipe(Effect.map((map) => HashMap.reduce(map, zero, f)))
2693
2720
  )
2694
2721
 
@@ -2807,7 +2834,7 @@ export const filterMap: {
2807
2834
  * @since 2.0.0
2808
2835
  * @category combinators
2809
2836
  */
2810
- <A, V, K>(f: (value: V, key: K) => Option.Option<A>): (self: TxHashMap<K, V>) => Effect.Effect<TxHashMap<K, A>>
2837
+ <A, V, K>(f: (value: V, key: K) => Option.Option<A>): (self: TxHashMap<K, V>) => Effect.Effect<TxHashMap<K, A>, never, Effect.Transaction>
2811
2838
  /**
2812
2839
  * Combines filtering and mapping in a single operation. Applies a function that returns
2813
2840
  * an Option to each entry, keeping only the Some values and transforming them.
@@ -2865,17 +2892,18 @@ export const filterMap: {
2865
2892
  * @since 2.0.0
2866
2893
  * @category combinators
2867
2894
  */
2868
- <K, V, A>(self: TxHashMap<K, V>, f: (value: V, key: K) => Option.Option<A>): Effect.Effect<TxHashMap<K, A>>
2895
+ <K, V, A>(self: TxHashMap<K, V>, f: (value: V, key: K) => Option.Option<A>): Effect.Effect<TxHashMap<K, A>, never, Effect.Transaction>
2869
2896
  } = dual(
2870
2897
  2,
2871
- <K, V, A>(self: TxHashMap<K, V>, f: (value: V, key: K) => Option.Option<A>): Effect.Effect<TxHashMap<K, A>> =>
2872
- Effect.atomic(
2873
- Effect.gen(function*() {
2874
- const currentMap = yield* TxRef.get(self.ref)
2875
- const filteredMap = HashMap.filterMap(currentMap, f)
2876
- return yield* fromHashMap(filteredMap)
2877
- })
2878
- )
2898
+ <K, V, A>(
2899
+ self: TxHashMap<K, V>,
2900
+ f: (value: V, key: K) => Option.Option<A>
2901
+ ): Effect.Effect<TxHashMap<K, A>, never, Effect.Transaction> =>
2902
+ Effect.gen(function*() {
2903
+ const currentMap = yield* TxRef.get(self.ref)
2904
+ const filteredMap = HashMap.filterMap(currentMap, f)
2905
+ return yield* fromHashMap(filteredMap)
2906
+ })
2879
2907
  )
2880
2908
 
2881
2909
  /**
@@ -2959,7 +2987,7 @@ export const hasBy: {
2959
2987
  * @since 2.0.0
2960
2988
  * @category combinators
2961
2989
  */
2962
- <K, V>(predicate: (value: V, key: K) => boolean): (self: TxHashMap<K, V>) => Effect.Effect<boolean>
2990
+ <K, V>(predicate: (value: V, key: K) => boolean): (self: TxHashMap<K, V>) => Effect.Effect<boolean, never, Effect.Transaction>
2963
2991
  /**
2964
2992
  * Checks if any entry in the TxHashMap matches the given predicate.
2965
2993
  *
@@ -3000,10 +3028,13 @@ export const hasBy: {
3000
3028
  * @since 2.0.0
3001
3029
  * @category combinators
3002
3030
  */
3003
- <K, V>(self: TxHashMap<K, V>, predicate: (value: V, key: K) => boolean): Effect.Effect<boolean>
3031
+ <K, V>(self: TxHashMap<K, V>, predicate: (value: V, key: K) => boolean): Effect.Effect<boolean, never, Effect.Transaction>
3004
3032
  } = dual(
3005
3033
  2,
3006
- <K, V>(self: TxHashMap<K, V>, predicate: (value: V, key: K) => boolean): Effect.Effect<boolean> =>
3034
+ <K, V>(
3035
+ self: TxHashMap<K, V>,
3036
+ predicate: (value: V, key: K) => boolean
3037
+ ): Effect.Effect<boolean, never, Effect.Transaction> =>
3007
3038
  TxRef.get(self.ref).pipe(Effect.map((map) => HashMap.hasBy(map, predicate)))
3008
3039
  )
3009
3040
 
@@ -3092,7 +3123,7 @@ export const findFirst: {
3092
3123
  * @since 2.0.0
3093
3124
  * @category combinators
3094
3125
  */
3095
- <K, V>(predicate: (value: V, key: K) => boolean): (self: TxHashMap<K, V>) => Effect.Effect<[K, V] | undefined>
3126
+ <K, V>(predicate: (value: V, key: K) => boolean): (self: TxHashMap<K, V>) => Effect.Effect<[K, V] | undefined, never, Effect.Transaction>
3096
3127
  /**
3097
3128
  * Finds the first entry in the TxHashMap that matches the given predicate.
3098
3129
  * Returns the key-value pair as a tuple wrapped in an Option.
@@ -3135,10 +3166,13 @@ export const findFirst: {
3135
3166
  * @since 2.0.0
3136
3167
  * @category combinators
3137
3168
  */
3138
- <K, V>(self: TxHashMap<K, V>, predicate: (value: V, key: K) => boolean): Effect.Effect<[K, V] | undefined>
3169
+ <K, V>(self: TxHashMap<K, V>, predicate: (value: V, key: K) => boolean): Effect.Effect<[K, V] | undefined, never, Effect.Transaction>
3139
3170
  } = dual(
3140
3171
  2,
3141
- <K, V>(self: TxHashMap<K, V>, predicate: (value: V, key: K) => boolean): Effect.Effect<[K, V] | undefined> =>
3172
+ <K, V>(
3173
+ self: TxHashMap<K, V>,
3174
+ predicate: (value: V, key: K) => boolean
3175
+ ): Effect.Effect<[K, V] | undefined, never, Effect.Transaction> =>
3142
3176
  TxRef.get(self.ref).pipe(Effect.map((map) => HashMap.findFirst(map, predicate)))
3143
3177
  )
3144
3178
 
@@ -3223,7 +3257,7 @@ export const some: {
3223
3257
  * @since 2.0.0
3224
3258
  * @category combinators
3225
3259
  */
3226
- <K, V>(predicate: (value: V, key: K) => boolean): (self: TxHashMap<K, V>) => Effect.Effect<boolean>
3260
+ <K, V>(predicate: (value: V, key: K) => boolean): (self: TxHashMap<K, V>) => Effect.Effect<boolean, never, Effect.Transaction>
3227
3261
  /**
3228
3262
  * Checks if at least one entry in the TxHashMap satisfies the given predicate.
3229
3263
  *
@@ -3264,10 +3298,13 @@ export const some: {
3264
3298
  * @since 2.0.0
3265
3299
  * @category combinators
3266
3300
  */
3267
- <K, V>(self: TxHashMap<K, V>, predicate: (value: V, key: K) => boolean): Effect.Effect<boolean>
3301
+ <K, V>(self: TxHashMap<K, V>, predicate: (value: V, key: K) => boolean): Effect.Effect<boolean, never, Effect.Transaction>
3268
3302
  } = dual(
3269
3303
  2,
3270
- <K, V>(self: TxHashMap<K, V>, predicate: (value: V, key: K) => boolean): Effect.Effect<boolean> =>
3304
+ <K, V>(
3305
+ self: TxHashMap<K, V>,
3306
+ predicate: (value: V, key: K) => boolean
3307
+ ): Effect.Effect<boolean, never, Effect.Transaction> =>
3271
3308
  TxRef.get(self.ref).pipe(Effect.map((map) => HashMap.some(map, predicate)))
3272
3309
  )
3273
3310
 
@@ -3352,7 +3389,7 @@ export const every: {
3352
3389
  * @since 2.0.0
3353
3390
  * @category combinators
3354
3391
  */
3355
- <K, V>(predicate: (value: V, key: K) => boolean): (self: TxHashMap<K, V>) => Effect.Effect<boolean>
3392
+ <K, V>(predicate: (value: V, key: K) => boolean): (self: TxHashMap<K, V>) => Effect.Effect<boolean, never, Effect.Transaction>
3356
3393
  /**
3357
3394
  * Checks if all entries in the TxHashMap satisfy the given predicate.
3358
3395
  *
@@ -3393,10 +3430,13 @@ export const every: {
3393
3430
  * @since 2.0.0
3394
3431
  * @category combinators
3395
3432
  */
3396
- <K, V>(self: TxHashMap<K, V>, predicate: (value: V, key: K) => boolean): Effect.Effect<boolean>
3433
+ <K, V>(self: TxHashMap<K, V>, predicate: (value: V, key: K) => boolean): Effect.Effect<boolean, never, Effect.Transaction>
3397
3434
  } = dual(
3398
3435
  2,
3399
- <K, V>(self: TxHashMap<K, V>, predicate: (value: V, key: K) => boolean): Effect.Effect<boolean> =>
3436
+ <K, V>(
3437
+ self: TxHashMap<K, V>,
3438
+ predicate: (value: V, key: K) => boolean
3439
+ ): Effect.Effect<boolean, never, Effect.Transaction> =>
3400
3440
  TxRef.get(self.ref).pipe(Effect.map((map) => HashMap.every(map, predicate)))
3401
3441
  )
3402
3442
 
@@ -3483,7 +3523,7 @@ export const forEach: {
3483
3523
  * @since 2.0.0
3484
3524
  * @category combinators
3485
3525
  */
3486
- <V, K, R, E>(f: (value: V, key: K) => Effect.Effect<void, E, R>): (self: TxHashMap<K, V>) => Effect.Effect<void, E, R>
3526
+ <V, K, R, E>(f: (value: V, key: K) => Effect.Effect<void, E, R>): (self: TxHashMap<K, V>) => Effect.Effect<void, E, R | Effect.Transaction>
3487
3527
  /**
3488
3528
  * Executes a side-effect function for each entry in the TxHashMap.
3489
3529
  * The function receives the value and key as parameters and can perform effects.
@@ -3525,10 +3565,13 @@ export const forEach: {
3525
3565
  * @since 2.0.0
3526
3566
  * @category combinators
3527
3567
  */
3528
- <K, V, R, E>(self: TxHashMap<K, V>, f: (value: V, key: K) => Effect.Effect<void, E, R>): Effect.Effect<void, E, R>
3568
+ <K, V, R, E>(self: TxHashMap<K, V>, f: (value: V, key: K) => Effect.Effect<void, E, R>): Effect.Effect<void, E, R | Effect.Transaction>
3529
3569
  } = dual(
3530
3570
  2,
3531
- <K, V, R, E>(self: TxHashMap<K, V>, f: (value: V, key: K) => Effect.Effect<void, E, R>): Effect.Effect<void, E, R> =>
3571
+ <K, V, R, E>(
3572
+ self: TxHashMap<K, V>,
3573
+ f: (value: V, key: K) => Effect.Effect<void, E, R>
3574
+ ): Effect.Effect<void, E, R | Effect.Transaction> =>
3532
3575
  Effect.gen(function*() {
3533
3576
  const currentMap = yield* TxRef.get(self.ref)
3534
3577
  const entries = HashMap.toEntries(currentMap)
@@ -3639,7 +3682,9 @@ export const flatMap: {
3639
3682
  * @since 2.0.0
3640
3683
  * @category combinators
3641
3684
  */
3642
- <A, V, K>(f: (value: V, key: K) => Effect.Effect<TxHashMap<K, A>>): (self: TxHashMap<K, V>) => Effect.Effect<TxHashMap<K, A>>
3685
+ <A, V, K>(
3686
+ f: (value: V, key: K) => Effect.Effect<TxHashMap<K, A>, never, Effect.Transaction>
3687
+ ): (self: TxHashMap<K, V>) => Effect.Effect<TxHashMap<K, A>, never, Effect.Transaction>
3643
3688
  /**
3644
3689
  * Transforms the TxHashMap by applying a function that returns a TxHashMap to each entry,
3645
3690
  * then flattening the results. Useful for complex transformations that require creating new maps.
@@ -3693,131 +3738,129 @@ export const flatMap: {
3693
3738
  */
3694
3739
  <K, V, A>(
3695
3740
  self: TxHashMap<K, V>,
3696
- f: (value: V, key: K) => Effect.Effect<TxHashMap<K, A>>
3697
- ): Effect.Effect<TxHashMap<K, A>>
3741
+ f: (value: V, key: K) => Effect.Effect<TxHashMap<K, A>, never, Effect.Transaction>
3742
+ ): Effect.Effect<TxHashMap<K, A>, never, Effect.Transaction>
3698
3743
  } = dual(
3699
3744
  2,
3700
3745
  <K, V, A>(
3701
3746
  self: TxHashMap<K, V>,
3702
- f: (value: V, key: K) => Effect.Effect<TxHashMap<K, A>>
3703
- ): Effect.Effect<TxHashMap<K, A>> =>
3704
- Effect.atomic(
3705
- Effect.gen(function*() {
3706
- const currentMap = yield* TxRef.get(self.ref)
3707
- const result = yield* empty</**
3708
- * Transforms the TxHashMap by applying a function that returns a TxHashMap to each entry,
3709
- * then flattening the results. Useful for complex transformations that require creating new maps.
3710
- *
3711
- * **Return behavior**: This function returns a new TxHashMap reference with the
3712
- * flattened results. The original TxHashMap is not modified.
3713
- *
3714
- * @example
3715
- * ```ts
3716
- * import { Effect, TxHashMap } from "effect"
3717
- *
3718
- * const program = Effect.gen(function*() {
3719
- * // Create a department-employee map
3720
- * const departments = yield* TxHashMap.make(
3721
- * ["engineering", ["alice", "bob"]],
3722
- * ["marketing", ["charlie", "diana"]]
3723
- * )
3724
- *
3725
- * // Expand each department into individual employee entries with metadata
3726
- * const employeeDetails = yield* TxHashMap.flatMap(
3727
- * departments,
3728
- * (employees, department) =>
3729
- * Effect.gen(function*() {
3730
- * const employeeMap = yield* TxHashMap.empty<
3731
- * string,
3732
- * { department: string; role: string }
3733
- * >()
3734
- * for (let i = 0; i < employees.length; i++) {
3735
- * const employee = employees[i]
3736
- * const role = i === 0 ? "lead" : "member"
3737
- * yield* TxHashMap.set(employeeMap, employee, { department, role })
3738
- * }
3739
- * return employeeMap
3740
- * })
3741
- * )
3742
- *
3743
- * // Check the flattened result
3744
- * const alice = yield* TxHashMap.get(employeeDetails, "alice")
3745
- * console.log(alice) // Option.some({ department: "engineering", role: "lead" })
3746
- *
3747
- * const charlie = yield* TxHashMap.get(employeeDetails, "charlie")
3748
- * console.log(charlie) // Option.some({ department: "marketing", role: "lead" })
3749
- *
3750
- * const size = yield* TxHashMap.size(employeeDetails)
3751
- * console.log(size) // 4 (all employees)
3752
- * })
3753
- * ```
3754
- *
3755
- * @since 2.0.0
3756
- * @category combinators
3757
- */
3758
- K, /**
3759
- * Transforms the TxHashMap by applying a function that returns a TxHashMap to each entry,
3760
- * then flattening the results. Useful for complex transformations that require creating new maps.
3761
- *
3762
- * **Return behavior**: This function returns a new TxHashMap reference with the
3763
- * flattened results. The original TxHashMap is not modified.
3764
- *
3765
- * @example
3766
- * ```ts
3767
- * import { Effect, TxHashMap } from "effect"
3768
- *
3769
- * const program = Effect.gen(function*() {
3770
- * // Create a department-employee map
3771
- * const departments = yield* TxHashMap.make(
3772
- * ["engineering", ["alice", "bob"]],
3773
- * ["marketing", ["charlie", "diana"]]
3774
- * )
3775
- *
3776
- * // Expand each department into individual employee entries with metadata
3777
- * const employeeDetails = yield* TxHashMap.flatMap(
3778
- * departments,
3779
- * (employees, department) =>
3780
- * Effect.gen(function*() {
3781
- * const employeeMap = yield* TxHashMap.empty<
3782
- * string,
3783
- * { department: string; role: string }
3784
- * >()
3785
- * for (let i = 0; i < employees.length; i++) {
3786
- * const employee = employees[i]
3787
- * const role = i === 0 ? "lead" : "member"
3788
- * yield* TxHashMap.set(employeeMap, employee, { department, role })
3789
- * }
3790
- * return employeeMap
3791
- * })
3792
- * )
3793
- *
3794
- * // Check the flattened result
3795
- * const alice = yield* TxHashMap.get(employeeDetails, "alice")
3796
- * console.log(alice) // Option.some({ department: "engineering", role: "lead" })
3797
- *
3798
- * const charlie = yield* TxHashMap.get(employeeDetails, "charlie")
3799
- * console.log(charlie) // Option.some({ department: "marketing", role: "lead" })
3800
- *
3801
- * const size = yield* TxHashMap.size(employeeDetails)
3802
- * console.log(size) // 4 (all employees)
3803
- * })
3804
- * ```
3805
- *
3806
- * @since 2.0.0
3807
- * @category combinators
3808
- */
3809
- A>()
3747
+ f: (value: V, key: K) => Effect.Effect<TxHashMap<K, A>, never, Effect.Transaction>
3748
+ ): Effect.Effect<TxHashMap<K, A>, never, Effect.Transaction> =>
3749
+ Effect.gen(function*() {
3750
+ const currentMap = yield* TxRef.get(self.ref)
3751
+ const result = yield* empty</**
3752
+ * Transforms the TxHashMap by applying a function that returns a TxHashMap to each entry,
3753
+ * then flattening the results. Useful for complex transformations that require creating new maps.
3754
+ *
3755
+ * **Return behavior**: This function returns a new TxHashMap reference with the
3756
+ * flattened results. The original TxHashMap is not modified.
3757
+ *
3758
+ * @example
3759
+ * ```ts
3760
+ * import { Effect, TxHashMap } from "effect"
3761
+ *
3762
+ * const program = Effect.gen(function*() {
3763
+ * // Create a department-employee map
3764
+ * const departments = yield* TxHashMap.make(
3765
+ * ["engineering", ["alice", "bob"]],
3766
+ * ["marketing", ["charlie", "diana"]]
3767
+ * )
3768
+ *
3769
+ * // Expand each department into individual employee entries with metadata
3770
+ * const employeeDetails = yield* TxHashMap.flatMap(
3771
+ * departments,
3772
+ * (employees, department) =>
3773
+ * Effect.gen(function*() {
3774
+ * const employeeMap = yield* TxHashMap.empty<
3775
+ * string,
3776
+ * { department: string; role: string }
3777
+ * >()
3778
+ * for (let i = 0; i < employees.length; i++) {
3779
+ * const employee = employees[i]
3780
+ * const role = i === 0 ? "lead" : "member"
3781
+ * yield* TxHashMap.set(employeeMap, employee, { department, role })
3782
+ * }
3783
+ * return employeeMap
3784
+ * })
3785
+ * )
3786
+ *
3787
+ * // Check the flattened result
3788
+ * const alice = yield* TxHashMap.get(employeeDetails, "alice")
3789
+ * console.log(alice) // Option.some({ department: "engineering", role: "lead" })
3790
+ *
3791
+ * const charlie = yield* TxHashMap.get(employeeDetails, "charlie")
3792
+ * console.log(charlie) // Option.some({ department: "marketing", role: "lead" })
3793
+ *
3794
+ * const size = yield* TxHashMap.size(employeeDetails)
3795
+ * console.log(size) // 4 (all employees)
3796
+ * })
3797
+ * ```
3798
+ *
3799
+ * @since 2.0.0
3800
+ * @category combinators
3801
+ */
3802
+ K, /**
3803
+ * Transforms the TxHashMap by applying a function that returns a TxHashMap to each entry,
3804
+ * then flattening the results. Useful for complex transformations that require creating new maps.
3805
+ *
3806
+ * **Return behavior**: This function returns a new TxHashMap reference with the
3807
+ * flattened results. The original TxHashMap is not modified.
3808
+ *
3809
+ * @example
3810
+ * ```ts
3811
+ * import { Effect, TxHashMap } from "effect"
3812
+ *
3813
+ * const program = Effect.gen(function*() {
3814
+ * // Create a department-employee map
3815
+ * const departments = yield* TxHashMap.make(
3816
+ * ["engineering", ["alice", "bob"]],
3817
+ * ["marketing", ["charlie", "diana"]]
3818
+ * )
3819
+ *
3820
+ * // Expand each department into individual employee entries with metadata
3821
+ * const employeeDetails = yield* TxHashMap.flatMap(
3822
+ * departments,
3823
+ * (employees, department) =>
3824
+ * Effect.gen(function*() {
3825
+ * const employeeMap = yield* TxHashMap.empty<
3826
+ * string,
3827
+ * { department: string; role: string }
3828
+ * >()
3829
+ * for (let i = 0; i < employees.length; i++) {
3830
+ * const employee = employees[i]
3831
+ * const role = i === 0 ? "lead" : "member"
3832
+ * yield* TxHashMap.set(employeeMap, employee, { department, role })
3833
+ * }
3834
+ * return employeeMap
3835
+ * })
3836
+ * )
3837
+ *
3838
+ * // Check the flattened result
3839
+ * const alice = yield* TxHashMap.get(employeeDetails, "alice")
3840
+ * console.log(alice) // Option.some({ department: "engineering", role: "lead" })
3841
+ *
3842
+ * const charlie = yield* TxHashMap.get(employeeDetails, "charlie")
3843
+ * console.log(charlie) // Option.some({ department: "marketing", role: "lead" })
3844
+ *
3845
+ * const size = yield* TxHashMap.size(employeeDetails)
3846
+ * console.log(size) // 4 (all employees)
3847
+ * })
3848
+ * ```
3849
+ *
3850
+ * @since 2.0.0
3851
+ * @category combinators
3852
+ */
3853
+ A>()
3810
3854
 
3811
- const mapEntries = HashMap.toEntries(currentMap)
3812
- for (const [key, value] of mapEntries) {
3813
- const newMap = yield* f(value, key)
3814
- const newEntries = yield* entries(newMap)
3815
- yield* setMany(result, newEntries)
3816
- }
3855
+ const mapEntries = HashMap.toEntries(currentMap)
3856
+ for (const [key, value] of mapEntries) {
3857
+ const newMap = yield* f(value, key)
3858
+ const newEntries = yield* entries(newMap)
3859
+ yield* setMany(result, newEntries)
3860
+ }
3817
3861
 
3818
- return result
3819
- })
3820
- )
3862
+ return result
3863
+ })
3821
3864
  )
3822
3865
 
3823
3866
  /**
@@ -3865,14 +3908,14 @@ export const flatMap: {
3865
3908
  * @since 2.0.0
3866
3909
  * @category combinators
3867
3910
  */
3868
- export const compact = <K, A>(self: TxHashMap<K, Option.Option<A>>): Effect.Effect<TxHashMap<K, A>> =>
3869
- Effect.atomic(
3870
- Effect.gen(function*() {
3871
- const currentMap = yield* TxRef.get(self.ref)
3872
- const compactedMap = HashMap.compact(currentMap)
3873
- return yield* fromHashMap(compactedMap)
3874
- })
3875
- )
3911
+ export const compact = <K, A>(
3912
+ self: TxHashMap<K, Option.Option<A>>
3913
+ ): Effect.Effect<TxHashMap<K, A>, never, Effect.Transaction> =>
3914
+ Effect.gen(function*() {
3915
+ const currentMap = yield* TxRef.get(self.ref)
3916
+ const compactedMap = HashMap.compact(currentMap)
3917
+ return yield* fromHashMap(compactedMap)
3918
+ })
3876
3919
 
3877
3920
  /**
3878
3921
  * Returns an array of all key-value pairs in the TxHashMap.
@@ -3908,7 +3951,9 @@ export const compact = <K, A>(self: TxHashMap<K, Option.Option<A>>): Effect.Effe
3908
3951
  * @since 2.0.0
3909
3952
  * @category combinators
3910
3953
  */
3911
- export const toEntries = <K, V>(self: TxHashMap<K, V>): Effect.Effect<Array<readonly [K, V]>> => entries(self)
3954
+ export const toEntries = <K, V>(
3955
+ self: TxHashMap<K, V>
3956
+ ): Effect.Effect<Array<readonly [K, V]>, never, Effect.Transaction> => entries(self)
3912
3957
 
3913
3958
  /**
3914
3959
  * Returns an array of all values in the TxHashMap.
@@ -3946,12 +3991,13 @@ export const toEntries = <K, V>(self: TxHashMap<K, V>): Effect.Effect<Array<read
3946
3991
  * @since 2.0.0
3947
3992
  * @category combinators
3948
3993
  */
3949
- export const toValues = <K, V>(self: TxHashMap<K, V>): Effect.Effect<Array<V>> => values(self)
3994
+ export const toValues = <K, V>(self: TxHashMap<K, V>): Effect.Effect<Array<V>, never, Effect.Transaction> =>
3995
+ values(self)
3950
3996
 
3951
3997
  /**
3952
3998
  * Helper function to create a TxHashMap from an existing HashMap
3953
3999
  */
3954
- const fromHashMap = <K, V>(hashMap: HashMap.HashMap<K, V>): Effect.Effect<TxHashMap<K, V>> =>
4000
+ const fromHashMap = <K, V>(hashMap: HashMap.HashMap<K, V>): Effect.Effect<TxHashMap<K, V>, never, Effect.Transaction> =>
3955
4001
  Effect.gen(function*() {
3956
4002
  const ref = yield* TxRef.make(hashMap)
3957
4003
  return Object.assign(Object.create(TxHashMapProto), { ref })