effect 3.11.1 → 3.11.3

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.
Files changed (56) hide show
  1. package/dist/cjs/Arbitrary.js +18 -8
  2. package/dist/cjs/Arbitrary.js.map +1 -1
  3. package/dist/cjs/BigDecimal.js +4 -0
  4. package/dist/cjs/BigDecimal.js.map +1 -1
  5. package/dist/cjs/Context.js +47 -6
  6. package/dist/cjs/Context.js.map +1 -1
  7. package/dist/cjs/Effect.js +25 -5
  8. package/dist/cjs/Effect.js.map +1 -1
  9. package/dist/cjs/JSONSchema.js +1 -0
  10. package/dist/cjs/JSONSchema.js.map +1 -1
  11. package/dist/cjs/Micro.js +108 -90
  12. package/dist/cjs/Micro.js.map +1 -1
  13. package/dist/cjs/Schema.js +75 -42
  14. package/dist/cjs/Schema.js.map +1 -1
  15. package/dist/cjs/SchemaAST.js +91 -22
  16. package/dist/cjs/SchemaAST.js.map +1 -1
  17. package/dist/cjs/internal/version.js +1 -1
  18. package/dist/dts/BigDecimal.d.ts +4 -0
  19. package/dist/dts/BigDecimal.d.ts.map +1 -1
  20. package/dist/dts/Context.d.ts +47 -6
  21. package/dist/dts/Context.d.ts.map +1 -1
  22. package/dist/dts/Effect.d.ts +25 -5
  23. package/dist/dts/Effect.d.ts.map +1 -1
  24. package/dist/dts/Micro.d.ts +164 -131
  25. package/dist/dts/Micro.d.ts.map +1 -1
  26. package/dist/dts/Schema.d.ts +10 -5
  27. package/dist/dts/Schema.d.ts.map +1 -1
  28. package/dist/dts/SchemaAST.d.ts +9 -4
  29. package/dist/dts/SchemaAST.d.ts.map +1 -1
  30. package/dist/esm/Arbitrary.js +18 -8
  31. package/dist/esm/Arbitrary.js.map +1 -1
  32. package/dist/esm/BigDecimal.js +4 -0
  33. package/dist/esm/BigDecimal.js.map +1 -1
  34. package/dist/esm/Context.js +47 -6
  35. package/dist/esm/Context.js.map +1 -1
  36. package/dist/esm/Effect.js +25 -5
  37. package/dist/esm/Effect.js.map +1 -1
  38. package/dist/esm/JSONSchema.js +1 -0
  39. package/dist/esm/JSONSchema.js.map +1 -1
  40. package/dist/esm/Micro.js +108 -90
  41. package/dist/esm/Micro.js.map +1 -1
  42. package/dist/esm/Schema.js +74 -41
  43. package/dist/esm/Schema.js.map +1 -1
  44. package/dist/esm/SchemaAST.js +88 -20
  45. package/dist/esm/SchemaAST.js.map +1 -1
  46. package/dist/esm/internal/version.js +1 -1
  47. package/package.json +1 -1
  48. package/src/Arbitrary.ts +21 -7
  49. package/src/BigDecimal.ts +4 -0
  50. package/src/Context.ts +47 -6
  51. package/src/Effect.ts +25 -5
  52. package/src/JSONSchema.ts +1 -0
  53. package/src/Micro.ts +217 -183
  54. package/src/Schema.ts +105 -83
  55. package/src/SchemaAST.ts +107 -31
  56. package/src/internal/version.ts +1 -1
@@ -132,7 +132,15 @@ export declare const MicroCauseTypeId: unique symbol;
132
132
  */
133
133
  export type MicroCauseTypeId = typeof MicroCauseTypeId;
134
134
  /**
135
- * A Micro Cause is a data type that represents the different ways a Micro can fail.
135
+ * A `MicroCause` is a data type that represents the different ways a `Micro` can fail.
136
+ *
137
+ * **Details**
138
+ *
139
+ * `MicroCause` comes in three forms:
140
+ *
141
+ * - `Die`: Indicates an unforeseen defect that wasn't planned for in the system's logic.
142
+ * - `Fail`: Covers anticipated errors that are recognized and typically handled within the application.
143
+ * - `Interrupt`: Signifies an operation that has been purposefully stopped.
136
144
  *
137
145
  * @since 3.4.6
138
146
  * @experimental
@@ -255,22 +263,22 @@ export declare const causeWithTrace: {
255
263
  /**
256
264
  * @since 3.11.0
257
265
  * @experimental
258
- * @category Fiber
266
+ * @category MicroFiber
259
267
  */
260
- export declare const FiberTypeId: unique symbol;
268
+ export declare const MicroFiberTypeId: unique symbol;
261
269
  /**
262
270
  * @since 3.11.0
263
271
  * @experimental
264
- * @category Fiber
272
+ * @category MicroFiber
265
273
  */
266
- export type FiberTypeId = typeof FiberTypeId;
274
+ export type MicroFiberTypeId = typeof MicroFiberTypeId;
267
275
  /**
268
276
  * @since 3.11.0
269
277
  * @experimental
270
- * @category Fiber
278
+ * @category MicroFiber
271
279
  */
