effect 4.0.0-beta.83 → 4.0.0-beta.85
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Array.d.ts +64 -64
- package/dist/Array.js +26 -26
- package/dist/Cache.d.ts +1 -1
- package/dist/Cache.js +1 -1
- package/dist/Cause.d.ts +68 -68
- package/dist/Cause.js +47 -47
- package/dist/Channel.d.ts +5 -5
- package/dist/Channel.js +3 -3
- package/dist/Clock.d.ts +1 -1
- package/dist/Clock.js +1 -1
- package/dist/Combiner.d.ts +9 -9
- package/dist/Combiner.js +8 -8
- package/dist/Config.d.ts +15 -94
- package/dist/Config.d.ts.map +1 -1
- package/dist/Config.js +22 -70
- package/dist/Config.js.map +1 -1
- package/dist/ConfigProvider.d.ts +58 -74
- package/dist/ConfigProvider.d.ts.map +1 -1
- package/dist/ConfigProvider.js +66 -41
- package/dist/ConfigProvider.js.map +1 -1
- package/dist/Console.d.ts +1 -1
- package/dist/Console.js +1 -1
- package/dist/Context.d.ts.map +1 -1
- package/dist/Context.js +4 -3
- package/dist/Context.js.map +1 -1
- package/dist/Data.d.ts +15 -15
- package/dist/Data.js +3 -3
- package/dist/DateTime.d.ts +6 -6
- package/dist/DateTime.js +2 -2
- package/dist/Duration.d.ts +3 -3
- package/dist/Duration.js +3 -3
- package/dist/Effect.d.ts +84 -45
- package/dist/Effect.d.ts.map +1 -1
- package/dist/Effect.js +72 -33
- package/dist/Effect.js.map +1 -1
- package/dist/Equal.d.ts +7 -7
- package/dist/Equal.js +5 -5
- package/dist/Equivalence.d.ts +17 -17
- package/dist/Equivalence.js +13 -13
- package/dist/Exit.d.ts +3 -3
- package/dist/Exit.js +3 -3
- package/dist/Formatter.d.ts +5 -5
- package/dist/Formatter.js +4 -4
- package/dist/Function.d.ts +10 -10
- package/dist/Function.js +3 -3
- package/dist/HashMap.d.ts +3 -3
- package/dist/HashMap.js +1 -1
- package/dist/Iterable.d.ts +6 -6
- package/dist/Iterable.js +2 -2
- package/dist/JsonPatch.d.ts +2 -2
- package/dist/Layer.d.ts +1 -1
- package/dist/Layer.js +5 -4
- package/dist/Layer.js.map +1 -1
- package/dist/LayerMap.d.ts.map +1 -1
- package/dist/LayerMap.js +4 -3
- package/dist/LayerMap.js.map +1 -1
- package/dist/Logger.d.ts +1 -1
- package/dist/Logger.js +1 -1
- package/dist/Match.d.ts +8 -8
- package/dist/Match.js +8 -8
- package/dist/Metric.d.ts +3 -3
- package/dist/Metric.js +3 -3
- package/dist/Optic.d.ts +30 -30
- package/dist/Optic.js +12 -12
- package/dist/Option.d.ts +7 -7
- package/dist/Option.js +7 -7
- package/dist/Order.d.ts +23 -23
- package/dist/Order.js +20 -20
- package/dist/Pool.d.ts +1 -1
- package/dist/Pool.js +1 -1
- package/dist/Predicate.d.ts +88 -88
- package/dist/Predicate.js +47 -47
- package/dist/PubSub.d.ts +3 -3
- package/dist/PubSub.js +3 -3
- package/dist/Random.d.ts +31 -0
- package/dist/Random.d.ts.map +1 -1
- package/dist/Random.js +32 -0
- package/dist/Random.js.map +1 -1
- package/dist/Reducer.d.ts +1 -1
- package/dist/Reducer.js +1 -1
- package/dist/Result.d.ts +18 -18
- package/dist/Result.js +8 -8
- package/dist/Runtime.d.ts +1 -1
- package/dist/Runtime.js +1 -1
- package/dist/Schema.d.ts +313 -126
- package/dist/Schema.d.ts.map +1 -1
- package/dist/Schema.js +316 -127
- package/dist/Schema.js.map +1 -1
- package/dist/SchemaAST.d.ts +9 -8
- package/dist/SchemaAST.d.ts.map +1 -1
- package/dist/SchemaAST.js +203 -140
- package/dist/SchemaAST.js.map +1 -1
- package/dist/SchemaGetter.d.ts +48 -48
- package/dist/SchemaGetter.js +44 -44
- package/dist/SchemaIssue.d.ts +3 -3
- package/dist/SchemaIssue.js +3 -3
- package/dist/SchemaParser.d.ts +122 -22
- package/dist/SchemaParser.d.ts.map +1 -1
- package/dist/SchemaParser.js +186 -50
- package/dist/SchemaParser.js.map +1 -1
- package/dist/SchemaRepresentation.d.ts +1 -1
- package/dist/SchemaRepresentation.d.ts.map +1 -1
- package/dist/SchemaRepresentation.js +96 -2
- package/dist/SchemaRepresentation.js.map +1 -1
- package/dist/SchemaTransformation.d.ts +20 -20
- package/dist/SchemaTransformation.js +18 -18
- package/dist/Stream.d.ts +3 -3
- package/dist/Stream.js +2 -2
- package/dist/Stream.js.map +1 -1
- package/dist/String.d.ts +1 -1
- package/dist/String.js +1 -1
- package/dist/Struct.d.ts +1 -1
- package/dist/Struct.js +1 -1
- package/dist/Types.d.ts +13 -13
- package/dist/internal/effect.js +33 -20
- package/dist/internal/effect.js.map +1 -1
- package/dist/internal/schema/arbitrary.js +17 -1
- package/dist/internal/schema/arbitrary.js.map +1 -1
- package/dist/internal/schema/cause.d.ts +2 -0
- package/dist/internal/schema/cause.d.ts.map +1 -0
- package/dist/internal/schema/cause.js +24 -0
- package/dist/internal/schema/cause.js.map +1 -0
- package/dist/internal/schema/schema.d.ts +8 -4
- package/dist/internal/schema/schema.d.ts.map +1 -1
- package/dist/internal/schema/schema.js +21 -8
- package/dist/internal/schema/schema.js.map +1 -1
- package/dist/internal/stackTraceLimit.d.ts +2 -0
- package/dist/internal/stackTraceLimit.d.ts.map +1 -0
- package/dist/internal/stackTraceLimit.js +40 -0
- package/dist/internal/stackTraceLimit.js.map +1 -0
- package/dist/internal/tracer.d.ts.map +1 -1
- package/dist/internal/tracer.js +4 -3
- package/dist/internal/tracer.js.map +1 -1
- package/dist/testing/TestSchema.d.ts +3 -3
- package/dist/testing/TestSchema.js +1 -1
- package/dist/unstable/ai/AiError.d.ts +1 -1
- package/dist/unstable/ai/AiError.js +1 -1
- package/dist/unstable/ai/Chat.d.ts +1 -1
- package/dist/unstable/ai/Chat.js +1 -1
- package/dist/unstable/ai/Tool.d.ts.map +1 -1
- package/dist/unstable/ai/Tool.js +4 -5
- package/dist/unstable/ai/Tool.js.map +1 -1
- package/dist/unstable/cli/Prompt.js +2 -2
- package/dist/unstable/cli/Prompt.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiMiddleware.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiMiddleware.js +4 -3
- package/dist/unstable/httpapi/HttpApiMiddleware.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiScalar.d.ts +2 -2
- package/dist/unstable/persistence/PersistedQueue.js +1 -1
- package/dist/unstable/rpc/Rpc.d.ts +1 -1
- package/dist/unstable/rpc/Rpc.js +1 -1
- package/dist/unstable/rpc/RpcGroup.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcGroup.js +3 -4
- package/dist/unstable/rpc/RpcGroup.js.map +1 -1
- package/dist/unstable/rpc/RpcMiddleware.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcMiddleware.js +4 -3
- package/dist/unstable/rpc/RpcMiddleware.js.map +1 -1
- package/dist/unstable/sql/SqlResolver.d.ts.map +1 -1
- package/dist/unstable/sql/SqlResolver.js +15 -2
- package/dist/unstable/sql/SqlResolver.js.map +1 -1
- package/dist/unstable/workflow/Activity.d.ts +1 -0
- package/dist/unstable/workflow/Activity.d.ts.map +1 -1
- package/dist/unstable/workflow/Activity.js +1 -0
- package/dist/unstable/workflow/Activity.js.map +1 -1
- package/dist/unstable/workflow/WorkflowEngine.js +1 -1
- package/dist/unstable/workflow/WorkflowEngine.js.map +1 -1
- package/package.json +1 -1
- package/src/Array.ts +65 -65
- package/src/Cache.ts +1 -1
- package/src/Cause.ts +68 -68
- package/src/Channel.ts +5 -5
- package/src/Clock.ts +1 -1
- package/src/Combiner.ts +9 -9
- package/src/Config.ts +40 -108
- package/src/ConfigProvider.ts +139 -100
- package/src/Console.ts +1 -1
- package/src/Context.ts +4 -5
- package/src/Data.ts +15 -15
- package/src/DateTime.ts +6 -6
- package/src/Duration.ts +3 -3
- package/src/Effect.ts +89 -45
- package/src/Equal.ts +7 -7
- package/src/Equivalence.ts +17 -17
- package/src/Exit.ts +3 -3
- package/src/Formatter.ts +5 -5
- package/src/Function.ts +10 -10
- package/src/HashMap.ts +3 -3
- package/src/Iterable.ts +6 -6
- package/src/JsonPatch.ts +2 -2
- package/src/Layer.ts +5 -5
- package/src/LayerMap.ts +4 -3
- package/src/Logger.ts +1 -1
- package/src/Match.ts +8 -8
- package/src/Metric.ts +3 -3
- package/src/Optic.ts +30 -30
- package/src/Option.ts +7 -7
- package/src/Order.ts +23 -23
- package/src/Pool.ts +1 -1
- package/src/Predicate.ts +88 -88
- package/src/PubSub.ts +3 -3
- package/src/Random.ts +42 -0
- package/src/Reducer.ts +1 -1
- package/src/Result.ts +20 -20
- package/src/Runtime.ts +1 -1
- package/src/Schema.ts +389 -153
- package/src/SchemaAST.ts +237 -148
- package/src/SchemaGetter.ts +48 -48
- package/src/SchemaIssue.ts +3 -3
- package/src/SchemaParser.ts +197 -58
- package/src/SchemaRepresentation.ts +73 -3
- package/src/SchemaTransformation.ts +20 -20
- package/src/Stream.ts +4 -4
- package/src/String.ts +1 -1
- package/src/Struct.ts +1 -1
- package/src/Types.ts +13 -13
- package/src/internal/effect.ts +40 -21
- package/src/internal/schema/arbitrary.ts +23 -2
- package/src/internal/schema/cause.ts +26 -0
- package/src/internal/schema/schema.ts +36 -10
- package/src/internal/stackTraceLimit.ts +63 -0
- package/src/internal/tracer.ts +4 -3
- package/src/testing/TestSchema.ts +3 -3
- package/src/unstable/ai/AiError.ts +1 -1
- package/src/unstable/ai/Chat.ts +1 -1
- package/src/unstable/ai/Tool.ts +4 -3
- package/src/unstable/cli/Prompt.ts +1 -1
- package/src/unstable/httpapi/HttpApiMiddleware.ts +4 -3
- package/src/unstable/httpapi/HttpApiScalar.ts +2 -2
- package/src/unstable/persistence/PersistedQueue.ts +1 -1
- package/src/unstable/rpc/Rpc.ts +1 -1
- package/src/unstable/rpc/RpcGroup.ts +3 -4
- package/src/unstable/rpc/RpcMiddleware.ts +4 -3
- package/src/unstable/sql/SqlResolver.ts +15 -2
- package/src/unstable/workflow/Activity.ts +2 -0
- package/src/unstable/workflow/WorkflowEngine.ts +1 -1
package/src/Array.ts
CHANGED
|
@@ -34,7 +34,7 @@ import type { NoInfer, TupleOf } from "./Types.ts"
|
|
|
34
34
|
* Use to access native JavaScript array constructor methods such as `isArray`
|
|
35
35
|
* or `from` from the Effect module namespace.
|
|
36
36
|
*
|
|
37
|
-
* **Example** (
|
|
37
|
+
* **Example** (Accessing the Array constructor)
|
|
38
38
|
*
|
|
39
39
|
* ```ts
|
|
40
40
|
* import { Array } from "effect"
|
|
@@ -458,7 +458,7 @@ export const ensure = <A>(self: ReadonlyArray<A> | A): Array<A> => Array.isArray
|
|
|
458
458
|
* Key order follows `Object.entries` semantics. Empty records produce an empty
|
|
459
459
|
* array.
|
|
460
460
|
*
|
|
461
|
-
* **Example** (
|
|
461
|
+
* **Example** (Converting a record to entries)
|
|
462
462
|
*
|
|
463
463
|
* ```ts
|
|
464
464
|
* import { Array } from "effect"
|
|
@@ -482,7 +482,7 @@ export const fromRecord: <K extends string, A>(self: Readonly<Record<K, A>>) =>
|
|
|
482
482
|
*
|
|
483
483
|
* Use to convert a single `Option` into an array for downstream array operations.
|
|
484
484
|
*
|
|
485
|
-
* **Example** (Option to array)
|
|
485
|
+
* **Example** (Converting an Option to an array)
|
|
486
486
|
*
|
|
487
487
|
* ```ts
|
|
488
488
|
* import { Array, Option } from "effect"
|
|
@@ -626,7 +626,7 @@ export const match: {
|
|
|
626
626
|
*
|
|
627
627
|
* `onNonEmpty` receives `(head, tail)` where `tail` is the rest of the array.
|
|
628
628
|
*
|
|
629
|
-
* **Example** (
|
|
629
|
+
* **Example** (Destructuring head and tail)
|
|
630
630
|
*
|
|
631
631
|
* ```ts
|
|
632
632
|
* import { Array } from "effect"
|
|
@@ -659,7 +659,7 @@ export const matchLeft: {
|
|
|
659
659
|
*
|
|
660
660
|
* `onNonEmpty` receives `(head, tail)` where `tail` is the rest of the array.
|
|
661
661
|
*
|
|
662
|
-
* **Example** (
|
|
662
|
+
* **Example** (Destructuring head and tail)
|
|
663
663
|
*
|
|
664
664
|
* ```ts
|
|
665
665
|
* import { Array } from "effect"
|
|
@@ -697,7 +697,7 @@ export const matchLeft: {
|
|
|
697
697
|
*
|
|
698
698
|
* `onNonEmpty` receives `(head, tail)` where `tail` is the rest of the array.
|
|
699
699
|
*
|
|
700
|
-
* **Example** (
|
|
700
|
+
* **Example** (Destructuring head and tail)
|
|
701
701
|
*
|
|
702
702
|
* ```ts
|
|
703
703
|
* import { Array } from "effect"
|
|
@@ -744,7 +744,7 @@ export const matchLeft: {
|
|
|
744
744
|
*
|
|
745
745
|
* `onNonEmpty` receives `(init, last)` where `init` is everything but the last element.
|
|
746
746
|
*
|
|
747
|
-
* **Example** (
|
|
747
|
+
* **Example** (Destructuring init and last)
|
|
748
748
|
*
|
|
749
749
|
* ```ts
|
|
750
750
|
* import { Array } from "effect"
|
|
@@ -777,7 +777,7 @@ export const matchRight: {
|
|
|
777
777
|
*
|
|
778
778
|
* `onNonEmpty` receives `(init, last)` where `init` is everything but the last element.
|
|
779
779
|
*
|
|
780
|
-
* **Example** (
|
|
780
|
+
* **Example** (Destructuring init and last)
|
|
781
781
|
*
|
|
782
782
|
* ```ts
|
|
783
783
|
* import { Array } from "effect"
|
|
@@ -815,7 +815,7 @@ export const matchRight: {
|
|
|
815
815
|
*
|
|
816
816
|
* `onNonEmpty` receives `(init, last)` where `init` is everything but the last element.
|
|
817
817
|
*
|
|
818
|
-
* **Example** (
|
|
818
|
+
* **Example** (Destructuring init and last)
|
|
819
819
|
*
|
|
820
820
|
* ```ts
|
|
821
821
|
* import { Array } from "effect"
|
|
@@ -1395,7 +1395,7 @@ export const scan: {
|
|
|
1395
1395
|
* The output length is `input.length + 1` because it ends with the initial
|
|
1396
1396
|
* value. The result is always a `NonEmptyArray`.
|
|
1397
1397
|
*
|
|
1398
|
-
* **Example** (
|
|
1398
|
+
* **Example** (Scanning running totals in reverse)
|
|
1399
1399
|
*
|
|
1400
1400
|
* ```ts
|
|
1401
1401
|
* import { Array } from "effect"
|
|
@@ -1424,7 +1424,7 @@ export const scanRight: {
|
|
|
1424
1424
|
* The output length is `input.length + 1` because it ends with the initial
|
|
1425
1425
|
* value. The result is always a `NonEmptyArray`.
|
|
1426
1426
|
*
|
|
1427
|
-
* **Example** (
|
|
1427
|
+
* **Example** (Scanning running totals in reverse)
|
|
1428
1428
|
*
|
|
1429
1429
|
* ```ts
|
|
1430
1430
|
* import { Array } from "effect"
|
|
@@ -1453,7 +1453,7 @@ export const scanRight: {
|
|
|
1453
1453
|
* The output length is `input.length + 1` because it ends with the initial
|
|
1454
1454
|
* value. The result is always a `NonEmptyArray`.
|
|
1455
1455
|
*
|
|
1456
|
-
* **Example** (
|
|
1456
|
+
* **Example** (Scanning running totals in reverse)
|
|
1457
1457
|
*
|
|
1458
1458
|
* ```ts
|
|
1459
1459
|
* import { Array } from "effect"
|
|
@@ -1698,7 +1698,7 @@ const clamp = <A>(i: number, as: ReadonlyArray<A>): number => Math.floor(Math.mi
|
|
|
1698
1698
|
*
|
|
1699
1699
|
* The index is floored to an integer. This never throws.
|
|
1700
1700
|
*
|
|
1701
|
-
* **Example** (
|
|
1701
|
+
* **Example** (Accessing indexes safely)
|
|
1702
1702
|
*
|
|
1703
1703
|
* ```ts
|
|
1704
1704
|
* import { Array } from "effect"
|
|
@@ -1728,7 +1728,7 @@ export const get: {
|
|
|
1728
1728
|
*
|
|
1729
1729
|
* The index is floored to an integer. This never throws.
|
|
1730
1730
|
*
|
|
1731
|
-
* **Example** (
|
|
1731
|
+
* **Example** (Accessing indexes safely)
|
|
1732
1732
|
*
|
|
1733
1733
|
* ```ts
|
|
1734
1734
|
* import { Array } from "effect"
|
|
@@ -1758,7 +1758,7 @@ export const get: {
|
|
|
1758
1758
|
*
|
|
1759
1759
|
* The index is floored to an integer. This never throws.
|
|
1760
1760
|
*
|
|
1761
|
-
* **Example** (
|
|
1761
|
+
* **Example** (Accessing indexes safely)
|
|
1762
1762
|
*
|
|
1763
1763
|
* ```ts
|
|
1764
1764
|
* import { Array } from "effect"
|
|
@@ -1793,7 +1793,7 @@ export const get: {
|
|
|
1793
1793
|
* Throws an `Error` with the message `"Index out of bounds: <i>"`. Prefer
|
|
1794
1794
|
* `get` for safe access.
|
|
1795
1795
|
*
|
|
1796
|
-
* **Example** (
|
|
1796
|
+
* **Example** (Accessing indexes unsafely)
|
|
1797
1797
|
*
|
|
1798
1798
|
* ```ts
|
|
1799
1799
|
* import { Array } from "effect"
|
|
@@ -1821,7 +1821,7 @@ export const getUnsafe: {
|
|
|
1821
1821
|
* Throws an `Error` with the message `"Index out of bounds: <i>"`. Prefer
|
|
1822
1822
|
* `get` for safe access.
|
|
1823
1823
|
*
|
|
1824
|
-
* **Example** (
|
|
1824
|
+
* **Example** (Accessing indexes unsafely)
|
|
1825
1825
|
*
|
|
1826
1826
|
* ```ts
|
|
1827
1827
|
* import { Array } from "effect"
|
|
@@ -1849,7 +1849,7 @@ export const getUnsafe: {
|
|
|
1849
1849
|
* Throws an `Error` with the message `"Index out of bounds: <i>"`. Prefer
|
|
1850
1850
|
* `get` for safe access.
|
|
1851
1851
|
*
|
|
1852
|
-
* **Example** (
|
|
1852
|
+
* **Example** (Accessing indexes unsafely)
|
|
1853
1853
|
*
|
|
1854
1854
|
* ```ts
|
|
1855
1855
|
* import { Array } from "effect"
|
|
@@ -4538,7 +4538,7 @@ export const sortWith: {
|
|
|
4538
4538
|
* This is data-last only and returns a function. The return type preserves
|
|
4539
4539
|
* `NonEmptyArray`.
|
|
4540
4540
|
*
|
|
4541
|
-
* **Example** (
|
|
4541
|
+
* **Example** (Sorting by multiple keys)
|
|
4542
4542
|
*
|
|
4543
4543
|
* ```ts
|
|
4544
4544
|
* import { Array, Order, pipe } from "effect"
|
|
@@ -5457,7 +5457,7 @@ export const rotate: {
|
|
|
5457
5457
|
* Use when checking membership with caller-provided equality instead of
|
|
5458
5458
|
* `Equal.equivalence()`.
|
|
5459
5459
|
*
|
|
5460
|
-
* **Example** (
|
|
5460
|
+
* **Example** (Checking with custom equality)
|
|
5461
5461
|
*
|
|
5462
5462
|
* ```ts
|
|
5463
5463
|
* import { Array, pipe } from "effect"
|
|
@@ -6367,7 +6367,7 @@ export const chunksOf: {
|
|
|
6367
6367
|
* Returns an empty array if `n <= 0` or the array has fewer than `n` elements.
|
|
6368
6368
|
* Each window is a tuple of exactly `n` elements.
|
|
6369
6369
|
*
|
|
6370
|
-
* **Example** (
|
|
6370
|
+
* **Example** (Creating sliding windows)
|
|
6371
6371
|
*
|
|
6372
6372
|
* ```ts
|
|
6373
6373
|
* import { Array } from "effect"
|
|
@@ -6394,7 +6394,7 @@ export const window: {
|
|
|
6394
6394
|
* Returns an empty array if `n <= 0` or the array has fewer than `n` elements.
|
|
6395
6395
|
* Each window is a tuple of exactly `n` elements.
|
|
6396
6396
|
*
|
|
6397
|
-
* **Example** (
|
|
6397
|
+
* **Example** (Creating sliding windows)
|
|
6398
6398
|
*
|
|
6399
6399
|
* ```ts
|
|
6400
6400
|
* import { Array } from "effect"
|
|
@@ -6421,7 +6421,7 @@ export const window: {
|
|
|
6421
6421
|
* Returns an empty array if `n <= 0` or the array has fewer than `n` elements.
|
|
6422
6422
|
* Each window is a tuple of exactly `n` elements.
|
|
6423
6423
|
*
|
|
6424
|
-
* **Example** (
|
|
6424
|
+
* **Example** (Creating sliding windows)
|
|
6425
6425
|
*
|
|
6426
6426
|
* ```ts
|
|
6427
6427
|
* import { Array } from "effect"
|
|
@@ -6719,7 +6719,7 @@ export const groupBy: {
|
|
|
6719
6719
|
* Use when you need the union of two arrays but duplicate detection must use a
|
|
6720
6720
|
* custom equivalence instead of the default `Equal.equivalence()`.
|
|
6721
6721
|
*
|
|
6722
|
-
* **Example** (
|
|
6722
|
+
* **Example** (Computing unions with custom equality)
|
|
6723
6723
|
*
|
|
6724
6724
|
* ```ts
|
|
6725
6725
|
* import { Array } from "effect"
|
|
@@ -6744,7 +6744,7 @@ export const unionWith: {
|
|
|
6744
6744
|
* Use when you need the union of two arrays but duplicate detection must use a
|
|
6745
6745
|
* custom equivalence instead of the default `Equal.equivalence()`.
|
|
6746
6746
|
*
|
|
6747
|
-
* **Example** (
|
|
6747
|
+
* **Example** (Computing unions with custom equality)
|
|
6748
6748
|
*
|
|
6749
6749
|
* ```ts
|
|
6750
6750
|
* import { Array } from "effect"
|
|
@@ -6772,7 +6772,7 @@ export const unionWith: {
|
|
|
6772
6772
|
* Use when you need the union of two arrays but duplicate detection must use a
|
|
6773
6773
|
* custom equivalence instead of the default `Equal.equivalence()`.
|
|
6774
6774
|
*
|
|
6775
|
-
* **Example** (
|
|
6775
|
+
* **Example** (Computing unions with custom equality)
|
|
6776
6776
|
*
|
|
6777
6777
|
* ```ts
|
|
6778
6778
|
* import { Array } from "effect"
|
|
@@ -6801,7 +6801,7 @@ export const unionWith: {
|
|
|
6801
6801
|
* Use when you need the union of two arrays but duplicate detection must use a
|
|
6802
6802
|
* custom equivalence instead of the default `Equal.equivalence()`.
|
|
6803
6803
|
*
|
|
6804
|
-
* **Example** (
|
|
6804
|
+
* **Example** (Computing unions with custom equality)
|
|
6805
6805
|
*
|
|
6806
6806
|
* ```ts
|
|
6807
6807
|
* import { Array } from "effect"
|
|
@@ -6830,7 +6830,7 @@ export const unionWith: {
|
|
|
6830
6830
|
* Use when you need the union of two arrays but duplicate detection must use a
|
|
6831
6831
|
* custom equivalence instead of the default `Equal.equivalence()`.
|
|
6832
6832
|
*
|
|
6833
|
-
* **Example** (
|
|
6833
|
+
* **Example** (Computing unions with custom equality)
|
|
6834
6834
|
*
|
|
6835
6835
|
* ```ts
|
|
6836
6836
|
* import { Array } from "effect"
|
|
@@ -6867,7 +6867,7 @@ export const unionWith: {
|
|
|
6867
6867
|
* Computes the union of two arrays, removing duplicates using
|
|
6868
6868
|
* `Equal.equivalence()`.
|
|
6869
6869
|
*
|
|
6870
|
-
* **Example** (
|
|
6870
|
+
* **Example** (Computing array unions)
|
|
6871
6871
|
*
|
|
6872
6872
|
* ```ts
|
|
6873
6873
|
* import { Array } from "effect"
|
|
@@ -6887,7 +6887,7 @@ export const union: {
|
|
|
6887
6887
|
* Computes the union of two arrays, removing duplicates using
|
|
6888
6888
|
* `Equal.equivalence()`.
|
|
6889
6889
|
*
|
|
6890
|
-
* **Example** (
|
|
6890
|
+
* **Example** (Computing array unions)
|
|
6891
6891
|
*
|
|
6892
6892
|
* ```ts
|
|
6893
6893
|
* import { Array } from "effect"
|
|
@@ -6909,7 +6909,7 @@ export const union: {
|
|
|
6909
6909
|
* Computes the union of two arrays, removing duplicates using
|
|
6910
6910
|
* `Equal.equivalence()`.
|
|
6911
6911
|
*
|
|
6912
|
-
* **Example** (
|
|
6912
|
+
* **Example** (Computing array unions)
|
|
6913
6913
|
*
|
|
6914
6914
|
* ```ts
|
|
6915
6915
|
* import { Array } from "effect"
|
|
@@ -6929,7 +6929,7 @@ export const union: {
|
|
|
6929
6929
|
* Computes the union of two arrays, removing duplicates using
|
|
6930
6930
|
* `Equal.equivalence()`.
|
|
6931
6931
|
*
|
|
6932
|
-
* **Example** (
|
|
6932
|
+
* **Example** (Computing array unions)
|
|
6933
6933
|
*
|
|
6934
6934
|
* ```ts
|
|
6935
6935
|
* import { Array } from "effect"
|
|
@@ -6949,7 +6949,7 @@ export const union: {
|
|
|
6949
6949
|
* Computes the union of two arrays, removing duplicates using
|
|
6950
6950
|
* `Equal.equivalence()`.
|
|
6951
6951
|
*
|
|
6952
|
-
* **Example** (
|
|
6952
|
+
* **Example** (Computing array unions)
|
|
6953
6953
|
*
|
|
6954
6954
|
* ```ts
|
|
6955
6955
|
* import { Array } from "effect"
|
|
@@ -6971,7 +6971,7 @@ export const union: {
|
|
|
6971
6971
|
* Computes the union of two arrays, removing duplicates using
|
|
6972
6972
|
* `Equal.equivalence()`.
|
|
6973
6973
|
*
|
|
6974
|
-
* **Example** (
|
|
6974
|
+
* **Example** (Computing array unions)
|
|
6975
6975
|
*
|
|
6976
6976
|
* ```ts
|
|
6977
6977
|
* import { Array } from "effect"
|
|
@@ -6998,7 +6998,7 @@ export const union: {
|
|
|
6998
6998
|
* Use when you need to keep only values present in both arrays and equality
|
|
6999
6999
|
* must be defined by a custom comparator, such as matching objects by id.
|
|
7000
7000
|
*
|
|
7001
|
-
* **Example** (
|
|
7001
|
+
* **Example** (Computing intersections with custom equality)
|
|
7002
7002
|
*
|
|
7003
7003
|
* ```ts
|
|
7004
7004
|
* import { Array } from "effect"
|
|
@@ -7039,7 +7039,7 @@ export const intersectionWith = <A>(isEquivalent: (self: A, that: A) => boolean)
|
|
|
7039
7039
|
* Use when Effect equality is the right membership test and you want to keep
|
|
7040
7040
|
* values present in both inputs while preserving the first input's order.
|
|
7041
7041
|
*
|
|
7042
|
-
* **Example** (
|
|
7042
|
+
* **Example** (Computing array intersections)
|
|
7043
7043
|
*
|
|
7044
7044
|
* ```ts
|
|
7045
7045
|
* import { Array } from "effect"
|
|
@@ -7064,7 +7064,7 @@ export const intersection: {
|
|
|
7064
7064
|
* Use when Effect equality is the right membership test and you want to keep
|
|
7065
7065
|
* values present in both inputs while preserving the first input's order.
|
|
7066
7066
|
*
|
|
7067
|
-
* **Example** (
|
|
7067
|
+
* **Example** (Computing array intersections)
|
|
7068
7068
|
*
|
|
7069
7069
|
* ```ts
|
|
7070
7070
|
* import { Array } from "effect"
|
|
@@ -7089,7 +7089,7 @@ export const intersection: {
|
|
|
7089
7089
|
* Use when Effect equality is the right membership test and you want to keep
|
|
7090
7090
|
* values present in both inputs while preserving the first input's order.
|
|
7091
7091
|
*
|
|
7092
|
-
* **Example** (
|
|
7092
|
+
* **Example** (Computing array intersections)
|
|
7093
7093
|
*
|
|
7094
7094
|
* ```ts
|
|
7095
7095
|
* import { Array } from "effect"
|
|
@@ -7116,7 +7116,7 @@ export const intersection: {
|
|
|
7116
7116
|
* Use when you need to keep only values from the first array and equality must
|
|
7117
7117
|
* be defined by a custom comparator, such as matching objects by id.
|
|
7118
7118
|
*
|
|
7119
|
-
* **Example** (
|
|
7119
|
+
* **Example** (Computing differences with custom equality)
|
|
7120
7120
|
*
|
|
7121
7121
|
* ```ts
|
|
7122
7122
|
* import { Array } from "effect"
|
|
@@ -7155,7 +7155,7 @@ export const differenceWith = <A>(isEquivalent: (self: A, that: A) => boolean):
|
|
|
7155
7155
|
* Use when you need to keep values from the first array that are absent from
|
|
7156
7156
|
* the second and the default `Equal.equivalence()` comparison is appropriate.
|
|
7157
7157
|
*
|
|
7158
|
-
* **Example** (
|
|
7158
|
+
* **Example** (Computing array differences)
|
|
7159
7159
|
*
|
|
7160
7160
|
* ```ts
|
|
7161
7161
|
* import { Array } from "effect"
|
|
@@ -7180,7 +7180,7 @@ export const difference: {
|
|
|
7180
7180
|
* Use when you need to keep values from the first array that are absent from
|
|
7181
7181
|
* the second and the default `Equal.equivalence()` comparison is appropriate.
|
|
7182
7182
|
*
|
|
7183
|
-
* **Example** (
|
|
7183
|
+
* **Example** (Computing array differences)
|
|
7184
7184
|
*
|
|
7185
7185
|
* ```ts
|
|
7186
7186
|
* import { Array } from "effect"
|
|
@@ -7205,7 +7205,7 @@ export const difference: {
|
|
|
7205
7205
|
* Use when you need to keep values from the first array that are absent from
|
|
7206
7206
|
* the second and the default `Equal.equivalence()` comparison is appropriate.
|
|
7207
7207
|
*
|
|
7208
|
-
* **Example** (
|
|
7208
|
+
* **Example** (Computing array differences)
|
|
7209
7209
|
*
|
|
7210
7210
|
* ```ts
|
|
7211
7211
|
* import { Array } from "effect"
|
|
@@ -7478,7 +7478,7 @@ export const map: {
|
|
|
7478
7478
|
* The function receives `(element, index)`. This returns `NonEmptyArray` when
|
|
7479
7479
|
* both the input and mapped arrays are non-empty.
|
|
7480
7480
|
*
|
|
7481
|
-
* **Example** (
|
|
7481
|
+
* **Example** (Flat mapping an array)
|
|
7482
7482
|
*
|
|
7483
7483
|
* ```ts
|
|
7484
7484
|
* import { Array } from "effect"
|
|
@@ -7506,7 +7506,7 @@ export const flatMap: {
|
|
|
7506
7506
|
* The function receives `(element, index)`. This returns `NonEmptyArray` when
|
|
7507
7507
|
* both the input and mapped arrays are non-empty.
|
|
7508
7508
|
*
|
|
7509
|
-
* **Example** (
|
|
7509
|
+
* **Example** (Flat mapping an array)
|
|
7510
7510
|
*
|
|
7511
7511
|
* ```ts
|
|
7512
7512
|
* import { Array } from "effect"
|
|
@@ -7534,7 +7534,7 @@ export const flatMap: {
|
|
|
7534
7534
|
* The function receives `(element, index)`. This returns `NonEmptyArray` when
|
|
7535
7535
|
* both the input and mapped arrays are non-empty.
|
|
7536
7536
|
*
|
|
7537
|
-
* **Example** (
|
|
7537
|
+
* **Example** (Flat mapping an array)
|
|
7538
7538
|
*
|
|
7539
7539
|
* ```ts
|
|
7540
7540
|
* import { Array } from "effect"
|
|
@@ -7565,7 +7565,7 @@ export const flatMap: {
|
|
|
7565
7565
|
* The function receives `(element, index)`. This returns `NonEmptyArray` when
|
|
7566
7566
|
* both the input and mapped arrays are non-empty.
|
|
7567
7567
|
*
|
|
7568
|
-
* **Example** (
|
|
7568
|
+
* **Example** (Flat mapping an array)
|
|
7569
7569
|
*
|
|
7570
7570
|
* ```ts
|
|
7571
7571
|
* import { Array } from "effect"
|
|
@@ -7742,7 +7742,7 @@ export const getSuccesses = <T extends Iterable<Result.Result<any, any>>>(
|
|
|
7742
7742
|
*
|
|
7743
7743
|
* The filter receives `(element, index)`. Failures are discarded.
|
|
7744
7744
|
*
|
|
7745
|
-
* **Example** (
|
|
7745
|
+
* **Example** (Filtering and transforming)
|
|
7746
7746
|
*
|
|
7747
7747
|
* ```ts
|
|
7748
7748
|
* import { Array, Result } from "effect"
|
|
@@ -7770,7 +7770,7 @@ export const filterMap: {
|
|
|
7770
7770
|
*
|
|
7771
7771
|
* The filter receives `(element, index)`. Failures are discarded.
|
|
7772
7772
|
*
|
|
7773
|
-
* **Example** (
|
|
7773
|
+
* **Example** (Filtering and transforming)
|
|
7774
7774
|
*
|
|
7775
7775
|
* ```ts
|
|
7776
7776
|
* import { Array, Result } from "effect"
|
|
@@ -7798,7 +7798,7 @@ export const filterMap: {
|
|
|
7798
7798
|
*
|
|
7799
7799
|
* The filter receives `(element, index)`. Failures are discarded.
|
|
7800
7800
|
*
|
|
7801
|
-
* **Example** (
|
|
7801
|
+
* **Example** (Filtering and transforming)
|
|
7802
7802
|
*
|
|
7803
7803
|
* ```ts
|
|
7804
7804
|
* import { Array, Result } from "effect"
|
|
@@ -8227,7 +8227,7 @@ export const reduce: {
|
|
|
8227
8227
|
*
|
|
8228
8228
|
* The function receives `(accumulator, element, index)`.
|
|
8229
8229
|
*
|
|
8230
|
-
* **Example** (
|
|
8230
|
+
* **Example** (Folding from right to left)
|
|
8231
8231
|
*
|
|
8232
8232
|
* ```ts
|
|
8233
8233
|
* import { Array } from "effect"
|
|
@@ -8253,7 +8253,7 @@ export const reduceRight: {
|
|
|
8253
8253
|
*
|
|
8254
8254
|
* The function receives `(accumulator, element, index)`.
|
|
8255
8255
|
*
|
|
8256
|
-
* **Example** (
|
|
8256
|
+
* **Example** (Folding from right to left)
|
|
8257
8257
|
*
|
|
8258
8258
|
* ```ts
|
|
8259
8259
|
* import { Array } from "effect"
|
|
@@ -8279,7 +8279,7 @@ export const reduceRight: {
|
|
|
8279
8279
|
*
|
|
8280
8280
|
* The function receives `(accumulator, element, index)`.
|
|
8281
8281
|
*
|
|
8282
|
-
* **Example** (
|
|
8282
|
+
* **Example** (Folding from right to left)
|
|
8283
8283
|
*
|
|
8284
8284
|
* ```ts
|
|
8285
8285
|
* import { Array } from "effect"
|
|
@@ -8304,7 +8304,7 @@ export const reduceRight: {
|
|
|
8304
8304
|
* Lifts a predicate into an array: returns `[value]` if the predicate holds,
|
|
8305
8305
|
* `[]` otherwise.
|
|
8306
8306
|
*
|
|
8307
|
-
* **Example** (
|
|
8307
|
+
* **Example** (Wrapping values conditionally)
|
|
8308
8308
|
*
|
|
8309
8309
|
* ```ts
|
|
8310
8310
|
* import { Array } from "effect"
|
|
@@ -8326,7 +8326,7 @@ export const liftPredicate: { // Note: I intentionally avoid using the NoInfer p
|
|
|
8326
8326
|
* Lifts a predicate into an array: returns `[value]` if the predicate holds,
|
|
8327
8327
|
* `[]` otherwise.
|
|
8328
8328
|
*
|
|
8329
|
-
* **Example** (
|
|
8329
|
+
* **Example** (Wrapping values conditionally)
|
|
8330
8330
|
*
|
|
8331
8331
|
* ```ts
|
|
8332
8332
|
* import { Array } from "effect"
|
|
@@ -8386,7 +8386,7 @@ export const liftOption = <A extends Array<unknown>, B>(
|
|
|
8386
8386
|
*
|
|
8387
8387
|
* Use to treat a nullable single value as zero or one array element.
|
|
8388
8388
|
*
|
|
8389
|
-
* **Example** (
|
|
8389
|
+
* **Example** (Converting nullable values to an array)
|
|
8390
8390
|
*
|
|
8391
8391
|
* ```ts
|
|
8392
8392
|
* import { Array } from "effect"
|
|
@@ -8441,7 +8441,7 @@ export const liftNullishOr = <A extends Array<unknown>, B>(
|
|
|
8441
8441
|
* Use when you need to map and filter in one step, where the mapper can return
|
|
8442
8442
|
* `null` or `undefined` to skip elements.
|
|
8443
8443
|
*
|
|
8444
|
-
* **Example** (
|
|
8444
|
+
* **Example** (Flat mapping with nullable values)
|
|
8445
8445
|
*
|
|
8446
8446
|
* ```ts
|
|
8447
8447
|
* import { Array } from "effect"
|
|
@@ -8466,7 +8466,7 @@ export const flatMapNullishOr: {
|
|
|
8466
8466
|
* Use when you need to map and filter in one step, where the mapper can return
|
|
8467
8467
|
* `null` or `undefined` to skip elements.
|
|
8468
8468
|
*
|
|
8469
|
-
* **Example** (
|
|
8469
|
+
* **Example** (Flat mapping with nullable values)
|
|
8470
8470
|
*
|
|
8471
8471
|
* ```ts
|
|
8472
8472
|
* import { Array } from "effect"
|
|
@@ -8491,7 +8491,7 @@ export const flatMapNullishOr: {
|
|
|
8491
8491
|
* Use when you need to map and filter in one step, where the mapper can return
|
|
8492
8492
|
* `null` or `undefined` to skip elements.
|
|
8493
8493
|
*
|
|
8494
|
-
* **Example** (
|
|
8494
|
+
* **Example** (Flat mapping with nullable values)
|
|
8495
8495
|
*
|
|
8496
8496
|
* ```ts
|
|
8497
8497
|
* import { Array } from "effect"
|
|
@@ -8755,7 +8755,7 @@ export const some: {
|
|
|
8755
8755
|
*
|
|
8756
8756
|
* For index `i`, the function receives `self.slice(i)`.
|
|
8757
8757
|
*
|
|
8758
|
-
* **Example** (
|
|
8758
|
+
* **Example** (Computing suffix lengths)
|
|
8759
8759
|
*
|
|
8760
8760
|
* ```ts
|
|
8761
8761
|
* import { Array } from "effect"
|
|
@@ -8782,7 +8782,7 @@ export const extend: {
|
|
|
8782
8782
|
*
|
|
8783
8783
|
* For index `i`, the function receives `self.slice(i)`.
|
|
8784
8784
|
*
|
|
8785
|
-
* **Example** (
|
|
8785
|
+
* **Example** (Computing suffix lengths)
|
|
8786
8786
|
*
|
|
8787
8787
|
* ```ts
|
|
8788
8788
|
* import { Array } from "effect"
|
|
@@ -8809,7 +8809,7 @@ export const extend: {
|
|
|
8809
8809
|
*
|
|
8810
8810
|
* For index `i`, the function receives `self.slice(i)`.
|
|
8811
8811
|
*
|
|
8812
|
-
* **Example** (
|
|
8812
|
+
* **Example** (Computing suffix lengths)
|
|
8813
8813
|
*
|
|
8814
8814
|
* ```ts
|
|
8815
8815
|
* import { Array } from "effect"
|
|
@@ -9634,7 +9634,7 @@ export const cartesianWith: {
|
|
|
9634
9634
|
* Produces every `[a, b]` combination of an element from `self` with an element
|
|
9635
9635
|
* from `that`, so the result length is `self.length * that.length`.
|
|
9636
9636
|
*
|
|
9637
|
-
* **Example** (
|
|
9637
|
+
* **Example** (Generating all pairs from two arrays)
|
|
9638
9638
|
*
|
|
9639
9639
|
* ```ts
|
|
9640
9640
|
* import { Array } from "effect"
|
|
@@ -9661,7 +9661,7 @@ export const cartesian: {
|
|
|
9661
9661
|
* Produces every `[a, b]` combination of an element from `self` with an element
|
|
9662
9662
|
* from `that`, so the result length is `self.length * that.length`.
|
|
9663
9663
|
*
|
|
9664
|
-
* **Example** (
|
|
9664
|
+
* **Example** (Generating all pairs from two arrays)
|
|
9665
9665
|
*
|
|
9666
9666
|
* ```ts
|
|
9667
9667
|
* import { Array } from "effect"
|
|
@@ -9688,7 +9688,7 @@ export const cartesian: {
|
|
|
9688
9688
|
* Produces every `[a, b]` combination of an element from `self` with an element
|
|
9689
9689
|
* from `that`, so the result length is `self.length * that.length`.
|
|
9690
9690
|
*
|
|
9691
|
-
* **Example** (
|
|
9691
|
+
* **Example** (Generating all pairs from two arrays)
|
|
9692
9692
|
*
|
|
9693
9693
|
* ```ts
|
|
9694
9694
|
* import { Array } from "effect"
|
|
@@ -9726,7 +9726,7 @@ export const cartesian: {
|
|
|
9726
9726
|
* like nested loops. Use `filter` and `map` in the pipeline to add conditions
|
|
9727
9727
|
* and transformations.
|
|
9728
9728
|
*
|
|
9729
|
-
* **Example** (
|
|
9729
|
+
* **Example** (Building array comprehensions with do notation)
|
|
9730
9730
|
*
|
|
9731
9731
|
* ```ts
|
|
9732
9732
|
* import { Array, pipe } from "effect"
|
package/src/Cache.ts
CHANGED
|
@@ -145,7 +145,7 @@ export interface Entry<A, E> {
|
|
|
145
145
|
* The timeToLive function receives both the exit result and the key, allowing
|
|
146
146
|
* for flexible TTL policies based on success/failure state and key characteristics.
|
|
147
147
|
*
|
|
148
|
-
* **Example** (
|
|
148
|
+
* **Example** (Configuring dynamic time to live)
|
|
149
149
|
*
|
|
150
150
|
* ```ts
|
|
151
151
|
* import { Cache, Effect, Exit } from "effect"
|