effect 4.0.0-beta.41 → 4.0.0-beta.43
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.
- package/dist/Effect.d.ts +19 -63
- package/dist/Effect.d.ts.map +1 -1
- package/dist/Effect.js +24 -65
- package/dist/Effect.js.map +1 -1
- package/dist/Layer.d.ts +25 -0
- package/dist/Layer.d.ts.map +1 -1
- package/dist/Layer.js +25 -0
- package/dist/Layer.js.map +1 -1
- package/dist/MutableList.d.ts.map +1 -1
- package/dist/MutableList.js +3 -0
- package/dist/MutableList.js.map +1 -1
- package/dist/Number.d.ts.map +1 -1
- package/dist/Number.js +12 -3
- package/dist/Number.js.map +1 -1
- package/dist/SchemaRepresentation.d.ts.map +1 -1
- package/dist/SchemaRepresentation.js +16 -14
- package/dist/SchemaRepresentation.js.map +1 -1
- package/dist/TxChunk.d.ts +39 -39
- package/dist/TxChunk.d.ts.map +1 -1
- package/dist/TxChunk.js +3 -3
- package/dist/TxChunk.js.map +1 -1
- package/dist/TxDeferred.d.ts +9 -9
- package/dist/TxDeferred.d.ts.map +1 -1
- package/dist/TxDeferred.js +2 -2
- package/dist/TxDeferred.js.map +1 -1
- package/dist/TxHashMap.d.ts +59 -59
- package/dist/TxHashMap.d.ts.map +1 -1
- package/dist/TxHashMap.js +8 -8
- package/dist/TxHashMap.js.map +1 -1
- package/dist/TxHashSet.d.ts +35 -35
- package/dist/TxHashSet.d.ts.map +1 -1
- package/dist/TxHashSet.js +7 -7
- package/dist/TxHashSet.js.map +1 -1
- package/dist/TxPriorityQueue.d.ts +23 -23
- package/dist/TxPriorityQueue.d.ts.map +1 -1
- package/dist/TxPriorityQueue.js +4 -4
- package/dist/TxPriorityQueue.js.map +1 -1
- package/dist/TxPubSub.d.ts +14 -14
- package/dist/TxPubSub.d.ts.map +1 -1
- package/dist/TxPubSub.js +12 -12
- package/dist/TxPubSub.js.map +1 -1
- package/dist/TxQueue.d.ts +33 -33
- package/dist/TxQueue.d.ts.map +1 -1
- package/dist/TxQueue.js +29 -44
- package/dist/TxQueue.js.map +1 -1
- package/dist/TxReentrantLock.d.ts +10 -33
- package/dist/TxReentrantLock.d.ts.map +1 -1
- package/dist/TxReentrantLock.js +14 -37
- package/dist/TxReentrantLock.js.map +1 -1
- package/dist/TxRef.d.ts +36 -42
- package/dist/TxRef.d.ts.map +1 -1
- package/dist/TxRef.js +16 -25
- package/dist/TxRef.js.map +1 -1
- package/dist/TxSemaphore.d.ts +8 -8
- package/dist/TxSemaphore.d.ts.map +1 -1
- package/dist/TxSemaphore.js +10 -10
- package/dist/TxSemaphore.js.map +1 -1
- package/dist/TxSubscriptionRef.d.ts +14 -14
- package/dist/TxSubscriptionRef.d.ts.map +1 -1
- package/dist/TxSubscriptionRef.js +5 -5
- package/dist/TxSubscriptionRef.js.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +3 -3
- package/dist/unstable/ai/AnthropicStructuredOutput.d.ts +1 -1
- package/dist/unstable/ai/AnthropicStructuredOutput.d.ts.map +1 -1
- package/dist/unstable/ai/AnthropicStructuredOutput.js +5 -2
- package/dist/unstable/ai/AnthropicStructuredOutput.js.map +1 -1
- package/dist/unstable/ai/OpenAiStructuredOutput.d.ts +1 -1
- package/dist/unstable/ai/OpenAiStructuredOutput.d.ts.map +1 -1
- package/dist/unstable/ai/OpenAiStructuredOutput.js +5 -1
- package/dist/unstable/ai/OpenAiStructuredOutput.js.map +1 -1
- package/dist/unstable/ai/internal/codec-transformer.js +5 -2
- package/dist/unstable/ai/internal/codec-transformer.js.map +1 -1
- package/dist/unstable/cli/internal/command.d.ts.map +1 -1
- package/dist/unstable/cli/internal/command.js +12 -1
- package/dist/unstable/cli/internal/command.js.map +1 -1
- package/dist/unstable/cluster/ClusterWorkflowEngine.d.ts +1 -0
- package/dist/unstable/cluster/ClusterWorkflowEngine.d.ts.map +1 -1
- package/dist/unstable/cluster/ClusterWorkflowEngine.js +55 -26
- package/dist/unstable/cluster/ClusterWorkflowEngine.js.map +1 -1
- package/dist/unstable/cluster/Entity.d.ts +2 -2
- package/dist/unstable/cluster/Entity.d.ts.map +1 -1
- package/dist/unstable/cluster/Entity.js +13 -8
- package/dist/unstable/cluster/Entity.js.map +1 -1
- package/dist/unstable/cluster/SqlMessageStorage.d.ts.map +1 -1
- package/dist/unstable/cluster/SqlMessageStorage.js +1 -4
- package/dist/unstable/cluster/SqlMessageStorage.js.map +1 -1
- package/dist/unstable/rpc/RpcSerialization.js +5 -5
- package/dist/unstable/rpc/RpcSerialization.js.map +1 -1
- package/dist/unstable/socket/Socket.d.ts +1 -1
- package/dist/unstable/socket/Socket.d.ts.map +1 -1
- package/dist/unstable/socket/Socket.js +1 -1
- package/dist/unstable/socket/Socket.js.map +1 -1
- package/dist/unstable/workflow/WorkflowEngine.d.ts +6 -0
- package/dist/unstable/workflow/WorkflowEngine.d.ts.map +1 -1
- package/dist/unstable/workflow/WorkflowEngine.js +9 -0
- package/dist/unstable/workflow/WorkflowEngine.js.map +1 -1
- package/package.json +1 -1
- package/src/Effect.ts +24 -75
- package/src/Layer.ts +27 -0
- package/src/MutableList.ts +3 -0
- package/src/Number.ts +13 -3
- package/src/SchemaRepresentation.ts +8 -6
- package/src/TxChunk.ts +53 -62
- package/src/TxDeferred.ts +14 -17
- package/src/TxHashMap.ts +91 -101
- package/src/TxHashSet.ts +68 -70
- package/src/TxPriorityQueue.ts +34 -38
- package/src/TxPubSub.ts +30 -32
- package/src/TxQueue.ts +70 -84
- package/src/TxReentrantLock.ts +30 -54
- package/src/TxRef.ts +53 -65
- package/src/TxSemaphore.ts +23 -24
- package/src/TxSubscriptionRef.ts +25 -27
- package/src/index.ts +3 -3
- package/src/unstable/ai/AnthropicStructuredOutput.ts +3 -3
- package/src/unstable/ai/OpenAiStructuredOutput.ts +5 -2
- package/src/unstable/ai/internal/codec-transformer.ts +3 -2
- package/src/unstable/cli/internal/command.ts +16 -1
- package/src/unstable/cluster/ClusterWorkflowEngine.ts +77 -38
- package/src/unstable/cluster/Entity.ts +18 -7
- package/src/unstable/cluster/SqlMessageStorage.ts +0 -4
- package/src/unstable/rpc/RpcSerialization.ts +5 -5
- package/src/unstable/socket/Socket.ts +1 -1
- package/src/unstable/workflow/WorkflowEngine.ts +22 -0
package/src/TxHashMap.ts
CHANGED
|
@@ -55,7 +55,7 @@ const TxHashMapProto = {
|
|
|
55
55
|
* console.log(user) // Option.some("Alice")
|
|
56
56
|
*
|
|
57
57
|
* // Multi-step atomic operations
|
|
58
|
-
* yield* Effect.
|
|
58
|
+
* yield* Effect.tx(
|
|
59
59
|
* Effect.gen(function*() {
|
|
60
60
|
* const currentUser = yield* TxHashMap.get(txMap, "user1")
|
|
61
61
|
* if (currentUser._tag === "Some") {
|
|
@@ -238,7 +238,7 @@ export declare namespace TxHashMap {
|
|
|
238
238
|
* @since 2.0.0
|
|
239
239
|
* @category constructors
|
|
240
240
|
*/
|
|
241
|
-
export const empty = <K, V>(): Effect.Effect<TxHashMap<K, V
|
|
241
|
+
export const empty = <K, V>(): Effect.Effect<TxHashMap<K, V>> =>
|
|
242
242
|
Effect.gen(function*() {
|
|
243
243
|
const ref = yield* TxRef.make(HashMap.empty<K, V>())
|
|
244
244
|
return Object.assign(Object.create(TxHashMapProto), { ref })
|
|
@@ -277,7 +277,7 @@ export const empty = <K, V>(): Effect.Effect<TxHashMap<K, V>, never, Effect.Tran
|
|
|
277
277
|
*/
|
|
278
278
|
export const make = <K, V>(
|
|
279
279
|
...entries: Array<readonly [K, V]>
|
|
280
|
-
): Effect.Effect<TxHashMap<K, V
|
|
280
|
+
): Effect.Effect<TxHashMap<K, V>> =>
|
|
281
281
|
Effect.gen(function*() {
|
|
282
282
|
const hashMap = HashMap.make(...entries)
|
|
283
283
|
const ref = yield* TxRef.make(hashMap)
|
|
@@ -320,7 +320,7 @@ export const make = <K, V>(
|
|
|
320
320
|
*/
|
|
321
321
|
export const fromIterable = <K, V>(
|
|
322
322
|
entries: Iterable<readonly [K, V]>
|
|
323
|
-
): Effect.Effect<TxHashMap<K, V
|
|
323
|
+
): Effect.Effect<TxHashMap<K, V>> =>
|
|
324
324
|
Effect.gen(function*() {
|
|
325
325
|
const hashMap = HashMap.fromIterable(entries)
|
|
326
326
|
const ref = yield* TxRef.make(hashMap)
|
|
@@ -390,7 +390,7 @@ export const get: {
|
|
|
390
390
|
* @since 2.0.0
|
|
391
391
|
* @category combinators
|
|
392
392
|
*/
|
|
393
|
-
<K1 extends K, K>(key: K1): <V>(self: TxHashMap<K, V>) => Effect.Effect<Option.Option<V
|
|
393
|
+
<K1 extends K, K>(key: K1): <V>(self: TxHashMap<K, V>) => Effect.Effect<Option.Option<V>>
|
|
394
394
|
/**
|
|
395
395
|
* Safely lookup the value for the specified key in the TxHashMap.
|
|
396
396
|
*
|
|
@@ -422,10 +422,10 @@ export const get: {
|
|
|
422
422
|
* @since 2.0.0
|
|
423
423
|
* @category combinators
|
|
424
424
|
*/
|
|
425
|
-
<K1 extends K, K, V>(self: TxHashMap<K, V>, key: K1): Effect.Effect<Option.Option<V
|
|
425
|
+
<K1 extends K, K, V>(self: TxHashMap<K, V>, key: K1): Effect.Effect<Option.Option<V>>
|
|
426
426
|
} = dual(
|
|
427
427
|
2,
|
|
428
|
-
<K1 extends K, K, V>(self: TxHashMap<K, V>, key: K1): Effect.Effect<Option.Option<V
|
|
428
|
+
<K1 extends K, K, V>(self: TxHashMap<K, V>, key: K1): Effect.Effect<Option.Option<V>> =>
|
|
429
429
|
Effect.gen(function*() {
|
|
430
430
|
const map = yield* TxRef.get(self.ref)
|
|
431
431
|
return HashMap.get(map, key)
|
|
@@ -501,7 +501,7 @@ export const set: {
|
|
|
501
501
|
* @since 2.0.0
|
|
502
502
|
* @category combinators
|
|
503
503
|
*/
|
|
504
|
-
<K, V>(key: K, value: V): (self: TxHashMap<K, V>) => Effect.Effect<void
|
|
504
|
+
<K, V>(key: K, value: V): (self: TxHashMap<K, V>) => Effect.Effect<void>
|
|
505
505
|
/**
|
|
506
506
|
* Sets the value for the specified key in the TxHashMap.
|
|
507
507
|
*
|
|
@@ -536,10 +536,10 @@ export const set: {
|
|
|
536
536
|
* @since 2.0.0
|
|
537
537
|
* @category combinators
|
|
538
538
|
*/
|
|
539
|
-
<K, V>(self: TxHashMap<K, V>, key: K, value: V): Effect.Effect<void
|
|
539
|
+
<K, V>(self: TxHashMap<K, V>, key: K, value: V): Effect.Effect<void>
|
|
540
540
|
} = dual(
|
|
541
541
|
3,
|
|
542
|
-
<K, V>(self: TxHashMap<K, V>, key: K, value: V): Effect.Effect<void
|
|
542
|
+
<K, V>(self: TxHashMap<K, V>, key: K, value: V): Effect.Effect<void> =>
|
|
543
543
|
TxRef.update(self.ref, (map) => HashMap.set(map, key, value))
|
|
544
544
|
)
|
|
545
545
|
|
|
@@ -604,7 +604,7 @@ export const has: {
|
|
|
604
604
|
* @since 2.0.0
|
|
605
605
|
* @category combinators
|
|
606
606
|
*/
|
|
607
|
-
<K1 extends K, K>(key: K1): <V>(self: TxHashMap<K, V>) => Effect.Effect<boolean
|
|
607
|
+
<K1 extends K, K>(key: K1): <V>(self: TxHashMap<K, V>) => Effect.Effect<boolean>
|
|
608
608
|
/**
|
|
609
609
|
* Checks if the specified key exists in the TxHashMap.
|
|
610
610
|
*
|
|
@@ -635,10 +635,10 @@ export const has: {
|
|
|
635
635
|
* @since 2.0.0
|
|
636
636
|
* @category combinators
|
|
637
637
|
*/
|
|
638
|
-
<K1 extends K, K, V>(self: TxHashMap<K, V>, key: K1): Effect.Effect<boolean
|
|
638
|
+
<K1 extends K, K, V>(self: TxHashMap<K, V>, key: K1): Effect.Effect<boolean>
|
|
639
639
|
} = dual(
|
|
640
640
|
2,
|
|
641
|
-
<K1 extends K, K, V>(self: TxHashMap<K, V>, key: K1): Effect.Effect<boolean
|
|
641
|
+
<K1 extends K, K, V>(self: TxHashMap<K, V>, key: K1): Effect.Effect<boolean> =>
|
|
642
642
|
Effect.gen(function*() {
|
|
643
643
|
const map = yield* TxRef.get(self.ref)
|
|
644
644
|
return HashMap.has(map, key)
|
|
@@ -720,7 +720,7 @@ export const remove: {
|
|
|
720
720
|
* @since 2.0.0
|
|
721
721
|
* @category combinators
|
|
722
722
|
*/
|
|
723
|
-
<K1 extends K, K>(key: K1): <V>(self: TxHashMap<K, V>) => Effect.Effect<boolean
|
|
723
|
+
<K1 extends K, K>(key: K1): <V>(self: TxHashMap<K, V>) => Effect.Effect<boolean>
|
|
724
724
|
/**
|
|
725
725
|
* Removes the specified key from the TxHashMap.
|
|
726
726
|
*
|
|
@@ -758,10 +758,10 @@ export const remove: {
|
|
|
758
758
|
* @since 2.0.0
|
|
759
759
|
* @category combinators
|
|
760
760
|
*/
|
|
761
|
-
<K1 extends K, K, V>(self: TxHashMap<K, V>, key: K1): Effect.Effect<boolean
|
|
761
|
+
<K1 extends K, K, V>(self: TxHashMap<K, V>, key: K1): Effect.Effect<boolean>
|
|
762
762
|
} = dual(
|
|
763
763
|
2,
|
|
764
|
-
<K1 extends K, K, V>(self: TxHashMap<K, V>, key: K1): Effect.Effect<boolean
|
|
764
|
+
<K1 extends K, K, V>(self: TxHashMap<K, V>, key: K1): Effect.Effect<boolean> =>
|
|
765
765
|
Effect.gen(function*() {
|
|
766
766
|
const currentMap = yield* TxRef.get(self.ref)
|
|
767
767
|
const existed = HashMap.has(currentMap, key)
|
|
@@ -769,7 +769,7 @@ export const remove: {
|
|
|
769
769
|
yield* TxRef.set(self.ref, HashMap.remove(currentMap, key))
|
|
770
770
|
}
|
|
771
771
|
return existed
|
|
772
|
-
})
|
|
772
|
+
}).pipe(Effect.tx)
|
|
773
773
|
)
|
|
774
774
|
|
|
775
775
|
/**
|
|
@@ -808,8 +808,7 @@ export const remove: {
|
|
|
808
808
|
* @since 2.0.0
|
|
809
809
|
* @category combinators
|
|
810
810
|
*/
|
|
811
|
-
export const clear = <K, V>(self: TxHashMap<K, V>): Effect.Effect<void,
|
|
812
|
-
TxRef.set(self.ref, HashMap.empty<K, V>())
|
|
811
|
+
export const clear = <K, V>(self: TxHashMap<K, V>): Effect.Effect<void> => TxRef.set(self.ref, HashMap.empty<K, V>())
|
|
813
812
|
|
|
814
813
|
/**
|
|
815
814
|
* Returns the number of entries in the TxHashMap.
|
|
@@ -843,7 +842,7 @@ export const clear = <K, V>(self: TxHashMap<K, V>): Effect.Effect<void, never, E
|
|
|
843
842
|
* @since 2.0.0
|
|
844
843
|
* @category combinators
|
|
845
844
|
*/
|
|
846
|
-
export const size = <K, V>(self: TxHashMap<K, V>): Effect.Effect<number
|
|
845
|
+
export const size = <K, V>(self: TxHashMap<K, V>): Effect.Effect<number> =>
|
|
847
846
|
Effect.gen(function*() {
|
|
848
847
|
const map = yield* TxRef.get(self.ref)
|
|
849
848
|
return HashMap.size(map)
|
|
@@ -877,7 +876,7 @@ export const size = <K, V>(self: TxHashMap<K, V>): Effect.Effect<number, never,
|
|
|
877
876
|
* @since 2.0.0
|
|
878
877
|
* @category combinators
|
|
879
878
|
*/
|
|
880
|
-
export const isEmpty = <K, V>(self: TxHashMap<K, V>): Effect.Effect<boolean
|
|
879
|
+
export const isEmpty = <K, V>(self: TxHashMap<K, V>): Effect.Effect<boolean> =>
|
|
881
880
|
Effect.gen(function*() {
|
|
882
881
|
const map = yield* TxRef.get(self.ref)
|
|
883
882
|
return HashMap.isEmpty(map)
|
|
@@ -906,7 +905,7 @@ export const isEmpty = <K, V>(self: TxHashMap<K, V>): Effect.Effect<boolean, nev
|
|
|
906
905
|
* @since 2.0.0
|
|
907
906
|
* @category combinators
|
|
908
907
|
*/
|
|
909
|
-
export const isNonEmpty = <K, V>(self: TxHashMap<K, V>): Effect.Effect<boolean
|
|
908
|
+
export const isNonEmpty = <K, V>(self: TxHashMap<K, V>): Effect.Effect<boolean> =>
|
|
910
909
|
Effect.map(isEmpty(self), (empty) => !empty)
|
|
911
910
|
|
|
912
911
|
/**
|
|
@@ -996,7 +995,7 @@ export const modify: {
|
|
|
996
995
|
* @since 2.0.0
|
|
997
996
|
* @category combinators
|
|
998
997
|
*/
|
|
999
|
-
<K, V>(key: K, f: (value: V) => V): (self: TxHashMap<K, V>) => Effect.Effect<Option.Option<V
|
|
998
|
+
<K, V>(key: K, f: (value: V) => V): (self: TxHashMap<K, V>) => Effect.Effect<Option.Option<V>>
|
|
1000
999
|
/**
|
|
1001
1000
|
* Updates the value for the specified key if it exists.
|
|
1002
1001
|
*
|
|
@@ -1040,14 +1039,14 @@ export const modify: {
|
|
|
1040
1039
|
* @since 2.0.0
|
|
1041
1040
|
* @category combinators
|
|
1042
1041
|
*/
|
|
1043
|
-
<K, V>(self: TxHashMap<K, V>, key: K, f: (value: V) => V): Effect.Effect<Option.Option<V
|
|
1042
|
+
<K, V>(self: TxHashMap<K, V>, key: K, f: (value: V) => V): Effect.Effect<Option.Option<V>>
|
|
1044
1043
|
} = dual(
|
|
1045
1044
|
3,
|
|
1046
1045
|
<K, V>(
|
|
1047
1046
|
self: TxHashMap<K, V>,
|
|
1048
1047
|
key: K,
|
|
1049
1048
|
f: (value: V) => V
|
|
1050
|
-
): Effect.Effect<Option.Option<V
|
|
1049
|
+
): Effect.Effect<Option.Option<V>> =>
|
|
1051
1050
|
Effect.gen(function*() {
|
|
1052
1051
|
const currentMap = yield* TxRef.get(self.ref)
|
|
1053
1052
|
const currentValue = HashMap.get(currentMap, key)
|
|
@@ -1057,7 +1056,7 @@ export const modify: {
|
|
|
1057
1056
|
return currentValue
|
|
1058
1057
|
}
|
|
1059
1058
|
return Option.none()
|
|
1060
|
-
})
|
|
1059
|
+
}).pipe(Effect.tx)
|
|
1061
1060
|
)
|
|
1062
1061
|
|
|
1063
1062
|
/**
|
|
@@ -1159,7 +1158,7 @@ export const modifyAt: {
|
|
|
1159
1158
|
* @since 2.0.0
|
|
1160
1159
|
* @category combinators
|
|
1161
1160
|
*/
|
|
1162
|
-
<K, V>(key: K, f: (value: Option.Option<V>) => Option.Option<V>): (self: TxHashMap<K, V>) => Effect.Effect<void
|
|
1161
|
+
<K, V>(key: K, f: (value: Option.Option<V>) => Option.Option<V>): (self: TxHashMap<K, V>) => Effect.Effect<void>
|
|
1163
1162
|
/**
|
|
1164
1163
|
* Updates the value for the specified key using an Option-based update function.
|
|
1165
1164
|
*
|
|
@@ -1213,14 +1212,14 @@ export const modifyAt: {
|
|
|
1213
1212
|
self: TxHashMap<K, V>,
|
|
1214
1213
|
key: K,
|
|
1215
1214
|
f: (value: Option.Option<V>) => Option.Option<V>
|
|
1216
|
-
): Effect.Effect<void
|
|
1215
|
+
): Effect.Effect<void>
|
|
1217
1216
|
} = dual(
|
|
1218
1217
|
3,
|
|
1219
1218
|
<K, V>(
|
|
1220
1219
|
self: TxHashMap<K, V>,
|
|
1221
1220
|
key: K,
|
|
1222
1221
|
f: (value: Option.Option<V>) => Option.Option<V>
|
|
1223
|
-
): Effect.Effect<void
|
|
1222
|
+
): Effect.Effect<void> =>
|
|
1224
1223
|
Effect.gen(function*() {
|
|
1225
1224
|
const currentMap = yield* TxRef.get(self.ref)
|
|
1226
1225
|
const currentValue = HashMap.get(currentMap, key)
|
|
@@ -1231,7 +1230,7 @@ export const modifyAt: {
|
|
|
1231
1230
|
} else if (Option.isSome(currentValue)) {
|
|
1232
1231
|
yield* TxRef.set(self.ref, HashMap.remove(currentMap, key))
|
|
1233
1232
|
}
|
|
1234
|
-
})
|
|
1233
|
+
}).pipe(Effect.tx)
|
|
1235
1234
|
)
|
|
1236
1235
|
|
|
1237
1236
|
/**
|
|
@@ -1264,7 +1263,7 @@ export const modifyAt: {
|
|
|
1264
1263
|
* @since 2.0.0
|
|
1265
1264
|
* @category combinators
|
|
1266
1265
|
*/
|
|
1267
|
-
export const keys = <K, V>(self: TxHashMap<K, V>): Effect.Effect<Array<K
|
|
1266
|
+
export const keys = <K, V>(self: TxHashMap<K, V>): Effect.Effect<Array<K>> =>
|
|
1268
1267
|
Effect.gen(function*() {
|
|
1269
1268
|
const map = yield* TxRef.get(self.ref)
|
|
1270
1269
|
return Array.from(HashMap.keys(map))
|
|
@@ -1301,7 +1300,7 @@ export const keys = <K, V>(self: TxHashMap<K, V>): Effect.Effect<Array<K>, never
|
|
|
1301
1300
|
* @since 2.0.0
|
|
1302
1301
|
* @category combinators
|
|
1303
1302
|
*/
|
|
1304
|
-
export const values = <K, V>(self: TxHashMap<K, V>): Effect.Effect<Array<V
|
|
1303
|
+
export const values = <K, V>(self: TxHashMap<K, V>): Effect.Effect<Array<V>> =>
|
|
1305
1304
|
Effect.gen(function*() {
|
|
1306
1305
|
const map = yield* TxRef.get(self.ref)
|
|
1307
1306
|
return HashMap.toValues(map)
|
|
@@ -1340,7 +1339,7 @@ export const values = <K, V>(self: TxHashMap<K, V>): Effect.Effect<Array<V>, nev
|
|
|
1340
1339
|
*/
|
|
1341
1340
|
export const entries = <K, V>(
|
|
1342
1341
|
self: TxHashMap<K, V>
|
|
1343
|
-
): Effect.Effect<Array<readonly [K, V]
|
|
1342
|
+
): Effect.Effect<Array<readonly [K, V]>> =>
|
|
1344
1343
|
Effect.gen(function*() {
|
|
1345
1344
|
const map = yield* TxRef.get(self.ref)
|
|
1346
1345
|
return HashMap.toEntries(map)
|
|
@@ -1382,7 +1381,7 @@ export const entries = <K, V>(
|
|
|
1382
1381
|
*/
|
|
1383
1382
|
export const snapshot = <K, V>(
|
|
1384
1383
|
self: TxHashMap<K, V>
|
|
1385
|
-
): Effect.Effect<HashMap.HashMap<K, V
|
|
1384
|
+
): Effect.Effect<HashMap.HashMap<K, V>> => TxRef.get(self.ref)
|
|
1386
1385
|
|
|
1387
1386
|
/**
|
|
1388
1387
|
* Merges another HashMap into this TxHashMap. If both maps contain the same key,
|
|
@@ -1479,7 +1478,7 @@ export const union: {
|
|
|
1479
1478
|
* @since 2.0.0
|
|
1480
1479
|
* @category combinators
|
|
1481
1480
|
*/
|
|
1482
|
-
<K1 extends K, K, V1 extends V, V>(other: HashMap.HashMap<K1, V1>): (self: TxHashMap<K, V>) => Effect.Effect<void
|
|
1481
|
+
<K1 extends K, K, V1 extends V, V>(other: HashMap.HashMap<K1, V1>): (self: TxHashMap<K, V>) => Effect.Effect<void>
|
|
1483
1482
|
/**
|
|
1484
1483
|
* Merges another HashMap into this TxHashMap. If both maps contain the same key,
|
|
1485
1484
|
* the value from the other map will be used.
|
|
@@ -1527,13 +1526,13 @@ export const union: {
|
|
|
1527
1526
|
* @since 2.0.0
|
|
1528
1527
|
* @category combinators
|
|
1529
1528
|
*/
|
|
1530
|
-
<K1 extends K, K, V1 extends V, V>(self: TxHashMap<K, V>, other: HashMap.HashMap<K1, V1>): Effect.Effect<void
|
|
1529
|
+
<K1 extends K, K, V1 extends V, V>(self: TxHashMap<K, V>, other: HashMap.HashMap<K1, V1>): Effect.Effect<void>
|
|
1531
1530
|
} = dual(
|
|
1532
1531
|
2,
|
|
1533
1532
|
<K1 extends K, K, V1 extends V, V>(
|
|
1534
1533
|
self: TxHashMap<K, V>,
|
|
1535
1534
|
other: HashMap.HashMap<K1, V1>
|
|
1536
|
-
): Effect.Effect<void
|
|
1535
|
+
): Effect.Effect<void> => TxRef.update(self.ref, (map) => HashMap.union(map, other))
|
|
1537
1536
|
)
|
|
1538
1537
|
|
|
1539
1538
|
/**
|
|
@@ -1621,7 +1620,7 @@ export const removeMany: {
|
|
|
1621
1620
|
* @since 2.0.0
|
|
1622
1621
|
* @category combinators
|
|
1623
1622
|
*/
|
|
1624
|
-
<K1 extends K, K>(keys: Iterable<K1>): <V>(self: TxHashMap<K, V>) => Effect.Effect<void
|
|
1623
|
+
<K1 extends K, K>(keys: Iterable<K1>): <V>(self: TxHashMap<K, V>) => Effect.Effect<void>
|
|
1625
1624
|
/**
|
|
1626
1625
|
* Removes multiple keys from the TxHashMap.
|
|
1627
1626
|
*
|
|
@@ -1664,10 +1663,10 @@ export const removeMany: {
|
|
|
1664
1663
|
* @since 2.0.0
|
|
1665
1664
|
* @category combinators
|
|
1666
1665
|
*/
|
|
1667
|
-
<K1 extends K, K, V>(self: TxHashMap<K, V>, keys: Iterable<K1>): Effect.Effect<void
|
|
1666
|
+
<K1 extends K, K, V>(self: TxHashMap<K, V>, keys: Iterable<K1>): Effect.Effect<void>
|
|
1668
1667
|
} = dual(
|
|
1669
1668
|
2,
|
|
1670
|
-
<K1 extends K, K, V>(self: TxHashMap<K, V>, keys: Iterable<K1>): Effect.Effect<void
|
|
1669
|
+
<K1 extends K, K, V>(self: TxHashMap<K, V>, keys: Iterable<K1>): Effect.Effect<void> =>
|
|
1671
1670
|
TxRef.update(self.ref, (map) => HashMap.removeMany(map, keys))
|
|
1672
1671
|
)
|
|
1673
1672
|
|
|
@@ -1786,7 +1785,7 @@ export const setMany: {
|
|
|
1786
1785
|
* @since 2.0.0
|
|
1787
1786
|
* @category combinators
|
|
1788
1787
|
*/
|
|
1789
|
-
<K1 extends K, K, V1 extends V, V>(entries: Iterable<readonly [K1, V1]>): (self: TxHashMap<K, V>) => Effect.Effect<void
|
|
1788
|
+
<K1 extends K, K, V1 extends V, V>(entries: Iterable<readonly [K1, V1]>): (self: TxHashMap<K, V>) => Effect.Effect<void>
|
|
1790
1789
|
/**
|
|
1791
1790
|
* Sets multiple key-value pairs in the TxHashMap.
|
|
1792
1791
|
*
|
|
@@ -1844,13 +1843,13 @@ export const setMany: {
|
|
|
1844
1843
|
* @since 2.0.0
|
|
1845
1844
|
* @category combinators
|
|
1846
1845
|
*/
|
|
1847
|
-
<K1 extends K, K, V1 extends V, V>(self: TxHashMap<K, V>, entries: Iterable<readonly [K1, V1]>): Effect.Effect<void
|
|
1846
|
+
<K1 extends K, K, V1 extends V, V>(self: TxHashMap<K, V>, entries: Iterable<readonly [K1, V1]>): Effect.Effect<void>
|
|
1848
1847
|
} = dual(
|
|
1849
1848
|
2,
|
|
1850
1849
|
<K1 extends K, K, V1 extends V, V>(
|
|
1851
1850
|
self: TxHashMap<K, V>,
|
|
1852
1851
|
entries: Iterable<readonly [K1, V1]>
|
|
1853
|
-
): Effect.Effect<void
|
|
1852
|
+
): Effect.Effect<void> => TxRef.update(self.ref, (map) => HashMap.setMany(map, entries))
|
|
1854
1853
|
)
|
|
1855
1854
|
|
|
1856
1855
|
/**
|
|
@@ -1959,7 +1958,7 @@ export const getHash: {
|
|
|
1959
1958
|
* @since 2.0.0
|
|
1960
1959
|
* @category combinators
|
|
1961
1960
|
*/
|
|
1962
|
-
<K1 extends K, K>(key: K1, hash: number): <V>(self: TxHashMap<K, V>) => Effect.Effect<Option.Option<V
|
|
1961
|
+
<K1 extends K, K>(key: K1, hash: number): <V>(self: TxHashMap<K, V>) => Effect.Effect<Option.Option<V>>
|
|
1963
1962
|
/**
|
|
1964
1963
|
* Lookup the value for the specified key in the TxHashMap using a custom hash.
|
|
1965
1964
|
* This can provide performance benefits when the hash is precomputed.
|
|
@@ -1996,15 +1995,14 @@ export const getHash: {
|
|
|
1996
1995
|
* @since 2.0.0
|
|
1997
1996
|
* @category combinators
|
|
1998
1997
|
*/
|
|
1999
|
-
<K1 extends K, K, V>(self: TxHashMap<K, V>, key: K1, hash: number): Effect.Effect<Option.Option<V
|
|
1998
|
+
<K1 extends K, K, V>(self: TxHashMap<K, V>, key: K1, hash: number): Effect.Effect<Option.Option<V>>
|
|
2000
1999
|
} = dual(
|
|
2001
2000
|
3,
|
|
2002
2001
|
<K1 extends K, K, V>(
|
|
2003
2002
|
self: TxHashMap<K, V>,
|
|
2004
2003
|
key: K1,
|
|
2005
2004
|
hash: number
|
|
2006
|
-
): Effect.Effect<Option.Option<V
|
|
2007
|
-
TxRef.get(self.ref).pipe(Effect.map((map) => HashMap.getHash(map, key, hash)))
|
|
2005
|
+
): Effect.Effect<Option.Option<V>> => TxRef.get(self.ref).pipe(Effect.map((map) => HashMap.getHash(map, key, hash)))
|
|
2008
2006
|
)
|
|
2009
2007
|
|
|
2010
2008
|
/**
|
|
@@ -2098,7 +2096,7 @@ export const hasHash: {
|
|
|
2098
2096
|
* @since 2.0.0
|
|
2099
2097
|
* @category combinators
|
|
2100
2098
|
*/
|
|
2101
|
-
<K1 extends K, K>(key: K1, hash: number): <V>(self: TxHashMap<K, V>) => Effect.Effect<boolean
|
|
2099
|
+
<K1 extends K, K>(key: K1, hash: number): <V>(self: TxHashMap<K, V>) => Effect.Effect<boolean>
|
|
2102
2100
|
/**
|
|
2103
2101
|
* Checks if the specified key has an entry in the TxHashMap using a custom hash.
|
|
2104
2102
|
* This can provide performance benefits when the hash is precomputed.
|
|
@@ -2144,15 +2142,14 @@ export const hasHash: {
|
|
|
2144
2142
|
* @since 2.0.0
|
|
2145
2143
|
* @category combinators
|
|
2146
2144
|
*/
|
|
2147
|
-
<K1 extends K, K, V>(self: TxHashMap<K, V>, key: K1, hash: number): Effect.Effect<boolean
|
|
2145
|
+
<K1 extends K, K, V>(self: TxHashMap<K, V>, key: K1, hash: number): Effect.Effect<boolean>
|
|
2148
2146
|
} = dual(
|
|
2149
2147
|
3,
|
|
2150
2148
|
<K1 extends K, K, V>(
|
|
2151
2149
|
self: TxHashMap<K, V>,
|
|
2152
2150
|
key: K1,
|
|
2153
2151
|
hash: number
|
|
2154
|
-
): Effect.Effect<boolean
|
|
2155
|
-
TxRef.get(self.ref).pipe(Effect.map((map) => HashMap.hasHash(map, key, hash)))
|
|
2152
|
+
): Effect.Effect<boolean> => TxRef.get(self.ref).pipe(Effect.map((map) => HashMap.hasHash(map, key, hash)))
|
|
2156
2153
|
)
|
|
2157
2154
|
|
|
2158
2155
|
/**
|
|
@@ -2246,7 +2243,7 @@ export const map: {
|
|
|
2246
2243
|
* @since 2.0.0
|
|
2247
2244
|
* @category combinators
|
|
2248
2245
|
*/
|
|
2249
|
-
<A, V, K>(f: (value: V, key: K) => A): (self: TxHashMap<K, V>) => Effect.Effect<TxHashMap<K, A
|
|
2246
|
+
<A, V, K>(f: (value: V, key: K) => A): (self: TxHashMap<K, V>) => Effect.Effect<TxHashMap<K, A>>
|
|
2250
2247
|
/**
|
|
2251
2248
|
* Transforms all values in the TxHashMap using the provided function, preserving keys.
|
|
2252
2249
|
*
|
|
@@ -2292,18 +2289,18 @@ export const map: {
|
|
|
2292
2289
|
* @since 2.0.0
|
|
2293
2290
|
* @category combinators
|
|
2294
2291
|
*/
|
|
2295
|
-
<K, V, A>(self: TxHashMap<K, V>, f: (value: V, key: K) => A): Effect.Effect<TxHashMap<K, A
|
|
2292
|
+
<K, V, A>(self: TxHashMap<K, V>, f: (value: V, key: K) => A): Effect.Effect<TxHashMap<K, A>>
|
|
2296
2293
|
} = dual(
|
|
2297
2294
|
2,
|
|
2298
2295
|
<K, V, A>(
|
|
2299
2296
|
self: TxHashMap<K, V>,
|
|
2300
2297
|
f: (value: V, key: K) => A
|
|
2301
|
-
): Effect.Effect<TxHashMap<K, A
|
|
2298
|
+
): Effect.Effect<TxHashMap<K, A>> =>
|
|
2302
2299
|
Effect.gen(function*() {
|
|
2303
2300
|
const currentMap = yield* TxRef.get(self.ref)
|
|
2304
2301
|
const mappedMap = HashMap.map(currentMap, f)
|
|
2305
2302
|
return yield* fromHashMap(mappedMap)
|
|
2306
|
-
})
|
|
2303
|
+
}).pipe(Effect.tx)
|
|
2307
2304
|
)
|
|
2308
2305
|
|
|
2309
2306
|
/**
|
|
@@ -2403,7 +2400,7 @@ export const filter: {
|
|
|
2403
2400
|
* @since 2.0.0
|
|
2404
2401
|
* @category combinators
|
|
2405
2402
|
*/
|
|
2406
|
-
<K, V, B extends V>(predicate: (value: V, key: K) => value is B): (self: TxHashMap<K, V>) => Effect.Effect<TxHashMap<K, B
|
|
2403
|
+
<K, V, B extends V>(predicate: (value: V, key: K) => value is B): (self: TxHashMap<K, V>) => Effect.Effect<TxHashMap<K, B>>
|
|
2407
2404
|
/**
|
|
2408
2405
|
* Filters the TxHashMap to keep only entries that satisfy the provided predicate.
|
|
2409
2406
|
*
|
|
@@ -2452,7 +2449,7 @@ export const filter: {
|
|
|
2452
2449
|
* @since 2.0.0
|
|
2453
2450
|
* @category combinators
|
|
2454
2451
|
*/
|
|
2455
|
-
<K, V>(predicate: (value: V, key: K) => boolean): (self: TxHashMap<K, V>) => Effect.Effect<TxHashMap<K, V
|
|
2452
|
+
<K, V>(predicate: (value: V, key: K) => boolean): (self: TxHashMap<K, V>) => Effect.Effect<TxHashMap<K, V>>
|
|
2456
2453
|
/**
|
|
2457
2454
|
* Filters the TxHashMap to keep only entries that satisfy the provided predicate.
|
|
2458
2455
|
*
|
|
@@ -2501,7 +2498,7 @@ export const filter: {
|
|
|
2501
2498
|
* @since 2.0.0
|
|
2502
2499
|
* @category combinators
|
|
2503
2500
|
*/
|
|
2504
|
-
<K, V, B extends V>(self: TxHashMap<K, V>, predicate: (value: V, key: K) => value is B): Effect.Effect<TxHashMap<K, B
|
|
2501
|
+
<K, V, B extends V>(self: TxHashMap<K, V>, predicate: (value: V, key: K) => value is B): Effect.Effect<TxHashMap<K, B>>
|
|
2505
2502
|
/**
|
|
2506
2503
|
* Filters the TxHashMap to keep only entries that satisfy the provided predicate.
|
|
2507
2504
|
*
|
|
@@ -2550,18 +2547,18 @@ export const filter: {
|
|
|
2550
2547
|
* @since 2.0.0
|
|
2551
2548
|
* @category combinators
|
|
2552
2549
|
*/
|
|
2553
|
-
<K, V>(self: TxHashMap<K, V>, predicate: (value: V, key: K) => boolean): Effect.Effect<TxHashMap<K, V
|
|
2550
|
+
<K, V>(self: TxHashMap<K, V>, predicate: (value: V, key: K) => boolean): Effect.Effect<TxHashMap<K, V>>
|
|
2554
2551
|
} = dual(
|
|
2555
2552
|
2,
|
|
2556
2553
|
<K, V>(
|
|
2557
2554
|
self: TxHashMap<K, V>,
|
|
2558
2555
|
predicate: (value: V, key: K) => boolean
|
|
2559
|
-
): Effect.Effect<TxHashMap<K, V
|
|
2556
|
+
): Effect.Effect<TxHashMap<K, V>> =>
|
|
2560
2557
|
Effect.gen(function*() {
|
|
2561
2558
|
const currentMap = yield* TxRef.get(self.ref)
|
|
2562
2559
|
const filteredMap = HashMap.filter(currentMap, predicate)
|
|
2563
2560
|
return yield* fromHashMap(filteredMap)
|
|
2564
|
-
})
|
|
2561
|
+
}).pipe(Effect.tx)
|
|
2565
2562
|
)
|
|
2566
2563
|
|
|
2567
2564
|
/**
|
|
@@ -2673,7 +2670,7 @@ export const reduce: {
|
|
|
2673
2670
|
* @since 2.0.0
|
|
2674
2671
|
* @category combinators
|
|
2675
2672
|
*/
|
|
2676
|
-
<A, V, K>(zero: A, f: (accumulator: A, value: V, key: K) => A): (self: TxHashMap<K, V>) => Effect.Effect<A
|
|
2673
|
+
<A, V, K>(zero: A, f: (accumulator: A, value: V, key: K) => A): (self: TxHashMap<K, V>) => Effect.Effect<A>
|
|
2677
2674
|
/**
|
|
2678
2675
|
* Reduces the TxHashMap entries to a single value by applying a reducer function.
|
|
2679
2676
|
* Iterates over all key-value pairs and accumulates them into a final result.
|
|
@@ -2728,15 +2725,14 @@ export const reduce: {
|
|
|
2728
2725
|
* @since 2.0.0
|
|
2729
2726
|
* @category combinators
|
|
2730
2727
|
*/
|
|
2731
|
-
<K, V, A>(self: TxHashMap<K, V>, zero: A, f: (accumulator: A, value: V, key: K) => A): Effect.Effect<A
|
|
2728
|
+
<K, V, A>(self: TxHashMap<K, V>, zero: A, f: (accumulator: A, value: V, key: K) => A): Effect.Effect<A>
|
|
2732
2729
|
} = dual(
|
|
2733
2730
|
3,
|
|
2734
2731
|
<K, V, A>(
|
|
2735
2732
|
self: TxHashMap<K, V>,
|
|
2736
2733
|
zero: A,
|
|
2737
2734
|
f: (accumulator: A, value: V, key: K) => A
|
|
2738
|
-
): Effect.Effect<A
|
|
2739
|
-
TxRef.get(self.ref).pipe(Effect.map((map) => HashMap.reduce(map, zero, f)))
|
|
2735
|
+
): Effect.Effect<A> => TxRef.get(self.ref).pipe(Effect.map((map) => HashMap.reduce(map, zero, f)))
|
|
2740
2736
|
)
|
|
2741
2737
|
|
|
2742
2738
|
/**
|
|
@@ -2854,7 +2850,7 @@ export const filterMap: {
|
|
|
2854
2850
|
* @since 2.0.0
|
|
2855
2851
|
* @category combinators
|
|
2856
2852
|
*/
|
|
2857
|
-
<V, K, A, X>(f: (input: V, key: K) => Result<A, X>): (self: TxHashMap<K, V>) => Effect.Effect<TxHashMap<K, A
|
|
2853
|
+
<V, K, A, X>(f: (input: V, key: K) => Result<A, X>): (self: TxHashMap<K, V>) => Effect.Effect<TxHashMap<K, A>>
|
|
2858
2854
|
/**
|
|
2859
2855
|
* Combines filtering and mapping in a single operation. Applies a filter to each
|
|
2860
2856
|
* entry, keeping only successful results and transforming them.
|
|
@@ -2912,18 +2908,18 @@ export const filterMap: {
|
|
|
2912
2908
|
* @since 2.0.0
|
|
2913
2909
|
* @category combinators
|
|
2914
2910
|
*/
|
|
2915
|
-
<K, V, A, X>(self: TxHashMap<K, V>, f: (input: V, key: K) => Result<A, X>): Effect.Effect<TxHashMap<K, A
|
|
2911
|
+
<K, V, A, X>(self: TxHashMap<K, V>, f: (input: V, key: K) => Result<A, X>): Effect.Effect<TxHashMap<K, A>>
|
|
2916
2912
|
} = dual(
|
|
2917
2913
|
2,
|
|
2918
2914
|
<K, V, A, X>(
|
|
2919
2915
|
self: TxHashMap<K, V>,
|
|
2920
2916
|
f: (input: V, key: K) => Result<A, X>
|
|
2921
|
-
): Effect.Effect<TxHashMap<K, A
|
|
2917
|
+
): Effect.Effect<TxHashMap<K, A>> =>
|
|
2922
2918
|
Effect.gen(function*() {
|
|
2923
2919
|
const currentMap = yield* TxRef.get(self.ref)
|
|
2924
2920
|
const filteredMap = HashMap.filterMap(currentMap, f)
|
|
2925
2921
|
return yield* fromHashMap(filteredMap)
|
|
2926
|
-
})
|
|
2922
|
+
}).pipe(Effect.tx)
|
|
2927
2923
|
)
|
|
2928
2924
|
|
|
2929
2925
|
/**
|
|
@@ -3007,7 +3003,7 @@ export const hasBy: {
|
|
|
3007
3003
|
* @since 2.0.0
|
|
3008
3004
|
* @category combinators
|
|
3009
3005
|
*/
|
|
3010
|
-
<K, V>(predicate: (value: V, key: K) => boolean): (self: TxHashMap<K, V>) => Effect.Effect<boolean
|
|
3006
|
+
<K, V>(predicate: (value: V, key: K) => boolean): (self: TxHashMap<K, V>) => Effect.Effect<boolean>
|
|
3011
3007
|
/**
|
|
3012
3008
|
* Checks if any entry in the TxHashMap matches the given predicate.
|
|
3013
3009
|
*
|
|
@@ -3048,14 +3044,13 @@ export const hasBy: {
|
|
|
3048
3044
|
* @since 2.0.0
|
|
3049
3045
|
* @category combinators
|
|
3050
3046
|
*/
|
|
3051
|
-
<K, V>(self: TxHashMap<K, V>, predicate: (value: V, key: K) => boolean): Effect.Effect<boolean
|
|
3047
|
+
<K, V>(self: TxHashMap<K, V>, predicate: (value: V, key: K) => boolean): Effect.Effect<boolean>
|
|
3052
3048
|
} = dual(
|
|
3053
3049
|
2,
|
|
3054
3050
|
<K, V>(
|
|
3055
3051
|
self: TxHashMap<K, V>,
|
|
3056
3052
|
predicate: (value: V, key: K) => boolean
|
|
3057
|
-
): Effect.Effect<boolean
|
|
3058
|
-
TxRef.get(self.ref).pipe(Effect.map((map) => HashMap.hasBy(map, predicate)))
|
|
3053
|
+
): Effect.Effect<boolean> => TxRef.get(self.ref).pipe(Effect.map((map) => HashMap.hasBy(map, predicate)))
|
|
3059
3054
|
)
|
|
3060
3055
|
|
|
3061
3056
|
/**
|
|
@@ -3143,7 +3138,7 @@ export const findFirst: {
|
|
|
3143
3138
|
* @since 2.0.0
|
|
3144
3139
|
* @category combinators
|
|
3145
3140
|
*/
|
|
3146
|
-
<K, V>(predicate: (value: V, key: K) => boolean): (self: TxHashMap<K, V>) => Effect.Effect<Option.Option<[K, V]
|
|
3141
|
+
<K, V>(predicate: (value: V, key: K) => boolean): (self: TxHashMap<K, V>) => Effect.Effect<Option.Option<[K, V]>>
|
|
3147
3142
|
/**
|
|
3148
3143
|
* Finds the first entry in the TxHashMap that matches the given predicate.
|
|
3149
3144
|
* Returns the key-value pair as a tuple wrapped in an Option.
|
|
@@ -3186,13 +3181,13 @@ export const findFirst: {
|
|
|
3186
3181
|
* @since 2.0.0
|
|
3187
3182
|
* @category combinators
|
|
3188
3183
|
*/
|
|
3189
|
-
<K, V>(self: TxHashMap<K, V>, predicate: (value: V, key: K) => boolean): Effect.Effect<Option.Option<[K, V]
|
|
3184
|
+
<K, V>(self: TxHashMap<K, V>, predicate: (value: V, key: K) => boolean): Effect.Effect<Option.Option<[K, V]>>
|
|
3190
3185
|
} = dual(
|
|
3191
3186
|
2,
|
|
3192
3187
|
<K, V>(
|
|
3193
3188
|
self: TxHashMap<K, V>,
|
|
3194
3189
|
predicate: (value: V, key: K) => boolean
|
|
3195
|
-
): Effect.Effect<Option.Option<[K, V]
|
|
3190
|
+
): Effect.Effect<Option.Option<[K, V]>> =>
|
|
3196
3191
|
TxRef.get(self.ref).pipe(Effect.map((map) => HashMap.findFirst(map, predicate)))
|
|
3197
3192
|
)
|
|
3198
3193
|
|
|
@@ -3277,7 +3272,7 @@ export const some: {
|
|
|
3277
3272
|
* @since 2.0.0
|
|
3278
3273
|
* @category combinators
|
|
3279
3274
|
*/
|
|
3280
|
-
<K, V>(predicate: (value: V, key: K) => boolean): (self: TxHashMap<K, V>) => Effect.Effect<boolean
|
|
3275
|
+
<K, V>(predicate: (value: V, key: K) => boolean): (self: TxHashMap<K, V>) => Effect.Effect<boolean>
|
|
3281
3276
|
/**
|
|
3282
3277
|
* Checks if at least one entry in the TxHashMap satisfies the given predicate.
|
|
3283
3278
|
*
|
|
@@ -3318,14 +3313,13 @@ export const some: {
|
|
|
3318
3313
|
* @since 2.0.0
|
|
3319
3314
|
* @category combinators
|
|
3320
3315
|
*/
|
|
3321
|
-
<K, V>(self: TxHashMap<K, V>, predicate: (value: V, key: K) => boolean): Effect.Effect<boolean
|
|
3316
|
+
<K, V>(self: TxHashMap<K, V>, predicate: (value: V, key: K) => boolean): Effect.Effect<boolean>
|
|
3322
3317
|
} = dual(
|
|
3323
3318
|
2,
|
|
3324
3319
|
<K, V>(
|
|
3325
3320
|
self: TxHashMap<K, V>,
|
|
3326
3321
|
predicate: (value: V, key: K) => boolean
|
|
3327
|
-
): Effect.Effect<boolean
|
|
3328
|
-
TxRef.get(self.ref).pipe(Effect.map((map) => HashMap.some(map, predicate)))
|
|
3322
|
+
): Effect.Effect<boolean> => TxRef.get(self.ref).pipe(Effect.map((map) => HashMap.some(map, predicate)))
|
|
3329
3323
|
)
|
|
3330
3324
|
|
|
3331
3325
|
/**
|
|
@@ -3409,7 +3403,7 @@ export const every: {
|
|
|
3409
3403
|
* @since 2.0.0
|
|
3410
3404
|
* @category combinators
|
|
3411
3405
|
*/
|
|
3412
|
-
<K, V>(predicate: (value: V, key: K) => boolean): (self: TxHashMap<K, V>) => Effect.Effect<boolean
|
|
3406
|
+
<K, V>(predicate: (value: V, key: K) => boolean): (self: TxHashMap<K, V>) => Effect.Effect<boolean>
|
|
3413
3407
|
/**
|
|
3414
3408
|
* Checks if all entries in the TxHashMap satisfy the given predicate.
|
|
3415
3409
|
*
|
|
@@ -3450,14 +3444,13 @@ export const every: {
|
|
|
3450
3444
|
* @since 2.0.0
|
|
3451
3445
|
* @category combinators
|
|
3452
3446
|
*/
|
|
3453
|
-
<K, V>(self: TxHashMap<K, V>, predicate: (value: V, key: K) => boolean): Effect.Effect<boolean
|
|
3447
|
+
<K, V>(self: TxHashMap<K, V>, predicate: (value: V, key: K) => boolean): Effect.Effect<boolean>
|
|
3454
3448
|
} = dual(
|
|
3455
3449
|
2,
|
|
3456
3450
|
<K, V>(
|
|
3457
3451
|
self: TxHashMap<K, V>,
|
|
3458
3452
|
predicate: (value: V, key: K) => boolean
|
|
3459
|
-
): Effect.Effect<boolean
|
|
3460
|
-
TxRef.get(self.ref).pipe(Effect.map((map) => HashMap.every(map, predicate)))
|
|
3453
|
+
): Effect.Effect<boolean> => TxRef.get(self.ref).pipe(Effect.map((map) => HashMap.every(map, predicate)))
|
|
3461
3454
|
)
|
|
3462
3455
|
|
|
3463
3456
|
/**
|
|
@@ -3543,7 +3536,7 @@ export const forEach: {
|
|
|
3543
3536
|
* @since 2.0.0
|
|
3544
3537
|
* @category combinators
|
|
3545
3538
|
*/
|
|
3546
|
-
<V, K, R, E>(f: (value: V, key: K) => Effect.Effect<void, E, R>): (self: TxHashMap<K, V>) => Effect.Effect<void, E, R
|
|
3539
|
+
<V, K, R, E>(f: (value: V, key: K) => Effect.Effect<void, E, R>): (self: TxHashMap<K, V>) => Effect.Effect<void, E, R>
|
|
3547
3540
|
/**
|
|
3548
3541
|
* Executes a side-effect function for each entry in the TxHashMap.
|
|
3549
3542
|
* The function receives the value and key as parameters and can perform effects.
|
|
@@ -3585,13 +3578,13 @@ export const forEach: {
|
|
|
3585
3578
|
* @since 2.0.0
|
|
3586
3579
|
* @category combinators
|
|
3587
3580
|
*/
|
|
3588
|
-
<K, V, R, E>(self: TxHashMap<K, V>, f: (value: V, key: K) => Effect.Effect<void, E, R>): Effect.Effect<void, E, R
|
|
3581
|
+
<K, V, R, E>(self: TxHashMap<K, V>, f: (value: V, key: K) => Effect.Effect<void, E, R>): Effect.Effect<void, E, R>
|
|
3589
3582
|
} = dual(
|
|
3590
3583
|
2,
|
|
3591
3584
|
<K, V, R, E>(
|
|
3592
3585
|
self: TxHashMap<K, V>,
|
|
3593
3586
|
f: (value: V, key: K) => Effect.Effect<void, E, R>
|
|
3594
|
-
): Effect.Effect<void, E, R
|
|
3587
|
+
): Effect.Effect<void, E, R> =>
|
|
3595
3588
|
Effect.gen(function*() {
|
|
3596
3589
|
const currentMap = yield* TxRef.get(self.ref)
|
|
3597
3590
|
const entries = HashMap.toEntries(currentMap)
|
|
@@ -3702,9 +3695,7 @@ export const flatMap: {
|
|
|
3702
3695
|
* @since 2.0.0
|
|
3703
3696
|
* @category combinators
|
|
3704
3697
|
*/
|
|
3705
|
-
<A, V, K>(
|
|
3706
|
-
f: (value: V, key: K) => Effect.Effect<TxHashMap<K, A>, never, Effect.Transaction>
|
|
3707
|
-
): (self: TxHashMap<K, V>) => Effect.Effect<TxHashMap<K, A>, never, Effect.Transaction>
|
|
3698
|
+
<A, V, K>(f: (value: V, key: K) => Effect.Effect<TxHashMap<K, A>>): (self: TxHashMap<K, V>) => Effect.Effect<TxHashMap<K, A>>
|
|
3708
3699
|
/**
|
|
3709
3700
|
* Transforms the TxHashMap by applying a function that returns a TxHashMap to each entry,
|
|
3710
3701
|
* then flattening the results. Useful for complex transformations that require creating new maps.
|
|
@@ -3758,14 +3749,14 @@ export const flatMap: {
|
|
|
3758
3749
|
*/
|
|
3759
3750
|
<K, V, A>(
|
|
3760
3751
|
self: TxHashMap<K, V>,
|
|
3761
|
-
f: (value: V, key: K) => Effect.Effect<TxHashMap<K, A
|
|
3762
|
-
): Effect.Effect<TxHashMap<K, A
|
|
3752
|
+
f: (value: V, key: K) => Effect.Effect<TxHashMap<K, A>>
|
|
3753
|
+
): Effect.Effect<TxHashMap<K, A>>
|
|
3763
3754
|
} = dual(
|
|
3764
3755
|
2,
|
|
3765
3756
|
<K, V, A>(
|
|
3766
3757
|
self: TxHashMap<K, V>,
|
|
3767
|
-
f: (value: V, key: K) => Effect.Effect<TxHashMap<K, A
|
|
3768
|
-
): Effect.Effect<TxHashMap<K, A
|
|
3758
|
+
f: (value: V, key: K) => Effect.Effect<TxHashMap<K, A>>
|
|
3759
|
+
): Effect.Effect<TxHashMap<K, A>> =>
|
|
3769
3760
|
Effect.gen(function*() {
|
|
3770
3761
|
const currentMap = yield* TxRef.get(self.ref)
|
|
3771
3762
|
const result = yield* empty</**
|
|
@@ -3880,7 +3871,7 @@ export const flatMap: {
|
|
|
3880
3871
|
}
|
|
3881
3872
|
|
|
3882
3873
|
return result
|
|
3883
|
-
})
|
|
3874
|
+
}).pipe(Effect.tx)
|
|
3884
3875
|
)
|
|
3885
3876
|
|
|
3886
3877
|
/**
|
|
@@ -3930,12 +3921,12 @@ export const flatMap: {
|
|
|
3930
3921
|
*/
|
|
3931
3922
|
export const compact = <K, A>(
|
|
3932
3923
|
self: TxHashMap<K, Option.Option<A>>
|
|
3933
|
-
): Effect.Effect<TxHashMap<K, A
|
|
3924
|
+
): Effect.Effect<TxHashMap<K, A>> =>
|
|
3934
3925
|
Effect.gen(function*() {
|
|
3935
3926
|
const currentMap = yield* TxRef.get(self.ref)
|
|
3936
3927
|
const compactedMap = HashMap.compact(currentMap)
|
|
3937
3928
|
return yield* fromHashMap(compactedMap)
|
|
3938
|
-
})
|
|
3929
|
+
}).pipe(Effect.tx)
|
|
3939
3930
|
|
|
3940
3931
|
/**
|
|
3941
3932
|
* Returns an array of all key-value pairs in the TxHashMap.
|
|
@@ -3973,7 +3964,7 @@ export const compact = <K, A>(
|
|
|
3973
3964
|
*/
|
|
3974
3965
|
export const toEntries = <K, V>(
|
|
3975
3966
|
self: TxHashMap<K, V>
|
|
3976
|
-
): Effect.Effect<Array<readonly [K, V]
|
|
3967
|
+
): Effect.Effect<Array<readonly [K, V]>> => entries(self)
|
|
3977
3968
|
|
|
3978
3969
|
/**
|
|
3979
3970
|
* Returns an array of all values in the TxHashMap.
|
|
@@ -4011,13 +4002,12 @@ export const toEntries = <K, V>(
|
|
|
4011
4002
|
* @since 2.0.0
|
|
4012
4003
|
* @category combinators
|
|
4013
4004
|
*/
|
|
4014
|
-
export const toValues = <K, V>(self: TxHashMap<K, V>): Effect.Effect<Array<V
|
|
4015
|
-
values(self)
|
|
4005
|
+
export const toValues = <K, V>(self: TxHashMap<K, V>): Effect.Effect<Array<V>> => values(self)
|
|
4016
4006
|
|
|
4017
4007
|
/**
|
|
4018
4008
|
* Helper function to create a TxHashMap from an existing HashMap
|
|
4019
4009
|
*/
|
|
4020
|
-
const fromHashMap = <K, V>(hashMap: HashMap.HashMap<K, V>): Effect.Effect<TxHashMap<K, V
|
|
4010
|
+
const fromHashMap = <K, V>(hashMap: HashMap.HashMap<K, V>): Effect.Effect<TxHashMap<K, V>> =>
|
|
4021
4011
|
Effect.gen(function*() {
|
|
4022
4012
|
const ref = yield* TxRef.make(hashMap)
|
|
4023
4013
|
return Object.assign(Object.create(TxHashMapProto), { ref })
|