@clayroach/effect 3.19.14-source-capture.6 → 3.19.14-source-capture.8
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/Utils.js +1 -1
- package/dist/cjs/Utils.js.map +1 -1
- package/dist/cjs/internal/clock.js +1 -1
- package/dist/cjs/internal/clock.js.map +1 -1
- package/dist/esm/Utils.js +1 -1
- package/dist/esm/Utils.js.map +1 -1
- package/dist/esm/internal/clock.js +1 -1
- package/dist/esm/internal/clock.js.map +1 -1
- package/package.json +1 -1
- package/src/Arbitrary.ts +0 -1101
- package/src/Array.ts +0 -3589
- package/src/BigDecimal.ts +0 -1349
- package/src/BigInt.ts +0 -643
- package/src/Boolean.ts +0 -287
- package/src/Brand.ts +0 -360
- package/src/Cache.ts +0 -281
- package/src/Cause.ts +0 -1555
- package/src/Channel.ts +0 -2355
- package/src/ChildExecutorDecision.ts +0 -146
- package/src/Chunk.ts +0 -1495
- package/src/Clock.ts +0 -111
- package/src/Config.ts +0 -542
- package/src/ConfigError.ts +0 -270
- package/src/ConfigProvider.ts +0 -333
- package/src/ConfigProviderPathPatch.ts +0 -100
- package/src/Console.ts +0 -226
- package/src/Context.ts +0 -585
- package/src/Cron.ts +0 -706
- package/src/Data.ts +0 -596
- package/src/DateTime.ts +0 -1686
- package/src/DefaultServices.ts +0 -34
- package/src/Deferred.ts +0 -301
- package/src/Differ.ts +0 -450
- package/src/Duration.ts +0 -1000
- package/src/Effect.ts +0 -14839
- package/src/Effectable.ts +0 -107
- package/src/Either.ts +0 -1040
- package/src/Encoding.ts +0 -195
- package/src/Equal.ts +0 -98
- package/src/Equivalence.ts +0 -235
- package/src/ExecutionPlan.ts +0 -308
- package/src/ExecutionStrategy.ts +0 -119
- package/src/Exit.ts +0 -467
- package/src/FastCheck.ts +0 -9
- package/src/Fiber.ts +0 -744
- package/src/FiberHandle.ts +0 -540
- package/src/FiberId.ts +0 -195
- package/src/FiberMap.ts +0 -656
- package/src/FiberRef.ts +0 -431
- package/src/FiberRefs.ts +0 -204
- package/src/FiberRefsPatch.ts +0 -105
- package/src/FiberSet.ts +0 -491
- package/src/FiberStatus.ts +0 -108
- package/src/Function.ts +0 -1222
- package/src/GlobalValue.ts +0 -53
- package/src/Graph.ts +0 -3732
- package/src/GroupBy.ts +0 -103
- package/src/HKT.ts +0 -45
- package/src/Hash.ts +0 -195
- package/src/HashMap.ts +0 -519
- package/src/HashRing.ts +0 -317
- package/src/HashSet.ts +0 -2346
- package/src/Inspectable.ts +0 -287
- package/src/Iterable.ts +0 -1119
- package/src/JSONSchema.ts +0 -1044
- package/src/KeyedPool.ts +0 -167
- package/src/Layer.ts +0 -1251
- package/src/LayerMap.ts +0 -436
- package/src/List.ts +0 -977
- package/src/LogLevel.ts +0 -285
- package/src/LogSpan.ts +0 -25
- package/src/Logger.ts +0 -702
- package/src/Mailbox.ts +0 -268
- package/src/ManagedRuntime.ts +0 -180
- package/src/Match.ts +0 -1477
- package/src/MergeDecision.ts +0 -95
- package/src/MergeState.ts +0 -172
- package/src/MergeStrategy.ts +0 -107
- package/src/Metric.ts +0 -780
- package/src/MetricBoundaries.ts +0 -69
- package/src/MetricHook.ts +0 -151
- package/src/MetricKey.ts +0 -224
- package/src/MetricKeyType.ts +0 -262
- package/src/MetricLabel.ts +0 -47
- package/src/MetricPair.ts +0 -71
- package/src/MetricPolling.ts +0 -148
- package/src/MetricRegistry.ts +0 -48
- package/src/MetricState.ts +0 -257
- package/src/Micro.ts +0 -4405
- package/src/ModuleVersion.ts +0 -18
- package/src/MutableHashMap.ts +0 -411
- package/src/MutableHashSet.ts +0 -706
- package/src/MutableList.ts +0 -297
- package/src/MutableQueue.ts +0 -227
- package/src/MutableRef.ts +0 -202
- package/src/NonEmptyIterable.ts +0 -32
- package/src/Number.ts +0 -1071
- package/src/Option.ts +0 -2170
- package/src/Order.ts +0 -373
- package/src/Ordering.ts +0 -111
- package/src/ParseResult.ts +0 -2031
- package/src/PartitionedSemaphore.ts +0 -200
- package/src/Pipeable.ts +0 -566
- package/src/Pool.ts +0 -204
- package/src/Predicate.ts +0 -1405
- package/src/Pretty.ts +0 -205
- package/src/PrimaryKey.ts +0 -23
- package/src/PubSub.ts +0 -182
- package/src/Queue.ts +0 -644
- package/src/Random.ts +0 -204
- package/src/RateLimiter.ts +0 -138
- package/src/RcMap.ts +0 -141
- package/src/RcRef.ts +0 -122
- package/src/Readable.ts +0 -93
- package/src/Record.ts +0 -1274
- package/src/RedBlackTree.ts +0 -421
- package/src/Redacted.ts +0 -144
- package/src/Ref.ts +0 -180
- package/src/RegExp.ts +0 -38
- package/src/Reloadable.ts +0 -127
- package/src/Request.ts +0 -347
- package/src/RequestBlock.ts +0 -118
- package/src/RequestResolver.ts +0 -366
- package/src/Resource.ts +0 -119
- package/src/Runtime.ts +0 -383
- package/src/RuntimeFlags.ts +0 -368
- package/src/RuntimeFlagsPatch.ts +0 -183
- package/src/STM.ts +0 -2045
- package/src/Schedule.ts +0 -2219
- package/src/ScheduleDecision.ts +0 -62
- package/src/ScheduleInterval.ts +0 -151
- package/src/ScheduleIntervals.ts +0 -122
- package/src/Scheduler.ts +0 -353
- package/src/Schema.ts +0 -10914
- package/src/SchemaAST.ts +0 -3043
- package/src/Scope.ts +0 -204
- package/src/ScopedCache.ts +0 -151
- package/src/ScopedRef.ts +0 -117
- package/src/Secret.ts +0 -88
- package/src/SingleProducerAsyncInput.ts +0 -67
- package/src/Sink.ts +0 -1461
- package/src/SortedMap.ts +0 -287
- package/src/SortedSet.ts +0 -390
- package/src/Stream.ts +0 -6468
- package/src/StreamEmit.ts +0 -136
- package/src/StreamHaltStrategy.ts +0 -123
- package/src/Streamable.ts +0 -45
- package/src/String.ts +0 -778
- package/src/Struct.ts +0 -243
- package/src/Subscribable.ts +0 -100
- package/src/SubscriptionRef.ts +0 -298
- package/src/Supervisor.ts +0 -240
- package/src/Symbol.ts +0 -29
- package/src/SynchronizedRef.ts +0 -270
- package/src/TArray.ts +0 -495
- package/src/TDeferred.ts +0 -100
- package/src/TMap.ts +0 -515
- package/src/TPriorityQueue.ts +0 -223
- package/src/TPubSub.ts +0 -200
- package/src/TQueue.ts +0 -432
- package/src/TRandom.ts +0 -129
- package/src/TReentrantLock.ts +0 -224
- package/src/TRef.ts +0 -178
- package/src/TSemaphore.ts +0 -129
- package/src/TSet.ts +0 -365
- package/src/TSubscriptionRef.ts +0 -192
- package/src/Take.ts +0 -258
- package/src/TestAnnotation.ts +0 -158
- package/src/TestAnnotationMap.ts +0 -119
- package/src/TestAnnotations.ts +0 -117
- package/src/TestClock.ts +0 -556
- package/src/TestConfig.ts +0 -47
- package/src/TestContext.ts +0 -36
- package/src/TestLive.ts +0 -53
- package/src/TestServices.ts +0 -390
- package/src/TestSized.ts +0 -55
- package/src/Tracer.ts +0 -198
- package/src/Trie.ts +0 -840
- package/src/Tuple.ts +0 -305
- package/src/Types.ts +0 -353
- package/src/Unify.ts +0 -113
- package/src/UpstreamPullRequest.ts +0 -117
- package/src/UpstreamPullStrategy.ts +0 -121
- package/src/Utils.ts +0 -809
- package/src/index.ts +0 -1561
- package/src/internal/array.ts +0 -8
- package/src/internal/blockedRequests.ts +0 -520
- package/src/internal/cache.ts +0 -733
- package/src/internal/cause.ts +0 -1050
- package/src/internal/channel/channelExecutor.ts +0 -1200
- package/src/internal/channel/channelState.ts +0 -134
- package/src/internal/channel/childExecutorDecision.ts +0 -96
- package/src/internal/channel/continuation.ts +0 -200
- package/src/internal/channel/mergeDecision.ts +0 -113
- package/src/internal/channel/mergeState.ts +0 -120
- package/src/internal/channel/mergeStrategy.ts +0 -72
- package/src/internal/channel/singleProducerAsyncInput.ts +0 -259
- package/src/internal/channel/subexecutor.ts +0 -229
- package/src/internal/channel/upstreamPullRequest.ts +0 -84
- package/src/internal/channel/upstreamPullStrategy.ts +0 -87
- package/src/internal/channel.ts +0 -2603
- package/src/internal/clock.ts +0 -95
- package/src/internal/completedRequestMap.ts +0 -9
- package/src/internal/concurrency.ts +0 -54
- package/src/internal/config.ts +0 -716
- package/src/internal/configError.ts +0 -304
- package/src/internal/configProvider/pathPatch.ts +0 -97
- package/src/internal/configProvider.ts +0 -799
- package/src/internal/console.ts +0 -153
- package/src/internal/context.ts +0 -337
- package/src/internal/core-effect.ts +0 -2293
- package/src/internal/core-stream.ts +0 -998
- package/src/internal/core.ts +0 -3273
- package/src/internal/data.ts +0 -36
- package/src/internal/dataSource.ts +0 -327
- package/src/internal/dateTime.ts +0 -1277
- package/src/internal/defaultServices/console.ts +0 -100
- package/src/internal/defaultServices.ts +0 -163
- package/src/internal/deferred.ts +0 -46
- package/src/internal/differ/chunkPatch.ts +0 -211
- package/src/internal/differ/contextPatch.ts +0 -232
- package/src/internal/differ/hashMapPatch.ts +0 -220
- package/src/internal/differ/hashSetPatch.ts +0 -176
- package/src/internal/differ/orPatch.ts +0 -311
- package/src/internal/differ/readonlyArrayPatch.ts +0 -210
- package/src/internal/differ.ts +0 -200
- package/src/internal/doNotation.ts +0 -80
- package/src/internal/effect/circular.ts +0 -905
- package/src/internal/effectable.ts +0 -131
- package/src/internal/either.ts +0 -110
- package/src/internal/encoding/base64.ts +0 -286
- package/src/internal/encoding/base64Url.ts +0 -29
- package/src/internal/encoding/common.ts +0 -51
- package/src/internal/encoding/hex.ts +0 -315
- package/src/internal/errors.ts +0 -7
- package/src/internal/executionPlan.ts +0 -114
- package/src/internal/executionStrategy.ts +0 -74
- package/src/internal/fiber.ts +0 -388
- package/src/internal/fiberId.ts +0 -267
- package/src/internal/fiberMessage.ts +0 -82
- package/src/internal/fiberRefs/patch.ts +0 -144
- package/src/internal/fiberRefs.ts +0 -297
- package/src/internal/fiberRuntime.ts +0 -3915
- package/src/internal/fiberScope.ts +0 -71
- package/src/internal/fiberStatus.ts +0 -119
- package/src/internal/groupBy.ts +0 -530
- package/src/internal/hashMap/array.ts +0 -49
- package/src/internal/hashMap/bitwise.ts +0 -32
- package/src/internal/hashMap/config.ts +0 -14
- package/src/internal/hashMap/keySet.ts +0 -8
- package/src/internal/hashMap/node.ts +0 -391
- package/src/internal/hashMap.ts +0 -586
- package/src/internal/hashSet.ts +0 -323
- package/src/internal/keyedPool.ts +0 -244
- package/src/internal/layer/circular.ts +0 -228
- package/src/internal/layer.ts +0 -1487
- package/src/internal/logSpan.ts +0 -20
- package/src/internal/logger-circular.ts +0 -24
- package/src/internal/logger.ts +0 -485
- package/src/internal/mailbox.ts +0 -561
- package/src/internal/managedRuntime/circular.ts +0 -6
- package/src/internal/managedRuntime.ts +0 -134
- package/src/internal/matcher.ts +0 -652
- package/src/internal/metric/boundaries.ts +0 -75
- package/src/internal/metric/hook.ts +0 -483
- package/src/internal/metric/key.ts +0 -167
- package/src/internal/metric/keyType.ts +0 -238
- package/src/internal/metric/label.ts +0 -41
- package/src/internal/metric/pair.ts +0 -48
- package/src/internal/metric/polling.ts +0 -149
- package/src/internal/metric/registry.ts +0 -187
- package/src/internal/metric/state.ts +0 -290
- package/src/internal/metric.ts +0 -577
- package/src/internal/opCodes/cause.ts +0 -35
- package/src/internal/opCodes/channel.ts +0 -83
- package/src/internal/opCodes/channelChildExecutorDecision.ts +0 -17
- package/src/internal/opCodes/channelMergeDecision.ts +0 -11
- package/src/internal/opCodes/channelMergeState.ts +0 -17
- package/src/internal/opCodes/channelMergeStrategy.ts +0 -11
- package/src/internal/opCodes/channelState.ts +0 -23
- package/src/internal/opCodes/channelUpstreamPullRequest.ts +0 -11
- package/src/internal/opCodes/channelUpstreamPullStrategy.ts +0 -11
- package/src/internal/opCodes/config.ts +0 -65
- package/src/internal/opCodes/configError.ts +0 -35
- package/src/internal/opCodes/continuation.ts +0 -11
- package/src/internal/opCodes/deferred.ts +0 -11
- package/src/internal/opCodes/effect.ts +0 -89
- package/src/internal/opCodes/layer.ts +0 -59
- package/src/internal/opCodes/streamHaltStrategy.ts +0 -23
- package/src/internal/option.ts +0 -80
- package/src/internal/pool.ts +0 -432
- package/src/internal/pubsub.ts +0 -1762
- package/src/internal/query.ts +0 -204
- package/src/internal/queue.ts +0 -766
- package/src/internal/random.ts +0 -161
- package/src/internal/rateLimiter.ts +0 -93
- package/src/internal/rcMap.ts +0 -285
- package/src/internal/rcRef.ts +0 -192
- package/src/internal/redBlackTree/iterator.ts +0 -200
- package/src/internal/redBlackTree/node.ts +0 -68
- package/src/internal/redBlackTree.ts +0 -1245
- package/src/internal/redacted.ts +0 -73
- package/src/internal/ref.ts +0 -171
- package/src/internal/reloadable.ts +0 -140
- package/src/internal/request.ts +0 -177
- package/src/internal/resource.ts +0 -76
- package/src/internal/ringBuffer.ts +0 -68
- package/src/internal/runtime.ts +0 -558
- package/src/internal/runtimeFlags.ts +0 -188
- package/src/internal/runtimeFlagsPatch.ts +0 -103
- package/src/internal/schedule/decision.ts +0 -47
- package/src/internal/schedule/interval.ts +0 -101
- package/src/internal/schedule/intervals.ts +0 -180
- package/src/internal/schedule.ts +0 -2199
- package/src/internal/schema/errors.ts +0 -191
- package/src/internal/schema/schemaId.ts +0 -106
- package/src/internal/schema/util.ts +0 -50
- package/src/internal/scopedCache.ts +0 -644
- package/src/internal/scopedRef.ts +0 -118
- package/src/internal/secret.ts +0 -89
- package/src/internal/singleShotGen.ts +0 -35
- package/src/internal/sink.ts +0 -2120
- package/src/internal/stack.ts +0 -10
- package/src/internal/stm/core.ts +0 -817
- package/src/internal/stm/entry.ts +0 -59
- package/src/internal/stm/journal.ts +0 -123
- package/src/internal/stm/opCodes/stm.ts +0 -71
- package/src/internal/stm/opCodes/stmState.ts +0 -17
- package/src/internal/stm/opCodes/strategy.ts +0 -17
- package/src/internal/stm/opCodes/tExit.ts +0 -29
- package/src/internal/stm/opCodes/tryCommit.ts +0 -11
- package/src/internal/stm/stm.ts +0 -1453
- package/src/internal/stm/stmState.ts +0 -136
- package/src/internal/stm/tArray.ts +0 -550
- package/src/internal/stm/tDeferred.ts +0 -81
- package/src/internal/stm/tExit.ts +0 -190
- package/src/internal/stm/tMap.ts +0 -824
- package/src/internal/stm/tPriorityQueue.ts +0 -267
- package/src/internal/stm/tPubSub.ts +0 -551
- package/src/internal/stm/tQueue.ts +0 -393
- package/src/internal/stm/tRandom.ts +0 -140
- package/src/internal/stm/tReentrantLock.ts +0 -352
- package/src/internal/stm/tRef.ts +0 -195
- package/src/internal/stm/tSemaphore.ts +0 -113
- package/src/internal/stm/tSet.ts +0 -259
- package/src/internal/stm/tSubscriptionRef.ts +0 -286
- package/src/internal/stm/tryCommit.ts +0 -34
- package/src/internal/stm/txnId.ts +0 -14
- package/src/internal/stm/versioned.ts +0 -4
- package/src/internal/stream/debounceState.ts +0 -57
- package/src/internal/stream/emit.ts +0 -123
- package/src/internal/stream/haltStrategy.ts +0 -94
- package/src/internal/stream/handoff.ts +0 -187
- package/src/internal/stream/handoffSignal.ts +0 -59
- package/src/internal/stream/pull.ts +0 -34
- package/src/internal/stream/sinkEndReason.ts +0 -30
- package/src/internal/stream/zipAllState.ts +0 -88
- package/src/internal/stream/zipChunksState.ts +0 -56
- package/src/internal/stream.ts +0 -8801
- package/src/internal/string-utils.ts +0 -107
- package/src/internal/subscriptionRef.ts +0 -138
- package/src/internal/supervisor/patch.ts +0 -190
- package/src/internal/supervisor.ts +0 -303
- package/src/internal/synchronizedRef.ts +0 -114
- package/src/internal/take.ts +0 -199
- package/src/internal/testing/sleep.ts +0 -27
- package/src/internal/testing/suspendedWarningData.ts +0 -85
- package/src/internal/testing/warningData.ts +0 -94
- package/src/internal/tracer.ts +0 -293
- package/src/internal/trie.ts +0 -722
- package/src/internal/version.ts +0 -7
|
@@ -1,303 +0,0 @@
|
|
|
1
|
-
import type * as Context from "../Context.js"
|
|
2
|
-
import type * as Effect from "../Effect.js"
|
|
3
|
-
import type * as Exit from "../Exit.js"
|
|
4
|
-
import type * as Fiber from "../Fiber.js"
|
|
5
|
-
import { pipe } from "../Function.js"
|
|
6
|
-
import { globalValue } from "../GlobalValue.js"
|
|
7
|
-
import * as MutableRef from "../MutableRef.js"
|
|
8
|
-
import type * as Option from "../Option.js"
|
|
9
|
-
import { hasProperty, isTagged } from "../Predicate.js"
|
|
10
|
-
import * as SortedSet from "../SortedSet.js"
|
|
11
|
-
import type * as Supervisor from "../Supervisor.js"
|
|
12
|
-
import * as core from "./core.js"
|
|
13
|
-
|
|
14
|
-
/** @internal */
|
|
15
|
-
const SupervisorSymbolKey = "effect/Supervisor"
|
|
16
|
-
|
|
17
|
-
/** @internal */
|
|
18
|
-
export const SupervisorTypeId: Supervisor.SupervisorTypeId = Symbol.for(
|
|
19
|
-
SupervisorSymbolKey
|
|
20
|
-
) as Supervisor.SupervisorTypeId
|
|
21
|
-
|
|
22
|
-
/** @internal */
|
|
23
|
-
export const supervisorVariance = {
|
|
24
|
-
/* c8 ignore next */
|
|
25
|
-
_T: (_: never) => _
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
/** @internal */
|
|
29
|
-
export class ProxySupervisor<out T> implements Supervisor.Supervisor<T> {
|
|
30
|
-
readonly [SupervisorTypeId] = supervisorVariance
|
|
31
|
-
|
|
32
|
-
constructor(
|
|
33
|
-
readonly underlying: Supervisor.Supervisor<any>,
|
|
34
|
-
readonly value0: Effect.Effect<T>
|
|
35
|
-
) {
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
get value(): Effect.Effect<T> {
|
|
39
|
-
return this.value0
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
onStart<A, E, R>(
|
|
43
|
-
context: Context.Context<R>,
|
|
44
|
-
effect: Effect.Effect<A, E, R>,
|
|
45
|
-
parent: Option.Option<Fiber.RuntimeFiber<any, any>>,
|
|
46
|
-
fiber: Fiber.RuntimeFiber<A, E>
|
|
47
|
-
): void {
|
|
48
|
-
this.underlying.onStart(context, effect, parent, fiber)
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
onEnd<A, E>(value: Exit.Exit<A, E>, fiber: Fiber.RuntimeFiber<A, E>): void {
|
|
52
|
-
this.underlying.onEnd(value, fiber)
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
onEffect<A, E>(fiber: Fiber.RuntimeFiber<A, E>, effect: Effect.Effect<any, any, any>): void {
|
|
56
|
-
this.underlying.onEffect(fiber, effect)
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
onSuspend<A, E>(fiber: Fiber.RuntimeFiber<A, E>): void {
|
|
60
|
-
this.underlying.onSuspend(fiber)
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
onResume<A, E>(fiber: Fiber.RuntimeFiber<A, E>): void {
|
|
64
|
-
this.underlying.onResume(fiber)
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
map<B>(f: (a: T) => B): Supervisor.Supervisor<B> {
|
|
68
|
-
return new ProxySupervisor(this, pipe(this.value, core.map(f)))
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
zip<B>(right: Supervisor.Supervisor<B>): Supervisor.Supervisor<[T, B]> {
|
|
72
|
-
return new Zip(this, right)
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
/** @internal */
|
|
77
|
-
export class Zip<out T0, out T1> implements Supervisor.Supervisor<readonly [T0, T1]> {
|
|
78
|
-
readonly _tag = "Zip"
|
|
79
|
-
readonly [SupervisorTypeId] = supervisorVariance
|
|
80
|
-
|
|
81
|
-
constructor(
|
|
82
|
-
readonly left: Supervisor.Supervisor<T0>,
|
|
83
|
-
readonly right: Supervisor.Supervisor<T1>
|
|
84
|
-
) {
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
get value(): Effect.Effect<[T0, T1]> {
|
|
88
|
-
return core.zip(this.left.value, this.right.value)
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
onStart<A, E, R>(
|
|
92
|
-
context: Context.Context<R>,
|
|
93
|
-
effect: Effect.Effect<A, E, R>,
|
|
94
|
-
parent: Option.Option<Fiber.RuntimeFiber<any, any>>,
|
|
95
|
-
fiber: Fiber.RuntimeFiber<A, E>
|
|
96
|
-
): void {
|
|
97
|
-
this.left.onStart(context, effect, parent, fiber)
|
|
98
|
-
this.right.onStart(context, effect, parent, fiber)
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
onEnd<A, E>(value: Exit.Exit<A, E>, fiber: Fiber.RuntimeFiber<A, E>): void {
|
|
102
|
-
this.left.onEnd(value, fiber)
|
|
103
|
-
this.right.onEnd(value, fiber)
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
onEffect<A, E>(fiber: Fiber.RuntimeFiber<A, E>, effect: Effect.Effect<any, any, any>): void {
|
|
107
|
-
this.left.onEffect(fiber, effect)
|
|
108
|
-
this.right.onEffect(fiber, effect)
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
onSuspend<A, E>(fiber: Fiber.RuntimeFiber<A, E>): void {
|
|
112
|
-
this.left.onSuspend(fiber)
|
|
113
|
-
this.right.onSuspend(fiber)
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
onResume<A, E>(fiber: Fiber.RuntimeFiber<A, E>): void {
|
|
117
|
-
this.left.onResume(fiber)
|
|
118
|
-
this.right.onResume(fiber)
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
map<B>(f: (a: [T0, T1]) => B): Supervisor.Supervisor<B> {
|
|
122
|
-
return new ProxySupervisor(this, pipe(this.value, core.map(f)))
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
zip<A>(right: Supervisor.Supervisor<A>): Supervisor.Supervisor<[[T0, T1], A]> {
|
|
126
|
-
return new Zip(this, right)
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
/** @internal */
|
|
131
|
-
export const isZip = (self: unknown): self is Zip<any, any> =>
|
|
132
|
-
hasProperty(self, SupervisorTypeId) && isTagged(self, "Zip")
|
|
133
|
-
|
|
134
|
-
/** @internal */
|
|
135
|
-
export class Track implements Supervisor.Supervisor<Array<Fiber.RuntimeFiber<any, any>>> {
|
|
136
|
-
readonly [SupervisorTypeId] = supervisorVariance
|
|
137
|
-
|
|
138
|
-
readonly fibers: Set<Fiber.RuntimeFiber<any, any>> = new Set()
|
|
139
|
-
|
|
140
|
-
get value(): Effect.Effect<Array<Fiber.RuntimeFiber<any, any>>> {
|
|
141
|
-
return core.sync(() => Array.from(this.fibers))
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
onStart<A, E, R>(
|
|
145
|
-
_context: Context.Context<R>,
|
|
146
|
-
_effect: Effect.Effect<A, E, R>,
|
|
147
|
-
_parent: Option.Option<Fiber.RuntimeFiber<any, any>>,
|
|
148
|
-
fiber: Fiber.RuntimeFiber<A, E>
|
|
149
|
-
): void {
|
|
150
|
-
this.fibers.add(fiber)
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
onEnd<A, E>(_value: Exit.Exit<A, E>, fiber: Fiber.RuntimeFiber<A, E>): void {
|
|
154
|
-
this.fibers.delete(fiber)
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
onEffect<A, E>(_fiber: Fiber.RuntimeFiber<A, E>, _effect: Effect.Effect<any, any, any>): void {
|
|
158
|
-
//
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
onSuspend<A, E>(_fiber: Fiber.RuntimeFiber<A, E>): void {
|
|
162
|
-
//
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
onResume<A, E>(_fiber: Fiber.RuntimeFiber<A, E>): void {
|
|
166
|
-
//
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
map<B>(f: (a: Array<Fiber.RuntimeFiber<any, any>>) => B): Supervisor.Supervisor<B> {
|
|
170
|
-
return new ProxySupervisor(this, pipe(this.value, core.map(f)))
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
zip<A>(
|
|
174
|
-
right: Supervisor.Supervisor<A>
|
|
175
|
-
): Supervisor.Supervisor<[Array<Fiber.RuntimeFiber<any, any>>, A]> {
|
|
176
|
-
return new Zip(this, right)
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
onRun<E, A, X>(execution: () => X, _fiber: Fiber.RuntimeFiber<A, E>): X {
|
|
180
|
-
return execution()
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
/** @internal */
|
|
185
|
-
export class Const<out T> implements Supervisor.Supervisor<T> {
|
|
186
|
-
readonly [SupervisorTypeId] = supervisorVariance
|
|
187
|
-
|
|
188
|
-
constructor(readonly effect: Effect.Effect<T>) {
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
get value(): Effect.Effect<T> {
|
|
192
|
-
return this.effect
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
onStart<A, E, R>(
|
|
196
|
-
_context: Context.Context<R>,
|
|
197
|
-
_effect: Effect.Effect<A, E, R>,
|
|
198
|
-
_parent: Option.Option<Fiber.RuntimeFiber<any, any>>,
|
|
199
|
-
_fiber: Fiber.RuntimeFiber<A, E>
|
|
200
|
-
): void {
|
|
201
|
-
//
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
onEnd<A, E>(_value: Exit.Exit<A, E>, _fiber: Fiber.RuntimeFiber<A, E>): void {
|
|
205
|
-
//
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
onEffect<A, E>(_fiber: Fiber.RuntimeFiber<A, E>, _effect: Effect.Effect<any, any, any>): void {
|
|
209
|
-
//
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
onSuspend<A, E>(_fiber: Fiber.RuntimeFiber<A, E>): void {
|
|
213
|
-
//
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
onResume<A, E>(_fiber: Fiber.RuntimeFiber<A, E>): void {
|
|
217
|
-
//
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
map<B>(f: (a: T) => B): Supervisor.Supervisor<B> {
|
|
221
|
-
return new ProxySupervisor(this, pipe(this.value, core.map(f)))
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
zip<A>(right: Supervisor.Supervisor<A>): Supervisor.Supervisor<[T, A]> {
|
|
225
|
-
return new Zip(this, right)
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
onRun<E, A, X>(execution: () => X, _fiber: Fiber.RuntimeFiber<A, E>): X {
|
|
229
|
-
return execution()
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
class FibersIn implements Supervisor.Supervisor<SortedSet.SortedSet<Fiber.RuntimeFiber<any, any>>> {
|
|
234
|
-
readonly [SupervisorTypeId] = supervisorVariance
|
|
235
|
-
|
|
236
|
-
constructor(readonly ref: MutableRef.MutableRef<SortedSet.SortedSet<Fiber.RuntimeFiber<any, any>>>) {
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
get value(): Effect.Effect<SortedSet.SortedSet<Fiber.RuntimeFiber<any, any>>> {
|
|
240
|
-
return core.sync(() => MutableRef.get(this.ref))
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
onStart<A, E, R>(
|
|
244
|
-
_context: Context.Context<R>,
|
|
245
|
-
_effect: Effect.Effect<A, E, R>,
|
|
246
|
-
_parent: Option.Option<Fiber.RuntimeFiber<any, any>>,
|
|
247
|
-
fiber: Fiber.RuntimeFiber<A, E>
|
|
248
|
-
): void {
|
|
249
|
-
pipe(this.ref, MutableRef.set(pipe(MutableRef.get(this.ref), SortedSet.add(fiber))))
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
onEnd<A, E>(_value: Exit.Exit<A, E>, fiber: Fiber.RuntimeFiber<A, E>): void {
|
|
253
|
-
pipe(this.ref, MutableRef.set(pipe(MutableRef.get(this.ref), SortedSet.remove(fiber))))
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
onEffect<A, E>(_fiber: Fiber.RuntimeFiber<A, E>, _effect: Effect.Effect<any, any, any>): void {
|
|
257
|
-
//
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
onSuspend<A, E>(_fiber: Fiber.RuntimeFiber<A, E>): void {
|
|
261
|
-
//
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
onResume<A, E>(_fiber: Fiber.RuntimeFiber<A, E>): void {
|
|
265
|
-
//
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
map<B>(f: (a: SortedSet.SortedSet<Fiber.RuntimeFiber<any, any>>) => B): Supervisor.Supervisor<B> {
|
|
269
|
-
return new ProxySupervisor(this, pipe(this.value, core.map(f)))
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
zip<A>(
|
|
273
|
-
right: Supervisor.Supervisor<A>
|
|
274
|
-
): Supervisor.Supervisor<[SortedSet.SortedSet<Fiber.RuntimeFiber<any, any>>, A]> {
|
|
275
|
-
return new Zip(this, right)
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
onRun<E, A, X>(execution: () => X, _fiber: Fiber.RuntimeFiber<A, E>): X {
|
|
279
|
-
return execution()
|
|
280
|
-
}
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
/** @internal */
|
|
284
|
-
export const unsafeTrack = (): Supervisor.Supervisor<Array<Fiber.RuntimeFiber<any, any>>> => {
|
|
285
|
-
return new Track()
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
/** @internal */
|
|
289
|
-
export const track: Effect.Effect<Supervisor.Supervisor<Array<Fiber.RuntimeFiber<any, any>>>> = core.sync(unsafeTrack)
|
|
290
|
-
|
|
291
|
-
/** @internal */
|
|
292
|
-
export const fromEffect = <A>(effect: Effect.Effect<A>): Supervisor.Supervisor<A> => {
|
|
293
|
-
return new Const(effect)
|
|
294
|
-
}
|
|
295
|
-
|
|
296
|
-
/** @internal */
|
|
297
|
-
export const none = globalValue("effect/Supervisor/none", () => fromEffect(core.void))
|
|
298
|
-
|
|
299
|
-
/** @internal */
|
|
300
|
-
export const fibersIn = (
|
|
301
|
-
ref: MutableRef.MutableRef<SortedSet.SortedSet<Fiber.RuntimeFiber<any, any>>>
|
|
302
|
-
): Effect.Effect<Supervisor.Supervisor<SortedSet.SortedSet<Fiber.RuntimeFiber<any, any>>>> =>
|
|
303
|
-
core.sync(() => new FibersIn(ref))
|
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
import type * as Effect from "../Effect.js"
|
|
2
|
-
import { dual, pipe } from "../Function.js"
|
|
3
|
-
import * as Option from "../Option.js"
|
|
4
|
-
import type * as Synchronized from "../SynchronizedRef.js"
|
|
5
|
-
import * as core from "./core.js"
|
|
6
|
-
|
|
7
|
-
/** @internal */
|
|
8
|
-
export const getAndUpdateEffect = dual<
|
|
9
|
-
<A, R, E>(f: (a: A) => Effect.Effect<A, E, R>) => (self: Synchronized.SynchronizedRef<A>) => Effect.Effect<A, E, R>,
|
|
10
|
-
<A, R, E>(self: Synchronized.SynchronizedRef<A>, f: (a: A) => Effect.Effect<A, E, R>) => Effect.Effect<A, E, R>
|
|
11
|
-
>(2, (self, f) =>
|
|
12
|
-
self.modifyEffect(
|
|
13
|
-
(value) => core.map(f(value), (result) => [value, result] as const)
|
|
14
|
-
))
|
|
15
|
-
|
|
16
|
-
/** @internal */
|
|
17
|
-
export const getAndUpdateSomeEffect = dual<
|
|
18
|
-
<A, R, E>(
|
|
19
|
-
pf: (a: A) => Option.Option<Effect.Effect<A, E, R>>
|
|
20
|
-
) => (self: Synchronized.SynchronizedRef<A>) => Effect.Effect<A, E, R>,
|
|
21
|
-
<A, R, E>(
|
|
22
|
-
self: Synchronized.SynchronizedRef<A>,
|
|
23
|
-
pf: (a: A) => Option.Option<Effect.Effect<A, E, R>>
|
|
24
|
-
) => Effect.Effect<A, E, R>
|
|
25
|
-
>(2, (self, pf) =>
|
|
26
|
-
self.modifyEffect((value) => {
|
|
27
|
-
const result = pf(value)
|
|
28
|
-
switch (result._tag) {
|
|
29
|
-
case "None": {
|
|
30
|
-
return core.succeed([value, value] as const)
|
|
31
|
-
}
|
|
32
|
-
case "Some": {
|
|
33
|
-
return core.map(result.value, (newValue) => [value, newValue] as const)
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
}))
|
|
37
|
-
|
|
38
|
-
/** @internal */
|
|
39
|
-
export const modify = dual<
|
|
40
|
-
<A, B>(f: (a: A) => readonly [B, A]) => (self: Synchronized.SynchronizedRef<A>) => Effect.Effect<B>,
|
|
41
|
-
<A, B>(self: Synchronized.SynchronizedRef<A>, f: (a: A) => readonly [B, A]) => Effect.Effect<B>
|
|
42
|
-
>(2, (self, f) => self.modify(f))
|
|
43
|
-
|
|
44
|
-
/** @internal */
|
|
45
|
-
export const modifyEffect = dual<
|
|
46
|
-
<A, B, E, R>(
|
|
47
|
-
f: (a: A) => Effect.Effect<readonly [B, A], E, R>
|
|
48
|
-
) => (self: Synchronized.SynchronizedRef<A>) => Effect.Effect<B, E, R>,
|
|
49
|
-
<A, B, E, R>(
|
|
50
|
-
self: Synchronized.SynchronizedRef<A>,
|
|
51
|
-
f: (a: A) => Effect.Effect<readonly [B, A], E, R>
|
|
52
|
-
) => Effect.Effect<B, E, R>
|
|
53
|
-
>(2, (self, f) => self.modifyEffect(f))
|
|
54
|
-
|
|
55
|
-
/** @internal */
|
|
56
|
-
export const modifySomeEffect = dual<
|
|
57
|
-
<A, B, R, E>(
|
|
58
|
-
fallback: B,
|
|
59
|
-
pf: (a: A) => Option.Option<Effect.Effect<readonly [B, A], E, R>>
|
|
60
|
-
) => (self: Synchronized.SynchronizedRef<A>) => Effect.Effect<B, E, R>,
|
|
61
|
-
<A, B, R, E>(
|
|
62
|
-
self: Synchronized.SynchronizedRef<A>,
|
|
63
|
-
fallback: B,
|
|
64
|
-
pf: (a: A) => Option.Option<Effect.Effect<readonly [B, A], E, R>>
|
|
65
|
-
) => Effect.Effect<B, E, R>
|
|
66
|
-
>(3, (self, fallback, pf) =>
|
|
67
|
-
self.modifyEffect(
|
|
68
|
-
(value) => pipe(pf(value), Option.getOrElse(() => core.succeed([fallback, value] as const)))
|
|
69
|
-
))
|
|
70
|
-
|
|
71
|
-
/** @internal */
|
|
72
|
-
export const updateEffect = dual<
|
|
73
|
-
<A, R, E>(
|
|
74
|
-
f: (a: A) => Effect.Effect<A, E, R>
|
|
75
|
-
) => (self: Synchronized.SynchronizedRef<A>) => Effect.Effect<void, E, R>,
|
|
76
|
-
<A, R, E>(self: Synchronized.SynchronizedRef<A>, f: (a: A) => Effect.Effect<A, E, R>) => Effect.Effect<void, E, R>
|
|
77
|
-
>(2, (self, f) =>
|
|
78
|
-
self.modifyEffect((value) =>
|
|
79
|
-
core.map(
|
|
80
|
-
f(value),
|
|
81
|
-
(result) => [undefined as void, result] as const
|
|
82
|
-
)
|
|
83
|
-
))
|
|
84
|
-
|
|
85
|
-
/** @internal */
|
|
86
|
-
export const updateAndGetEffect = dual<
|
|
87
|
-
<A, R, E>(f: (a: A) => Effect.Effect<A, E, R>) => (self: Synchronized.SynchronizedRef<A>) => Effect.Effect<A, E, R>,
|
|
88
|
-
<A, R, E>(self: Synchronized.SynchronizedRef<A>, f: (a: A) => Effect.Effect<A, E, R>) => Effect.Effect<A, E, R>
|
|
89
|
-
>(2, (self, f) =>
|
|
90
|
-
self.modifyEffect(
|
|
91
|
-
(value) => core.map(f(value), (result) => [result, result] as const)
|
|
92
|
-
))
|
|
93
|
-
|
|
94
|
-
/** @internal */
|
|
95
|
-
export const updateSomeEffect = dual<
|
|
96
|
-
<A, R, E>(
|
|
97
|
-
pf: (a: A) => Option.Option<Effect.Effect<A, E, R>>
|
|
98
|
-
) => (self: Synchronized.SynchronizedRef<A>) => Effect.Effect<void, E, R>,
|
|
99
|
-
<A, R, E>(
|
|
100
|
-
self: Synchronized.SynchronizedRef<A>,
|
|
101
|
-
pf: (a: A) => Option.Option<Effect.Effect<A, E, R>>
|
|
102
|
-
) => Effect.Effect<void, E, R>
|
|
103
|
-
>(2, (self, pf) =>
|
|
104
|
-
self.modifyEffect((value) => {
|
|
105
|
-
const result = pf(value)
|
|
106
|
-
switch (result._tag) {
|
|
107
|
-
case "None": {
|
|
108
|
-
return core.succeed([void 0, value] as const)
|
|
109
|
-
}
|
|
110
|
-
case "Some": {
|
|
111
|
-
return core.map(result.value, (a) => [void 0, a] as const)
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
}))
|
package/src/internal/take.ts
DELETED
|
@@ -1,199 +0,0 @@
|
|
|
1
|
-
import * as Cause from "../Cause.js"
|
|
2
|
-
import * as Chunk from "../Chunk.js"
|
|
3
|
-
import * as Effect from "../Effect.js"
|
|
4
|
-
import * as Exit from "../Exit.js"
|
|
5
|
-
import { constFalse, constTrue, dual, pipe } from "../Function.js"
|
|
6
|
-
import * as Option from "../Option.js"
|
|
7
|
-
import { pipeArguments } from "../Pipeable.js"
|
|
8
|
-
import type * as Take from "../Take.js"
|
|
9
|
-
|
|
10
|
-
/** @internal */
|
|
11
|
-
const TakeSymbolKey = "effect/Take"
|
|
12
|
-
|
|
13
|
-
/** @internal */
|
|
14
|
-
export const TakeTypeId: Take.TakeTypeId = Symbol.for(
|
|
15
|
-
TakeSymbolKey
|
|
16
|
-
) as Take.TakeTypeId
|
|
17
|
-
|
|
18
|
-
const takeVariance = {
|
|
19
|
-
/* c8 ignore next */
|
|
20
|
-
_A: (_: never) => _,
|
|
21
|
-
/* c8 ignore next */
|
|
22
|
-
_E: (_: never) => _
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
/** @internal */
|
|
26
|
-
export class TakeImpl<out A, out E = never> implements Take.Take<A, E> {
|
|
27
|
-
readonly [TakeTypeId] = takeVariance
|
|
28
|
-
constructor(readonly exit: Exit.Exit<Chunk.Chunk<A>, Option.Option<E>>) {
|
|
29
|
-
}
|
|
30
|
-
pipe() {
|
|
31
|
-
return pipeArguments(this, arguments)
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
/** @internal */
|
|
36
|
-
export const chunk = <A>(chunk: Chunk.Chunk<A>): Take.Take<A> => new TakeImpl(Exit.succeed(chunk))
|
|
37
|
-
|
|
38
|
-
/** @internal */
|
|
39
|
-
export const die = (defect: unknown): Take.Take<never> => new TakeImpl(Exit.die(defect))
|
|
40
|
-
|
|
41
|
-
/** @internal */
|
|
42
|
-
export const dieMessage = (message: string): Take.Take<never> =>
|
|
43
|
-
new TakeImpl(Exit.die(new Cause.RuntimeException(message)))
|
|
44
|
-
|
|
45
|
-
/** @internal */
|
|
46
|
-
export const done = <A, E>(self: Take.Take<A, E>): Effect.Effect<Chunk.Chunk<A>, Option.Option<E>> =>
|
|
47
|
-
Effect.suspend(() => self.exit)
|
|
48
|
-
|
|
49
|
-
/** @internal */
|
|
50
|
-
export const end: Take.Take<never> = new TakeImpl(Exit.fail(Option.none()))
|
|
51
|
-
|
|
52
|
-
/** @internal */
|
|
53
|
-
export const fail = <E>(error: E): Take.Take<never, E> => new TakeImpl(Exit.fail(Option.some(error)))
|
|
54
|
-
|
|
55
|
-
/** @internal */
|
|
56
|
-
export const failCause = <E>(cause: Cause.Cause<E>): Take.Take<never, E> =>
|
|
57
|
-
new TakeImpl(Exit.failCause(pipe(cause, Cause.map(Option.some))))
|
|
58
|
-
|
|
59
|
-
/** @internal */
|
|
60
|
-
export const fromEffect = <A, E, R>(effect: Effect.Effect<A, E, R>): Effect.Effect<Take.Take<A, E>, never, R> =>
|
|
61
|
-
Effect.matchCause(effect, { onFailure: failCause, onSuccess: of })
|
|
62
|
-
|
|
63
|
-
/** @internal */
|
|
64
|
-
export const fromExit = <A, E>(exit: Exit.Exit<A, E>): Take.Take<A, E> =>
|
|
65
|
-
new TakeImpl(pipe(exit, Exit.mapBoth({ onFailure: Option.some, onSuccess: Chunk.of })))
|
|
66
|
-
|
|
67
|
-
/** @internal */
|
|
68
|
-
export const fromPull = <A, E, R>(
|
|
69
|
-
pull: Effect.Effect<Chunk.Chunk<A>, Option.Option<E>, R>
|
|
70
|
-
): Effect.Effect<Take.Take<A, E>, never, R> =>
|
|
71
|
-
Effect.matchCause(pull, {
|
|
72
|
-
onFailure: (cause) =>
|
|
73
|
-
Option.match(Cause.flipCauseOption(cause), {
|
|
74
|
-
onNone: () => end,
|
|
75
|
-
onSome: failCause
|
|
76
|
-
}),
|
|
77
|
-
onSuccess: chunk
|
|
78
|
-
})
|
|
79
|
-
|
|
80
|
-
/** @internal */
|
|
81
|
-
export const isDone = <A, E>(self: Take.Take<A, E>): boolean =>
|
|
82
|
-
Exit.match(self.exit, {
|
|
83
|
-
onFailure: (cause) => Option.isNone(Cause.flipCauseOption(cause)),
|
|
84
|
-
onSuccess: constFalse
|
|
85
|
-
})
|
|
86
|
-
|
|
87
|
-
/** @internal */
|
|
88
|
-
export const isFailure = <A, E>(self: Take.Take<A, E>): boolean =>
|
|
89
|
-
Exit.match(self.exit, {
|
|
90
|
-
onFailure: (cause) => Option.isSome(Cause.flipCauseOption(cause)),
|
|
91
|
-
onSuccess: constFalse
|
|
92
|
-
})
|
|
93
|
-
|
|
94
|
-
/** @internal */
|
|
95
|
-
export const isSuccess = <A, E>(self: Take.Take<A, E>): boolean =>
|
|
96
|
-
Exit.match(self.exit, {
|
|
97
|
-
onFailure: constFalse,
|
|
98
|
-
onSuccess: constTrue
|
|
99
|
-
})
|
|
100
|
-
|
|
101
|
-
/** @internal */
|
|
102
|
-
export const make = <A, E>(
|
|
103
|
-
exit: Exit.Exit<Chunk.Chunk<A>, Option.Option<E>>
|
|
104
|
-
): Take.Take<A, E> => new TakeImpl(exit)
|
|
105
|
-
|
|
106
|
-
/** @internal */
|
|
107
|
-
export const match = dual<
|
|
108
|
-
<Z, E, Z2, A, Z3>(
|
|
109
|
-
options: {
|
|
110
|
-
readonly onEnd: () => Z
|
|
111
|
-
readonly onFailure: (cause: Cause.Cause<E>) => Z2
|
|
112
|
-
readonly onSuccess: (chunk: Chunk.Chunk<A>) => Z3
|
|
113
|
-
}
|
|
114
|
-
) => (self: Take.Take<A, E>) => Z | Z2 | Z3,
|
|
115
|
-
<A, E, Z, Z2, Z3>(
|
|
116
|
-
self: Take.Take<A, E>,
|
|
117
|
-
options: {
|
|
118
|
-
readonly onEnd: () => Z
|
|
119
|
-
readonly onFailure: (cause: Cause.Cause<E>) => Z2
|
|
120
|
-
readonly onSuccess: (chunk: Chunk.Chunk<A>) => Z3
|
|
121
|
-
}
|
|
122
|
-
) => Z | Z2 | Z3
|
|
123
|
-
>(2, <A, E, Z, Z2, Z3>(
|
|
124
|
-
self: Take.Take<A, E>,
|
|
125
|
-
{ onEnd, onFailure, onSuccess }: {
|
|
126
|
-
readonly onEnd: () => Z
|
|
127
|
-
readonly onFailure: (cause: Cause.Cause<E>) => Z2
|
|
128
|
-
readonly onSuccess: (chunk: Chunk.Chunk<A>) => Z3
|
|
129
|
-
}
|
|
130
|
-
): Z | Z2 | Z3 =>
|
|
131
|
-
Exit.match(self.exit, {
|
|
132
|
-
onFailure: (cause) =>
|
|
133
|
-
Option.match(Cause.flipCauseOption(cause), {
|
|
134
|
-
onNone: onEnd,
|
|
135
|
-
onSome: onFailure
|
|
136
|
-
}),
|
|
137
|
-
onSuccess
|
|
138
|
-
}))
|
|
139
|
-
|
|
140
|
-
/** @internal */
|
|
141
|
-
export const matchEffect = dual<
|
|
142
|
-
<Z, E2, R, E, Z2, R2, A, Z3, E3, R3>(
|
|
143
|
-
options: {
|
|
144
|
-
readonly onEnd: Effect.Effect<Z, E2, R>
|
|
145
|
-
readonly onFailure: (cause: Cause.Cause<E>) => Effect.Effect<Z2, E2, R2>
|
|
146
|
-
readonly onSuccess: (chunk: Chunk.Chunk<A>) => Effect.Effect<Z3, E3, R3>
|
|
147
|
-
}
|
|
148
|
-
) => (self: Take.Take<A, E>) => Effect.Effect<Z | Z2 | Z3, E2 | E | E3, R | R2 | R3>,
|
|
149
|
-
<A, E, Z, E2, R, Z2, R2, Z3, E3, R3>(
|
|
150
|
-
self: Take.Take<A, E>,
|
|
151
|
-
options: {
|
|
152
|
-
readonly onEnd: Effect.Effect<Z, E2, R>
|
|
153
|
-
readonly onFailure: (cause: Cause.Cause<E>) => Effect.Effect<Z2, E2, R2>
|
|
154
|
-
readonly onSuccess: (chunk: Chunk.Chunk<A>) => Effect.Effect<Z3, E3, R3>
|
|
155
|
-
}
|
|
156
|
-
) => Effect.Effect<Z | Z2 | Z3, E2 | E | E3, R | R2 | R3>
|
|
157
|
-
>(2, <A, E, Z, E2, R, Z2, R2, Z3, E3, R3>(
|
|
158
|
-
self: Take.Take<A, E>,
|
|
159
|
-
{ onEnd, onFailure, onSuccess }: {
|
|
160
|
-
readonly onEnd: Effect.Effect<Z, E2, R>
|
|
161
|
-
readonly onFailure: (cause: Cause.Cause<E>) => Effect.Effect<Z2, E2, R2>
|
|
162
|
-
readonly onSuccess: (chunk: Chunk.Chunk<A>) => Effect.Effect<Z3, E3, R3>
|
|
163
|
-
}
|
|
164
|
-
): Effect.Effect<Z | Z2 | Z3, E2 | E | E3, R | R2 | R3> =>
|
|
165
|
-
Exit.matchEffect(self.exit, {
|
|
166
|
-
onFailure: (cause) =>
|
|
167
|
-
Option.match<Cause.Cause<E>, Effect.Effect<Z | Z2, E2 | E, R | R2>>(Cause.flipCauseOption(cause), {
|
|
168
|
-
onNone: () => onEnd,
|
|
169
|
-
onSome: onFailure
|
|
170
|
-
}),
|
|
171
|
-
onSuccess
|
|
172
|
-
}))
|
|
173
|
-
|
|
174
|
-
/** @internal */
|
|
175
|
-
export const map = dual<
|
|
176
|
-
<A, B>(f: (a: A) => B) => <E>(self: Take.Take<A, E>) => Take.Take<B, E>,
|
|
177
|
-
<A, E, B>(self: Take.Take<A, E>, f: (a: A) => B) => Take.Take<B, E>
|
|
178
|
-
>(
|
|
179
|
-
2,
|
|
180
|
-
<A, E, B>(self: Take.Take<A, E>, f: (a: A) => B): Take.Take<B, E> =>
|
|
181
|
-
new TakeImpl(pipe(self.exit, Exit.map(Chunk.map(f))))
|
|
182
|
-
)
|
|
183
|
-
|
|
184
|
-
/** @internal */
|
|
185
|
-
export const of = <A>(value: A): Take.Take<A> => new TakeImpl(Exit.succeed(Chunk.of(value)))
|
|
186
|
-
|
|
187
|
-
/** @internal */
|
|
188
|
-
export const tap = dual<
|
|
189
|
-
<A, X, E2, R>(
|
|
190
|
-
f: (chunk: Chunk.Chunk<A>) => Effect.Effect<X, E2, R>
|
|
191
|
-
) => <E>(self: Take.Take<A, E>) => Effect.Effect<void, E2 | E, R>,
|
|
192
|
-
<A, E, X, E2, R>(
|
|
193
|
-
self: Take.Take<A, E>,
|
|
194
|
-
f: (chunk: Chunk.Chunk<A>) => Effect.Effect<X, E2, R>
|
|
195
|
-
) => Effect.Effect<void, E2 | E, R>
|
|
196
|
-
>(2, <A, E, X, E2, R>(
|
|
197
|
-
self: Take.Take<A, E>,
|
|
198
|
-
f: (chunk: Chunk.Chunk<A>) => Effect.Effect<X, E2, R>
|
|
199
|
-
): Effect.Effect<void, E2 | E, R> => pipe(self.exit, Exit.forEachEffect(f), Effect.asVoid))
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import type * as Deferred from "../../Deferred.js"
|
|
2
|
-
import type * as Duration from "../../Duration.js"
|
|
3
|
-
import type * as FiberId from "../../FiberId.js"
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* `Sleep` represents the state of a scheduled effect, including the time the
|
|
7
|
-
* effect is scheduled to run, a promise that can be completed to resume
|
|
8
|
-
* execution of the effect, and the fiber executing the effect.
|
|
9
|
-
*
|
|
10
|
-
* @internal
|
|
11
|
-
*/
|
|
12
|
-
export interface Sleep {
|
|
13
|
-
readonly duration: Duration.Duration
|
|
14
|
-
readonly deferred: Deferred.Deferred<void>
|
|
15
|
-
readonly fiberId: FiberId.FiberId
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
/** @internal */
|
|
19
|
-
export const make = (
|
|
20
|
-
duration: Duration.Duration,
|
|
21
|
-
deferred: Deferred.Deferred<void>,
|
|
22
|
-
fiberId: FiberId.FiberId
|
|
23
|
-
): Sleep => ({
|
|
24
|
-
duration,
|
|
25
|
-
deferred,
|
|
26
|
-
fiberId
|
|
27
|
-
})
|