272
- export interface Fiber<out A, out E = never> {
273
- readonly [FiberTypeId]: Fiber.Variance<A, E>;
280
+ export interface MicroFiber<out A, out E = never> {
281
+ readonly [MicroFiberTypeId]: MicroFiber.Variance<A, E>;
274
282
  readonly currentOpCount: number;
275
283
  readonly getRef: <I, A>(ref: Context.Reference<I, A>) => A;
276
284
  readonly context: Context.Context<never>;
@@ -281,27 +289,27 @@ export interface Fiber<out A, out E = never> {
281
289
  /**
282
290
  * @since 3.11.0
283
291
  * @experimental
284
- * @category Fiber
292
+ * @category MicroFiber
285
293
  */
286
- export declare namespace Fiber {
294
+ export declare namespace MicroFiber {
287
295
  /**
288
296
  * @since 3.11.0
289
297
  * @experimental
290
- * @category Fiber
298
+ * @category MicroFiber
291
299
  */
292
300
  interface Variance<out A, out E = never> {
293
301
  readonly _A: Covariant<A>;
294
302
  readonly _E: Covariant<E>;
295
303
  }
296
304
  }
297
- declare class FiberImpl<in out A = any, in out E = any> implements Fiber<A, E> {
305
+ declare class MicroFiberImpl<in out A = any, in out E = any> implements MicroFiber<A, E> {
298
306
  context: Context.Context<never>;
299
307
  interruptible: boolean;
300
- readonly [FiberTypeId]: Fiber.Variance<A, E>;
308
+ readonly [MicroFiberTypeId]: MicroFiber.Variance<A, E>;
301
309
  readonly _stack: Array<Primitive>;
302
310
  readonly _observers: Array<(exit: MicroExit<A, E>) => void>;
303
311
  _exit: MicroExit<A, E> | undefined;
304
- _children: Set<FiberImpl<any, any>> | undefined;
312
+ _children: Set<MicroFiberImpl<any, any>> | undefined;
305
313
  currentOpCount: number;
306
314
  constructor(context: Context.Context<never>, interruptible?: boolean);
307
315
  getRef<I, A>(ref: Context.Reference<I, A>): A;
@@ -311,29 +319,35 @@ declare class FiberImpl<in out A = any, in out E = any> implements Fiber<A, E> {
311
319
  unsafePoll(): MicroExit<A, E> | undefined;
312
320
  evaluate(effect: Primitive): void;
313
321
  runLoop(effect: Primitive): MicroExit<A, E> | Yield;
314
- getCont<S extends successCont | failureCont>(symbol: S): (Primitive & Record<S, (value: any, fiber: FiberImpl) => Primitive>) | undefined;
322
+ getCont<S extends successCont | failureCont>(symbol: S): (Primitive & Record<S, (value: any, fiber: MicroFiberImpl) => Primitive>) | undefined;
315
323
  _yielded: MicroExit<any, any> | (() => void) | undefined;
316
324
  yieldWith(value: MicroExit<any, any> | (() => void)): Yield;
317
- children(): Set<Fiber<any, any>>;
325
+ children(): Set<MicroFiber<any, any>>;
318
326
  }
319
327
  /**
320
328
  * @since 3.11.0
321
329
  * @experimental
322
- * @category Fiber
330
+ * @category MicroFiber
331
+ */
332
+ export declare const fiberAwait: <A, E>(self: MicroFiber<A, E>) => Micro<MicroExit<A, E>>;
333
+ /**
334
+ * @since 3.11.2
335
+ * @experimental
336
+ * @category MicroFiber
323
337
  */
324
- export declare const fiberAwait: <A, E>(self: Fiber<A, E>) => Micro<MicroExit<A, E>>;
338
+ export declare const fiberJoin: <A, E>(self: MicroFiber<A, E>) => Micro<A, E>;
325
339
  /**
326
340
  * @since 3.11.0
327
341
  * @experimental
328
- * @category Fiber
342
+ * @category MicroFiber
329
343
  */
330
- export declare const fiberInterrupt: <A, E>(self: Fiber<A, E>) => Micro<void>;
344
+ export declare const fiberInterrupt: <A, E>(self: MicroFiber<A, E>) => Micro<void>;
331
345
  /**
332
346
  * @since 3.11.0
333
347
  * @experimental
334
- * @category Fiber
348
+ * @category MicroFiber
335
349
  */
336
- export declare const fiberInterruptAll: <A extends Iterable<Fiber<any, any>>>(fibers: A) => Micro<void>;
350
+ export declare const fiberInterruptAll: <A extends Iterable<MicroFiber<any, any>>>(fibers: A) => Micro<void>;
337
351
  declare const identifier: unique symbol;
338
352
  type identifier = typeof identifier;
339
353
  declare const evaluate: unique symbol;
@@ -348,10 +362,10 @@ declare const Yield: unique symbol;
348
362
  type Yield = typeof Yield;
349
363
  interface Primitive {
350
364
  readonly [identifier]: string;
351
- readonly [successCont]: ((value: unknown, fiber: FiberImpl) => Primitive | Yield) | undefined;
352
- readonly [failureCont]: ((cause: MicroCause<unknown>, fiber: FiberImpl) => Primitive | Yield) | undefined;
353
- readonly [ensureCont]: ((fiber: FiberImpl) => ((value: unknown, fiber: FiberImpl) => Primitive | Yield) | undefined) | undefined;
354
- [evaluate](fiber: FiberImpl): Primitive | Yield;
365
+ readonly [successCont]: ((value: unknown, fiber: MicroFiberImpl) => Primitive | Yield) | undefined;
366
+ readonly [failureCont]: ((cause: MicroCause<unknown>, fiber: MicroFiberImpl) => Primitive | Yield) | undefined;
367
+ readonly [ensureCont]: ((fiber: MicroFiberImpl) => ((value: unknown, fiber: MicroFiberImpl) => Primitive | Yield) | undefined) | undefined;
368
+ [evaluate](fiber: MicroFiberImpl): Primitive | Yield;
355
369
  }
356
370
  /**
357
371
  * Creates a `Micro` effect that will succeed with the specified constant value.
@@ -370,10 +384,10 @@ export declare const succeed: <A>(value: A) => Micro<A>;
370
384
  */
371
385
  export declare const failCause: <E>(cause: MicroCause<E>) => Micro<never, E>;
372
386
  /**
373
- * Creates a `Micro` effect that will fail with the specified error.
387
+ * Creates a `Micro` effect that fails with the given error.
374
388
  *
375
- * This will result in a `CauseFail`, where the error is tracked at the
376
- * type level.
389
+ * This results in a `Fail` variant of the `MicroCause` type, where the error is
390
+ * tracked at the type level.
377
391
  *
378
392
  * @since 3.4.0
379
393
  * @experimental
@@ -381,10 +395,10 @@ export declare const failCause: <E>(cause: MicroCause<E>) => Micro<never, E>;
381
395
  */
382
396
  export declare const fail: <E>(error: E) => Micro<never, E>;
383
397
  /**
384
- * Creates a `Micro` effect that will succeed with the lazily evaluated value.
398
+ * Creates a `Micro` effect that succeeds with a lazily evaluated value.
385
399
  *
386
- * If the evaluation of the value throws an error, the effect will fail with
387
- * `CauseDie`.
400
+ * If the evaluation of the value throws an error, the effect will fail with a
401
+ * `Die` variant of the `MicroCause` type.
388
402
  *
389
403
  * @since 3.4.0
390
404
  * @experimental
@@ -418,7 +432,7 @@ export declare const yieldNowWith: (priority?: number) => Micro<void>;
418
432
  */
419
433
  export declare const yieldNow: Micro<void>;
420
434
  /**
421
- * Creates a `Micro` effect that will succeed with `Option.Some` of the value.
435
+ * Creates a `Micro` effect that will succeed with the value wrapped in `Some`.
422
436
  *
423
437
  * @since 3.4.0
424
438
  * @experimental
@@ -426,7 +440,7 @@ export declare const yieldNow: Micro<void>;
426
440
  */
427
441
  export declare const succeedSome: <A>(a: A) => Micro<Option.Option<A>>;
428
442
  /**
429
- * Creates a `Micro` effect that will succeed with `Option.None`.
443
+ * Creates a `Micro` effect that succeeds with `None`.
430
444
  *
431
445
  * @since 3.4.0
432
446
  * @experimental
@@ -444,8 +458,8 @@ export declare const failCauseSync: <E>(evaluate: LazyArg<MicroCause<E>>) => Mic
444
458
  /**
445
459
  * Creates a `Micro` effect that will die with the specified error.
446
460
  *
447
- * This will result in a `CauseDie`, where the error is not tracked at
448
- * the type level.
461
+ * This results in a `Die` variant of the `MicroCause` type, where the error is
462
+ * not tracked at the type level.
449
463
  *
450
464
  * @since 3.4.0
451
465
  * @experimental
@@ -455,8 +469,8 @@ export declare const die: (defect: unknown) => Micro<never>;
455
469
  /**
456
470
  * Creates a `Micro` effect that will fail with the lazily evaluated error.
457
471
  *
458
- * This will result in a `CauseFail`, where the error is tracked at the
459
- * type level.
472
+ * This results in a `Fail` variant of the `MicroCause` type, where the error is
473
+ * tracked at the type level.
460
474
  *
461
475
  * @since 3.4.6
462
476
  * @experimental
@@ -502,9 +516,6 @@ export {
502
516
  * The `Micro` equivalent of a try / catch block, which allows you to map
503
517
  * thrown errors to a specific error type.
504
518
  *
505
- * @since 3.4.0
506
- * @experimental
507
- * @category constructors
508
519
  * @example
509
520
  * ```ts
510
521
  * import { Micro } from "effect"
@@ -514,11 +525,17 @@ export {
514
525
  * catch: (cause) => new Error("caught", { cause })
515
526
  * })
516
527
  * ```
528
+ *
529
+ * @since 3.4.0
530
+ * @experimental
531
+ * @category constructors
517
532
  */
518
533
  try_ as try };
519
534
  /**
520
- * Wrap a `Promise` into a `Micro` effect. Any errors will result in a
521
- * `CauseDie`.
535
+ * Wrap a `Promise` into a `Micro` effect.
536
+ *
537
+ * Any errors will result in a `Die` variant of the `MicroCause` type, where the
538
+ * error is not tracked at the type level.
522
539
  *
523
540
  * @since 3.4.0
524
541
  * @experimental
@@ -529,9 +546,6 @@ export declare const promise: <A>(evaluate: (signal: AbortSignal) => PromiseLike
529
546
  * Wrap a `Promise` into a `Micro` effect. Any errors will be caught and
530
547
  * converted into a specific error type.
531
548
  *
532
- * @since 3.4.0
533
- * @experimental
534
- * @category constructors
535
549
  * @example
536
550
  * ```ts
537
551
  * import { Micro } from "effect"
@@ -541,19 +555,23 @@ export declare const promise: <A>(evaluate: (signal: AbortSignal) => PromiseLike
541
555
  * catch: (cause) => new Error("caught", { cause })
542
556
  * })
543
557
  * ```
558
+ *
559
+ * @since 3.4.0
560
+ * @experimental
561
+ * @category constructors
544
562
  */
545
563
  export declare const tryPromise: <A, E>(options: {
546
564
  readonly try: (signal: AbortSignal) => PromiseLike<A>;
547
565
  readonly catch: (error: unknown) => E;
548
566
  }) => Micro<A, E>;
549
567
  /**
550
- * Create a `Micro` effect using the current `Fiber`.
568
+ * Create a `Micro` effect using the current `MicroFiber`.
551
569
  *
552
570
  * @since 3.4.0
553
571
  * @experimental
554
572
  * @category constructors
555
573
  */
556
- export declare const withFiber: <A, E = never, R = never>(evaluate: (fiber: FiberImpl<A, E>) => Micro<A, E, R>) => Micro<A, E, R>;
574
+ export declare const withMicroFiber: <A, E = never, R = never>(evaluate: (fiber: MicroFiberImpl<A, E>) => Micro<A, E, R>) => Micro<A, E, R>;
557
575
  /**
558
576
  * Flush any yielded effects that are waiting to be executed.
559
577
  *
@@ -618,7 +636,7 @@ export declare const as: {
618
636
  <A, E, R, B>(self: Micro<A, E, R>, value: B): Micro<B, E, R>;
619
637
  };
620
638
  /**
621
- * Wrap the success value of this `Micro` effect in an `Option.Some`.
639
+ * Wrap the success value of this `Micro` effect in a `Some`.
622
640
  *
623
641
  * @since 3.4.0
624
642
  * @experimental
@@ -634,11 +652,11 @@ export declare const asSome: <A, E, R>(self: Micro<A, E, R>) => Micro<Option.Opt
634
652
  */
635
653
  export declare const flip: <A, E, R>(self: Micro<A, E, R>) => Micro<E, A, R>;
636
654
  /**
637
- * A more flexible version of `flatMap`, that combines `map` and `flatMap` into
638
- * a single api.
655
+ * A more flexible version of `flatMap` that combines `map` and `flatMap` into a
656
+ * single API.
639
657
  *
640
- * It also allows you to pass in a `Micro` effect directly, which will be
641
- * executed after the current effect.
658
+ * It also lets you directly pass a `Micro` effect, which will be executed after
659
+ * the current effect.
642
660
  *
643
661
  * @since 3.4.0
644
662
  * @experimental
@@ -646,11 +664,11 @@ export declare const flip: <A, E, R>(self: Micro<A, E, R>) => Micro<E, A, R>;
646
664
  */
647
665
  export declare const andThen: {
648
666
  /**
649
- * A more flexible version of `flatMap`, that combines `map` and `flatMap` into
650
- * a single api.
667
+ * A more flexible version of `flatMap` that combines `map` and `flatMap` into a
668
+ * single API.
651
669
  *
652
- * It also allows you to pass in a `Micro` effect directly, which will be
653
- * executed after the current effect.
670
+ * It also lets you directly pass a `Micro` effect, which will be executed after
671
+ * the current effect.
654
672
  *
655
673
  * @since 3.4.0
656
674
  * @experimental
@@ -658,11 +676,11 @@ export declare const andThen: {
658
676
  */
659
677
  <A, X>(f: (a: A) => X): <E, R>(self: Micro<A, E, R>) => [X] extends [Micro<infer A1, infer E1, infer R1>] ? Micro<A1, E | E1, R | R1> : Micro<X, E, R>;
660
678
  /**
661
- * A more flexible version of `flatMap`, that combines `map` and `flatMap` into
662
- * a single api.
679
+ * A more flexible version of `flatMap` that combines `map` and `flatMap` into a
680
+ * single API.
663
681
  *
664
- * It also allows you to pass in a `Micro` effect directly, which will be
665
- * executed after the current effect.
682
+ * It also lets you directly pass a `Micro` effect, which will be executed after
683
+ * the current effect.
666
684
  *
667
685
  * @since 3.4.0
668
686
  * @experimental
@@ -670,11 +688,11 @@ export declare const andThen: {
670
688
  */
671
689
  <X>(f: NotFunction<X>): <A, E, R>(self: Micro<A, E, R>) => [X] extends [Micro<infer A1, infer E1, infer R1>] ? Micro<A1, E | E1, R | R1> : Micro<X, E, R>;
672
690
  /**
673
- * A more flexible version of `flatMap`, that combines `map` and `flatMap` into
674
- * a single api.
691
+ * A more flexible version of `flatMap` that combines `map` and `flatMap` into a
692
+ * single API.
675
693
  *
676
- * It also allows you to pass in a `Micro` effect directly, which will be
677
- * executed after the current effect.
694
+ * It also lets you directly pass a `Micro` effect, which will be executed after
695
+ * the current effect.
678
696
  *
679
697
  * @since 3.4.0
680
698
  * @experimental
@@ -682,11 +700,11 @@ export declare const andThen: {
682
700
  */
683
701
  <A, E, R, X>(self: Micro<A, E, R>, f: (a: A) => X): [X] extends [Micro<infer A1, infer E1, infer R1>] ? Micro<A1, E | E1, R | R1> : Micro<X, E, R>;
684
702
  /**
685
- * A more flexible version of `flatMap`, that combines `map` and `flatMap` into
686
- * a single api.
703
+ * A more flexible version of `flatMap` that combines `map` and `flatMap` into a
704
+ * single API.
687
705
  *
688
- * It also allows you to pass in a `Micro` effect directly, which will be
689
- * executed after the current effect.
706
+ * It also lets you directly pass a `Micro` effect, which will be executed after
707
+ * the current effect.
690
708
  *
691
709
  * @since 3.4.0
692
710
  * @experimental
@@ -782,7 +800,7 @@ export declare const raceAll: <Eff extends Micro<any, any, any>>(all: Iterable<E
782
800
  /**
783
801
  * Returns an effect that races all the specified effects,
784
802
  * yielding the value of the first effect to succeed or fail. Losers of
785
- * the race will be interrupted immediately
803
+ * the race will be interrupted immediately.
786
804
  *
787
805
  * @since 3.4.0
788
806
  * @experimental
@@ -791,7 +809,7 @@ export declare const raceAll: <Eff extends Micro<any, any, any>>(all: Iterable<E
791
809
  export declare const raceAllFirst: <Eff extends Micro<any, any, any>>(all: Iterable<Eff>) => Micro<Micro.Success<Eff>, Micro.Error<Eff>, Micro.Context<Eff>>;
792
810
  /**
793
811
  * Returns an effect that races two effects, yielding the value of the first
794
- * effect to succeed. Losers of the race will be interrupted immediately
812
+ * effect to succeed. Losers of the race will be interrupted immediately.
795
813
  *
796
814
  * @since 3.4.0
797
815
  * @experimental
@@ -800,7 +818,7 @@ export declare const raceAllFirst: <Eff extends Micro<any, any, any>>(all: Itera
800
818
  export declare const race: {
801
819
  /**
802
820
  * Returns an effect that races two effects, yielding the value of the first
803
- * effect to succeed. Losers of the race will be interrupted immediately
821
+ * effect to succeed. Losers of the race will be interrupted immediately.
804
822
  *
805
823
  * @since 3.4.0
806
824
  * @experimental
@@ -809,7 +827,7 @@ export declare const race: {
809
827
  <A2, E2, R2>(that: Micro<A2, E2, R2>): <A, E, R>(self: Micro<A, E, R>) => Micro<A | A2, E | E2, R | R2>;
810
828
  /**
811
829
  * Returns an effect that races two effects, yielding the value of the first
812
- * effect to succeed. Losers of the race will be interrupted immediately
830
+ * effect to succeed. Losers of the race will be interrupted immediately.
813
831
  *
814
832
  * @since 3.4.0
815
833
  * @experimental
@@ -819,7 +837,7 @@ export declare const race: {
819
837
  };
820
838
  /**
821
839
  * Returns an effect that races two effects, yielding the value of the first
822
- * effect to succeed *or* fail. Losers of the race will be interrupted immediately
840
+ * effect to succeed *or* fail. Losers of the race will be interrupted immediately.
823
841
  *
824
842
  * @since 3.4.0
825
843
  * @experimental
@@ -828,7 +846,7 @@ export declare const race: {
828
846
  export declare const raceFirst: {
829
847
  /**
830
848
  * Returns an effect that races two effects, yielding the value of the first
831
- * effect to succeed *or* fail. Losers of the race will be interrupted immediately
849
+ * effect to succeed *or* fail. Losers of the race will be interrupted immediately.
832
850
  *
833
851
  * @since 3.4.0
834
852
  * @experimental
@@ -837,7 +855,7 @@ export declare const raceFirst: {
837
855
  <A2, E2, R2>(that: Micro<A2, E2, R2>): <A, E, R>(self: Micro<A, E, R>) => Micro<A | A2, E | E2, R | R2>;
838
856
  /**
839
857
  * Returns an effect that races two effects, yielding the value of the first
840
- * effect to succeed *or* fail. Losers of the race will be interrupted immediately
858
+ * effect to succeed *or* fail. Losers of the race will be interrupted immediately.
841
859
  *
842
860
  * @since 3.4.0
843
861
  * @experimental
@@ -910,10 +928,9 @@ export declare const map: {
910
928
  <A, E, R, B>(self: Micro<A, E, R>, f: (a: A) => B): Micro<B, E, R>;
911
929
  };
912
930
  /**
913
- * The MicroExit type is a data type that represents the result of a Micro
914
- * computation.
915
- *
916
- * It uses the `Either` data type to represent the success and failure cases.
931
+ * The `MicroExit` type is used to represent the result of a `Micro` computation. It
932
+ * can either be successful, containing a value of type `A`, or it can fail,
933
+ * containing an error of type `E` wrapped in a `MicroCause`.
917
934
  *
918
935
  * @since 3.4.6
919
936
  * @experimental
@@ -1044,7 +1061,7 @@ export declare const exitVoidAll: <I extends Iterable<MicroExit<any, any>>>(exit
1044
1061
  */
1045
1062
  export interface MicroScheduler {
1046
1063
  readonly scheduleTask: (task: () => void, priority: number) => void;
1047
- readonly shouldYield: (fiber: Fiber<unknown, unknown>) => boolean;
1064
+ readonly shouldYield: (fiber: MicroFiber<unknown, unknown>) => boolean;
1048
1065
  readonly flush: () => void;
1049
1066
  }
1050
1067
  /**
@@ -1070,7 +1087,7 @@ export declare class MicroSchedulerDefault implements MicroScheduler {
1070
1087
  /**
1071
1088
  * @since 3.5.9
1072
1089
  */
1073
- shouldYield(fiber: Fiber<unknown, unknown>): boolean;
1090
+ shouldYield(fiber: MicroFiber<unknown, unknown>): boolean;
1074
1091
  /**
1075
1092
  * @since 3.5.9
1076
1093
  */
@@ -1293,10 +1310,8 @@ export declare class CurrentScheduler extends CurrentScheduler_base {
1293
1310
  * If you have a `Micro` that uses `concurrency: "inherit"`, you can use this
1294
1311
  * api to control the concurrency of that `Micro` when it is run.
1295
1312
  *
1296
- * @since 3.4.0
1297
- * @experimental
1298
- * @category environment refs
1299
1313
  * @example
1314
+ * ```ts
1300
1315
  * import * as Micro from "effect/Micro"
1301
1316
  *
1302
1317
  * Micro.forEach([1, 2, 3], (n) => Micro.succeed(n), {
@@ -1304,16 +1319,19 @@ export declare class CurrentScheduler extends CurrentScheduler_base {
1304
1319
  * }).pipe(
1305
1320
  * Micro.withConcurrency(2) // use a concurrency of 2
1306
1321
  * )
1322
+ * ```
1323
+ *
1324
+ * @since 3.4.0
1325
+ * @experimental
1326
+ * @category environment refs
1307
1327
  */
1308
1328
  export declare const withConcurrency: {
1309
1329
  /**
1310
1330
  * If you have a `Micro` that uses `concurrency: "inherit"`, you can use this
1311
1331
  * api to control the concurrency of that `Micro` when it is run.
1312
1332
  *
1313
- * @since 3.4.0
1314
- * @experimental
1315
- * @category environment refs
1316
1333
  * @example
1334
+ * ```ts
1317
1335
  * import * as Micro from "effect/Micro"
1318
1336
  *
1319
1337
  * Micro.forEach([1, 2, 3], (n) => Micro.succeed(n), {
@@ -1321,16 +1339,19 @@ export declare const withConcurrency: {
1321
1339
  * }).pipe(
1322
1340
  * Micro.withConcurrency(2) // use a concurrency of 2
1323
1341
  * )
1342
+ * ```
1343
+ *
1344
+ * @since 3.4.0
1345
+ * @experimental
1346
+ * @category environment refs
1324
1347
  */
1325
1348
  (concurrency: "unbounded" | number): <A, E, R>(self: Micro<A, E, R>) => Micro<A, E, R>;
1326
1349
  /**
1327
1350
  * If you have a `Micro` that uses `concurrency: "inherit"`, you can use this
1328
1351
  * api to control the concurrency of that `Micro` when it is run.
1329
1352
  *
1330
- * @since 3.4.0
1331
- * @experimental
1332
- * @category environment refs
1333
1353
  * @example
1354
+ * ```ts
1334
1355
  * import * as Micro from "effect/Micro"
1335
1356
  *
1336
1357
  * Micro.forEach([1, 2, 3], (n) => Micro.succeed(n), {
@@ -1338,6 +1359,11 @@ export declare const withConcurrency: {
1338
1359
  * }).pipe(
1339
1360
  * Micro.withConcurrency(2) // use a concurrency of 2
1340
1361
  * )
1362
+ * ```
1363
+ *
1364
+ * @since 3.4.0
1365
+ * @experimental
1366
+ * @category environment refs
1341
1367
  */
1342
1368
  <A, E, R>(self: Micro<A, E, R>, concurrency: "unbounded" | number): Micro<A, E, R>;
1343
1369
  };
@@ -1974,7 +2000,7 @@ export declare const catchCauseIf: {
1974
2000
  /**
1975
2001
  * Catch the error of the given `Micro` effect, allowing you to recover from it.
1976
2002
  *
1977
- * It only catches expected (`MicroCause.Fail`) errors.
2003
+ * It only catches expected errors.
1978
2004
  *
1979
2005
  * @since 3.4.6
1980
2006
  * @experimental
@@ -1984,7 +2010,7 @@ export declare const catchAll: {
1984
2010
  /**
1985
2011
  * Catch the error of the given `Micro` effect, allowing you to recover from it.
1986
2012
  *
1987
- * It only catches expected (`MicroCause.Fail`) errors.
2013
+ * It only catches expected errors.
1988
2014
  *
1989
2015
  * @since 3.4.6
1990
2016
  * @experimental
@@ -1994,7 +2020,7 @@ export declare const catchAll: {
1994
2020
  /**
1995
2021
  * Catch the error of the given `Micro` effect, allowing you to recover from it.
1996
2022
  *
1997
- * It only catches expected (`MicroCause.Fail`) errors.
2023
+ * It only catches expected errors.
1998
2024
  *
1999
2025
  * @since 3.4.6
2000
2026
  * @experimental
@@ -2965,9 +2991,6 @@ export declare const interruptible: <A, E, R>(self: Micro<A, E, R>) => Micro<A,
2965
2991
  * You can use the `restore` function to restore a `Micro` effect to the
2966
2992
  * interruptibility state before the `uninterruptibleMask` was applied.
2967
2993
  *
2968
- * @since 3.4.0
2969
- * @experimental
2970
- * @category interruption
2971
2994
  * @example
2972
2995
  * ```ts
2973
2996
  * import * as Micro from "effect/Micro"
@@ -2978,6 +3001,10 @@ export declare const interruptible: <A, E, R>(self: Micro<A, E, R>) => Micro<A,
2978
3001
  * )
2979
3002
  * )
2980
3003
  * ```
3004
+ *
3005
+ * @since 3.4.0
3006
+ * @experimental
3007
+ * @category interruption
2981
3008
  */
2982
3009
  export declare const uninterruptibleMask: <A, E, R>(f: (restore: <A_1, E_1, R_1>(effect: Micro<A_1, E_1, R_1>) => Micro<A_1, E_1, R_1>) => Micro<A, E, R>) => Micro<A, E, R>;
2983
3010
  /**
@@ -3053,13 +3080,14 @@ export declare const whileLoop: <A, E, R>(options: {
3053
3080
  readonly step: (a: A) => void;
3054
3081
  }) => Micro<void, E, R>;
3055
3082
  /**
3056
- * For each element of the provided iterable, run the effect and collect the results.
3083
+ * For each element of the provided iterable, run the effect and collect the
3084
+ * results.
3057
3085
  *
3058
3086
  * If the `discard` option is set to `true`, the results will be discarded and
3059
3087
  * the effect will return `void`.
3060
3088
  *
3061
- * The `concurrency` option can be set to control how many effects are run in
3062
- * parallel. By default, the effects are run sequentially.
3089
+ * The `concurrency` option can be set to control how many effects are run
3090
+ * concurrently. By default, the effects are run sequentially.
3063
3091
  *
3064
3092
  * @since 3.4.0
3065
3093
  * @experimental
@@ -3067,13 +3095,14 @@ export declare const whileLoop: <A, E, R>(options: {
3067
3095
  */
3068
3096
  export declare const forEach: {
3069
3097
  /**
3070
- * For each element of the provided iterable, run the effect and collect the results.
3098
+ * For each element of the provided iterable, run the effect and collect the
3099
+ * results.
3071
3100
  *
3072
3101
  * If the `discard` option is set to `true`, the results will be discarded and
3073
3102
  * the effect will return `void`.
3074
3103
  *
3075
- * The `concurrency` option can be set to control how many effects are run in
3076
- * parallel. By default, the effects are run sequentially.
3104
+ * The `concurrency` option can be set to control how many effects are run
3105
+ * concurrently. By default, the effects are run sequentially.
3077
3106
  *
3078
3107
  * @since 3.4.0
3079
3108
  * @experimental
@@ -3084,13 +3113,14 @@ export declare const forEach: {
3084
3113
  readonly discard?: false | undefined;
3085
3114
  }): Micro<Array<B>, E, R>;
3086
3115
  /**
3087
- * For each element of the provided iterable, run the effect and collect the results.
3116
+ * For each element of the provided iterable, run the effect and collect the
3117
+ * results.
3088
3118
  *
3089
3119
  * If the `discard` option is set to `true`, the results will be discarded and
3090
3120
  * the effect will return `void`.
3091
3121
  *
3092
- * The `concurrency` option can be set to control how many effects are run in
3093
- * parallel. By default, the effects are run sequentially.
3122
+ * The `concurrency` option can be set to control how many effects are run
3123
+ * concurrently. By default, the effects are run sequentially.
3094
3124
  *
3095
3125
  * @since 3.4.0
3096
3126
  * @experimental
@@ -3104,7 +3134,8 @@ export declare const forEach: {
3104
3134
  /**
3105
3135
  * Effectfully filter the elements of the provided iterable.
3106
3136
  *
3107
- * Use the `concurrency` option to control how many elements are processed in parallel.
3137
+ * Use the `concurrency` option to control how many elements are processed
3138
+ * concurrently.
3108
3139
  *
3109
3140
  * @since 3.4.0
3110
3141
  * @experimental
@@ -3117,7 +3148,8 @@ export declare const filter: <A, E, R>(iterable: Iterable<A>, f: (a: NoInfer<A>)
3117
3148
  /**
3118
3149
  * Effectfully filter the elements of the provided iterable.
3119
3150
  *
3120
- * Use the `concurrency` option to control how many elements are processed in parallel.
3151
+ * Use the `concurrency` option to control how many elements are processed
3152
+ * concurrently.
3121
3153
  *
3122
3154
  * @since 3.4.0
3123
3155
  * @experimental
@@ -3210,82 +3242,79 @@ export {
3210
3242
  */
3211
3243
  let_ as let };
3212
3244
  /**
3213
- * Run the `Micro` effect in a new `Handle` that can be awaited, joined, or
3245
+ * Run the `Micro` effect in a new `MicroFiber` that can be awaited, joined, or
3214
3246
  * aborted.
3215
3247
  *
3216
3248
  * When the parent `Micro` finishes, this `Micro` will be aborted.
3217
3249
  *
3218
3250
  * @since 3.4.0
3219
3251
  * @experimental
3220
- * @category handle & forking
3252
+ * @category fiber & forking
3221
3253
  */
3222
- export declare const fork: <A, E, R>(self: Micro<A, E, R>) => Micro<Fiber<A, E>, never, R>;
3254
+ export declare const fork: <A, E, R>(self: Micro<A, E, R>) => Micro<MicroFiber<A, E>, never, R>;
3223
3255
  /**
3224
- * Run the `Micro` effect in a new `Handle` that can be awaited, joined, or
3256
+ * Run the `Micro` effect in a new `MicroFiber` that can be awaited, joined, or
3225
3257
  * aborted.
3226
3258
  *
3227
3259
  * It will not be aborted when the parent `Micro` finishes.
3228
3260
  *
3229
3261
  * @since 3.4.0
3230
3262
  * @experimental
3231
- * @category handle & forking
3263
+ * @category fiber & forking
3232
3264
  */
3233
- export declare const forkDaemon: <A, E, R>(self: Micro<A, E, R>) => Micro<Fiber<A, E>, never, R>;
3265
+ export declare const forkDaemon: <A, E, R>(self: Micro<A, E, R>) => Micro<MicroFiber<A, E>, never, R>;
3234
3266
  /**
3235
- * Run the `Micro` effect in a new `Handle` that can be awaited, joined, or
3267
+ * Run the `Micro` effect in a new `MicroFiber` that can be awaited, joined, or
3236
3268
  * aborted.
3237
3269
  *
3238
3270
  * The lifetime of the handle will be attached to the provided `MicroScope`.
3239
3271
  *
3240
3272
  * @since 3.4.0
3241
3273
  * @experimental
3242
- * @category handle & forking
3274
+ * @category fiber & forking
3243
3275
  */
3244
3276
  export declare const forkIn: {
3245
3277
  /**
3246
- * Run the `Micro` effect in a new `Handle` that can be awaited, joined, or
3278
+ * Run the `Micro` effect in a new `MicroFiber` that can be awaited, joined, or
3247
3279
  * aborted.
3248
3280
  *
3249
3281
  * The lifetime of the handle will be attached to the provided `MicroScope`.
3250
3282
  *
3251
3283
  * @since 3.4.0
3252
3284
  * @experimental
3253
- * @category handle & forking
3285
+ * @category fiber & forking
3254
3286
  */
3255
- (scope: MicroScope): <A, E, R>(self: Micro<A, E, R>) => Micro<Fiber<A, E>, never, R>;
3287
+ (scope: MicroScope): <A, E, R>(self: Micro<A, E, R>) => Micro<MicroFiber<A, E>, never, R>;
3256
3288
  /**
3257
- * Run the `Micro` effect in a new `Handle` that can be awaited, joined, or
3289
+ * Run the `Micro` effect in a new `MicroFiber` that can be awaited, joined, or
3258
3290
  * aborted.
3259
3291
  *
3260
3292
  * The lifetime of the handle will be attached to the provided `MicroScope`.
3261
3293
  *
3262
3294
  * @since 3.4.0
3263
3295
  * @experimental
3264
- * @category handle & forking
3296
+ * @category fiber & forking
3265
3297
  */
3266
- <A, E, R>(self: Micro<A, E, R>, scope: MicroScope): Micro<Fiber<A, E>, never, R>;
3298
+ <A, E, R>(self: Micro<A, E, R>, scope: MicroScope): Micro<MicroFiber<A, E>, never, R>;
3267
3299
  };
3268
3300
  /**
3269
- * Run the `Micro` effect in a new `Handle` that can be awaited, joined, or
3301
+ * Run the `Micro` effect in a new `MicroFiber` that can be awaited, joined, or
3270
3302
  * aborted.
3271
3303
  *
3272
3304
  * The lifetime of the handle will be attached to the current `MicroScope`.
3273
3305
  *
3274
3306
  * @since 3.4.0
3275
3307
  * @experimental
3276
- * @category handle & forking
3308
+ * @category fiber & forking
3277
3309
  */
3278
- export declare const forkScoped: <A, E, R>(self: Micro<A, E, R>) => Micro<Fiber<A, E>, never, R | MicroScope>;
3310
+ export declare const forkScoped: <A, E, R>(self: Micro<A, E, R>) => Micro<MicroFiber<A, E>, never, R | MicroScope>;
3279
3311
  /**
3280
- * Execute the `Micro` effect and return a `Handle` that can be awaited, joined,
3312
+ * Execute the `Micro` effect and return a `MicroFiber` that can be awaited, joined,
3281
3313
  * or aborted.
3282
3314
  *
3283
3315
  * You can listen for the result by adding an observer using the handle's
3284
3316
  * `addObserver` method.
3285
3317
  *
3286
- * @since 3.4.0
3287
- * @experimental
3288
- * @category execution
3289
3318
  * @example
3290
3319
  * ```ts
3291
3320
  * import * as Micro from "effect/Micro"
@@ -3299,11 +3328,15 @@ export declare const forkScoped: <A, E, R>(self: Micro<A, E, R>) => Micro<Fiber<
3299
3328
  * console.log(exit)
3300
3329
  * })
3301
3330
  * ```
3331
+ *
3332
+ * @since 3.4.0
3333
+ * @experimental
3334
+ * @category execution
3302
3335
  */
3303
3336
  export declare const runFork: <A, E>(effect: Micro<A, E>, options?: {
3304
3337
  readonly signal?: AbortSignal | undefined;
3305
3338
  readonly scheduler?: MicroScheduler | undefined;
3306
- } | undefined) => FiberImpl<A, E>;
3339
+ } | undefined) => MicroFiberImpl<A, E>;
3307
3340
  /**
3308
3341
  * Execute the `Micro` effect and return a `Promise` that resolves with the
3309
3342
  * `MicroExit` of the computation.
@@ -3332,7 +3365,7 @@ export declare const runPromise: <A, E>(effect: Micro<A, E>, options?: {
3332
3365
  * Attempt to execute the `Micro` effect synchronously and return the `MicroExit`.
3333
3366
  *
3334
3367
  * If any asynchronous effects are encountered, the function will return a
3335
- * `CauseDie` containing the `Handle`.
3368
+ * `CauseDie` containing the `MicroFiber`.
3336
3369
  *
3337
3370
  * @since 3.4.6
3338
3371
  * @experimental