effect 4.0.0-beta.68 → 4.0.0-beta.69
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/Channel.d.ts.map +1 -1
- package/dist/Channel.js +1 -1
- package/dist/Channel.js.map +1 -1
- package/dist/Effect.d.ts +485 -485
- package/dist/Effect.js +218 -218
- package/dist/index.d.ts +21 -29
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +21 -29
- package/dist/index.js.map +1 -1
- package/dist/unstable/ai/index.d.ts +1 -1
- package/dist/unstable/ai/index.js +1 -1
- package/dist/unstable/cli/Flag.d.ts +23 -0
- package/dist/unstable/cli/Flag.d.ts.map +1 -1
- package/dist/unstable/cli/Flag.js +23 -0
- package/dist/unstable/cli/Flag.js.map +1 -1
- package/dist/unstable/cli/Param.d.ts +2 -0
- package/dist/unstable/cli/Param.d.ts.map +1 -1
- package/dist/unstable/cli/Param.js +27 -0
- package/dist/unstable/cli/Param.js.map +1 -1
- package/dist/unstable/cli/index.d.ts +30 -0
- package/dist/unstable/cli/index.d.ts.map +1 -1
- package/dist/unstable/cli/index.js +1 -1
- package/dist/unstable/cli/internal/command.d.ts.map +1 -1
- package/dist/unstable/cli/internal/command.js +3 -0
- package/dist/unstable/cli/internal/command.js.map +1 -1
- package/dist/unstable/cli/internal/completions/descriptor.js +3 -0
- package/dist/unstable/cli/internal/completions/descriptor.js.map +1 -1
- package/dist/unstable/cli/internal/help.d.ts.map +1 -1
- package/dist/unstable/cli/internal/help.js +10 -0
- package/dist/unstable/cli/internal/help.js.map +1 -1
- package/dist/unstable/cli/internal/parser.js +3 -0
- package/dist/unstable/cli/internal/parser.js.map +1 -1
- package/dist/unstable/cluster/index.d.ts +1 -1
- package/dist/unstable/cluster/index.js +1 -1
- package/dist/unstable/observability/index.d.ts +1 -1
- package/dist/unstable/observability/index.js +1 -1
- package/dist/unstable/process/index.d.ts +1 -1
- package/dist/unstable/process/index.js +1 -1
- package/dist/unstable/reactivity/index.d.ts +2 -3
- package/dist/unstable/reactivity/index.d.ts.map +1 -1
- package/dist/unstable/reactivity/index.js +2 -3
- package/dist/unstable/reactivity/index.js.map +1 -1
- package/dist/unstable/rpc/RpcWorker.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcWorker.js +1 -1
- package/dist/unstable/rpc/RpcWorker.js.map +1 -1
- package/dist/unstable/sql/Migrator.d.ts +6 -4
- package/dist/unstable/sql/Migrator.d.ts.map +1 -1
- package/dist/unstable/sql/Migrator.js +9 -7
- package/dist/unstable/sql/Migrator.js.map +1 -1
- package/dist/unstable/sql/index.d.ts +0 -1
- package/dist/unstable/sql/index.d.ts.map +1 -1
- package/dist/unstable/sql/index.js +0 -1
- package/dist/unstable/sql/index.js.map +1 -1
- package/dist/unstable/workflow/WorkflowEngine.d.ts.map +1 -1
- package/dist/unstable/workflow/WorkflowEngine.js +5 -9
- package/dist/unstable/workflow/WorkflowEngine.js.map +1 -1
- package/package.json +3 -3
- package/src/Channel.ts +6 -1
- package/src/Effect.ts +491 -491
- package/src/index.ts +21 -29
- package/src/unstable/ai/index.ts +1 -1
- package/src/unstable/cli/Flag.ts +24 -0
- package/src/unstable/cli/Param.ts +32 -0
- package/src/unstable/cli/index.ts +1 -1
- package/src/unstable/cli/internal/command.ts +3 -0
- package/src/unstable/cli/internal/completions/descriptor.ts +3 -0
- package/src/unstable/cli/internal/help.ts +10 -0
- package/src/unstable/cli/internal/parser.ts +3 -0
- package/src/unstable/cluster/index.ts +1 -1
- package/src/unstable/observability/index.ts +1 -1
- package/src/unstable/process/index.ts +1 -1
- package/src/unstable/reactivity/index.ts +2 -3
- package/src/unstable/rpc/RpcWorker.ts +3 -1
- package/src/unstable/sql/Migrator.ts +9 -7
- package/src/unstable/sql/index.ts +0 -1
- package/src/unstable/workflow/WorkflowEngine.ts +7 -11
package/dist/Effect.d.ts
CHANGED
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
* - **Testable**: Built-in support for testing with controlled environments
|
|
21
21
|
* - **Interruptible**: Effects can be safely interrupted and cancelled
|
|
22
22
|
*
|
|
23
|
-
* **Example** (
|
|
23
|
+
* **Example** (Creating and running effects)
|
|
24
24
|
*
|
|
25
25
|
* ```ts
|
|
26
26
|
* import { Console, Effect } from "effect"
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
* Effect.runPromise(program).then(console.log) // 13
|
|
40
40
|
* ```
|
|
41
41
|
*
|
|
42
|
-
* **Example** (
|
|
42
|
+
* **Example** (Handling typed failures)
|
|
43
43
|
*
|
|
44
44
|
* ```ts
|
|
45
45
|
* import { Data, Effect } from "effect"
|
|
@@ -192,7 +192,7 @@ export type Services<T> = T extends Effect<infer _A, infer _E, infer _R> ? _R :
|
|
|
192
192
|
/**
|
|
193
193
|
* Tests if a value is an `Effect`.
|
|
194
194
|
*
|
|
195
|
-
* **Example** (
|
|
195
|
+
* **Example** (Checking whether a value is an Effect)
|
|
196
196
|
*
|
|
197
197
|
* ```ts
|
|
198
198
|
* import { Effect } from "effect"
|
|
@@ -307,7 +307,7 @@ export declare namespace All {
|
|
|
307
307
|
* `Result` in the same output shape. Use `discard: true` to ignore successful
|
|
308
308
|
* values and return `void`.
|
|
309
309
|
*
|
|
310
|
-
* **Example** (
|
|
310
|
+
* **Example** (Collecting tuple results in order)
|
|
311
311
|
*
|
|
312
312
|
* ```ts
|
|
313
313
|
* import { Console, Effect } from "effect"
|
|
@@ -328,7 +328,7 @@ export declare namespace All {
|
|
|
328
328
|
* // [ 42, 'Hello' ]
|
|
329
329
|
* ```
|
|
330
330
|
*
|
|
331
|
-
* **Example** (
|
|
331
|
+
* **Example** (Collecting iterable results in order)
|
|
332
332
|
*
|
|
333
333
|
* ```ts
|
|
334
334
|
* import { Console, Effect } from "effect"
|
|
@@ -349,7 +349,7 @@ export declare namespace All {
|
|
|
349
349
|
* // [ 1, 2, 3 ]
|
|
350
350
|
* ```
|
|
351
351
|
*
|
|
352
|
-
* **Example** (
|
|
352
|
+
* **Example** (Collecting struct results by key)
|
|
353
353
|
*
|
|
354
354
|
* ```ts
|
|
355
355
|
* import { Console, Effect } from "effect"
|
|
@@ -370,7 +370,7 @@ export declare namespace All {
|
|
|
370
370
|
* // { a: 42, b: 'Hello' }
|
|
371
371
|
* ```
|
|
372
372
|
*
|
|
373
|
-
* **Example** (
|
|
373
|
+
* **Example** (Collecting record results by key)
|
|
374
374
|
*
|
|
375
375
|
* ```ts
|
|
376
376
|
* import { Console, Effect } from "effect"
|
|
@@ -391,7 +391,7 @@ export declare namespace All {
|
|
|
391
391
|
* // { key1: 1, key2: 2 }
|
|
392
392
|
* ```
|
|
393
393
|
*
|
|
394
|
-
* **Example** (
|
|
394
|
+
* **Example** (Stopping on the first failure)
|
|
395
395
|
*
|
|
396
396
|
* ```ts
|
|
397
397
|
* import { Console, Effect } from "effect"
|
|
@@ -435,7 +435,7 @@ export declare const all: <const Arg extends Iterable<Effect<any, any, any>> | R
|
|
|
435
435
|
* This function runs every effect and never fails. Use `concurrency` to control
|
|
436
436
|
* parallelism.
|
|
437
437
|
*
|
|
438
|
-
* **Example** (
|
|
438
|
+
* **Example** (Separating successes and failures)
|
|
439
439
|
*
|
|
440
440
|
* ```ts
|
|
441
441
|
* import { Effect } from "effect"
|
|
@@ -464,7 +464,7 @@ export declare const partition: {
|
|
|
464
464
|
* This function runs every effect and never fails. Use `concurrency` to control
|
|
465
465
|
* parallelism.
|
|
466
466
|
*
|
|
467
|
-
* **Example** (
|
|
467
|
+
* **Example** (Separating successes and failures)
|
|
468
468
|
*
|
|
469
469
|
* ```ts
|
|
470
470
|
* import { Effect } from "effect"
|
|
@@ -495,7 +495,7 @@ export declare const partition: {
|
|
|
495
495
|
* This function runs every effect and never fails. Use `concurrency` to control
|
|
496
496
|
* parallelism.
|
|
497
497
|
*
|
|
498
|
-
* **Example** (
|
|
498
|
+
* **Example** (Separating successes and failures)
|
|
499
499
|
*
|
|
500
500
|
* ```ts
|
|
501
501
|
* import { Effect } from "effect"
|
|
@@ -525,7 +525,7 @@ export declare const partition: {
|
|
|
525
525
|
* Use `discard: true` to ignore successful values while still validating all
|
|
526
526
|
* elements.
|
|
527
527
|
*
|
|
528
|
-
* **Example** (
|
|
528
|
+
* **Example** (Validating every element)
|
|
529
529
|
*
|
|
530
530
|
* ```ts
|
|
531
531
|
* import { Effect } from "effect"
|
|
@@ -562,7 +562,7 @@ export declare const validate: {
|
|
|
562
562
|
* Use `discard: true` to ignore successful values while still validating all
|
|
563
563
|
* elements.
|
|
564
564
|
*
|
|
565
|
-
* **Example** (
|
|
565
|
+
* **Example** (Validating every element)
|
|
566
566
|
*
|
|
567
567
|
* ```ts
|
|
568
568
|
* import { Effect } from "effect"
|
|
@@ -602,7 +602,7 @@ export declare const validate: {
|
|
|
602
602
|
* Use `discard: true` to ignore successful values while still validating all
|
|
603
603
|
* elements.
|
|
604
604
|
*
|
|
605
|
-
* **Example** (
|
|
605
|
+
* **Example** (Validating every element)
|
|
606
606
|
*
|
|
607
607
|
* ```ts
|
|
608
608
|
* import { Effect } from "effect"
|
|
@@ -642,7 +642,7 @@ export declare const validate: {
|
|
|
642
642
|
* Use `discard: true` to ignore successful values while still validating all
|
|
643
643
|
* elements.
|
|
644
644
|
*
|
|
645
|
-
* **Example** (
|
|
645
|
+
* **Example** (Validating every element)
|
|
646
646
|
*
|
|
647
647
|
* ```ts
|
|
648
648
|
* import { Effect } from "effect"
|
|
@@ -682,7 +682,7 @@ export declare const validate: {
|
|
|
682
682
|
* Use `discard: true` to ignore successful values while still validating all
|
|
683
683
|
* elements.
|
|
684
684
|
*
|
|
685
|
-
* **Example** (
|
|
685
|
+
* **Example** (Validating every element)
|
|
686
686
|
*
|
|
687
687
|
* ```ts
|
|
688
688
|
* import { Effect } from "effect"
|
|
@@ -719,7 +719,7 @@ export declare const validate: {
|
|
|
719
719
|
* The predicate receives the element and its index. Evaluation short-circuits
|
|
720
720
|
* as soon as an element matches.
|
|
721
721
|
*
|
|
722
|
-
* **Example** (
|
|
722
|
+
* **Example** (Finding the first successful match)
|
|
723
723
|
*
|
|
724
724
|
* ```ts
|
|
725
725
|
* import { Effect } from "effect"
|
|
@@ -740,7 +740,7 @@ export declare const findFirst: {
|
|
|
740
740
|
* The predicate receives the element and its index. Evaluation short-circuits
|
|
741
741
|
* as soon as an element matches.
|
|
742
742
|
*
|
|
743
|
-
* **Example** (
|
|
743
|
+
* **Example** (Finding the first successful match)
|
|
744
744
|
*
|
|
745
745
|
* ```ts
|
|
746
746
|
* import { Effect } from "effect"
|
|
@@ -761,7 +761,7 @@ export declare const findFirst: {
|
|
|
761
761
|
* The predicate receives the element and its index. Evaluation short-circuits
|
|
762
762
|
* as soon as an element matches.
|
|
763
763
|
*
|
|
764
|
-
* **Example** (
|
|
764
|
+
* **Example** (Finding the first successful match)
|
|
765
765
|
*
|
|
766
766
|
* ```ts
|
|
767
767
|
* import { Effect } from "effect"
|
|
@@ -831,7 +831,7 @@ export declare const findFirstFilter: {
|
|
|
831
831
|
*
|
|
832
832
|
* @see {@link all} for combining multiple effects into one.
|
|
833
833
|
*
|
|
834
|
-
* **Example** (
|
|
834
|
+
* **Example** (Mapping over an iterable with effects)
|
|
835
835
|
*
|
|
836
836
|
* ```ts
|
|
837
837
|
* import { Console, Effect } from "effect"
|
|
@@ -852,7 +852,7 @@ export declare const findFirstFilter: {
|
|
|
852
852
|
* // [ 2, 4, 6, 8, 10 ]
|
|
853
853
|
* ```
|
|
854
854
|
*
|
|
855
|
-
* **Example** (
|
|
855
|
+
* **Example** (Running effects without collecting results)
|
|
856
856
|
*
|
|
857
857
|
* ```ts
|
|
858
858
|
* import { Console, Effect } from "effect"
|
|
@@ -902,7 +902,7 @@ export declare const forEach: {
|
|
|
902
902
|
*
|
|
903
903
|
* @see {@link all} for combining multiple effects into one.
|
|
904
904
|
*
|
|
905
|
-
* **Example** (
|
|
905
|
+
* **Example** (Mapping over an iterable with effects)
|
|
906
906
|
*
|
|
907
907
|
* ```ts
|
|
908
908
|
* import { Console, Effect } from "effect"
|
|
@@ -923,7 +923,7 @@ export declare const forEach: {
|
|
|
923
923
|
* // [ 2, 4, 6, 8, 10 ]
|
|
924
924
|
* ```
|
|
925
925
|
*
|
|
926
|
-
* **Example** (
|
|
926
|
+
* **Example** (Running effects without collecting results)
|
|
927
927
|
*
|
|
928
928
|
* ```ts
|
|
929
929
|
* import { Console, Effect } from "effect"
|
|
@@ -976,7 +976,7 @@ export declare const forEach: {
|
|
|
976
976
|
*
|
|
977
977
|
* @see {@link all} for combining multiple effects into one.
|
|
978
978
|
*
|
|
979
|
-
* **Example** (
|
|
979
|
+
* **Example** (Mapping over an iterable with effects)
|
|
980
980
|
*
|
|
981
981
|
* ```ts
|
|
982
982
|
* import { Console, Effect } from "effect"
|
|
@@ -997,7 +997,7 @@ export declare const forEach: {
|
|
|
997
997
|
* // [ 2, 4, 6, 8, 10 ]
|
|
998
998
|
* ```
|
|
999
999
|
*
|
|
1000
|
-
* **Example** (
|
|
1000
|
+
* **Example** (Running effects without collecting results)
|
|
1001
1001
|
*
|
|
1002
1002
|
* ```ts
|
|
1003
1003
|
* import { Console, Effect } from "effect"
|
|
@@ -1031,7 +1031,7 @@ export declare const forEach: {
|
|
|
1031
1031
|
/**
|
|
1032
1032
|
* Executes a body effect repeatedly while a condition holds true.
|
|
1033
1033
|
*
|
|
1034
|
-
* **Example** (
|
|
1034
|
+
* **Example** (Repeating an effectful loop)
|
|
1035
1035
|
*
|
|
1036
1036
|
* ```ts
|
|
1037
1037
|
* import { Effect } from "effect"
|
|
@@ -1086,7 +1086,7 @@ export declare const whileLoop: <A, E, R>(options: {
|
|
|
1086
1086
|
*
|
|
1087
1087
|
* @see {@link tryPromise} for a version that can handle failures.
|
|
1088
1088
|
*
|
|
1089
|
-
* **Example** (
|
|
1089
|
+
* **Example** (Wrapping a non-rejecting Promise)
|
|
1090
1090
|
*
|
|
1091
1091
|
* ```ts
|
|
1092
1092
|
* import { Effect } from "effect"
|
|
@@ -1136,7 +1136,7 @@ export declare const promise: <A>(evaluate: (signal: AbortSignal) => PromiseLike
|
|
|
1136
1136
|
* An optional `AbortSignal` can be provided to allow for interruption of the
|
|
1137
1137
|
* wrapped `Promise` API.
|
|
1138
1138
|
*
|
|
1139
|
-
* **Example** (
|
|
1139
|
+
* **Example** (Wrapping a fetch request that may fail)
|
|
1140
1140
|
*
|
|
1141
1141
|
* ```ts
|
|
1142
1142
|
* import { Effect } from "effect"
|
|
@@ -1152,7 +1152,7 @@ export declare const promise: <A>(evaluate: (signal: AbortSignal) => PromiseLike
|
|
|
1152
1152
|
* const program = getTodo(1)
|
|
1153
1153
|
* ```
|
|
1154
1154
|
*
|
|
1155
|
-
* **Example** (
|
|
1155
|
+
* **Example** (Mapping Promise rejections to a tagged error)
|
|
1156
1156
|
*
|
|
1157
1157
|
* ```ts
|
|
1158
1158
|
* import { Data, Effect } from "effect"
|
|
@@ -1190,7 +1190,7 @@ export declare const tryPromise: <A, E = Cause.UnknownError>(options: {
|
|
|
1190
1190
|
*
|
|
1191
1191
|
* @see {@link fail} to create an effect that represents a failure.
|
|
1192
1192
|
*
|
|
1193
|
-
* **Example** (Creating a
|
|
1193
|
+
* **Example** (Creating a successful effect)
|
|
1194
1194
|
*
|
|
1195
1195
|
* ```ts
|
|
1196
1196
|
* import { Effect } from "effect"
|
|
@@ -1209,7 +1209,7 @@ export declare const succeed: <A>(value: A) => Effect<A>;
|
|
|
1209
1209
|
/**
|
|
1210
1210
|
* Returns an effect which succeeds with `None`.
|
|
1211
1211
|
*
|
|
1212
|
-
* **Example** (
|
|
1212
|
+
* **Example** (Succeeding with Option.none)
|
|
1213
1213
|
*
|
|
1214
1214
|
* ```ts
|
|
1215
1215
|
* import { Effect } from "effect"
|
|
@@ -1227,7 +1227,7 @@ export declare const succeedNone: Effect<Option<never>>;
|
|
|
1227
1227
|
/**
|
|
1228
1228
|
* Returns an effect which succeeds with the value wrapped in a `Some`.
|
|
1229
1229
|
*
|
|
1230
|
-
* **Example** (
|
|
1230
|
+
* **Example** (Succeeding with Option.some)
|
|
1231
1231
|
*
|
|
1232
1232
|
* ```ts
|
|
1233
1233
|
* import { Effect } from "effect"
|
|
@@ -1256,7 +1256,7 @@ export declare const succeedSome: <A>(value: A) => Effect<Option<A>>;
|
|
|
1256
1256
|
* - **Handling Circular Dependencies**: Useful in managing circular dependencies, such as recursive functions that need to avoid eager evaluation to prevent stack overflow.
|
|
1257
1257
|
* - **Unifying Return Types**: Can help TypeScript unify return types in situations where multiple branches of logic return different effects, simplifying type inference.
|
|
1258
1258
|
*
|
|
1259
|
-
* **Example** (
|
|
1259
|
+
* **Example** (Lazily evaluating side effects)
|
|
1260
1260
|
*
|
|
1261
1261
|
* ```ts
|
|
1262
1262
|
* import { Effect } from "effect"
|
|
@@ -1274,7 +1274,7 @@ export declare const succeedSome: <A>(value: A) => Effect<Option<A>>;
|
|
|
1274
1274
|
* console.log(Effect.runSync(good)) // Output: 2
|
|
1275
1275
|
* ```
|
|
1276
1276
|
*
|
|
1277
|
-
* **Example** (
|
|
1277
|
+
* **Example** (Suspending recursive Fibonacci evaluation)
|
|
1278
1278
|
*
|
|
1279
1279
|
* ```ts
|
|
1280
1280
|
* import { Effect } from "effect"
|
|
@@ -1300,7 +1300,7 @@ export declare const succeedSome: <A>(value: A) => Effect<Option<A>>;
|
|
|
1300
1300
|
* // Output: 3524578
|
|
1301
1301
|
* ```
|
|
1302
1302
|
*
|
|
1303
|
-
* **Example** (
|
|
1303
|
+
* **Example** (Helping TypeScript infer recursive effect types)
|
|
1304
1304
|
*
|
|
1305
1305
|
* ```ts
|
|
1306
1306
|
* import { Effect } from "effect"
|
|
@@ -1348,7 +1348,7 @@ export declare const suspend: <A, E, R>(effect: LazyArg<Effect<A, E, R>>) => Eff
|
|
|
1348
1348
|
*
|
|
1349
1349
|
* @see {@link try_ | try} for a version that can handle failures.
|
|
1350
1350
|
*
|
|
1351
|
-
* **Example** (
|
|
1351
|
+
* **Example** (Capturing synchronous logging in an Effect)
|
|
1352
1352
|
*
|
|
1353
1353
|
* ```ts
|
|
1354
1354
|
* import { Effect } from "effect"
|
|
@@ -1396,7 +1396,7 @@ undefined_ as undefined };
|
|
|
1396
1396
|
* Use `Effect.callback` when integrating APIs that complete through callbacks
|
|
1397
1397
|
* instead of returning a `Promise`.
|
|
1398
1398
|
*
|
|
1399
|
-
* **Example** (
|
|
1399
|
+
* **Example** (Integrating callback APIs)
|
|
1400
1400
|
*
|
|
1401
1401
|
* ```ts
|
|
1402
1402
|
* import { Effect } from "effect"
|
|
@@ -1421,7 +1421,7 @@ export declare const callback: <A, E = never, R = never>(register: (this: Schedu
|
|
|
1421
1421
|
* Returns an effect that will never produce anything. The moral equivalent of
|
|
1422
1422
|
* `while(true) {}`, only without the wasted CPU cycles.
|
|
1423
1423
|
*
|
|
1424
|
-
* **Example** (
|
|
1424
|
+
* **Example** (Creating a never-ending effect)
|
|
1425
1425
|
*
|
|
1426
1426
|
* ```ts
|
|
1427
1427
|
* import { Effect } from "effect"
|
|
@@ -1444,7 +1444,7 @@ export declare const never: Effect<never>;
|
|
|
1444
1444
|
* An `Effect` containing an empty record `{}`, used as the starting point for
|
|
1445
1445
|
* do notation chains.
|
|
1446
1446
|
*
|
|
1447
|
-
* **Example** (
|
|
1447
|
+
* **Example** (Starting do notation)
|
|
1448
1448
|
*
|
|
1449
1449
|
* ```ts
|
|
1450
1450
|
* import { Effect, pipe } from "effect"
|
|
@@ -1539,7 +1539,7 @@ export declare const bind: {
|
|
|
1539
1539
|
* explicit control over the execution of effects. You can `yield*` values from
|
|
1540
1540
|
* effects and return the final result at the end.
|
|
1541
1541
|
*
|
|
1542
|
-
* **Example** (
|
|
1542
|
+
* **Example** (Sequencing effects with generators)
|
|
1543
1543
|
*
|
|
1544
1544
|
* ```ts
|
|
1545
1545
|
* import { Data, Effect } from "effect"
|
|
@@ -1591,7 +1591,7 @@ export declare const gen: {
|
|
|
1591
1591
|
* explicit control over the execution of effects. You can `yield*` values from
|
|
1592
1592
|
* effects and return the final result at the end.
|
|
1593
1593
|
*
|
|
1594
|
-
* **Example** (
|
|
1594
|
+
* **Example** (Sequencing effects with generators)
|
|
1595
1595
|
*
|
|
1596
1596
|
* ```ts
|
|
1597
1597
|
* import { Data, Effect } from "effect"
|
|
@@ -1647,7 +1647,7 @@ export declare const gen: {
|
|
|
1647
1647
|
* explicit control over the execution of effects. You can `yield*` values from
|
|
1648
1648
|
* effects and return the final result at the end.
|
|
1649
1649
|
*
|
|
1650
|
-
* **Example** (
|
|
1650
|
+
* **Example** (Sequencing effects with generators)
|
|
1651
1651
|
*
|
|
1652
1652
|
* ```ts
|
|
1653
1653
|
* import { Data, Effect } from "effect"
|
|
@@ -1716,7 +1716,7 @@ export declare namespace gen {
|
|
|
1716
1716
|
*
|
|
1717
1717
|
* @see {@link succeed} to create an effect that represents a successful value.
|
|
1718
1718
|
*
|
|
1719
|
-
* **Example** (Creating a
|
|
1719
|
+
* **Example** (Creating a failed effect)
|
|
1720
1720
|
*
|
|
1721
1721
|
* ```ts
|
|
1722
1722
|
* import { Data, Effect } from "effect"
|
|
@@ -1740,7 +1740,7 @@ export declare const fail: <E>(error: E) => Effect<never, E>;
|
|
|
1740
1740
|
* This function is useful when you need to create an error effect but want to
|
|
1741
1741
|
* defer the computation of the error value until the effect is actually run.
|
|
1742
1742
|
*
|
|
1743
|
-
* **Example** (
|
|
1743
|
+
* **Example** (Lazily creating failures)
|
|
1744
1744
|
*
|
|
1745
1745
|
* ```ts
|
|
1746
1746
|
* import { Data, Effect } from "effect"
|
|
@@ -1763,7 +1763,7 @@ export declare const failSync: <E>(evaluate: LazyArg<E>) => Effect<never, E>;
|
|
|
1763
1763
|
* This function allows you to create effects that fail with complex error
|
|
1764
1764
|
* structures, including multiple errors, defects, interruptions, and more.
|
|
1765
1765
|
*
|
|
1766
|
-
* **Example** (
|
|
1766
|
+
* **Example** (Failing with a full Cause)
|
|
1767
1767
|
*
|
|
1768
1768
|
* ```ts
|
|
1769
1769
|
* import { Cause, Effect } from "effect"
|
|
@@ -1786,7 +1786,7 @@ export declare const failCause: <E>(cause: Cause.Cause<E>) => Effect<never, E>;
|
|
|
1786
1786
|
* This function is useful when you need to create a failure effect with a
|
|
1787
1787
|
* complex cause but want to defer the computation until the effect is run.
|
|
1788
1788
|
*
|
|
1789
|
-
* **Example** (
|
|
1789
|
+
* **Example** (Lazily creating a Cause)
|
|
1790
1790
|
*
|
|
1791
1791
|
* ```ts
|
|
1792
1792
|
* import { Cause, Effect } from "effect"
|
|
@@ -1822,7 +1822,7 @@ export declare const failCauseSync: <E>(evaluate: LazyArg<Cause.Cause<E>>) => Ef
|
|
|
1822
1822
|
*
|
|
1823
1823
|
* @see {@link die} for a variant that dies with an already computed defect.
|
|
1824
1824
|
*
|
|
1825
|
-
* **Example** (
|
|
1825
|
+
* **Example** (Failing when division by zero)
|
|
1826
1826
|
*
|
|
1827
1827
|
* ```ts
|
|
1828
1828
|
* import { Effect } from "effect"
|
|
@@ -1874,7 +1874,7 @@ export {
|
|
|
1874
1874
|
* @see {@link sync} if the effectful computation is synchronous and does not
|
|
1875
1875
|
* throw errors.
|
|
1876
1876
|
*
|
|
1877
|
-
* **Example** (
|
|
1877
|
+
* **Example** (Parsing JSON with typed error mapping)
|
|
1878
1878
|
*
|
|
1879
1879
|
* ```ts
|
|
1880
1880
|
* import { Effect } from "effect"
|
|
@@ -1894,7 +1894,7 @@ export {
|
|
|
1894
1894
|
* // Output: Exit.failure with Error
|
|
1895
1895
|
* ```
|
|
1896
1896
|
*
|
|
1897
|
-
* **Example** (
|
|
1897
|
+
* **Example** (Mapping synchronous exceptions to a tagged error)
|
|
1898
1898
|
*
|
|
1899
1899
|
* ```ts
|
|
1900
1900
|
* import { Data, Effect } from "effect"
|
|
@@ -1918,7 +1918,7 @@ try_ as try };
|
|
|
1918
1918
|
/**
|
|
1919
1919
|
* Yields control back to the Effect runtime, allowing other fibers to execute.
|
|
1920
1920
|
*
|
|
1921
|
-
* **Example** (
|
|
1921
|
+
* **Example** (Yielding to other fibers)
|
|
1922
1922
|
*
|
|
1923
1923
|
* ```ts
|
|
1924
1924
|
* import { Effect } from "effect"
|
|
@@ -1939,7 +1939,7 @@ export declare const yieldNow: Effect<void>;
|
|
|
1939
1939
|
/**
|
|
1940
1940
|
* Yields control back to the Effect runtime with a specified priority, allowing other fibers to execute.
|
|
1941
1941
|
*
|
|
1942
|
-
* **Example** (
|
|
1942
|
+
* **Example** (Yielding with priority)
|
|
1943
1943
|
*
|
|
1944
1944
|
* ```ts
|
|
1945
1945
|
* import { Effect } from "effect"
|
|
@@ -1960,7 +1960,7 @@ export declare const yieldNowWith: (priority?: number) => Effect<void>;
|
|
|
1960
1960
|
/**
|
|
1961
1961
|
* Provides access to the current fiber within an effect computation.
|
|
1962
1962
|
*
|
|
1963
|
-
* **Example** (
|
|
1963
|
+
* **Example** (Reading the current fiber)
|
|
1964
1964
|
*
|
|
1965
1965
|
* ```ts
|
|
1966
1966
|
* import { Effect } from "effect"
|
|
@@ -1980,7 +1980,7 @@ export declare const withFiber: <A, E = never, R = never>(evaluate: (fiber: Fibe
|
|
|
1980
1980
|
/**
|
|
1981
1981
|
* Converts a `Result` to an `Effect`.
|
|
1982
1982
|
*
|
|
1983
|
-
* **Example** (
|
|
1983
|
+
* **Example** (Converting a Result into an Effect)
|
|
1984
1984
|
*
|
|
1985
1985
|
* ```ts
|
|
1986
1986
|
* import { Effect, Result } from "effect"
|
|
@@ -2006,7 +2006,7 @@ export declare const fromResult: <A, E>(result: Result.Result<A, E>) => Effect<A
|
|
|
2006
2006
|
* `Option.some` becomes a successful effect with the contained value, while
|
|
2007
2007
|
* `Option.none` becomes a failed effect with `NoSuchElementError`.
|
|
2008
2008
|
*
|
|
2009
|
-
* **Example** (
|
|
2009
|
+
* **Example** (Converting an Option into an Effect)
|
|
2010
2010
|
*
|
|
2011
2011
|
* ```ts
|
|
2012
2012
|
* import { Effect, Option } from "effect"
|
|
@@ -2030,7 +2030,7 @@ export declare const fromOption: <A>(option: Option<A>) => Effect<A, Cause.NoSuc
|
|
|
2030
2030
|
* Converts a nullable value to an `Effect`, failing with a `NoSuchElementError`
|
|
2031
2031
|
* when the value is `null` or `undefined`.
|
|
2032
2032
|
*
|
|
2033
|
-
* **Example** (
|
|
2033
|
+
* **Example** (Failing on nullish values)
|
|
2034
2034
|
*
|
|
2035
2035
|
* ```ts
|
|
2036
2036
|
* import { Console, Effect } from "effect"
|
|
@@ -2082,7 +2082,7 @@ export declare const fromNullishOr: <A>(value: A) => Effect<NonNullable<A>, Caus
|
|
|
2082
2082
|
* step produces a new `Effect` while flattening any nested effects that may
|
|
2083
2083
|
* occur.
|
|
2084
2084
|
*
|
|
2085
|
-
* **Example** (
|
|
2085
|
+
* **Example** (Sequencing dependent effects)
|
|
2086
2086
|
*
|
|
2087
2087
|
* ```ts
|
|
2088
2088
|
* import { Data, Effect, pipe } from "effect"
|
|
@@ -2147,7 +2147,7 @@ export declare const flatMap: {
|
|
|
2147
2147
|
* step produces a new `Effect` while flattening any nested effects that may
|
|
2148
2148
|
* occur.
|
|
2149
2149
|
*
|
|
2150
|
-
* **Example** (
|
|
2150
|
+
* **Example** (Sequencing dependent effects)
|
|
2151
2151
|
*
|
|
2152
2152
|
* ```ts
|
|
2153
2153
|
* import { Data, Effect, pipe } from "effect"
|
|
@@ -2212,7 +2212,7 @@ export declare const flatMap: {
|
|
|
2212
2212
|
* step produces a new `Effect` while flattening any nested effects that may
|
|
2213
2213
|
* occur.
|
|
2214
2214
|
*
|
|
2215
|
-
* **Example** (
|
|
2215
|
+
* **Example** (Sequencing dependent effects)
|
|
2216
2216
|
*
|
|
2217
2217
|
* ```ts
|
|
2218
2218
|
* import { Data, Effect, pipe } from "effect"
|
|
@@ -2251,7 +2251,7 @@ export declare const flatMap: {
|
|
|
2251
2251
|
/**
|
|
2252
2252
|
* Flattens an `Effect` that produces another `Effect` into a single effect.
|
|
2253
2253
|
*
|
|
2254
|
-
* **Example** (
|
|
2254
|
+
* **Example** (Flattening nested effects)
|
|
2255
2255
|
*
|
|
2256
2256
|
* ```ts
|
|
2257
2257
|
* import { Console, Effect } from "effect"
|
|
@@ -2298,7 +2298,7 @@ export declare const flatten: <A, E, R, E2, R2>(self: Effect<Effect<A, E, R>, E2
|
|
|
2298
2298
|
* Failures or requirements from either effect are preserved in the returned
|
|
2299
2299
|
* effect.
|
|
2300
2300
|
*
|
|
2301
|
-
* **Example** (
|
|
2301
|
+
* **Example** (Sequencing a discount calculation after fetching a total)
|
|
2302
2302
|
*
|
|
2303
2303
|
* ```ts
|
|
2304
2304
|
* import { Data, Effect, pipe } from "effect"
|
|
@@ -2371,7 +2371,7 @@ export declare const andThen: {
|
|
|
2371
2371
|
* Failures or requirements from either effect are preserved in the returned
|
|
2372
2372
|
* effect.
|
|
2373
2373
|
*
|
|
2374
|
-
* **Example** (
|
|
2374
|
+
* **Example** (Sequencing a discount calculation after fetching a total)
|
|
2375
2375
|
*
|
|
2376
2376
|
* ```ts
|
|
2377
2377
|
* import { Data, Effect, pipe } from "effect"
|
|
@@ -2444,7 +2444,7 @@ export declare const andThen: {
|
|
|
2444
2444
|
* Failures or requirements from either effect are preserved in the returned
|
|
2445
2445
|
* effect.
|
|
2446
2446
|
*
|
|
2447
|
-
* **Example** (
|
|
2447
|
+
* **Example** (Sequencing a discount calculation after fetching a total)
|
|
2448
2448
|
*
|
|
2449
2449
|
* ```ts
|
|
2450
2450
|
* import { Data, Effect, pipe } from "effect"
|
|
@@ -2517,7 +2517,7 @@ export declare const andThen: {
|
|
|
2517
2517
|
* Failures or requirements from either effect are preserved in the returned
|
|
2518
2518
|
* effect.
|
|
2519
2519
|
*
|
|
2520
|
-
* **Example** (
|
|
2520
|
+
* **Example** (Sequencing a discount calculation after fetching a total)
|
|
2521
2521
|
*
|
|
2522
2522
|
* ```ts
|
|
2523
2523
|
* import { Data, Effect, pipe } from "effect"
|
|
@@ -2590,7 +2590,7 @@ export declare const andThen: {
|
|
|
2590
2590
|
* Failures or requirements from either effect are preserved in the returned
|
|
2591
2591
|
* effect.
|
|
2592
2592
|
*
|
|
2593
|
-
* **Example** (
|
|
2593
|
+
* **Example** (Sequencing a discount calculation after fetching a total)
|
|
2594
2594
|
*
|
|
2595
2595
|
* ```ts
|
|
2596
2596
|
* import { Data, Effect, pipe } from "effect"
|
|
@@ -2929,7 +2929,7 @@ export declare const tap: {
|
|
|
2929
2929
|
* The resulting effect cannot fail directly because all recoverable failures
|
|
2930
2930
|
* are represented inside the `Result` type.
|
|
2931
2931
|
*
|
|
2932
|
-
* **Example** (
|
|
2932
|
+
* **Example** (Capturing success or failure as Result)
|
|
2933
2933
|
*
|
|
2934
2934
|
* ```ts
|
|
2935
2935
|
* import { Effect } from "effect"
|
|
@@ -2962,7 +2962,7 @@ export declare const result: <A, E, R>(self: Effect<A, E, R>) => Effect<Result.R
|
|
|
2962
2962
|
* Success values become `Option.some`, recoverable failures become
|
|
2963
2963
|
* `Option.none`, and defects still fail the effect.
|
|
2964
2964
|
*
|
|
2965
|
-
* **Example** (
|
|
2965
|
+
* **Example** (Capturing success or failure as Option)
|
|
2966
2966
|
*
|
|
2967
2967
|
* ```ts
|
|
2968
2968
|
* import { Console, Effect, Option } from "effect"
|
|
@@ -3000,7 +3000,7 @@ export declare const option: <A, E, R>(self: Effect<A, E, R>) => Effect<Option<A
|
|
|
3000
3000
|
* the `Exit.Failure` type. The error type is set to `never`, indicating that
|
|
3001
3001
|
* the effect is structured to never fail directly.
|
|
3002
3002
|
*
|
|
3003
|
-
* **Example** (
|
|
3003
|
+
* **Example** (Capturing completion as Exit)
|
|
3004
3004
|
*
|
|
3005
3005
|
* ```ts
|
|
3006
3006
|
* import { Effect } from "effect"
|
|
@@ -3047,7 +3047,7 @@ export declare const exit: <A, E, R>(self: Effect<A, E, R>) => Effect<Exit.Exit<
|
|
|
3047
3047
|
* effect is not modified. Instead, a new effect is returned with the updated
|
|
3048
3048
|
* value.
|
|
3049
3049
|
*
|
|
3050
|
-
* **Example** (Adding a
|
|
3050
|
+
* **Example** (Adding a service charge)
|
|
3051
3051
|
*
|
|
3052
3052
|
* ```ts
|
|
3053
3053
|
* import { Effect, pipe } from "effect"
|
|
@@ -3095,7 +3095,7 @@ export declare const map: {
|
|
|
3095
3095
|
* effect is not modified. Instead, a new effect is returned with the updated
|
|
3096
3096
|
* value.
|
|
3097
3097
|
*
|
|
3098
|
-
* **Example** (Adding a
|
|
3098
|
+
* **Example** (Adding a service charge)
|
|
3099
3099
|
*
|
|
3100
3100
|
* ```ts
|
|
3101
3101
|
* import { Effect, pipe } from "effect"
|
|
@@ -3143,7 +3143,7 @@ export declare const map: {
|
|
|
3143
3143
|
* effect is not modified. Instead, a new effect is returned with the updated
|
|
3144
3144
|
* value.
|
|
3145
3145
|
*
|
|
3146
|
-
* **Example** (Adding a
|
|
3146
|
+
* **Example** (Adding a service charge)
|
|
3147
3147
|
*
|
|
3148
3148
|
* ```ts
|
|
3149
3149
|
* import { Effect, pipe } from "effect"
|
|
@@ -3176,7 +3176,7 @@ export declare const map: {
|
|
|
3176
3176
|
* `as` allows you to ignore the original value inside an effect and
|
|
3177
3177
|
* replace it with a new constant value.
|
|
3178
3178
|
*
|
|
3179
|
-
* **Example** (Replacing a
|
|
3179
|
+
* **Example** (Replacing a success value)
|
|
3180
3180
|
*
|
|
3181
3181
|
* ```ts
|
|
3182
3182
|
* import { Effect, pipe } from "effect"
|
|
@@ -3198,7 +3198,7 @@ export declare const as: {
|
|
|
3198
3198
|
* `as` allows you to ignore the original value inside an effect and
|
|
3199
3199
|
* replace it with a new constant value.
|
|
3200
3200
|
*
|
|
3201
|
-
* **Example** (Replacing a
|
|
3201
|
+
* **Example** (Replacing a success value)
|
|
3202
3202
|
*
|
|
3203
3203
|
* ```ts
|
|
3204
3204
|
* import { Effect, pipe } from "effect"
|
|
@@ -3220,7 +3220,7 @@ export declare const as: {
|
|
|
3220
3220
|
* `as` allows you to ignore the original value inside an effect and
|
|
3221
3221
|
* replace it with a new constant value.
|
|
3222
3222
|
*
|
|
3223
|
-
* **Example** (Replacing a
|
|
3223
|
+
* **Example** (Replacing a success value)
|
|
3224
3224
|
*
|
|
3225
3225
|
* ```ts
|
|
3226
3226
|
* import { Effect, pipe } from "effect"
|
|
@@ -3242,7 +3242,7 @@ export declare const as: {
|
|
|
3242
3242
|
* in an `Option` value. If the original `Effect` value fails, the returned
|
|
3243
3243
|
* `Effect` value will also fail.
|
|
3244
3244
|
*
|
|
3245
|
-
* **Example** (
|
|
3245
|
+
* **Example** (Wrapping success in Option.some)
|
|
3246
3246
|
*
|
|
3247
3247
|
* ```ts
|
|
3248
3248
|
* import { Effect } from "effect"
|
|
@@ -3263,7 +3263,7 @@ export declare const asSome: <A, E, R>(self: Effect<A, E, R>) => Effect<Option<A
|
|
|
3263
3263
|
* succeed. If the original `Effect` value fails, the returned `Effect` value
|
|
3264
3264
|
* will fail with the same error.
|
|
3265
3265
|
*
|
|
3266
|
-
* **Example** (
|
|
3266
|
+
* **Example** (Discarding success values)
|
|
3267
3267
|
*
|
|
3268
3268
|
* ```ts
|
|
3269
3269
|
* import { Effect } from "effect"
|
|
@@ -3287,7 +3287,7 @@ export declare const asVoid: <A, E, R>(self: Effect<A, E, R>) => Effect<void, E,
|
|
|
3287
3287
|
* be helpful in scenarios where you want to handle a success as a failure or
|
|
3288
3288
|
* treat an error as a valid result.
|
|
3289
3289
|
*
|
|
3290
|
-
* **Example** (
|
|
3290
|
+
* **Example** (Swapping success and failure channels)
|
|
3291
3291
|
*
|
|
3292
3292
|
* ```ts
|
|
3293
3293
|
* import { Effect } from "effect"
|
|
@@ -3319,7 +3319,7 @@ export declare const flip: <A, E, R>(self: Effect<A, E, R>) => Effect<E, A, R>;
|
|
|
3319
3319
|
* @see {@link zipWith} for a version that combines the results with a custom function.
|
|
3320
3320
|
* @see {@link validate} for a version that accumulates errors.
|
|
3321
3321
|
*
|
|
3322
|
-
* **Example** (Combining
|
|
3322
|
+
* **Example** (Combining two effects sequentially)
|
|
3323
3323
|
*
|
|
3324
3324
|
* ```ts
|
|
3325
3325
|
* import { Effect } from "effect"
|
|
@@ -3346,7 +3346,7 @@ export declare const flip: <A, E, R>(self: Effect<A, E, R>) => Effect<E, A, R>;
|
|
|
3346
3346
|
* // [ 1, 'hello' ]
|
|
3347
3347
|
* ```
|
|
3348
3348
|
*
|
|
3349
|
-
* **Example** (Combining
|
|
3349
|
+
* **Example** (Combining two effects concurrently)
|
|
3350
3350
|
*
|
|
3351
3351
|
* ```ts
|
|
3352
3352
|
* import { Effect } from "effect"
|
|
@@ -3388,7 +3388,7 @@ export declare const zip: {
|
|
|
3388
3388
|
* @see {@link zipWith} for a version that combines the results with a custom function.
|
|
3389
3389
|
* @see {@link validate} for a version that accumulates errors.
|
|
3390
3390
|
*
|
|
3391
|
-
* **Example** (Combining
|
|
3391
|
+
* **Example** (Combining two effects sequentially)
|
|
3392
3392
|
*
|
|
3393
3393
|
* ```ts
|
|
3394
3394
|
* import { Effect } from "effect"
|
|
@@ -3415,7 +3415,7 @@ export declare const zip: {
|
|
|
3415
3415
|
* // [ 1, 'hello' ]
|
|
3416
3416
|
* ```
|
|
3417
3417
|
*
|
|
3418
|
-
* **Example** (Combining
|
|
3418
|
+
* **Example** (Combining two effects concurrently)
|
|
3419
3419
|
*
|
|
3420
3420
|
* ```ts
|
|
3421
3421
|
* import { Effect } from "effect"
|
|
@@ -3459,7 +3459,7 @@ export declare const zip: {
|
|
|
3459
3459
|
* @see {@link zipWith} for a version that combines the results with a custom function.
|
|
3460
3460
|
* @see {@link validate} for a version that accumulates errors.
|
|
3461
3461
|
*
|
|
3462
|
-
* **Example** (Combining
|
|
3462
|
+
* **Example** (Combining two effects sequentially)
|
|
3463
3463
|
*
|
|
3464
3464
|
* ```ts
|
|
3465
3465
|
* import { Effect } from "effect"
|
|
@@ -3486,7 +3486,7 @@ export declare const zip: {
|
|
|
3486
3486
|
* // [ 1, 'hello' ]
|
|
3487
3487
|
* ```
|
|
3488
3488
|
*
|
|
3489
|
-
* **Example** (Combining
|
|
3489
|
+
* **Example** (Combining two effects concurrently)
|
|
3490
3490
|
*
|
|
3491
3491
|
* ```ts
|
|
3492
3492
|
* import { Effect } from "effect"
|
|
@@ -3532,7 +3532,7 @@ export declare const zip: {
|
|
|
3532
3532
|
* By default, the effects are run sequentially. To execute them concurrently,
|
|
3533
3533
|
* use the `{ concurrent: true }` option.
|
|
3534
3534
|
*
|
|
3535
|
-
* **Example** (Combining
|
|
3535
|
+
* **Example** (Combining two success values with a function)
|
|
3536
3536
|
*
|
|
3537
3537
|
* ```ts
|
|
3538
3538
|
* import { Effect } from "effect"
|
|
@@ -3579,7 +3579,7 @@ export declare const zipWith: {
|
|
|
3579
3579
|
* By default, the effects are run sequentially. To execute them concurrently,
|
|
3580
3580
|
* use the `{ concurrent: true }` option.
|
|
3581
3581
|
*
|
|
3582
|
-
* **Example** (Combining
|
|
3582
|
+
* **Example** (Combining two success values with a function)
|
|
3583
3583
|
*
|
|
3584
3584
|
* ```ts
|
|
3585
3585
|
* import { Effect } from "effect"
|
|
@@ -3628,7 +3628,7 @@ export declare const zipWith: {
|
|
|
3628
3628
|
* By default, the effects are run sequentially. To execute them concurrently,
|
|
3629
3629
|
* use the `{ concurrent: true }` option.
|
|
3630
3630
|
*
|
|
3631
|
-
* **Example** (Combining
|
|
3631
|
+
* **Example** (Combining two success values with a function)
|
|
3632
3632
|
*
|
|
3633
3633
|
* ```ts
|
|
3634
3634
|
* import { Effect } from "effect"
|
|
@@ -3701,7 +3701,7 @@ catch_ as catch };
|
|
|
3701
3701
|
* The error type must have a readonly `_tag` field to use `catchTag`. This
|
|
3702
3702
|
* field is used to identify and match errors.
|
|
3703
3703
|
*
|
|
3704
|
-
* **Example** (
|
|
3704
|
+
* **Example** (Handling a tagged error)
|
|
3705
3705
|
*
|
|
3706
3706
|
* ```ts
|
|
3707
3707
|
* import { Effect } from "effect"
|
|
@@ -3743,7 +3743,7 @@ export declare const catchTag: {
|
|
|
3743
3743
|
* The error type must have a readonly `_tag` field to use `catchTag`. This
|
|
3744
3744
|
* field is used to identify and match errors.
|
|
3745
3745
|
*
|
|
3746
|
-
* **Example** (
|
|
3746
|
+
* **Example** (Handling a tagged error)
|
|
3747
3747
|
*
|
|
3748
3748
|
* ```ts
|
|
3749
3749
|
* import { Effect } from "effect"
|
|
@@ -3785,7 +3785,7 @@ export declare const catchTag: {
|
|
|
3785
3785
|
* The error type must have a readonly `_tag` field to use `catchTag`. This
|
|
3786
3786
|
* field is used to identify and match errors.
|
|
3787
3787
|
*
|
|
3788
|
-
* **Example** (
|
|
3788
|
+
* **Example** (Handling a tagged error)
|
|
3789
3789
|
*
|
|
3790
3790
|
* ```ts
|
|
3791
3791
|
* import { Effect } from "effect"
|
|
@@ -3829,7 +3829,7 @@ export declare const catchTag: {
|
|
|
3829
3829
|
* The error type must have a readonly `_tag` field to use `catchTag`. This
|
|
3830
3830
|
* field is used to identify and match errors.
|
|
3831
3831
|
*
|
|
3832
|
-
* **Example** (
|
|
3832
|
+
* **Example** (Handling multiple tagged errors)
|
|
3833
3833
|
*
|
|
3834
3834
|
* ```ts
|
|
3835
3835
|
* import { Data, Effect } from "effect"
|
|
@@ -3873,7 +3873,7 @@ export declare const catchTags: {
|
|
|
3873
3873
|
* The error type must have a readonly `_tag` field to use `catchTag`. This
|
|
3874
3874
|
* field is used to identify and match errors.
|
|
3875
3875
|
*
|
|
3876
|
-
* **Example** (
|
|
3876
|
+
* **Example** (Handling multiple tagged errors)
|
|
3877
3877
|
*
|
|
3878
3878
|
* ```ts
|
|
3879
3879
|
* import { Data, Effect } from "effect"
|
|
@@ -3937,7 +3937,7 @@ export declare const catchTags: {
|
|
|
3937
3937
|
* The error type must have a readonly `_tag` field to use `catchTag`. This
|
|
3938
3938
|
* field is used to identify and match errors.
|
|
3939
3939
|
*
|
|
3940
|
-
* **Example** (
|
|
3940
|
+
* **Example** (Handling multiple tagged errors)
|
|
3941
3941
|
*
|
|
3942
3942
|
* ```ts
|
|
3943
3943
|
* import { Data, Effect } from "effect"
|
|
@@ -3993,7 +3993,7 @@ export declare const catchTags: {
|
|
|
3993
3993
|
* Use this to handle nested error causes without removing the parent error
|
|
3994
3994
|
* from the error channel. The handler receives the unwrapped reason.
|
|
3995
3995
|
*
|
|
3996
|
-
* **Example** (
|
|
3996
|
+
* **Example** (Handling an error reason)
|
|
3997
3997
|
*
|
|
3998
3998
|
* ```ts
|
|
3999
3999
|
* import { Data, Effect } from "effect"
|
|
@@ -4030,7 +4030,7 @@ export declare const catchReason: {
|
|
|
4030
4030
|
* Use this to handle nested error causes without removing the parent error
|
|
4031
4031
|
* from the error channel. The handler receives the unwrapped reason.
|
|
4032
4032
|
*
|
|
4033
|
-
* **Example** (
|
|
4033
|
+
* **Example** (Handling an error reason)
|
|
4034
4034
|
*
|
|
4035
4035
|
* ```ts
|
|
4036
4036
|
* import { Data, Effect } from "effect"
|
|
@@ -4067,7 +4067,7 @@ export declare const catchReason: {
|
|
|
4067
4067
|
* Use this to handle nested error causes without removing the parent error
|
|
4068
4068
|
* from the error channel. The handler receives the unwrapped reason.
|
|
4069
4069
|
*
|
|
4070
|
-
* **Example** (
|
|
4070
|
+
* **Example** (Handling an error reason)
|
|
4071
4071
|
*
|
|
4072
4072
|
* ```ts
|
|
4073
4073
|
* import { Data, Effect } from "effect"
|
|
@@ -4102,7 +4102,7 @@ export declare const catchReason: {
|
|
|
4102
4102
|
/**
|
|
4103
4103
|
* Catches multiple reasons within a tagged error using an object of handlers.
|
|
4104
4104
|
*
|
|
4105
|
-
* **Example** (
|
|
4105
|
+
* **Example** (Handling multiple error reasons)
|
|
4106
4106
|
*
|
|
4107
4107
|
* ```ts
|
|
4108
4108
|
* import { Data, Effect } from "effect"
|
|
@@ -4138,7 +4138,7 @@ export declare const catchReasons: {
|
|
|
4138
4138
|
/**
|
|
4139
4139
|
* Catches multiple reasons within a tagged error using an object of handlers.
|
|
4140
4140
|
*
|
|
4141
|
-
* **Example** (
|
|
4141
|
+
* **Example** (Handling multiple error reasons)
|
|
4142
4142
|
*
|
|
4143
4143
|
* ```ts
|
|
4144
4144
|
* import { Data, Effect } from "effect"
|
|
@@ -4182,7 +4182,7 @@ export declare const catchReasons: {
|
|
|
4182
4182
|
/**
|
|
4183
4183
|
* Catches multiple reasons within a tagged error using an object of handlers.
|
|
4184
4184
|
*
|
|
4185
|
-
* **Example** (
|
|
4185
|
+
* **Example** (Handling multiple error reasons)
|
|
4186
4186
|
*
|
|
4187
4187
|
* ```ts
|
|
4188
4188
|
* import { Data, Effect } from "effect"
|
|
@@ -4239,7 +4239,7 @@ export type TagsWithReason<E> = {
|
|
|
4239
4239
|
* Promotes nested reason errors into the Effect error channel, replacing
|
|
4240
4240
|
* the parent error.
|
|
4241
4241
|
*
|
|
4242
|
-
* **Example** (
|
|
4242
|
+
* **Example** (Extracting the reason from a tagged error)
|
|
4243
4243
|
*
|
|
4244
4244
|
* ```ts
|
|
4245
4245
|
* import { Data, Effect } from "effect"
|
|
@@ -4271,7 +4271,7 @@ export declare const unwrapReason: {
|
|
|
4271
4271
|
* Promotes nested reason errors into the Effect error channel, replacing
|
|
4272
4272
|
* the parent error.
|
|
4273
4273
|
*
|
|
4274
|
-
* **Example** (
|
|
4274
|
+
* **Example** (Extracting the reason from a tagged error)
|
|
4275
4275
|
*
|
|
4276
4276
|
* ```ts
|
|
4277
4277
|
* import { Data, Effect } from "effect"
|
|
@@ -4303,7 +4303,7 @@ export declare const unwrapReason: {
|
|
|
4303
4303
|
* Promotes nested reason errors into the Effect error channel, replacing
|
|
4304
4304
|
* the parent error.
|
|
4305
4305
|
*
|
|
4306
|
-
* **Example** (
|
|
4306
|
+
* **Example** (Extracting the reason from a tagged error)
|
|
4307
4307
|
*
|
|
4308
4308
|
* ```ts
|
|
4309
4309
|
* import { Data, Effect } from "effect"
|
|
@@ -4349,7 +4349,7 @@ export declare const unwrapReason: {
|
|
|
4349
4349
|
* they often indicate serious issues. However, in some cases, such as
|
|
4350
4350
|
* dynamically loaded plugins, controlled recovery might be needed.
|
|
4351
4351
|
*
|
|
4352
|
-
* **Example** (
|
|
4352
|
+
* **Example** (Recovering from full failure causes)
|
|
4353
4353
|
*
|
|
4354
4354
|
* ```ts
|
|
4355
4355
|
* import { Cause, Console, Effect } from "effect"
|
|
@@ -4389,7 +4389,7 @@ export declare const catchCause: {
|
|
|
4389
4389
|
* they often indicate serious issues. However, in some cases, such as
|
|
4390
4390
|
* dynamically loaded plugins, controlled recovery might be needed.
|
|
4391
4391
|
*
|
|
4392
|
-
* **Example** (
|
|
4392
|
+
* **Example** (Recovering from full failure causes)
|
|
4393
4393
|
*
|
|
4394
4394
|
* ```ts
|
|
4395
4395
|
* import { Cause, Console, Effect } from "effect"
|
|
@@ -4429,7 +4429,7 @@ export declare const catchCause: {
|
|
|
4429
4429
|
* they often indicate serious issues. However, in some cases, such as
|
|
4430
4430
|
* dynamically loaded plugins, controlled recovery might be needed.
|
|
4431
4431
|
*
|
|
4432
|
-
* **Example** (
|
|
4432
|
+
* **Example** (Recovering from full failure causes)
|
|
4433
4433
|
*
|
|
4434
4434
|
* ```ts
|
|
4435
4435
|
* import { Cause, Console, Effect } from "effect"
|
|
@@ -4472,7 +4472,7 @@ export declare const catchCause: {
|
|
|
4472
4472
|
* they often indicate serious issues. In some cases, such as dynamically loaded
|
|
4473
4473
|
* plugins, controlled recovery may be needed.
|
|
4474
4474
|
*
|
|
4475
|
-
* **Example** (
|
|
4475
|
+
* **Example** (Recovering from defects)
|
|
4476
4476
|
*
|
|
4477
4477
|
* ```ts
|
|
4478
4478
|
* import { Console, Effect } from "effect"
|
|
@@ -4513,7 +4513,7 @@ export declare const catchDefect: {
|
|
|
4513
4513
|
* they often indicate serious issues. In some cases, such as dynamically loaded
|
|
4514
4514
|
* plugins, controlled recovery may be needed.
|
|
4515
4515
|
*
|
|
4516
|
-
* **Example** (
|
|
4516
|
+
* **Example** (Recovering from defects)
|
|
4517
4517
|
*
|
|
4518
4518
|
* ```ts
|
|
4519
4519
|
* import { Console, Effect } from "effect"
|
|
@@ -4554,7 +4554,7 @@ export declare const catchDefect: {
|
|
|
4554
4554
|
* they often indicate serious issues. In some cases, such as dynamically loaded
|
|
4555
4555
|
* plugins, controlled recovery may be needed.
|
|
4556
4556
|
*
|
|
4557
|
-
* **Example** (
|
|
4557
|
+
* **Example** (Recovering from defects)
|
|
4558
4558
|
*
|
|
4559
4559
|
* ```ts
|
|
4560
4560
|
* import { Console, Effect } from "effect"
|
|
@@ -4587,7 +4587,7 @@ export declare const catchDefect: {
|
|
|
4587
4587
|
* matching. Non-matching errors re-fail with the original cause. Defects and
|
|
4588
4588
|
* interrupts are not caught.
|
|
4589
4589
|
*
|
|
4590
|
-
* **Example** (
|
|
4590
|
+
* **Example** (Recovering when a predicate matches)
|
|
4591
4591
|
*
|
|
4592
4592
|
* ```ts
|
|
4593
4593
|
* import { Data, Effect, Filter } from "effect"
|
|
@@ -4627,7 +4627,7 @@ export declare const catchIf: {
|
|
|
4627
4627
|
* matching. Non-matching errors re-fail with the original cause. Defects and
|
|
4628
4628
|
* interrupts are not caught.
|
|
4629
4629
|
*
|
|
4630
|
-
* **Example** (
|
|
4630
|
+
* **Example** (Recovering when a predicate matches)
|
|
4631
4631
|
*
|
|
4632
4632
|
* ```ts
|
|
4633
4633
|
* import { Data, Effect, Filter } from "effect"
|
|
@@ -4667,7 +4667,7 @@ export declare const catchIf: {
|
|
|
4667
4667
|
* matching. Non-matching errors re-fail with the original cause. Defects and
|
|
4668
4668
|
* interrupts are not caught.
|
|
4669
4669
|
*
|
|
4670
|
-
* **Example** (
|
|
4670
|
+
* **Example** (Recovering when a predicate matches)
|
|
4671
4671
|
*
|
|
4672
4672
|
* ```ts
|
|
4673
4673
|
* import { Data, Effect, Filter } from "effect"
|
|
@@ -4707,7 +4707,7 @@ export declare const catchIf: {
|
|
|
4707
4707
|
* matching. Non-matching errors re-fail with the original cause. Defects and
|
|
4708
4708
|
* interrupts are not caught.
|
|
4709
4709
|
*
|
|
4710
|
-
* **Example** (
|
|
4710
|
+
* **Example** (Recovering when a predicate matches)
|
|
4711
4711
|
*
|
|
4712
4712
|
* ```ts
|
|
4713
4713
|
* import { Data, Effect, Filter } from "effect"
|
|
@@ -4747,7 +4747,7 @@ export declare const catchIf: {
|
|
|
4747
4747
|
* matching. Non-matching errors re-fail with the original cause. Defects and
|
|
4748
4748
|
* interrupts are not caught.
|
|
4749
4749
|
*
|
|
4750
|
-
* **Example** (
|
|
4750
|
+
* **Example** (Recovering when a predicate matches)
|
|
4751
4751
|
*
|
|
4752
4752
|
* ```ts
|
|
4753
4753
|
* import { Data, Effect, Filter } from "effect"
|
|
@@ -4806,7 +4806,7 @@ export declare const catchFilter: {
|
|
|
4806
4806
|
* Success values become `Option.some`, `NoSuchElementError` becomes
|
|
4807
4807
|
* `Option.none`, and all other errors are preserved.
|
|
4808
4808
|
*
|
|
4809
|
-
* **Example** (
|
|
4809
|
+
* **Example** (Recovering from missing Option values)
|
|
4810
4810
|
*
|
|
4811
4811
|
* ```ts
|
|
4812
4812
|
* import { Effect, Option } from "effect"
|
|
@@ -4829,7 +4829,7 @@ export declare const catchNoSuchElement: <A, E, R>(self: Effect<A, E, R>) => Eff
|
|
|
4829
4829
|
* that match a specific predicate. This is useful when you want to handle
|
|
4830
4830
|
* only certain types of errors while letting others propagate.
|
|
4831
4831
|
*
|
|
4832
|
-
* **Example** (
|
|
4832
|
+
* **Example** (Recovering from selected causes)
|
|
4833
4833
|
*
|
|
4834
4834
|
* ```ts
|
|
4835
4835
|
* import { Cause, Console, Effect } from "effect"
|
|
@@ -4863,7 +4863,7 @@ export declare const catchCauseIf: {
|
|
|
4863
4863
|
* that match a specific predicate. This is useful when you want to handle
|
|
4864
4864
|
* only certain types of errors while letting others propagate.
|
|
4865
4865
|
*
|
|
4866
|
-
* **Example** (
|
|
4866
|
+
* **Example** (Recovering from selected causes)
|
|
4867
4867
|
*
|
|
4868
4868
|
* ```ts
|
|
4869
4869
|
* import { Cause, Console, Effect } from "effect"
|
|
@@ -4897,7 +4897,7 @@ export declare const catchCauseIf: {
|
|
|
4897
4897
|
* that match a specific predicate. This is useful when you want to handle
|
|
4898
4898
|
* only certain types of errors while letting others propagate.
|
|
4899
4899
|
*
|
|
4900
|
-
* **Example** (
|
|
4900
|
+
* **Example** (Recovering from selected causes)
|
|
4901
4901
|
*
|
|
4902
4902
|
* ```ts
|
|
4903
4903
|
* import { Cause, Console, Effect } from "effect"
|
|
@@ -4960,7 +4960,7 @@ export declare const catchCauseFilter: {
|
|
|
4960
4960
|
* @see {@link mapBoth} for a version that operates on both channels.
|
|
4961
4961
|
* @see {@link mapError} if you want to replace the error with a new one.
|
|
4962
4962
|
*
|
|
4963
|
-
* **Example** (
|
|
4963
|
+
* **Example** (Transforming the error channel)
|
|
4964
4964
|
*
|
|
4965
4965
|
* ```ts
|
|
4966
4966
|
* import { Data, Effect } from "effect"
|
|
@@ -4996,7 +4996,7 @@ export declare const mapError: {
|
|
|
4996
4996
|
* @see {@link mapBoth} for a version that operates on both channels.
|
|
4997
4997
|
* @see {@link mapError} if you want to replace the error with a new one.
|
|
4998
4998
|
*
|
|
4999
|
-
* **Example** (
|
|
4999
|
+
* **Example** (Transforming the error channel)
|
|
5000
5000
|
*
|
|
5001
5001
|
* ```ts
|
|
5002
5002
|
* import { Data, Effect } from "effect"
|
|
@@ -5032,7 +5032,7 @@ export declare const mapError: {
|
|
|
5032
5032
|
* @see {@link mapBoth} for a version that operates on both channels.
|
|
5033
5033
|
* @see {@link mapError} if you want to replace the error with a new one.
|
|
5034
5034
|
*
|
|
5035
|
-
* **Example** (
|
|
5035
|
+
* **Example** (Transforming the error channel)
|
|
5036
5036
|
*
|
|
5037
5037
|
* ```ts
|
|
5038
5038
|
* import { Data, Effect } from "effect"
|
|
@@ -5066,7 +5066,7 @@ export declare const mapError: {
|
|
|
5066
5066
|
* the error and the success values without altering the overall success or
|
|
5067
5067
|
* failure status of the effect.
|
|
5068
5068
|
*
|
|
5069
|
-
* **Example** (
|
|
5069
|
+
* **Example** (Transforming success and failure channels)
|
|
5070
5070
|
*
|
|
5071
5071
|
* ```ts
|
|
5072
5072
|
* import { Data, Effect } from "effect"
|
|
@@ -5102,7 +5102,7 @@ export declare const mapBoth: {
|
|
|
5102
5102
|
* the error and the success values without altering the overall success or
|
|
5103
5103
|
* failure status of the effect.
|
|
5104
5104
|
*
|
|
5105
|
-
* **Example** (
|
|
5105
|
+
* **Example** (Transforming success and failure channels)
|
|
5106
5106
|
*
|
|
5107
5107
|
* ```ts
|
|
5108
5108
|
* import { Data, Effect } from "effect"
|
|
@@ -5141,7 +5141,7 @@ export declare const mapBoth: {
|
|
|
5141
5141
|
* the error and the success values without altering the overall success or
|
|
5142
5142
|
* failure status of the effect.
|
|
5143
5143
|
*
|
|
5144
|
-
* **Example** (
|
|
5144
|
+
* **Example** (Transforming success and failure channels)
|
|
5145
5145
|
*
|
|
5146
5146
|
* ```ts
|
|
5147
5147
|
* import { Data, Effect } from "effect"
|
|
@@ -5182,7 +5182,7 @@ export declare const mapBoth: {
|
|
|
5182
5182
|
*
|
|
5183
5183
|
* @see {@link mapError} to transform the error before converting it into a defect with {@link orDie}.
|
|
5184
5184
|
*
|
|
5185
|
-
* **Example** (
|
|
5185
|
+
* **Example** (Converting typed failures into defects)
|
|
5186
5186
|
*
|
|
5187
5187
|
* ```ts
|
|
5188
5188
|
* import { Data, Effect } from "effect"
|
|
@@ -5218,7 +5218,7 @@ export declare const orDie: <A, E, R>(self: Effect<A, E, R>) => Effect<A, never,
|
|
|
5218
5218
|
* operation passed to `tapError` fails, that error is also represented in the
|
|
5219
5219
|
* returned effect's error channel.
|
|
5220
5220
|
*
|
|
5221
|
-
* **Example** (
|
|
5221
|
+
* **Example** (Running effects on failure)
|
|
5222
5222
|
*
|
|
5223
5223
|
* ```ts
|
|
5224
5224
|
* import { Console, Effect } from "effect"
|
|
@@ -5251,7 +5251,7 @@ export declare const tapError: {
|
|
|
5251
5251
|
* operation passed to `tapError` fails, that error is also represented in the
|
|
5252
5252
|
* returned effect's error channel.
|
|
5253
5253
|
*
|
|
5254
|
-
* **Example** (
|
|
5254
|
+
* **Example** (Running effects on failure)
|
|
5255
5255
|
*
|
|
5256
5256
|
* ```ts
|
|
5257
5257
|
* import { Console, Effect } from "effect"
|
|
@@ -5284,7 +5284,7 @@ export declare const tapError: {
|
|
|
5284
5284
|
* operation passed to `tapError` fails, that error is also represented in the
|
|
5285
5285
|
* returned effect's error channel.
|
|
5286
5286
|
*
|
|
5287
|
-
* **Example** (
|
|
5287
|
+
* **Example** (Running effects on failure)
|
|
5288
5288
|
*
|
|
5289
5289
|
* ```ts
|
|
5290
5290
|
* import { Console, Effect } from "effect"
|
|
@@ -5315,7 +5315,7 @@ export declare const tapError: {
|
|
|
5315
5315
|
* list of tags. When the handler succeeds, the original failure is preserved;
|
|
5316
5316
|
* if the handler fails, its error is also included in the returned effect.
|
|
5317
5317
|
*
|
|
5318
|
-
* **Example** (
|
|
5318
|
+
* **Example** (Running effects for tagged failures)
|
|
5319
5319
|
*
|
|
5320
5320
|
* ```ts
|
|
5321
5321
|
* import { Console, Data, Effect } from "effect"
|
|
@@ -5351,7 +5351,7 @@ export declare const tapErrorTag: {
|
|
|
5351
5351
|
* list of tags. When the handler succeeds, the original failure is preserved;
|
|
5352
5352
|
* if the handler fails, its error is also included in the returned effect.
|
|
5353
5353
|
*
|
|
5354
|
-
* **Example** (
|
|
5354
|
+
* **Example** (Running effects for tagged failures)
|
|
5355
5355
|
*
|
|
5356
5356
|
* ```ts
|
|
5357
5357
|
* import { Console, Data, Effect } from "effect"
|
|
@@ -5387,7 +5387,7 @@ export declare const tapErrorTag: {
|
|
|
5387
5387
|
* list of tags. When the handler succeeds, the original failure is preserved;
|
|
5388
5388
|
* if the handler fails, its error is also included in the returned effect.
|
|
5389
5389
|
*
|
|
5390
|
-
* **Example** (
|
|
5390
|
+
* **Example** (Running effects for tagged failures)
|
|
5391
5391
|
*
|
|
5392
5392
|
* ```ts
|
|
5393
5393
|
* import { Console, Data, Effect } from "effect"
|
|
@@ -5427,7 +5427,7 @@ export declare const tapErrorTag: {
|
|
|
5427
5427
|
* the operation succeeds, the original cause is preserved. If the operation
|
|
5428
5428
|
* fails, its error is also represented in the returned effect.
|
|
5429
5429
|
*
|
|
5430
|
-
* **Example** (
|
|
5430
|
+
* **Example** (Observing full failure causes)
|
|
5431
5431
|
*
|
|
5432
5432
|
* ```ts
|
|
5433
5433
|
* import { Cause, Console, Effect } from "effect"
|
|
@@ -5458,7 +5458,7 @@ export declare const tapCause: {
|
|
|
5458
5458
|
* the operation succeeds, the original cause is preserved. If the operation
|
|
5459
5459
|
* fails, its error is also represented in the returned effect.
|
|
5460
5460
|
*
|
|
5461
|
-
* **Example** (
|
|
5461
|
+
* **Example** (Observing full failure causes)
|
|
5462
5462
|
*
|
|
5463
5463
|
* ```ts
|
|
5464
5464
|
* import { Cause, Console, Effect } from "effect"
|
|
@@ -5489,7 +5489,7 @@ export declare const tapCause: {
|
|
|
5489
5489
|
* the operation succeeds, the original cause is preserved. If the operation
|
|
5490
5490
|
* fails, its error is also represented in the returned effect.
|
|
5491
5491
|
*
|
|
5492
|
-
* **Example** (
|
|
5492
|
+
* **Example** (Observing full failure causes)
|
|
5493
5493
|
*
|
|
5494
5494
|
* ```ts
|
|
5495
5495
|
* import { Cause, Console, Effect } from "effect"
|
|
@@ -5518,7 +5518,7 @@ export declare const tapCause: {
|
|
|
5518
5518
|
* the cause matches a specific predicate. This is useful for conditional logging,
|
|
5519
5519
|
* monitoring, or other side effects based on the type of failure.
|
|
5520
5520
|
*
|
|
5521
|
-
* **Example** (
|
|
5521
|
+
* **Example** (Observing selected failure causes)
|
|
5522
5522
|
*
|
|
5523
5523
|
* ```ts
|
|
5524
5524
|
* import { Cause, Console, Effect } from "effect"
|
|
@@ -5548,7 +5548,7 @@ export declare const tapCauseIf: {
|
|
|
5548
5548
|
* the cause matches a specific predicate. This is useful for conditional logging,
|
|
5549
5549
|
* monitoring, or other side effects based on the type of failure.
|
|
5550
5550
|
*
|
|
5551
|
-
* **Example** (
|
|
5551
|
+
* **Example** (Observing selected failure causes)
|
|
5552
5552
|
*
|
|
5553
5553
|
* ```ts
|
|
5554
5554
|
* import { Cause, Console, Effect } from "effect"
|
|
@@ -5578,7 +5578,7 @@ export declare const tapCauseIf: {
|
|
|
5578
5578
|
* the cause matches a specific predicate. This is useful for conditional logging,
|
|
5579
5579
|
* monitoring, or other side effects based on the type of failure.
|
|
5580
5580
|
*
|
|
5581
|
-
* **Example** (
|
|
5581
|
+
* **Example** (Observing selected failure causes)
|
|
5582
5582
|
*
|
|
5583
5583
|
* ```ts
|
|
5584
5584
|
* import { Cause, Console, Effect } from "effect"
|
|
@@ -5634,7 +5634,7 @@ export declare const tapCauseFilter: {
|
|
|
5634
5634
|
* operation succeeds, the original defect is preserved; if the operation fails,
|
|
5635
5635
|
* its error is also represented in the returned effect.
|
|
5636
5636
|
*
|
|
5637
|
-
* **Example** (
|
|
5637
|
+
* **Example** (Observing defects)
|
|
5638
5638
|
*
|
|
5639
5639
|
* ```ts
|
|
5640
5640
|
* import { Console, Effect } from "effect"
|
|
@@ -5682,7 +5682,7 @@ export declare const tapDefect: {
|
|
|
5682
5682
|
* operation succeeds, the original defect is preserved; if the operation fails,
|
|
5683
5683
|
* its error is also represented in the returned effect.
|
|
5684
5684
|
*
|
|
5685
|
-
* **Example** (
|
|
5685
|
+
* **Example** (Observing defects)
|
|
5686
5686
|
*
|
|
5687
5687
|
* ```ts
|
|
5688
5688
|
* import { Console, Effect } from "effect"
|
|
@@ -5730,7 +5730,7 @@ export declare const tapDefect: {
|
|
|
5730
5730
|
* operation succeeds, the original defect is preserved; if the operation fails,
|
|
5731
5731
|
* its error is also represented in the returned effect.
|
|
5732
5732
|
*
|
|
5733
|
-
* **Example** (
|
|
5733
|
+
* **Example** (Observing defects)
|
|
5734
5734
|
*
|
|
5735
5735
|
* ```ts
|
|
5736
5736
|
* import { Console, Effect } from "effect"
|
|
@@ -5774,7 +5774,7 @@ export declare const tapDefect: {
|
|
|
5774
5774
|
*
|
|
5775
5775
|
* Yields between attempts so other fibers can run.
|
|
5776
5776
|
*
|
|
5777
|
-
* **Example** (
|
|
5777
|
+
* **Example** (Retrying until success)
|
|
5778
5778
|
*
|
|
5779
5779
|
* ```ts
|
|
5780
5780
|
* import { Console, Effect } from "effect"
|
|
@@ -5867,7 +5867,7 @@ export declare namespace Retry {
|
|
|
5867
5867
|
* Use `retry` when typed failures may be transient, such as network issues or
|
|
5868
5868
|
* temporary resource unavailability.
|
|
5869
5869
|
*
|
|
5870
|
-
* **Example** (
|
|
5870
|
+
* **Example** (Retrying with a schedule)
|
|
5871
5871
|
*
|
|
5872
5872
|
* ```ts
|
|
5873
5873
|
* import { Data, Effect, Schedule } from "effect"
|
|
@@ -5915,7 +5915,7 @@ export declare const retry: {
|
|
|
5915
5915
|
* Use `retry` when typed failures may be transient, such as network issues or
|
|
5916
5916
|
* temporary resource unavailability.
|
|
5917
5917
|
*
|
|
5918
|
-
* **Example** (
|
|
5918
|
+
* **Example** (Retrying with a schedule)
|
|
5919
5919
|
*
|
|
5920
5920
|
* ```ts
|
|
5921
5921
|
* import { Data, Effect, Schedule } from "effect"
|
|
@@ -5963,7 +5963,7 @@ export declare const retry: {
|
|
|
5963
5963
|
* Use `retry` when typed failures may be transient, such as network issues or
|
|
5964
5964
|
* temporary resource unavailability.
|
|
5965
5965
|
*
|
|
5966
|
-
* **Example** (
|
|
5966
|
+
* **Example** (Retrying with a schedule)
|
|
5967
5967
|
*
|
|
5968
5968
|
* ```ts
|
|
5969
5969
|
* import { Data, Effect, Schedule } from "effect"
|
|
@@ -6011,7 +6011,7 @@ export declare const retry: {
|
|
|
6011
6011
|
* Use `retry` when typed failures may be transient, such as network issues or
|
|
6012
6012
|
* temporary resource unavailability.
|
|
6013
6013
|
*
|
|
6014
|
-
* **Example** (
|
|
6014
|
+
* **Example** (Retrying with a schedule)
|
|
6015
6015
|
*
|
|
6016
6016
|
* ```ts
|
|
6017
6017
|
* import { Data, Effect, Schedule } from "effect"
|
|
@@ -6059,7 +6059,7 @@ export declare const retry: {
|
|
|
6059
6059
|
* Use `retry` when typed failures may be transient, such as network issues or
|
|
6060
6060
|
* temporary resource unavailability.
|
|
6061
6061
|
*
|
|
6062
|
-
* **Example** (
|
|
6062
|
+
* **Example** (Retrying with a schedule)
|
|
6063
6063
|
*
|
|
6064
6064
|
* ```ts
|
|
6065
6065
|
* import { Data, Effect, Schedule } from "effect"
|
|
@@ -6107,7 +6107,7 @@ export declare const retry: {
|
|
|
6107
6107
|
* Use `retry` when typed failures may be transient, such as network issues or
|
|
6108
6108
|
* temporary resource unavailability.
|
|
6109
6109
|
*
|
|
6110
|
-
* **Example** (
|
|
6110
|
+
* **Example** (Retrying with a schedule)
|
|
6111
6111
|
*
|
|
6112
6112
|
* ```ts
|
|
6113
6113
|
* import { Data, Effect, Schedule } from "effect"
|
|
@@ -6155,7 +6155,7 @@ export declare const retry: {
|
|
|
6155
6155
|
* Use `retry` when typed failures may be transient, such as network issues or
|
|
6156
6156
|
* temporary resource unavailability.
|
|
6157
6157
|
*
|
|
6158
|
-
* **Example** (
|
|
6158
|
+
* **Example** (Retrying with a schedule)
|
|
6159
6159
|
*
|
|
6160
6160
|
* ```ts
|
|
6161
6161
|
* import { Data, Effect, Schedule } from "effect"
|
|
@@ -6205,7 +6205,7 @@ export declare const retry: {
|
|
|
6205
6205
|
*
|
|
6206
6206
|
* @see {@link retry} for a version that does not run a fallback effect.
|
|
6207
6207
|
*
|
|
6208
|
-
* **Example** (
|
|
6208
|
+
* **Example** (Falling back after retries are exhausted)
|
|
6209
6209
|
*
|
|
6210
6210
|
* ```ts
|
|
6211
6211
|
* import { Console, Data, Effect, Schedule } from "effect"
|
|
@@ -6263,7 +6263,7 @@ export declare const retryOrElse: {
|
|
|
6263
6263
|
*
|
|
6264
6264
|
* @see {@link retry} for a version that does not run a fallback effect.
|
|
6265
6265
|
*
|
|
6266
|
-
* **Example** (
|
|
6266
|
+
* **Example** (Falling back after retries are exhausted)
|
|
6267
6267
|
*
|
|
6268
6268
|
* ```ts
|
|
6269
6269
|
* import { Console, Data, Effect, Schedule } from "effect"
|
|
@@ -6321,7 +6321,7 @@ export declare const retryOrElse: {
|
|
|
6321
6321
|
*
|
|
6322
6322
|
* @see {@link retry} for a version that does not run a fallback effect.
|
|
6323
6323
|
*
|
|
6324
|
-
* **Example** (
|
|
6324
|
+
* **Example** (Falling back after retries are exhausted)
|
|
6325
6325
|
*
|
|
6326
6326
|
* ```ts
|
|
6327
6327
|
* import { Console, Data, Effect, Schedule } from "effect"
|
|
@@ -6371,7 +6371,7 @@ export declare const retryOrElse: {
|
|
|
6371
6371
|
* failures, defects, and interruptions. Use `unsandbox` to restore the original
|
|
6372
6372
|
* typed error channel after cause-level handling.
|
|
6373
6373
|
*
|
|
6374
|
-
* **Example** (
|
|
6374
|
+
* **Example** (Exposing failures as causes)
|
|
6375
6375
|
*
|
|
6376
6376
|
* ```ts
|
|
6377
6377
|
* import { Cause, Effect } from "effect"
|
|
@@ -6406,7 +6406,7 @@ export declare const sandbox: <A, E, R>(self: Effect<A, E, R>) => Effect<A, Caus
|
|
|
6406
6406
|
* Use the `log` option to emit the full {@link Cause} when the effect fails,
|
|
6407
6407
|
* and `message` to prepend a custom log message.
|
|
6408
6408
|
*
|
|
6409
|
-
* **Example** (
|
|
6409
|
+
* **Example** (Discarding success and failure values)
|
|
6410
6410
|
*
|
|
6411
6411
|
* ```ts
|
|
6412
6412
|
* import { Effect } from "effect"
|
|
@@ -6450,7 +6450,7 @@ export declare const ignore: <Arg extends Effect<any, any, any> | {
|
|
|
6450
6450
|
* Use the `log` option to emit the full {@link Cause} when the effect fails,
|
|
6451
6451
|
* and `message` to prepend a custom log message.
|
|
6452
6452
|
*
|
|
6453
|
-
* **Example** (
|
|
6453
|
+
* **Example** (Ignoring failures and logging causes)
|
|
6454
6454
|
*
|
|
6455
6455
|
* ```ts
|
|
6456
6456
|
* import { Effect } from "effect"
|
|
@@ -6482,7 +6482,7 @@ export declare const ignoreCause: <Arg extends Effect<any, any, any> | {
|
|
|
6482
6482
|
* and retry timing is derived per step (the first attempt uses the remaining
|
|
6483
6483
|
* attempts schedule; later retries apply the step schedule at least once).
|
|
6484
6484
|
*
|
|
6485
|
-
* **Example** (
|
|
6485
|
+
* **Example** (Retrying with an execution plan)
|
|
6486
6486
|
*
|
|
6487
6487
|
* ```ts
|
|
6488
6488
|
* import { Context, Effect, ExecutionPlan, Layer } from "effect"
|
|
@@ -6517,7 +6517,7 @@ export declare const withExecutionPlan: {
|
|
|
6517
6517
|
* and retry timing is derived per step (the first attempt uses the remaining
|
|
6518
6518
|
* attempts schedule; later retries apply the step schedule at least once).
|
|
6519
6519
|
*
|
|
6520
|
-
* **Example** (
|
|
6520
|
+
* **Example** (Retrying with an execution plan)
|
|
6521
6521
|
*
|
|
6522
6522
|
* ```ts
|
|
6523
6523
|
* import { Context, Effect, ExecutionPlan, Layer } from "effect"
|
|
@@ -6557,7 +6557,7 @@ export declare const withExecutionPlan: {
|
|
|
6557
6557
|
* and retry timing is derived per step (the first attempt uses the remaining
|
|
6558
6558
|
* attempts schedule; later retries apply the step schedule at least once).
|
|
6559
6559
|
*
|
|
6560
|
-
* **Example** (
|
|
6560
|
+
* **Example** (Retrying with an execution plan)
|
|
6561
6561
|
*
|
|
6562
6562
|
* ```ts
|
|
6563
6563
|
* import { Context, Effect, ExecutionPlan, Layer } from "effect"
|
|
@@ -6617,7 +6617,7 @@ export declare const withErrorReporting: <Arg extends Effect<any, any, any> | {
|
|
|
6617
6617
|
*
|
|
6618
6618
|
* Defects and interruptions are not recovered by this operator.
|
|
6619
6619
|
*
|
|
6620
|
-
* **Example** (
|
|
6620
|
+
* **Example** (Replacing failures with a value)
|
|
6621
6621
|
*
|
|
6622
6622
|
* ```ts
|
|
6623
6623
|
* import { Effect } from "effect"
|
|
@@ -6654,7 +6654,7 @@ export declare const orElseSucceed: {
|
|
|
6654
6654
|
*
|
|
6655
6655
|
* Defects and interruptions are not recovered by this operator.
|
|
6656
6656
|
*
|
|
6657
|
-
* **Example** (
|
|
6657
|
+
* **Example** (Replacing failures with a value)
|
|
6658
6658
|
*
|
|
6659
6659
|
* ```ts
|
|
6660
6660
|
* import { Effect } from "effect"
|
|
@@ -6691,7 +6691,7 @@ export declare const orElseSucceed: {
|
|
|
6691
6691
|
*
|
|
6692
6692
|
* Defects and interruptions are not recovered by this operator.
|
|
6693
6693
|
*
|
|
6694
|
-
* **Example** (
|
|
6694
|
+
* **Example** (Replacing failures with a value)
|
|
6695
6695
|
*
|
|
6696
6696
|
* ```ts
|
|
6697
6697
|
* import { Effect } from "effect"
|
|
@@ -6738,7 +6738,7 @@ export declare const orElseSucceed: {
|
|
|
6738
6738
|
* attempting multiple APIs, reading configuration from several sources, or
|
|
6739
6739
|
* trying alternative resource locations in order.
|
|
6740
6740
|
*
|
|
6741
|
-
* **Example** (
|
|
6741
|
+
* **Example** (Trying alternatives until one succeeds)
|
|
6742
6742
|
*
|
|
6743
6743
|
* ```ts
|
|
6744
6744
|
* import { Effect } from "effect"
|
|
@@ -6775,7 +6775,7 @@ export declare const firstSuccessOf: <Eff extends Effect<any, any, any>>(effects
|
|
|
6775
6775
|
*
|
|
6776
6776
|
* @see {@link timeoutOrElse} for a version that allows specifying both success and timeout handlers.
|
|
6777
6777
|
*
|
|
6778
|
-
* **Example** (
|
|
6778
|
+
* **Example** (Failing when work takes too long)
|
|
6779
6779
|
*
|
|
6780
6780
|
* ```ts
|
|
6781
6781
|
* import { Effect } from "effect"
|
|
@@ -6821,7 +6821,7 @@ export declare const timeout: {
|
|
|
6821
6821
|
*
|
|
6822
6822
|
* @see {@link timeoutOrElse} for a version that allows specifying both success and timeout handlers.
|
|
6823
6823
|
*
|
|
6824
|
-
* **Example** (
|
|
6824
|
+
* **Example** (Failing when work takes too long)
|
|
6825
6825
|
*
|
|
6826
6826
|
* ```ts
|
|
6827
6827
|
* import { Effect } from "effect"
|
|
@@ -6867,7 +6867,7 @@ export declare const timeout: {
|
|
|
6867
6867
|
*
|
|
6868
6868
|
* @see {@link timeoutOrElse} for a version that allows specifying both success and timeout handlers.
|
|
6869
6869
|
*
|
|
6870
|
-
* **Example** (
|
|
6870
|
+
* **Example** (Failing when work takes too long)
|
|
6871
6871
|
*
|
|
6872
6872
|
* ```ts
|
|
6873
6873
|
* import { Effect } from "effect"
|
|
@@ -6916,7 +6916,7 @@ export declare const timeout: {
|
|
|
6916
6916
|
* @see {@link timeout} for a version that raises a `TimeoutException`.
|
|
6917
6917
|
* @see {@link timeoutOrElse} for a version that allows specifying both success and timeout handlers.
|
|
6918
6918
|
*
|
|
6919
|
-
* **Example** (
|
|
6919
|
+
* **Example** (Returning None on timeout)
|
|
6920
6920
|
*
|
|
6921
6921
|
* ```ts
|
|
6922
6922
|
* import { Effect } from "effect"
|
|
@@ -6962,7 +6962,7 @@ export declare const timeoutOption: {
|
|
|
6962
6962
|
* @see {@link timeout} for a version that raises a `TimeoutException`.
|
|
6963
6963
|
* @see {@link timeoutOrElse} for a version that allows specifying both success and timeout handlers.
|
|
6964
6964
|
*
|
|
6965
|
-
* **Example** (
|
|
6965
|
+
* **Example** (Returning None on timeout)
|
|
6966
6966
|
*
|
|
6967
6967
|
* ```ts
|
|
6968
6968
|
* import { Effect } from "effect"
|
|
@@ -7008,7 +7008,7 @@ export declare const timeoutOption: {
|
|
|
7008
7008
|
* @see {@link timeout} for a version that raises a `TimeoutException`.
|
|
7009
7009
|
* @see {@link timeoutOrElse} for a version that allows specifying both success and timeout handlers.
|
|
7010
7010
|
*
|
|
7011
|
-
* **Example** (
|
|
7011
|
+
* **Example** (Returning None on timeout)
|
|
7012
7012
|
*
|
|
7013
7013
|
* ```ts
|
|
7014
7014
|
* import { Effect } from "effect"
|
|
@@ -7047,7 +7047,7 @@ export declare const timeoutOption: {
|
|
|
7047
7047
|
* This function is useful when you want to set a maximum duration for an operation
|
|
7048
7048
|
* and provide an alternative action if the timeout is exceeded.
|
|
7049
7049
|
*
|
|
7050
|
-
* **Example** (
|
|
7050
|
+
* **Example** (Falling back on timeout)
|
|
7051
7051
|
*
|
|
7052
7052
|
* ```ts
|
|
7053
7053
|
* import { Console, Effect } from "effect"
|
|
@@ -7085,7 +7085,7 @@ export declare const timeoutOrElse: {
|
|
|
7085
7085
|
* This function is useful when you want to set a maximum duration for an operation
|
|
7086
7086
|
* and provide an alternative action if the timeout is exceeded.
|
|
7087
7087
|
*
|
|
7088
|
-
* **Example** (
|
|
7088
|
+
* **Example** (Falling back on timeout)
|
|
7089
7089
|
*
|
|
7090
7090
|
* ```ts
|
|
7091
7091
|
* import { Console, Effect } from "effect"
|
|
@@ -7126,7 +7126,7 @@ export declare const timeoutOrElse: {
|
|
|
7126
7126
|
* This function is useful when you want to set a maximum duration for an operation
|
|
7127
7127
|
* and provide an alternative action if the timeout is exceeded.
|
|
7128
7128
|
*
|
|
7129
|
-
* **Example** (
|
|
7129
|
+
* **Example** (Falling back on timeout)
|
|
7130
7130
|
*
|
|
7131
7131
|
* ```ts
|
|
7132
7132
|
* import { Console, Effect } from "effect"
|
|
@@ -7166,7 +7166,7 @@ export declare const timeoutOrElse: {
|
|
|
7166
7166
|
* Returns an effect that is delayed from this effect by the specified
|
|
7167
7167
|
* `Duration`.
|
|
7168
7168
|
*
|
|
7169
|
-
* **Example** (
|
|
7169
|
+
* **Example** (Delaying an effect)
|
|
7170
7170
|
*
|
|
7171
7171
|
* ```ts
|
|
7172
7172
|
* import { Console, Effect } from "effect"
|
|
@@ -7188,7 +7188,7 @@ export declare const delay: {
|
|
|
7188
7188
|
* Returns an effect that is delayed from this effect by the specified
|
|
7189
7189
|
* `Duration`.
|
|
7190
7190
|
*
|
|
7191
|
-
* **Example** (
|
|
7191
|
+
* **Example** (Delaying an effect)
|
|
7192
7192
|
*
|
|
7193
7193
|
* ```ts
|
|
7194
7194
|
* import { Console, Effect } from "effect"
|
|
@@ -7210,7 +7210,7 @@ export declare const delay: {
|
|
|
7210
7210
|
* Returns an effect that is delayed from this effect by the specified
|
|
7211
7211
|
* `Duration`.
|
|
7212
7212
|
*
|
|
7213
|
-
* **Example** (
|
|
7213
|
+
* **Example** (Delaying an effect)
|
|
7214
7214
|
*
|
|
7215
7215
|
* ```ts
|
|
7216
7216
|
* import { Console, Effect } from "effect"
|
|
@@ -7233,7 +7233,7 @@ export declare const delay: {
|
|
|
7233
7233
|
* Returns an effect that suspends the current fiber for the specified duration
|
|
7234
7234
|
* without blocking a JavaScript thread.
|
|
7235
7235
|
*
|
|
7236
|
-
* **Example** (
|
|
7236
|
+
* **Example** (Pausing without blocking)
|
|
7237
7237
|
*
|
|
7238
7238
|
* ```ts
|
|
7239
7239
|
* import { Console, Effect } from "effect"
|
|
@@ -7259,7 +7259,7 @@ export declare const sleep: (duration: Duration.Input) => Effect<void>;
|
|
|
7259
7259
|
* The original success, failure, or interruption is preserved; only the success
|
|
7260
7260
|
* value is paired with the duration.
|
|
7261
7261
|
*
|
|
7262
|
-
* **Example** (
|
|
7262
|
+
* **Example** (Measuring execution time)
|
|
7263
7263
|
*
|
|
7264
7264
|
* ```ts
|
|
7265
7265
|
* import { Console, Duration, Effect } from "effect"
|
|
@@ -7291,7 +7291,7 @@ export declare const timed: <A, E, R>(self: Effect<A, E, R>) => Effect<[duration
|
|
|
7291
7291
|
*
|
|
7292
7292
|
* @see {@link race} for a version that handles only two effects.
|
|
7293
7293
|
*
|
|
7294
|
-
* **Example** (
|
|
7294
|
+
* **Example** (Racing many effects)
|
|
7295
7295
|
*
|
|
7296
7296
|
* ```ts
|
|
7297
7297
|
* import { Duration, Effect } from "effect"
|
|
@@ -7327,7 +7327,7 @@ export declare const raceAll: <Eff extends Effect<any, any, any>>(all: Iterable<
|
|
|
7327
7327
|
* `raceAll` when early failures should be ignored until a success occurs or
|
|
7328
7328
|
* all effects fail.
|
|
7329
7329
|
*
|
|
7330
|
-
* **Example** (
|
|
7330
|
+
* **Example** (Taking the first settled result)
|
|
7331
7331
|
*
|
|
7332
7332
|
* ```ts
|
|
7333
7333
|
* import { Duration, Effect } from "effect"
|
|
@@ -7359,7 +7359,7 @@ export declare const raceAllFirst: <Eff extends Effect<any, any, any>>(all: Iter
|
|
|
7359
7359
|
* If one effect succeeds, the other is interrupted and `onWinner` can observe the
|
|
7360
7360
|
* winning fiber. If both fail, the race fails.
|
|
7361
7361
|
*
|
|
7362
|
-
* **Example** (
|
|
7362
|
+
* **Example** (Racing two effects)
|
|
7363
7363
|
*
|
|
7364
7364
|
* ```ts
|
|
7365
7365
|
* import { Console, Duration, Effect } from "effect"
|
|
@@ -7386,7 +7386,7 @@ export declare const race: {
|
|
|
7386
7386
|
* If one effect succeeds, the other is interrupted and `onWinner` can observe the
|
|
7387
7387
|
* winning fiber. If both fail, the race fails.
|
|
7388
7388
|
*
|
|
7389
|
-
* **Example** (
|
|
7389
|
+
* **Example** (Racing two effects)
|
|
7390
7390
|
*
|
|
7391
7391
|
* ```ts
|
|
7392
7392
|
* import { Console, Duration, Effect } from "effect"
|
|
@@ -7419,7 +7419,7 @@ export declare const race: {
|
|
|
7419
7419
|
* If one effect succeeds, the other is interrupted and `onWinner` can observe the
|
|
7420
7420
|
* winning fiber. If both fail, the race fails.
|
|
7421
7421
|
*
|
|
7422
|
-
* **Example** (
|
|
7422
|
+
* **Example** (Racing two effects)
|
|
7423
7423
|
*
|
|
7424
7424
|
* ```ts
|
|
7425
7425
|
* import { Console, Duration, Effect } from "effect"
|
|
@@ -7453,7 +7453,7 @@ export declare const race: {
|
|
|
7453
7453
|
*
|
|
7454
7454
|
* The losing effect is interrupted, and `onWinner` can observe the winning fiber.
|
|
7455
7455
|
*
|
|
7456
|
-
* **Example** (
|
|
7456
|
+
* **Example** (Observing the winning fiber)
|
|
7457
7457
|
*
|
|
7458
7458
|
* ```ts
|
|
7459
7459
|
* import { Console, Duration, Effect } from "effect"
|
|
@@ -7483,7 +7483,7 @@ export declare const raceFirst: {
|
|
|
7483
7483
|
*
|
|
7484
7484
|
* The losing effect is interrupted, and `onWinner` can observe the winning fiber.
|
|
7485
7485
|
*
|
|
7486
|
-
* **Example** (
|
|
7486
|
+
* **Example** (Observing the winning fiber)
|
|
7487
7487
|
*
|
|
7488
7488
|
* ```ts
|
|
7489
7489
|
* import { Console, Duration, Effect } from "effect"
|
|
@@ -7519,7 +7519,7 @@ export declare const raceFirst: {
|
|
|
7519
7519
|
*
|
|
7520
7520
|
* The losing effect is interrupted, and `onWinner` can observe the winning fiber.
|
|
7521
7521
|
*
|
|
7522
|
-
* **Example** (
|
|
7522
|
+
* **Example** (Observing the winning fiber)
|
|
7523
7523
|
*
|
|
7524
7524
|
* ```ts
|
|
7525
7525
|
* import { Console, Duration, Effect } from "effect"
|
|
@@ -7554,7 +7554,7 @@ export declare const raceFirst: {
|
|
|
7554
7554
|
* Filters elements of an iterable using a predicate, refinement, or effectful
|
|
7555
7555
|
* predicate.
|
|
7556
7556
|
*
|
|
7557
|
-
* **Example** (
|
|
7557
|
+
* **Example** (Filtering success values)
|
|
7558
7558
|
*
|
|
7559
7559
|
* ```ts
|
|
7560
7560
|
* import { Effect } from "effect"
|
|
@@ -7576,7 +7576,7 @@ export declare const filter: {
|
|
|
7576
7576
|
* Filters elements of an iterable using a predicate, refinement, or effectful
|
|
7577
7577
|
* predicate.
|
|
7578
7578
|
*
|
|
7579
|
-
* **Example** (
|
|
7579
|
+
* **Example** (Filtering success values)
|
|
7580
7580
|
*
|
|
7581
7581
|
* ```ts
|
|
7582
7582
|
* import { Effect } from "effect"
|
|
@@ -7598,7 +7598,7 @@ export declare const filter: {
|
|
|
7598
7598
|
* Filters elements of an iterable using a predicate, refinement, or effectful
|
|
7599
7599
|
* predicate.
|
|
7600
7600
|
*
|
|
7601
|
-
* **Example** (
|
|
7601
|
+
* **Example** (Filtering success values)
|
|
7602
7602
|
*
|
|
7603
7603
|
* ```ts
|
|
7604
7604
|
* import { Effect } from "effect"
|
|
@@ -7620,7 +7620,7 @@ export declare const filter: {
|
|
|
7620
7620
|
* Filters elements of an iterable using a predicate, refinement, or effectful
|
|
7621
7621
|
* predicate.
|
|
7622
7622
|
*
|
|
7623
|
-
* **Example** (
|
|
7623
|
+
* **Example** (Filtering success values)
|
|
7624
7624
|
*
|
|
7625
7625
|
* ```ts
|
|
7626
7626
|
* import { Effect } from "effect"
|
|
@@ -7644,7 +7644,7 @@ export declare const filter: {
|
|
|
7644
7644
|
* Filters elements of an iterable using a predicate, refinement, or effectful
|
|
7645
7645
|
* predicate.
|
|
7646
7646
|
*
|
|
7647
|
-
* **Example** (
|
|
7647
|
+
* **Example** (Filtering success values)
|
|
7648
7648
|
*
|
|
7649
7649
|
* ```ts
|
|
7650
7650
|
* import { Effect } from "effect"
|
|
@@ -7666,7 +7666,7 @@ export declare const filter: {
|
|
|
7666
7666
|
* Filters elements of an iterable using a predicate, refinement, or effectful
|
|
7667
7667
|
* predicate.
|
|
7668
7668
|
*
|
|
7669
|
-
* **Example** (
|
|
7669
|
+
* **Example** (Filtering success values)
|
|
7670
7670
|
*
|
|
7671
7671
|
* ```ts
|
|
7672
7672
|
* import { Effect } from "effect"
|
|
@@ -7688,7 +7688,7 @@ export declare const filter: {
|
|
|
7688
7688
|
* Filters elements of an iterable using a predicate, refinement, or effectful
|
|
7689
7689
|
* predicate.
|
|
7690
7690
|
*
|
|
7691
|
-
* **Example** (
|
|
7691
|
+
* **Example** (Filtering success values)
|
|
7692
7692
|
*
|
|
7693
7693
|
* ```ts
|
|
7694
7694
|
* import { Effect } from "effect"
|
|
@@ -7767,7 +7767,7 @@ export declare const filterMapEffect: {
|
|
|
7767
7767
|
* `orElse` effect can produce an alternative value or perform additional
|
|
7768
7768
|
* computations.
|
|
7769
7769
|
*
|
|
7770
|
-
* **Example** (
|
|
7770
|
+
* **Example** (Filtering with a fallback effect)
|
|
7771
7771
|
*
|
|
7772
7772
|
* ```ts
|
|
7773
7773
|
* import { Effect } from "effect"
|
|
@@ -7799,7 +7799,7 @@ export declare const filterOrElse: {
|
|
|
7799
7799
|
* `orElse` effect can produce an alternative value or perform additional
|
|
7800
7800
|
* computations.
|
|
7801
7801
|
*
|
|
7802
|
-
* **Example** (
|
|
7802
|
+
* **Example** (Filtering with a fallback effect)
|
|
7803
7803
|
*
|
|
7804
7804
|
* ```ts
|
|
7805
7805
|
* import { Effect } from "effect"
|
|
@@ -7831,7 +7831,7 @@ export declare const filterOrElse: {
|
|
|
7831
7831
|
* `orElse` effect can produce an alternative value or perform additional
|
|
7832
7832
|
* computations.
|
|
7833
7833
|
*
|
|
7834
|
-
* **Example** (
|
|
7834
|
+
* **Example** (Filtering with a fallback effect)
|
|
7835
7835
|
*
|
|
7836
7836
|
* ```ts
|
|
7837
7837
|
* import { Effect } from "effect"
|
|
@@ -7863,7 +7863,7 @@ export declare const filterOrElse: {
|
|
|
7863
7863
|
* `orElse` effect can produce an alternative value or perform additional
|
|
7864
7864
|
* computations.
|
|
7865
7865
|
*
|
|
7866
|
-
* **Example** (
|
|
7866
|
+
* **Example** (Filtering with a fallback effect)
|
|
7867
7867
|
*
|
|
7868
7868
|
* ```ts
|
|
7869
7869
|
* import { Effect } from "effect"
|
|
@@ -7895,7 +7895,7 @@ export declare const filterOrElse: {
|
|
|
7895
7895
|
* `orElse` effect can produce an alternative value or perform additional
|
|
7896
7896
|
* computations.
|
|
7897
7897
|
*
|
|
7898
|
-
* **Example** (
|
|
7898
|
+
* **Example** (Filtering with a fallback effect)
|
|
7899
7899
|
*
|
|
7900
7900
|
* ```ts
|
|
7901
7901
|
* import { Effect } from "effect"
|
|
@@ -7949,7 +7949,7 @@ export declare const filterMapOrElse: {
|
|
|
7949
7949
|
* predicate evaluates to `false`, the effect fails with either a custom
|
|
7950
7950
|
* error (if `orFailWith` is provided) or a `NoSuchElementError`.
|
|
7951
7951
|
*
|
|
7952
|
-
* **Example** (
|
|
7952
|
+
* **Example** (Filtering with a custom failure)
|
|
7953
7953
|
*
|
|
7954
7954
|
* ```ts
|
|
7955
7955
|
* import { Effect } from "effect"
|
|
@@ -7980,7 +7980,7 @@ export declare const filterOrFail: {
|
|
|
7980
7980
|
* predicate evaluates to `false`, the effect fails with either a custom
|
|
7981
7981
|
* error (if `orFailWith` is provided) or a `NoSuchElementError`.
|
|
7982
7982
|
*
|
|
7983
|
-
* **Example** (
|
|
7983
|
+
* **Example** (Filtering with a custom failure)
|
|
7984
7984
|
*
|
|
7985
7985
|
* ```ts
|
|
7986
7986
|
* import { Effect } from "effect"
|
|
@@ -8011,7 +8011,7 @@ export declare const filterOrFail: {
|
|
|
8011
8011
|
* predicate evaluates to `false`, the effect fails with either a custom
|
|
8012
8012
|
* error (if `orFailWith` is provided) or a `NoSuchElementError`.
|
|
8013
8013
|
*
|
|
8014
|
-
* **Example** (
|
|
8014
|
+
* **Example** (Filtering with a custom failure)
|
|
8015
8015
|
*
|
|
8016
8016
|
* ```ts
|
|
8017
8017
|
* import { Effect } from "effect"
|
|
@@ -8042,7 +8042,7 @@ export declare const filterOrFail: {
|
|
|
8042
8042
|
* predicate evaluates to `false`, the effect fails with either a custom
|
|
8043
8043
|
* error (if `orFailWith` is provided) or a `NoSuchElementError`.
|
|
8044
8044
|
*
|
|
8045
|
-
* **Example** (
|
|
8045
|
+
* **Example** (Filtering with a custom failure)
|
|
8046
8046
|
*
|
|
8047
8047
|
* ```ts
|
|
8048
8048
|
* import { Effect } from "effect"
|
|
@@ -8073,7 +8073,7 @@ export declare const filterOrFail: {
|
|
|
8073
8073
|
* predicate evaluates to `false`, the effect fails with either a custom
|
|
8074
8074
|
* error (if `orFailWith` is provided) or a `NoSuchElementError`.
|
|
8075
8075
|
*
|
|
8076
|
-
* **Example** (
|
|
8076
|
+
* **Example** (Filtering with a custom failure)
|
|
8077
8077
|
*
|
|
8078
8078
|
* ```ts
|
|
8079
8079
|
* import { Effect } from "effect"
|
|
@@ -8104,7 +8104,7 @@ export declare const filterOrFail: {
|
|
|
8104
8104
|
* predicate evaluates to `false`, the effect fails with either a custom
|
|
8105
8105
|
* error (if `orFailWith` is provided) or a `NoSuchElementError`.
|
|
8106
8106
|
*
|
|
8107
|
-
* **Example** (
|
|
8107
|
+
* **Example** (Filtering with a custom failure)
|
|
8108
8108
|
*
|
|
8109
8109
|
* ```ts
|
|
8110
8110
|
* import { Effect } from "effect"
|
|
@@ -8135,7 +8135,7 @@ export declare const filterOrFail: {
|
|
|
8135
8135
|
* predicate evaluates to `false`, the effect fails with either a custom
|
|
8136
8136
|
* error (if `orFailWith` is provided) or a `NoSuchElementError`.
|
|
8137
8137
|
*
|
|
8138
|
-
* **Example** (
|
|
8138
|
+
* **Example** (Filtering with a custom failure)
|
|
8139
8139
|
*
|
|
8140
8140
|
* ```ts
|
|
8141
8141
|
* import { Effect } from "effect"
|
|
@@ -8166,7 +8166,7 @@ export declare const filterOrFail: {
|
|
|
8166
8166
|
* predicate evaluates to `false`, the effect fails with either a custom
|
|
8167
8167
|
* error (if `orFailWith` is provided) or a `NoSuchElementError`.
|
|
8168
8168
|
*
|
|
8169
|
-
* **Example** (
|
|
8169
|
+
* **Example** (Filtering with a custom failure)
|
|
8170
8170
|
*
|
|
8171
8171
|
* ```ts
|
|
8172
8172
|
* import { Effect } from "effect"
|
|
@@ -8197,7 +8197,7 @@ export declare const filterOrFail: {
|
|
|
8197
8197
|
* predicate evaluates to `false`, the effect fails with either a custom
|
|
8198
8198
|
* error (if `orFailWith` is provided) or a `NoSuchElementError`.
|
|
8199
8199
|
*
|
|
8200
|
-
* **Example** (
|
|
8200
|
+
* **Example** (Filtering with a custom failure)
|
|
8201
8201
|
*
|
|
8202
8202
|
* ```ts
|
|
8203
8203
|
* import { Effect } from "effect"
|
|
@@ -8272,7 +8272,7 @@ export declare const filterMapOrFail: {
|
|
|
8272
8272
|
* Use this when an effectful check decides whether to run another effect while
|
|
8273
8273
|
* representing the skipped case explicitly.
|
|
8274
8274
|
*
|
|
8275
|
-
* **Example** (
|
|
8275
|
+
* **Example** (Conditionally running an effect)
|
|
8276
8276
|
*
|
|
8277
8277
|
* ```ts
|
|
8278
8278
|
* import { Console, Effect } from "effect"
|
|
@@ -8311,7 +8311,7 @@ export declare const when: {
|
|
|
8311
8311
|
* Use this when an effectful check decides whether to run another effect while
|
|
8312
8312
|
* representing the skipped case explicitly.
|
|
8313
8313
|
*
|
|
8314
|
-
* **Example** (
|
|
8314
|
+
* **Example** (Conditionally running an effect)
|
|
8315
8315
|
*
|
|
8316
8316
|
* ```ts
|
|
8317
8317
|
* import { Console, Effect } from "effect"
|
|
@@ -8350,7 +8350,7 @@ export declare const when: {
|
|
|
8350
8350
|
* Use this when an effectful check decides whether to run another effect while
|
|
8351
8351
|
* representing the skipped case explicitly.
|
|
8352
8352
|
*
|
|
8353
|
-
* **Example** (
|
|
8353
|
+
* **Example** (Conditionally running an effect)
|
|
8354
8354
|
*
|
|
8355
8355
|
* ```ts
|
|
8356
8356
|
* import { Console, Effect } from "effect"
|
|
@@ -8392,7 +8392,7 @@ export declare const when: {
|
|
|
8392
8392
|
*
|
|
8393
8393
|
* @see {@link matchEffect} if you need to perform side effects in the handlers.
|
|
8394
8394
|
*
|
|
8395
|
-
* **Example** (
|
|
8395
|
+
* **Example** (Matching success and failure values)
|
|
8396
8396
|
*
|
|
8397
8397
|
* ```ts
|
|
8398
8398
|
* import { Data, Effect } from "effect"
|
|
@@ -8446,7 +8446,7 @@ export declare const match: {
|
|
|
8446
8446
|
*
|
|
8447
8447
|
* @see {@link matchEffect} if you need to perform side effects in the handlers.
|
|
8448
8448
|
*
|
|
8449
|
-
* **Example** (
|
|
8449
|
+
* **Example** (Matching success and failure values)
|
|
8450
8450
|
*
|
|
8451
8451
|
* ```ts
|
|
8452
8452
|
* import { Data, Effect } from "effect"
|
|
@@ -8503,7 +8503,7 @@ export declare const match: {
|
|
|
8503
8503
|
*
|
|
8504
8504
|
* @see {@link matchEffect} if you need to perform side effects in the handlers.
|
|
8505
8505
|
*
|
|
8506
|
-
* **Example** (
|
|
8506
|
+
* **Example** (Matching success and failure values)
|
|
8507
8507
|
*
|
|
8508
8508
|
* ```ts
|
|
8509
8509
|
* import { Data, Effect } from "effect"
|
|
@@ -8560,7 +8560,7 @@ export declare const match: {
|
|
|
8560
8560
|
* optimal performance for resolved effects. This is particularly useful in
|
|
8561
8561
|
* scenarios where you frequently work with already computed values.
|
|
8562
8562
|
*
|
|
8563
|
-
* **Example** (
|
|
8563
|
+
* **Example** (Pattern matching eagerly when possible)
|
|
8564
8564
|
*
|
|
8565
8565
|
* ```ts
|
|
8566
8566
|
* import { Effect } from "effect"
|
|
@@ -8598,7 +8598,7 @@ export declare const matchEager: {
|
|
|
8598
8598
|
* optimal performance for resolved effects. This is particularly useful in
|
|
8599
8599
|
* scenarios where you frequently work with already computed values.
|
|
8600
8600
|
*
|
|
8601
|
-
* **Example** (
|
|
8601
|
+
* **Example** (Pattern matching eagerly when possible)
|
|
8602
8602
|
*
|
|
8603
8603
|
* ```ts
|
|
8604
8604
|
* import { Effect } from "effect"
|
|
@@ -8639,7 +8639,7 @@ export declare const matchEager: {
|
|
|
8639
8639
|
* optimal performance for resolved effects. This is particularly useful in
|
|
8640
8640
|
* scenarios where you frequently work with already computed values.
|
|
8641
8641
|
*
|
|
8642
|
-
* **Example** (
|
|
8642
|
+
* **Example** (Pattern matching eagerly when possible)
|
|
8643
8643
|
*
|
|
8644
8644
|
* ```ts
|
|
8645
8645
|
* import { Effect } from "effect"
|
|
@@ -8678,7 +8678,7 @@ export declare const matchEager: {
|
|
|
8678
8678
|
* regular failures, defects, or interruptions. You can provide specific
|
|
8679
8679
|
* handling logic for each failure type based on the cause.
|
|
8680
8680
|
*
|
|
8681
|
-
* **Example** (
|
|
8681
|
+
* **Example** (Matching on success or failure causes)
|
|
8682
8682
|
*
|
|
8683
8683
|
* ```ts
|
|
8684
8684
|
* import { Cause, Effect } from "effect"
|
|
@@ -8716,7 +8716,7 @@ export declare const matchCause: {
|
|
|
8716
8716
|
* regular failures, defects, or interruptions. You can provide specific
|
|
8717
8717
|
* handling logic for each failure type based on the cause.
|
|
8718
8718
|
*
|
|
8719
|
-
* **Example** (
|
|
8719
|
+
* **Example** (Matching on success or failure causes)
|
|
8720
8720
|
*
|
|
8721
8721
|
* ```ts
|
|
8722
8722
|
* import { Cause, Effect } from "effect"
|
|
@@ -8757,7 +8757,7 @@ export declare const matchCause: {
|
|
|
8757
8757
|
* regular failures, defects, or interruptions. You can provide specific
|
|
8758
8758
|
* handling logic for each failure type based on the cause.
|
|
8759
8759
|
*
|
|
8760
|
-
* **Example** (
|
|
8760
|
+
* **Example** (Matching on success or failure causes)
|
|
8761
8761
|
*
|
|
8762
8762
|
* ```ts
|
|
8763
8763
|
* import { Cause, Effect } from "effect"
|
|
@@ -8800,7 +8800,7 @@ export declare const matchCause: {
|
|
|
8800
8800
|
* and you want to avoid the overhead of the effect pipeline. For pending effects,
|
|
8801
8801
|
* it automatically falls back to the regular `matchCause` behavior.
|
|
8802
8802
|
*
|
|
8803
|
-
* **Example** (
|
|
8803
|
+
* **Example** (Eagerly matching already completed effects)
|
|
8804
8804
|
*
|
|
8805
8805
|
* ```ts
|
|
8806
8806
|
* import { Effect } from "effect"
|
|
@@ -8830,7 +8830,7 @@ export declare const matchCauseEager: {
|
|
|
8830
8830
|
* and you want to avoid the overhead of the effect pipeline. For pending effects,
|
|
8831
8831
|
* it automatically falls back to the regular `matchCause` behavior.
|
|
8832
8832
|
*
|
|
8833
|
-
* **Example** (
|
|
8833
|
+
* **Example** (Eagerly matching already completed effects)
|
|
8834
8834
|
*
|
|
8835
8835
|
* ```ts
|
|
8836
8836
|
* import { Effect } from "effect"
|
|
@@ -8863,7 +8863,7 @@ export declare const matchCauseEager: {
|
|
|
8863
8863
|
* and you want to avoid the overhead of the effect pipeline. For pending effects,
|
|
8864
8864
|
* it automatically falls back to the regular `matchCause` behavior.
|
|
8865
8865
|
*
|
|
8866
|
-
* **Example** (
|
|
8866
|
+
* **Example** (Eagerly matching already completed effects)
|
|
8867
8867
|
*
|
|
8868
8868
|
* ```ts
|
|
8869
8869
|
* import { Effect } from "effect"
|
|
@@ -8931,7 +8931,7 @@ export declare const matchCauseEffectEager: {
|
|
|
8931
8931
|
* you to respond accordingly while performing side effects (like logging or
|
|
8932
8932
|
* other operations).
|
|
8933
8933
|
*
|
|
8934
|
-
* **Example** (
|
|
8934
|
+
* **Example** (Effectfully matching on causes)
|
|
8935
8935
|
*
|
|
8936
8936
|
* ```ts
|
|
8937
8937
|
* import { Cause, Console, Data, Effect, Result } from "effect"
|
|
@@ -8986,7 +8986,7 @@ export declare const matchCauseEffect: {
|
|
|
8986
8986
|
* you to respond accordingly while performing side effects (like logging or
|
|
8987
8987
|
* other operations).
|
|
8988
8988
|
*
|
|
8989
|
-
* **Example** (
|
|
8989
|
+
* **Example** (Effectfully matching on causes)
|
|
8990
8990
|
*
|
|
8991
8991
|
* ```ts
|
|
8992
8992
|
* import { Cause, Console, Data, Effect, Result } from "effect"
|
|
@@ -9044,7 +9044,7 @@ export declare const matchCauseEffect: {
|
|
|
9044
9044
|
* you to respond accordingly while performing side effects (like logging or
|
|
9045
9045
|
* other operations).
|
|
9046
9046
|
*
|
|
9047
|
-
* **Example** (
|
|
9047
|
+
* **Example** (Effectfully matching on causes)
|
|
9048
9048
|
*
|
|
9049
9049
|
* ```ts
|
|
9050
9050
|
* import { Cause, Console, Data, Effect, Result } from "effect"
|
|
@@ -9107,7 +9107,7 @@ export declare const matchCauseEffect: {
|
|
|
9107
9107
|
* @see {@link match} if you don't need side effects and only want to handle the
|
|
9108
9108
|
* result or failure.
|
|
9109
9109
|
*
|
|
9110
|
-
* **Example** (
|
|
9110
|
+
* **Example** (Matching success and failure with effectful handlers)
|
|
9111
9111
|
*
|
|
9112
9112
|
* ```ts
|
|
9113
9113
|
* import { Data, Effect } from "effect"
|
|
@@ -9168,7 +9168,7 @@ export declare const matchEffect: {
|
|
|
9168
9168
|
* @see {@link match} if you don't need side effects and only want to handle the
|
|
9169
9169
|
* result or failure.
|
|
9170
9170
|
*
|
|
9171
|
-
* **Example** (
|
|
9171
|
+
* **Example** (Matching success and failure with effectful handlers)
|
|
9172
9172
|
*
|
|
9173
9173
|
* ```ts
|
|
9174
9174
|
* import { Data, Effect } from "effect"
|
|
@@ -9232,7 +9232,7 @@ export declare const matchEffect: {
|
|
|
9232
9232
|
* @see {@link match} if you don't need side effects and only want to handle the
|
|
9233
9233
|
* result or failure.
|
|
9234
9234
|
*
|
|
9235
|
-
* **Example** (
|
|
9235
|
+
* **Example** (Matching success and failure with effectful handlers)
|
|
9236
9236
|
*
|
|
9237
9237
|
* ```ts
|
|
9238
9238
|
* import { Data, Effect } from "effect"
|
|
@@ -9339,7 +9339,7 @@ export declare const isSuccess: <A, E, R>(self: Effect<A, E, R>) => Effect<boole
|
|
|
9339
9339
|
* in the effect's environment. This can be useful for debugging, introspection,
|
|
9340
9340
|
* or when you need to pass the entire context to another function.
|
|
9341
9341
|
*
|
|
9342
|
-
* **Example** (
|
|
9342
|
+
* **Example** (Reading the full context)
|
|
9343
9343
|
*
|
|
9344
9344
|
* ```ts
|
|
9345
9345
|
* import { Console, Context, Effect, Option } from "effect"
|
|
@@ -9379,7 +9379,7 @@ export declare const context: <R = never>() => Effect<Context.Context<R>, never,
|
|
|
9379
9379
|
* computations based on all available services. This is useful when you need
|
|
9380
9380
|
* to conditionally execute logic based on what services are available.
|
|
9381
9381
|
*
|
|
9382
|
-
* **Example** (
|
|
9382
|
+
* **Example** (Deriving values from the context)
|
|
9383
9383
|
*
|
|
9384
9384
|
* ```ts
|
|
9385
9385
|
* import { Console, Context, Effect, Option } from "effect"
|
|
@@ -9423,7 +9423,7 @@ export declare const contextWith: <R, A, E, R2>(f: (context: Context.Context<R>)
|
|
|
9423
9423
|
* to build the layer every time; by default, layers are shared between provide
|
|
9424
9424
|
* calls.
|
|
9425
9425
|
*
|
|
9426
|
-
* **Example** (
|
|
9426
|
+
* **Example** (Providing dependencies with a layer)
|
|
9427
9427
|
*
|
|
9428
9428
|
* ```ts
|
|
9429
9429
|
* import { Context, Effect, Layer } from "effect"
|
|
@@ -9458,7 +9458,7 @@ export declare const provide: {
|
|
|
9458
9458
|
* to build the layer every time; by default, layers are shared between provide
|
|
9459
9459
|
* calls.
|
|
9460
9460
|
*
|
|
9461
|
-
* **Example** (
|
|
9461
|
+
* **Example** (Providing dependencies with a layer)
|
|
9462
9462
|
*
|
|
9463
9463
|
* ```ts
|
|
9464
9464
|
* import { Context, Effect, Layer } from "effect"
|
|
@@ -9495,7 +9495,7 @@ export declare const provide: {
|
|
|
9495
9495
|
* to build the layer every time; by default, layers are shared between provide
|
|
9496
9496
|
* calls.
|
|
9497
9497
|
*
|
|
9498
|
-
* **Example** (
|
|
9498
|
+
* **Example** (Providing dependencies with a layer)
|
|
9499
9499
|
*
|
|
9500
9500
|
* ```ts
|
|
9501
9501
|
* import { Context, Effect, Layer } from "effect"
|
|
@@ -9532,7 +9532,7 @@ export declare const provide: {
|
|
|
9532
9532
|
* to build the layer every time; by default, layers are shared between provide
|
|
9533
9533
|
* calls.
|
|
9534
9534
|
*
|
|
9535
|
-
* **Example** (
|
|
9535
|
+
* **Example** (Providing dependencies with a layer)
|
|
9536
9536
|
*
|
|
9537
9537
|
* ```ts
|
|
9538
9538
|
* import { Context, Effect, Layer } from "effect"
|
|
@@ -9567,7 +9567,7 @@ export declare const provide: {
|
|
|
9567
9567
|
* to build the layer every time; by default, layers are shared between provide
|
|
9568
9568
|
* calls.
|
|
9569
9569
|
*
|
|
9570
|
-
* **Example** (
|
|
9570
|
+
* **Example** (Providing dependencies with a layer)
|
|
9571
9571
|
*
|
|
9572
9572
|
* ```ts
|
|
9573
9573
|
* import { Context, Effect, Layer } from "effect"
|
|
@@ -9604,7 +9604,7 @@ export declare const provide: {
|
|
|
9604
9604
|
* to build the layer every time; by default, layers are shared between provide
|
|
9605
9605
|
* calls.
|
|
9606
9606
|
*
|
|
9607
|
-
* **Example** (
|
|
9607
|
+
* **Example** (Providing dependencies with a layer)
|
|
9608
9608
|
*
|
|
9609
9609
|
* ```ts
|
|
9610
9610
|
* import { Context, Effect, Layer } from "effect"
|
|
@@ -9641,7 +9641,7 @@ export declare const provide: {
|
|
|
9641
9641
|
* to build the layer every time; by default, layers are shared between provide
|
|
9642
9642
|
* calls.
|
|
9643
9643
|
*
|
|
9644
|
-
* **Example** (
|
|
9644
|
+
* **Example** (Providing dependencies with a layer)
|
|
9645
9645
|
*
|
|
9646
9646
|
* ```ts
|
|
9647
9647
|
* import { Context, Effect, Layer } from "effect"
|
|
@@ -9681,7 +9681,7 @@ export declare const provide: {
|
|
|
9681
9681
|
* that contains all the required services. It removes the provided services
|
|
9682
9682
|
* from the effect's requirements, making them available to the effect.
|
|
9683
9683
|
*
|
|
9684
|
-
* **Example** (
|
|
9684
|
+
* **Example** (Providing a complete context)
|
|
9685
9685
|
*
|
|
9686
9686
|
* ```ts
|
|
9687
9687
|
* import { Context, Effect } from "effect"
|
|
@@ -9722,7 +9722,7 @@ export declare const provideContext: {
|
|
|
9722
9722
|
* that contains all the required services. It removes the provided services
|
|
9723
9723
|
* from the effect's requirements, making them available to the effect.
|
|
9724
9724
|
*
|
|
9725
|
-
* **Example** (
|
|
9725
|
+
* **Example** (Providing a complete context)
|
|
9726
9726
|
*
|
|
9727
9727
|
* ```ts
|
|
9728
9728
|
* import { Context, Effect } from "effect"
|
|
@@ -9763,7 +9763,7 @@ export declare const provideContext: {
|
|
|
9763
9763
|
* that contains all the required services. It removes the provided services
|
|
9764
9764
|
* from the effect's requirements, making them available to the effect.
|
|
9765
9765
|
*
|
|
9766
|
-
* **Example** (
|
|
9766
|
+
* **Example** (Providing a complete context)
|
|
9767
9767
|
*
|
|
9768
9768
|
* ```ts
|
|
9769
9769
|
* import { Context, Effect } from "effect"
|
|
@@ -9799,7 +9799,7 @@ export declare const provideContext: {
|
|
|
9799
9799
|
/**
|
|
9800
9800
|
* Accesses a service from the context.
|
|
9801
9801
|
*
|
|
9802
|
-
* **Example** (
|
|
9802
|
+
* **Example** (Accessing a required service)
|
|
9803
9803
|
*
|
|
9804
9804
|
* ```ts
|
|
9805
9805
|
* import { Context, Effect } from "effect"
|
|
@@ -9830,7 +9830,7 @@ export declare const service: <I, S>(service: Context.Key<I, S>) => Effect<S, ne
|
|
|
9830
9830
|
* available, it returns `None`. Unlike `service`, this function does not
|
|
9831
9831
|
* require the service to be present in the environment.
|
|
9832
9832
|
*
|
|
9833
|
-
* **Example** (
|
|
9833
|
+
* **Example** (Accessing an optional service)
|
|
9834
9834
|
*
|
|
9835
9835
|
* ```ts
|
|
9836
9836
|
* import { Context, Effect, Option } from "effect"
|
|
@@ -9864,7 +9864,7 @@ export declare const serviceOption: <I, S>(key: Context.Key<I, S>) => Effect<Opt
|
|
|
9864
9864
|
* This function allows you to transform the context required by an effect,
|
|
9865
9865
|
* providing part of the context and leaving the rest to be fulfilled later.
|
|
9866
9866
|
*
|
|
9867
|
-
* **Example** (
|
|
9867
|
+
* **Example** (Updating the context before running)
|
|
9868
9868
|
*
|
|
9869
9869
|
* ```ts
|
|
9870
9870
|
* import { Context, Effect } from "effect"
|
|
@@ -9906,7 +9906,7 @@ export declare const updateContext: {
|
|
|
9906
9906
|
* This function allows you to transform the context required by an effect,
|
|
9907
9907
|
* providing part of the context and leaving the rest to be fulfilled later.
|
|
9908
9908
|
*
|
|
9909
|
-
* **Example** (
|
|
9909
|
+
* **Example** (Updating the context before running)
|
|
9910
9910
|
*
|
|
9911
9911
|
* ```ts
|
|
9912
9912
|
* import { Context, Effect } from "effect"
|
|
@@ -9948,7 +9948,7 @@ export declare const updateContext: {
|
|
|
9948
9948
|
* This function allows you to transform the context required by an effect,
|
|
9949
9949
|
* providing part of the context and leaving the rest to be fulfilled later.
|
|
9950
9950
|
*
|
|
9951
|
-
* **Example** (
|
|
9951
|
+
* **Example** (Updating the context before running)
|
|
9952
9952
|
*
|
|
9953
9953
|
* ```ts
|
|
9954
9954
|
* import { Context, Effect } from "effect"
|
|
@@ -9990,7 +9990,7 @@ export declare const updateContext: {
|
|
|
9990
9990
|
* The service must be available in the effect's context; `updateService`
|
|
9991
9991
|
* replaces it for the wrapped effect with the value returned by the updater.
|
|
9992
9992
|
*
|
|
9993
|
-
* **Example** (
|
|
9993
|
+
* **Example** (Replacing a service for one effect)
|
|
9994
9994
|
*
|
|
9995
9995
|
* ```ts
|
|
9996
9996
|
* import { Console, Context, Effect } from "effect"
|
|
@@ -10024,7 +10024,7 @@ export declare const updateService: {
|
|
|
10024
10024
|
* The service must be available in the effect's context; `updateService`
|
|
10025
10025
|
* replaces it for the wrapped effect with the value returned by the updater.
|
|
10026
10026
|
*
|
|
10027
|
-
* **Example** (
|
|
10027
|
+
* **Example** (Replacing a service for one effect)
|
|
10028
10028
|
*
|
|
10029
10029
|
* ```ts
|
|
10030
10030
|
* import { Console, Context, Effect } from "effect"
|
|
@@ -10058,7 +10058,7 @@ export declare const updateService: {
|
|
|
10058
10058
|
* The service must be available in the effect's context; `updateService`
|
|
10059
10059
|
* replaces it for the wrapped effect with the value returned by the updater.
|
|
10060
10060
|
*
|
|
10061
|
-
* **Example** (
|
|
10061
|
+
* **Example** (Replacing a service for one effect)
|
|
10062
10062
|
*
|
|
10063
10063
|
* ```ts
|
|
10064
10064
|
* import { Console, Context, Effect } from "effect"
|
|
@@ -10098,7 +10098,7 @@ export declare const updateService: {
|
|
|
10098
10098
|
*
|
|
10099
10099
|
* @see {@link provide} for providing multiple layers to an effect.
|
|
10100
10100
|
*
|
|
10101
|
-
* **Example** (
|
|
10101
|
+
* **Example** (Providing a service value)
|
|
10102
10102
|
*
|
|
10103
10103
|
* ```ts
|
|
10104
10104
|
* import { Console, Context, Effect } from "effect"
|
|
@@ -10145,7 +10145,7 @@ export declare const provideService: {
|
|
|
10145
10145
|
*
|
|
10146
10146
|
* @see {@link provide} for providing multiple layers to an effect.
|
|
10147
10147
|
*
|
|
10148
|
-
* **Example** (
|
|
10148
|
+
* **Example** (Providing a service value)
|
|
10149
10149
|
*
|
|
10150
10150
|
* ```ts
|
|
10151
10151
|
* import { Console, Context, Effect } from "effect"
|
|
@@ -10192,7 +10192,7 @@ export declare const provideService: {
|
|
|
10192
10192
|
*
|
|
10193
10193
|
* @see {@link provide} for providing multiple layers to an effect.
|
|
10194
10194
|
*
|
|
10195
|
-
* **Example** (
|
|
10195
|
+
* **Example** (Providing a service value)
|
|
10196
10196
|
*
|
|
10197
10197
|
* ```ts
|
|
10198
10198
|
* import { Console, Context, Effect } from "effect"
|
|
@@ -10239,7 +10239,7 @@ export declare const provideService: {
|
|
|
10239
10239
|
*
|
|
10240
10240
|
* @see {@link provide} for providing multiple layers to an effect.
|
|
10241
10241
|
*
|
|
10242
|
-
* **Example** (
|
|
10242
|
+
* **Example** (Providing a service value)
|
|
10243
10243
|
*
|
|
10244
10244
|
* ```ts
|
|
10245
10245
|
* import { Console, Context, Effect } from "effect"
|
|
@@ -10287,7 +10287,7 @@ export declare const provideService: {
|
|
|
10287
10287
|
*
|
|
10288
10288
|
* @see {@link provide} for providing multiple layers to an effect.
|
|
10289
10289
|
*
|
|
10290
|
-
* **Example** (
|
|
10290
|
+
* **Example** (Providing a service value)
|
|
10291
10291
|
*
|
|
10292
10292
|
* ```ts
|
|
10293
10293
|
* import { Console, Context, Effect } from "effect"
|
|
@@ -10334,7 +10334,7 @@ export declare const provideService: {
|
|
|
10334
10334
|
*
|
|
10335
10335
|
* @see {@link provide} for providing multiple layers to an effect.
|
|
10336
10336
|
*
|
|
10337
|
-
* **Example** (
|
|
10337
|
+
* **Example** (Providing a service value)
|
|
10338
10338
|
*
|
|
10339
10339
|
* ```ts
|
|
10340
10340
|
* import { Console, Context, Effect } from "effect"
|
|
@@ -10380,7 +10380,7 @@ export declare const provideService: {
|
|
|
10380
10380
|
* and leaves any other requirements to be provided later. Acquisition failures
|
|
10381
10381
|
* are included in the returned effect's error channel.
|
|
10382
10382
|
*
|
|
10383
|
-
* **Example** (
|
|
10383
|
+
* **Example** (Providing a service with an effect)
|
|
10384
10384
|
*
|
|
10385
10385
|
* ```ts
|
|
10386
10386
|
* import { Console, Context, Effect } from "effect"
|
|
@@ -10434,7 +10434,7 @@ export declare const provideServiceEffect: {
|
|
|
10434
10434
|
* and leaves any other requirements to be provided later. Acquisition failures
|
|
10435
10435
|
* are included in the returned effect's error channel.
|
|
10436
10436
|
*
|
|
10437
|
-
* **Example** (
|
|
10437
|
+
* **Example** (Providing a service with an effect)
|
|
10438
10438
|
*
|
|
10439
10439
|
* ```ts
|
|
10440
10440
|
* import { Console, Context, Effect } from "effect"
|
|
@@ -10488,7 +10488,7 @@ export declare const provideServiceEffect: {
|
|
|
10488
10488
|
* and leaves any other requirements to be provided later. Acquisition failures
|
|
10489
10489
|
* are included in the returned effect's error channel.
|
|
10490
10490
|
*
|
|
10491
|
-
* **Example** (
|
|
10491
|
+
* **Example** (Providing a service with an effect)
|
|
10492
10492
|
*
|
|
10493
10493
|
* ```ts
|
|
10494
10494
|
* import { Console, Context, Effect } from "effect"
|
|
@@ -10536,7 +10536,7 @@ export declare const provideServiceEffect: {
|
|
|
10536
10536
|
/**
|
|
10537
10537
|
* Sets the concurrency level for parallel operations within an effect.
|
|
10538
10538
|
*
|
|
10539
|
-
* **Example** (
|
|
10539
|
+
* **Example** (Setting local concurrency)
|
|
10540
10540
|
*
|
|
10541
10541
|
* ```ts
|
|
10542
10542
|
* import { Console, Effect } from "effect"
|
|
@@ -10569,7 +10569,7 @@ export declare const withConcurrency: {
|
|
|
10569
10569
|
/**
|
|
10570
10570
|
* Sets the concurrency level for parallel operations within an effect.
|
|
10571
10571
|
*
|
|
10572
|
-
* **Example** (
|
|
10572
|
+
* **Example** (Setting local concurrency)
|
|
10573
10573
|
*
|
|
10574
10574
|
* ```ts
|
|
10575
10575
|
* import { Console, Effect } from "effect"
|
|
@@ -10602,7 +10602,7 @@ export declare const withConcurrency: {
|
|
|
10602
10602
|
/**
|
|
10603
10603
|
* Sets the concurrency level for parallel operations within an effect.
|
|
10604
10604
|
*
|
|
10605
|
-
* **Example** (
|
|
10605
|
+
* **Example** (Setting local concurrency)
|
|
10606
10606
|
*
|
|
10607
10607
|
* ```ts
|
|
10608
10608
|
* import { Console, Effect } from "effect"
|
|
@@ -10636,7 +10636,7 @@ export declare const withConcurrency: {
|
|
|
10636
10636
|
/**
|
|
10637
10637
|
* Returns the current scope for resource management.
|
|
10638
10638
|
*
|
|
10639
|
-
* **Example** (
|
|
10639
|
+
* **Example** (Accessing the current scope)
|
|
10640
10640
|
*
|
|
10641
10641
|
* ```ts
|
|
10642
10642
|
* import { Console, Effect } from "effect"
|
|
@@ -10671,7 +10671,7 @@ export declare const scope: Effect<Scope, never, Scope>;
|
|
|
10671
10671
|
* ensuring that their finalizers are run as soon as this workflow completes
|
|
10672
10672
|
* execution, whether by success, failure, or interruption.
|
|
10673
10673
|
*
|
|
10674
|
-
* **Example** (
|
|
10674
|
+
* **Example** (Running a scoped acquisition)
|
|
10675
10675
|
*
|
|
10676
10676
|
* ```ts
|
|
10677
10677
|
* import { Console, Effect } from "effect"
|
|
@@ -10702,7 +10702,7 @@ export declare const scoped: <A, E, R>(self: Effect<A, E, R>) => Effect<A, E, Ex
|
|
|
10702
10702
|
/**
|
|
10703
10703
|
* Creates a scoped effect by providing access to the scope.
|
|
10704
10704
|
*
|
|
10705
|
-
* **Example** (
|
|
10705
|
+
* **Example** (Working with an explicit scope)
|
|
10706
10706
|
*
|
|
10707
10707
|
* ```ts
|
|
10708
10708
|
* import { Console, Effect, Scope } from "effect"
|
|
@@ -10752,7 +10752,7 @@ export declare const scopedWith: <A, E, R>(f: (scope: Scope) => Effect<A, E, R>)
|
|
|
10752
10752
|
* By default, acquisition is protected by an uninterruptible region. Pass
|
|
10753
10753
|
* `{ interruptible: true }` to allow the acquisition effect to be interrupted.
|
|
10754
10754
|
*
|
|
10755
|
-
* **Example** (
|
|
10755
|
+
* **Example** (Acquiring and releasing a resource)
|
|
10756
10756
|
*
|
|
10757
10757
|
* ```ts
|
|
10758
10758
|
* import { Console, Effect, Exit } from "effect"
|
|
@@ -10811,7 +10811,7 @@ export declare const acquireRelease: <A, E, R, R2>(acquire: Effect<A, E, R>, rel
|
|
|
10811
10811
|
*
|
|
10812
10812
|
* @see [JavaScript `using` declarations](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/using)
|
|
10813
10813
|
*
|
|
10814
|
-
* **Example** (
|
|
10814
|
+
* **Example** (Acquiring a disposable resource)
|
|
10815
10815
|
*
|
|
10816
10816
|
* ```ts
|
|
10817
10817
|
* import sqlite from "node:sqlite";
|
|
@@ -10858,7 +10858,7 @@ export declare const acquireDisposable: <A extends AsyncDisposable | Disposable,
|
|
|
10858
10858
|
* is not desired, errors produced by the `release` `Effect` value can be caught
|
|
10859
10859
|
* and ignored.
|
|
10860
10860
|
*
|
|
10861
|
-
* **Example** (
|
|
10861
|
+
* **Example** (Using a resource with cleanup)
|
|
10862
10862
|
*
|
|
10863
10863
|
* ```ts
|
|
10864
10864
|
* import { Console, Effect, Exit } from "effect"
|
|
@@ -10917,7 +10917,7 @@ export declare const acquireUseRelease: <Resource, E, R, A, E2, R2, E3, R3>(acqu
|
|
|
10917
10917
|
* whether the effect succeeds or fails. They're commonly used for resource
|
|
10918
10918
|
* cleanup, logging, or other side effects that should always occur.
|
|
10919
10919
|
*
|
|
10920
|
-
* **Example** (
|
|
10920
|
+
* **Example** (Registering scope finalizers)
|
|
10921
10921
|
*
|
|
10922
10922
|
* ```ts
|
|
10923
10923
|
* import { Console, Effect, Exit } from "effect"
|
|
@@ -10962,7 +10962,7 @@ export declare const addFinalizer: <R>(finalizer: (exit: Exit.Exit<unknown, unkn
|
|
|
10962
10962
|
* should generally not be used for releasing resources. For higher-level
|
|
10963
10963
|
* logic built on `ensuring`, see the `acquireRelease` family of methods.
|
|
10964
10964
|
*
|
|
10965
|
-
* **Example** (
|
|
10965
|
+
* **Example** (Always running cleanup)
|
|
10966
10966
|
*
|
|
10967
10967
|
* ```ts
|
|
10968
10968
|
* import { Console, Effect } from "effect"
|
|
@@ -11003,7 +11003,7 @@ export declare const ensuring: {
|
|
|
11003
11003
|
* should generally not be used for releasing resources. For higher-level
|
|
11004
11004
|
* logic built on `ensuring`, see the `acquireRelease` family of methods.
|
|
11005
11005
|
*
|
|
11006
|
-
* **Example** (
|
|
11006
|
+
* **Example** (Always running cleanup)
|
|
11007
11007
|
*
|
|
11008
11008
|
* ```ts
|
|
11009
11009
|
* import { Console, Effect } from "effect"
|
|
@@ -11044,7 +11044,7 @@ export declare const ensuring: {
|
|
|
11044
11044
|
* should generally not be used for releasing resources. For higher-level
|
|
11045
11045
|
* logic built on `ensuring`, see the `acquireRelease` family of methods.
|
|
11046
11046
|
*
|
|
11047
|
-
* **Example** (
|
|
11047
|
+
* **Example** (Always running cleanup)
|
|
11048
11048
|
*
|
|
11049
11049
|
* ```ts
|
|
11050
11050
|
* import { Console, Effect } from "effect"
|
|
@@ -11079,7 +11079,7 @@ export declare const ensuring: {
|
|
|
11079
11079
|
* Runs the specified effect if this effect fails, providing the error to the
|
|
11080
11080
|
* effect if it exists. The provided effect will not be interrupted.
|
|
11081
11081
|
*
|
|
11082
|
-
* **Example** (
|
|
11082
|
+
* **Example** (Running cleanup on failure)
|
|
11083
11083
|
*
|
|
11084
11084
|
* ```ts
|
|
11085
11085
|
* import { Cause, Console, Data, Effect } from "effect"
|
|
@@ -11107,7 +11107,7 @@ export declare const onError: {
|
|
|
11107
11107
|
* Runs the specified effect if this effect fails, providing the error to the
|
|
11108
11108
|
* effect if it exists. The provided effect will not be interrupted.
|
|
11109
11109
|
*
|
|
11110
|
-
* **Example** (
|
|
11110
|
+
* **Example** (Running cleanup on failure)
|
|
11111
11111
|
*
|
|
11112
11112
|
* ```ts
|
|
11113
11113
|
* import { Cause, Console, Data, Effect } from "effect"
|
|
@@ -11135,7 +11135,7 @@ export declare const onError: {
|
|
|
11135
11135
|
* Runs the specified effect if this effect fails, providing the error to the
|
|
11136
11136
|
* effect if it exists. The provided effect will not be interrupted.
|
|
11137
11137
|
*
|
|
11138
|
-
* **Example** (
|
|
11138
|
+
* **Example** (Running cleanup on failure)
|
|
11139
11139
|
*
|
|
11140
11140
|
* ```ts
|
|
11141
11141
|
* import { Cause, Console, Data, Effect } from "effect"
|
|
@@ -11164,7 +11164,7 @@ export declare const onError: {
|
|
|
11164
11164
|
* Runs the finalizer only when this effect fails and the `Cause` matches the
|
|
11165
11165
|
* provided predicate.
|
|
11166
11166
|
*
|
|
11167
|
-
* **Example** (
|
|
11167
|
+
* **Example** (Running cleanup for selected failures)
|
|
11168
11168
|
*
|
|
11169
11169
|
* ```ts
|
|
11170
11170
|
* import { Cause, Console, Effect } from "effect"
|
|
@@ -11189,7 +11189,7 @@ export declare const onErrorIf: {
|
|
|
11189
11189
|
* Runs the finalizer only when this effect fails and the `Cause` matches the
|
|
11190
11190
|
* provided predicate.
|
|
11191
11191
|
*
|
|
11192
|
-
* **Example** (
|
|
11192
|
+
* **Example** (Running cleanup for selected failures)
|
|
11193
11193
|
*
|
|
11194
11194
|
* ```ts
|
|
11195
11195
|
* import { Cause, Console, Effect } from "effect"
|
|
@@ -11214,7 +11214,7 @@ export declare const onErrorIf: {
|
|
|
11214
11214
|
* Runs the finalizer only when this effect fails and the `Cause` matches the
|
|
11215
11215
|
* provided predicate.
|
|
11216
11216
|
*
|
|
11217
|
-
* **Example** (
|
|
11217
|
+
* **Example** (Running cleanup for selected failures)
|
|
11218
11218
|
*
|
|
11219
11219
|
* ```ts
|
|
11220
11220
|
* import { Cause, Console, Effect } from "effect"
|
|
@@ -11275,7 +11275,7 @@ export declare const onExitPrimitive: <A, E, R, XE = never, XR = never>(self: Ef
|
|
|
11275
11275
|
* Ensures that a cleanup functions runs, whether this effect succeeds, fails,
|
|
11276
11276
|
* or is interrupted.
|
|
11277
11277
|
*
|
|
11278
|
-
* **Example** (
|
|
11278
|
+
* **Example** (Observing every exit)
|
|
11279
11279
|
*
|
|
11280
11280
|
* ```ts
|
|
11281
11281
|
* import { Console, Effect, Exit } from "effect"
|
|
@@ -11303,7 +11303,7 @@ export declare const onExit: {
|
|
|
11303
11303
|
* Ensures that a cleanup functions runs, whether this effect succeeds, fails,
|
|
11304
11304
|
* or is interrupted.
|
|
11305
11305
|
*
|
|
11306
|
-
* **Example** (
|
|
11306
|
+
* **Example** (Observing every exit)
|
|
11307
11307
|
*
|
|
11308
11308
|
* ```ts
|
|
11309
11309
|
* import { Console, Effect, Exit } from "effect"
|
|
@@ -11331,7 +11331,7 @@ export declare const onExit: {
|
|
|
11331
11331
|
* Ensures that a cleanup functions runs, whether this effect succeeds, fails,
|
|
11332
11332
|
* or is interrupted.
|
|
11333
11333
|
*
|
|
11334
|
-
* **Example** (
|
|
11334
|
+
* **Example** (Observing every exit)
|
|
11335
11335
|
*
|
|
11336
11336
|
* ```ts
|
|
11337
11337
|
* import { Console, Effect, Exit } from "effect"
|
|
@@ -11360,7 +11360,7 @@ export declare const onExit: {
|
|
|
11360
11360
|
* Runs the cleanup effect only when the `Exit` satisfies the provided
|
|
11361
11361
|
* predicate.
|
|
11362
11362
|
*
|
|
11363
|
-
* **Example** (
|
|
11363
|
+
* **Example** (Observing selected exits)
|
|
11364
11364
|
*
|
|
11365
11365
|
* ```ts
|
|
11366
11366
|
* import { Console, Effect, Exit } from "effect"
|
|
@@ -11383,7 +11383,7 @@ export declare const onExitIf: {
|
|
|
11383
11383
|
* Runs the cleanup effect only when the `Exit` satisfies the provided
|
|
11384
11384
|
* predicate.
|
|
11385
11385
|
*
|
|
11386
|
-
* **Example** (
|
|
11386
|
+
* **Example** (Observing selected exits)
|
|
11387
11387
|
*
|
|
11388
11388
|
* ```ts
|
|
11389
11389
|
* import { Console, Effect, Exit } from "effect"
|
|
@@ -11406,7 +11406,7 @@ export declare const onExitIf: {
|
|
|
11406
11406
|
* Runs the cleanup effect only when the `Exit` satisfies the provided
|
|
11407
11407
|
* predicate.
|
|
11408
11408
|
*
|
|
11409
|
-
* **Example** (
|
|
11409
|
+
* **Example** (Observing selected exits)
|
|
11410
11410
|
*
|
|
11411
11411
|
* ```ts
|
|
11412
11412
|
* import { Console, Effect, Exit } from "effect"
|
|
@@ -11471,7 +11471,7 @@ export declare const onExitFilter: {
|
|
|
11471
11471
|
* @see {@link cachedInvalidateWithTTL} for a similar function that includes an
|
|
11472
11472
|
* additional effect for manually invalidating the cached value.
|
|
11473
11473
|
*
|
|
11474
|
-
* **Example** (
|
|
11474
|
+
* **Example** (Memoizing an effect until invalidated)
|
|
11475
11475
|
*
|
|
11476
11476
|
* ```ts
|
|
11477
11477
|
* import { Console, Effect } from "effect"
|
|
@@ -11545,7 +11545,7 @@ export declare const cached: <A, E, R>(self: Effect<A, E, R>) => Effect<Effect<A
|
|
|
11545
11545
|
* @see {@link cachedInvalidateWithTTL} for a similar function that includes an
|
|
11546
11546
|
* additional effect for manually invalidating the cached value.
|
|
11547
11547
|
*
|
|
11548
|
-
* **Example** (
|
|
11548
|
+
* **Example** (Memoizing an effect with TTL)
|
|
11549
11549
|
*
|
|
11550
11550
|
* ```ts
|
|
11551
11551
|
* import { Console, Effect } from "effect"
|
|
@@ -11613,7 +11613,7 @@ export declare const cachedWithTTL: {
|
|
|
11613
11613
|
* @see {@link cachedInvalidateWithTTL} for a similar function that includes an
|
|
11614
11614
|
* additional effect for manually invalidating the cached value.
|
|
11615
11615
|
*
|
|
11616
|
-
* **Example** (
|
|
11616
|
+
* **Example** (Memoizing an effect with TTL)
|
|
11617
11617
|
*
|
|
11618
11618
|
* ```ts
|
|
11619
11619
|
* import { Console, Effect } from "effect"
|
|
@@ -11681,7 +11681,7 @@ export declare const cachedWithTTL: {
|
|
|
11681
11681
|
* @see {@link cachedInvalidateWithTTL} for a similar function that includes an
|
|
11682
11682
|
* additional effect for manually invalidating the cached value.
|
|
11683
11683
|
*
|
|
11684
|
-
* **Example** (
|
|
11684
|
+
* **Example** (Memoizing an effect with TTL)
|
|
11685
11685
|
*
|
|
11686
11686
|
* ```ts
|
|
11687
11687
|
* import { Console, Effect } from "effect"
|
|
@@ -11750,7 +11750,7 @@ export declare const cachedWithTTL: {
|
|
|
11750
11750
|
* @see {@link cachedWithTTL} for a similar function that caches the result for
|
|
11751
11751
|
* a specified duration but does not include an effect for manual invalidation.
|
|
11752
11752
|
*
|
|
11753
|
-
* **Example** (
|
|
11753
|
+
* **Example** (Memoizing with TTL and invalidation)
|
|
11754
11754
|
*
|
|
11755
11755
|
* ```ts
|
|
11756
11756
|
* import { Console, Effect } from "effect"
|
|
@@ -11821,7 +11821,7 @@ export declare const cachedInvalidateWithTTL: {
|
|
|
11821
11821
|
* @see {@link cachedWithTTL} for a similar function that caches the result for
|
|
11822
11822
|
* a specified duration but does not include an effect for manual invalidation.
|
|
11823
11823
|
*
|
|
11824
|
-
* **Example** (
|
|
11824
|
+
* **Example** (Memoizing with TTL and invalidation)
|
|
11825
11825
|
*
|
|
11826
11826
|
* ```ts
|
|
11827
11827
|
* import { Console, Effect } from "effect"
|
|
@@ -11892,7 +11892,7 @@ export declare const cachedInvalidateWithTTL: {
|
|
|
11892
11892
|
* @see {@link cachedWithTTL} for a similar function that caches the result for
|
|
11893
11893
|
* a specified duration but does not include an effect for manual invalidation.
|
|
11894
11894
|
*
|
|
11895
|
-
* **Example** (
|
|
11895
|
+
* **Example** (Memoizing with TTL and invalidation)
|
|
11896
11896
|
*
|
|
11897
11897
|
* ```ts
|
|
11898
11898
|
* import { Console, Effect } from "effect"
|
|
@@ -11935,7 +11935,7 @@ export declare const cachedInvalidateWithTTL: {
|
|
|
11935
11935
|
/**
|
|
11936
11936
|
* Returns an effect that is immediately interrupted.
|
|
11937
11937
|
*
|
|
11938
|
-
* **Example** (
|
|
11938
|
+
* **Example** (Creating an interrupted effect)
|
|
11939
11939
|
*
|
|
11940
11940
|
* ```ts
|
|
11941
11941
|
* import { Effect } from "effect"
|
|
@@ -11956,7 +11956,7 @@ export declare const interrupt: Effect<never>;
|
|
|
11956
11956
|
/**
|
|
11957
11957
|
* Returns a new effect that allows the effect to be interruptible.
|
|
11958
11958
|
*
|
|
11959
|
-
* **Example** (
|
|
11959
|
+
* **Example** (Allowing interruption)
|
|
11960
11960
|
*
|
|
11961
11961
|
* ```ts
|
|
11962
11962
|
* import { Effect } from "effect"
|
|
@@ -11977,7 +11977,7 @@ export declare const interruptible: <A, E, R>(self: Effect<A, E, R>) => Effect<A
|
|
|
11977
11977
|
/**
|
|
11978
11978
|
* Runs the specified finalizer effect if this effect is interrupted.
|
|
11979
11979
|
*
|
|
11980
|
-
* **Example** (
|
|
11980
|
+
* **Example** (Running cleanup on interruption)
|
|
11981
11981
|
*
|
|
11982
11982
|
* ```ts
|
|
11983
11983
|
* import { Console, Effect, Fiber } from "effect"
|
|
@@ -12002,7 +12002,7 @@ export declare const onInterrupt: {
|
|
|
12002
12002
|
/**
|
|
12003
12003
|
* Runs the specified finalizer effect if this effect is interrupted.
|
|
12004
12004
|
*
|
|
12005
|
-
* **Example** (
|
|
12005
|
+
* **Example** (Running cleanup on interruption)
|
|
12006
12006
|
*
|
|
12007
12007
|
* ```ts
|
|
12008
12008
|
* import { Console, Effect, Fiber } from "effect"
|
|
@@ -12027,7 +12027,7 @@ export declare const onInterrupt: {
|
|
|
12027
12027
|
/**
|
|
12028
12028
|
* Runs the specified finalizer effect if this effect is interrupted.
|
|
12029
12029
|
*
|
|
12030
|
-
* **Example** (
|
|
12030
|
+
* **Example** (Running cleanup on interruption)
|
|
12031
12031
|
*
|
|
12032
12032
|
* ```ts
|
|
12033
12033
|
* import { Console, Effect, Fiber } from "effect"
|
|
@@ -12053,7 +12053,7 @@ export declare const onInterrupt: {
|
|
|
12053
12053
|
/**
|
|
12054
12054
|
* Returns a new effect that disables interruption for the given effect.
|
|
12055
12055
|
*
|
|
12056
|
-
* **Example** (
|
|
12056
|
+
* **Example** (Preventing interruption)
|
|
12057
12057
|
*
|
|
12058
12058
|
* ```ts
|
|
12059
12059
|
* import { Console, Effect, Fiber } from "effect"
|
|
@@ -12079,7 +12079,7 @@ export declare const uninterruptible: <A, E, R>(self: Effect<A, E, R>) => Effect
|
|
|
12079
12079
|
* Disables interruption and provides a restore function to restore the
|
|
12080
12080
|
* interruptible state within the effect.
|
|
12081
12081
|
*
|
|
12082
|
-
* **Example** (
|
|
12082
|
+
* **Example** (Restoring interruption in protected regions)
|
|
12083
12083
|
*
|
|
12084
12084
|
* ```ts
|
|
12085
12085
|
* import { Console, Effect } from "effect"
|
|
@@ -12111,7 +12111,7 @@ export declare const uninterruptibleMask: <A, E, R>(f: (restore: <AX, EX, RX>(ef
|
|
|
12111
12111
|
* `restore` function. This function can be used to restore the interruptibility
|
|
12112
12112
|
* of any specific region of code.
|
|
12113
12113
|
*
|
|
12114
|
-
* **Example** (
|
|
12114
|
+
* **Example** (Controlling interruptibility locally)
|
|
12115
12115
|
*
|
|
12116
12116
|
* ```ts
|
|
12117
12117
|
* import { Console, Effect } from "effect"
|
|
@@ -12190,7 +12190,7 @@ export declare namespace Repeat {
|
|
|
12190
12190
|
/**
|
|
12191
12191
|
* Repeats this effect forever (until the first error).
|
|
12192
12192
|
*
|
|
12193
|
-
* **Example** (
|
|
12193
|
+
* **Example** (Repeating forever)
|
|
12194
12194
|
*
|
|
12195
12195
|
* ```ts
|
|
12196
12196
|
* import { Console, Effect, Fiber } from "effect"
|
|
@@ -12246,7 +12246,7 @@ export declare const forever: <Arg extends Effect<any, any, any> | {
|
|
|
12246
12246
|
* delays, limiting recursions, or dynamically adjusting based on the outcome of
|
|
12247
12247
|
* each execution.
|
|
12248
12248
|
*
|
|
12249
|
-
* **Example** (
|
|
12249
|
+
* **Example** (Repeating successful effects with a schedule)
|
|
12250
12250
|
*
|
|
12251
12251
|
* ```ts
|
|
12252
12252
|
* // Success Example
|
|
@@ -12259,7 +12259,7 @@ export declare const forever: <Arg extends Effect<any, any, any> | {
|
|
|
12259
12259
|
* // Effect.runPromise(program).then((n) => console.log(`repetitions: ${n}`))
|
|
12260
12260
|
* ```
|
|
12261
12261
|
*
|
|
12262
|
-
* **Example** (
|
|
12262
|
+
* **Example** (Stopping repetition on failure)
|
|
12263
12263
|
*
|
|
12264
12264
|
* ```ts
|
|
12265
12265
|
* // Failure Example
|
|
@@ -12311,7 +12311,7 @@ export declare const repeat: {
|
|
|
12311
12311
|
* delays, limiting recursions, or dynamically adjusting based on the outcome of
|
|
12312
12312
|
* each execution.
|
|
12313
12313
|
*
|
|
12314
|
-
* **Example** (
|
|
12314
|
+
* **Example** (Repeating successful effects with a schedule)
|
|
12315
12315
|
*
|
|
12316
12316
|
* ```ts
|
|
12317
12317
|
* // Success Example
|
|
@@ -12324,7 +12324,7 @@ export declare const repeat: {
|
|
|
12324
12324
|
* // Effect.runPromise(program).then((n) => console.log(`repetitions: ${n}`))
|
|
12325
12325
|
* ```
|
|
12326
12326
|
*
|
|
12327
|
-
* **Example** (
|
|
12327
|
+
* **Example** (Stopping repetition on failure)
|
|
12328
12328
|
*
|
|
12329
12329
|
* ```ts
|
|
12330
12330
|
* // Failure Example
|
|
@@ -12376,7 +12376,7 @@ export declare const repeat: {
|
|
|
12376
12376
|
* delays, limiting recursions, or dynamically adjusting based on the outcome of
|
|
12377
12377
|
* each execution.
|
|
12378
12378
|
*
|
|
12379
|
-
* **Example** (
|
|
12379
|
+
* **Example** (Repeating successful effects with a schedule)
|
|
12380
12380
|
*
|
|
12381
12381
|
* ```ts
|
|
12382
12382
|
* // Success Example
|
|
@@ -12389,7 +12389,7 @@ export declare const repeat: {
|
|
|
12389
12389
|
* // Effect.runPromise(program).then((n) => console.log(`repetitions: ${n}`))
|
|
12390
12390
|
* ```
|
|
12391
12391
|
*
|
|
12392
|
-
* **Example** (
|
|
12392
|
+
* **Example** (Stopping repetition on failure)
|
|
12393
12393
|
*
|
|
12394
12394
|
* ```ts
|
|
12395
12395
|
* // Failure Example
|
|
@@ -12441,7 +12441,7 @@ export declare const repeat: {
|
|
|
12441
12441
|
* delays, limiting recursions, or dynamically adjusting based on the outcome of
|
|
12442
12442
|
* each execution.
|
|
12443
12443
|
*
|
|
12444
|
-
* **Example** (
|
|
12444
|
+
* **Example** (Repeating successful effects with a schedule)
|
|
12445
12445
|
*
|
|
12446
12446
|
* ```ts
|
|
12447
12447
|
* // Success Example
|
|
@@ -12454,7 +12454,7 @@ export declare const repeat: {
|
|
|
12454
12454
|
* // Effect.runPromise(program).then((n) => console.log(`repetitions: ${n}`))
|
|
12455
12455
|
* ```
|
|
12456
12456
|
*
|
|
12457
|
-
* **Example** (
|
|
12457
|
+
* **Example** (Stopping repetition on failure)
|
|
12458
12458
|
*
|
|
12459
12459
|
* ```ts
|
|
12460
12460
|
* // Failure Example
|
|
@@ -12506,7 +12506,7 @@ export declare const repeat: {
|
|
|
12506
12506
|
* delays, limiting recursions, or dynamically adjusting based on the outcome of
|
|
12507
12507
|
* each execution.
|
|
12508
12508
|
*
|
|
12509
|
-
* **Example** (
|
|
12509
|
+
* **Example** (Repeating successful effects with a schedule)
|
|
12510
12510
|
*
|
|
12511
12511
|
* ```ts
|
|
12512
12512
|
* // Success Example
|
|
@@ -12519,7 +12519,7 @@ export declare const repeat: {
|
|
|
12519
12519
|
* // Effect.runPromise(program).then((n) => console.log(`repetitions: ${n}`))
|
|
12520
12520
|
* ```
|
|
12521
12521
|
*
|
|
12522
|
-
* **Example** (
|
|
12522
|
+
* **Example** (Stopping repetition on failure)
|
|
12523
12523
|
*
|
|
12524
12524
|
* ```ts
|
|
12525
12525
|
* // Failure Example
|
|
@@ -12571,7 +12571,7 @@ export declare const repeat: {
|
|
|
12571
12571
|
* delays, limiting recursions, or dynamically adjusting based on the outcome of
|
|
12572
12572
|
* each execution.
|
|
12573
12573
|
*
|
|
12574
|
-
* **Example** (
|
|
12574
|
+
* **Example** (Repeating successful effects with a schedule)
|
|
12575
12575
|
*
|
|
12576
12576
|
* ```ts
|
|
12577
12577
|
* // Success Example
|
|
@@ -12584,7 +12584,7 @@ export declare const repeat: {
|
|
|
12584
12584
|
* // Effect.runPromise(program).then((n) => console.log(`repetitions: ${n}`))
|
|
12585
12585
|
* ```
|
|
12586
12586
|
*
|
|
12587
|
-
* **Example** (
|
|
12587
|
+
* **Example** (Stopping repetition on failure)
|
|
12588
12588
|
*
|
|
12589
12589
|
* ```ts
|
|
12590
12590
|
* // Failure Example
|
|
@@ -12636,7 +12636,7 @@ export declare const repeat: {
|
|
|
12636
12636
|
* delays, limiting recursions, or dynamically adjusting based on the outcome of
|
|
12637
12637
|
* each execution.
|
|
12638
12638
|
*
|
|
12639
|
-
* **Example** (
|
|
12639
|
+
* **Example** (Repeating successful effects with a schedule)
|
|
12640
12640
|
*
|
|
12641
12641
|
* ```ts
|
|
12642
12642
|
* // Success Example
|
|
@@ -12649,7 +12649,7 @@ export declare const repeat: {
|
|
|
12649
12649
|
* // Effect.runPromise(program).then((n) => console.log(`repetitions: ${n}`))
|
|
12650
12650
|
* ```
|
|
12651
12651
|
*
|
|
12652
|
-
* **Example** (
|
|
12652
|
+
* **Example** (Stopping repetition on failure)
|
|
12653
12653
|
*
|
|
12654
12654
|
* ```ts
|
|
12655
12655
|
* // Failure Example
|
|
@@ -12691,7 +12691,7 @@ export declare const repeat: {
|
|
|
12691
12691
|
* otherwise it receives `None`. If the schedule completes normally, the
|
|
12692
12692
|
* returned effect succeeds with the schedule's output.
|
|
12693
12693
|
*
|
|
12694
|
-
* **Example** (
|
|
12694
|
+
* **Example** (Recovering after repetition stops)
|
|
12695
12695
|
*
|
|
12696
12696
|
* ```ts
|
|
12697
12697
|
* import { Console, Effect, Option, Schedule } from "effect"
|
|
@@ -12734,7 +12734,7 @@ export declare const repeatOrElse: {
|
|
|
12734
12734
|
* otherwise it receives `None`. If the schedule completes normally, the
|
|
12735
12735
|
* returned effect succeeds with the schedule's output.
|
|
12736
12736
|
*
|
|
12737
|
-
* **Example** (
|
|
12737
|
+
* **Example** (Recovering after repetition stops)
|
|
12738
12738
|
*
|
|
12739
12739
|
* ```ts
|
|
12740
12740
|
* import { Console, Effect, Option, Schedule } from "effect"
|
|
@@ -12777,7 +12777,7 @@ export declare const repeatOrElse: {
|
|
|
12777
12777
|
* otherwise it receives `None`. If the schedule completes normally, the
|
|
12778
12778
|
* returned effect succeeds with the schedule's output.
|
|
12779
12779
|
*
|
|
12780
|
-
* **Example** (
|
|
12780
|
+
* **Example** (Recovering after repetition stops)
|
|
12781
12781
|
*
|
|
12782
12782
|
* ```ts
|
|
12783
12783
|
* import { Console, Effect, Option, Schedule } from "effect"
|
|
@@ -12843,7 +12843,7 @@ export declare const replicate: {
|
|
|
12843
12843
|
*
|
|
12844
12844
|
* Use `concurrency` to control parallelism and `discard: true` to ignore results.
|
|
12845
12845
|
*
|
|
12846
|
-
* **Example** (
|
|
12846
|
+
* **Example** (Replicating an effect)
|
|
12847
12847
|
*
|
|
12848
12848
|
* ```ts
|
|
12849
12849
|
* import { Console, Effect } from "effect"
|
|
@@ -12863,7 +12863,7 @@ export declare const replicateEffect: {
|
|
|
12863
12863
|
*
|
|
12864
12864
|
* Use `concurrency` to control parallelism and `discard: true` to ignore results.
|
|
12865
12865
|
*
|
|
12866
|
-
* **Example** (
|
|
12866
|
+
* **Example** (Replicating an effect)
|
|
12867
12867
|
*
|
|
12868
12868
|
* ```ts
|
|
12869
12869
|
* import { Console, Effect } from "effect"
|
|
@@ -12886,7 +12886,7 @@ export declare const replicateEffect: {
|
|
|
12886
12886
|
*
|
|
12887
12887
|
* Use `concurrency` to control parallelism and `discard: true` to ignore results.
|
|
12888
12888
|
*
|
|
12889
|
-
* **Example** (
|
|
12889
|
+
* **Example** (Replicating an effect)
|
|
12890
12890
|
*
|
|
12891
12891
|
* ```ts
|
|
12892
12892
|
* import { Console, Effect } from "effect"
|
|
@@ -12909,7 +12909,7 @@ export declare const replicateEffect: {
|
|
|
12909
12909
|
*
|
|
12910
12910
|
* Use `concurrency` to control parallelism and `discard: true` to ignore results.
|
|
12911
12911
|
*
|
|
12912
|
-
* **Example** (
|
|
12912
|
+
* **Example** (Replicating an effect)
|
|
12913
12913
|
*
|
|
12914
12914
|
* ```ts
|
|
12915
12915
|
* import { Console, Effect } from "effect"
|
|
@@ -12932,7 +12932,7 @@ export declare const replicateEffect: {
|
|
|
12932
12932
|
*
|
|
12933
12933
|
* Use `concurrency` to control parallelism and `discard: true` to ignore results.
|
|
12934
12934
|
*
|
|
12935
|
-
* **Example** (
|
|
12935
|
+
* **Example** (Replicating an effect)
|
|
12936
12936
|
*
|
|
12937
12937
|
* ```ts
|
|
12938
12938
|
* import { Console, Effect } from "effect"
|
|
@@ -12963,7 +12963,7 @@ export declare const replicateEffect: {
|
|
|
12963
12963
|
* fails, and otherwise succeeds with the schedule output when the schedule
|
|
12964
12964
|
* completes.
|
|
12965
12965
|
*
|
|
12966
|
-
* **Example** (
|
|
12966
|
+
* **Example** (Scheduling repeated execution)
|
|
12967
12967
|
*
|
|
12968
12968
|
* ```ts
|
|
12969
12969
|
* import { Console, Effect, Schedule } from "effect"
|
|
@@ -13006,7 +13006,7 @@ export declare const schedule: {
|
|
|
13006
13006
|
* fails, and otherwise succeeds with the schedule output when the schedule
|
|
13007
13007
|
* completes.
|
|
13008
13008
|
*
|
|
13009
|
-
* **Example** (
|
|
13009
|
+
* **Example** (Scheduling repeated execution)
|
|
13010
13010
|
*
|
|
13011
13011
|
* ```ts
|
|
13012
13012
|
* import { Console, Effect, Schedule } from "effect"
|
|
@@ -13049,7 +13049,7 @@ export declare const schedule: {
|
|
|
13049
13049
|
* fails, and otherwise succeeds with the schedule output when the schedule
|
|
13050
13050
|
* completes.
|
|
13051
13051
|
*
|
|
13052
|
-
* **Example** (
|
|
13052
|
+
* **Example** (Scheduling repeated execution)
|
|
13053
13053
|
*
|
|
13054
13054
|
* ```ts
|
|
13055
13055
|
* import { Console, Effect, Schedule } from "effect"
|
|
@@ -13093,7 +13093,7 @@ export declare const schedule: {
|
|
|
13093
13093
|
* succeeds with the schedule output when the schedule completes and fails if
|
|
13094
13094
|
* the effect or schedule fails.
|
|
13095
13095
|
*
|
|
13096
|
-
* **Example** (
|
|
13096
|
+
* **Example** (Scheduling from an initial value)
|
|
13097
13097
|
*
|
|
13098
13098
|
* ```ts
|
|
13099
13099
|
* import { Console, Effect, Schedule } from "effect"
|
|
@@ -13131,7 +13131,7 @@ export declare const scheduleFrom: {
|
|
|
13131
13131
|
* succeeds with the schedule output when the schedule completes and fails if
|
|
13132
13132
|
* the effect or schedule fails.
|
|
13133
13133
|
*
|
|
13134
|
-
* **Example** (
|
|
13134
|
+
* **Example** (Scheduling from an initial value)
|
|
13135
13135
|
*
|
|
13136
13136
|
* ```ts
|
|
13137
13137
|
* import { Console, Effect, Schedule } from "effect"
|
|
@@ -13169,7 +13169,7 @@ export declare const scheduleFrom: {
|
|
|
13169
13169
|
* succeeds with the schedule output when the schedule completes and fails if
|
|
13170
13170
|
* the effect or schedule fails.
|
|
13171
13171
|
*
|
|
13172
|
-
* **Example** (
|
|
13172
|
+
* **Example** (Scheduling from an initial value)
|
|
13173
13173
|
*
|
|
13174
13174
|
* ```ts
|
|
13175
13175
|
* import { Console, Effect, Schedule } from "effect"
|
|
@@ -13199,7 +13199,7 @@ export declare const scheduleFrom: {
|
|
|
13199
13199
|
/**
|
|
13200
13200
|
* Returns the current tracer from the context.
|
|
13201
13201
|
*
|
|
13202
|
-
* **Example** (
|
|
13202
|
+
* **Example** (Accessing the current tracer)
|
|
13203
13203
|
*
|
|
13204
13204
|
* ```ts
|
|
13205
13205
|
* import { Effect } from "effect"
|
|
@@ -13218,7 +13218,7 @@ export declare const tracer: Effect<Tracer>;
|
|
|
13218
13218
|
/**
|
|
13219
13219
|
* Provides a tracer to an effect.
|
|
13220
13220
|
*
|
|
13221
|
-
* **Example** (
|
|
13221
|
+
* **Example** (Providing a tracer)
|
|
13222
13222
|
*
|
|
13223
13223
|
* ```ts
|
|
13224
13224
|
* import { Effect } from "effect"
|
|
@@ -13239,7 +13239,7 @@ export declare const withTracer: {
|
|
|
13239
13239
|
/**
|
|
13240
13240
|
* Provides a tracer to an effect.
|
|
13241
13241
|
*
|
|
13242
|
-
* **Example** (
|
|
13242
|
+
* **Example** (Providing a tracer)
|
|
13243
13243
|
*
|
|
13244
13244
|
* ```ts
|
|
13245
13245
|
* import { Effect } from "effect"
|
|
@@ -13260,7 +13260,7 @@ export declare const withTracer: {
|
|
|
13260
13260
|
/**
|
|
13261
13261
|
* Provides a tracer to an effect.
|
|
13262
13262
|
*
|
|
13263
|
-
* **Example** (
|
|
13263
|
+
* **Example** (Providing a tracer)
|
|
13264
13264
|
*
|
|
13265
13265
|
* ```ts
|
|
13266
13266
|
* import { Effect } from "effect"
|
|
@@ -13287,7 +13287,7 @@ export declare const withTracer: {
|
|
|
13287
13287
|
* When `enabled` is `false`, spans created inside the effect are not registered
|
|
13288
13288
|
* with the current tracer and do not propagate as normal trace parents.
|
|
13289
13289
|
*
|
|
13290
|
-
* **Example** (
|
|
13290
|
+
* **Example** (Enabling or disabling tracing)
|
|
13291
13291
|
*
|
|
13292
13292
|
* ```ts
|
|
13293
13293
|
* import { Effect } from "effect"
|
|
@@ -13311,7 +13311,7 @@ export declare const withTracerEnabled: {
|
|
|
13311
13311
|
* When `enabled` is `false`, spans created inside the effect are not registered
|
|
13312
13312
|
* with the current tracer and do not propagate as normal trace parents.
|
|
13313
13313
|
*
|
|
13314
|
-
* **Example** (
|
|
13314
|
+
* **Example** (Enabling or disabling tracing)
|
|
13315
13315
|
*
|
|
13316
13316
|
* ```ts
|
|
13317
13317
|
* import { Effect } from "effect"
|
|
@@ -13335,7 +13335,7 @@ export declare const withTracerEnabled: {
|
|
|
13335
13335
|
* When `enabled` is `false`, spans created inside the effect are not registered
|
|
13336
13336
|
* with the current tracer and do not propagate as normal trace parents.
|
|
13337
13337
|
*
|
|
13338
|
-
* **Example** (
|
|
13338
|
+
* **Example** (Enabling or disabling tracing)
|
|
13339
13339
|
*
|
|
13340
13340
|
* ```ts
|
|
13341
13341
|
* import { Effect } from "effect"
|
|
@@ -13355,7 +13355,7 @@ export declare const withTracerEnabled: {
|
|
|
13355
13355
|
/**
|
|
13356
13356
|
* Enables or disables tracer timing for the given Effect.
|
|
13357
13357
|
*
|
|
13358
|
-
* **Example** (
|
|
13358
|
+
* **Example** (Enabling or disabling tracing timing)
|
|
13359
13359
|
*
|
|
13360
13360
|
* ```ts
|
|
13361
13361
|
* import { Effect } from "effect"
|
|
@@ -13374,7 +13374,7 @@ export declare const withTracerTiming: {
|
|
|
13374
13374
|
/**
|
|
13375
13375
|
* Enables or disables tracer timing for the given Effect.
|
|
13376
13376
|
*
|
|
13377
|
-
* **Example** (
|
|
13377
|
+
* **Example** (Enabling or disabling tracing timing)
|
|
13378
13378
|
*
|
|
13379
13379
|
* ```ts
|
|
13380
13380
|
* import { Effect } from "effect"
|
|
@@ -13393,7 +13393,7 @@ export declare const withTracerTiming: {
|
|
|
13393
13393
|
/**
|
|
13394
13394
|
* Enables or disables tracer timing for the given Effect.
|
|
13395
13395
|
*
|
|
13396
|
-
* **Example** (
|
|
13396
|
+
* **Example** (Enabling or disabling tracing timing)
|
|
13397
13397
|
*
|
|
13398
13398
|
* ```ts
|
|
13399
13399
|
* import { Effect } from "effect"
|
|
@@ -13413,7 +13413,7 @@ export declare const withTracerTiming: {
|
|
|
13413
13413
|
/**
|
|
13414
13414
|
* Adds an annotation to each span in this effect.
|
|
13415
13415
|
*
|
|
13416
|
-
* **Example** (
|
|
13416
|
+
* **Example** (Annotating all spans)
|
|
13417
13417
|
*
|
|
13418
13418
|
* ```ts
|
|
13419
13419
|
* import { Effect } from "effect"
|
|
@@ -13441,7 +13441,7 @@ export declare const annotateSpans: {
|
|
|
13441
13441
|
/**
|
|
13442
13442
|
* Adds an annotation to each span in this effect.
|
|
13443
13443
|
*
|
|
13444
|
-
* **Example** (
|
|
13444
|
+
* **Example** (Annotating all spans)
|
|
13445
13445
|
*
|
|
13446
13446
|
* ```ts
|
|
13447
13447
|
* import { Effect } from "effect"
|
|
@@ -13469,7 +13469,7 @@ export declare const annotateSpans: {
|
|
|
13469
13469
|
/**
|
|
13470
13470
|
* Adds an annotation to each span in this effect.
|
|
13471
13471
|
*
|
|
13472
|
-
* **Example** (
|
|
13472
|
+
* **Example** (Annotating all spans)
|
|
13473
13473
|
*
|
|
13474
13474
|
* ```ts
|
|
13475
13475
|
* import { Effect } from "effect"
|
|
@@ -13497,7 +13497,7 @@ export declare const annotateSpans: {
|
|
|
13497
13497
|
/**
|
|
13498
13498
|
* Adds an annotation to each span in this effect.
|
|
13499
13499
|
*
|
|
13500
|
-
* **Example** (
|
|
13500
|
+
* **Example** (Annotating all spans)
|
|
13501
13501
|
*
|
|
13502
13502
|
* ```ts
|
|
13503
13503
|
* import { Effect } from "effect"
|
|
@@ -13525,7 +13525,7 @@ export declare const annotateSpans: {
|
|
|
13525
13525
|
/**
|
|
13526
13526
|
* Adds an annotation to each span in this effect.
|
|
13527
13527
|
*
|
|
13528
|
-
* **Example** (
|
|
13528
|
+
* **Example** (Annotating all spans)
|
|
13529
13529
|
*
|
|
13530
13530
|
* ```ts
|
|
13531
13531
|
* import { Effect } from "effect"
|
|
@@ -13554,7 +13554,7 @@ export declare const annotateSpans: {
|
|
|
13554
13554
|
/**
|
|
13555
13555
|
* Adds an annotation to the current span if available.
|
|
13556
13556
|
*
|
|
13557
|
-
* **Example** (
|
|
13557
|
+
* **Example** (Annotating the current span)
|
|
13558
13558
|
*
|
|
13559
13559
|
* ```ts
|
|
13560
13560
|
* import { Effect } from "effect"
|
|
@@ -13579,7 +13579,7 @@ export declare const annotateCurrentSpan: {
|
|
|
13579
13579
|
/**
|
|
13580
13580
|
* Adds an annotation to the current span if available.
|
|
13581
13581
|
*
|
|
13582
|
-
* **Example** (
|
|
13582
|
+
* **Example** (Annotating the current span)
|
|
13583
13583
|
*
|
|
13584
13584
|
* ```ts
|
|
13585
13585
|
* import { Effect } from "effect"
|
|
@@ -13604,7 +13604,7 @@ export declare const annotateCurrentSpan: {
|
|
|
13604
13604
|
/**
|
|
13605
13605
|
* Adds an annotation to the current span if available.
|
|
13606
13606
|
*
|
|
13607
|
-
* **Example** (
|
|
13607
|
+
* **Example** (Annotating the current span)
|
|
13608
13608
|
*
|
|
13609
13609
|
* ```ts
|
|
13610
13610
|
* import { Effect } from "effect"
|
|
@@ -13635,7 +13635,7 @@ export declare const annotateCurrentSpan: {
|
|
|
13635
13635
|
* The effect fails with `NoSuchElementError` when there is no active local
|
|
13636
13636
|
* `Span`.
|
|
13637
13637
|
*
|
|
13638
|
-
* **Example** (
|
|
13638
|
+
* **Example** (Reading the current span)
|
|
13639
13639
|
*
|
|
13640
13640
|
* ```ts
|
|
13641
13641
|
* import { Effect } from "effect"
|
|
@@ -13662,7 +13662,7 @@ export declare const currentSpan: Effect<Span, Cause.NoSuchElementError>;
|
|
|
13662
13662
|
* present, and fails with `NoSuchElementError` when no parent span is
|
|
13663
13663
|
* available.
|
|
13664
13664
|
*
|
|
13665
|
-
* **Example** (
|
|
13665
|
+
* **Example** (Reading the parent span)
|
|
13666
13666
|
*
|
|
13667
13667
|
* ```ts
|
|
13668
13668
|
* import { Effect } from "effect"
|
|
@@ -13693,7 +13693,7 @@ export declare const currentParentSpan: Effect<AnySpan, Cause.NoSuchElementError
|
|
|
13693
13693
|
* These annotations are applied to spans created inside the context, such as
|
|
13694
13694
|
* spans created by `withSpan`, `useSpan`, or `makeSpan`.
|
|
13695
13695
|
*
|
|
13696
|
-
* **Example** (
|
|
13696
|
+
* **Example** (Providing span annotations)
|
|
13697
13697
|
*
|
|
13698
13698
|
* ```ts
|
|
13699
13699
|
* import { Effect } from "effect"
|
|
@@ -13726,7 +13726,7 @@ export declare const spanAnnotations: Effect<Readonly<Record<string, unknown>>>;
|
|
|
13726
13726
|
* These links are attached to spans created inside the context. Span links
|
|
13727
13727
|
* connect related spans without making one span the parent of another.
|
|
13728
13728
|
*
|
|
13729
|
-
* **Example** (
|
|
13729
|
+
* **Example** (Providing span links)
|
|
13730
13730
|
*
|
|
13731
13731
|
* ```ts
|
|
13732
13732
|
* import { Effect } from "effect"
|
|
@@ -13750,7 +13750,7 @@ export declare const spanLinks: Effect<ReadonlyArray<SpanLink>>;
|
|
|
13750
13750
|
* parent-child relationship. For example, you might want to link spans from
|
|
13751
13751
|
* parallel operations or connect spans across different traces.
|
|
13752
13752
|
*
|
|
13753
|
-
* **Example** (
|
|
13753
|
+
* **Example** (Linking one span to another span)
|
|
13754
13754
|
*
|
|
13755
13755
|
* ```ts
|
|
13756
13756
|
* import { Effect } from "effect"
|
|
@@ -13773,7 +13773,7 @@ export declare const spanLinks: Effect<ReadonlyArray<SpanLink>>;
|
|
|
13773
13773
|
* })
|
|
13774
13774
|
* ```
|
|
13775
13775
|
*
|
|
13776
|
-
* **Example** (
|
|
13776
|
+
* **Example** (Linking multiple spans at once)
|
|
13777
13777
|
*
|
|
13778
13778
|
* ```ts
|
|
13779
13779
|
* import { Effect } from "effect"
|
|
@@ -13803,7 +13803,7 @@ export declare const linkSpans: {
|
|
|
13803
13803
|
* parent-child relationship. For example, you might want to link spans from
|
|
13804
13804
|
* parallel operations or connect spans across different traces.
|
|
13805
13805
|
*
|
|
13806
|
-
* **Example** (
|
|
13806
|
+
* **Example** (Linking one span to another span)
|
|
13807
13807
|
*
|
|
13808
13808
|
* ```ts
|
|
13809
13809
|
* import { Effect } from "effect"
|
|
@@ -13826,7 +13826,7 @@ export declare const linkSpans: {
|
|
|
13826
13826
|
* })
|
|
13827
13827
|
* ```
|
|
13828
13828
|
*
|
|
13829
|
-
* **Example** (
|
|
13829
|
+
* **Example** (Linking multiple spans at once)
|
|
13830
13830
|
*
|
|
13831
13831
|
* ```ts
|
|
13832
13832
|
* import { Effect } from "effect"
|
|
@@ -13856,7 +13856,7 @@ export declare const linkSpans: {
|
|
|
13856
13856
|
* parent-child relationship. For example, you might want to link spans from
|
|
13857
13857
|
* parallel operations or connect spans across different traces.
|
|
13858
13858
|
*
|
|
13859
|
-
* **Example** (
|
|
13859
|
+
* **Example** (Linking one span to another span)
|
|
13860
13860
|
*
|
|
13861
13861
|
* ```ts
|
|
13862
13862
|
* import { Effect } from "effect"
|
|
@@ -13879,7 +13879,7 @@ export declare const linkSpans: {
|
|
|
13879
13879
|
* })
|
|
13880
13880
|
* ```
|
|
13881
13881
|
*
|
|
13882
|
-
* **Example** (
|
|
13882
|
+
* **Example** (Linking multiple spans at once)
|
|
13883
13883
|
*
|
|
13884
13884
|
* ```ts
|
|
13885
13885
|
* import { Effect } from "effect"
|
|
@@ -13912,7 +13912,7 @@ export declare const linkSpans: {
|
|
|
13912
13912
|
* automatically. Use `withSpan`, `useSpan`, or `makeSpanScoped` when the span
|
|
13913
13913
|
* should be installed as context or closed automatically.
|
|
13914
13914
|
*
|
|
13915
|
-
* **Example** (
|
|
13915
|
+
* **Example** (Creating a span manually)
|
|
13916
13916
|
*
|
|
13917
13917
|
* ```ts
|
|
13918
13918
|
* import { Effect } from "effect"
|
|
@@ -13935,7 +13935,7 @@ export declare const makeSpan: (name: string, options?: SpanOptionsNoTrace) => E
|
|
|
13935
13935
|
* The span is not added to the current span stack, so no child spans will be
|
|
13936
13936
|
* created for it.
|
|
13937
13937
|
*
|
|
13938
|
-
* **Example** (
|
|
13938
|
+
* **Example** (Creating a scoped standalone span)
|
|
13939
13939
|
*
|
|
13940
13940
|
* ```ts
|
|
13941
13941
|
* import { Effect } from "effect"
|
|
@@ -13961,7 +13961,7 @@ export declare const makeSpanScoped: (name: string, options?: SpanOptionsNoTrace
|
|
|
13961
13961
|
* The span is not added to the current span stack, so no child spans will be
|
|
13962
13962
|
* created for it.
|
|
13963
13963
|
*
|
|
13964
|
-
* **Example** (
|
|
13964
|
+
* **Example** (Running an effect with a standalone span)
|
|
13965
13965
|
*
|
|
13966
13966
|
* ```ts
|
|
13967
13967
|
* import { Effect } from "effect"
|
|
@@ -13987,7 +13987,7 @@ export declare const useSpan: {
|
|
|
13987
13987
|
* The span is not added to the current span stack, so no child spans will be
|
|
13988
13988
|
* created for it.
|
|
13989
13989
|
*
|
|
13990
|
-
* **Example** (
|
|
13990
|
+
* **Example** (Running an effect with a standalone span)
|
|
13991
13991
|
*
|
|
13992
13992
|
* ```ts
|
|
13993
13993
|
* import { Effect } from "effect"
|
|
@@ -14013,7 +14013,7 @@ export declare const useSpan: {
|
|
|
14013
14013
|
* The span is not added to the current span stack, so no child spans will be
|
|
14014
14014
|
* created for it.
|
|
14015
14015
|
*
|
|
14016
|
-
* **Example** (
|
|
14016
|
+
* **Example** (Running an effect with a standalone span)
|
|
14017
14017
|
*
|
|
14018
14018
|
* ```ts
|
|
14019
14019
|
* import { Effect } from "effect"
|
|
@@ -14036,7 +14036,7 @@ export declare const useSpan: {
|
|
|
14036
14036
|
/**
|
|
14037
14037
|
* Wraps the effect with a new span for tracing.
|
|
14038
14038
|
*
|
|
14039
|
-
* **Example** (
|
|
14039
|
+
* **Example** (Wrapping an effect in a child span)
|
|
14040
14040
|
*
|
|
14041
14041
|
* ```ts
|
|
14042
14042
|
* import { Effect } from "effect"
|
|
@@ -14058,7 +14058,7 @@ export declare const withSpan: {
|
|
|
14058
14058
|
/**
|
|
14059
14059
|
* Wraps the effect with a new span for tracing.
|
|
14060
14060
|
*
|
|
14061
|
-
* **Example** (
|
|
14061
|
+
* **Example** (Wrapping an effect in a child span)
|
|
14062
14062
|
*
|
|
14063
14063
|
* ```ts
|
|
14064
14064
|
* import { Effect } from "effect"
|
|
@@ -14080,7 +14080,7 @@ export declare const withSpan: {
|
|
|
14080
14080
|
/**
|
|
14081
14081
|
* Wraps the effect with a new span for tracing.
|
|
14082
14082
|
*
|
|
14083
|
-
* **Example** (
|
|
14083
|
+
* **Example** (Wrapping an effect in a child span)
|
|
14084
14084
|
*
|
|
14085
14085
|
* ```ts
|
|
14086
14086
|
* import { Effect } from "effect"
|
|
@@ -14105,7 +14105,7 @@ export declare const withSpan: {
|
|
|
14105
14105
|
*
|
|
14106
14106
|
* The span is ended when the Scope is finalized.
|
|
14107
14107
|
*
|
|
14108
|
-
* **Example** (
|
|
14108
|
+
* **Example** (Creating a scoped child span)
|
|
14109
14109
|
*
|
|
14110
14110
|
* ```ts
|
|
14111
14111
|
* import { Effect } from "effect"
|
|
@@ -14128,7 +14128,7 @@ export declare const withSpanScoped: {
|
|
|
14128
14128
|
*
|
|
14129
14129
|
* The span is ended when the Scope is finalized.
|
|
14130
14130
|
*
|
|
14131
|
-
* **Example** (
|
|
14131
|
+
* **Example** (Creating a scoped child span)
|
|
14132
14132
|
*
|
|
14133
14133
|
* ```ts
|
|
14134
14134
|
* import { Effect } from "effect"
|
|
@@ -14151,7 +14151,7 @@ export declare const withSpanScoped: {
|
|
|
14151
14151
|
*
|
|
14152
14152
|
* The span is ended when the Scope is finalized.
|
|
14153
14153
|
*
|
|
14154
|
-
* **Example** (
|
|
14154
|
+
* **Example** (Creating a scoped child span)
|
|
14155
14155
|
*
|
|
14156
14156
|
* ```ts
|
|
14157
14157
|
* import { Effect } from "effect"
|
|
@@ -14173,7 +14173,7 @@ export declare const withSpanScoped: {
|
|
|
14173
14173
|
/**
|
|
14174
14174
|
* Adds the provided span to the current span stack.
|
|
14175
14175
|
*
|
|
14176
|
-
* **Example** (
|
|
14176
|
+
* **Example** (Setting a parent span)
|
|
14177
14177
|
*
|
|
14178
14178
|
* ```ts
|
|
14179
14179
|
* import { Effect } from "effect"
|
|
@@ -14193,7 +14193,7 @@ export declare const withParentSpan: {
|
|
|
14193
14193
|
/**
|
|
14194
14194
|
* Adds the provided span to the current span stack.
|
|
14195
14195
|
*
|
|
14196
|
-
* **Example** (
|
|
14196
|
+
* **Example** (Setting a parent span)
|
|
14197
14197
|
*
|
|
14198
14198
|
* ```ts
|
|
14199
14199
|
* import { Effect } from "effect"
|
|
@@ -14213,7 +14213,7 @@ export declare const withParentSpan: {
|
|
|
14213
14213
|
/**
|
|
14214
14214
|
* Adds the provided span to the current span stack.
|
|
14215
14215
|
*
|
|
14216
|
-
* **Example** (
|
|
14216
|
+
* **Example** (Setting a parent span)
|
|
14217
14217
|
*
|
|
14218
14218
|
* ```ts
|
|
14219
14219
|
* import { Effect } from "effect"
|
|
@@ -14237,7 +14237,7 @@ export declare const withParentSpan: {
|
|
|
14237
14237
|
* @category Requests & Batching
|
|
14238
14238
|
* @since 2.0.0
|
|
14239
14239
|
*
|
|
14240
|
-
* **Example** (
|
|
14240
|
+
* **Example** (Executing a request through a resolver)
|
|
14241
14241
|
*
|
|
14242
14242
|
* ```ts
|
|
14243
14243
|
* import { Console, Effect, Exit, Request, RequestResolver } from "effect"
|
|
@@ -14269,7 +14269,7 @@ export declare const request: {
|
|
|
14269
14269
|
* @category Requests & Batching
|
|
14270
14270
|
* @since 2.0.0
|
|
14271
14271
|
*
|
|
14272
|
-
* **Example** (
|
|
14272
|
+
* **Example** (Executing a request through a resolver)
|
|
14273
14273
|
*
|
|
14274
14274
|
* ```ts
|
|
14275
14275
|
* import { Console, Effect, Exit, Request, RequestResolver } from "effect"
|
|
@@ -14301,7 +14301,7 @@ export declare const request: {
|
|
|
14301
14301
|
* @category Requests & Batching
|
|
14302
14302
|
* @since 2.0.0
|
|
14303
14303
|
*
|
|
14304
|
-
* **Example** (
|
|
14304
|
+
* **Example** (Executing a request through a resolver)
|
|
14305
14305
|
*
|
|
14306
14306
|
* ```ts
|
|
14307
14307
|
* import { Console, Effect, Exit, Request, RequestResolver } from "effect"
|
|
@@ -14363,7 +14363,7 @@ export declare const requestUnsafe: <A extends Request.Any>(self: A, options: {
|
|
|
14363
14363
|
* fibers leak. This behavior is called "auto supervision", and if this
|
|
14364
14364
|
* behavior is not desired, you may use the `forkDetach` or `forkIn` methods.
|
|
14365
14365
|
*
|
|
14366
|
-
* **Example** (
|
|
14366
|
+
* **Example** (Forking a child fiber)
|
|
14367
14367
|
*
|
|
14368
14368
|
* ```ts
|
|
14369
14369
|
* import { Effect, Fiber } from "effect"
|
|
@@ -14403,7 +14403,7 @@ export declare const forkChild: <Arg extends Effect<any, any, any> | {
|
|
|
14403
14403
|
* Forks the effect in the specified scope. The fiber will be interrupted
|
|
14404
14404
|
* when the scope is closed.
|
|
14405
14405
|
*
|
|
14406
|
-
* **Example** (
|
|
14406
|
+
* **Example** (Forking into a supplied scope)
|
|
14407
14407
|
*
|
|
14408
14408
|
* ```ts
|
|
14409
14409
|
* import { Effect } from "effect"
|
|
@@ -14432,7 +14432,7 @@ export declare const forkIn: {
|
|
|
14432
14432
|
* Forks the effect in the specified scope. The fiber will be interrupted
|
|
14433
14433
|
* when the scope is closed.
|
|
14434
14434
|
*
|
|
14435
|
-
* **Example** (
|
|
14435
|
+
* **Example** (Forking into a supplied scope)
|
|
14436
14436
|
*
|
|
14437
14437
|
* ```ts
|
|
14438
14438
|
* import { Effect } from "effect"
|
|
@@ -14464,7 +14464,7 @@ export declare const forkIn: {
|
|
|
14464
14464
|
* Forks the effect in the specified scope. The fiber will be interrupted
|
|
14465
14465
|
* when the scope is closed.
|
|
14466
14466
|
*
|
|
14467
|
-
* **Example** (
|
|
14467
|
+
* **Example** (Forking into a supplied scope)
|
|
14468
14468
|
*
|
|
14469
14469
|
* ```ts
|
|
14470
14470
|
* import { Effect } from "effect"
|
|
@@ -14496,7 +14496,7 @@ export declare const forkIn: {
|
|
|
14496
14496
|
/**
|
|
14497
14497
|
* Forks the fiber in a `Scope`, interrupting it when the scope is closed.
|
|
14498
14498
|
*
|
|
14499
|
-
* **Example** (
|
|
14499
|
+
* **Example** (Forking into the current scope)
|
|
14500
14500
|
*
|
|
14501
14501
|
* ```ts
|
|
14502
14502
|
* import { Effect } from "effect"
|
|
@@ -14541,7 +14541,7 @@ export declare const forkScoped: <Arg extends Effect<any, any, any> | {
|
|
|
14541
14541
|
* new fiber is attached to the global scope, when the fiber executing the
|
|
14542
14542
|
* returned effect terminates, the forked fiber will continue running.
|
|
14543
14543
|
*
|
|
14544
|
-
* **Example** (
|
|
14544
|
+
* **Example** (Forking a detached fiber)
|
|
14545
14545
|
*
|
|
14546
14546
|
* ```ts
|
|
14547
14547
|
* import { Effect } from "effect"
|
|
@@ -14590,7 +14590,7 @@ export declare const awaitAllChildren: <A, E, R>(self: Effect<A, E, R>) => Effec
|
|
|
14590
14590
|
/**
|
|
14591
14591
|
* Access the fiber currently executing the effect.
|
|
14592
14592
|
*
|
|
14593
|
-
* **Example** (
|
|
14593
|
+
* **Example** (Accessing the current fiber)
|
|
14594
14594
|
*
|
|
14595
14595
|
* ```ts
|
|
14596
14596
|
* import { Console, Effect } from "effect"
|
|
@@ -14608,7 +14608,7 @@ export declare const fiber: Effect<Fiber<unknown, unknown>>;
|
|
|
14608
14608
|
/**
|
|
14609
14609
|
* Access the current fiber id executing the effect.
|
|
14610
14610
|
*
|
|
14611
|
-
* **Example** (
|
|
14611
|
+
* **Example** (Accessing the current fiber id)
|
|
14612
14612
|
*
|
|
14613
14613
|
* ```ts
|
|
14614
14614
|
* import { Effect } from "effect"
|
|
@@ -14654,7 +14654,7 @@ export interface RunOptions {
|
|
|
14654
14654
|
* Unless you specifically need a `Promise` or synchronous operation,
|
|
14655
14655
|
* `runFork` is a good default choice.
|
|
14656
14656
|
*
|
|
14657
|
-
* **Example** (Running an
|
|
14657
|
+
* **Example** (Running an effect in the background)
|
|
14658
14658
|
*
|
|
14659
14659
|
* ```ts
|
|
14660
14660
|
* import { Console, Effect, Fiber, Schedule } from "effect"
|
|
@@ -14682,7 +14682,7 @@ export declare const runFork: <A, E>(effect: Effect<A, E, never>, options?: RunO
|
|
|
14682
14682
|
/**
|
|
14683
14683
|
* Runs an effect in the background with the provided services.
|
|
14684
14684
|
*
|
|
14685
|
-
* **Example** (
|
|
14685
|
+
* **Example** (Running with services in the background)
|
|
14686
14686
|
*
|
|
14687
14687
|
* ```ts
|
|
14688
14688
|
* import { Context, Effect } from "effect"
|
|
@@ -14715,7 +14715,7 @@ export declare const runForkWith: <R>(context: Context.Context<R>) => <A, E>(eff
|
|
|
14715
14715
|
*
|
|
14716
14716
|
* The returned interruptor calls `fiber.interruptUnsafe`, optionally with an interruptor id.
|
|
14717
14717
|
*
|
|
14718
|
-
* **Example** (
|
|
14718
|
+
* **Example** (Running with services and a callback)
|
|
14719
14719
|
*
|
|
14720
14720
|
* ```ts
|
|
14721
14721
|
* import { Console, Context, Effect, Exit } from "effect"
|
|
@@ -14761,7 +14761,7 @@ export declare const runCallbackWith: <R>(context: Context.Context<R>) => <A, E>
|
|
|
14761
14761
|
* The interruptor calls `fiber.interruptUnsafe` with the optional interruptor
|
|
14762
14762
|
* id.
|
|
14763
14763
|
*
|
|
14764
|
-
* **Example** (
|
|
14764
|
+
* **Example** (Running with a callback)
|
|
14765
14765
|
*
|
|
14766
14766
|
* ```ts
|
|
14767
14767
|
* import { Console, Effect, Exit } from "effect"
|
|
@@ -14809,7 +14809,7 @@ export declare const runCallback: <A, E>(effect: Effect<A, E, never>, options?:
|
|
|
14809
14809
|
*
|
|
14810
14810
|
* @see {@link runPromiseExit} for a version that returns an `Exit` type instead of rejecting.
|
|
14811
14811
|
*
|
|
14812
|
-
* **Example** (Running a
|
|
14812
|
+
* **Example** (Running a successful effect as a Promise)
|
|
14813
14813
|
*
|
|
14814
14814
|
* ```ts
|
|
14815
14815
|
* import { Effect } from "effect"
|
|
@@ -14818,7 +14818,7 @@ export declare const runCallback: <A, E>(effect: Effect<A, E, never>, options?:
|
|
|
14818
14818
|
* // Output: 1
|
|
14819
14819
|
* ```
|
|
14820
14820
|
*
|
|
14821
|
-
* **Example** (
|
|
14821
|
+
* **Example** (Running effects as promises)
|
|
14822
14822
|
*
|
|
14823
14823
|
* ```ts
|
|
14824
14824
|
* //Example: Handling a Failing Effect as a Rejected Promise
|
|
@@ -14836,7 +14836,7 @@ export declare const runPromise: <A, E>(effect: Effect<A, E>, options?: RunOptio
|
|
|
14836
14836
|
/**
|
|
14837
14837
|
* Executes an effect as a Promise with the provided services.
|
|
14838
14838
|
*
|
|
14839
|
-
* **Example** (
|
|
14839
|
+
* **Example** (Running with services as a promise)
|
|
14840
14840
|
*
|
|
14841
14841
|
* ```ts
|
|
14842
14842
|
* import { Context, Effect } from "effect"
|
|
@@ -14879,7 +14879,7 @@ export declare const runPromiseWith: <R>(context: Context.Context<R>) => <A, E>(
|
|
|
14879
14879
|
* - If it fails, the failure information is provided as a `Failure` containing
|
|
14880
14880
|
* a `Cause` type.
|
|
14881
14881
|
*
|
|
14882
|
-
* **Example** (
|
|
14882
|
+
* **Example** (Observing promise results as Exit)
|
|
14883
14883
|
*
|
|
14884
14884
|
* ```ts
|
|
14885
14885
|
* import { Effect } from "effect"
|
|
@@ -14914,7 +14914,7 @@ export declare const runPromiseExit: <A, E>(effect: Effect<A, E>, options?: RunO
|
|
|
14914
14914
|
/**
|
|
14915
14915
|
* Runs an effect and returns a Promise of Exit with provided services.
|
|
14916
14916
|
*
|
|
14917
|
-
* **Example** (
|
|
14917
|
+
* **Example** (Running with services as an Exit promise)
|
|
14918
14918
|
*
|
|
14919
14919
|
* ```ts
|
|
14920
14920
|
* import { Context, Effect, Exit } from "effect"
|
|
@@ -14961,7 +14961,7 @@ export declare const runPromiseExitWith: <R>(context: Context.Context<R>) => <A,
|
|
|
14961
14961
|
* @see {@link runSyncExit} for a version that returns an `Exit` type instead of
|
|
14962
14962
|
* throwing an error.
|
|
14963
14963
|
*
|
|
14964
|
-
* **Example** (
|
|
14964
|
+
* **Example** (Running a synchronous effect)
|
|
14965
14965
|
*
|
|
14966
14966
|
* ```ts
|
|
14967
14967
|
* import { Effect } from "effect"
|
|
@@ -14978,7 +14978,7 @@ export declare const runPromiseExitWith: <R>(context: Context.Context<R>) => <A,
|
|
|
14978
14978
|
* // Output: 1
|
|
14979
14979
|
* ```
|
|
14980
14980
|
*
|
|
14981
|
-
* **Example** (
|
|
14981
|
+
* **Example** (Throwing for failed or async effects)
|
|
14982
14982
|
*
|
|
14983
14983
|
* ```ts
|
|
14984
14984
|
* import { Effect } from "effect"
|
|
@@ -15009,7 +15009,7 @@ export declare const runSync: <A, E>(effect: Effect<A, E>) => A;
|
|
|
15009
15009
|
/**
|
|
15010
15010
|
* Executes an effect synchronously with provided services.
|
|
15011
15011
|
*
|
|
15012
|
-
* **Example** (
|
|
15012
|
+
* **Example** (Running synchronously with services)
|
|
15013
15013
|
*
|
|
15014
15014
|
* ```ts
|
|
15015
15015
|
* import { Context, Effect } from "effect"
|
|
@@ -15057,7 +15057,7 @@ export declare const runSyncWith: <R>(context: Context.Context<R>) => <A, E>(eff
|
|
|
15057
15057
|
* return an `Failure` with a `Die` cause, indicating that the effect cannot be
|
|
15058
15058
|
* resolved synchronously.
|
|
15059
15059
|
*
|
|
15060
|
-
* **Example** (
|
|
15060
|
+
* **Example** (Observing synchronous results as Exit)
|
|
15061
15061
|
*
|
|
15062
15062
|
* ```ts
|
|
15063
15063
|
* import { Effect } from "effect"
|
|
@@ -15083,7 +15083,7 @@ export declare const runSyncWith: <R>(context: Context.Context<R>) => <A, E>(eff
|
|
|
15083
15083
|
* // }
|
|
15084
15084
|
* ```
|
|
15085
15085
|
*
|
|
15086
|
-
* **Example** (
|
|
15086
|
+
* **Example** (Capturing async work as a Die cause)
|
|
15087
15087
|
*
|
|
15088
15088
|
* ```ts
|
|
15089
15089
|
* import { Effect } from "effect"
|
|
@@ -15112,7 +15112,7 @@ export declare const runSyncExit: <A, E>(effect: Effect<A, E>) => Exit.Exit<A, E
|
|
|
15112
15112
|
/**
|
|
15113
15113
|
* Runs an effect synchronously with provided services, returning an Exit result.
|
|
15114
15114
|
*
|
|
15115
|
-
* **Example** (
|
|
15115
|
+
* **Example** (Running synchronously with services as Exit)
|
|
15116
15116
|
*
|
|
15117
15117
|
* ```ts
|
|
15118
15118
|
* import { Context, Effect, Exit } from "effect"
|
|
@@ -15753,7 +15753,7 @@ export declare namespace fn {
|
|
|
15753
15753
|
*
|
|
15754
15754
|
* `Effect.fnUntraced` also acts as a `pipe` function, so you can append transforms after the body.
|
|
15755
15755
|
*
|
|
15756
|
-
* **Example** (
|
|
15756
|
+
* **Example** (Defining untraced effect functions)
|
|
15757
15757
|
*
|
|
15758
15758
|
* ```ts
|
|
15759
15759
|
* import { Console, Effect } from "effect"
|
|
@@ -15775,7 +15775,7 @@ export declare const fnUntraced: fn.Untraced;
|
|
|
15775
15775
|
*
|
|
15776
15776
|
* Pipeable functions run after the body and can transform the resulting Effect.
|
|
15777
15777
|
*
|
|
15778
|
-
* **Example** (
|
|
15778
|
+
* **Example** (Defining traced effect functions)
|
|
15779
15779
|
*
|
|
15780
15780
|
* ```ts
|
|
15781
15781
|
* import { Console, Effect } from "effect"
|
|
@@ -15805,7 +15805,7 @@ export declare const fn: fn.Traced & {
|
|
|
15805
15805
|
* Retrieves the `Clock` service from the context and provides it to the
|
|
15806
15806
|
* specified effectful function.
|
|
15807
15807
|
*
|
|
15808
|
-
* **Example** (
|
|
15808
|
+
* **Example** (Accessing the Clock service)
|
|
15809
15809
|
*
|
|
15810
15810
|
* ```ts
|
|
15811
15811
|
* import { Console, Effect } from "effect"
|
|
@@ -15832,7 +15832,7 @@ export declare const clockWith: <A, E, R>(f: (clock: Clock) => Effect<A, E, R>)
|
|
|
15832
15832
|
* If no level is provided, the logger uses the fiber's current log level and
|
|
15833
15833
|
* extracts any `Cause` values from the message list.
|
|
15834
15834
|
*
|
|
15835
|
-
* **Example** (
|
|
15835
|
+
* **Example** (Logging at a dynamic level)
|
|
15836
15836
|
*
|
|
15837
15837
|
* ```ts
|
|
15838
15838
|
* import { Effect } from "effect"
|
|
@@ -15851,7 +15851,7 @@ export declare const logWithLevel: (level?: Severity) => (...message: ReadonlyAr
|
|
|
15851
15851
|
/**
|
|
15852
15852
|
* Logs one or more messages using the default log level.
|
|
15853
15853
|
*
|
|
15854
|
-
* **Example** (
|
|
15854
|
+
* **Example** (Logging at the default level)
|
|
15855
15855
|
*
|
|
15856
15856
|
* ```ts
|
|
15857
15857
|
* import { Effect } from "effect"
|
|
@@ -15879,7 +15879,7 @@ export declare const log: (...message: ReadonlyArray<any>) => Effect<void>;
|
|
|
15879
15879
|
/**
|
|
15880
15880
|
* Logs one or more messages at the FATAL level.
|
|
15881
15881
|
*
|
|
15882
|
-
* **Example** (
|
|
15882
|
+
* **Example** (Logging fatal messages)
|
|
15883
15883
|
*
|
|
15884
15884
|
* ```ts
|
|
15885
15885
|
* import { Effect } from "effect"
|
|
@@ -15908,7 +15908,7 @@ export declare const logFatal: (...message: ReadonlyArray<any>) => Effect<void>;
|
|
|
15908
15908
|
/**
|
|
15909
15909
|
* Logs one or more messages at the WARNING level.
|
|
15910
15910
|
*
|
|
15911
|
-
* **Example** (
|
|
15911
|
+
* **Example** (Logging warnings)
|
|
15912
15912
|
*
|
|
15913
15913
|
* ```ts
|
|
15914
15914
|
* import { Effect } from "effect"
|
|
@@ -15938,7 +15938,7 @@ export declare const logWarning: (...message: ReadonlyArray<any>) => Effect<void
|
|
|
15938
15938
|
/**
|
|
15939
15939
|
* Logs one or more messages at the ERROR level.
|
|
15940
15940
|
*
|
|
15941
|
-
* **Example** (
|
|
15941
|
+
* **Example** (Logging errors)
|
|
15942
15942
|
*
|
|
15943
15943
|
* ```ts
|
|
15944
15944
|
* import { Effect } from "effect"
|
|
@@ -15971,7 +15971,7 @@ export declare const logError: (...message: ReadonlyArray<any>) => Effect<void>;
|
|
|
15971
15971
|
/**
|
|
15972
15972
|
* Logs one or more messages at the INFO level.
|
|
15973
15973
|
*
|
|
15974
|
-
* **Example** (
|
|
15974
|
+
* **Example** (Logging information)
|
|
15975
15975
|
*
|
|
15976
15976
|
* ```ts
|
|
15977
15977
|
* import { Effect } from "effect"
|
|
@@ -15999,7 +15999,7 @@ export declare const logInfo: (...message: ReadonlyArray<any>) => Effect<void>;
|
|
|
15999
15999
|
/**
|
|
16000
16000
|
* Logs one or more messages at the DEBUG level.
|
|
16001
16001
|
*
|
|
16002
|
-
* **Example** (
|
|
16002
|
+
* **Example** (Logging debug messages)
|
|
16003
16003
|
*
|
|
16004
16004
|
* ```ts
|
|
16005
16005
|
* import { Effect } from "effect"
|
|
@@ -16028,7 +16028,7 @@ export declare const logDebug: (...message: ReadonlyArray<any>) => Effect<void>;
|
|
|
16028
16028
|
/**
|
|
16029
16029
|
* Logs one or more messages at the TRACE level.
|
|
16030
16030
|
*
|
|
16031
|
-
* **Example** (
|
|
16031
|
+
* **Example** (Logging trace messages)
|
|
16032
16032
|
*
|
|
16033
16033
|
* ```ts
|
|
16034
16034
|
* import { Effect } from "effect"
|
|
@@ -16060,7 +16060,7 @@ export declare const logTrace: (...message: ReadonlyArray<any>) => Effect<void>;
|
|
|
16060
16060
|
/**
|
|
16061
16061
|
* Adds a logger to the set of loggers which will output logs for this effect.
|
|
16062
16062
|
*
|
|
16063
|
-
* **Example** (
|
|
16063
|
+
* **Example** (Adding a logger to an effect)
|
|
16064
16064
|
*
|
|
16065
16065
|
* ```ts
|
|
16066
16066
|
* import { Effect, Logger } from "effect"
|
|
@@ -16089,7 +16089,7 @@ export declare const withLogger: (<Output>(logger: Logger<unknown, Output>) => <
|
|
|
16089
16089
|
/**
|
|
16090
16090
|
* Adds an annotation to each log line in this effect.
|
|
16091
16091
|
*
|
|
16092
|
-
* **Example** (
|
|
16092
|
+
* **Example** (Adding log annotations)
|
|
16093
16093
|
*
|
|
16094
16094
|
* ```ts
|
|
16095
16095
|
* import { Effect } from "effect"
|
|
@@ -16130,7 +16130,7 @@ export declare const annotateLogs: {
|
|
|
16130
16130
|
* `annotateLogsScoped` updates annotations for the entire current `Scope` and
|
|
16131
16131
|
* restores the previous annotations when the scope closes.
|
|
16132
16132
|
*
|
|
16133
|
-
* **Example** (
|
|
16133
|
+
* **Example** (Adding scoped log annotations)
|
|
16134
16134
|
*
|
|
16135
16135
|
* ```ts
|
|
16136
16136
|
* import { Effect } from "effect"
|
|
@@ -16157,7 +16157,7 @@ export declare const annotateLogsScoped: {
|
|
|
16157
16157
|
* `annotateLogsScoped` updates annotations for the entire current `Scope` and
|
|
16158
16158
|
* restores the previous annotations when the scope closes.
|
|
16159
16159
|
*
|
|
16160
|
-
* **Example** (
|
|
16160
|
+
* **Example** (Adding scoped log annotations)
|
|
16161
16161
|
*
|
|
16162
16162
|
* ```ts
|
|
16163
16163
|
* import { Effect } from "effect"
|
|
@@ -16184,7 +16184,7 @@ export declare const annotateLogsScoped: {
|
|
|
16184
16184
|
* `annotateLogsScoped` updates annotations for the entire current `Scope` and
|
|
16185
16185
|
* restores the previous annotations when the scope closes.
|
|
16186
16186
|
*
|
|
16187
|
-
* **Example** (
|
|
16187
|
+
* **Example** (Adding scoped log annotations)
|
|
16188
16188
|
*
|
|
16189
16189
|
* ```ts
|
|
16190
16190
|
* import { Effect } from "effect"
|
|
@@ -16208,7 +16208,7 @@ export declare const annotateLogsScoped: {
|
|
|
16208
16208
|
/**
|
|
16209
16209
|
* Adds a span to each log line in this effect.
|
|
16210
16210
|
*
|
|
16211
|
-
* **Example** (
|
|
16211
|
+
* **Example** (Adding a log span)
|
|
16212
16212
|
*
|
|
16213
16213
|
* ```ts
|
|
16214
16214
|
* import { Effect } from "effect"
|
|
@@ -16243,7 +16243,7 @@ export declare const withLogSpan: ((label: string) => <A, E, R>(effect: Effect<A
|
|
|
16243
16243
|
* Also accepts an optional function which can be used to map the `Exit` value
|
|
16244
16244
|
* of the `Effect` into a valid `Input` for the `Metric`.
|
|
16245
16245
|
*
|
|
16246
|
-
* **Example** (
|
|
16246
|
+
* **Example** (Incrementing a metric for each execution)
|
|
16247
16247
|
*
|
|
16248
16248
|
* ```ts
|
|
16249
16249
|
* import { Effect, Metric } from "effect"
|
|
@@ -16263,7 +16263,7 @@ export declare const withLogSpan: ((label: string) => <A, E, R>(effect: Effect<A
|
|
|
16263
16263
|
* )
|
|
16264
16264
|
* ```
|
|
16265
16265
|
*
|
|
16266
|
-
* **Example** (
|
|
16266
|
+
* **Example** (Mapping exits before updating a metric)
|
|
16267
16267
|
*
|
|
16268
16268
|
* ```ts
|
|
16269
16269
|
* import { Effect, Exit, Metric } from "effect"
|
|
@@ -16294,7 +16294,7 @@ export declare const track: {
|
|
|
16294
16294
|
* Also accepts an optional function which can be used to map the `Exit` value
|
|
16295
16295
|
* of the `Effect` into a valid `Input` for the `Metric`.
|
|
16296
16296
|
*
|
|
16297
|
-
* **Example** (
|
|
16297
|
+
* **Example** (Incrementing a metric for each execution)
|
|
16298
16298
|
*
|
|
16299
16299
|
* ```ts
|
|
16300
16300
|
* import { Effect, Metric } from "effect"
|
|
@@ -16314,7 +16314,7 @@ export declare const track: {
|
|
|
16314
16314
|
* )
|
|
16315
16315
|
* ```
|
|
16316
16316
|
*
|
|
16317
|
-
* **Example** (
|
|
16317
|
+
* **Example** (Mapping exits before updating a metric)
|
|
16318
16318
|
*
|
|
16319
16319
|
* ```ts
|
|
16320
16320
|
* import { Effect, Exit, Metric } from "effect"
|
|
@@ -16345,7 +16345,7 @@ export declare const track: {
|
|
|
16345
16345
|
* Also accepts an optional function which can be used to map the `Exit` value
|
|
16346
16346
|
* of the `Effect` into a valid `Input` for the `Metric`.
|
|
16347
16347
|
*
|
|
16348
|
-
* **Example** (
|
|
16348
|
+
* **Example** (Incrementing a metric for each execution)
|
|
16349
16349
|
*
|
|
16350
16350
|
* ```ts
|
|
16351
16351
|
* import { Effect, Metric } from "effect"
|
|
@@ -16365,7 +16365,7 @@ export declare const track: {
|
|
|
16365
16365
|
* )
|
|
16366
16366
|
* ```
|
|
16367
16367
|
*
|
|
16368
|
-
* **Example** (
|
|
16368
|
+
* **Example** (Mapping exits before updating a metric)
|
|
16369
16369
|
*
|
|
16370
16370
|
* ```ts
|
|
16371
16371
|
* import { Effect, Exit, Metric } from "effect"
|
|
@@ -16396,7 +16396,7 @@ export declare const track: {
|
|
|
16396
16396
|
* Also accepts an optional function which can be used to map the `Exit` value
|
|
16397
16397
|
* of the `Effect` into a valid `Input` for the `Metric`.
|
|
16398
16398
|
*
|
|
16399
|
-
* **Example** (
|
|
16399
|
+
* **Example** (Incrementing a metric for each execution)
|
|
16400
16400
|
*
|
|
16401
16401
|
* ```ts
|
|
16402
16402
|
* import { Effect, Metric } from "effect"
|
|
@@ -16416,7 +16416,7 @@ export declare const track: {
|
|
|
16416
16416
|
* )
|
|
16417
16417
|
* ```
|
|
16418
16418
|
*
|
|
16419
|
-
* **Example** (
|
|
16419
|
+
* **Example** (Mapping exits before updating a metric)
|
|
16420
16420
|
*
|
|
16421
16421
|
* ```ts
|
|
16422
16422
|
* import { Effect, Exit, Metric } from "effect"
|
|
@@ -16447,7 +16447,7 @@ export declare const track: {
|
|
|
16447
16447
|
* Also accepts an optional function which can be used to map the `Exit` value
|
|
16448
16448
|
* of the `Effect` into a valid `Input` for the `Metric`.
|
|
16449
16449
|
*
|
|
16450
|
-
* **Example** (
|
|
16450
|
+
* **Example** (Incrementing a metric for each execution)
|
|
16451
16451
|
*
|
|
16452
16452
|
* ```ts
|
|
16453
16453
|
* import { Effect, Metric } from "effect"
|
|
@@ -16467,7 +16467,7 @@ export declare const track: {
|
|
|
16467
16467
|
* )
|
|
16468
16468
|
* ```
|
|
16469
16469
|
*
|
|
16470
|
-
* **Example** (
|
|
16470
|
+
* **Example** (Mapping exits before updating a metric)
|
|
16471
16471
|
*
|
|
16472
16472
|
* ```ts
|
|
16473
16473
|
* import { Effect, Exit, Metric } from "effect"
|
|
@@ -16500,7 +16500,7 @@ export declare const track: {
|
|
|
16500
16500
|
* Also accepts an optional function which can be used to map the success value
|
|
16501
16501
|
* of the `Effect` into a valid `Input` for the `Metric`.
|
|
16502
16502
|
*
|
|
16503
|
-
* **Example** (
|
|
16503
|
+
* **Example** (Counting successful results)
|
|
16504
16504
|
*
|
|
16505
16505
|
* ```ts
|
|
16506
16506
|
* import { Effect, Metric } from "effect"
|
|
@@ -16519,7 +16519,7 @@ export declare const track: {
|
|
|
16519
16519
|
* )
|
|
16520
16520
|
* ```
|
|
16521
16521
|
*
|
|
16522
|
-
* **Example** (
|
|
16522
|
+
* **Example** (Mapping successes before tracking)
|
|
16523
16523
|
*
|
|
16524
16524
|
* ```ts
|
|
16525
16525
|
* import { Effect, Metric } from "effect"
|
|
@@ -16548,7 +16548,7 @@ export declare const trackSuccesses: {
|
|
|
16548
16548
|
* Also accepts an optional function which can be used to map the success value
|
|
16549
16549
|
* of the `Effect` into a valid `Input` for the `Metric`.
|
|
16550
16550
|
*
|
|
16551
|
-
* **Example** (
|
|
16551
|
+
* **Example** (Counting successful results)
|
|
16552
16552
|
*
|
|
16553
16553
|
* ```ts
|
|
16554
16554
|
* import { Effect, Metric } from "effect"
|
|
@@ -16567,7 +16567,7 @@ export declare const trackSuccesses: {
|
|
|
16567
16567
|
* )
|
|
16568
16568
|
* ```
|
|
16569
16569
|
*
|
|
16570
|
-
* **Example** (
|
|
16570
|
+
* **Example** (Mapping successes before tracking)
|
|
16571
16571
|
*
|
|
16572
16572
|
* ```ts
|
|
16573
16573
|
* import { Effect, Metric } from "effect"
|
|
@@ -16596,7 +16596,7 @@ export declare const trackSuccesses: {
|
|
|
16596
16596
|
* Also accepts an optional function which can be used to map the success value
|
|
16597
16597
|
* of the `Effect` into a valid `Input` for the `Metric`.
|
|
16598
16598
|
*
|
|
16599
|
-
* **Example** (
|
|
16599
|
+
* **Example** (Counting successful results)
|
|
16600
16600
|
*
|
|
16601
16601
|
* ```ts
|
|
16602
16602
|
* import { Effect, Metric } from "effect"
|
|
@@ -16615,7 +16615,7 @@ export declare const trackSuccesses: {
|
|
|
16615
16615
|
* )
|
|
16616
16616
|
* ```
|
|
16617
16617
|
*
|
|
16618
|
-
* **Example** (
|
|
16618
|
+
* **Example** (Mapping successes before tracking)
|
|
16619
16619
|
*
|
|
16620
16620
|
* ```ts
|
|
16621
16621
|
* import { Effect, Metric } from "effect"
|
|
@@ -16644,7 +16644,7 @@ export declare const trackSuccesses: {
|
|
|
16644
16644
|
* Also accepts an optional function which can be used to map the success value
|
|
16645
16645
|
* of the `Effect` into a valid `Input` for the `Metric`.
|
|
16646
16646
|
*
|
|
16647
|
-
* **Example** (
|
|
16647
|
+
* **Example** (Counting successful results)
|
|
16648
16648
|
*
|
|
16649
16649
|
* ```ts
|
|
16650
16650
|
* import { Effect, Metric } from "effect"
|
|
@@ -16663,7 +16663,7 @@ export declare const trackSuccesses: {
|
|
|
16663
16663
|
* )
|
|
16664
16664
|
* ```
|
|
16665
16665
|
*
|
|
16666
|
-
* **Example** (
|
|
16666
|
+
* **Example** (Mapping successes before tracking)
|
|
16667
16667
|
*
|
|
16668
16668
|
* ```ts
|
|
16669
16669
|
* import { Effect, Metric } from "effect"
|
|
@@ -16692,7 +16692,7 @@ export declare const trackSuccesses: {
|
|
|
16692
16692
|
* Also accepts an optional function which can be used to map the success value
|
|
16693
16693
|
* of the `Effect` into a valid `Input` for the `Metric`.
|
|
16694
16694
|
*
|
|
16695
|
-
* **Example** (
|
|
16695
|
+
* **Example** (Counting successful results)
|
|
16696
16696
|
*
|
|
16697
16697
|
* ```ts
|
|
16698
16698
|
* import { Effect, Metric } from "effect"
|
|
@@ -16711,7 +16711,7 @@ export declare const trackSuccesses: {
|
|
|
16711
16711
|
* )
|
|
16712
16712
|
* ```
|
|
16713
16713
|
*
|
|
16714
|
-
* **Example** (
|
|
16714
|
+
* **Example** (Mapping successes before tracking)
|
|
16715
16715
|
*
|
|
16716
16716
|
* ```ts
|
|
16717
16717
|
* import { Effect, Metric } from "effect"
|
|
@@ -16741,7 +16741,7 @@ export declare const trackSuccesses: {
|
|
|
16741
16741
|
* Also accepts an optional function which can be used to map the error value
|
|
16742
16742
|
* of the `Effect` into a valid `Input` for the `Metric`.
|
|
16743
16743
|
*
|
|
16744
|
-
* **Example** (
|
|
16744
|
+
* **Example** (Counting expected failures)
|
|
16745
16745
|
*
|
|
16746
16746
|
* ```ts
|
|
16747
16747
|
* import { Effect, Metric } from "effect"
|
|
@@ -16760,7 +16760,7 @@ export declare const trackSuccesses: {
|
|
|
16760
16760
|
* )
|
|
16761
16761
|
* ```
|
|
16762
16762
|
*
|
|
16763
|
-
* **Example** (
|
|
16763
|
+
* **Example** (Mapping errors before tracking)
|
|
16764
16764
|
*
|
|
16765
16765
|
* ```ts
|
|
16766
16766
|
* import { Data, Effect, Metric } from "effect"
|
|
@@ -16791,7 +16791,7 @@ export declare const trackErrors: {
|
|
|
16791
16791
|
* Also accepts an optional function which can be used to map the error value
|
|
16792
16792
|
* of the `Effect` into a valid `Input` for the `Metric`.
|
|
16793
16793
|
*
|
|
16794
|
-
* **Example** (
|
|
16794
|
+
* **Example** (Counting expected failures)
|
|
16795
16795
|
*
|
|
16796
16796
|
* ```ts
|
|
16797
16797
|
* import { Effect, Metric } from "effect"
|
|
@@ -16810,7 +16810,7 @@ export declare const trackErrors: {
|
|
|
16810
16810
|
* )
|
|
16811
16811
|
* ```
|
|
16812
16812
|
*
|
|
16813
|
-
* **Example** (
|
|
16813
|
+
* **Example** (Mapping errors before tracking)
|
|
16814
16814
|
*
|
|
16815
16815
|
* ```ts
|
|
16816
16816
|
* import { Data, Effect, Metric } from "effect"
|
|
@@ -16841,7 +16841,7 @@ export declare const trackErrors: {
|
|
|
16841
16841
|
* Also accepts an optional function which can be used to map the error value
|
|
16842
16842
|
* of the `Effect` into a valid `Input` for the `Metric`.
|
|
16843
16843
|
*
|
|
16844
|
-
* **Example** (
|
|
16844
|
+
* **Example** (Counting expected failures)
|
|
16845
16845
|
*
|
|
16846
16846
|
* ```ts
|
|
16847
16847
|
* import { Effect, Metric } from "effect"
|
|
@@ -16860,7 +16860,7 @@ export declare const trackErrors: {
|
|
|
16860
16860
|
* )
|
|
16861
16861
|
* ```
|
|
16862
16862
|
*
|
|
16863
|
-
* **Example** (
|
|
16863
|
+
* **Example** (Mapping errors before tracking)
|
|
16864
16864
|
*
|
|
16865
16865
|
* ```ts
|
|
16866
16866
|
* import { Data, Effect, Metric } from "effect"
|
|
@@ -16891,7 +16891,7 @@ export declare const trackErrors: {
|
|
|
16891
16891
|
* Also accepts an optional function which can be used to map the error value
|
|
16892
16892
|
* of the `Effect` into a valid `Input` for the `Metric`.
|
|
16893
16893
|
*
|
|
16894
|
-
* **Example** (
|
|
16894
|
+
* **Example** (Counting expected failures)
|
|
16895
16895
|
*
|
|
16896
16896
|
* ```ts
|
|
16897
16897
|
* import { Effect, Metric } from "effect"
|
|
@@ -16910,7 +16910,7 @@ export declare const trackErrors: {
|
|
|
16910
16910
|
* )
|
|
16911
16911
|
* ```
|
|
16912
16912
|
*
|
|
16913
|
-
* **Example** (
|
|
16913
|
+
* **Example** (Mapping errors before tracking)
|
|
16914
16914
|
*
|
|
16915
16915
|
* ```ts
|
|
16916
16916
|
* import { Data, Effect, Metric } from "effect"
|
|
@@ -16941,7 +16941,7 @@ export declare const trackErrors: {
|
|
|
16941
16941
|
* Also accepts an optional function which can be used to map the error value
|
|
16942
16942
|
* of the `Effect` into a valid `Input` for the `Metric`.
|
|
16943
16943
|
*
|
|
16944
|
-
* **Example** (
|
|
16944
|
+
* **Example** (Counting expected failures)
|
|
16945
16945
|
*
|
|
16946
16946
|
* ```ts
|
|
16947
16947
|
* import { Effect, Metric } from "effect"
|
|
@@ -16960,7 +16960,7 @@ export declare const trackErrors: {
|
|
|
16960
16960
|
* )
|
|
16961
16961
|
* ```
|
|
16962
16962
|
*
|
|
16963
|
-
* **Example** (
|
|
16963
|
+
* **Example** (Mapping errors before tracking)
|
|
16964
16964
|
*
|
|
16965
16965
|
* ```ts
|
|
16966
16966
|
* import { Data, Effect, Metric } from "effect"
|
|
@@ -16992,7 +16992,7 @@ export declare const trackErrors: {
|
|
|
16992
16992
|
* Also accepts an optional function which can be used to map the defect value
|
|
16993
16993
|
* of the `Effect` into a valid `Input` for the `Metric`.
|
|
16994
16994
|
*
|
|
16995
|
-
* **Example** (
|
|
16995
|
+
* **Example** (Counting defects)
|
|
16996
16996
|
*
|
|
16997
16997
|
* ```ts
|
|
16998
16998
|
* import { Effect, Metric } from "effect"
|
|
@@ -17011,7 +17011,7 @@ export declare const trackErrors: {
|
|
|
17011
17011
|
* )
|
|
17012
17012
|
* ```
|
|
17013
17013
|
*
|
|
17014
|
-
* **Example** (
|
|
17014
|
+
* **Example** (Mapping defects before tracking)
|
|
17015
17015
|
*
|
|
17016
17016
|
* ```ts
|
|
17017
17017
|
* import { Effect, Metric } from "effect"
|
|
@@ -17043,7 +17043,7 @@ export declare const trackDefects: {
|
|
|
17043
17043
|
* Also accepts an optional function which can be used to map the defect value
|
|
17044
17044
|
* of the `Effect` into a valid `Input` for the `Metric`.
|
|
17045
17045
|
*
|
|
17046
|
-
* **Example** (
|
|
17046
|
+
* **Example** (Counting defects)
|
|
17047
17047
|
*
|
|
17048
17048
|
* ```ts
|
|
17049
17049
|
* import { Effect, Metric } from "effect"
|
|
@@ -17062,7 +17062,7 @@ export declare const trackDefects: {
|
|
|
17062
17062
|
* )
|
|
17063
17063
|
* ```
|
|
17064
17064
|
*
|
|
17065
|
-
* **Example** (
|
|
17065
|
+
* **Example** (Mapping defects before tracking)
|
|
17066
17066
|
*
|
|
17067
17067
|
* ```ts
|
|
17068
17068
|
* import { Effect, Metric } from "effect"
|
|
@@ -17094,7 +17094,7 @@ export declare const trackDefects: {
|
|
|
17094
17094
|
* Also accepts an optional function which can be used to map the defect value
|
|
17095
17095
|
* of the `Effect` into a valid `Input` for the `Metric`.
|
|
17096
17096
|
*
|
|
17097
|
-
* **Example** (
|
|
17097
|
+
* **Example** (Counting defects)
|
|
17098
17098
|
*
|
|
17099
17099
|
* ```ts
|
|
17100
17100
|
* import { Effect, Metric } from "effect"
|
|
@@ -17113,7 +17113,7 @@ export declare const trackDefects: {
|
|
|
17113
17113
|
* )
|
|
17114
17114
|
* ```
|
|
17115
17115
|
*
|
|
17116
|
-
* **Example** (
|
|
17116
|
+
* **Example** (Mapping defects before tracking)
|
|
17117
17117
|
*
|
|
17118
17118
|
* ```ts
|
|
17119
17119
|
* import { Effect, Metric } from "effect"
|
|
@@ -17145,7 +17145,7 @@ export declare const trackDefects: {
|
|
|
17145
17145
|
* Also accepts an optional function which can be used to map the defect value
|
|
17146
17146
|
* of the `Effect` into a valid `Input` for the `Metric`.
|
|
17147
17147
|
*
|
|
17148
|
-
* **Example** (
|
|
17148
|
+
* **Example** (Counting defects)
|
|
17149
17149
|
*
|
|
17150
17150
|
* ```ts
|
|
17151
17151
|
* import { Effect, Metric } from "effect"
|
|
@@ -17164,7 +17164,7 @@ export declare const trackDefects: {
|
|
|
17164
17164
|
* )
|
|
17165
17165
|
* ```
|
|
17166
17166
|
*
|
|
17167
|
-
* **Example** (
|
|
17167
|
+
* **Example** (Mapping defects before tracking)
|
|
17168
17168
|
*
|
|
17169
17169
|
* ```ts
|
|
17170
17170
|
* import { Effect, Metric } from "effect"
|
|
@@ -17196,7 +17196,7 @@ export declare const trackDefects: {
|
|
|
17196
17196
|
* Also accepts an optional function which can be used to map the defect value
|
|
17197
17197
|
* of the `Effect` into a valid `Input` for the `Metric`.
|
|
17198
17198
|
*
|
|
17199
|
-
* **Example** (
|
|
17199
|
+
* **Example** (Counting defects)
|
|
17200
17200
|
*
|
|
17201
17201
|
* ```ts
|
|
17202
17202
|
* import { Effect, Metric } from "effect"
|
|
@@ -17215,7 +17215,7 @@ export declare const trackDefects: {
|
|
|
17215
17215
|
* )
|
|
17216
17216
|
* ```
|
|
17217
17217
|
*
|
|
17218
|
-
* **Example** (
|
|
17218
|
+
* **Example** (Mapping defects before tracking)
|
|
17219
17219
|
*
|
|
17220
17220
|
* ```ts
|
|
17221
17221
|
* import { Effect, Metric } from "effect"
|
|
@@ -17249,7 +17249,7 @@ export declare const trackDefects: {
|
|
|
17249
17249
|
* that the wrapped `Effect` took to complete into a valid `Input` for the
|
|
17250
17250
|
* `Metric`.
|
|
17251
17251
|
*
|
|
17252
|
-
* **Example** (
|
|
17252
|
+
* **Example** (Recording execution duration)
|
|
17253
17253
|
*
|
|
17254
17254
|
* ```ts
|
|
17255
17255
|
* import { Effect, Metric } from "effect"
|
|
@@ -17266,7 +17266,7 @@ export declare const trackDefects: {
|
|
|
17266
17266
|
* )
|
|
17267
17267
|
* ```
|
|
17268
17268
|
*
|
|
17269
|
-
* **Example** (
|
|
17269
|
+
* **Example** (Mapping duration before tracking)
|
|
17270
17270
|
*
|
|
17271
17271
|
* ```ts
|
|
17272
17272
|
* import { Duration, Effect, Metric } from "effect"
|
|
@@ -17296,7 +17296,7 @@ export declare const trackDuration: {
|
|
|
17296
17296
|
* that the wrapped `Effect` took to complete into a valid `Input` for the
|
|
17297
17297
|
* `Metric`.
|
|
17298
17298
|
*
|
|
17299
|
-
* **Example** (
|
|
17299
|
+
* **Example** (Recording execution duration)
|
|
17300
17300
|
*
|
|
17301
17301
|
* ```ts
|
|
17302
17302
|
* import { Effect, Metric } from "effect"
|
|
@@ -17313,7 +17313,7 @@ export declare const trackDuration: {
|
|
|
17313
17313
|
* )
|
|
17314
17314
|
* ```
|
|
17315
17315
|
*
|
|
17316
|
-
* **Example** (
|
|
17316
|
+
* **Example** (Mapping duration before tracking)
|
|
17317
17317
|
*
|
|
17318
17318
|
* ```ts
|
|
17319
17319
|
* import { Duration, Effect, Metric } from "effect"
|
|
@@ -17343,7 +17343,7 @@ export declare const trackDuration: {
|
|
|
17343
17343
|
* that the wrapped `Effect` took to complete into a valid `Input` for the
|
|
17344
17344
|
* `Metric`.
|
|
17345
17345
|
*
|
|
17346
|
-
* **Example** (
|
|
17346
|
+
* **Example** (Recording execution duration)
|
|
17347
17347
|
*
|
|
17348
17348
|
* ```ts
|
|
17349
17349
|
* import { Effect, Metric } from "effect"
|
|
@@ -17360,7 +17360,7 @@ export declare const trackDuration: {
|
|
|
17360
17360
|
* )
|
|
17361
17361
|
* ```
|
|
17362
17362
|
*
|
|
17363
|
-
* **Example** (
|
|
17363
|
+
* **Example** (Mapping duration before tracking)
|
|
17364
17364
|
*
|
|
17365
17365
|
* ```ts
|
|
17366
17366
|
* import { Duration, Effect, Metric } from "effect"
|
|
@@ -17390,7 +17390,7 @@ export declare const trackDuration: {
|
|
|
17390
17390
|
* that the wrapped `Effect` took to complete into a valid `Input` for the
|
|
17391
17391
|
* `Metric`.
|
|
17392
17392
|
*
|
|
17393
|
-
* **Example** (
|
|
17393
|
+
* **Example** (Recording execution duration)
|
|
17394
17394
|
*
|
|
17395
17395
|
* ```ts
|
|
17396
17396
|
* import { Effect, Metric } from "effect"
|
|
@@ -17407,7 +17407,7 @@ export declare const trackDuration: {
|
|
|
17407
17407
|
* )
|
|
17408
17408
|
* ```
|
|
17409
17409
|
*
|
|
17410
|
-
* **Example** (
|
|
17410
|
+
* **Example** (Mapping duration before tracking)
|
|
17411
17411
|
*
|
|
17412
17412
|
* ```ts
|
|
17413
17413
|
* import { Duration, Effect, Metric } from "effect"
|
|
@@ -17437,7 +17437,7 @@ export declare const trackDuration: {
|
|
|
17437
17437
|
* that the wrapped `Effect` took to complete into a valid `Input` for the
|
|
17438
17438
|
* `Metric`.
|
|
17439
17439
|
*
|
|
17440
|
-
* **Example** (
|
|
17440
|
+
* **Example** (Recording execution duration)
|
|
17441
17441
|
*
|
|
17442
17442
|
* ```ts
|
|
17443
17443
|
* import { Effect, Metric } from "effect"
|
|
@@ -17454,7 +17454,7 @@ export declare const trackDuration: {
|
|
|
17454
17454
|
* )
|
|
17455
17455
|
* ```
|
|
17456
17456
|
*
|
|
17457
|
-
* **Example** (
|
|
17457
|
+
* **Example** (Mapping duration before tracking)
|
|
17458
17458
|
*
|
|
17459
17459
|
* ```ts
|
|
17460
17460
|
* import { Duration, Effect, Metric } from "effect"
|
|
@@ -17490,7 +17490,7 @@ declare const Transaction_base: Context.ServiceClass<Transaction, "effect/Effect
|
|
|
17490
17490
|
* - a journal that stores any non committed change to TxRef values
|
|
17491
17491
|
* - a retry flag to know if the transaction should be retried
|
|
17492
17492
|
*
|
|
17493
|
-
* **Example** (
|
|
17493
|
+
* **Example** (Building transactions)
|
|
17494
17494
|
*
|
|
17495
17495
|
* ```ts
|
|
17496
17496
|
* import { Effect } from "effect"
|
|
@@ -17526,7 +17526,7 @@ export declare class Transaction extends Transaction_base {
|
|
|
17526
17526
|
* The outermost `tx` call creates the transaction boundary and commits or rolls back the full
|
|
17527
17527
|
* composed transaction.
|
|
17528
17528
|
*
|
|
17529
|
-
* **Example** (
|
|
17529
|
+
* **Example** (Running a transaction)
|
|
17530
17530
|
*
|
|
17531
17531
|
* ```ts
|
|
17532
17532
|
* import { Effect, TxRef } from "effect"
|
|
@@ -17560,7 +17560,7 @@ export declare const tx: <A, E, R>(effect: Effect<A, E, R>) => Effect<A, E, Excl
|
|
|
17560
17560
|
* @category Transactions
|
|
17561
17561
|
* @since 4.0.0
|
|
17562
17562
|
*
|
|
17563
|
-
* **Example** (
|
|
17563
|
+
* **Example** (Retrying transactions)
|
|
17564
17564
|
*
|
|
17565
17565
|
* ```ts
|
|
17566
17566
|
* import { Effect, TxRef } from "effect"
|
|
@@ -17823,7 +17823,7 @@ export declare namespace Effectify {
|
|
|
17823
17823
|
* callback errors and `onSyncError` to turn synchronous throws into typed
|
|
17824
17824
|
* failures; otherwise synchronous throws become defects.
|
|
17825
17825
|
*
|
|
17826
|
-
* **Example** (
|
|
17826
|
+
* **Example** (Converting callbacks to effects)
|
|
17827
17827
|
*
|
|
17828
17828
|
* ```ts
|
|
17829
17829
|
* import { Effect } from "effect"
|
|
@@ -17839,7 +17839,7 @@ export declare namespace Effectify {
|
|
|
17839
17839
|
* // Output: contents of package.json
|
|
17840
17840
|
* ```
|
|
17841
17841
|
*
|
|
17842
|
-
* **Example** (
|
|
17842
|
+
* **Example** (Mapping callback errors to typed failures)
|
|
17843
17843
|
*
|
|
17844
17844
|
* ```ts
|
|
17845
17845
|
* import { Effect } from "effect"
|
|
@@ -17872,7 +17872,7 @@ export declare const effectify: {
|
|
|
17872
17872
|
* callback errors and `onSyncError` to turn synchronous throws into typed
|
|
17873
17873
|
* failures; otherwise synchronous throws become defects.
|
|
17874
17874
|
*
|
|
17875
|
-
* **Example** (
|
|
17875
|
+
* **Example** (Converting callbacks to effects)
|
|
17876
17876
|
*
|
|
17877
17877
|
* ```ts
|
|
17878
17878
|
* import { Effect } from "effect"
|
|
@@ -17888,7 +17888,7 @@ export declare const effectify: {
|
|
|
17888
17888
|
* // Output: contents of package.json
|
|
17889
17889
|
* ```
|
|
17890
17890
|
*
|
|
17891
|
-
* **Example** (
|
|
17891
|
+
* **Example** (Mapping callback errors to typed failures)
|
|
17892
17892
|
*
|
|
17893
17893
|
* ```ts
|
|
17894
17894
|
* import { Effect } from "effect"
|
|
@@ -17921,7 +17921,7 @@ export declare const effectify: {
|
|
|
17921
17921
|
* callback errors and `onSyncError` to turn synchronous throws into typed
|
|
17922
17922
|
* failures; otherwise synchronous throws become defects.
|
|
17923
17923
|
*
|
|
17924
|
-
* **Example** (
|
|
17924
|
+
* **Example** (Converting callbacks to effects)
|
|
17925
17925
|
*
|
|
17926
17926
|
* ```ts
|
|
17927
17927
|
* import { Effect } from "effect"
|
|
@@ -17937,7 +17937,7 @@ export declare const effectify: {
|
|
|
17937
17937
|
* // Output: contents of package.json
|
|
17938
17938
|
* ```
|
|
17939
17939
|
*
|
|
17940
|
-
* **Example** (
|
|
17940
|
+
* **Example** (Mapping callback errors to typed failures)
|
|
17941
17941
|
*
|
|
17942
17942
|
* ```ts
|
|
17943
17943
|
* import { Effect } from "effect"
|
|
@@ -17970,7 +17970,7 @@ export declare const effectify: {
|
|
|
17970
17970
|
* callback errors and `onSyncError` to turn synchronous throws into typed
|
|
17971
17971
|
* failures; otherwise synchronous throws become defects.
|
|
17972
17972
|
*
|
|
17973
|
-
* **Example** (
|
|
17973
|
+
* **Example** (Converting callbacks to effects)
|
|
17974
17974
|
*
|
|
17975
17975
|
* ```ts
|
|
17976
17976
|
* import { Effect } from "effect"
|
|
@@ -17986,7 +17986,7 @@ export declare const effectify: {
|
|
|
17986
17986
|
* // Output: contents of package.json
|
|
17987
17987
|
* ```
|
|
17988
17988
|
*
|
|
17989
|
-
* **Example** (
|
|
17989
|
+
* **Example** (Mapping callback errors to typed failures)
|
|
17990
17990
|
*
|
|
17991
17991
|
* ```ts
|
|
17992
17992
|
* import { Effect } from "effect"
|
|
@@ -18014,7 +18014,7 @@ export declare const effectify: {
|
|
|
18014
18014
|
* This function provides compile-time type checking to ensure that the success
|
|
18015
18015
|
* value of an effect conforms to a specific type constraint.
|
|
18016
18016
|
*
|
|
18017
|
-
* **Example** (
|
|
18017
|
+
* **Example** (Constraining the success type)
|
|
18018
18018
|
*
|
|
18019
18019
|
* ```ts
|
|
18020
18020
|
* import { Effect } from "effect"
|
|
@@ -18041,7 +18041,7 @@ export declare const satisfiesSuccessType: <A>() => <A2 extends A, E, R>(effect:
|
|
|
18041
18041
|
* This function provides compile-time type checking to ensure that the error
|
|
18042
18042
|
* type of an effect conforms to a specific type constraint.
|
|
18043
18043
|
*
|
|
18044
|
-
* **Example** (
|
|
18044
|
+
* **Example** (Constraining the error type)
|
|
18045
18045
|
*
|
|
18046
18046
|
* ```ts
|
|
18047
18047
|
* import { Data, Effect } from "effect"
|
|
@@ -18070,7 +18070,7 @@ export declare const satisfiesErrorType: <E>() => <A, E2 extends E, R>(effect: E
|
|
|
18070
18070
|
* This function provides compile-time type checking to ensure that the
|
|
18071
18071
|
* requirements (context) type of an effect conforms to a specific type constraint.
|
|
18072
18072
|
*
|
|
18073
|
-
* **Example** (
|
|
18073
|
+
* **Example** (Constraining the services type)
|
|
18074
18074
|
*
|
|
18075
18075
|
* ```ts
|
|
18076
18076
|
* import { Effect } from "effect"
|
|
@@ -18107,7 +18107,7 @@ export declare const satisfiesServicesType: <R>() => <A, E, R2 extends R>(effect
|
|
|
18107
18107
|
* - For **Failure effects**: Returns the failure as-is without applying the mapping
|
|
18108
18108
|
* - For **Pending effects**: Falls back to the regular `map` behavior
|
|
18109
18109
|
*
|
|
18110
|
-
* **Example** (
|
|
18110
|
+
* **Example** (Mapping already completed effects)
|
|
18111
18111
|
*
|
|
18112
18112
|
* ```ts
|
|
18113
18113
|
* import { Effect } from "effect"
|
|
@@ -18141,7 +18141,7 @@ export declare const mapEager: {
|
|
|
18141
18141
|
* - For **Failure effects**: Returns the failure as-is without applying the mapping
|
|
18142
18142
|
* - For **Pending effects**: Falls back to the regular `map` behavior
|
|
18143
18143
|
*
|
|
18144
|
-
* **Example** (
|
|
18144
|
+
* **Example** (Mapping already completed effects)
|
|
18145
18145
|
*
|
|
18146
18146
|
* ```ts
|
|
18147
18147
|
* import { Effect } from "effect"
|
|
@@ -18175,7 +18175,7 @@ export declare const mapEager: {
|
|
|
18175
18175
|
* - For **Failure effects**: Returns the failure as-is without applying the mapping
|
|
18176
18176
|
* - For **Pending effects**: Falls back to the regular `map` behavior
|
|
18177
18177
|
*
|
|
18178
|
-
* **Example** (
|
|
18178
|
+
* **Example** (Mapping already completed effects)
|
|
18179
18179
|
*
|
|
18180
18180
|
* ```ts
|
|
18181
18181
|
* import { Effect } from "effect"
|
|
@@ -18210,7 +18210,7 @@ export declare const mapEager: {
|
|
|
18210
18210
|
* - For **Failure effects**: Applies the mapping function immediately to the error
|
|
18211
18211
|
* - For **Pending effects**: Falls back to the regular `mapError` behavior
|
|
18212
18212
|
*
|
|
18213
|
-
* **Example** (
|
|
18213
|
+
* **Example** (Mapping errors eagerly when possible)
|
|
18214
18214
|
*
|
|
18215
18215
|
* ```ts
|
|
18216
18216
|
* import { Effect } from "effect"
|
|
@@ -18247,7 +18247,7 @@ export declare const mapErrorEager: {
|
|
|
18247
18247
|
* - For **Failure effects**: Applies the mapping function immediately to the error
|
|
18248
18248
|
* - For **Pending effects**: Falls back to the regular `mapError` behavior
|
|
18249
18249
|
*
|
|
18250
|
-
* **Example** (
|
|
18250
|
+
* **Example** (Mapping errors eagerly when possible)
|
|
18251
18251
|
*
|
|
18252
18252
|
* ```ts
|
|
18253
18253
|
* import { Effect } from "effect"
|
|
@@ -18284,7 +18284,7 @@ export declare const mapErrorEager: {
|
|
|
18284
18284
|
* - For **Failure effects**: Applies the mapping function immediately to the error
|
|
18285
18285
|
* - For **Pending effects**: Falls back to the regular `mapError` behavior
|
|
18286
18286
|
*
|
|
18287
|
-
* **Example** (
|
|
18287
|
+
* **Example** (Mapping errors eagerly when possible)
|
|
18288
18288
|
*
|
|
18289
18289
|
* ```ts
|
|
18290
18290
|
* import { Effect } from "effect"
|
|
@@ -18322,7 +18322,7 @@ export declare const mapErrorEager: {
|
|
|
18322
18322
|
* - For **Failure effects**: Applies the `onFailure` function immediately to the error
|
|
18323
18323
|
* - For **Pending effects**: Falls back to the regular `mapBoth` behavior
|
|
18324
18324
|
*
|
|
18325
|
-
* **Example** (
|
|
18325
|
+
* **Example** (Mapping both channels eagerly when possible)
|
|
18326
18326
|
*
|
|
18327
18327
|
* ```ts
|
|
18328
18328
|
* import { Effect } from "effect"
|
|
@@ -18361,7 +18361,7 @@ export declare const mapBothEager: {
|
|
|
18361
18361
|
* - For **Failure effects**: Applies the `onFailure` function immediately to the error
|
|
18362
18362
|
* - For **Pending effects**: Falls back to the regular `mapBoth` behavior
|
|
18363
18363
|
*
|
|
18364
|
-
* **Example** (
|
|
18364
|
+
* **Example** (Mapping both channels eagerly when possible)
|
|
18365
18365
|
*
|
|
18366
18366
|
* ```ts
|
|
18367
18367
|
* import { Effect } from "effect"
|
|
@@ -18403,7 +18403,7 @@ export declare const mapBothEager: {
|
|
|
18403
18403
|
* - For **Failure effects**: Applies the `onFailure` function immediately to the error
|
|
18404
18404
|
* - For **Pending effects**: Falls back to the regular `mapBoth` behavior
|
|
18405
18405
|
*
|
|
18406
|
-
* **Example** (
|
|
18406
|
+
* **Example** (Mapping both channels eagerly when possible)
|
|
18407
18407
|
*
|
|
18408
18408
|
* ```ts
|
|
18409
18409
|
* import { Effect } from "effect"
|
|
@@ -18446,7 +18446,7 @@ export declare const mapBothEager: {
|
|
|
18446
18446
|
* - For **Failure effects**: Returns the failure as-is without applying the flatMap
|
|
18447
18447
|
* - For **Pending effects**: Falls back to the regular `flatMap` behavior
|
|
18448
18448
|
*
|
|
18449
|
-
* **Example** (
|
|
18449
|
+
* **Example** (Flat mapping eagerly when possible)
|
|
18450
18450
|
*
|
|
18451
18451
|
* ```ts
|
|
18452
18452
|
* import { Effect } from "effect"
|
|
@@ -18483,7 +18483,7 @@ export declare const flatMapEager: {
|
|
|
18483
18483
|
* - For **Failure effects**: Returns the failure as-is without applying the flatMap
|
|
18484
18484
|
* - For **Pending effects**: Falls back to the regular `flatMap` behavior
|
|
18485
18485
|
*
|
|
18486
|
-
* **Example** (
|
|
18486
|
+
* **Example** (Flat mapping eagerly when possible)
|
|
18487
18487
|
*
|
|
18488
18488
|
* ```ts
|
|
18489
18489
|
* import { Effect } from "effect"
|
|
@@ -18520,7 +18520,7 @@ export declare const flatMapEager: {
|
|
|
18520
18520
|
* - For **Failure effects**: Returns the failure as-is without applying the flatMap
|
|
18521
18521
|
* - For **Pending effects**: Falls back to the regular `flatMap` behavior
|
|
18522
18522
|
*
|
|
18523
|
-
* **Example** (
|
|
18523
|
+
* **Example** (Flat mapping eagerly when possible)
|
|
18524
18524
|
*
|
|
18525
18525
|
* ```ts
|
|
18526
18526
|
* import { Effect } from "effect"
|
|
@@ -18558,7 +18558,7 @@ export declare const flatMapEager: {
|
|
|
18558
18558
|
* - For **Failure effects**: Applies the catch function immediately to the error
|
|
18559
18559
|
* - For **Pending effects**: Falls back to the regular `catch` behavior
|
|
18560
18560
|
*
|
|
18561
|
-
* **Example** (
|
|
18561
|
+
* **Example** (Catching failures eagerly when possible)
|
|
18562
18562
|
*
|
|
18563
18563
|
* ```ts
|
|
18564
18564
|
* import { Effect } from "effect"
|
|
@@ -18605,7 +18605,7 @@ export declare const catchEager: {
|
|
|
18605
18605
|
* - For **Failure effects**: Applies the catch function immediately to the error
|
|
18606
18606
|
* - For **Pending effects**: Falls back to the regular `catch` behavior
|
|
18607
18607
|
*
|
|
18608
|
-
* **Example** (
|
|
18608
|
+
* **Example** (Catching failures eagerly when possible)
|
|
18609
18609
|
*
|
|
18610
18610
|
* ```ts
|
|
18611
18611
|
* import { Effect } from "effect"
|
|
@@ -18652,7 +18652,7 @@ export declare const catchEager: {
|
|
|
18652
18652
|
* - For **Failure effects**: Applies the catch function immediately to the error
|
|
18653
18653
|
* - For **Pending effects**: Falls back to the regular `catch` behavior
|
|
18654
18654
|
*
|
|
18655
|
-
* **Example** (
|
|
18655
|
+
* **Example** (Catching failures eagerly when possible)
|
|
18656
18656
|
*
|
|
18657
18657
|
* ```ts
|
|
18658
18658
|
* import { Effect } from "effect"
|
|
@@ -18690,7 +18690,7 @@ export declare const catchEager: {
|
|
|
18690
18690
|
* Executes generator functions eagerly when all yielded effects are synchronous,
|
|
18691
18691
|
* stopping at the first async effect and deferring to normal execution.
|
|
18692
18692
|
*
|
|
18693
|
-
* **Example** (
|
|
18693
|
+
* **Example** (Defining eager untraced effect functions)
|
|
18694
18694
|
*
|
|
18695
18695
|
* ```ts
|
|
18696
18696
|
* import { Effect } from "effect"
|