effect 4.0.0-beta.17 → 4.0.0-beta.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Array.d.ts +127 -299
- package/dist/Array.d.ts.map +1 -1
- package/dist/Array.js +102 -62
- package/dist/Array.js.map +1 -1
- package/dist/Cache.d.ts.map +1 -1
- package/dist/Cache.js +5 -4
- package/dist/Cache.js.map +1 -1
- package/dist/Channel.d.ts +97 -11
- package/dist/Channel.d.ts.map +1 -1
- package/dist/Channel.js +72 -29
- package/dist/Channel.js.map +1 -1
- package/dist/Chunk.d.ts +54 -247
- package/dist/Chunk.d.ts.map +1 -1
- package/dist/Chunk.js +36 -67
- package/dist/Chunk.js.map +1 -1
- package/dist/Effect.d.ts +337 -437
- package/dist/Effect.d.ts.map +1 -1
- package/dist/Effect.js +118 -134
- package/dist/Effect.js.map +1 -1
- package/dist/Filter.d.ts +0 -33
- package/dist/Filter.d.ts.map +1 -1
- package/dist/Filter.js +0 -13
- package/dist/Filter.js.map +1 -1
- package/dist/HashMap.d.ts +15 -14
- package/dist/HashMap.d.ts.map +1 -1
- package/dist/HashMap.js +4 -4
- package/dist/HashMap.js.map +1 -1
- package/dist/Iterable.d.ts +40 -39
- package/dist/Iterable.d.ts.map +1 -1
- package/dist/Iterable.js +94 -22
- package/dist/Iterable.js.map +1 -1
- package/dist/Option.d.ts +22 -15
- package/dist/Option.d.ts.map +1 -1
- package/dist/Option.js +14 -7
- package/dist/Option.js.map +1 -1
- package/dist/Pull.d.ts.map +1 -1
- package/dist/Pull.js +1 -1
- package/dist/Pull.js.map +1 -1
- package/dist/Record.d.ts +24 -120
- package/dist/Record.d.ts.map +1 -1
- package/dist/Record.js +21 -41
- package/dist/Record.js.map +1 -1
- package/dist/Sink.d.ts +11 -11
- package/dist/Sink.d.ts.map +1 -1
- package/dist/Sink.js +53 -6
- package/dist/Sink.js.map +1 -1
- package/dist/Stream.d.ts +198 -386
- package/dist/Stream.d.ts.map +1 -1
- package/dist/Stream.js +103 -59
- package/dist/Stream.js.map +1 -1
- package/dist/Trie.d.ts +18 -17
- package/dist/Trie.d.ts.map +1 -1
- package/dist/Trie.js +5 -5
- package/dist/Trie.js.map +1 -1
- package/dist/TxChunk.d.ts +37 -37
- 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 +328 -0
- package/dist/TxDeferred.d.ts.map +1 -0
- package/dist/TxDeferred.js +196 -0
- package/dist/TxDeferred.js.map +1 -0
- package/dist/TxHashMap.d.ts +84 -83
- package/dist/TxHashMap.d.ts.map +1 -1
- package/dist/TxHashMap.js +24 -24
- 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 +14 -14
- package/dist/TxHashSet.js.map +1 -1
- package/dist/TxPriorityQueue.d.ts +609 -0
- package/dist/TxPriorityQueue.d.ts.map +1 -0
- package/dist/TxPriorityQueue.js +415 -0
- package/dist/TxPriorityQueue.js.map +1 -0
- package/dist/TxPubSub.d.ts +585 -0
- package/dist/TxPubSub.d.ts.map +1 -0
- package/dist/TxPubSub.js +521 -0
- package/dist/TxPubSub.js.map +1 -0
- package/dist/TxQueue.d.ts +32 -32
- package/dist/TxQueue.d.ts.map +1 -1
- package/dist/TxQueue.js +26 -26
- package/dist/TxQueue.js.map +1 -1
- package/dist/TxReentrantLock.d.ts +523 -0
- package/dist/TxReentrantLock.d.ts.map +1 -0
- package/dist/TxReentrantLock.js +504 -0
- package/dist/TxReentrantLock.js.map +1 -0
- package/dist/TxRef.d.ts +34 -34
- package/dist/TxRef.d.ts.map +1 -1
- package/dist/TxRef.js +21 -14
- 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 +7 -7
- package/dist/TxSemaphore.js.map +1 -1
- package/dist/TxSubscriptionRef.d.ts +508 -0
- package/dist/TxSubscriptionRef.d.ts.map +1 -0
- package/dist/TxSubscriptionRef.js +293 -0
- package/dist/TxSubscriptionRef.js.map +1 -0
- package/dist/index.d.ts +40 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +40 -0
- package/dist/index.js.map +1 -1
- package/dist/internal/effect.js +99 -42
- package/dist/internal/effect.js.map +1 -1
- package/dist/internal/hashMap.js +3 -2
- package/dist/internal/hashMap.js.map +1 -1
- package/dist/internal/trie.js +5 -4
- package/dist/internal/trie.js.map +1 -1
- package/dist/unstable/ai/Tool.d.ts.map +1 -1
- package/dist/unstable/ai/Tool.js +0 -9
- package/dist/unstable/ai/Tool.js.map +1 -1
- package/dist/unstable/cli/Command.d.ts +1 -1
- package/dist/unstable/cli/Command.d.ts.map +1 -1
- package/dist/unstable/cli/Command.js +1 -1
- package/dist/unstable/cli/Command.js.map +1 -1
- package/dist/unstable/cluster/K8sHttpClient.js +4 -4
- package/dist/unstable/cluster/K8sHttpClient.js.map +1 -1
- package/dist/unstable/cluster/Sharding.js +1 -1
- package/dist/unstable/cluster/Sharding.js.map +1 -1
- package/dist/unstable/encoding/Sse.js +1 -1
- package/dist/unstable/encoding/Sse.js.map +1 -1
- package/dist/unstable/rpc/RpcServer.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcServer.js +1 -2
- package/dist/unstable/rpc/RpcServer.js.map +1 -1
- package/dist/unstable/socket/Socket.d.ts.map +1 -1
- package/dist/unstable/socket/Socket.js +3 -3
- package/dist/unstable/socket/Socket.js.map +1 -1
- package/package.json +1 -1
- package/src/Array.ts +190 -342
- package/src/Cache.ts +6 -5
- package/src/Channel.ts +506 -102
- package/src/Chunk.ts +81 -268
- package/src/Effect.ts +437 -518
- package/src/Filter.ts +0 -57
- package/src/HashMap.ts +15 -14
- package/src/Iterable.ts +105 -50
- package/src/Option.ts +30 -20
- package/src/Pull.ts +1 -1
- package/src/Record.ts +43 -152
- package/src/Sink.ts +75 -23
- package/src/Stream.ts +442 -502
- package/src/Trie.ts +18 -17
- package/src/TxChunk.ts +72 -53
- package/src/TxDeferred.ts +394 -0
- package/src/TxHashMap.ts +332 -285
- package/src/TxHashSet.ts +111 -116
- package/src/TxPriorityQueue.ts +767 -0
- package/src/TxPubSub.ts +789 -0
- package/src/TxQueue.ts +241 -251
- package/src/TxReentrantLock.ts +753 -0
- package/src/TxRef.ts +50 -38
- package/src/TxSemaphore.ts +29 -32
- package/src/TxSubscriptionRef.ts +639 -0
- package/src/index.ts +45 -0
- package/src/internal/effect.ts +368 -163
- package/src/internal/hashMap.ts +7 -5
- package/src/internal/trie.ts +16 -9
- package/src/unstable/ai/Tool.ts +0 -9
- package/src/unstable/cli/Command.ts +6 -4
- package/src/unstable/cluster/K8sHttpClient.ts +4 -4
- package/src/unstable/cluster/Sharding.ts +1 -1
- package/src/unstable/encoding/Sse.ts +1 -1
- package/src/unstable/rpc/RpcServer.ts +1 -7
- package/src/unstable/socket/Socket.ts +9 -11
package/src/Trie.ts
CHANGED
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
* @since 2.0.0
|
|
17
17
|
*/
|
|
18
18
|
import type { Equal } from "./Equal.ts"
|
|
19
|
+
import type * as Filter from "./Filter.ts"
|
|
19
20
|
import type { Inspectable } from "./Inspectable.ts"
|
|
20
21
|
import * as TR from "./internal/trie.ts"
|
|
21
22
|
import type { Option } from "./Option.ts"
|
|
@@ -1488,13 +1489,13 @@ export const filter: {
|
|
|
1488
1489
|
} = TR.filter
|
|
1489
1490
|
|
|
1490
1491
|
/**
|
|
1491
|
-
* Maps over the entries of the `Trie` using the specified
|
|
1492
|
-
*
|
|
1492
|
+
* Maps over the entries of the `Trie` using the specified filter and keeps
|
|
1493
|
+
* only successful results.
|
|
1493
1494
|
*
|
|
1494
1495
|
* @example
|
|
1495
1496
|
* ```ts
|
|
1496
1497
|
* import * as Equal from "effect/Equal"
|
|
1497
|
-
* import * as
|
|
1498
|
+
* import * as Result from "effect/Result"
|
|
1498
1499
|
* import * as Trie from "effect/Trie"
|
|
1499
1500
|
* import * as assert from "node:assert"
|
|
1500
1501
|
*
|
|
@@ -1515,7 +1516,7 @@ export const filter: {
|
|
|
1515
1516
|
*
|
|
1516
1517
|
* assert.equal(
|
|
1517
1518
|
* Equal.equals(
|
|
1518
|
-
* Trie.filterMap(trie, (v) => v > 1 ?
|
|
1519
|
+
* Trie.filterMap(trie, (v) => v > 1 ? Result.succeed(v) : Result.failVoid),
|
|
1519
1520
|
* trieMapV
|
|
1520
1521
|
* ),
|
|
1521
1522
|
* true
|
|
@@ -1524,7 +1525,7 @@ export const filter: {
|
|
|
1524
1525
|
* Equal.equals(
|
|
1525
1526
|
* Trie.filterMap(
|
|
1526
1527
|
* trie,
|
|
1527
|
-
* (v, k) => k.length > 3 ?
|
|
1528
|
+
* (v, k) => k.length > 3 ? Result.succeed(v) : Result.failVoid
|
|
1528
1529
|
* ),
|
|
1529
1530
|
* trieMapK
|
|
1530
1531
|
* ),
|
|
@@ -1537,13 +1538,13 @@ export const filter: {
|
|
|
1537
1538
|
*/
|
|
1538
1539
|
export const filterMap: {
|
|
1539
1540
|
/**
|
|
1540
|
-
* Maps over the entries of the `Trie` using the specified
|
|
1541
|
-
*
|
|
1541
|
+
* Maps over the entries of the `Trie` using the specified filter and keeps
|
|
1542
|
+
* only successful results.
|
|
1542
1543
|
*
|
|
1543
1544
|
* @example
|
|
1544
1545
|
* ```ts
|
|
1545
1546
|
* import * as Equal from "effect/Equal"
|
|
1546
|
-
* import * as
|
|
1547
|
+
* import * as Result from "effect/Result"
|
|
1547
1548
|
* import * as Trie from "effect/Trie"
|
|
1548
1549
|
* import * as assert from "node:assert"
|
|
1549
1550
|
*
|
|
@@ -1564,7 +1565,7 @@ export const filterMap: {
|
|
|
1564
1565
|
*
|
|
1565
1566
|
* assert.equal(
|
|
1566
1567
|
* Equal.equals(
|
|
1567
|
-
* Trie.filterMap(trie, (v) => v > 1 ?
|
|
1568
|
+
* Trie.filterMap(trie, (v) => v > 1 ? Result.succeed(v) : Result.failVoid),
|
|
1568
1569
|
* trieMapV
|
|
1569
1570
|
* ),
|
|
1570
1571
|
* true
|
|
@@ -1573,7 +1574,7 @@ export const filterMap: {
|
|
|
1573
1574
|
* Equal.equals(
|
|
1574
1575
|
* Trie.filterMap(
|
|
1575
1576
|
* trie,
|
|
1576
|
-
* (v, k) => k.length > 3 ?
|
|
1577
|
+
* (v, k) => k.length > 3 ? Result.succeed(v) : Result.failVoid
|
|
1577
1578
|
* ),
|
|
1578
1579
|
* trieMapK
|
|
1579
1580
|
* ),
|
|
@@ -1584,15 +1585,15 @@ export const filterMap: {
|
|
|
1584
1585
|
* @since 2.0.0
|
|
1585
1586
|
* @category filtering
|
|
1586
1587
|
*/
|
|
1587
|
-
<A, B>(f:
|
|
1588
|
+
<A, B, X>(f: Filter.Filter<A, B, X, [key: string]>): (self: Trie<A>) => Trie<B>
|
|
1588
1589
|
/**
|
|
1589
|
-
* Maps over the entries of the `Trie` using the specified
|
|
1590
|
-
*
|
|
1590
|
+
* Maps over the entries of the `Trie` using the specified filter and keeps
|
|
1591
|
+
* only successful results.
|
|
1591
1592
|
*
|
|
1592
1593
|
* @example
|
|
1593
1594
|
* ```ts
|
|
1594
1595
|
* import * as Equal from "effect/Equal"
|
|
1595
|
-
* import * as
|
|
1596
|
+
* import * as Result from "effect/Result"
|
|
1596
1597
|
* import * as Trie from "effect/Trie"
|
|
1597
1598
|
* import * as assert from "node:assert"
|
|
1598
1599
|
*
|
|
@@ -1613,7 +1614,7 @@ export const filterMap: {
|
|
|
1613
1614
|
*
|
|
1614
1615
|
* assert.equal(
|
|
1615
1616
|
* Equal.equals(
|
|
1616
|
-
* Trie.filterMap(trie, (v) => v > 1 ?
|
|
1617
|
+
* Trie.filterMap(trie, (v) => v > 1 ? Result.succeed(v) : Result.failVoid),
|
|
1617
1618
|
* trieMapV
|
|
1618
1619
|
* ),
|
|
1619
1620
|
* true
|
|
@@ -1622,7 +1623,7 @@ export const filterMap: {
|
|
|
1622
1623
|
* Equal.equals(
|
|
1623
1624
|
* Trie.filterMap(
|
|
1624
1625
|
* trie,
|
|
1625
|
-
* (v, k) => k.length > 3 ?
|
|
1626
|
+
* (v, k) => k.length > 3 ? Result.succeed(v) : Result.failVoid
|
|
1626
1627
|
* ),
|
|
1627
1628
|
* trieMapK
|
|
1628
1629
|
* ),
|
|
@@ -1633,7 +1634,7 @@ export const filterMap: {
|
|
|
1633
1634
|
* @since 2.0.0
|
|
1634
1635
|
* @category filtering
|
|
1635
1636
|
*/
|
|
1636
|
-
<A, B>(self: Trie<A>, f:
|
|
1637
|
+
<A, B, X>(self: Trie<A>, f: Filter.Filter<A, B, X, [key: string]>): Trie<B>
|
|
1637
1638
|
} = TR.filterMap
|
|
1638
1639
|
|
|
1639
1640
|
/**
|
package/src/TxChunk.ts
CHANGED
|
@@ -48,7 +48,7 @@ const TypeId = "~effect/transactions/TxChunk"
|
|
|
48
48
|
* console.log(Chunk.toReadonlyArray(result)) // [1, 2, 3, 4]
|
|
49
49
|
*
|
|
50
50
|
* // Multi-step atomic operation - use explicit transaction
|
|
51
|
-
* yield* Effect.
|
|
51
|
+
* yield* Effect.transaction(
|
|
52
52
|
* Effect.gen(function*() {
|
|
53
53
|
* yield* TxChunk.prepend(txChunk, 0)
|
|
54
54
|
* yield* TxChunk.append(txChunk, 5)
|
|
@@ -109,7 +109,7 @@ const TxChunkProto = {
|
|
|
109
109
|
* })
|
|
110
110
|
* ```
|
|
111
111
|
*/
|
|
112
|
-
export const make = <A>(initial: Chunk.Chunk<A>): Effect.Effect<TxChunk<A
|
|
112
|
+
export const make = <A>(initial: Chunk.Chunk<A>): Effect.Effect<TxChunk<A>, never, Effect.Transaction> =>
|
|
113
113
|
Effect.map(TxRef.make(initial), (ref) => makeUnsafe(ref))
|
|
114
114
|
|
|
115
115
|
/**
|
|
@@ -140,7 +140,7 @@ export const make = <A>(initial: Chunk.Chunk<A>): Effect.Effect<TxChunk<A>> =>
|
|
|
140
140
|
* })
|
|
141
141
|
* ```
|
|
142
142
|
*/
|
|
143
|
-
export const empty = <A = never>(): Effect.Effect<TxChunk<A
|
|
143
|
+
export const empty = <A = never>(): Effect.Effect<TxChunk<A>, never, Effect.Transaction> =>
|
|
144
144
|
Effect.map(TxRef.make(Chunk.empty<A>()), (ref) => makeUnsafe(ref))
|
|
145
145
|
|
|
146
146
|
/**
|
|
@@ -164,7 +164,7 @@ export const empty = <A = never>(): Effect.Effect<TxChunk<A>> =>
|
|
|
164
164
|
* console.log(Chunk.toReadonlyArray(chunk)) // [1, 2, 3, 4, 5]
|
|
165
165
|
*
|
|
166
166
|
* // Multi-step atomic modification - use explicit transaction
|
|
167
|
-
* yield* Effect.
|
|
167
|
+
* yield* Effect.transaction(
|
|
168
168
|
* Effect.gen(function*() {
|
|
169
169
|
* yield* TxChunk.append(txChunk, 6)
|
|
170
170
|
* yield* TxChunk.prepend(txChunk, 0)
|
|
@@ -176,7 +176,7 @@ export const empty = <A = never>(): Effect.Effect<TxChunk<A>> =>
|
|
|
176
176
|
* })
|
|
177
177
|
* ```
|
|
178
178
|
*/
|
|
179
|
-
export const fromIterable = <A>(iterable: Iterable<A>): Effect.Effect<TxChunk<A
|
|
179
|
+
export const fromIterable = <A>(iterable: Iterable<A>): Effect.Effect<TxChunk<A>, never, Effect.Transaction> =>
|
|
180
180
|
Effect.map(TxRef.make(Chunk.fromIterable(iterable)), (ref) => makeUnsafe(ref))
|
|
181
181
|
|
|
182
182
|
/**
|
|
@@ -265,7 +265,7 @@ export const modify: {
|
|
|
265
265
|
f: (current: Chunk.Chunk<NoInfer<A>>) => [returnValue: R, newValue: Chunk.Chunk<A>]
|
|
266
266
|
): (
|
|
267
267
|
self: TxChunk<A>
|
|
268
|
-
) => Effect.Effect<R>
|
|
268
|
+
) => Effect.Effect<R, never, Effect.Transaction>
|
|
269
269
|
/**
|
|
270
270
|
* Modifies the value of the `TxChunk` using the provided function.
|
|
271
271
|
*
|
|
@@ -297,13 +297,13 @@ export const modify: {
|
|
|
297
297
|
<A, R>(
|
|
298
298
|
self: TxChunk<A>,
|
|
299
299
|
f: (current: Chunk.Chunk<A>) => [returnValue: R, newValue: Chunk.Chunk<A>]
|
|
300
|
-
): Effect.Effect<R>
|
|
300
|
+
): Effect.Effect<R, never, Effect.Transaction>
|
|
301
301
|
} = dual(
|
|
302
302
|
2,
|
|
303
303
|
<A, R>(
|
|
304
304
|
self: TxChunk<A>,
|
|
305
305
|
f: (current: Chunk.Chunk<A>) => [returnValue: R, newValue: Chunk.Chunk<A>]
|
|
306
|
-
): Effect.Effect<R> => TxRef.modify(self.ref, f)
|
|
306
|
+
): Effect.Effect<R, never, Effect.Transaction> => TxRef.modify(self.ref, f)
|
|
307
307
|
)
|
|
308
308
|
|
|
309
309
|
/**
|
|
@@ -357,7 +357,7 @@ export const update: {
|
|
|
357
357
|
* @since 4.0.0
|
|
358
358
|
* @category combinators
|
|
359
359
|
*/
|
|
360
|
-
<A>(f: (current: Chunk.Chunk<NoInfer<A>>) => Chunk.Chunk<A>): (self: TxChunk<A>) => Effect.Effect<void>
|
|
360
|
+
<A>(f: (current: Chunk.Chunk<NoInfer<A>>) => Chunk.Chunk<A>): (self: TxChunk<A>) => Effect.Effect<void, never, Effect.Transaction>
|
|
361
361
|
/**
|
|
362
362
|
* Updates the value of the `TxChunk` using the provided function.
|
|
363
363
|
*
|
|
@@ -383,11 +383,13 @@ export const update: {
|
|
|
383
383
|
* @since 4.0.0
|
|
384
384
|
* @category combinators
|
|
385
385
|
*/
|
|
386
|
-
<A>(self: TxChunk<A>, f: (current: Chunk.Chunk<A>) => Chunk.Chunk<A>): Effect.Effect<void>
|
|
386
|
+
<A>(self: TxChunk<A>, f: (current: Chunk.Chunk<A>) => Chunk.Chunk<A>): Effect.Effect<void, never, Effect.Transaction>
|
|
387
387
|
} = dual(
|
|
388
388
|
2,
|
|
389
|
-
<A>(
|
|
390
|
-
|
|
389
|
+
<A>(
|
|
390
|
+
self: TxChunk<A>,
|
|
391
|
+
f: (current: Chunk.Chunk<A>) => Chunk.Chunk<A>
|
|
392
|
+
): Effect.Effect<void, never, Effect.Transaction> => TxRef.update(self.ref, f)
|
|
391
393
|
)
|
|
392
394
|
|
|
393
395
|
/**
|
|
@@ -413,7 +415,8 @@ export const update: {
|
|
|
413
415
|
* @since 4.0.0
|
|
414
416
|
* @category combinators
|
|
415
417
|
*/
|
|
416
|
-
export const get = <A>(self: TxChunk<A>): Effect.Effect<Chunk.Chunk<A
|
|
418
|
+
export const get = <A>(self: TxChunk<A>): Effect.Effect<Chunk.Chunk<A>, never, Effect.Transaction> =>
|
|
419
|
+
TxRef.get(self.ref)
|
|
417
420
|
|
|
418
421
|
/**
|
|
419
422
|
* Sets the value of the `TxChunk`.
|
|
@@ -466,7 +469,7 @@ export const set: {
|
|
|
466
469
|
* @since 4.0.0
|
|
467
470
|
* @category combinators
|
|
468
471
|
*/
|
|
469
|
-
<A>(chunk: Chunk.Chunk<A>): (self: TxChunk<A>) => Effect.Effect<void>
|
|
472
|
+
<A>(chunk: Chunk.Chunk<A>): (self: TxChunk<A>) => Effect.Effect<void, never, Effect.Transaction>
|
|
470
473
|
/**
|
|
471
474
|
* Sets the value of the `TxChunk`.
|
|
472
475
|
*
|
|
@@ -492,8 +495,12 @@ export const set: {
|
|
|
492
495
|
* @since 4.0.0
|
|
493
496
|
* @category combinators
|
|
494
497
|
*/
|
|
495
|
-
<A>(self: TxChunk<A>, chunk: Chunk.Chunk<A>): Effect.Effect<void>
|
|
496
|
-
} = dual(
|
|
498
|
+
<A>(self: TxChunk<A>, chunk: Chunk.Chunk<A>): Effect.Effect<void, never, Effect.Transaction>
|
|
499
|
+
} = dual(
|
|
500
|
+
2,
|
|
501
|
+
<A>(self: TxChunk<A>, chunk: Chunk.Chunk<A>): Effect.Effect<void, never, Effect.Transaction> =>
|
|
502
|
+
TxRef.set(self.ref, chunk)
|
|
503
|
+
)
|
|
497
504
|
|
|
498
505
|
/**
|
|
499
506
|
* Appends an element to the end of the `TxChunk`.
|
|
@@ -544,7 +551,7 @@ export const append: {
|
|
|
544
551
|
* @since 4.0.0
|
|
545
552
|
* @category combinators
|
|
546
553
|
*/
|
|
547
|
-
<A>(element: A): (self: TxChunk<A>) => Effect.Effect<void>
|
|
554
|
+
<A>(element: A): (self: TxChunk<A>) => Effect.Effect<void, never, Effect.Transaction>
|
|
548
555
|
/**
|
|
549
556
|
* Appends an element to the end of the `TxChunk`.
|
|
550
557
|
*
|
|
@@ -569,10 +576,11 @@ export const append: {
|
|
|
569
576
|
* @since 4.0.0
|
|
570
577
|
* @category combinators
|
|
571
578
|
*/
|
|
572
|
-
<A>(self: TxChunk<A>, element: A): Effect.Effect<void>
|
|
579
|
+
<A>(self: TxChunk<A>, element: A): Effect.Effect<void, never, Effect.Transaction>
|
|
573
580
|
} = dual(
|
|
574
581
|
2,
|
|
575
|
-
<A>(self: TxChunk<A>, element: A): Effect.Effect<void
|
|
582
|
+
<A>(self: TxChunk<A>, element: A): Effect.Effect<void, never, Effect.Transaction> =>
|
|
583
|
+
update(self, (current) => Chunk.append(current, element))
|
|
576
584
|
)
|
|
577
585
|
|
|
578
586
|
/**
|
|
@@ -624,7 +632,7 @@ export const prepend: {
|
|
|
624
632
|
* @since 4.0.0
|
|
625
633
|
* @category combinators
|
|
626
634
|
*/
|
|
627
|
-
<A>(element: A): (self: TxChunk<A>) => Effect.Effect<void>
|
|
635
|
+
<A>(element: A): (self: TxChunk<A>) => Effect.Effect<void, never, Effect.Transaction>
|
|
628
636
|
/**
|
|
629
637
|
* Prepends an element to the beginning of the `TxChunk`.
|
|
630
638
|
*
|
|
@@ -649,10 +657,11 @@ export const prepend: {
|
|
|
649
657
|
* @since 4.0.0
|
|
650
658
|
* @category combinators
|
|
651
659
|
*/
|
|
652
|
-
<A>(self: TxChunk<A>, element: A): Effect.Effect<void>
|
|
660
|
+
<A>(self: TxChunk<A>, element: A): Effect.Effect<void, never, Effect.Transaction>
|
|
653
661
|
} = dual(
|
|
654
662
|
2,
|
|
655
|
-
<A>(self: TxChunk<A>, element: A): Effect.Effect<void
|
|
663
|
+
<A>(self: TxChunk<A>, element: A): Effect.Effect<void, never, Effect.Transaction> =>
|
|
664
|
+
update(self, (current) => Chunk.prepend(current, element))
|
|
656
665
|
)
|
|
657
666
|
|
|
658
667
|
/**
|
|
@@ -679,7 +688,7 @@ export const prepend: {
|
|
|
679
688
|
* @since 4.0.0
|
|
680
689
|
* @category combinators
|
|
681
690
|
*/
|
|
682
|
-
export const size = <A>(self: TxChunk<A>): Effect.Effect<number> =>
|
|
691
|
+
export const size = <A>(self: TxChunk<A>): Effect.Effect<number, never, Effect.Transaction> =>
|
|
683
692
|
modify(self, (current) => [Chunk.size(current), current])
|
|
684
693
|
|
|
685
694
|
/**
|
|
@@ -705,7 +714,7 @@ export const size = <A>(self: TxChunk<A>): Effect.Effect<number> =>
|
|
|
705
714
|
* @since 4.0.0
|
|
706
715
|
* @category combinators
|
|
707
716
|
*/
|
|
708
|
-
export const isEmpty = <A>(self: TxChunk<A>): Effect.Effect<boolean> =>
|
|
717
|
+
export const isEmpty = <A>(self: TxChunk<A>): Effect.Effect<boolean, never, Effect.Transaction> =>
|
|
709
718
|
modify(self, (current) => [Chunk.isEmpty(current), current])
|
|
710
719
|
|
|
711
720
|
/**
|
|
@@ -731,7 +740,7 @@ export const isEmpty = <A>(self: TxChunk<A>): Effect.Effect<boolean> =>
|
|
|
731
740
|
* @since 4.0.0
|
|
732
741
|
* @category combinators
|
|
733
742
|
*/
|
|
734
|
-
export const isNonEmpty = <A>(self: TxChunk<A>): Effect.Effect<boolean> =>
|
|
743
|
+
export const isNonEmpty = <A>(self: TxChunk<A>): Effect.Effect<boolean, never, Effect.Transaction> =>
|
|
735
744
|
modify(self, (current) => [Chunk.isNonEmpty(current), current])
|
|
736
745
|
|
|
737
746
|
/**
|
|
@@ -783,7 +792,7 @@ export const take: {
|
|
|
783
792
|
* @since 4.0.0
|
|
784
793
|
* @category combinators
|
|
785
794
|
*/
|
|
786
|
-
(n: number): <A>(self: TxChunk<A>) => Effect.Effect<void>
|
|
795
|
+
(n: number): <A>(self: TxChunk<A>) => Effect.Effect<void, never, Effect.Transaction>
|
|
787
796
|
/**
|
|
788
797
|
* Takes the first `n` elements from the `TxChunk`.
|
|
789
798
|
*
|
|
@@ -808,8 +817,12 @@ export const take: {
|
|
|
808
817
|
* @since 4.0.0
|
|
809
818
|
* @category combinators
|
|
810
819
|
*/
|
|
811
|
-
<A>(self: TxChunk<A>, n: number): Effect.Effect<void>
|
|
812
|
-
} = dual(
|
|
820
|
+
<A>(self: TxChunk<A>, n: number): Effect.Effect<void, never, Effect.Transaction>
|
|
821
|
+
} = dual(
|
|
822
|
+
2,
|
|
823
|
+
<A>(self: TxChunk<A>, n: number): Effect.Effect<void, never, Effect.Transaction> =>
|
|
824
|
+
update(self, (current) => Chunk.take(current, n))
|
|
825
|
+
)
|
|
813
826
|
|
|
814
827
|
/**
|
|
815
828
|
* Drops the first `n` elements from the `TxChunk`.
|
|
@@ -860,7 +873,7 @@ export const drop: {
|
|
|
860
873
|
* @since 4.0.0
|
|
861
874
|
* @category combinators
|
|
862
875
|
*/
|
|
863
|
-
(n: number): <A>(self: TxChunk<A>) => Effect.Effect<void>
|
|
876
|
+
(n: number): <A>(self: TxChunk<A>) => Effect.Effect<void, never, Effect.Transaction>
|
|
864
877
|
/**
|
|
865
878
|
* Drops the first `n` elements from the `TxChunk`.
|
|
866
879
|
*
|
|
@@ -885,8 +898,12 @@ export const drop: {
|
|
|
885
898
|
* @since 4.0.0
|
|
886
899
|
* @category combinators
|
|
887
900
|
*/
|
|
888
|
-
<A>(self: TxChunk<A>, n: number): Effect.Effect<void>
|
|
889
|
-
} = dual(
|
|
901
|
+
<A>(self: TxChunk<A>, n: number): Effect.Effect<void, never, Effect.Transaction>
|
|
902
|
+
} = dual(
|
|
903
|
+
2,
|
|
904
|
+
<A>(self: TxChunk<A>, n: number): Effect.Effect<void, never, Effect.Transaction> =>
|
|
905
|
+
update(self, (current) => Chunk.drop(current, n))
|
|
906
|
+
)
|
|
890
907
|
|
|
891
908
|
/**
|
|
892
909
|
* Takes a slice of the `TxChunk` from `start` to `end` (exclusive).
|
|
@@ -937,7 +954,7 @@ export const slice: {
|
|
|
937
954
|
* @since 4.0.0
|
|
938
955
|
* @category combinators
|
|
939
956
|
*/
|
|
940
|
-
(start: number, end: number): <A>(self: TxChunk<A>) => Effect.Effect<void>
|
|
957
|
+
(start: number, end: number): <A>(self: TxChunk<A>) => Effect.Effect<void, never, Effect.Transaction>
|
|
941
958
|
/**
|
|
942
959
|
* Takes a slice of the `TxChunk` from `start` to `end` (exclusive).
|
|
943
960
|
*
|
|
@@ -962,10 +979,10 @@ export const slice: {
|
|
|
962
979
|
* @since 4.0.0
|
|
963
980
|
* @category combinators
|
|
964
981
|
*/
|
|
965
|
-
<A>(self: TxChunk<A>, start: number, end: number): Effect.Effect<void>
|
|
982
|
+
<A>(self: TxChunk<A>, start: number, end: number): Effect.Effect<void, never, Effect.Transaction>
|
|
966
983
|
} = dual(
|
|
967
984
|
3,
|
|
968
|
-
<A>(self: TxChunk<A>, start: number, end: number): Effect.Effect<void> =>
|
|
985
|
+
<A>(self: TxChunk<A>, start: number, end: number): Effect.Effect<void, never, Effect.Transaction> =>
|
|
969
986
|
update(self, (current) => Chunk.take(Chunk.drop(current, start), end - start))
|
|
970
987
|
)
|
|
971
988
|
|
|
@@ -1022,7 +1039,7 @@ export const map: {
|
|
|
1022
1039
|
* @since 4.0.0
|
|
1023
1040
|
* @category combinators
|
|
1024
1041
|
*/
|
|
1025
|
-
<A>(f: (a: NoInfer<A>) => A): (self: TxChunk<A>) => Effect.Effect<void>
|
|
1042
|
+
<A>(f: (a: NoInfer<A>) => A): (self: TxChunk<A>) => Effect.Effect<void, never, Effect.Transaction>
|
|
1026
1043
|
/**
|
|
1027
1044
|
* Maps each element of the `TxChunk` using the provided function.
|
|
1028
1045
|
* Note: This only works when the mapped type B is assignable to A.
|
|
@@ -1049,10 +1066,11 @@ export const map: {
|
|
|
1049
1066
|
* @since 4.0.0
|
|
1050
1067
|
* @category combinators
|
|
1051
1068
|
*/
|
|
1052
|
-
<A>(self: TxChunk<A>, f: (a: A) => A): Effect.Effect<void>
|
|
1069
|
+
<A>(self: TxChunk<A>, f: (a: A) => A): Effect.Effect<void, never, Effect.Transaction>
|
|
1053
1070
|
} = dual(
|
|
1054
1071
|
2,
|
|
1055
|
-
<A>(self: TxChunk<A>, f: (a: A) => A): Effect.Effect<void
|
|
1072
|
+
<A>(self: TxChunk<A>, f: (a: A) => A): Effect.Effect<void, never, Effect.Transaction> =>
|
|
1073
|
+
update(self, (current) => Chunk.map(current, f))
|
|
1056
1074
|
)
|
|
1057
1075
|
|
|
1058
1076
|
/**
|
|
@@ -1106,7 +1124,7 @@ export const filter: {
|
|
|
1106
1124
|
* @since 4.0.0
|
|
1107
1125
|
* @category combinators
|
|
1108
1126
|
*/
|
|
1109
|
-
<A, B extends A>(refinement: (a: A) => a is B): (self: TxChunk<A>) => Effect.Effect<void>
|
|
1127
|
+
<A, B extends A>(refinement: (a: A) => a is B): (self: TxChunk<A>) => Effect.Effect<void, never, Effect.Transaction>
|
|
1110
1128
|
/**
|
|
1111
1129
|
* Filters the `TxChunk` keeping only elements that satisfy the predicate.
|
|
1112
1130
|
*
|
|
@@ -1132,7 +1150,7 @@ export const filter: {
|
|
|
1132
1150
|
* @since 4.0.0
|
|
1133
1151
|
* @category combinators
|
|
1134
1152
|
*/
|
|
1135
|
-
<A>(predicate: (a: A) => boolean): (self: TxChunk<A>) => Effect.Effect<void>
|
|
1153
|
+
<A>(predicate: (a: A) => boolean): (self: TxChunk<A>) => Effect.Effect<void, never, Effect.Transaction>
|
|
1136
1154
|
/**
|
|
1137
1155
|
* Filters the `TxChunk` keeping only elements that satisfy the predicate.
|
|
1138
1156
|
*
|
|
@@ -1158,7 +1176,7 @@ export const filter: {
|
|
|
1158
1176
|
* @since 4.0.0
|
|
1159
1177
|
* @category combinators
|
|
1160
1178
|
*/
|
|
1161
|
-
<A, B extends A>(self: TxChunk<A>, refinement: (a: A) => a is B): Effect.Effect<void>
|
|
1179
|
+
<A, B extends A>(self: TxChunk<A>, refinement: (a: A) => a is B): Effect.Effect<void, never, Effect.Transaction>
|
|
1162
1180
|
/**
|
|
1163
1181
|
* Filters the `TxChunk` keeping only elements that satisfy the predicate.
|
|
1164
1182
|
*
|
|
@@ -1184,10 +1202,10 @@ export const filter: {
|
|
|
1184
1202
|
* @since 4.0.0
|
|
1185
1203
|
* @category combinators
|
|
1186
1204
|
*/
|
|
1187
|
-
<A>(self: TxChunk<A>, predicate: (a: A) => boolean): Effect.Effect<void>
|
|
1205
|
+
<A>(self: TxChunk<A>, predicate: (a: A) => boolean): Effect.Effect<void, never, Effect.Transaction>
|
|
1188
1206
|
} = dual(
|
|
1189
1207
|
2,
|
|
1190
|
-
<A>(self: TxChunk<A>, predicate: (a: A) => boolean): Effect.Effect<void> =>
|
|
1208
|
+
<A>(self: TxChunk<A>, predicate: (a: A) => boolean): Effect.Effect<void, never, Effect.Transaction> =>
|
|
1191
1209
|
update(self, (current) => Chunk.filter(current, predicate))
|
|
1192
1210
|
)
|
|
1193
1211
|
|
|
@@ -1244,7 +1262,7 @@ export const appendAll: {
|
|
|
1244
1262
|
* @since 4.0.0
|
|
1245
1263
|
* @category combinators
|
|
1246
1264
|
*/
|
|
1247
|
-
<A>(other: Chunk.Chunk<A>): (self: TxChunk<A>) => Effect.Effect<void>
|
|
1265
|
+
<A>(other: Chunk.Chunk<A>): (self: TxChunk<A>) => Effect.Effect<void, never, Effect.Transaction>
|
|
1248
1266
|
/**
|
|
1249
1267
|
* Concatenates another chunk to the end of the `TxChunk`.
|
|
1250
1268
|
*
|
|
@@ -1271,10 +1289,10 @@ export const appendAll: {
|
|
|
1271
1289
|
* @since 4.0.0
|
|
1272
1290
|
* @category combinators
|
|
1273
1291
|
*/
|
|
1274
|
-
<A>(self: TxChunk<A>, other: Chunk.Chunk<A>): Effect.Effect<void>
|
|
1292
|
+
<A>(self: TxChunk<A>, other: Chunk.Chunk<A>): Effect.Effect<void, never, Effect.Transaction>
|
|
1275
1293
|
} = dual(
|
|
1276
1294
|
2,
|
|
1277
|
-
<A>(self: TxChunk<A>, other: Chunk.Chunk<A>): Effect.Effect<void> =>
|
|
1295
|
+
<A>(self: TxChunk<A>, other: Chunk.Chunk<A>): Effect.Effect<void, never, Effect.Transaction> =>
|
|
1278
1296
|
update(self, (current) => Chunk.appendAll(current, other))
|
|
1279
1297
|
)
|
|
1280
1298
|
|
|
@@ -1331,7 +1349,7 @@ export const prependAll: {
|
|
|
1331
1349
|
* @since 4.0.0
|
|
1332
1350
|
* @category combinators
|
|
1333
1351
|
*/
|
|
1334
|
-
<A>(other: Chunk.Chunk<A>): (self: TxChunk<A>) => Effect.Effect<void>
|
|
1352
|
+
<A>(other: Chunk.Chunk<A>): (self: TxChunk<A>) => Effect.Effect<void, never, Effect.Transaction>
|
|
1335
1353
|
/**
|
|
1336
1354
|
* Concatenates another chunk to the beginning of the `TxChunk`.
|
|
1337
1355
|
*
|
|
@@ -1358,10 +1376,10 @@ export const prependAll: {
|
|
|
1358
1376
|
* @since 4.0.0
|
|
1359
1377
|
* @category combinators
|
|
1360
1378
|
*/
|
|
1361
|
-
<A>(self: TxChunk<A>, other: Chunk.Chunk<A>): Effect.Effect<void>
|
|
1379
|
+
<A>(self: TxChunk<A>, other: Chunk.Chunk<A>): Effect.Effect<void, never, Effect.Transaction>
|
|
1362
1380
|
} = dual(
|
|
1363
1381
|
2,
|
|
1364
|
-
<A>(self: TxChunk<A>, other: Chunk.Chunk<A>): Effect.Effect<void> =>
|
|
1382
|
+
<A>(self: TxChunk<A>, other: Chunk.Chunk<A>): Effect.Effect<void, never, Effect.Transaction> =>
|
|
1365
1383
|
update(self, (current) => Chunk.prependAll(current, other))
|
|
1366
1384
|
)
|
|
1367
1385
|
|
|
@@ -1422,7 +1440,7 @@ export const concat: {
|
|
|
1422
1440
|
* })
|
|
1423
1441
|
* ```
|
|
1424
1442
|
*/
|
|
1425
|
-
<A>(other: TxChunk<A>): (self: TxChunk<A>) => Effect.Effect<void>
|
|
1443
|
+
<A>(other: TxChunk<A>): (self: TxChunk<A>) => Effect.Effect<void, never, Effect.Transaction>
|
|
1426
1444
|
/**
|
|
1427
1445
|
* Concatenates another `TxChunk` to the end of this `TxChunk`.
|
|
1428
1446
|
*
|
|
@@ -1451,11 +1469,12 @@ export const concat: {
|
|
|
1451
1469
|
* })
|
|
1452
1470
|
* ```
|
|
1453
1471
|
*/
|
|
1454
|
-
<A>(self: TxChunk<A>, other: TxChunk<A>): Effect.Effect<void>
|
|
1455
|
-
} = dual(
|
|
1456
|
-
|
|
1472
|
+
<A>(self: TxChunk<A>, other: TxChunk<A>): Effect.Effect<void, never, Effect.Transaction>
|
|
1473
|
+
} = dual(
|
|
1474
|
+
2,
|
|
1475
|
+
<A>(self: TxChunk<A>, other: TxChunk<A>): Effect.Effect<void, never, Effect.Transaction> =>
|
|
1457
1476
|
Effect.gen(function*() {
|
|
1458
1477
|
const otherChunk = yield* get(other)
|
|
1459
1478
|
yield* appendAll(self, otherChunk)
|
|
1460
1479
|
})
|
|
1461
|
-
|
|
1480
|
+
)
|