effect 2.3.8 → 2.4.0
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/cjs/BigInt.js +14 -1
- package/dist/cjs/BigInt.js.map +1 -1
- package/dist/cjs/Effect.js +16 -61
- package/dist/cjs/Effect.js.map +1 -1
- package/dist/cjs/Either.js +35 -6
- package/dist/cjs/Either.js.map +1 -1
- package/dist/cjs/Equal.js +1 -1
- package/dist/cjs/Equal.js.map +1 -1
- package/dist/cjs/Exit.js +1 -1
- package/dist/cjs/Number.js +25 -1
- package/dist/cjs/Number.js.map +1 -1
- package/dist/cjs/ReadonlyArray.js +2 -2
- package/dist/cjs/ReadonlyArray.js.map +1 -1
- package/dist/cjs/ReadonlyRecord.js +71 -76
- package/dist/cjs/ReadonlyRecord.js.map +1 -1
- package/dist/cjs/STM.js.map +1 -1
- package/dist/cjs/Schedule.js.map +1 -1
- package/dist/cjs/Sink.js.map +1 -1
- package/dist/cjs/Stream.js +3 -23
- package/dist/cjs/Stream.js.map +1 -1
- package/dist/cjs/Struct.js +3 -1
- package/dist/cjs/Struct.js.map +1 -1
- package/dist/cjs/TestAnnotation.js.map +1 -1
- package/dist/cjs/internal/channel/channelExecutor.js +5 -5
- package/dist/cjs/internal/channel/channelExecutor.js.map +1 -1
- package/dist/cjs/internal/channel/channelState.js +5 -5
- package/dist/cjs/internal/channel/channelState.js.map +1 -1
- package/dist/cjs/internal/channel.js.map +1 -1
- package/dist/cjs/internal/clock.js +3 -4
- package/dist/cjs/internal/clock.js.map +1 -1
- package/dist/cjs/internal/core-effect.js +6 -23
- package/dist/cjs/internal/core-effect.js.map +1 -1
- package/dist/cjs/internal/core.js +11 -27
- package/dist/cjs/internal/core.js.map +1 -1
- package/dist/cjs/internal/effect/circular.js +4 -5
- package/dist/cjs/internal/effect/circular.js.map +1 -1
- package/dist/cjs/internal/either.js +3 -3
- package/dist/cjs/internal/either.js.map +1 -1
- package/dist/cjs/internal/groupBy.js.map +1 -1
- package/dist/cjs/internal/layer.js +0 -2
- package/dist/cjs/internal/layer.js.map +1 -1
- package/dist/cjs/internal/runtime.js +12 -1
- package/dist/cjs/internal/runtime.js.map +1 -1
- package/dist/cjs/internal/schedule.js +4 -4
- package/dist/cjs/internal/schedule.js.map +1 -1
- package/dist/cjs/internal/sink.js +0 -2
- package/dist/cjs/internal/sink.js.map +1 -1
- package/dist/cjs/internal/stm/stm.js +1 -0
- package/dist/cjs/internal/stm/stm.js.map +1 -1
- package/dist/cjs/internal/stream.js +51 -64
- package/dist/cjs/internal/stream.js.map +1 -1
- package/dist/cjs/internal/version.js +1 -1
- package/dist/dts/BigInt.d.ts +7 -0
- package/dist/dts/BigInt.d.ts.map +1 -1
- package/dist/dts/Brand.d.ts +1 -1
- package/dist/dts/Brand.d.ts.map +1 -1
- package/dist/dts/Cause.d.ts +1 -1
- package/dist/dts/Cause.d.ts.map +1 -1
- package/dist/dts/Channel.d.ts +11 -11
- package/dist/dts/Channel.d.ts.map +1 -1
- package/dist/dts/Chunk.d.ts +3 -3
- package/dist/dts/Config.d.ts +4 -4
- package/dist/dts/Config.d.ts.map +1 -1
- package/dist/dts/Cron.d.ts +1 -1
- package/dist/dts/Cron.d.ts.map +1 -1
- package/dist/dts/Differ.d.ts +2 -2
- package/dist/dts/Differ.d.ts.map +1 -1
- package/dist/dts/Effect.d.ts +52 -108
- package/dist/dts/Effect.d.ts.map +1 -1
- package/dist/dts/Either.d.ts +126 -83
- package/dist/dts/Either.d.ts.map +1 -1
- package/dist/dts/Encoding.d.ts +6 -6
- package/dist/dts/Encoding.d.ts.map +1 -1
- package/dist/dts/Equal.d.ts.map +1 -1
- package/dist/dts/Exit.d.ts +2 -2
- package/dist/dts/Fiber.d.ts +2 -2
- package/dist/dts/Fiber.d.ts.map +1 -1
- package/dist/dts/GroupBy.d.ts +12 -12
- package/dist/dts/GroupBy.d.ts.map +1 -1
- package/dist/dts/Layer.d.ts +26 -26
- package/dist/dts/Layer.d.ts.map +1 -1
- package/dist/dts/List.d.ts +2 -2
- package/dist/dts/Logger.d.ts +4 -4
- package/dist/dts/Match.d.ts +2 -2
- package/dist/dts/Match.d.ts.map +1 -1
- package/dist/dts/MergeDecision.d.ts +1 -1
- package/dist/dts/MergeState.d.ts +5 -5
- package/dist/dts/MergeState.d.ts.map +1 -1
- package/dist/dts/Metric.d.ts +13 -13
- package/dist/dts/Metric.d.ts.map +1 -1
- package/dist/dts/MetricPolling.d.ts +4 -4
- package/dist/dts/MetricPolling.d.ts.map +1 -1
- package/dist/dts/Number.d.ts +8 -0
- package/dist/dts/Number.d.ts.map +1 -1
- package/dist/dts/Option.d.ts +11 -11
- package/dist/dts/ReadonlyArray.d.ts +9 -8
- package/dist/dts/ReadonlyArray.d.ts.map +1 -1
- package/dist/dts/ReadonlyRecord.d.ts +111 -94
- package/dist/dts/ReadonlyRecord.d.ts.map +1 -1
- package/dist/dts/Reloadable.d.ts +4 -4
- package/dist/dts/Reloadable.d.ts.map +1 -1
- package/dist/dts/RequestResolver.d.ts +13 -13
- package/dist/dts/RequestResolver.d.ts.map +1 -1
- package/dist/dts/Resource.d.ts +1 -1
- package/dist/dts/Resource.d.ts.map +1 -1
- package/dist/dts/STM.d.ts +144 -139
- package/dist/dts/STM.d.ts.map +1 -1
- package/dist/dts/Schedule.d.ts +171 -179
- package/dist/dts/Schedule.d.ts.map +1 -1
- package/dist/dts/SingleProducerAsyncInput.d.ts +1 -1
- package/dist/dts/SingleProducerAsyncInput.d.ts.map +1 -1
- package/dist/dts/Sink.d.ts +13 -13
- package/dist/dts/Sink.d.ts.map +1 -1
- package/dist/dts/Stream.d.ts +355 -366
- package/dist/dts/Stream.d.ts.map +1 -1
- package/dist/dts/Struct.d.ts +3 -3
- package/dist/dts/Struct.d.ts.map +1 -1
- package/dist/dts/SubscriptionRef.d.ts +2 -2
- package/dist/dts/TArray.d.ts +2 -2
- package/dist/dts/TDeferred.d.ts +3 -3
- package/dist/dts/TMap.d.ts +10 -10
- package/dist/dts/TSet.d.ts +4 -4
- package/dist/dts/Take.d.ts +2 -2
- package/dist/dts/TestAnnotation.d.ts +2 -2
- package/dist/dts/TestAnnotation.d.ts.map +1 -1
- package/dist/dts/Types.d.ts +7 -0
- package/dist/dts/Types.d.ts.map +1 -1
- package/dist/dts/internal/stm/stm.d.ts +2 -15
- package/dist/dts/internal/stm/stm.d.ts.map +1 -1
- package/dist/esm/BigInt.js +12 -0
- package/dist/esm/BigInt.js.map +1 -1
- package/dist/esm/Effect.js +13 -58
- package/dist/esm/Effect.js.map +1 -1
- package/dist/esm/Either.js +42 -5
- package/dist/esm/Either.js.map +1 -1
- package/dist/esm/Equal.js +1 -1
- package/dist/esm/Equal.js.map +1 -1
- package/dist/esm/Exit.js +1 -1
- package/dist/esm/Number.js +23 -0
- package/dist/esm/Number.js.map +1 -1
- package/dist/esm/ReadonlyArray.js +2 -2
- package/dist/esm/ReadonlyArray.js.map +1 -1
- package/dist/esm/ReadonlyRecord.js +70 -75
- package/dist/esm/ReadonlyRecord.js.map +1 -1
- package/dist/esm/STM.js.map +1 -1
- package/dist/esm/Schedule.js.map +1 -1
- package/dist/esm/Sink.js.map +1 -1
- package/dist/esm/Stream.js +5 -22
- package/dist/esm/Stream.js.map +1 -1
- package/dist/esm/Struct.js +3 -1
- package/dist/esm/Struct.js.map +1 -1
- package/dist/esm/TestAnnotation.js.map +1 -1
- package/dist/esm/internal/channel/channelExecutor.js +5 -5
- package/dist/esm/internal/channel/channelExecutor.js.map +1 -1
- package/dist/esm/internal/channel/channelState.js +3 -3
- package/dist/esm/internal/channel/channelState.js.map +1 -1
- package/dist/esm/internal/channel.js.map +1 -1
- package/dist/esm/internal/clock.js +3 -4
- package/dist/esm/internal/clock.js.map +1 -1
- package/dist/esm/internal/core-effect.js +4 -20
- package/dist/esm/internal/core-effect.js.map +1 -1
- package/dist/esm/internal/core.js +8 -22
- package/dist/esm/internal/core.js.map +1 -1
- package/dist/esm/internal/effect/circular.js +4 -5
- package/dist/esm/internal/effect/circular.js.map +1 -1
- package/dist/esm/internal/either.js +3 -3
- package/dist/esm/internal/either.js.map +1 -1
- package/dist/esm/internal/groupBy.js.map +1 -1
- package/dist/esm/internal/layer.js +0 -2
- package/dist/esm/internal/layer.js.map +1 -1
- package/dist/esm/internal/runtime.js +12 -1
- package/dist/esm/internal/runtime.js.map +1 -1
- package/dist/esm/internal/schedule.js +4 -4
- package/dist/esm/internal/schedule.js.map +1 -1
- package/dist/esm/internal/sink.js +0 -2
- package/dist/esm/internal/sink.js.map +1 -1
- package/dist/esm/internal/stm/stm.js +1 -0
- package/dist/esm/internal/stm/stm.js.map +1 -1
- package/dist/esm/internal/stream.js +49 -59
- package/dist/esm/internal/stream.js.map +1 -1
- package/dist/esm/internal/version.js +1 -1
- package/package.json +1 -1
- package/src/BigInt.ts +13 -0
- package/src/Brand.ts +4 -4
- package/src/Cause.ts +1 -1
- package/src/Channel.ts +17 -17
- package/src/Chunk.ts +4 -4
- package/src/Config.ts +4 -4
- package/src/Cron.ts +2 -2
- package/src/Differ.ts +2 -2
- package/src/Effect.ts +68 -145
- package/src/Either.ts +215 -133
- package/src/Encoding.ts +3 -3
- package/src/Equal.ts +1 -1
- package/src/Exit.ts +2 -2
- package/src/Fiber.ts +2 -2
- package/src/GroupBy.ts +16 -16
- package/src/Layer.ts +32 -32
- package/src/List.ts +3 -3
- package/src/Logger.ts +4 -4
- package/src/Match.ts +3 -3
- package/src/MergeDecision.ts +1 -1
- package/src/MergeState.ts +8 -8
- package/src/Metric.ts +13 -13
- package/src/MetricPolling.ts +9 -9
- package/src/Number.ts +26 -0
- package/src/Option.ts +17 -17
- package/src/ReadonlyArray.ts +23 -15
- package/src/ReadonlyRecord.ts +421 -265
- package/src/Reloadable.ts +4 -4
- package/src/RequestResolver.ts +19 -19
- package/src/Resource.ts +3 -3
- package/src/STM.ts +166 -213
- package/src/Schedule.ts +331 -361
- package/src/SingleProducerAsyncInput.ts +1 -1
- package/src/Sink.ts +19 -19
- package/src/Stream.ts +449 -456
- package/src/Struct.ts +8 -5
- package/src/SubscriptionRef.ts +2 -2
- package/src/TArray.ts +2 -2
- package/src/TDeferred.ts +4 -4
- package/src/TMap.ts +10 -10
- package/src/TSet.ts +4 -4
- package/src/Take.ts +4 -4
- package/src/TestAnnotation.ts +5 -8
- package/src/Types.ts +11 -0
- package/src/internal/blockedRequests.ts +2 -2
- package/src/internal/cause.ts +2 -2
- package/src/internal/channel/channelExecutor.ts +26 -26
- package/src/internal/channel/channelState.ts +13 -13
- package/src/internal/channel/mergeDecision.ts +1 -1
- package/src/internal/channel/mergeState.ts +6 -6
- package/src/internal/channel/singleProducerAsyncInput.ts +5 -5
- package/src/internal/channel.ts +43 -43
- package/src/internal/clock.ts +3 -4
- package/src/internal/config.ts +7 -7
- package/src/internal/configError.ts +1 -1
- package/src/internal/configProvider/pathPatch.ts +2 -2
- package/src/internal/configProvider.ts +1 -1
- package/src/internal/core-effect.ts +28 -43
- package/src/internal/core.ts +15 -40
- package/src/internal/dataSource.ts +26 -26
- package/src/internal/differ/orPatch.ts +7 -7
- package/src/internal/differ.ts +2 -2
- package/src/internal/effect/circular.ts +9 -10
- package/src/internal/either.ts +25 -22
- package/src/internal/encoding/base64.ts +1 -1
- package/src/internal/encoding/base64Url.ts +1 -1
- package/src/internal/encoding/hex.ts +1 -1
- package/src/internal/fiber.ts +2 -2
- package/src/internal/fiberRuntime.ts +9 -9
- package/src/internal/groupBy.ts +40 -40
- package/src/internal/layer/circular.ts +4 -4
- package/src/internal/layer.ts +52 -54
- package/src/internal/matcher.ts +5 -5
- package/src/internal/metric/polling.ts +8 -8
- package/src/internal/metric.ts +6 -6
- package/src/internal/reloadable.ts +4 -4
- package/src/internal/resource.ts +2 -2
- package/src/internal/runtime.ts +32 -19
- package/src/internal/schedule.ts +430 -500
- package/src/internal/sink.ts +27 -29
- package/src/internal/stm/core.ts +23 -23
- package/src/internal/stm/stm.ts +158 -157
- package/src/internal/stm/tArray.ts +3 -3
- package/src/internal/stm/tDeferred.ts +5 -5
- package/src/internal/stm/tMap.ts +13 -13
- package/src/internal/stm/tSet.ts +4 -4
- package/src/internal/stream.ts +688 -723
- package/src/internal/subscriptionRef.ts +3 -3
- package/src/internal/take.ts +6 -6
- package/src/internal/version.ts +1 -1
package/src/internal/channel.ts
CHANGED
|
@@ -182,8 +182,8 @@ export const catchAll = dual<
|
|
|
182
182
|
|
|
183
183
|
/** @internal */
|
|
184
184
|
export const concatMap = dual<
|
|
185
|
-
<OutElem, OutElem2, InElem2, OutErr2, InErr2,
|
|
186
|
-
f: (o: OutElem) => Channel.Channel<OutElem2, InElem2, OutErr2, InErr2,
|
|
185
|
+
<OutElem, OutElem2, InElem2, OutErr2, InErr2, X, InDone2, Env2>(
|
|
186
|
+
f: (o: OutElem) => Channel.Channel<OutElem2, InElem2, OutErr2, InErr2, X, InDone2, Env2>
|
|
187
187
|
) => <Env, InErr, InElem, InDone, OutErr, OutDone>(
|
|
188
188
|
self: Channel.Channel<OutElem, InElem, OutErr, InErr, OutDone, InDone, Env>
|
|
189
189
|
) => Channel.Channel<
|
|
@@ -195,9 +195,9 @@ export const concatMap = dual<
|
|
|
195
195
|
InDone & InDone2,
|
|
196
196
|
Env2 | Env
|
|
197
197
|
>,
|
|
198
|
-
<Env, InErr, InElem, InDone, OutErr, OutDone, OutElem, OutElem2, Env2, InErr2, InElem2, InDone2, OutErr2,
|
|
198
|
+
<Env, InErr, InElem, InDone, OutErr, OutDone, OutElem, OutElem2, Env2, InErr2, InElem2, InDone2, OutErr2, X>(
|
|
199
199
|
self: Channel.Channel<OutElem, InElem, OutErr, InErr, OutDone, InDone, Env>,
|
|
200
|
-
f: (o: OutElem) => Channel.Channel<OutElem2, InElem2, OutErr2, InErr2,
|
|
200
|
+
f: (o: OutElem) => Channel.Channel<OutElem2, InElem2, OutErr2, InErr2, X, InDone2, Env2>
|
|
201
201
|
) => Channel.Channel<
|
|
202
202
|
OutElem2,
|
|
203
203
|
InElem & InElem2,
|
|
@@ -207,9 +207,9 @@ export const concatMap = dual<
|
|
|
207
207
|
InDone & InDone2,
|
|
208
208
|
Env2 | Env
|
|
209
209
|
>
|
|
210
|
-
>(2, <Env, InErr, InElem, InDone, OutErr, OutDone, OutElem, OutElem2, Env2, InErr2, InElem2, InDone2, OutErr2,
|
|
210
|
+
>(2, <Env, InErr, InElem, InDone, OutErr, OutDone, OutElem, OutElem2, Env2, InErr2, InElem2, InDone2, OutErr2, X>(
|
|
211
211
|
self: Channel.Channel<OutElem, InElem, OutErr, InErr, OutDone, InDone, Env>,
|
|
212
|
-
f: (o: OutElem) => Channel.Channel<OutElem2, InElem2, OutErr2, InErr2,
|
|
212
|
+
f: (o: OutElem) => Channel.Channel<OutElem2, InElem2, OutErr2, InErr2, X, InDone2, Env2>
|
|
213
213
|
): Channel.Channel<
|
|
214
214
|
OutElem2,
|
|
215
215
|
InElem & InElem2,
|
|
@@ -660,9 +660,9 @@ export const foldChannel = dual<
|
|
|
660
660
|
}))
|
|
661
661
|
|
|
662
662
|
/** @internal */
|
|
663
|
-
export const fromEither = <
|
|
664
|
-
either: Either.Either<
|
|
665
|
-
): Channel.Channel<never, unknown,
|
|
663
|
+
export const fromEither = <R, L>(
|
|
664
|
+
either: Either.Either<R, L>
|
|
665
|
+
): Channel.Channel<never, unknown, L, unknown, R, unknown> =>
|
|
666
666
|
core.suspend(() => Either.match(either, { onLeft: core.fail, onRight: core.succeed }))
|
|
667
667
|
|
|
668
668
|
/** @internal */
|
|
@@ -679,13 +679,13 @@ export const fromInput = <Err, Elem, Done>(
|
|
|
679
679
|
|
|
680
680
|
/** @internal */
|
|
681
681
|
export const fromPubSub = <Done, Err, Elem>(
|
|
682
|
-
pubsub: PubSub.PubSub<Either.Either<Exit.Exit<Done, Err
|
|
682
|
+
pubsub: PubSub.PubSub<Either.Either<Elem, Exit.Exit<Done, Err>>>
|
|
683
683
|
): Channel.Channel<Elem, unknown, Err, unknown, Done, unknown> =>
|
|
684
684
|
unwrapScoped(Effect.map(PubSub.subscribe(pubsub), fromQueue))
|
|
685
685
|
|
|
686
686
|
/** @internal */
|
|
687
687
|
export const fromPubSubScoped = <Done, Err, Elem>(
|
|
688
|
-
pubsub: PubSub.PubSub<Either.Either<Exit.Exit<Done, Err
|
|
688
|
+
pubsub: PubSub.PubSub<Either.Either<Elem, Exit.Exit<Done, Err>>>
|
|
689
689
|
): Effect.Effect<Channel.Channel<Elem, unknown, Err, unknown, Done, unknown>, never, Scope.Scope> =>
|
|
690
690
|
Effect.map(PubSub.subscribe(pubsub), fromQueue)
|
|
691
691
|
|
|
@@ -702,12 +702,12 @@ export const fromOption = <A>(
|
|
|
702
702
|
|
|
703
703
|
/** @internal */
|
|
704
704
|
export const fromQueue = <Done, Err, Elem>(
|
|
705
|
-
queue: Queue.Dequeue<Either.Either<Exit.Exit<Done, Err
|
|
705
|
+
queue: Queue.Dequeue<Either.Either<Elem, Exit.Exit<Done, Err>>>
|
|
706
706
|
): Channel.Channel<Elem, unknown, Err, unknown, Done, unknown> => core.suspend(() => fromQueueInternal(queue))
|
|
707
707
|
|
|
708
708
|
/** @internal */
|
|
709
709
|
const fromQueueInternal = <Done, Err, Elem>(
|
|
710
|
-
queue: Queue.Dequeue<Either.Either<Exit.Exit<Done, Err
|
|
710
|
+
queue: Queue.Dequeue<Either.Either<Elem, Exit.Exit<Done, Err>>>
|
|
711
711
|
): Channel.Channel<Elem, unknown, Err, unknown, Done, unknown> =>
|
|
712
712
|
pipe(
|
|
713
713
|
core.fromEffect(Queue.take(queue)),
|
|
@@ -912,7 +912,7 @@ export const mapOutEffectPar = dual<
|
|
|
912
912
|
Effect.gen(function*($) {
|
|
913
913
|
const queue = yield* $(
|
|
914
914
|
Effect.acquireRelease(
|
|
915
|
-
Queue.bounded<Effect.Effect<Either.Either<
|
|
915
|
+
Queue.bounded<Effect.Effect<Either.Either<OutElem1, OutDone>, OutErr | OutErr1, Env1>>(n),
|
|
916
916
|
(queue) => Queue.shutdown(queue)
|
|
917
917
|
)
|
|
918
918
|
)
|
|
@@ -1143,7 +1143,7 @@ export const mergeAllWith = (
|
|
|
1143
1143
|
const queueReader = fromInput(input)
|
|
1144
1144
|
const queue = yield* $(
|
|
1145
1145
|
Effect.acquireRelease(
|
|
1146
|
-
Queue.bounded<Effect.Effect<Either.Either<
|
|
1146
|
+
Queue.bounded<Effect.Effect<Either.Either<OutElem, OutDone>, OutErr | OutErr1, Env>>(bufferSize),
|
|
1147
1147
|
(queue) => Queue.shutdown(queue)
|
|
1148
1148
|
)
|
|
1149
1149
|
)
|
|
@@ -1159,7 +1159,7 @@ export const mergeAllWith = (
|
|
|
1159
1159
|
.withPermits
|
|
1160
1160
|
const pull = yield* $(toPull(channels))
|
|
1161
1161
|
const evaluatePull = (
|
|
1162
|
-
pull: Effect.Effect<Either.Either<
|
|
1162
|
+
pull: Effect.Effect<Either.Either<OutElem, OutDone>, OutErr | OutErr1, Env | Env1>
|
|
1163
1163
|
) =>
|
|
1164
1164
|
pipe(
|
|
1165
1165
|
Effect.flatMap(
|
|
@@ -1622,9 +1622,9 @@ export const mergeWith = dual<
|
|
|
1622
1622
|
>
|
|
1623
1623
|
|
|
1624
1624
|
const handleSide = <Err, Done, Err2, Done2>(
|
|
1625
|
-
exit: Exit.Exit<Either.Either<
|
|
1626
|
-
fiber: Fiber.Fiber<Either.Either<
|
|
1627
|
-
pull: Effect.Effect<Either.Either<
|
|
1625
|
+
exit: Exit.Exit<Either.Either<OutElem | OutElem1, Done>, Err>,
|
|
1626
|
+
fiber: Fiber.Fiber<Either.Either<OutElem | OutElem1, Done2>, Err2>,
|
|
1627
|
+
pull: Effect.Effect<Either.Either<OutElem | OutElem1, Done>, Err, Env | Env1>
|
|
1628
1628
|
) =>
|
|
1629
1629
|
(
|
|
1630
1630
|
done: (
|
|
@@ -1637,8 +1637,8 @@ export const mergeWith = dual<
|
|
|
1637
1637
|
OutDone2 | OutDone3
|
|
1638
1638
|
>,
|
|
1639
1639
|
both: (
|
|
1640
|
-
f1: Fiber.Fiber<Either.Either<
|
|
1641
|
-
f2: Fiber.Fiber<Either.Either<
|
|
1640
|
+
f1: Fiber.Fiber<Either.Either<OutElem | OutElem1, Done>, Err>,
|
|
1641
|
+
f2: Fiber.Fiber<Either.Either<OutElem | OutElem1, Done2>, Err2>
|
|
1642
1642
|
) => State,
|
|
1643
1643
|
single: (
|
|
1644
1644
|
f: (
|
|
@@ -2021,21 +2021,21 @@ export const mapInputContext = dual<
|
|
|
2021
2021
|
|
|
2022
2022
|
/** @internal */
|
|
2023
2023
|
export const provideSomeLayer = dual<
|
|
2024
|
-
<
|
|
2025
|
-
layer: Layer.Layer<
|
|
2024
|
+
<R2, OutErr2, Env0>(
|
|
2025
|
+
layer: Layer.Layer<R2, OutErr2, Env0>
|
|
2026
2026
|
) => <OutElem, InElem, OutErr, InErr, OutDone, InDone, R>(
|
|
2027
2027
|
self: Channel.Channel<OutElem, InElem, OutErr, InErr, OutDone, InDone, R>
|
|
2028
|
-
) => Channel.Channel<OutElem, InElem, OutErr2 | OutErr, InErr, OutDone, InDone, Env0 | Exclude<R,
|
|
2029
|
-
<OutElem, InElem, OutErr, InErr, OutDone, InDone, R,
|
|
2028
|
+
) => Channel.Channel<OutElem, InElem, OutErr2 | OutErr, InErr, OutDone, InDone, Env0 | Exclude<R, R2>>,
|
|
2029
|
+
<OutElem, InElem, OutErr, InErr, OutDone, InDone, R, R2, OutErr2, Env0>(
|
|
2030
2030
|
self: Channel.Channel<OutElem, InElem, OutErr, InErr, OutDone, InDone, R>,
|
|
2031
|
-
layer: Layer.Layer<
|
|
2032
|
-
) => Channel.Channel<OutElem, InElem, OutErr2 | OutErr, InErr, OutDone, InDone, Env0 | Exclude<R,
|
|
2033
|
-
>(2, <OutElem, InElem, OutErr, InErr, OutDone, InDone, R,
|
|
2031
|
+
layer: Layer.Layer<R2, OutErr2, Env0>
|
|
2032
|
+
) => Channel.Channel<OutElem, InElem, OutErr2 | OutErr, InErr, OutDone, InDone, Env0 | Exclude<R, R2>>
|
|
2033
|
+
>(2, <OutElem, InElem, OutErr, InErr, OutDone, InDone, R, R2, OutErr2, Env0>(
|
|
2034
2034
|
self: Channel.Channel<OutElem, InElem, OutErr, InErr, OutDone, InDone, R>,
|
|
2035
|
-
layer: Layer.Layer<
|
|
2036
|
-
): Channel.Channel<OutElem, InElem, OutErr | OutErr2, InErr, OutDone, InDone, Env0 | Exclude<R,
|
|
2035
|
+
layer: Layer.Layer<R2, OutErr2, Env0>
|
|
2036
|
+
): Channel.Channel<OutElem, InElem, OutErr | OutErr2, InErr, OutDone, InDone, Env0 | Exclude<R, R2>> =>
|
|
2037
2037
|
// @ts-expect-error
|
|
2038
|
-
provideLayer(self, Layer.merge(Layer.context<Exclude<R,
|
|
2038
|
+
provideLayer(self, Layer.merge(Layer.context<Exclude<R, R2>>(), layer)))
|
|
2039
2039
|
|
|
2040
2040
|
/** @internal */
|
|
2041
2041
|
export const read = <In>(): Channel.Channel<never, In, Option.Option<never>, unknown, In, unknown> =>
|
|
@@ -2107,13 +2107,13 @@ export const serviceWithEffect = <T extends Context.Tag<any, any>>(tag: T) =>
|
|
|
2107
2107
|
|
|
2108
2108
|
/** @internal */
|
|
2109
2109
|
export const toPubSub = <Done, Err, Elem>(
|
|
2110
|
-
pubsub: PubSub.PubSub<Either.Either<Exit.Exit<Done, Err
|
|
2110
|
+
pubsub: PubSub.PubSub<Either.Either<Elem, Exit.Exit<Done, Err>>>
|
|
2111
2111
|
): Channel.Channel<never, Elem, never, Err, unknown, Done> => toQueue(pubsub)
|
|
2112
2112
|
|
|
2113
2113
|
/** @internal */
|
|
2114
2114
|
export const toPull = <OutElem, InElem, OutErr, InErr, OutDone, InDone, Env>(
|
|
2115
2115
|
self: Channel.Channel<OutElem, InElem, OutErr, InErr, OutDone, InDone, Env>
|
|
2116
|
-
): Effect.Effect<Effect.Effect<Either.Either<
|
|
2116
|
+
): Effect.Effect<Effect.Effect<Either.Either<OutElem, OutDone>, OutErr, Env>, never, Env | Scope.Scope> =>
|
|
2117
2117
|
Effect.map(
|
|
2118
2118
|
Effect.acquireRelease(
|
|
2119
2119
|
Effect.sync(() => new executor.ChannelExecutor(self, void 0, identity)),
|
|
@@ -2122,20 +2122,20 @@ export const toPull = <OutElem, InElem, OutErr, InErr, OutDone, InDone, Env>(
|
|
|
2122
2122
|
return finalize === undefined ? Effect.unit : finalize
|
|
2123
2123
|
}
|
|
2124
2124
|
),
|
|
2125
|
-
(exec) => Effect.suspend(() => interpretToPull(exec.run() as ChannelState.ChannelState<
|
|
2125
|
+
(exec) => Effect.suspend(() => interpretToPull(exec.run() as ChannelState.ChannelState<OutErr, Env>, exec))
|
|
2126
2126
|
)
|
|
2127
2127
|
|
|
2128
2128
|
/** @internal */
|
|
2129
2129
|
const interpretToPull = <Env, InErr, InElem, InDone, OutErr, OutElem, OutDone>(
|
|
2130
|
-
channelState: ChannelState.ChannelState<
|
|
2130
|
+
channelState: ChannelState.ChannelState<OutErr, Env>,
|
|
2131
2131
|
exec: executor.ChannelExecutor<OutElem, InElem, OutErr, InErr, OutDone, InDone, Env>
|
|
2132
|
-
): Effect.Effect<Either.Either<
|
|
2132
|
+
): Effect.Effect<Either.Either<OutElem, OutDone>, OutErr, Env> => {
|
|
2133
2133
|
const state = channelState as ChannelState.Primitive
|
|
2134
2134
|
switch (state._tag) {
|
|
2135
2135
|
case ChannelStateOpCodes.OP_DONE: {
|
|
2136
2136
|
return Exit.match(exec.getDone(), {
|
|
2137
2137
|
onFailure: Effect.failCause,
|
|
2138
|
-
onSuccess: (done): Effect.Effect<Either.Either<
|
|
2138
|
+
onSuccess: (done): Effect.Effect<Either.Either<OutElem, OutDone>, OutErr, Env> =>
|
|
2139
2139
|
Effect.succeed(Either.left(done))
|
|
2140
2140
|
})
|
|
2141
2141
|
}
|
|
@@ -2144,15 +2144,15 @@ const interpretToPull = <Env, InErr, InElem, InDone, OutErr, OutElem, OutDone>(
|
|
|
2144
2144
|
}
|
|
2145
2145
|
case ChannelStateOpCodes.OP_FROM_EFFECT: {
|
|
2146
2146
|
return pipe(
|
|
2147
|
-
state.effect as Effect.Effect<Either.Either<
|
|
2148
|
-
Effect.flatMap(() => interpretToPull(exec.run() as ChannelState.ChannelState<
|
|
2147
|
+
state.effect as Effect.Effect<Either.Either<OutElem, OutDone>, OutErr, Env>,
|
|
2148
|
+
Effect.flatMap(() => interpretToPull(exec.run() as ChannelState.ChannelState<OutErr, Env>, exec))
|
|
2149
2149
|
)
|
|
2150
2150
|
}
|
|
2151
2151
|
case ChannelStateOpCodes.OP_READ: {
|
|
2152
2152
|
return executor.readUpstream(
|
|
2153
2153
|
state,
|
|
2154
|
-
() => interpretToPull(exec.run() as ChannelState.ChannelState<
|
|
2155
|
-
(cause) => Effect.failCause(cause) as Effect.Effect<Either.Either<
|
|
2154
|
+
() => interpretToPull(exec.run() as ChannelState.ChannelState<OutErr, Env>, exec),
|
|
2155
|
+
(cause) => Effect.failCause(cause) as Effect.Effect<Either.Either<OutElem, OutDone>, OutErr, Env>
|
|
2156
2156
|
)
|
|
2157
2157
|
}
|
|
2158
2158
|
}
|
|
@@ -2160,12 +2160,12 @@ const interpretToPull = <Env, InErr, InElem, InDone, OutErr, OutElem, OutDone>(
|
|
|
2160
2160
|
|
|
2161
2161
|
/** @internal */
|
|
2162
2162
|
export const toQueue = <Done, Err, Elem>(
|
|
2163
|
-
queue: Queue.Enqueue<Either.Either<Exit.Exit<Done, Err
|
|
2163
|
+
queue: Queue.Enqueue<Either.Either<Elem, Exit.Exit<Done, Err>>>
|
|
2164
2164
|
): Channel.Channel<never, Elem, never, Err, unknown, Done> => core.suspend(() => toQueueInternal(queue))
|
|
2165
2165
|
|
|
2166
2166
|
/** @internal */
|
|
2167
2167
|
const toQueueInternal = <Err, Done, Elem>(
|
|
2168
|
-
queue: Queue.Enqueue<Either.Either<Exit.Exit<Done, Err
|
|
2168
|
+
queue: Queue.Enqueue<Either.Either<Elem, Exit.Exit<Done, Err>>>
|
|
2169
2169
|
): Channel.Channel<never, Elem, never, Err, unknown, Done> => {
|
|
2170
2170
|
return core.readWithCause({
|
|
2171
2171
|
onInput: (elem) =>
|
package/src/internal/clock.ts
CHANGED
|
@@ -2,7 +2,6 @@ import type * as Clock from "../Clock.js"
|
|
|
2
2
|
import * as Context from "../Context.js"
|
|
3
3
|
import * as Duration from "../Duration.js"
|
|
4
4
|
import type * as Effect from "../Effect.js"
|
|
5
|
-
import * as Either from "../Either.js"
|
|
6
5
|
import { constFalse } from "../Function.js"
|
|
7
6
|
import * as core from "./core.js"
|
|
8
7
|
|
|
@@ -85,9 +84,9 @@ class ClockImpl implements Clock.Clock {
|
|
|
85
84
|
}
|
|
86
85
|
|
|
87
86
|
sleep(duration: Duration.Duration): Effect.Effect<void> {
|
|
88
|
-
return core.
|
|
89
|
-
const canceler = globalClockScheduler.unsafeSchedule(() =>
|
|
90
|
-
return
|
|
87
|
+
return core.async<void>((resume) => {
|
|
88
|
+
const canceler = globalClockScheduler.unsafeSchedule(() => resume(core.unit), duration)
|
|
89
|
+
return core.asUnit(core.sync(canceler))
|
|
91
90
|
})
|
|
92
91
|
}
|
|
93
92
|
}
|
package/src/internal/config.ts
CHANGED
|
@@ -60,7 +60,7 @@ export type Op<Tag extends string, Body = {}> = Config.Config<never> & Body & {
|
|
|
60
60
|
export interface Constant extends
|
|
61
61
|
Op<OpCodes.OP_CONSTANT, {
|
|
62
62
|
readonly value: unknown
|
|
63
|
-
parse(text: string): Either.Either<ConfigError.ConfigError
|
|
63
|
+
parse(text: string): Either.Either<unknown, ConfigError.ConfigError>
|
|
64
64
|
}>
|
|
65
65
|
{}
|
|
66
66
|
|
|
@@ -85,7 +85,7 @@ export interface Fallback extends
|
|
|
85
85
|
export interface Fail extends
|
|
86
86
|
Op<OpCodes.OP_FAIL, {
|
|
87
87
|
readonly message: string
|
|
88
|
-
parse(text: string): Either.Either<ConfigError.ConfigError
|
|
88
|
+
parse(text: string): Either.Either<unknown, ConfigError.ConfigError>
|
|
89
89
|
}>
|
|
90
90
|
{}
|
|
91
91
|
|
|
@@ -100,7 +100,7 @@ export interface Lazy extends
|
|
|
100
100
|
export interface MapOrFail extends
|
|
101
101
|
Op<OpCodes.OP_MAP_OR_FAIL, {
|
|
102
102
|
readonly original: Config.Config<unknown>
|
|
103
|
-
mapOrFail(value: unknown): Either.Either<ConfigError.ConfigError
|
|
103
|
+
mapOrFail(value: unknown): Either.Either<unknown, ConfigError.ConfigError>
|
|
104
104
|
}>
|
|
105
105
|
{}
|
|
106
106
|
|
|
@@ -116,7 +116,7 @@ export interface Nested extends
|
|
|
116
116
|
export interface Primitive extends
|
|
117
117
|
Op<OpCodes.OP_PRIMITIVE, {
|
|
118
118
|
readonly description: string
|
|
119
|
-
parse(text: string): Either.Either<ConfigError.ConfigError
|
|
119
|
+
parse(text: string): Either.Either<unknown, ConfigError.ConfigError>
|
|
120
120
|
}>
|
|
121
121
|
{}
|
|
122
122
|
|
|
@@ -314,8 +314,8 @@ export const mapAttempt = dual<
|
|
|
314
314
|
|
|
315
315
|
/** @internal */
|
|
316
316
|
export const mapOrFail = dual<
|
|
317
|
-
<A, B>(f: (a: A) => Either.Either<ConfigError.ConfigError
|
|
318
|
-
<A, B>(self: Config.Config<A>, f: (a: A) => Either.Either<ConfigError.ConfigError
|
|
317
|
+
<A, B>(f: (a: A) => Either.Either<B, ConfigError.ConfigError>) => (self: Config.Config<A>) => Config.Config<B>,
|
|
318
|
+
<A, B>(self: Config.Config<A>, f: (a: A) => Either.Either<B, ConfigError.ConfigError>) => Config.Config<B>
|
|
319
319
|
>(2, (self, f) => {
|
|
320
320
|
const mapOrFail = Object.create(proto)
|
|
321
321
|
mapOrFail._tag = OpCodes.OP_MAP_OR_FAIL
|
|
@@ -385,7 +385,7 @@ export const option = <A>(self: Config.Config<A>): Config.Config<Option.Option<A
|
|
|
385
385
|
/** @internal */
|
|
386
386
|
export const primitive = <A>(
|
|
387
387
|
description: string,
|
|
388
|
-
parse: (text: string) => Either.Either<ConfigError.ConfigError
|
|
388
|
+
parse: (text: string) => Either.Either<A, ConfigError.ConfigError>
|
|
389
389
|
): Config.Config<A> => {
|
|
390
390
|
const primitive = Object.create(proto)
|
|
391
391
|
primitive._tag = OpCodes.OP_PRIMITIVE
|
|
@@ -215,7 +215,7 @@ export const reduceWithContext = dual<
|
|
|
215
215
|
<C, Z>(self: ConfigError.ConfigError, context: C, reducer: ConfigError.ConfigErrorReducer<C, Z>) => Z
|
|
216
216
|
>(3, <C, Z>(self: ConfigError.ConfigError, context: C, reducer: ConfigError.ConfigErrorReducer<C, Z>) => {
|
|
217
217
|
const input: Array<ConfigError.ConfigError> = [self]
|
|
218
|
-
const output: Array<Either.Either<
|
|
218
|
+
const output: Array<Either.Either<Z, ConfigErrorCase>> = []
|
|
219
219
|
while (input.length > 0) {
|
|
220
220
|
const error = input.pop()!
|
|
221
221
|
switch (error._tag) {
|
|
@@ -46,11 +46,11 @@ export const patch = dual<
|
|
|
46
46
|
patch: PathPatch.PathPatch
|
|
47
47
|
) => (
|
|
48
48
|
path: ReadonlyArray<string>
|
|
49
|
-
) => Either.Either<ConfigError.ConfigError
|
|
49
|
+
) => Either.Either<ReadonlyArray<string>, ConfigError.ConfigError>,
|
|
50
50
|
(
|
|
51
51
|
path: ReadonlyArray<string>,
|
|
52
52
|
patch: PathPatch.PathPatch
|
|
53
|
-
) => Either.Either<ConfigError.ConfigError
|
|
53
|
+
) => Either.Either<ReadonlyArray<string>, ConfigError.ConfigError>
|
|
54
54
|
>(2, (path, patch) => {
|
|
55
55
|
let input: List.List<PathPatch.PathPatch> = List.of(patch)
|
|
56
56
|
let output: ReadonlyArray<string> = path
|
|
@@ -438,7 +438,7 @@ const fromFlatLoop = <A>(
|
|
|
438
438
|
}
|
|
439
439
|
|
|
440
440
|
const fromFlatLoopFail =
|
|
441
|
-
(prefix: ReadonlyArray<string>, path: string) => (index: number): Either.Either<ConfigError.ConfigError
|
|
441
|
+
(prefix: ReadonlyArray<string>, path: string) => (index: number): Either.Either<unknown, ConfigError.ConfigError> =>
|
|
442
442
|
Either.left(
|
|
443
443
|
configError.MissingData(
|
|
444
444
|
prefix,
|
|
@@ -4,9 +4,8 @@ import * as Clock from "../Clock.js"
|
|
|
4
4
|
import * as Context from "../Context.js"
|
|
5
5
|
import * as Duration from "../Duration.js"
|
|
6
6
|
import type * as Effect from "../Effect.js"
|
|
7
|
-
import * as Either from "../Either.js"
|
|
8
7
|
import type * as Fiber from "../Fiber.js"
|
|
9
|
-
import * as FiberId from "../FiberId.js"
|
|
8
|
+
import type * as FiberId from "../FiberId.js"
|
|
10
9
|
import type * as FiberRef from "../FiberRef.js"
|
|
11
10
|
import * as FiberRefs from "../FiberRefs.js"
|
|
12
11
|
import type * as FiberRefsPatch from "../FiberRefsPatch.js"
|
|
@@ -26,7 +25,7 @@ import * as ReadonlyArray from "../ReadonlyArray.js"
|
|
|
26
25
|
import * as Ref from "../Ref.js"
|
|
27
26
|
import type * as runtimeFlagsPatch from "../RuntimeFlagsPatch.js"
|
|
28
27
|
import * as Tracer from "../Tracer.js"
|
|
29
|
-
import type { NoInfer } from "../Types.js"
|
|
28
|
+
import type { MergeRecord, NoInfer } from "../Types.js"
|
|
30
29
|
import * as internalCause from "./cause.js"
|
|
31
30
|
import * as core from "./core.js"
|
|
32
31
|
import * as defaultServices from "./defaultServices.js"
|
|
@@ -75,26 +74,6 @@ export const asSome = <A, E, R>(self: Effect.Effect<A, E, R>): Effect.Effect<Opt
|
|
|
75
74
|
export const asSomeError = <A, E, R>(self: Effect.Effect<A, E, R>): Effect.Effect<A, Option.Option<E>, R> =>
|
|
76
75
|
core.mapError(self, Option.some)
|
|
77
76
|
|
|
78
|
-
/* @internal */
|
|
79
|
-
export const asyncOption = <A, E = never, R = never>(
|
|
80
|
-
register: (callback: (_: Effect.Effect<A, E, R>) => void) => Option.Option<Effect.Effect<A, E, R>>,
|
|
81
|
-
blockingOn: FiberId.FiberId = FiberId.none
|
|
82
|
-
): Effect.Effect<A, E, R> =>
|
|
83
|
-
core.asyncEither(
|
|
84
|
-
(cb) => {
|
|
85
|
-
const option = register(cb)
|
|
86
|
-
switch (option._tag) {
|
|
87
|
-
case "None": {
|
|
88
|
-
return Either.left(core.unit)
|
|
89
|
-
}
|
|
90
|
-
case "Some": {
|
|
91
|
-
return Either.right(option.value)
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
},
|
|
95
|
-
blockingOn
|
|
96
|
-
)
|
|
97
|
-
|
|
98
77
|
/* @internal */
|
|
99
78
|
export const try_: {
|
|
100
79
|
<A, E>(options: {
|
|
@@ -168,10 +147,13 @@ export const catchAllDefect = dual<
|
|
|
168
147
|
self: Effect.Effect<A, E, R>,
|
|
169
148
|
f: (defect: unknown) => Effect.Effect<A2, E2, R2>
|
|
170
149
|
) => Effect.Effect<A | A2, E | E2, R | R2>
|
|
171
|
-
>(2,
|
|
150
|
+
>(2, <A, E, R, A2, E2, R2>(
|
|
151
|
+
self: Effect.Effect<A, E, R>,
|
|
152
|
+
f: (defect: unknown) => Effect.Effect<A2, E2, R2>
|
|
153
|
+
): Effect.Effect<A | A2, E | E2, R | R2> =>
|
|
172
154
|
core.catchAllCause(
|
|
173
155
|
self,
|
|
174
|
-
|
|
156
|
+
(cause): Effect.Effect<A | A2, E | E2, R | R2> => {
|
|
175
157
|
const option = internalCause.find(cause, (_) => internalCause.isDieType(_) ? Option.some(_) : Option.none())
|
|
176
158
|
switch (option._tag) {
|
|
177
159
|
case "None": {
|
|
@@ -181,7 +163,7 @@ export const catchAllDefect = dual<
|
|
|
181
163
|
return f(option.value.defect)
|
|
182
164
|
}
|
|
183
165
|
}
|
|
184
|
-
}
|
|
166
|
+
}
|
|
185
167
|
))
|
|
186
168
|
|
|
187
169
|
/* @internal */
|
|
@@ -226,10 +208,13 @@ export const catchSomeDefect = dual<
|
|
|
226
208
|
) => Effect.Effect<A | A2, E | E2, R | R2>
|
|
227
209
|
>(
|
|
228
210
|
2,
|
|
229
|
-
|
|
211
|
+
<A, E, R, A2, E2, R2>(
|
|
212
|
+
self: Effect.Effect<A, E, R>,
|
|
213
|
+
pf: (defect: unknown) => Option.Option<Effect.Effect<A2, E2, R2>>
|
|
214
|
+
): Effect.Effect<A | A2, E | E2, R | R2> =>
|
|
230
215
|
core.catchAllCause(
|
|
231
216
|
self,
|
|
232
|
-
|
|
217
|
+
(cause): Effect.Effect<A | A2, E | E2, R | R2> => {
|
|
233
218
|
const option = internalCause.find(cause, (_) => internalCause.isDieType(_) ? Option.some(_) : Option.none())
|
|
234
219
|
switch (option._tag) {
|
|
235
220
|
case "None": {
|
|
@@ -240,7 +225,7 @@ export const catchSomeDefect = dual<
|
|
|
240
225
|
return optionEffect._tag === "Some" ? optionEffect.value : core.failCause(cause)
|
|
241
226
|
}
|
|
242
227
|
}
|
|
243
|
-
}
|
|
228
|
+
}
|
|
244
229
|
)
|
|
245
230
|
)
|
|
246
231
|
|
|
@@ -386,21 +371,21 @@ export const bind: {
|
|
|
386
371
|
<N extends string, K, A, E2, R2>(
|
|
387
372
|
tag: Exclude<N, keyof K>,
|
|
388
373
|
f: (_: K) => Effect.Effect<A, E2, R2>
|
|
389
|
-
): <E, R>(self: Effect.Effect<K, E, R>) => Effect.Effect<
|
|
374
|
+
): <E, R>(self: Effect.Effect<K, E, R>) => Effect.Effect<MergeRecord<K, { [k in N]: A }>, E2 | E, R2 | R>
|
|
390
375
|
<K, E, R, N extends string, A, E2, R2>(
|
|
391
376
|
self: Effect.Effect<K, E, R>,
|
|
392
377
|
tag: Exclude<N, keyof K>,
|
|
393
378
|
f: (_: K) => Effect.Effect<A, E2, R2>
|
|
394
|
-
): Effect.Effect<
|
|
379
|
+
): Effect.Effect<MergeRecord<K, { [k in N]: A }>, E2 | E, R2 | R>
|
|
395
380
|
} = dual(3, <K, E, R, N extends string, A, E2, R2>(
|
|
396
381
|
self: Effect.Effect<K, E, R>,
|
|
397
382
|
tag: Exclude<N, keyof K>,
|
|
398
383
|
f: (_: K) => Effect.Effect<A, E2, R2>
|
|
399
|
-
): Effect.Effect<
|
|
384
|
+
): Effect.Effect<MergeRecord<K, { [k in N]: A }>, E2 | E, R2 | R> =>
|
|
400
385
|
core.flatMap(self, (k) =>
|
|
401
386
|
core.map(
|
|
402
387
|
f(k),
|
|
403
|
-
(a):
|
|
388
|
+
(a): MergeRecord<K, { [k in N]: A }> => ({ ...k, [tag]: a } as any)
|
|
404
389
|
)))
|
|
405
390
|
|
|
406
391
|
/* @internal */
|
|
@@ -418,20 +403,20 @@ export const let_: {
|
|
|
418
403
|
<N extends string, K, A>(
|
|
419
404
|
tag: Exclude<N, keyof K>,
|
|
420
405
|
f: (_: K) => A
|
|
421
|
-
): <E, R>(self: Effect.Effect<K, E, R>) => Effect.Effect<
|
|
406
|
+
): <E, R>(self: Effect.Effect<K, E, R>) => Effect.Effect<MergeRecord<K, { [k in N]: A }>, E, R>
|
|
422
407
|
<K, E, R, N extends string, A>(
|
|
423
408
|
self: Effect.Effect<K, E, R>,
|
|
424
409
|
tag: Exclude<N, keyof K>,
|
|
425
410
|
f: (_: K) => A
|
|
426
|
-
): Effect.Effect<
|
|
411
|
+
): Effect.Effect<MergeRecord<K, { [k in N]: A }>, E, R>
|
|
427
412
|
} = dual(3, <K, E, R, N extends string, A>(
|
|
428
413
|
self: Effect.Effect<K, E, R>,
|
|
429
414
|
tag: Exclude<N, keyof K>,
|
|
430
415
|
f: (_: K) => A
|
|
431
|
-
): Effect.Effect<
|
|
416
|
+
): Effect.Effect<MergeRecord<K, { [k in N]: A }>, E, R> =>
|
|
432
417
|
core.map(
|
|
433
418
|
self,
|
|
434
|
-
(k):
|
|
419
|
+
(k): MergeRecord<K, { [k in N]: A }> => ({ ...k, [tag]: f(k) } as any)
|
|
435
420
|
))
|
|
436
421
|
|
|
437
422
|
/* @internal */
|
|
@@ -1012,7 +997,7 @@ export const loop: {
|
|
|
1012
997
|
? loopDiscard(initial, options.while, options.step, options.body)
|
|
1013
998
|
: core.map(loopInternal(initial, options.while, options.step, options.body), Array.from)
|
|
1014
999
|
|
|
1015
|
-
const loopInternal = <Z,
|
|
1000
|
+
const loopInternal = <Z, A, E, R>(
|
|
1016
1001
|
initial: Z,
|
|
1017
1002
|
cont: Predicate.Predicate<Z>,
|
|
1018
1003
|
inc: (z: Z) => Z,
|
|
@@ -1125,7 +1110,7 @@ export const merge = <A, E, R>(self: Effect.Effect<A, E, R>): Effect.Effect<E |
|
|
|
1125
1110
|
})
|
|
1126
1111
|
|
|
1127
1112
|
/* @internal */
|
|
1128
|
-
export const negate = <
|
|
1113
|
+
export const negate = <E, R>(self: Effect.Effect<boolean, E, R>): Effect.Effect<boolean, E, R> =>
|
|
1129
1114
|
core.map(self, (b) => !b)
|
|
1130
1115
|
|
|
1131
1116
|
/* @internal */
|
|
@@ -1297,14 +1282,14 @@ export const reduceRight = dual<
|
|
|
1297
1282
|
|
|
1298
1283
|
/* @internal */
|
|
1299
1284
|
export const reduceWhile = dual<
|
|
1300
|
-
<
|
|
1285
|
+
<Z, A, E, R>(
|
|
1301
1286
|
zero: Z,
|
|
1302
1287
|
options: {
|
|
1303
1288
|
readonly while: Predicate.Predicate<Z>
|
|
1304
1289
|
readonly body: (s: Z, a: A, i: number) => Effect.Effect<Z, E, R>
|
|
1305
1290
|
}
|
|
1306
1291
|
) => (elements: Iterable<A>) => Effect.Effect<Z, E, R>,
|
|
1307
|
-
<A,
|
|
1292
|
+
<A, Z, E, R>(
|
|
1308
1293
|
elements: Iterable<A>,
|
|
1309
1294
|
zero: Z,
|
|
1310
1295
|
options: {
|
|
@@ -1312,7 +1297,7 @@ export const reduceWhile = dual<
|
|
|
1312
1297
|
readonly body: (s: Z, a: A, i: number) => Effect.Effect<Z, E, R>
|
|
1313
1298
|
}
|
|
1314
1299
|
) => Effect.Effect<Z, E, R>
|
|
1315
|
-
>(3, <A,
|
|
1300
|
+
>(3, <A, Z, E, R>(
|
|
1316
1301
|
elements: Iterable<A>,
|
|
1317
1302
|
zero: Z,
|
|
1318
1303
|
options: {
|
|
@@ -1867,7 +1852,7 @@ export const withMetric = dual<
|
|
|
1867
1852
|
>(2, (self, metric) => metric(self))
|
|
1868
1853
|
|
|
1869
1854
|
/** @internal */
|
|
1870
|
-
export const serviceFunctionEffect = <T extends Effect.Effect<any, any, any>, Args extends Array<any>,
|
|
1855
|
+
export const serviceFunctionEffect = <T extends Effect.Effect<any, any, any>, Args extends Array<any>, A, E, R>(
|
|
1871
1856
|
getService: T,
|
|
1872
1857
|
f: (_: Effect.Effect.Success<T>) => (...args: Args) => Effect.Effect<A, E, R>
|
|
1873
1858
|
) =>
|