@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
package/src/index.ts
DELETED
|
@@ -1,1561 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @since 2.0.0
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
export {
|
|
6
|
-
/**
|
|
7
|
-
* @since 2.0.0
|
|
8
|
-
*/
|
|
9
|
-
absurd,
|
|
10
|
-
/**
|
|
11
|
-
* @since 2.0.0
|
|
12
|
-
*/
|
|
13
|
-
flow,
|
|
14
|
-
/**
|
|
15
|
-
* @since 2.0.0
|
|
16
|
-
*/
|
|
17
|
-
hole,
|
|
18
|
-
/**
|
|
19
|
-
* @since 2.0.0
|
|
20
|
-
*/
|
|
21
|
-
identity,
|
|
22
|
-
/**
|
|
23
|
-
* @since 2.0.0
|
|
24
|
-
*/
|
|
25
|
-
pipe,
|
|
26
|
-
/**
|
|
27
|
-
* @since 2.0.0
|
|
28
|
-
*/
|
|
29
|
-
unsafeCoerce
|
|
30
|
-
} from "./Function.js"
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* @since 3.10.0
|
|
34
|
-
*/
|
|
35
|
-
export * as Arbitrary from "./Arbitrary.js"
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* This module provides utility functions for working with arrays in TypeScript.
|
|
39
|
-
*
|
|
40
|
-
* @since 2.0.0
|
|
41
|
-
*/
|
|
42
|
-
export * as Array from "./Array.js"
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* This module provides utility functions and type class instances for working with the `BigDecimal` type in TypeScript.
|
|
46
|
-
* It includes functions for basic arithmetic operations, as well as type class instances for `Equivalence` and `Order`.
|
|
47
|
-
*
|
|
48
|
-
* A `BigDecimal` allows storing any real number to arbitrary precision; which avoids common floating point errors
|
|
49
|
-
* (such as 0.1 + 0.2 ≠ 0.3) at the cost of complexity.
|
|
50
|
-
*
|
|
51
|
-
* Internally, `BigDecimal` uses a `BigInt` object, paired with a 64-bit integer which determines the position of the
|
|
52
|
-
* decimal point. Therefore, the precision *is not* actually arbitrary, but limited to 2<sup>63</sup> decimal places.
|
|
53
|
-
*
|
|
54
|
-
* It is not recommended to convert a floating point number to a decimal directly, as the floating point representation
|
|
55
|
-
* may be unexpected.
|
|
56
|
-
*
|
|
57
|
-
* @module BigDecimal
|
|
58
|
-
* @since 2.0.0
|
|
59
|
-
* @see {@link module:BigInt} for more similar operations on `bigint` types
|
|
60
|
-
* @see {@link module:Number} for more similar operations on `number` types
|
|
61
|
-
*/
|
|
62
|
-
export * as BigDecimal from "./BigDecimal.js"
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
* This module provides utility functions and type class instances for working with the `bigint` type in TypeScript.
|
|
66
|
-
* It includes functions for basic arithmetic operations, as well as type class instances for
|
|
67
|
-
* `Equivalence` and `Order`.
|
|
68
|
-
*
|
|
69
|
-
* @module BigInt
|
|
70
|
-
* @since 2.0.0
|
|
71
|
-
* @see {@link module:BigDecimal} for more similar operations on `BigDecimal` types
|
|
72
|
-
* @see {@link module:Number} for more similar operations on `number` types
|
|
73
|
-
*/
|
|
74
|
-
export * as BigInt from "./BigInt.js"
|
|
75
|
-
|
|
76
|
-
/**
|
|
77
|
-
* This module provides utility functions and type class instances for working with the `boolean` type in TypeScript.
|
|
78
|
-
* It includes functions for basic boolean operations, as well as type class instances for
|
|
79
|
-
* `Equivalence` and `Order`.
|
|
80
|
-
*
|
|
81
|
-
* @since 2.0.0
|
|
82
|
-
*/
|
|
83
|
-
export * as Boolean from "./Boolean.js"
|
|
84
|
-
|
|
85
|
-
/**
|
|
86
|
-
* This module provides types and utility functions to create and work with branded types,
|
|
87
|
-
* which are TypeScript types with an added type tag to prevent accidental usage of a value in the wrong context.
|
|
88
|
-
*
|
|
89
|
-
* The `refined` and `nominal` functions are both used to create branded types in TypeScript.
|
|
90
|
-
* The main difference between them is that `refined` allows for validation of the data, while `nominal` does not.
|
|
91
|
-
*
|
|
92
|
-
* The `nominal` function is used to create a new branded type that has the same underlying type as the input, but with a different name.
|
|
93
|
-
* This is useful when you want to distinguish between two values of the same type that have different meanings.
|
|
94
|
-
* The `nominal` function does not perform any validation of the input data.
|
|
95
|
-
*
|
|
96
|
-
* On the other hand, the `refined` function is used to create a new branded type that has the same underlying type as the input,
|
|
97
|
-
* but with a different name, and it also allows for validation of the input data.
|
|
98
|
-
* The `refined` function takes a predicate that is used to validate the input data.
|
|
99
|
-
* If the input data fails the validation, a `BrandErrors` is returned, which provides information about the specific validation failure.
|
|
100
|
-
*
|
|
101
|
-
* @since 2.0.0
|
|
102
|
-
*/
|
|
103
|
-
export * as Brand from "./Brand.js"
|
|
104
|
-
|
|
105
|
-
/**
|
|
106
|
-
* @since 2.0.0
|
|
107
|
-
*/
|
|
108
|
-
export * as Cache from "./Cache.js"
|
|
109
|
-
|
|
110
|
-
/**
|
|
111
|
-
* The `Effect<A, E, R>` type is polymorphic in values of type `E` and we can
|
|
112
|
-
* work with any error type that we want. However, there is a lot of information
|
|
113
|
-
* that is not inside an arbitrary `E` value. So as a result, an `Effect` needs
|
|
114
|
-
* somewhere to store things like unexpected errors or defects, stack and
|
|
115
|
-
* execution traces, causes of fiber interruptions, and so forth.
|
|
116
|
-
*
|
|
117
|
-
* Effect-TS is very strict about preserving the full information related to a
|
|
118
|
-
* failure. It captures all type of errors into the `Cause` data type. `Effect`
|
|
119
|
-
* uses the `Cause<E>` data type to store the full story of failure. So its
|
|
120
|
-
* error model is lossless. It doesn't throw information related to the failure
|
|
121
|
-
* result. So we can figure out exactly what happened during the operation of
|
|
122
|
-
* our effects.
|
|
123
|
-
*
|
|
124
|
-
* It is important to note that `Cause` is an underlying data type representing
|
|
125
|
-
* errors occuring within an `Effect` workflow. Thus, we don't usually deal with
|
|
126
|
-
* `Cause`s directly. Even though it is not a data type that we deal with very
|
|
127
|
-
* often, the `Cause` of a failing `Effect` workflow can be accessed at any
|
|
128
|
-
* time, which gives us total access to all parallel and sequential errors in
|
|
129
|
-
* occurring within our codebase.
|
|
130
|
-
*
|
|
131
|
-
* @since 2.0.0
|
|
132
|
-
*/
|
|
133
|
-
export * as Cause from "./Cause.js"
|
|
134
|
-
|
|
135
|
-
/**
|
|
136
|
-
* @since 2.0.0
|
|
137
|
-
*/
|
|
138
|
-
export * as Channel from "./Channel.js"
|
|
139
|
-
|
|
140
|
-
/**
|
|
141
|
-
* @since 2.0.0
|
|
142
|
-
*/
|
|
143
|
-
export * as ChildExecutorDecision from "./ChildExecutorDecision.js"
|
|
144
|
-
|
|
145
|
-
/**
|
|
146
|
-
* @since 2.0.0
|
|
147
|
-
*/
|
|
148
|
-
export * as Chunk from "./Chunk.js"
|
|
149
|
-
|
|
150
|
-
/**
|
|
151
|
-
* @since 2.0.0
|
|
152
|
-
*/
|
|
153
|
-
export * as Clock from "./Clock.js"
|
|
154
|
-
|
|
155
|
-
/**
|
|
156
|
-
* @since 2.0.0
|
|
157
|
-
*/
|
|
158
|
-
export * as Config from "./Config.js"
|
|
159
|
-
|
|
160
|
-
/**
|
|
161
|
-
* @since 2.0.0
|
|
162
|
-
*/
|
|
163
|
-
export * as ConfigError from "./ConfigError.js"
|
|
164
|
-
|
|
165
|
-
/**
|
|
166
|
-
* @since 2.0.0
|
|
167
|
-
*/
|
|
168
|
-
export * as ConfigProvider from "./ConfigProvider.js"
|
|
169
|
-
|
|
170
|
-
/**
|
|
171
|
-
* @since 2.0.0
|
|
172
|
-
*/
|
|
173
|
-
export * as ConfigProviderPathPatch from "./ConfigProviderPathPatch.js"
|
|
174
|
-
|
|
175
|
-
/**
|
|
176
|
-
* @since 2.0.0
|
|
177
|
-
*/
|
|
178
|
-
export * as Console from "./Console.js"
|
|
179
|
-
|
|
180
|
-
/**
|
|
181
|
-
* This module provides a data structure called `Context` that can be used for dependency injection in effectful
|
|
182
|
-
* programs. It is essentially a table mapping `Tag`s to their implementations (called `Service`s), and can be used to
|
|
183
|
-
* manage dependencies in a type-safe way. The `Context` data structure is essentially a way of providing access to a set
|
|
184
|
-
* of related services that can be passed around as a single unit. This module provides functions to create, modify, and
|
|
185
|
-
* query the contents of a `Context`, as well as a number of utility types for working with tags and services.
|
|
186
|
-
*
|
|
187
|
-
* @since 2.0.0
|
|
188
|
-
*/
|
|
189
|
-
export * as Context from "./Context.js"
|
|
190
|
-
|
|
191
|
-
/**
|
|
192
|
-
* @since 2.0.0
|
|
193
|
-
*/
|
|
194
|
-
export * as Cron from "./Cron.js"
|
|
195
|
-
|
|
196
|
-
/**
|
|
197
|
-
* @since 2.0.0
|
|
198
|
-
*/
|
|
199
|
-
export * as Data from "./Data.js"
|
|
200
|
-
|
|
201
|
-
/**
|
|
202
|
-
* @since 3.6.0
|
|
203
|
-
*/
|
|
204
|
-
export * as DateTime from "./DateTime.js"
|
|
205
|
-
|
|
206
|
-
/**
|
|
207
|
-
* @since 2.0.0
|
|
208
|
-
*/
|
|
209
|
-
export * as DefaultServices from "./DefaultServices.js"
|
|
210
|
-
|
|
211
|
-
/**
|
|
212
|
-
* @since 2.0.0
|
|
213
|
-
*/
|
|
214
|
-
export * as Deferred from "./Deferred.js"
|
|
215
|
-
|
|
216
|
-
/**
|
|
217
|
-
* @since 2.0.0
|
|
218
|
-
*/
|
|
219
|
-
export * as Differ from "./Differ.js"
|
|
220
|
-
|
|
221
|
-
/**
|
|
222
|
-
* @since 2.0.0
|
|
223
|
-
*/
|
|
224
|
-
export * as Duration from "./Duration.js"
|
|
225
|
-
|
|
226
|
-
/**
|
|
227
|
-
* @since 2.0.0
|
|
228
|
-
*/
|
|
229
|
-
export * as Effect from "./Effect.js"
|
|
230
|
-
|
|
231
|
-
/**
|
|
232
|
-
* @since 2.0.0
|
|
233
|
-
*/
|
|
234
|
-
export * as Effectable from "./Effectable.js"
|
|
235
|
-
|
|
236
|
-
/**
|
|
237
|
-
* @since 2.0.0
|
|
238
|
-
*/
|
|
239
|
-
export * as Either from "./Either.js"
|
|
240
|
-
|
|
241
|
-
/**
|
|
242
|
-
* This module provides encoding & decoding functionality for:
|
|
243
|
-
*
|
|
244
|
-
* - base64 (RFC4648)
|
|
245
|
-
* - base64 (URL)
|
|
246
|
-
* - hex
|
|
247
|
-
*
|
|
248
|
-
* @since 2.0.0
|
|
249
|
-
*/
|
|
250
|
-
export * as Encoding from "./Encoding.js"
|
|
251
|
-
|
|
252
|
-
/**
|
|
253
|
-
* @since 2.0.0
|
|
254
|
-
*/
|
|
255
|
-
export * as Equal from "./Equal.js"
|
|
256
|
-
|
|
257
|
-
/**
|
|
258
|
-
* This module provides an implementation of the `Equivalence` type class, which defines a binary relation
|
|
259
|
-
* that is reflexive, symmetric, and transitive. In other words, it defines a notion of equivalence between values of a certain type.
|
|
260
|
-
* These properties are also known in mathematics as an "equivalence relation".
|
|
261
|
-
*
|
|
262
|
-
* @since 2.0.0
|
|
263
|
-
*/
|
|
264
|
-
export * as Equivalence from "./Equivalence.js"
|
|
265
|
-
|
|
266
|
-
/**
|
|
267
|
-
* @since 3.16.0
|
|
268
|
-
* @experimental
|
|
269
|
-
*/
|
|
270
|
-
export * as ExecutionPlan from "./ExecutionPlan.js"
|
|
271
|
-
|
|
272
|
-
/**
|
|
273
|
-
* @since 2.0.0
|
|
274
|
-
*/
|
|
275
|
-
export * as ExecutionStrategy from "./ExecutionStrategy.js"
|
|
276
|
-
|
|
277
|
-
/**
|
|
278
|
-
* @since 2.0.0
|
|
279
|
-
*/
|
|
280
|
-
export * as Exit from "./Exit.js"
|
|
281
|
-
|
|
282
|
-
/**
|
|
283
|
-
* @since 3.10.0
|
|
284
|
-
*/
|
|
285
|
-
export * as FastCheck from "./FastCheck.js"
|
|
286
|
-
|
|
287
|
-
/**
|
|
288
|
-
* @since 2.0.0
|
|
289
|
-
*/
|
|
290
|
-
export * as Fiber from "./Fiber.js"
|
|
291
|
-
|
|
292
|
-
/**
|
|
293
|
-
* @since 2.0.0
|
|
294
|
-
*/
|
|
295
|
-
export * as FiberHandle from "./FiberHandle.js"
|
|
296
|
-
|
|
297
|
-
/**
|
|
298
|
-
* @since 2.0.0
|
|
299
|
-
*/
|
|
300
|
-
export * as FiberId from "./FiberId.js"
|
|
301
|
-
|
|
302
|
-
/**
|
|
303
|
-
* @since 2.0.0
|
|
304
|
-
*/
|
|
305
|
-
export * as FiberMap from "./FiberMap.js"
|
|
306
|
-
|
|
307
|
-
/**
|
|
308
|
-
* @since 2.0.0
|
|
309
|
-
*/
|
|
310
|
-
export * as FiberRef from "./FiberRef.js"
|
|
311
|
-
|
|
312
|
-
/**
|
|
313
|
-
* @since 2.0.0
|
|
314
|
-
*/
|
|
315
|
-
export * as FiberRefs from "./FiberRefs.js"
|
|
316
|
-
|
|
317
|
-
/**
|
|
318
|
-
* @since 2.0.0
|
|
319
|
-
*/
|
|
320
|
-
export * as FiberRefsPatch from "./FiberRefsPatch.js"
|
|
321
|
-
|
|
322
|
-
/**
|
|
323
|
-
* @since 2.0.0
|
|
324
|
-
*/
|
|
325
|
-
export * as FiberSet from "./FiberSet.js"
|
|
326
|
-
|
|
327
|
-
/**
|
|
328
|
-
* @since 2.0.0
|
|
329
|
-
*/
|
|
330
|
-
export * as FiberStatus from "./FiberStatus.js"
|
|
331
|
-
|
|
332
|
-
/**
|
|
333
|
-
* @since 2.0.0
|
|
334
|
-
*/
|
|
335
|
-
export * as Function from "./Function.js"
|
|
336
|
-
|
|
337
|
-
/**
|
|
338
|
-
* The `GlobalValue` module ensures that a single instance of a value is created globally,
|
|
339
|
-
* even when modules are imported multiple times (e.g., due to mixing CommonJS and ESM builds)
|
|
340
|
-
* or during hot-reloading in development environments like Next.js or Remix.
|
|
341
|
-
*
|
|
342
|
-
* It achieves this by using a versioned global store, identified by a unique `Symbol` tied to
|
|
343
|
-
* the current version of the `effect` library. The store holds values that are keyed by an identifier,
|
|
344
|
-
* allowing the reuse of previously computed instances across imports or reloads.
|
|
345
|
-
*
|
|
346
|
-
* This pattern is particularly useful in scenarios where frequent reloading can cause services or
|
|
347
|
-
* single-instance objects to be recreated unnecessarily, such as in development environments with hot-reloading.
|
|
348
|
-
*
|
|
349
|
-
* @since 2.0.0
|
|
350
|
-
*/
|
|
351
|
-
export * as GlobalValue from "./GlobalValue.js"
|
|
352
|
-
|
|
353
|
-
/**
|
|
354
|
-
* @experimental
|
|
355
|
-
* @since 3.18.0
|
|
356
|
-
*/
|
|
357
|
-
export * as Graph from "./Graph.js"
|
|
358
|
-
|
|
359
|
-
/**
|
|
360
|
-
* @since 2.0.0
|
|
361
|
-
*/
|
|
362
|
-
export * as GroupBy from "./GroupBy.js"
|
|
363
|
-
|
|
364
|
-
/**
|
|
365
|
-
* @since 2.0.0
|
|
366
|
-
*/
|
|
367
|
-
export * as HKT from "./HKT.js"
|
|
368
|
-
|
|
369
|
-
/**
|
|
370
|
-
* @since 2.0.0
|
|
371
|
-
*/
|
|
372
|
-
export * as Hash from "./Hash.js"
|
|
373
|
-
|
|
374
|
-
/**
|
|
375
|
-
* @since 2.0.0
|
|
376
|
-
*/
|
|
377
|
-
export * as HashMap from "./HashMap.js"
|
|
378
|
-
|
|
379
|
-
/**
|
|
380
|
-
* @since 3.19.0
|
|
381
|
-
* @experimental
|
|
382
|
-
*/
|
|
383
|
-
export * as HashRing from "./HashRing.js"
|
|
384
|
-
|
|
385
|
-
/**
|
|
386
|
-
* # HashSet
|
|
387
|
-
*
|
|
388
|
-
* An immutable `HashSet` provides a collection of unique values with efficient
|
|
389
|
-
* lookup, insertion and removal. Once created, a `HashSet` cannot be modified;
|
|
390
|
-
* any operation that would alter the set instead returns a new `HashSet` with
|
|
391
|
-
* the changes. This immutability offers benefits like predictable state
|
|
392
|
-
* management and easier reasoning about your code.
|
|
393
|
-
*
|
|
394
|
-
* ## What Problem Does It Solve?
|
|
395
|
-
*
|
|
396
|
-
* `HashSet` solves the problem of maintaining an unsorted collection where each
|
|
397
|
-
* value appears exactly once, with fast operations for checking membership and
|
|
398
|
-
* adding/removing values.
|
|
399
|
-
*
|
|
400
|
-
* ## When to Use
|
|
401
|
-
*
|
|
402
|
-
* Use `HashSet` when you need:
|
|
403
|
-
*
|
|
404
|
-
* - A collection with no duplicate values
|
|
405
|
-
* - Efficient membership testing (**`O(1)`** average complexity)
|
|
406
|
-
* - Set operations like union, intersection, and difference
|
|
407
|
-
* - An immutable data structure that preserves functional programming patterns
|
|
408
|
-
*
|
|
409
|
-
* ## Advanced Features
|
|
410
|
-
*
|
|
411
|
-
* HashSet provides operations for:
|
|
412
|
-
*
|
|
413
|
-
* - Transforming sets with map and flatMap
|
|
414
|
-
* - Filtering elements with filter
|
|
415
|
-
* - Combining sets with union, intersection and difference
|
|
416
|
-
* - Performance optimizations via mutable operations in controlled contexts
|
|
417
|
-
*
|
|
418
|
-
* ## Performance Characteristics
|
|
419
|
-
*
|
|
420
|
-
* - **Lookup** operations ({@link module:HashSet.has}): **`O(1)`** average time
|
|
421
|
-
* complexity
|
|
422
|
-
* - **Insertion** operations ({@link module:HashSet.add}): **`O(1)`** average time
|
|
423
|
-
* complexity
|
|
424
|
-
* - **Removal** operations ({@link module:HashSet.remove}): **`O(1)`** average
|
|
425
|
-
* time complexity
|
|
426
|
-
* - **Set** operations ({@link module:HashSet.union},
|
|
427
|
-
* {@link module:HashSet.intersection}): **`O(n)`** where n is the size of the
|
|
428
|
-
* smaller set
|
|
429
|
-
* - **Iteration**: **`O(n)`** where n is the size of the set
|
|
430
|
-
*
|
|
431
|
-
* The HashSet data structure implements the following traits:
|
|
432
|
-
*
|
|
433
|
-
* - {@link Iterable}: allows iterating over the values in the set
|
|
434
|
-
* - {@link Equal}: allows comparing two sets for value-based equality
|
|
435
|
-
* - {@link Pipeable}: allows chaining operations with the pipe operator
|
|
436
|
-
* - {@link Inspectable}: allows inspecting the contents of the set
|
|
437
|
-
*
|
|
438
|
-
* ## Operations Reference
|
|
439
|
-
*
|
|
440
|
-
* | Category | Operation | Description | Complexity |
|
|
441
|
-
* | ------------ | ----------------------------------- | ------------------------------------------- | ---------- |
|
|
442
|
-
* | constructors | {@link module:HashSet.empty} | Creates an empty HashSet | O(1) |
|
|
443
|
-
* | constructors | {@link module:HashSet.fromIterable} | Creates a HashSet from an iterable | O(n) |
|
|
444
|
-
* | constructors | {@link module:HashSet.make} | Creates a HashSet from multiple values | O(n) |
|
|
445
|
-
* | | | | |
|
|
446
|
-
* | elements | {@link module:HashSet.has} | Checks if a value exists in the set | O(1) avg |
|
|
447
|
-
* | elements | {@link module:HashSet.some} | Checks if any element satisfies a predicate | O(n) |
|
|
448
|
-
* | elements | {@link module:HashSet.every} | Checks if all elements satisfy a predicate | O(n) |
|
|
449
|
-
* | elements | {@link module:HashSet.isSubset} | Checks if a set is a subset of another | O(n) |
|
|
450
|
-
* | | | | |
|
|
451
|
-
* | getters | {@link module:HashSet.values} | Gets an iterator of all values | O(1) |
|
|
452
|
-
* | getters | {@link module:HashSet.toValues} | Gets an array of all values | O(n) |
|
|
453
|
-
* | getters | {@link module:HashSet.size} | Gets the number of elements | O(1) |
|
|
454
|
-
* | | | | |
|
|
455
|
-
* | mutations | {@link module:HashSet.add} | Adds a value to the set | O(1) avg |
|
|
456
|
-
* | mutations | {@link module:HashSet.remove} | Removes a value from the set | O(1) avg |
|
|
457
|
-
* | mutations | {@link module:HashSet.toggle} | Toggles a value's presence | O(1) avg |
|
|
458
|
-
* | | | | |
|
|
459
|
-
* | operations | {@link module:HashSet.difference} | Computes set difference (A - B) | O(n) |
|
|
460
|
-
* | operations | {@link module:HashSet.intersection} | Computes set intersection (A ∩ B) | O(n) |
|
|
461
|
-
* | operations | {@link module:HashSet.union} | Computes set union (A ∪ B) | O(n) |
|
|
462
|
-
* | | | | |
|
|
463
|
-
* | mapping | {@link module:HashSet.map} | Transforms each element | O(n) |
|
|
464
|
-
* | | | | |
|
|
465
|
-
* | sequencing | {@link module:HashSet.flatMap} | Transforms and flattens elements | O(n) |
|
|
466
|
-
* | | | | |
|
|
467
|
-
* | traversing | {@link module:HashSet.forEach} | Applies a function to each element | O(n) |
|
|
468
|
-
* | | | | |
|
|
469
|
-
* | folding | {@link module:HashSet.reduce} | Reduces the set to a single value | O(n) |
|
|
470
|
-
* | | | | |
|
|
471
|
-
* | filtering | {@link module:HashSet.filter} | Keeps elements that satisfy a predicate | O(n) |
|
|
472
|
-
* | | | | |
|
|
473
|
-
* | partitioning | {@link module:HashSet.partition} | Splits into two sets by a predicate | O(n) |
|
|
474
|
-
*
|
|
475
|
-
* ## Notes
|
|
476
|
-
*
|
|
477
|
-
* ### Composability with the Effect Ecosystem:
|
|
478
|
-
*
|
|
479
|
-
* This `HashSet` is designed to work seamlessly within the Effect ecosystem. It
|
|
480
|
-
* implements the {@link Iterable}, {@link Equal}, {@link Pipeable}, and
|
|
481
|
-
* {@link Inspectable} traits from Effect. This ensures compatibility with other
|
|
482
|
-
* Effect data structures and functionalities. For example, you can easily use
|
|
483
|
-
* Effect's `pipe` method to chain operations on the `HashSet`.
|
|
484
|
-
*
|
|
485
|
-
* **Equality of Elements with Effect's {@link Equal `Equal`} Trait:**
|
|
486
|
-
*
|
|
487
|
-
* This `HashSet` relies on Effect's {@link Equal} trait to determine the
|
|
488
|
-
* uniqueness of elements within the set. The way equality is checked depends on
|
|
489
|
-
* the type of the elements:
|
|
490
|
-
*
|
|
491
|
-
* - **Primitive Values:** For primitive JavaScript values like strings, numbers,
|
|
492
|
-
* booleans, `null`, and `undefined`, equality is determined by their value
|
|
493
|
-
* (similar to the `===` operator).
|
|
494
|
-
* - **Objects and Custom Types:** For objects and other custom types, equality is
|
|
495
|
-
* determined by whether those types implement the {@link Equal} interface
|
|
496
|
-
* themselves. If an element type implements `Equal`, the `HashSet` will
|
|
497
|
-
* delegate to that implementation to perform the equality check. This allows
|
|
498
|
-
* you to define custom logic for determining when two instances of your
|
|
499
|
-
* objects should be considered equal based on their properties, rather than
|
|
500
|
-
* just their object identity.
|
|
501
|
-
*
|
|
502
|
-
* ```ts
|
|
503
|
-
* import { Equal, Hash, HashSet } from "effect"
|
|
504
|
-
*
|
|
505
|
-
* class Person implements Equal.Equal {
|
|
506
|
-
* constructor(
|
|
507
|
-
* readonly id: number, // Unique identifier
|
|
508
|
-
* readonly name: string,
|
|
509
|
-
* readonly age: number
|
|
510
|
-
* ) {}
|
|
511
|
-
*
|
|
512
|
-
* // Define equality based on id, name, and age
|
|
513
|
-
* [Equal.symbol](that: Equal.Equal): boolean {
|
|
514
|
-
* if (that instanceof Person) {
|
|
515
|
-
* return (
|
|
516
|
-
* Equal.equals(this.id, that.id) &&
|
|
517
|
-
* Equal.equals(this.name, that.name) &&
|
|
518
|
-
* Equal.equals(this.age, that.age)
|
|
519
|
-
* )
|
|
520
|
-
* }
|
|
521
|
-
* return false
|
|
522
|
-
* }
|
|
523
|
-
*
|
|
524
|
-
* // Generate a hash code based on the unique id
|
|
525
|
-
* [Hash.symbol](): number {
|
|
526
|
-
* return Hash.hash(this.id)
|
|
527
|
-
* }
|
|
528
|
-
* }
|
|
529
|
-
*
|
|
530
|
-
* // Creating a HashSet with objects that implement the Equal interface
|
|
531
|
-
* const set = HashSet.empty().pipe(
|
|
532
|
-
* HashSet.add(new Person(1, "Alice", 30)),
|
|
533
|
-
* HashSet.add(new Person(1, "Alice", 30))
|
|
534
|
-
* )
|
|
535
|
-
*
|
|
536
|
-
* // HashSet recognizes them as equal, so only one element is stored
|
|
537
|
-
* console.log(HashSet.size(set))
|
|
538
|
-
* // Output: 1
|
|
539
|
-
* ```
|
|
540
|
-
*
|
|
541
|
-
* **Simplifying Equality and Hashing with `Data` and `Schema`:**
|
|
542
|
-
*
|
|
543
|
-
* Effect's {@link Data} and {@link Schema `Schema.Data`} modules offer powerful
|
|
544
|
-
* ways to automatically handle the implementation of both the {@link Equal} and
|
|
545
|
-
* {@link Hash} traits for your custom data structures.
|
|
546
|
-
*
|
|
547
|
-
* - **`Data` Module:** By using constructors like `Data.struct`, `Data.tuple`,
|
|
548
|
-
* `Data.array`, or `Data.case` to define your data types, Effect
|
|
549
|
-
* automatically generates the necessary implementations for value-based
|
|
550
|
-
* equality and consistent hashing. This significantly reduces boilerplate and
|
|
551
|
-
* ensures correctness.
|
|
552
|
-
*
|
|
553
|
-
* ```ts
|
|
554
|
-
* import { HashSet, Data, Equal } from "effect"
|
|
555
|
-
* import assert from "node:assert/strict"
|
|
556
|
-
*
|
|
557
|
-
* // Data.* implements the `Equal` traits for us
|
|
558
|
-
* const person1 = Data.struct({ id: 1, name: "Alice", age: 30 })
|
|
559
|
-
* const person2 = Data.struct({ id: 1, name: "Alice", age: 30 })
|
|
560
|
-
*
|
|
561
|
-
* assert(Equal.equals(person1, person2))
|
|
562
|
-
*
|
|
563
|
-
* const set = HashSet.empty().pipe(
|
|
564
|
-
* HashSet.add(person1),
|
|
565
|
-
* HashSet.add(person2)
|
|
566
|
-
* )
|
|
567
|
-
*
|
|
568
|
-
* // HashSet recognizes them as equal, so only one element is stored
|
|
569
|
-
* console.log(HashSet.size(set)) // Output: 1
|
|
570
|
-
* ```
|
|
571
|
-
*
|
|
572
|
-
* - **`Schema` Module:** When defining data schemas using the {@link Schema}
|
|
573
|
-
* module, you can use `Schema.Data` to automatically include the `Equal` and
|
|
574
|
-
* `Hash` traits in the decoded objects. This is particularly important when
|
|
575
|
-
* working with `HashSet`. **For decoded objects to be correctly recognized as
|
|
576
|
-
* equal within a `HashSet`, ensure that the schema for those objects is
|
|
577
|
-
* defined using `Schema.Data`.**
|
|
578
|
-
*
|
|
579
|
-
* ```ts
|
|
580
|
-
* import { Equal, HashSet, Schema } from "effect"
|
|
581
|
-
* import assert from "node:assert/strict"
|
|
582
|
-
*
|
|
583
|
-
* // Schema.Data implements the `Equal` traits for us
|
|
584
|
-
* const PersonSchema = Schema.Data(
|
|
585
|
-
* Schema.Struct({
|
|
586
|
-
* id: Schema.Number,
|
|
587
|
-
* name: Schema.String,
|
|
588
|
-
* age: Schema.Number
|
|
589
|
-
* })
|
|
590
|
-
* )
|
|
591
|
-
*
|
|
592
|
-
* const Person = Schema.decode(PersonSchema)
|
|
593
|
-
*
|
|
594
|
-
* const person1 = Person({ id: 1, name: "Alice", age: 30 })
|
|
595
|
-
* const person2 = Person({ id: 1, name: "Alice", age: 30 })
|
|
596
|
-
*
|
|
597
|
-
* assert(Equal.equals(person1, person2)) // Output: true
|
|
598
|
-
*
|
|
599
|
-
* const set = HashSet.empty().pipe(
|
|
600
|
-
* HashSet.add(person1),
|
|
601
|
-
* HashSet.add(person2)
|
|
602
|
-
* )
|
|
603
|
-
*
|
|
604
|
-
* // HashSet thanks to Schema.Data implementation of the `Equal` trait, recognizes the two Person as equal, so only one element is stored
|
|
605
|
-
* console.log(HashSet.size(set)) // Output: 1
|
|
606
|
-
* ```
|
|
607
|
-
*
|
|
608
|
-
* ### Interoperability with the JavaScript Runtime:
|
|
609
|
-
*
|
|
610
|
-
* To interoperate with the regular JavaScript runtime, Effect's `HashSet`
|
|
611
|
-
* provides methods to access its elements in formats readily usable by
|
|
612
|
-
* JavaScript APIs: {@link values `HashSet.values`},
|
|
613
|
-
* {@link toValues `HashSet.toValues`}
|
|
614
|
-
*
|
|
615
|
-
* ```ts
|
|
616
|
-
* import { HashSet } from "effect"
|
|
617
|
-
*
|
|
618
|
-
* const hashSet: HashSet.HashSet<number> = HashSet.make(1, 2, 3)
|
|
619
|
-
*
|
|
620
|
-
* // Using HashSet.values to convert HashSet.HashSet<A> to IterableIterator<A>
|
|
621
|
-
* const iterable: IterableIterator<number> = HashSet.values(hashSet)
|
|
622
|
-
*
|
|
623
|
-
* console.log(...iterable) // Logs: 1 2 3
|
|
624
|
-
*
|
|
625
|
-
* // Using HashSet.toValues to convert HashSet.HashSet<A> to Array<A>
|
|
626
|
-
* const array: Array<number> = HashSet.toValues(hashSet)
|
|
627
|
-
*
|
|
628
|
-
* console.log(array) // Logs: [ 1, 2, 3 ]
|
|
629
|
-
* ```
|
|
630
|
-
*
|
|
631
|
-
* Be mindful of performance implications (both time and space complexity) when
|
|
632
|
-
* frequently converting between Effect's immutable HashSet and mutable
|
|
633
|
-
* JavaScript data structures, especially for large collections.
|
|
634
|
-
*
|
|
635
|
-
* @module HashSet
|
|
636
|
-
* @since 2.0.0
|
|
637
|
-
*/
|
|
638
|
-
export * as HashSet from "./HashSet.js"
|
|
639
|
-
|
|
640
|
-
/**
|
|
641
|
-
* @since 2.0.0
|
|
642
|
-
*/
|
|
643
|
-
export * as Inspectable from "./Inspectable.js"
|
|
644
|
-
|
|
645
|
-
/**
|
|
646
|
-
* This module provides utility functions for working with Iterables in TypeScript.
|
|
647
|
-
*
|
|
648
|
-
* @since 2.0.0
|
|
649
|
-
*/
|
|
650
|
-
export * as Iterable from "./Iterable.js"
|
|
651
|
-
|
|
652
|
-
/**
|
|
653
|
-
* @since 3.10.0
|
|
654
|
-
*/
|
|
655
|
-
export * as JSONSchema from "./JSONSchema.js"
|
|
656
|
-
|
|
657
|
-
/**
|
|
658
|
-
* @since 2.0.0
|
|
659
|
-
*/
|
|
660
|
-
export * as KeyedPool from "./KeyedPool.js"
|
|
661
|
-
|
|
662
|
-
/**
|
|
663
|
-
* A `Layer<ROut, E, RIn>` describes how to build one or more services in your
|
|
664
|
-
* application. Services can be injected into effects via
|
|
665
|
-
* `Effect.provideService`. Effects can require services via `Effect.service`.
|
|
666
|
-
*
|
|
667
|
-
* Layer can be thought of as recipes for producing bundles of services, given
|
|
668
|
-
* their dependencies (other services).
|
|
669
|
-
*
|
|
670
|
-
* Construction of services can be effectful and utilize resources that must be
|
|
671
|
-
* acquired and safely released when the services are done being utilized.
|
|
672
|
-
*
|
|
673
|
-
* By default layers are shared, meaning that if the same layer is used twice
|
|
674
|
-
* the layer will only be allocated a single time.
|
|
675
|
-
*
|
|
676
|
-
* Because of their excellent composition properties, layers are the idiomatic
|
|
677
|
-
* way in Effect-TS to create services that depend on other services.
|
|
678
|
-
*
|
|
679
|
-
* @since 2.0.0
|
|
680
|
-
*/
|
|
681
|
-
export * as Layer from "./Layer.js"
|
|
682
|
-
|
|
683
|
-
/**
|
|
684
|
-
* @since 3.14.0
|
|
685
|
-
* @experimental
|
|
686
|
-
*/
|
|
687
|
-
export * as LayerMap from "./LayerMap.js"
|
|
688
|
-
|
|
689
|
-
/**
|
|
690
|
-
* A data type for immutable linked lists representing ordered collections of elements of type `A`.
|
|
691
|
-
*
|
|
692
|
-
* This data type is optimal for last-in-first-out (LIFO), stack-like access patterns. If you need another access pattern, for example, random access or FIFO, consider using a collection more suited to this than `List`.
|
|
693
|
-
*
|
|
694
|
-
* **Performance**
|
|
695
|
-
*
|
|
696
|
-
* - Time: `List` has `O(1)` prepend and head/tail access. Most other operations are `O(n)` on the number of elements in the list. This includes the index-based lookup of elements, `length`, `append` and `reverse`.
|
|
697
|
-
* - Space: `List` implements structural sharing of the tail list. This means that many operations are either zero- or constant-memory cost.
|
|
698
|
-
*
|
|
699
|
-
* @since 2.0.0
|
|
700
|
-
*/
|
|
701
|
-
export * as List from "./List.js"
|
|
702
|
-
|
|
703
|
-
/**
|
|
704
|
-
* @since 2.0.0
|
|
705
|
-
*/
|
|
706
|
-
export * as LogLevel from "./LogLevel.js"
|
|
707
|
-
|
|
708
|
-
/**
|
|
709
|
-
* @since 2.0.0
|
|
710
|
-
*/
|
|
711
|
-
export * as LogSpan from "./LogSpan.js"
|
|
712
|
-
|
|
713
|
-
/**
|
|
714
|
-
* @since 2.0.0
|
|
715
|
-
*/
|
|
716
|
-
export * as Logger from "./Logger.js"
|
|
717
|
-
|
|
718
|
-
/**
|
|
719
|
-
* @since 3.8.0
|
|
720
|
-
* @experimental
|
|
721
|
-
*/
|
|
722
|
-
export * as Mailbox from "./Mailbox.js"
|
|
723
|
-
|
|
724
|
-
/**
|
|
725
|
-
* @since 2.0.0
|
|
726
|
-
*/
|
|
727
|
-
export * as ManagedRuntime from "./ManagedRuntime.js"
|
|
728
|
-
|
|
729
|
-
/**
|
|
730
|
-
* The `effect/match` module provides a type-safe pattern matching system for
|
|
731
|
-
* TypeScript. Inspired by functional programming, it simplifies conditional
|
|
732
|
-
* logic by replacing verbose if/else or switch statements with a structured and
|
|
733
|
-
* expressive API.
|
|
734
|
-
*
|
|
735
|
-
* This module supports matching against types, values, and discriminated unions
|
|
736
|
-
* while enforcing exhaustiveness checking to ensure all cases are handled.
|
|
737
|
-
*
|
|
738
|
-
* Although pattern matching is not yet a native JavaScript feature,
|
|
739
|
-
* `effect/match` offers a reliable implementation that is available today.
|
|
740
|
-
*
|
|
741
|
-
* **How Pattern Matching Works**
|
|
742
|
-
*
|
|
743
|
-
* Pattern matching follows a structured process:
|
|
744
|
-
*
|
|
745
|
-
* - **Creating a matcher**: Define a `Matcher` that operates on either a
|
|
746
|
-
* specific `Match.type` or `Match.value`.
|
|
747
|
-
*
|
|
748
|
-
* - **Defining patterns**: Use combinators such as `Match.when`, `Match.not`,
|
|
749
|
-
* and `Match.tag` to specify matching conditions.
|
|
750
|
-
*
|
|
751
|
-
* - **Completing the match**: Apply a finalizer such as `Match.exhaustive`,
|
|
752
|
-
* `Match.orElse`, or `Match.option` to determine how unmatched cases should
|
|
753
|
-
* be handled.
|
|
754
|
-
*
|
|
755
|
-
* @since 1.0.0
|
|
756
|
-
*/
|
|
757
|
-
export * as Match from "./Match.js"
|
|
758
|
-
|
|
759
|
-
/**
|
|
760
|
-
* @since 2.0.0
|
|
761
|
-
*/
|
|
762
|
-
export * as MergeDecision from "./MergeDecision.js"
|
|
763
|
-
|
|
764
|
-
/**
|
|
765
|
-
* @since 2.0.0
|
|
766
|
-
*/
|
|
767
|
-
export * as MergeState from "./MergeState.js"
|
|
768
|
-
|
|
769
|
-
/**
|
|
770
|
-
* @since 2.0.0
|
|
771
|
-
*/
|
|
772
|
-
export * as MergeStrategy from "./MergeStrategy.js"
|
|
773
|
-
|
|
774
|
-
/**
|
|
775
|
-
* @since 2.0.0
|
|
776
|
-
*/
|
|
777
|
-
export * as Metric from "./Metric.js"
|
|
778
|
-
|
|
779
|
-
/**
|
|
780
|
-
* @since 2.0.0
|
|
781
|
-
*/
|
|
782
|
-
export * as MetricBoundaries from "./MetricBoundaries.js"
|
|
783
|
-
|
|
784
|
-
/**
|
|
785
|
-
* @since 2.0.0
|
|
786
|
-
*/
|
|
787
|
-
export * as MetricHook from "./MetricHook.js"
|
|
788
|
-
|
|
789
|
-
/**
|
|
790
|
-
* @since 2.0.0
|
|
791
|
-
*/
|
|
792
|
-
export * as MetricKey from "./MetricKey.js"
|
|
793
|
-
|
|
794
|
-
/**
|
|
795
|
-
* @since 2.0.0
|
|
796
|
-
*/
|
|
797
|
-
export * as MetricKeyType from "./MetricKeyType.js"
|
|
798
|
-
|
|
799
|
-
/**
|
|
800
|
-
* @since 2.0.0
|
|
801
|
-
*/
|
|
802
|
-
export * as MetricLabel from "./MetricLabel.js"
|
|
803
|
-
|
|
804
|
-
/**
|
|
805
|
-
* @since 2.0.0
|
|
806
|
-
*/
|
|
807
|
-
export * as MetricPair from "./MetricPair.js"
|
|
808
|
-
|
|
809
|
-
/**
|
|
810
|
-
* @since 2.0.0
|
|
811
|
-
*/
|
|
812
|
-
export * as MetricPolling from "./MetricPolling.js"
|
|
813
|
-
|
|
814
|
-
/**
|
|
815
|
-
* @since 2.0.0
|
|
816
|
-
*/
|
|
817
|
-
export * as MetricRegistry from "./MetricRegistry.js"
|
|
818
|
-
|
|
819
|
-
/**
|
|
820
|
-
* @since 2.0.0
|
|
821
|
-
*/
|
|
822
|
-
export * as MetricState from "./MetricState.js"
|
|
823
|
-
|
|
824
|
-
/**
|
|
825
|
-
* A lightweight alternative to the `Effect` data type, with a subset of the functionality.
|
|
826
|
-
*
|
|
827
|
-
* @since 3.4.0
|
|
828
|
-
* @experimental
|
|
829
|
-
*/
|
|
830
|
-
export * as Micro from "./Micro.js"
|
|
831
|
-
|
|
832
|
-
/**
|
|
833
|
-
* @since 2.0.0
|
|
834
|
-
*
|
|
835
|
-
* Enables low level framework authors to run on their own isolated effect version
|
|
836
|
-
*/
|
|
837
|
-
export * as ModuleVersion from "./ModuleVersion.js"
|
|
838
|
-
|
|
839
|
-
/**
|
|
840
|
-
* @since 2.0.0
|
|
841
|
-
*/
|
|
842
|
-
export * as MutableHashMap from "./MutableHashMap.js"
|
|
843
|
-
|
|
844
|
-
/**
|
|
845
|
-
* # MutableHashSet
|
|
846
|
-
*
|
|
847
|
-
* A mutable `MutableHashSet` provides a collection of unique values with
|
|
848
|
-
* efficient lookup, insertion and removal. Unlike its immutable sibling
|
|
849
|
-
* {@link module:HashSet}, a `MutableHashSet` can be modified in-place;
|
|
850
|
-
* operations like add, remove, and clear directly modify the original set
|
|
851
|
-
* rather than creating a new one. This mutability offers benefits like improved
|
|
852
|
-
* performance in scenarios where you need to build or modify a set
|
|
853
|
-
* incrementally.
|
|
854
|
-
*
|
|
855
|
-
* ## What Problem Does It Solve?
|
|
856
|
-
*
|
|
857
|
-
* `MutableHashSet` solves the problem of maintaining an unsorted collection
|
|
858
|
-
* where each value appears exactly once, with fast operations for checking
|
|
859
|
-
* membership and adding/removing values, in contexts where mutability is
|
|
860
|
-
* preferred for performance or implementation simplicity.
|
|
861
|
-
*
|
|
862
|
-
* ## When to Use
|
|
863
|
-
*
|
|
864
|
-
* Use `MutableHashSet` when you need:
|
|
865
|
-
*
|
|
866
|
-
* - A collection with no duplicate values
|
|
867
|
-
* - Efficient membership testing (**`O(1)`** average complexity)
|
|
868
|
-
* - In-place modifications for better performance
|
|
869
|
-
* - A set that will be built or modified incrementally
|
|
870
|
-
* - Local mutability in otherwise immutable code
|
|
871
|
-
*
|
|
872
|
-
* ## Advanced Features
|
|
873
|
-
*
|
|
874
|
-
* MutableHashSet provides operations for:
|
|
875
|
-
*
|
|
876
|
-
* - Adding and removing elements with direct mutation
|
|
877
|
-
* - Checking for element existence
|
|
878
|
-
* - Clearing all elements at once
|
|
879
|
-
* - Converting to/from other collection types
|
|
880
|
-
*
|
|
881
|
-
* ## Performance Characteristics
|
|
882
|
-
*
|
|
883
|
-
* - **Lookup** operations ({@link module:MutableHashSet.has}): **`O(1)`** average
|
|
884
|
-
* time complexity
|
|
885
|
-
* - **Insertion** operations ({@link module:MutableHashSet.add}): **`O(1)`**
|
|
886
|
-
* average time complexity
|
|
887
|
-
* - **Removal** operations ({@link module:MutableHashSet.remove}): **`O(1)`**
|
|
888
|
-
* average time complexity
|
|
889
|
-
* - **Iteration**: **`O(n)`** where n is the size of the set
|
|
890
|
-
*
|
|
891
|
-
* The MutableHashSet data structure implements the following traits:
|
|
892
|
-
*
|
|
893
|
-
* - {@link Iterable}: allows iterating over the values in the set
|
|
894
|
-
* - {@link Pipeable}: allows chaining operations with the pipe operator
|
|
895
|
-
* - {@link Inspectable}: allows inspecting the contents of the set
|
|
896
|
-
*
|
|
897
|
-
* ## Operations Reference
|
|
898
|
-
*
|
|
899
|
-
* | Category | Operation | Description | Complexity |
|
|
900
|
-
* | ------------ | ------------------------------------------ | ----------------------------------- | ---------- |
|
|
901
|
-
* | constructors | {@link module:MutableHashSet.empty} | Creates an empty MutableHashSet | O(1) |
|
|
902
|
-
* | constructors | {@link module:MutableHashSet.fromIterable} | Creates a set from an iterable | O(n) |
|
|
903
|
-
* | constructors | {@link module:MutableHashSet.make} | Creates a set from multiple values | O(n) |
|
|
904
|
-
* | | | | |
|
|
905
|
-
* | elements | {@link module:MutableHashSet.has} | Checks if a value exists in the set | O(1) avg |
|
|
906
|
-
* | elements | {@link module:MutableHashSet.add} | Adds a value to the set | O(1) avg |
|
|
907
|
-
* | elements | {@link module:MutableHashSet.remove} | Removes a value from the set | O(1) avg |
|
|
908
|
-
* | elements | {@link module:MutableHashSet.size} | Gets the number of elements | O(1) |
|
|
909
|
-
* | elements | {@link module:MutableHashSet.clear} | Removes all values from the set | O(1) |
|
|
910
|
-
*
|
|
911
|
-
* ## Notes
|
|
912
|
-
*
|
|
913
|
-
* ### Mutability Considerations:
|
|
914
|
-
*
|
|
915
|
-
* Unlike most data structures in the Effect ecosystem, `MutableHashSet` is
|
|
916
|
-
* mutable. This means that operations like `add`, `remove`, and `clear` modify
|
|
917
|
-
* the original set rather than creating a new one. This can lead to more
|
|
918
|
-
* efficient code in some scenarios, but requires careful handling to avoid
|
|
919
|
-
* unexpected side effects.
|
|
920
|
-
*
|
|
921
|
-
* ### When to Choose `MutableHashSet` vs {@link module:HashSet}:
|
|
922
|
-
*
|
|
923
|
-
* - Use `MutableHashSet` when you need to build or modify a set incrementally and
|
|
924
|
-
* performance is a priority
|
|
925
|
-
* - Use `HashSet` when you want immutability guarantees and functional
|
|
926
|
-
* programming patterns
|
|
927
|
-
* - Consider using {@link module:HashSet}'s bounded mutation context (via
|
|
928
|
-
* {@link module:HashSet.beginMutation}, {@link module:HashSet.endMutation}, and
|
|
929
|
-
* {@link module:HashSet.mutate} methods) when you need temporary mutability
|
|
930
|
-
* within an otherwise immutable context - this approach might be sufficient
|
|
931
|
-
* for many use cases without requiring a separate `MutableHashSet`
|
|
932
|
-
* - `MutableHashSet` is often useful for local operations where the mutability is
|
|
933
|
-
* contained and doesn't leak into the broader application
|
|
934
|
-
*
|
|
935
|
-
* @module MutableHashSet
|
|
936
|
-
* @since 2.0.0
|
|
937
|
-
*/
|
|
938
|
-
export * as MutableHashSet from "./MutableHashSet.js"
|
|
939
|
-
|
|
940
|
-
/**
|
|
941
|
-
* @since 2.0.0
|
|
942
|
-
*/
|
|
943
|
-
export * as MutableList from "./MutableList.js"
|
|
944
|
-
|
|
945
|
-
/**
|
|
946
|
-
* @since 2.0.0
|
|
947
|
-
*/
|
|
948
|
-
export * as MutableQueue from "./MutableQueue.js"
|
|
949
|
-
|
|
950
|
-
/**
|
|
951
|
-
* @since 2.0.0
|
|
952
|
-
*/
|
|
953
|
-
export * as MutableRef from "./MutableRef.js"
|
|
954
|
-
|
|
955
|
-
/**
|
|
956
|
-
* @since 2.0.0
|
|
957
|
-
*/
|
|
958
|
-
export * as NonEmptyIterable from "./NonEmptyIterable.js"
|
|
959
|
-
|
|
960
|
-
/**
|
|
961
|
-
* # Number
|
|
962
|
-
*
|
|
963
|
-
* This module provides utility functions and type class instances for working
|
|
964
|
-
* with the `number` type in TypeScript. It includes functions for basic
|
|
965
|
-
* arithmetic operations, as well as type class instances for `Equivalence` and
|
|
966
|
-
* `Order`.
|
|
967
|
-
*
|
|
968
|
-
* ## Operations Reference
|
|
969
|
-
*
|
|
970
|
-
* | Category | Operation | Description | Domain | Co-domain |
|
|
971
|
-
* | ------------ | ------------------------------------------ | ------------------------------------------------------- | ------------------------------ | --------------------- |
|
|
972
|
-
* | constructors | {@link module:Number.parse} | Safely parses a string to a number | `string` | `Option<number>` |
|
|
973
|
-
* | | | | | |
|
|
974
|
-
* | math | {@link module:Number.sum} | Adds two numbers | `number`, `number` | `number` |
|
|
975
|
-
* | math | {@link module:Number.sumAll} | Sums all numbers in a collection | `Iterable<number>` | `number` |
|
|
976
|
-
* | math | {@link module:Number.subtract} | Subtracts one number from another | `number`, `number` | `number` |
|
|
977
|
-
* | math | {@link module:Number.multiply} | Multiplies two numbers | `number`, `number` | `number` |
|
|
978
|
-
* | math | {@link module:Number.multiplyAll} | Multiplies all numbers in a collection | `Iterable<number>` | `number` |
|
|
979
|
-
* | math | {@link module:Number.divide} | Safely divides handling division by zero | `number`, `number` | `Option<number>` |
|
|
980
|
-
* | math | {@link module:Number.unsafeDivide} | Divides but misbehaves for division by zero | `number`, `number` | `number` |
|
|
981
|
-
* | math | {@link module:Number.remainder} | Calculates remainder of division | `number`, `number` | `number` |
|
|
982
|
-
* | math | {@link module:Number.increment} | Adds 1 to a number | `number` | `number` |
|
|
983
|
-
* | math | {@link module:Number.decrement} | Subtracts 1 from a number | `number` | `number` |
|
|
984
|
-
* | math | {@link module:Number.sign} | Determines the sign of a number | `number` | `Ordering` |
|
|
985
|
-
* | math | {@link module:Number.nextPow2} | Finds the next power of 2 | `number` | `number` |
|
|
986
|
-
* | math | {@link module:Number.round} | Rounds a number with specified precision | `number`, `number` | `number` |
|
|
987
|
-
* | | | | | |
|
|
988
|
-
* | predicates | {@link module:Number.between} | Checks if a number is in a range | `number`, `{minimum, maximum}` | `boolean` |
|
|
989
|
-
* | predicates | {@link module:Number.lessThan} | Checks if one number is less than another | `number`, `number` | `boolean` |
|
|
990
|
-
* | predicates | {@link module:Number.lessThanOrEqualTo} | Checks if one number is less than or equal | `number`, `number` | `boolean` |
|
|
991
|
-
* | predicates | {@link module:Number.greaterThan} | Checks if one number is greater than another | `number`, `number` | `boolean` |
|
|
992
|
-
* | predicates | {@link module:Number.greaterThanOrEqualTo} | Checks if one number is greater or equal | `number`, `number` | `boolean` |
|
|
993
|
-
* | | | | | |
|
|
994
|
-
* | guards | {@link module:Number.isNumber} | Type guard for JavaScript numbers | `unknown` | `boolean` |
|
|
995
|
-
* | | | | | |
|
|
996
|
-
* | comparison | {@link module:Number.min} | Returns the minimum of two numbers | `number`, `number` | `number` |
|
|
997
|
-
* | comparison | {@link module:Number.max} | Returns the maximum of two numbers | `number`, `number` | `number` |
|
|
998
|
-
* | comparison | {@link module:Number.clamp} | Restricts a number to a range | `number`, `{minimum, maximum}` | `number` |
|
|
999
|
-
* | | | | | |
|
|
1000
|
-
* | instances | {@link module:Number.Equivalence} | Equivalence instance for numbers | | `Equivalence<number>` |
|
|
1001
|
-
* | instances | {@link module:Number.Order} | Order instance for numbers | | `Order<number>` |
|
|
1002
|
-
* | | | | | |
|
|
1003
|
-
* | errors | {@link module:Number.DivisionByZeroError} | Error thrown by unsafeDivide | | |
|
|
1004
|
-
*
|
|
1005
|
-
* ## Composition Patterns and Type Safety
|
|
1006
|
-
*
|
|
1007
|
-
* When building function pipelines, understanding how types flow through
|
|
1008
|
-
* operations is critical:
|
|
1009
|
-
*
|
|
1010
|
-
* ### Composing with type-preserving operations
|
|
1011
|
-
*
|
|
1012
|
-
* Most operations in this module are type-preserving (`number → number`),
|
|
1013
|
-
* making them easily composable in pipelines:
|
|
1014
|
-
*
|
|
1015
|
-
* ```ts
|
|
1016
|
-
* import { pipe } from "effect"
|
|
1017
|
-
* import * as Number from "effect/Number"
|
|
1018
|
-
*
|
|
1019
|
-
* const result = pipe(
|
|
1020
|
-
* 10,
|
|
1021
|
-
* Number.increment, // number → number
|
|
1022
|
-
* Number.multiply(2), // number → number
|
|
1023
|
-
* Number.round(1) // number → number
|
|
1024
|
-
* ) // Result: number (21)
|
|
1025
|
-
* ```
|
|
1026
|
-
*
|
|
1027
|
-
* ### Working with Option results
|
|
1028
|
-
*
|
|
1029
|
-
* Operations that might fail (like division by zero) return Option types and
|
|
1030
|
-
* require Option combinators:
|
|
1031
|
-
*
|
|
1032
|
-
* ```ts
|
|
1033
|
-
* import { pipe, Option } from "effect"
|
|
1034
|
-
* import * as Number from "effect/Number"
|
|
1035
|
-
*
|
|
1036
|
-
* const result = pipe(
|
|
1037
|
-
* 10,
|
|
1038
|
-
* Number.divide(0), // number → Option<number>
|
|
1039
|
-
* Option.getOrElse(() => 0) // Option<number> → number
|
|
1040
|
-
* ) // Result: number (0)
|
|
1041
|
-
* ```
|
|
1042
|
-
*
|
|
1043
|
-
* ### Composition best practices
|
|
1044
|
-
*
|
|
1045
|
-
* - Chain type-preserving operations for maximum composability
|
|
1046
|
-
* - Use Option combinators when working with potentially failing operations
|
|
1047
|
-
* - Consider using Effect for operations that might fail with specific errors
|
|
1048
|
-
* - Remember that all operations maintain JavaScript's floating-point precision
|
|
1049
|
-
* limitations
|
|
1050
|
-
*
|
|
1051
|
-
* @module Number
|
|
1052
|
-
* @since 2.0.0
|
|
1053
|
-
* @see {@link module:BigInt} for more similar operations on `bigint` types
|
|
1054
|
-
* @see {@link module:BigDecimal} for more similar operations on `BigDecimal` types
|
|
1055
|
-
*/
|
|
1056
|
-
export * as Number from "./Number.js"
|
|
1057
|
-
|
|
1058
|
-
/**
|
|
1059
|
-
* @since 2.0.0
|
|
1060
|
-
*/
|
|
1061
|
-
export * as Option from "./Option.js"
|
|
1062
|
-
|
|
1063
|
-
/**
|
|
1064
|
-
* This module provides an implementation of the `Order` type class which is used to define a total ordering on some type `A`.
|
|
1065
|
-
* An order is defined by a relation `<=`, which obeys the following laws:
|
|
1066
|
-
*
|
|
1067
|
-
* - either `x <= y` or `y <= x` (totality)
|
|
1068
|
-
* - if `x <= y` and `y <= x`, then `x == y` (antisymmetry)
|
|
1069
|
-
* - if `x <= y` and `y <= z`, then `x <= z` (transitivity)
|
|
1070
|
-
*
|
|
1071
|
-
* The truth table for compare is defined as follows:
|
|
1072
|
-
*
|
|
1073
|
-
* | `x <= y` | `x >= y` | Ordering | |
|
|
1074
|
-
* | -------- | -------- | -------- | --------------------- |
|
|
1075
|
-
* | `true` | `true` | `0` | corresponds to x == y |
|
|
1076
|
-
* | `true` | `false` | `< 0` | corresponds to x < y |
|
|
1077
|
-
* | `false` | `true` | `> 0` | corresponds to x > y |
|
|
1078
|
-
*
|
|
1079
|
-
* @since 2.0.0
|
|
1080
|
-
*/
|
|
1081
|
-
export * as Order from "./Order.js"
|
|
1082
|
-
|
|
1083
|
-
/**
|
|
1084
|
-
* @since 2.0.0
|
|
1085
|
-
*/
|
|
1086
|
-
export * as Ordering from "./Ordering.js"
|
|
1087
|
-
|
|
1088
|
-
/**
|
|
1089
|
-
* @since 3.10.0
|
|
1090
|
-
*/
|
|
1091
|
-
export * as ParseResult from "./ParseResult.js"
|
|
1092
|
-
|
|
1093
|
-
/**
|
|
1094
|
-
* @since 3.19.4
|
|
1095
|
-
* @experimental
|
|
1096
|
-
*/
|
|
1097
|
-
export * as PartitionedSemaphore from "./PartitionedSemaphore.js"
|
|
1098
|
-
|
|
1099
|
-
/**
|
|
1100
|
-
* @since 2.0.0
|
|
1101
|
-
*/
|
|
1102
|
-
export * as Pipeable from "./Pipeable.js"
|
|
1103
|
-
|
|
1104
|
-
/**
|
|
1105
|
-
* @since 2.0.0
|
|
1106
|
-
*/
|
|
1107
|
-
export * as Pool from "./Pool.js"
|
|
1108
|
-
|
|
1109
|
-
/**
|
|
1110
|
-
* This module provides a collection of functions for working with predicates and refinements.
|
|
1111
|
-
*
|
|
1112
|
-
* A `Predicate<A>` is a function that takes a value of type `A` and returns a boolean.
|
|
1113
|
-
* It is used to check if a value satisfies a certain condition.
|
|
1114
|
-
*
|
|
1115
|
-
* A `Refinement<A, B>` is a special type of predicate that not only checks a condition
|
|
1116
|
-
* but also provides a type guard, allowing TypeScript to narrow the type of the input
|
|
1117
|
-
* value from `A` to a more specific type `B` within a conditional block.
|
|
1118
|
-
*
|
|
1119
|
-
* The module includes:
|
|
1120
|
-
* - Basic predicates and refinements for common types (e.g., `isString`, `isNumber`).
|
|
1121
|
-
* - Combinators to create new predicates from existing ones (e.g., `and`, `or`, `not`).
|
|
1122
|
-
* - Advanced combinators for working with data structures (e.g., `tuple`, `struct`).
|
|
1123
|
-
* - Type-level utilities for inspecting predicate and refinement types.
|
|
1124
|
-
*
|
|
1125
|
-
* @since 2.0.0
|
|
1126
|
-
*/
|
|
1127
|
-
export * as Predicate from "./Predicate.js"
|
|
1128
|
-
|
|
1129
|
-
/**
|
|
1130
|
-
* @since 3.10.0
|
|
1131
|
-
*/
|
|
1132
|
-
export * as Pretty from "./Pretty.js"
|
|
1133
|
-
|
|
1134
|
-
/**
|
|
1135
|
-
* @since 2.0.0
|
|
1136
|
-
*/
|
|
1137
|
-
export * as PrimaryKey from "./PrimaryKey.js"
|
|
1138
|
-
|
|
1139
|
-
/**
|
|
1140
|
-
* @since 2.0.0
|
|
1141
|
-
*/
|
|
1142
|
-
export * as PubSub from "./PubSub.js"
|
|
1143
|
-
|
|
1144
|
-
/**
|
|
1145
|
-
* @since 2.0.0
|
|
1146
|
-
*/
|
|
1147
|
-
export * as Queue from "./Queue.js"
|
|
1148
|
-
|
|
1149
|
-
/**
|
|
1150
|
-
* @since 2.0.0
|
|
1151
|
-
*/
|
|
1152
|
-
export * as Random from "./Random.js"
|
|
1153
|
-
|
|
1154
|
-
/**
|
|
1155
|
-
* Limits the number of calls to a resource to a maximum amount in some interval.
|
|
1156
|
-
*
|
|
1157
|
-
* @since 2.0.0
|
|
1158
|
-
*/
|
|
1159
|
-
export * as RateLimiter from "./RateLimiter.js"
|
|
1160
|
-
|
|
1161
|
-
/**
|
|
1162
|
-
* @since 3.5.0
|
|
1163
|
-
*/
|
|
1164
|
-
export * as RcMap from "./RcMap.js"
|
|
1165
|
-
|
|
1166
|
-
/**
|
|
1167
|
-
* @since 3.5.0
|
|
1168
|
-
*/
|
|
1169
|
-
export * as RcRef from "./RcRef.js"
|
|
1170
|
-
|
|
1171
|
-
/**
|
|
1172
|
-
* @since 2.0.0
|
|
1173
|
-
*/
|
|
1174
|
-
export * as Readable from "./Readable.js"
|
|
1175
|
-
|
|
1176
|
-
/**
|
|
1177
|
-
* This module provides utility functions for working with records in TypeScript.
|
|
1178
|
-
*
|
|
1179
|
-
* @since 2.0.0
|
|
1180
|
-
*/
|
|
1181
|
-
export * as Record from "./Record.js"
|
|
1182
|
-
|
|
1183
|
-
/**
|
|
1184
|
-
* @since 2.0.0
|
|
1185
|
-
*/
|
|
1186
|
-
export * as RedBlackTree from "./RedBlackTree.js"
|
|
1187
|
-
|
|
1188
|
-
/**
|
|
1189
|
-
* The Redacted module provides functionality for handling sensitive information
|
|
1190
|
-
* securely within your application. By using the `Redacted` data type, you can
|
|
1191
|
-
* ensure that sensitive values are not accidentally exposed in logs or error
|
|
1192
|
-
* messages.
|
|
1193
|
-
*
|
|
1194
|
-
* @since 3.3.0
|
|
1195
|
-
*/
|
|
1196
|
-
export * as Redacted from "./Redacted.js"
|
|
1197
|
-
|
|
1198
|
-
/**
|
|
1199
|
-
* @since 2.0.0
|
|
1200
|
-
*/
|
|
1201
|
-
export * as Ref from "./Ref.js"
|
|
1202
|
-
|
|
1203
|
-
/**
|
|
1204
|
-
* This module provides utility functions for working with RegExp in TypeScript.
|
|
1205
|
-
*
|
|
1206
|
-
* @since 2.0.0
|
|
1207
|
-
*/
|
|
1208
|
-
export * as RegExp from "./RegExp.js"
|
|
1209
|
-
|
|
1210
|
-
/**
|
|
1211
|
-
* @since 2.0.0
|
|
1212
|
-
*/
|
|
1213
|
-
export * as Reloadable from "./Reloadable.js"
|
|
1214
|
-
|
|
1215
|
-
/**
|
|
1216
|
-
* @since 2.0.0
|
|
1217
|
-
*/
|
|
1218
|
-
export * as Request from "./Request.js"
|
|
1219
|
-
|
|
1220
|
-
/**
|
|
1221
|
-
* @since 2.0.0
|
|
1222
|
-
*/
|
|
1223
|
-
export * as RequestBlock from "./RequestBlock.js"
|
|
1224
|
-
|
|
1225
|
-
/**
|
|
1226
|
-
* @since 2.0.0
|
|
1227
|
-
*/
|
|
1228
|
-
export * as RequestResolver from "./RequestResolver.js"
|
|
1229
|
-
|
|
1230
|
-
/**
|
|
1231
|
-
* @since 2.0.0
|
|
1232
|
-
*/
|
|
1233
|
-
export * as Resource from "./Resource.js"
|
|
1234
|
-
|
|
1235
|
-
/**
|
|
1236
|
-
* @since 2.0.0
|
|
1237
|
-
*/
|
|
1238
|
-
export * as Runtime from "./Runtime.js"
|
|
1239
|
-
|
|
1240
|
-
/**
|
|
1241
|
-
* @since 2.0.0
|
|
1242
|
-
*/
|
|
1243
|
-
export * as RuntimeFlags from "./RuntimeFlags.js"
|
|
1244
|
-
|
|
1245
|
-
/**
|
|
1246
|
-
* @since 2.0.0
|
|
1247
|
-
*/
|
|
1248
|
-
export * as RuntimeFlagsPatch from "./RuntimeFlagsPatch.js"
|
|
1249
|
-
|
|
1250
|
-
/**
|
|
1251
|
-
* @since 2.0.0
|
|
1252
|
-
*/
|
|
1253
|
-
export * as STM from "./STM.js"
|
|
1254
|
-
|
|
1255
|
-
/**
|
|
1256
|
-
* @since 2.0.0
|
|
1257
|
-
*/
|
|
1258
|
-
export * as Schedule from "./Schedule.js"
|
|
1259
|
-
|
|
1260
|
-
/**
|
|
1261
|
-
* @since 2.0.0
|
|
1262
|
-
*/
|
|
1263
|
-
export * as ScheduleDecision from "./ScheduleDecision.js"
|
|
1264
|
-
|
|
1265
|
-
/**
|
|
1266
|
-
* @since 2.0.0
|
|
1267
|
-
*/
|
|
1268
|
-
export * as ScheduleInterval from "./ScheduleInterval.js"
|
|
1269
|
-
|
|
1270
|
-
/**
|
|
1271
|
-
* @since 2.0.0
|
|
1272
|
-
*/
|
|
1273
|
-
export * as ScheduleIntervals from "./ScheduleIntervals.js"
|
|
1274
|
-
|
|
1275
|
-
/**
|
|
1276
|
-
* @since 2.0.0
|
|
1277
|
-
*/
|
|
1278
|
-
export * as Scheduler from "./Scheduler.js"
|
|
1279
|
-
|
|
1280
|
-
/**
|
|
1281
|
-
* @since 3.10.0
|
|
1282
|
-
*/
|
|
1283
|
-
export * as Schema from "./Schema.js"
|
|
1284
|
-
|
|
1285
|
-
/**
|
|
1286
|
-
* @since 3.10.0
|
|
1287
|
-
*/
|
|
1288
|
-
export * as SchemaAST from "./SchemaAST.js"
|
|
1289
|
-
|
|
1290
|
-
/**
|
|
1291
|
-
* @since 2.0.0
|
|
1292
|
-
*/
|
|
1293
|
-
export * as Scope from "./Scope.js"
|
|
1294
|
-
|
|
1295
|
-
/**
|
|
1296
|
-
* @since 2.0.0
|
|
1297
|
-
*/
|
|
1298
|
-
export * as ScopedCache from "./ScopedCache.js"
|
|
1299
|
-
|
|
1300
|
-
/**
|
|
1301
|
-
* @since 2.0.0
|
|
1302
|
-
*/
|
|
1303
|
-
export * as ScopedRef from "./ScopedRef.js"
|
|
1304
|
-
|
|
1305
|
-
/**
|
|
1306
|
-
* @since 2.0.0
|
|
1307
|
-
* @deprecated
|
|
1308
|
-
*/
|
|
1309
|
-
export * as Secret from "./Secret.js"
|
|
1310
|
-
|
|
1311
|
-
/**
|
|
1312
|
-
* @since 2.0.0
|
|
1313
|
-
*/
|
|
1314
|
-
export * as SingleProducerAsyncInput from "./SingleProducerAsyncInput.js"
|
|
1315
|
-
|
|
1316
|
-
/**
|
|
1317
|
-
* @since 2.0.0
|
|
1318
|
-
*/
|
|
1319
|
-
export * as Sink from "./Sink.js"
|
|
1320
|
-
|
|
1321
|
-
/**
|
|
1322
|
-
* @since 2.0.0
|
|
1323
|
-
*/
|
|
1324
|
-
export * as SortedMap from "./SortedMap.js"
|
|
1325
|
-
|
|
1326
|
-
/**
|
|
1327
|
-
* @since 2.0.0
|
|
1328
|
-
*/
|
|
1329
|
-
export * as SortedSet from "./SortedSet.js"
|
|
1330
|
-
|
|
1331
|
-
/**
|
|
1332
|
-
* @since 2.0.0
|
|
1333
|
-
*/
|
|
1334
|
-
export * as Stream from "./Stream.js"
|
|
1335
|
-
|
|
1336
|
-
/**
|
|
1337
|
-
* @since 2.0.0
|
|
1338
|
-
*/
|
|
1339
|
-
export * as StreamEmit from "./StreamEmit.js"
|
|
1340
|
-
|
|
1341
|
-
/**
|
|
1342
|
-
* @since 2.0.0
|
|
1343
|
-
*/
|
|
1344
|
-
export * as StreamHaltStrategy from "./StreamHaltStrategy.js"
|
|
1345
|
-
|
|
1346
|
-
/**
|
|
1347
|
-
* @since 2.0.0
|
|
1348
|
-
*/
|
|
1349
|
-
export * as Streamable from "./Streamable.js"
|
|
1350
|
-
|
|
1351
|
-
/**
|
|
1352
|
-
* This module provides utility functions and type class instances for working with the `string` type in TypeScript.
|
|
1353
|
-
* It includes functions for basic string manipulation, as well as type class instances for
|
|
1354
|
-
* `Equivalence` and `Order`.
|
|
1355
|
-
*
|
|
1356
|
-
* @since 2.0.0
|
|
1357
|
-
*/
|
|
1358
|
-
export * as String from "./String.js"
|
|
1359
|
-
|
|
1360
|
-
/**
|
|
1361
|
-
* This module provides utility functions for working with structs in TypeScript.
|
|
1362
|
-
*
|
|
1363
|
-
* @since 2.0.0
|
|
1364
|
-
*/
|
|
1365
|
-
export * as Struct from "./Struct.js"
|
|
1366
|
-
|
|
1367
|
-
/**
|
|
1368
|
-
* @since 2.0.0
|
|
1369
|
-
*/
|
|
1370
|
-
export * as Subscribable from "./Subscribable.js"
|
|
1371
|
-
|
|
1372
|
-
/**
|
|
1373
|
-
* @since 2.0.0
|
|
1374
|
-
*/
|
|
1375
|
-
export * as SubscriptionRef from "./SubscriptionRef.js"
|
|
1376
|
-
|
|
1377
|
-
/**
|
|
1378
|
-
* A `Supervisor<T>` is allowed to supervise the launching and termination of
|
|
1379
|
-
* fibers, producing some visible value of type `T` from the supervision.
|
|
1380
|
-
*
|
|
1381
|
-
* @since 2.0.0
|
|
1382
|
-
*/
|
|
1383
|
-
export * as Supervisor from "./Supervisor.js"
|
|
1384
|
-
|
|
1385
|
-
/**
|
|
1386
|
-
* @since 2.0.0
|
|
1387
|
-
*/
|
|
1388
|
-
export * as Symbol from "./Symbol.js"
|
|
1389
|
-
|
|
1390
|
-
/**
|
|
1391
|
-
* @since 2.0.0
|
|
1392
|
-
*/
|
|
1393
|
-
export * as SynchronizedRef from "./SynchronizedRef.js"
|
|
1394
|
-
|
|
1395
|
-
/**
|
|
1396
|
-
* @since 2.0.0
|
|
1397
|
-
*/
|
|
1398
|
-
export * as TArray from "./TArray.js"
|
|
1399
|
-
|
|
1400
|
-
/**
|
|
1401
|
-
* @since 2.0.0
|
|
1402
|
-
*/
|
|
1403
|
-
export * as TDeferred from "./TDeferred.js"
|
|
1404
|
-
|
|
1405
|
-
/**
|
|
1406
|
-
* @since 2.0.0
|
|
1407
|
-
*/
|
|
1408
|
-
export * as TMap from "./TMap.js"
|
|
1409
|
-
|
|
1410
|
-
/**
|
|
1411
|
-
* @since 2.0.0
|
|
1412
|
-
*/
|
|
1413
|
-
export * as TPriorityQueue from "./TPriorityQueue.js"
|
|
1414
|
-
|
|
1415
|
-
/**
|
|
1416
|
-
* @since 2.0.0
|
|
1417
|
-
*/
|
|
1418
|
-
export * as TPubSub from "./TPubSub.js"
|
|
1419
|
-
|
|
1420
|
-
/**
|
|
1421
|
-
* @since 2.0.0
|
|
1422
|
-
*/
|
|
1423
|
-
export * as TQueue from "./TQueue.js"
|
|
1424
|
-
|
|
1425
|
-
/**
|
|
1426
|
-
* @since 2.0.0
|
|
1427
|
-
*/
|
|
1428
|
-
export * as TRandom from "./TRandom.js"
|
|
1429
|
-
|
|
1430
|
-
/**
|
|
1431
|
-
* @since 2.0.0
|
|
1432
|
-
*/
|
|
1433
|
-
export * as TReentrantLock from "./TReentrantLock.js"
|
|
1434
|
-
|
|
1435
|
-
/**
|
|
1436
|
-
* @since 2.0.0
|
|
1437
|
-
*/
|
|
1438
|
-
export * as TRef from "./TRef.js"
|
|
1439
|
-
|
|
1440
|
-
/**
|
|
1441
|
-
* @since 2.0.0
|
|
1442
|
-
*/
|
|
1443
|
-
export * as TSemaphore from "./TSemaphore.js"
|
|
1444
|
-
|
|
1445
|
-
/**
|
|
1446
|
-
* @since 2.0.0
|
|
1447
|
-
*/
|
|
1448
|
-
export * as TSet from "./TSet.js"
|
|
1449
|
-
|
|
1450
|
-
/**
|
|
1451
|
-
* @since 3.10.0
|
|
1452
|
-
*/
|
|
1453
|
-
export * as TSubscriptionRef from "./TSubscriptionRef.js"
|
|
1454
|
-
|
|
1455
|
-
/**
|
|
1456
|
-
* @since 2.0.0
|
|
1457
|
-
*/
|
|
1458
|
-
export * as Take from "./Take.js"
|
|
1459
|
-
|
|
1460
|
-
/**
|
|
1461
|
-
* @since 2.0.0
|
|
1462
|
-
*/
|
|
1463
|
-
export * as TestAnnotation from "./TestAnnotation.js"
|
|
1464
|
-
|
|
1465
|
-
/**
|
|
1466
|
-
* @since 2.0.0
|
|
1467
|
-
*/
|
|
1468
|
-
export * as TestAnnotationMap from "./TestAnnotationMap.js"
|
|
1469
|
-
|
|
1470
|
-
/**
|
|
1471
|
-
* @since 2.0.0
|
|
1472
|
-
*/
|
|
1473
|
-
export * as TestAnnotations from "./TestAnnotations.js"
|
|
1474
|
-
|
|
1475
|
-
/**
|
|
1476
|
-
* @since 2.0.0
|
|
1477
|
-
*/
|
|
1478
|
-
export * as TestClock from "./TestClock.js"
|
|
1479
|
-
|
|
1480
|
-
/**
|
|
1481
|
-
* @since 2.0.0
|
|
1482
|
-
*/
|
|
1483
|
-
export * as TestConfig from "./TestConfig.js"
|
|
1484
|
-
|
|
1485
|
-
/**
|
|
1486
|
-
* @since 2.0.0
|
|
1487
|
-
*/
|
|
1488
|
-
export * as TestContext from "./TestContext.js"
|
|
1489
|
-
|
|
1490
|
-
/**
|
|
1491
|
-
* @since 2.0.0
|
|
1492
|
-
*/
|
|
1493
|
-
export * as TestLive from "./TestLive.js"
|
|
1494
|
-
|
|
1495
|
-
/**
|
|
1496
|
-
* @since 2.0.0
|
|
1497
|
-
*/
|
|
1498
|
-
export * as TestServices from "./TestServices.js"
|
|
1499
|
-
|
|
1500
|
-
/**
|
|
1501
|
-
* @since 2.0.0
|
|
1502
|
-
*/
|
|
1503
|
-
export * as TestSized from "./TestSized.js"
|
|
1504
|
-
|
|
1505
|
-
/**
|
|
1506
|
-
* @since 2.0.0
|
|
1507
|
-
*/
|
|
1508
|
-
export * as Tracer from "./Tracer.js"
|
|
1509
|
-
|
|
1510
|
-
/**
|
|
1511
|
-
* A `Trie` is used for locating specific `string` keys from within a set.
|
|
1512
|
-
*
|
|
1513
|
-
* It works similar to `HashMap`, but with keys required to be `string`.
|
|
1514
|
-
* This constraint unlocks some performance optimizations and new methods to get string prefixes (e.g. `keysWithPrefix`, `longestPrefixOf`).
|
|
1515
|
-
*
|
|
1516
|
-
* Prefix search is also the main feature that makes a `Trie` more suited than `HashMap` for certain usecases.
|
|
1517
|
-
*
|
|
1518
|
-
* A `Trie` is often used to store a dictionary (list of words) that can be searched
|
|
1519
|
-
* in a manner that allows for efficient generation of completion lists
|
|
1520
|
-
* (e.g. predict the rest of a word a user is typing).
|
|
1521
|
-
*
|
|
1522
|
-
* A `Trie` has O(n) lookup time where `n` is the size of the key,
|
|
1523
|
-
* or even less than `n` on search misses.
|
|
1524
|
-
*
|
|
1525
|
-
* @since 2.0.0
|
|
1526
|
-
*/
|
|
1527
|
-
export * as Trie from "./Trie.js"
|
|
1528
|
-
|
|
1529
|
-
/**
|
|
1530
|
-
* This module provides utility functions for working with tuples in TypeScript.
|
|
1531
|
-
*
|
|
1532
|
-
* @since 2.0.0
|
|
1533
|
-
*/
|
|
1534
|
-
export * as Tuple from "./Tuple.js"
|
|
1535
|
-
|
|
1536
|
-
/**
|
|
1537
|
-
* A collection of types that are commonly used types.
|
|
1538
|
-
*
|
|
1539
|
-
* @since 2.0.0
|
|
1540
|
-
*/
|
|
1541
|
-
export * as Types from "./Types.js"
|
|
1542
|
-
|
|
1543
|
-
/**
|
|
1544
|
-
* @since 2.0.0
|
|
1545
|
-
*/
|
|
1546
|
-
export * as Unify from "./Unify.js"
|
|
1547
|
-
|
|
1548
|
-
/**
|
|
1549
|
-
* @since 2.0.0
|
|
1550
|
-
*/
|
|
1551
|
-
export * as UpstreamPullRequest from "./UpstreamPullRequest.js"
|
|
1552
|
-
|
|
1553
|
-
/**
|
|
1554
|
-
* @since 2.0.0
|
|
1555
|
-
*/
|
|
1556
|
-
export * as UpstreamPullStrategy from "./UpstreamPullStrategy.js"
|
|
1557
|
-
|
|
1558
|
-
/**
|
|
1559
|
-
* @since 2.0.0
|
|
1560
|
-
*/
|
|
1561
|
-
export * as Utils from "./Utils.js"
|