effect 3.3.5 → 3.4.1

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 (98) hide show
  1. package/Micro/package.json +6 -0
  2. package/dist/cjs/Array.js +18 -3
  3. package/dist/cjs/Array.js.map +1 -1
  4. package/dist/cjs/Chunk.js +13 -2
  5. package/dist/cjs/Chunk.js.map +1 -1
  6. package/dist/cjs/Effect.js +236 -15
  7. package/dist/cjs/Effect.js.map +1 -1
  8. package/dist/cjs/Either.js +31 -1
  9. package/dist/cjs/Either.js.map +1 -1
  10. package/dist/cjs/ManagedRuntime.js.map +1 -1
  11. package/dist/cjs/Micro.js +2383 -0
  12. package/dist/cjs/Micro.js.map +1 -0
  13. package/dist/cjs/Option.js +1 -2
  14. package/dist/cjs/Option.js.map +1 -1
  15. package/dist/cjs/Schedule.js +2 -2
  16. package/dist/cjs/Stream.js.map +1 -1
  17. package/dist/cjs/Tuple.js +16 -9
  18. package/dist/cjs/Tuple.js.map +1 -1
  19. package/dist/cjs/index.js +4 -2
  20. package/dist/cjs/index.js.map +1 -1
  21. package/dist/cjs/internal/core-effect.js +4 -2
  22. package/dist/cjs/internal/core-effect.js.map +1 -1
  23. package/dist/cjs/internal/core.js +12 -2
  24. package/dist/cjs/internal/core.js.map +1 -1
  25. package/dist/cjs/internal/fiberRuntime.js +32 -0
  26. package/dist/cjs/internal/fiberRuntime.js.map +1 -1
  27. package/dist/cjs/internal/stream.js.map +1 -1
  28. package/dist/cjs/internal/version.js +1 -1
  29. package/dist/dts/Array.d.ts +14 -0
  30. package/dist/dts/Array.d.ts.map +1 -1
  31. package/dist/dts/Cause.d.ts +1 -1
  32. package/dist/dts/Chunk.d.ts +11 -0
  33. package/dist/dts/Chunk.d.ts.map +1 -1
  34. package/dist/dts/Effect.d.ts +235 -12
  35. package/dist/dts/Effect.d.ts.map +1 -1
  36. package/dist/dts/Either.d.ts +35 -0
  37. package/dist/dts/Either.d.ts.map +1 -1
  38. package/dist/dts/ManagedRuntime.d.ts +15 -0
  39. package/dist/dts/ManagedRuntime.d.ts.map +1 -1
  40. package/dist/dts/Micro.d.ts +2010 -0
  41. package/dist/dts/Micro.d.ts.map +1 -0
  42. package/dist/dts/Option.d.ts +2 -0
  43. package/dist/dts/Option.d.ts.map +1 -1
  44. package/dist/dts/Schedule.d.ts +2 -2
  45. package/dist/dts/Stream.d.ts +45 -6
  46. package/dist/dts/Stream.d.ts.map +1 -1
  47. package/dist/dts/Tuple.d.ts +18 -0
  48. package/dist/dts/Tuple.d.ts.map +1 -1
  49. package/dist/dts/index.d.ts +7 -0
  50. package/dist/dts/index.d.ts.map +1 -1
  51. package/dist/dts/internal/core-effect.d.ts.map +1 -1
  52. package/dist/dts/internal/core.d.ts.map +1 -1
  53. package/dist/dts/internal/fiberRuntime.d.ts.map +1 -1
  54. package/dist/esm/Array.js +14 -0
  55. package/dist/esm/Array.js.map +1 -1
  56. package/dist/esm/Chunk.js +11 -0
  57. package/dist/esm/Chunk.js.map +1 -1
  58. package/dist/esm/Effect.js +233 -12
  59. package/dist/esm/Effect.js.map +1 -1
  60. package/dist/esm/Either.js +30 -0
  61. package/dist/esm/Either.js.map +1 -1
  62. package/dist/esm/ManagedRuntime.js.map +1 -1
  63. package/dist/esm/Micro.js +2307 -0
  64. package/dist/esm/Micro.js.map +1 -0
  65. package/dist/esm/Option.js +1 -1
  66. package/dist/esm/Option.js.map +1 -1
  67. package/dist/esm/Schedule.js +2 -2
  68. package/dist/esm/Stream.js.map +1 -1
  69. package/dist/esm/Tuple.js +15 -8
  70. package/dist/esm/Tuple.js.map +1 -1
  71. package/dist/esm/index.js +7 -0
  72. package/dist/esm/index.js.map +1 -1
  73. package/dist/esm/internal/core-effect.js +2 -0
  74. package/dist/esm/internal/core-effect.js.map +1 -1
  75. package/dist/esm/internal/core.js +10 -1
  76. package/dist/esm/internal/core.js.map +1 -1
  77. package/dist/esm/internal/fiberRuntime.js +32 -0
  78. package/dist/esm/internal/fiberRuntime.js.map +1 -1
  79. package/dist/esm/internal/stream.js.map +1 -1
  80. package/dist/esm/internal/version.js +1 -1
  81. package/package.json +9 -1
  82. package/src/Array.ts +15 -0
  83. package/src/Cause.ts +1 -1
  84. package/src/Chunk.ts +12 -0
  85. package/src/Effect.ts +243 -12
  86. package/src/Either.ts +51 -0
  87. package/src/ManagedRuntime.ts +16 -0
  88. package/src/Micro.ts +3835 -0
  89. package/src/Option.ts +12 -1
  90. package/src/Schedule.ts +2 -2
  91. package/src/Stream.ts +60 -8
  92. package/src/Tuple.ts +18 -8
  93. package/src/index.ts +8 -0
  94. package/src/internal/core-effect.ts +33 -0
  95. package/src/internal/core.ts +18 -1
  96. package/src/internal/fiberRuntime.ts +32 -0
  97. package/src/internal/stream.ts +8 -4
  98. package/src/internal/version.ts +1 -1
@@ -0,0 +1,2010 @@
1
+ /**
2
+ * A lightweight alternative to the `Effect` data type, with a subset of the functionality.
3
+ *
4
+ * @since 3.4.0
5
+ * @experimental
6
+ */
7
+ import type { Channel, ChannelTypeId } from "./Channel.js";
8
+ import * as Context from "./Context.js";
9
+ import type { Effect, EffectTypeId } from "./Effect.js";
10
+ import * as Either from "./Either.js";
11
+ import { type LazyArg } from "./Function.js";
12
+ import type { TypeLambda } from "./HKT.js";
13
+ import type { Inspectable } from "./Inspectable.js";
14
+ import * as Option from "./Option.js";
15
+ import { type Pipeable } from "./Pipeable.js";
16
+ import { type Predicate, type Refinement } from "./Predicate.js";
17
+ import type { ReadonlyRecord } from "./Record.js";
18
+ import type { Sink, SinkTypeId } from "./Sink.js";
19
+ import type { Stream, StreamTypeId } from "./Stream.js";
20
+ import type { Concurrency, Covariant, Equals, NoInfer, NotFunction, Simplify } from "./Types.js";
21
+ import { YieldWrap } from "./Utils.js";
22
+ /**
23
+ * @since 3.4.0
24
+ * @experimental
25
+ * @category type ids
26
+ */
27
+ export declare const TypeId: unique symbol;
28
+ /**
29
+ * @since 3.4.0
30
+ * @experimental
31
+ * @category type ids
32
+ */
33
+ export type TypeId = typeof TypeId;
34
+ /**
35
+ * @since 3.4.0
36
+ * @experimental
37
+ * @category symbols
38
+ */
39
+ export declare const runSymbol: unique symbol;
40
+ /**
41
+ * @since 3.4.0
42
+ * @experimental
43
+ * @category symbols
44
+ */
45
+ export type runSymbol = typeof runSymbol;
46
+ /**
47
+ * A lightweight alternative to the `Effect` data type, with a subset of the functionality.
48
+ *
49
+ * @since 3.4.0
50
+ * @experimental
51
+ * @category models
52
+ */
53
+ export interface Micro<out A, out E = never, out R = never> extends Effect<A, E, R> {
54
+ readonly [TypeId]: Micro.Variance<A, E, R>;
55
+ readonly [runSymbol]: (env: Env<any>, onResult: (result: Result<A, E>) => void) => void;
56
+ [Symbol.iterator](): MicroIterator<Micro<A, E, R>>;
57
+ }
58
+ /**
59
+ * @category type lambdas
60
+ * @since 3.4.1
61
+ */
62
+ export interface MicroTypeLambda extends TypeLambda {
63
+ readonly type: Micro<this["Target"], this["Out1"], this["Out2"]>;
64
+ }
65
+ /**
66
+ * @since 3.4.0
67
+ * @experimental
68
+ */
69
+ export declare namespace Micro {
70
+ /**
71
+ * @since 3.4.0
72
+ * @experimental
73
+ */
74
+ interface Variance<A, E, R> {
75
+ _A: Covariant<A>;
76
+ _E: Covariant<E>;
77
+ _R: Covariant<R>;
78
+ }
79
+ /**
80
+ * @since 3.4.0
81
+ * @experimental
82
+ */
83
+ type Success<T> = T extends Micro<infer _A, infer _E, infer _R> ? _A : never;
84
+ /**
85
+ * @since 3.4.0
86
+ * @experimental
87
+ */
88
+ type Error<T> = T extends Micro<infer _A, infer _E, infer _R> ? _E : never;
89
+ /**
90
+ * @since 3.4.0
91
+ * @experimental
92
+ */
93
+ type Context<T> = T extends Micro<infer _A, infer _E, infer _R> ? _R : never;
94
+ }
95
+ /**
96
+ * @since 3.4.0
97
+ * @experimental
98
+ * @category guards
99
+ */
100
+ export declare const isMicro: (u: unknown) => u is Micro<any, any, any>;
101
+ /**
102
+ * @since 3.4.0
103
+ * @experimental
104
+ * @category models
105
+ */
106
+ export interface MicroIterator<T extends Micro<any, any, any>> {
107
+ next(...args: ReadonlyArray<any>): IteratorResult<YieldWrap<T>, Micro.Success<T>>;
108
+ }
109
+ /**
110
+ * @since 3.4.0
111
+ * @experimental
112
+ * @category failure
113
+ */
114
+ export declare const FailureTypeId: unique symbol;
115
+ /**
116
+ * @since 3.4.0
117
+ * @experimental
118
+ * @category failure
119
+ */
120
+ export type FailureTypeId = typeof FailureTypeId;
121
+ /**
122
+ * A Micro Failure is a data type that represents the different ways a Micro can fail.
123
+ *
124
+ * @since 3.4.0
125
+ * @experimental
126
+ * @category failure
127
+ */
128
+ export type Failure<E> = Failure.Unexpected | Failure.Expected<E> | Failure.Aborted;
129
+ /**
130
+ * @since 3.4.0
131
+ * @experimental
132
+ * @category failure
133
+ */
134
+ export declare namespace Failure {
135
+ /**
136
+ * @since 3.4.0
137
+ * @experimental
138
+ */
139
+ interface Proto<Tag extends string, E> extends Pipeable, globalThis.Error {
140
+ readonly [FailureTypeId]: {
141
+ _E: Covariant<E>;
142
+ };
143
+ readonly _tag: Tag;
144
+ readonly traces: ReadonlyArray<string>;
145
+ }
146
+ /**
147
+ * @since 3.4.0
148
+ * @experimental
149
+ * @category failure
150
+ */
151
+ interface Unexpected extends Proto<"Unexpected", never> {
152
+ readonly defect: unknown;
153
+ }
154
+ /**
155
+ * @since 3.4.0
156
+ * @experimental
157
+ * @category failure
158
+ */
159
+ interface Expected<E> extends Proto<"Expected", E> {
160
+ readonly error: E;
161
+ }
162
+ /**
163
+ * @since 3.4.0
164
+ * @experimental
165
+ * @category failure
166
+ */
167
+ interface Aborted extends Proto<"Aborted", never> {
168
+ }
169
+ }
170
+ /**
171
+ * @since 3.4.0
172
+ * @experimental
173
+ * @category failure
174
+ */
175
+ export declare const FailureExpected: <E>(error: E, traces?: ReadonlyArray<string>) => Failure<E>;
176
+ /**
177
+ * @since 3.4.0
178
+ * @experimental
179
+ * @category failure
180
+ */
181
+ export declare const FailureUnexpected: (defect: unknown, traces?: ReadonlyArray<string>) => Failure<never>;
182
+ /**
183
+ * @since 3.4.0
184
+ * @experimental
185
+ * @category failure
186
+ */
187
+ export declare const FailureAborted: (traces?: ReadonlyArray<string>) => Failure<never>;
188
+ /**
189
+ * @since 3.4.0
190
+ * @experimental
191
+ * @category failure
192
+ */
193
+ export declare const failureIsExpected: <E>(self: Failure<E>) => self is Failure.Expected<E>;
194
+ /**
195
+ * @since 3.4.0
196
+ * @experimental
197
+ * @category failure
198
+ */
199
+ export declare const failureIsUnexpected: <E>(self: Failure<E>) => self is Failure.Unexpected;
200
+ /**
201
+ * @since 3.4.0
202
+ * @experimental
203
+ * @category failure
204
+ */
205
+ export declare const failureIsAborted: <E>(self: Failure<E>) => self is Failure.Aborted;
206
+ /**
207
+ * @since 3.4.0
208
+ * @experimental
209
+ * @category failure
210
+ */
211
+ export declare const failureSquash: <E>(self: Failure<E>) => unknown;
212
+ /**
213
+ * @since 3.4.0
214
+ * @experimental
215
+ * @category failure
216
+ */
217
+ export declare const failureWithTrace: {
218
+ (trace: string): <E>(self: Failure<E>) => Failure<E>;
219
+ <E>(self: Failure<E>, trace: string): Failure<E>;
220
+ };
221
+ /**
222
+ * The Micro Result type is a data type that represents the result of a Micro
223
+ * computation.
224
+ *
225
+ * It uses the `Either` data type to represent the success and failure cases.
226
+ *
227
+ * @since 3.4.0
228
+ * @experimental
229
+ * @category result
230
+ */
231
+ export type Result<A, E = never> = Either.Either<A, Failure<E>>;
232
+ /**
233
+ * @since 3.4.0
234
+ * @experimental
235
+ * @category result
236
+ */
237
+ export declare const ResultAborted: Result<never>;
238
+ /**
239
+ * @since 3.4.0
240
+ * @experimental
241
+ * @category result
242
+ */
243
+ export declare const ResultSuccess: <A>(a: A) => Result<A, never>;
244
+ /**
245
+ * @since 3.4.0
246
+ * @experimental
247
+ * @category result
248
+ */
249
+ export declare const ResultFail: <E>(e: E) => Result<never, E>;
250
+ /**
251
+ * @since 3.4.0
252
+ * @experimental
253
+ * @category result
254
+ */
255
+ export declare const ResultFailUnexpected: (defect: unknown) => Result<never>;
256
+ /**
257
+ * @since 3.4.0
258
+ * @experimental
259
+ * @category result
260
+ */
261
+ export declare const ResultFailWith: <E>(failure: Failure<E>) => Result<never, E>;
262
+ /**
263
+ * @since 3.4.0
264
+ * @experimental
265
+ * @category result
266
+ */
267
+ export declare const resultIsSuccess: <A, E>(self: Result<A, E>) => self is Either.Right<Failure<E>, A>;
268
+ /**
269
+ * @since 3.4.0
270
+ * @experimental
271
+ * @category result
272
+ */
273
+ export declare const resultIsFailure: <A, E>(self: Result<A, E>) => self is Either.Left<Failure<E>, A>;
274
+ /**
275
+ * @since 3.4.0
276
+ * @experimental
277
+ * @category result
278
+ */
279
+ export declare const resultIsAborted: <A, E>(self: Result<A, E>) => self is Either.Left<Failure.Aborted, A>;
280
+ /**
281
+ * @since 3.4.0
282
+ * @experimental
283
+ * @category result
284
+ */
285
+ export declare const resultIsFailureExpected: <A, E>(self: Result<A, E>) => self is Either.Left<Failure.Expected<E>, A>;
286
+ /**
287
+ * @since 3.4.0
288
+ * @experimental
289
+ * @category result
290
+ */
291
+ export declare const resultIsFailureUnexpected: <A, E>(self: Result<A, E>) => self is Either.Left<Failure.Unexpected, A>;
292
+ /**
293
+ * @since 3.4.0
294
+ * @experimental
295
+ * @category result
296
+ */
297
+ export declare const resultVoid: Result<void>;
298
+ /**
299
+ * @since 3.4.0
300
+ * @experimental
301
+ * @category environment
302
+ */
303
+ export declare const EnvTypeId: unique symbol;
304
+ /**
305
+ * @since 3.4.0
306
+ * @experimental
307
+ * @category environment
308
+ */
309
+ export type EnvTypeId = typeof EnvTypeId;
310
+ /**
311
+ * @since 3.4.0
312
+ * @experimental
313
+ * @category environment
314
+ */
315
+ export interface Env<R> extends Pipeable {
316
+ readonly [EnvTypeId]: {
317
+ _R: Covariant<R>;
318
+ };
319
+ readonly refs: ReadonlyRecord<string, unknown>;
320
+ }
321
+ /**
322
+ * @since 3.4.0
323
+ * @experimental
324
+ * @category environment
325
+ */
326
+ export declare const EnvRefTypeId: unique symbol;
327
+ /**
328
+ * @since 3.4.0
329
+ * @experimental
330
+ * @category environment
331
+ */
332
+ export type EnvRefTypeId = typeof EnvRefTypeId;
333
+ /**
334
+ * @since 3.4.0
335
+ * @experimental
336
+ * @category environment
337
+ */
338
+ export interface EnvRef<A> {
339
+ readonly [EnvRefTypeId]: EnvRefTypeId;
340
+ readonly key: string;
341
+ readonly initial: A;
342
+ }
343
+ /**
344
+ * @since 3.4.0
345
+ * @experimental
346
+ * @category environment
347
+ */
348
+ export declare const envMake: <R = never>(refs: Record<string, unknown>) => Env<R>;
349
+ /**
350
+ * @since 3.4.0
351
+ * @experimental
352
+ * @category environment
353
+ */
354
+ export declare const envUnsafeMakeEmpty: () => Env<never>;
355
+ /**
356
+ * @since 3.4.0
357
+ * @experimental
358
+ * @category environment
359
+ */
360
+ export declare const envGet: {
361
+ <A>(ref: EnvRef<A>): <R>(self: Env<R>) => A;
362
+ <A, R>(self: Env<R>, ref: EnvRef<A>): A;
363
+ };
364
+ /**
365
+ * @since 3.4.0
366
+ * @experimental
367
+ * @category environment
368
+ */
369
+ export declare const envSet: {
370
+ <A>(ref: EnvRef<A>, value: A): <R>(self: Env<R>) => Env<R>;
371
+ <A, R>(self: Env<R>, ref: EnvRef<A>, value: A): Env<R>;
372
+ };
373
+ /**
374
+ * @since 3.4.0
375
+ * @experimental
376
+ * @category environment
377
+ */
378
+ export declare const envMutate: {
379
+ (f: (map: Record<string, unknown>) => void): <R>(self: Env<R>) => Env<R>;
380
+ <R>(self: Env<R>, f: (map: Record<string, unknown>) => void): Env<R>;
381
+ };
382
+ /**
383
+ * Access the given `Context.Tag` from the environment.
384
+ *
385
+ * @since 3.4.0
386
+ * @experimental
387
+ * @category environment
388
+ */
389
+ export declare const service: <I, S>(tag: Context.Tag<I, S>) => Micro<S, never, I>;
390
+ /**
391
+ * Access the given `Context.Tag` from the environment, without tracking the
392
+ * dependency at the type level.
393
+ *
394
+ * It will return an `Option` of the service, depending on whether it is
395
+ * available in the environment or not.
396
+ *
397
+ * @since 3.4.0
398
+ * @experimental
399
+ * @category environment
400
+ */
401
+ export declare const serviceOption: <I, S>(tag: Context.Tag<I, S>) => Micro<Option.Option<S>>;
402
+ /**
403
+ * Retrieve the current value of the given `EnvRef`.
404
+ *
405
+ * @since 3.4.0
406
+ * @experimental
407
+ * @category environment
408
+ */
409
+ export declare const getEnvRef: <A>(envRef: EnvRef<A>) => Micro<A>;
410
+ /**
411
+ * Set the value of the given `EnvRef` for the duration of the effect.
412
+ *
413
+ * @since 3.4.0
414
+ * @experimental
415
+ * @category environment
416
+ */
417
+ export declare const locally: {
418
+ <A>(fiberRef: EnvRef<A>, value: A): <XA, E, R>(self: Micro<XA, E, R>) => Micro<XA, E, R>;
419
+ <XA, E, R, A>(self: Micro<XA, E, R>, fiberRef: EnvRef<A>, value: A): Micro<XA, E, R>;
420
+ };
421
+ /**
422
+ * Access the current `Context` from the environment.
423
+ *
424
+ * @since 3.4.0
425
+ * @experimental
426
+ * @category environment
427
+ */
428
+ export declare const context: <R>() => Micro<Context.Context<R>>;
429
+ /**
430
+ * Merge the given `Context` with the current context.
431
+ *
432
+ * @since 3.4.0
433
+ * @experimental
434
+ * @category environment
435
+ */
436
+ export declare const provideContext: {
437
+ <XR>(context: Context.Context<XR>): <A, E, R>(self: Micro<A, E, R>) => Micro<A, E, Exclude<R, XR>>;
438
+ <A, E, R, XR>(self: Micro<A, E, R>, context: Context.Context<XR>): Micro<A, E, Exclude<R, XR>>;
439
+ };
440
+ /**
441
+ * Add the provided service to the current context.
442
+ *
443
+ * @since 3.4.0
444
+ * @experimental
445
+ * @category environment
446
+ */
447
+ export declare const provideService: {
448
+ <I, S>(tag: Context.Tag<I, S>, service: S): <A, E, R>(self: Micro<A, E, R>) => Micro<A, E, Exclude<R, I>>;
449
+ <A, E, R, I, S>(self: Micro<A, E, R>, tag: Context.Tag<I, S>, service: S): Micro<A, E, Exclude<R, I>>;
450
+ };
451
+ /**
452
+ * Create a service using the provided `Micro` effect, and add it to the
453
+ * current context.
454
+ *
455
+ * @since 3.4.0
456
+ * @experimental
457
+ * @category environment
458
+ */
459
+ export declare const provideServiceMicro: {
460
+ <I, S, E2, R2>(tag: Context.Tag<I, S>, acquire: Micro<S, E2, R2>): <A, E, R>(self: Micro<A, E, R>) => Micro<A, E | E2, Exclude<R, I> | R2>;
461
+ <A, E, R, I, S, E2, R2>(self: Micro<A, E, R>, tag: Context.Tag<I, S>, acquire: Micro<S, E2, R2>): Micro<A, E | E2, Exclude<R, I> | R2>;
462
+ };
463
+ /**
464
+ * @since 3.4.0
465
+ * @experimental
466
+ * @category environment refs
467
+ */
468
+ export declare const envRefMake: <A>(key: string, initial: LazyArg<A>) => EnvRef<A>;
469
+ /**
470
+ * @since 3.4.0
471
+ * @experimental
472
+ * @category environment refs
473
+ */
474
+ export declare const currentAbortController: EnvRef<AbortController>;
475
+ /**
476
+ * @since 3.4.0
477
+ * @experimental
478
+ * @category environment refs
479
+ */
480
+ export declare const currentAbortSignal: EnvRef<AbortSignal>;
481
+ /**
482
+ * @since 3.4.0
483
+ * @experimental
484
+ * @category environment refs
485
+ */
486
+ export declare const currentContext: EnvRef<Context.Context<never>>;
487
+ /**
488
+ * @since 3.4.0
489
+ * @experimental
490
+ * @category environment refs
491
+ */
492
+ export declare const currentConcurrency: EnvRef<"unbounded" | number>;
493
+ /**
494
+ * @since 3.4.0
495
+ * @experimental
496
+ * @category environment refs
497
+ */
498
+ export declare const currentMaxDepthBeforeYield: EnvRef<number>;
499
+ /**
500
+ * If you have a `Micro` that uses `concurrency: "inherit"`, you can use this
501
+ * api to control the concurrency of that `Micro` when it is run.
502
+ *
503
+ * @since 3.4.0
504
+ * @experimental
505
+ * @category environment refs
506
+ * @example
507
+ * import * as Micro from "effect/Micro"
508
+ *
509
+ * Micro.forEach([1, 2, 3], (n) => Micro.succeed(n), {
510
+ * concurrency: "inherit"
511
+ * }).pipe(
512
+ * Micro.withConcurrency(2) // use a concurrency of 2
513
+ * )
514
+ */
515
+ export declare const withConcurrency: {
516
+ (concurrency: "unbounded" | number): <A, E, R>(self: Micro<A, E, R>) => Micro<A, E, R>;
517
+ <A, E, R>(self: Micro<A, E, R>, concurrency: "unbounded" | number): Micro<A, E, R>;
518
+ };
519
+ /**
520
+ * A low-level constructor for creating a `Micro` effect. It takes a function
521
+ * that receives an environment and a callback which should be called with the
522
+ * result of the effect.
523
+ *
524
+ * @since 3.4.0
525
+ * @experimental
526
+ * @category constructors
527
+ */
528
+ export declare const make: <A, E, R>(run: (env: Env<R>, onResult: (result: Result<A, E>) => void) => void) => Micro<A, E, R>;
529
+ /**
530
+ * Converts a `Result` into a `Micro` effect.
531
+ *
532
+ * @since 3.4.0
533
+ * @experimental
534
+ * @category constructors
535
+ */
536
+ export declare const fromResult: <A, E>(self: Result<A, E>) => Micro<A, E>;
537
+ /**
538
+ * Converts a lazy `Result` into a `Micro` effect.
539
+ *
540
+ * @since 3.4.0
541
+ * @experimental
542
+ * @category constructors
543
+ */
544
+ export declare const fromResultSync: <A, E>(self: LazyArg<Result<A, E>>) => Micro<A, E>;
545
+ /**
546
+ * Creates a `Micro` effect that will succeed with the specified constant value.
547
+ *
548
+ * @since 3.4.0
549
+ * @experimental
550
+ * @category constructors
551
+ */
552
+ export declare const succeed: <A>(a: A) => Micro<A>;
553
+ /**
554
+ * Creates a `Micro` effect that will succeed with `Option.Some` of the value.
555
+ *
556
+ * @since 3.4.0
557
+ * @experimental
558
+ * @category constructors
559
+ */
560
+ export declare const succeedSome: <A>(a: A) => Micro<Option.Option<A>>;
561
+ /**
562
+ * Creates a `Micro` effect that will succeed with `Option.None`.
563
+ *
564
+ * @since 3.4.0
565
+ * @experimental
566
+ * @category constructors
567
+ */
568
+ export declare const succeedNone: Micro<Option.Option<never>>;
569
+ /**
570
+ * Creates a `Micro` effect that will fail with the specified error.
571
+ *
572
+ * This will result in a `FailureExpected`, where the error is tracked at the
573
+ * type level.
574
+ *
575
+ * @since 3.4.0
576
+ * @experimental
577
+ * @category constructors
578
+ */
579
+ export declare const fail: <E>(e: E) => Micro<never, E>;
580
+ /**
581
+ * Creates a `Micro` effect that will fail with the lazily evaluated error.
582
+ *
583
+ * This will result in a `FailureExpected`, where the error is tracked at the
584
+ * type level.
585
+ *
586
+ * @since 3.4.0
587
+ * @experimental
588
+ * @category constructors
589
+ */
590
+ export declare const failSync: <E>(e: LazyArg<E>) => Micro<never, E>;
591
+ /**
592
+ * Creates a `Micro` effect that will die with the specified error.
593
+ *
594
+ * This will result in a `FailureUnexpected`, where the error is not tracked at
595
+ * the type level.
596
+ *
597
+ * @since 3.4.0
598
+ * @experimental
599
+ * @category constructors
600
+ */
601
+ export declare const die: (defect: unknown) => Micro<never>;
602
+ /**
603
+ * Creates a `Micro` effect that will fail with the specified `Failure`.
604
+ *
605
+ * @since 3.4.0
606
+ * @experimental
607
+ * @category constructors
608
+ */
609
+ export declare const failWith: <E>(failure: Failure<E>) => Micro<never, E>;
610
+ /**
611
+ * Creates a `Micro` effect that will fail with the lazily evaluated `Failure`.
612
+ *
613
+ * @since 3.4.0
614
+ * @experimental
615
+ * @category constructors
616
+ */
617
+ export declare const failWithSync: <E>(failure: LazyArg<Failure<E>>) => Micro<never, E>;
618
+ /**
619
+ * Creates a `Micro` effect that will succeed with the lazily evaluated value.
620
+ *
621
+ * If the evaluation of the value throws an error, the effect will fail with
622
+ * `FailureUnexpected`.
623
+ *
624
+ * @since 3.4.0
625
+ * @experimental
626
+ * @category constructors
627
+ */
628
+ export declare const sync: <A>(evaluate: LazyArg<A>) => Micro<A>;
629
+ /**
630
+ * Converts an `Option` into a `Micro` effect, that will fail with a
631
+ * `Option.None` if the option is `None`. Otherwise, it will succeed with the
632
+ * value of the option.
633
+ *
634
+ * @since 3.4.0
635
+ * @experimental
636
+ * @category constructors
637
+ */
638
+ export declare const fromOption: <A>(option: Option.Option<A>) => Micro<A, Option.None<never>>;
639
+ /**
640
+ * Converts an `Either` into a `Micro` effect, that will fail with the left side
641
+ * of the either if it is a `Left`. Otherwise, it will succeed with the right
642
+ * side of the either.
643
+ *
644
+ * @since 3.4.0
645
+ * @experimental
646
+ * @category constructors
647
+ */
648
+ export declare const fromEither: <R, L>(either: Either.Either<R, L>) => Micro<R, L>;
649
+ /**
650
+ * Lazily creates a `Micro` effect from the given side-effect.
651
+ *
652
+ * @since 3.4.0
653
+ * @experimental
654
+ * @category constructors
655
+ */
656
+ export declare const suspend: <A, E, R>(evaluate: LazyArg<Micro<A, E, R>>) => Micro<A, E, R>;
657
+ declare const void_: Micro<void>;
658
+ export {
659
+ /**
660
+ * A `Micro` effect that will succeed with `void` (`undefined`).
661
+ *
662
+ * @since 3.4.0
663
+ * @experimental
664
+ * @category constructors
665
+ */
666
+ void_ as void };
667
+ /**
668
+ * Create a `Micro` effect from an asynchronous computation.
669
+ *
670
+ * You can return a cleanup effect that will be run when the effect is aborted.
671
+ * It is also passed an `AbortSignal` that is triggered when the effect is
672
+ * aborted.
673
+ *
674
+ * @since 3.4.0
675
+ * @experimental
676
+ * @category constructors
677
+ */
678
+ export declare const async: <A, E = never, R = never>(register: (resume: (effect: Micro<A, E, R>) => void, signal: AbortSignal) => void | Micro<void, never, R>) => Micro<A, E, R>;
679
+ declare const try_: <A, E>(options: {
680
+ try: LazyArg<A>;
681
+ catch: (error: unknown) => E;
682
+ }) => Micro<A, E>;
683
+ export {
684
+ /**
685
+ * The `Micro` equivalent of a try / catch block, which allows you to map
686
+ * thrown errors to a specific error type.
687
+ *
688
+ * @since 3.4.0
689
+ * @experimental
690
+ * @category constructors
691
+ * @example
692
+ * import { Micro } from "effect"
693
+ *
694
+ * Micro.try({
695
+ * try: () => throw new Error("boom"),
696
+ * catch: (cause) => new Error("caught", { cause })
697
+ * })
698
+ */
699
+ try_ as try };
700
+ /**
701
+ * Wrap a `Promise` into a `Micro` effect. Any errors will result in a
702
+ * `FailureUnexpected`.
703
+ *
704
+ * @since 3.4.0
705
+ * @experimental
706
+ * @category constructors
707
+ */
708
+ export declare const promise: <A>(evaluate: (signal: AbortSignal) => PromiseLike<A>) => Micro<A>;
709
+ /**
710
+ * Wrap a `Promise` into a `Micro` effect. Any errors will be caught and
711
+ * converted into a specific error type.
712
+ *
713
+ * @since 3.4.0
714
+ * @experimental
715
+ * @category constructors
716
+ * @example
717
+ * import { Micro } from "effect"
718
+ *
719
+ * Micro.tryPromise({
720
+ * try: () => Promise.resolve("success"),
721
+ * catch: (cause) => new Error("caught", { cause })
722
+ * })
723
+ */
724
+ export declare const tryPromise: <A, E>(options: {
725
+ readonly try: (signal: AbortSignal) => PromiseLike<A>;
726
+ readonly catch: (error: unknown) => E;
727
+ }) => Micro<A, E>;
728
+ /**
729
+ * Pause the execution of the current `Micro` effect, and resume it on the next
730
+ * iteration of the event loop.
731
+ *
732
+ * @since 3.4.0
733
+ * @experimental
734
+ * @category constructors
735
+ */
736
+ export declare const yieldNow: Micro<void>;
737
+ /**
738
+ * Flush any yielded effects that are waiting to be executed.
739
+ *
740
+ * @since 3.4.0
741
+ * @experimental
742
+ * @category constructors
743
+ */
744
+ export declare const yieldFlush: Micro<void>;
745
+ /**
746
+ * A `Micro` that will never succeed or fail. It wraps `setInterval` to prevent
747
+ * the Javascript runtime from exiting.
748
+ *
749
+ * @since 3.4.0
750
+ * @experimental
751
+ * @category constructors
752
+ */
753
+ export declare const never: Micro<never>;
754
+ /**
755
+ * @since 3.4.0
756
+ * @experimental
757
+ * @category constructors
758
+ */
759
+ export declare const gen: <Eff extends YieldWrap<Micro<any, any, any>>, AEff>(f: () => Generator<Eff, AEff, never>) => Micro<AEff, [Eff] extends [never] ? never : [Eff] extends [YieldWrap<Micro<infer _A, infer E, infer _R>>] ? E : never, [Eff] extends [never] ? never : [Eff] extends [YieldWrap<Micro<infer _A_1, infer _E, infer R>>] ? R : never>;
760
+ /**
761
+ * Flattens any nested `Micro` effects, merging the error and requirement types.
762
+ *
763
+ * @since 3.4.0
764
+ * @experimental
765
+ * @category mapping & sequencing
766
+ */
767
+ export declare const flatten: <A, E, R, E2, R2>(self: Micro<Micro<A, E, R>, E2, R2>) => Micro<A, E | E2, R | R2>;
768
+ /**
769
+ * Transforms the success value of the `Micro` effect with the specified
770
+ * function.
771
+ *
772
+ * @since 3.4.0
773
+ * @experimental
774
+ * @category mapping & sequencing
775
+ */
776
+ export declare const map: {
777
+ <A, B>(f: (a: A) => B): <E, R>(self: Micro<A, E, R>) => Micro<B, E, R>;
778
+ <A, E, R, B>(self: Micro<A, E, R>, f: (a: A) => B): Micro<B, E, R>;
779
+ };
780
+ /**
781
+ * Create a `Micro` effect that will replace the success value of the given
782
+ * effect.
783
+ *
784
+ * @since 3.4.0
785
+ * @experimental
786
+ * @category mapping & sequencing
787
+ */
788
+ export declare const as: {
789
+ <A, B>(value: B): <E, R>(self: Micro<A, E, R>) => Micro<B, E, R>;
790
+ <A, E, R, B>(self: Micro<A, E, R>, value: B): Micro<B, E, R>;
791
+ };
792
+ /**
793
+ * Wrap the success value of this `Micro` effect in an `Option.Some`.
794
+ *
795
+ * @since 3.4.0
796
+ * @experimental
797
+ * @category mapping & sequencing
798
+ */
799
+ export declare const asSome: <A, E, R>(self: Micro<A, E, R>) => Micro<Option.Option<A>, E, R>;
800
+ /**
801
+ * Map the success value of this `Micro` effect to another `Micro` effect, then
802
+ * flatten the result.
803
+ *
804
+ * @since 3.4.0
805
+ * @experimental
806
+ * @category mapping & sequencing
807
+ */
808
+ export declare const flatMap: {
809
+ <A, B, E2, R2>(f: (a: A) => Micro<B, E2, R2>): <E, R>(self: Micro<A, E, R>) => Micro<B, E | E2, R | R2>;
810
+ <A, E, R, B, E2, R2>(self: Micro<A, E, R>, f: (a: A) => Micro<B, E2, R2>): Micro<B, E | E2, R | R2>;
811
+ };
812
+ /**
813
+ * Swap the error and success types of the `Micro` effect.
814
+ *
815
+ * @since 3.4.0
816
+ * @experimental
817
+ * @category mapping & sequencing
818
+ */
819
+ export declare const flip: <A, E, R>(self: Micro<A, E, R>) => Micro<E, A, R>;
820
+ /**
821
+ * A more flexible version of `flatMap`, that combines `map` and `flatMap` into
822
+ * a single api.
823
+ *
824
+ * It also allows you to pass in a `Micro` effect directly, which will be
825
+ * executed after the current effect.
826
+ *
827
+ * @since 3.4.0
828
+ * @experimental
829
+ * @category mapping & sequencing
830
+ */
831
+ export declare const andThen: {
832
+ <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>;
833
+ <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>;
834
+ <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>;
835
+ <A, E, R, X>(self: Micro<A, E, R>, f: NotFunction<X>): [X] extends [Micro<infer A1, infer E1, infer R1>] ? Micro<A1, E | E1, R | R1> : Micro<X, E, R>;
836
+ };
837
+ /**
838
+ * Execute a side effect from the success value of the `Micro` effect.
839
+ *
840
+ * It is similar to the `andThen` api, but the success value is ignored.
841
+ *
842
+ * @since 3.4.0
843
+ * @experimental
844
+ * @category mapping & sequencing
845
+ */
846
+ export declare const tap: {
847
+ <A, X>(f: (a: NoInfer<A>) => X): <E, R>(self: Micro<A, E, R>) => [X] extends [Micro<infer _A1, infer E1, infer R1>] ? Micro<A, E | E1, R | R1> : Micro<A, E, R>;
848
+ <X>(f: NotFunction<X>): <A, E, R>(self: Micro<A, E, R>) => [X] extends [Micro<infer _A1, infer E1, infer R1>] ? Micro<A, E | E1, R | R1> : Micro<A, E, R>;
849
+ <A, E, R, X>(self: Micro<A, E, R>, f: (a: NoInfer<A>) => X): [X] extends [Micro<infer _A1, infer E1, infer R1>] ? Micro<A, E | E1, R | R1> : Micro<A, E, R>;
850
+ <A, E, R, X>(self: Micro<A, E, R>, f: NotFunction<X>): [X] extends [Micro<infer _A1, infer E1, infer R1>] ? Micro<A, E | E1, R | R1> : Micro<A, E, R>;
851
+ };
852
+ /**
853
+ * Replace the success value of the `Micro` effect with `void`.
854
+ *
855
+ * @since 3.4.0
856
+ * @experimental
857
+ * @category mapping & sequencing
858
+ */
859
+ export declare const asVoid: <A, E, R>(self: Micro<A, E, R>) => Micro<void, E, R>;
860
+ /**
861
+ * Access the `Result` of the given `Micro` effect.
862
+ *
863
+ * @since 3.4.0
864
+ * @experimental
865
+ * @category mapping & sequencing
866
+ */
867
+ export declare const asResult: <A, E, R>(self: Micro<A, E, R>) => Micro<Result<A, E>, never, R>;
868
+ /**
869
+ * Replace the error type of the given `Micro` with the full `Failure` object.
870
+ *
871
+ * @since 3.4.0
872
+ * @experimental
873
+ * @category mapping & sequencing
874
+ */
875
+ export declare const sandbox: <A, E, R>(self: Micro<A, E, R>) => Micro<A, Failure<E>, R>;
876
+ /**
877
+ * Returns an effect that races all the specified effects,
878
+ * yielding the value of the first effect to succeed with a value. Losers of
879
+ * the race will be interrupted immediately
880
+ *
881
+ * @since 3.4.0
882
+ * @experimental
883
+ * @category sequencing
884
+ */
885
+ export declare const raceAll: <Eff extends Micro<any, any, any>>(all: Iterable<Eff>) => Micro<Micro.Success<Eff>, Micro.Error<Eff>, Micro.Context<Eff>>;
886
+ /**
887
+ * Returns an effect that races all the specified effects,
888
+ * yielding the value of the first effect to succeed or fail. Losers of
889
+ * the race will be interrupted immediately
890
+ *
891
+ * @since 3.4.0
892
+ * @experimental
893
+ * @category sequencing
894
+ */
895
+ export declare const raceAllFirst: <Eff extends Micro<any, any, any>>(all: Iterable<Eff>) => Micro<Micro.Success<Eff>, Micro.Error<Eff>, Micro.Context<Eff>>;
896
+ /**
897
+ * Returns an effect that races two effects, yielding the value of the first
898
+ * effect to succeed. Losers of the race will be interrupted immediately
899
+ *
900
+ * @since 3.4.0
901
+ * @experimental
902
+ * @category sequencing
903
+ */
904
+ export declare const race: {
905
+ <A2, E2, R2>(that: Micro<A2, E2, R2>): <A, E, R>(self: Micro<A, E, R>) => Micro<A | A2, E | E2, R | R2>;
906
+ <A, E, R, A2, E2, R2>(self: Micro<A, E, R>, that: Micro<A2, E2, R2>): Micro<A | A2, E | E2, R | R2>;
907
+ };
908
+ /**
909
+ * Returns an effect that races two effects, yielding the value of the first
910
+ * effect to succeed *or* fail. Losers of the race will be interrupted immediately
911
+ *
912
+ * @since 3.4.0
913
+ * @experimental
914
+ * @category sequencing
915
+ */
916
+ export declare const raceFirst: {
917
+ <A2, E2, R2>(that: Micro<A2, E2, R2>): <A, E, R>(self: Micro<A, E, R>) => Micro<A | A2, E | E2, R | R2>;
918
+ <A, E, R, A2, E2, R2>(self: Micro<A, E, R>, that: Micro<A2, E2, R2>): Micro<A | A2, E | E2, R | R2>;
919
+ };
920
+ /**
921
+ * Combine two `Micro` effects into a single effect that produces a tuple of
922
+ * their results.
923
+ *
924
+ * @since 3.4.0
925
+ * @experimental
926
+ * @category zipping
927
+ */
928
+ export declare const zip: {
929
+ <A2, E2, R2>(that: Micro<A2, E2, R2>, options?: {
930
+ readonly concurrent?: boolean | undefined;
931
+ } | undefined): <A, E, R>(self: Micro<A, E, R>) => Micro<[A, A2], E2 | E, R2 | R>;
932
+ <A, E, R, A2, E2, R2>(self: Micro<A, E, R>, that: Micro<A2, E2, R2>, options?: {
933
+ readonly concurrent?: boolean | undefined;
934
+ } | undefined): Micro<[A, A2], E | E2, R | R2>;
935
+ };
936
+ /**
937
+ * Filter the specified effect with the provided function, failing with specified
938
+ * `Failure` if the predicate fails.
939
+ *
940
+ * In addition to the filtering capabilities discussed earlier, you have the option to further
941
+ * refine and narrow down the type of the success channel by providing a
942
+ *
943
+ * @since 3.4.0
944
+ * @experimental
945
+ * @category filtering & conditionals
946
+ */
947
+ export declare const filterOrFailWith: {
948
+ <A, B extends A, E2>(refinement: Refinement<A, B>, orFailWith: (a: NoInfer<A>) => Failure<E2>): <E, R>(self: Micro<A, E, R>) => Micro<B, E2 | E, R>;
949
+ <A, E2>(predicate: Predicate<NoInfer<A>>, orFailWith: (a: NoInfer<A>) => Failure<E2>): <E, R>(self: Micro<A, E, R>) => Micro<A, E2 | E, R>;
950
+ <A, E, R, B extends A, E2>(self: Micro<A, E, R>, refinement: Refinement<A, B>, orFailWith: (a: A) => Failure<E2>): Micro<B, E | E2, R>;
951
+ <A, E, R, E2>(self: Micro<A, E, R>, predicate: Predicate<A>, orFailWith: (a: A) => Failure<E2>): Micro<A, E | E2, R>;
952
+ };
953
+ /**
954
+ * Filter the specified effect with the provided function, failing with specified
955
+ * error if the predicate fails.
956
+ *
957
+ * In addition to the filtering capabilities discussed earlier, you have the option to further
958
+ * refine and narrow down the type of the success channel by providing a
959
+ *
960
+ * @since 3.4.0
961
+ * @experimental
962
+ * @category filtering & conditionals
963
+ */
964
+ export declare const filterOrFail: {
965
+ <A, B extends A, E2>(refinement: Refinement<A, B>, orFailWith: (a: NoInfer<A>) => E2): <E, R>(self: Micro<A, E, R>) => Micro<B, E2 | E, R>;
966
+ <A, E2>(predicate: Predicate<NoInfer<A>>, orFailWith: (a: NoInfer<A>) => E2): <E, R>(self: Micro<A, E, R>) => Micro<A, E2 | E, R>;
967
+ <A, E, R, B extends A, E2>(self: Micro<A, E, R>, refinement: Refinement<A, B>, orFailWith: (a: A) => E2): Micro<B, E | E2, R>;
968
+ <A, E, R, E2>(self: Micro<A, E, R>, predicate: Predicate<A>, orFailWith: (a: A) => E2): Micro<A, E | E2, R>;
969
+ };
970
+ /**
971
+ * The moral equivalent of `if (p) exp`.
972
+ *
973
+ * @since 3.4.0
974
+ * @experimental
975
+ * @category filtering & conditionals
976
+ */
977
+ export declare const when: {
978
+ <E2 = never, R2 = never>(condition: LazyArg<boolean> | Micro<boolean, E2, R2>): <A, E, R>(self: Micro<A, E, R>) => Micro<Option.Option<A>, E | E2, R | R2>;
979
+ <A, E, R, E2 = never, R2 = never>(self: Micro<A, E, R>, condition: LazyArg<boolean> | Micro<boolean, E2, R2>): Micro<Option.Option<A>, E | E2, R | R2>;
980
+ };
981
+ /**
982
+ * Repeat the given `Micro` using the provided options.
983
+ *
984
+ * The `while` predicate will be checked after each iteration, and can use the
985
+ * fall `Result` of the effect to determine if the repetition should continue.
986
+ *
987
+ * @since 3.4.0
988
+ * @experimental
989
+ * @category repetition
990
+ */
991
+ export declare const repeatResult: {
992
+ <A, E>(options: {
993
+ while: Predicate<Result<A, E>>;
994
+ times?: number | undefined;
995
+ delay?: DelayFn | undefined;
996
+ }): <R>(self: Micro<A, E, R>) => Micro<A, E, R>;
997
+ <A, E, R>(self: Micro<A, E, R>, options: {
998
+ while: Predicate<Result<A, E>>;
999
+ times?: number | undefined;
1000
+ delay?: DelayFn | undefined;
1001
+ }): Micro<A, E, R>;
1002
+ };
1003
+ /**
1004
+ * Repeat the given `Micro` effect using the provided options. Only successful
1005
+ * results will be repeated.
1006
+ *
1007
+ * @since 3.4.0
1008
+ * @experimental
1009
+ * @category repetition
1010
+ */
1011
+ export declare const repeat: {
1012
+ <A, E>(options?: {
1013
+ while?: Predicate<A> | undefined;
1014
+ times?: number | undefined;
1015
+ delay?: DelayFn | undefined;
1016
+ } | undefined): <R>(self: Micro<A, E, R>) => Micro<A, E, R>;
1017
+ <A, E, R>(self: Micro<A, E, R>, options?: {
1018
+ while?: Predicate<A> | undefined;
1019
+ times?: number | undefined;
1020
+ delay?: DelayFn | undefined;
1021
+ } | undefined): Micro<A, E, R>;
1022
+ };
1023
+ /**
1024
+ * Repeat the given `Micro` effect forever, only stopping if the effect fails.
1025
+ *
1026
+ * @since 3.4.0
1027
+ * @experimental
1028
+ * @category repetition
1029
+ */
1030
+ export declare const forever: <A, E, R>(self: Micro<A, E, R>) => Micro<never, E, R>;
1031
+ /**
1032
+ * Represents a function that can be used to calculate the delay between
1033
+ * repeats.
1034
+ *
1035
+ * The function takes the current attempt number and the elapsed time since
1036
+ * the first attempt, and returns the delay for the next attempt. If the
1037
+ * function returns `None`, the repetition will stop.
1038
+ *
1039
+ * @since 3.4.0
1040
+ * @experimental
1041
+ * @category delay fn
1042
+ */
1043
+ export type DelayFn = (attempt: number, elapsed: number) => Option.Option<number>;
1044
+ /**
1045
+ * Create a `DelayFn` that will generate a duration with an exponential backoff.
1046
+ *
1047
+ * @since 3.4.0
1048
+ * @experimental
1049
+ * @category delay fn
1050
+ */
1051
+ export declare const delayExponential: (baseMillis: number, factor?: number) => DelayFn;
1052
+ /**
1053
+ * Create a `DelayFn` that will generate a duration with fixed intervals.
1054
+ *
1055
+ * @since 3.4.0
1056
+ * @experimental
1057
+ * @category delay fn
1058
+ */
1059
+ export declare const delaySpaced: (millis: number) => DelayFn;
1060
+ /**
1061
+ * Transform a `DelayFn` to one that will have a duration that will never exceed
1062
+ * the specified maximum.
1063
+ *
1064
+ * @since 3.4.0
1065
+ * @experimental
1066
+ * @category delay fn
1067
+ */
1068
+ export declare const delayWithMax: {
1069
+ (max: number): (self: DelayFn) => DelayFn;
1070
+ (self: DelayFn, max: number): DelayFn;
1071
+ };
1072
+ /**
1073
+ * Transform a `DelayFn` to one that will stop repeating after the specified
1074
+ * amount of time.
1075
+ *
1076
+ * @since 3.4.0
1077
+ * @experimental
1078
+ * @category delay fn
1079
+ */
1080
+ export declare const delayWithMaxElapsed: {
1081
+ (max: number): (self: DelayFn) => DelayFn;
1082
+ (self: DelayFn, max: number): DelayFn;
1083
+ };
1084
+ /**
1085
+ * Transform a `DelayFn` to one that will stop repeating after the specified
1086
+ * number of attempts.
1087
+ *
1088
+ * @since 3.4.0
1089
+ * @experimental
1090
+ * @category delay fn
1091
+ */
1092
+ export declare const delayWithRecurs: {
1093
+ (n: number): (self: DelayFn) => DelayFn;
1094
+ (self: DelayFn, n: number): DelayFn;
1095
+ };
1096
+ /**
1097
+ * Catch the full `Failure` object of the given `Micro` effect, allowing you to
1098
+ * recover from any kind of failure.
1099
+ *
1100
+ * @since 3.4.0
1101
+ * @experimental
1102
+ * @category error handling
1103
+ */
1104
+ export declare const catchFailure: {
1105
+ <E, B, E2, R2>(f: (failure: NoInfer<Failure<E>>) => Micro<B, E2, R2>): <A, R>(self: Micro<A, E, R>) => Micro<A | B, E2, R | R2>;
1106
+ <A, E, R, B, E2, R2>(self: Micro<A, E, R>, f: (failure: NoInfer<Failure<E>>) => Micro<B, E2, R2>): Micro<A | B, E2, R | R2>;
1107
+ };
1108
+ /**
1109
+ * Selectively catch a `Failure` object of the given `Micro` effect,
1110
+ * using the provided predicate to determine if the failure should be caught.
1111
+ *
1112
+ * @since 3.4.0
1113
+ * @experimental
1114
+ * @category error handling
1115
+ */
1116
+ export declare const catchFailureIf: {
1117
+ <E, B, E2, R2, EB extends Failure<E>>(refinement: Refinement<Failure<E>, EB>, f: (failure: EB) => Micro<B, E2, R2>): <A, R>(self: Micro<A, E, R>) => Micro<A | B, E2, R | R2>;
1118
+ <E, B, E2, R2>(predicate: Predicate<Failure<NoInfer<E>>>, f: (failure: NoInfer<Failure<E>>) => Micro<B, E2, R2>): <A, R>(self: Micro<A, E, R>) => Micro<A | B, E2, R | R2>;
1119
+ <A, E, R, B, E2, R2, EB extends Failure<E>>(self: Micro<A, E, R>, refinement: Refinement<Failure<E>, EB>, f: (failure: EB) => Micro<B, E2, R2>): Micro<A | B, E2, R | R2>;
1120
+ <A, E, R, B, E2, R2>(self: Micro<A, E, R>, predicate: Predicate<Failure<NoInfer<E>>>, f: (failure: NoInfer<Failure<E>>) => Micro<B, E2, R2>): Micro<A | B, E2, R | R2>;
1121
+ };
1122
+ /**
1123
+ * Catch the error of the given `Micro` effect, allowing you to recover from it.
1124
+ *
1125
+ * It only catches expected (`FailureExpected`) errors.
1126
+ *
1127
+ * @since 3.4.0
1128
+ * @experimental
1129
+ * @category error handling
1130
+ */
1131
+ export declare const catchExpected: {
1132
+ <E, B, E2, R2>(f: (e: NoInfer<E>) => Micro<B, E2, R2>): <A, R>(self: Micro<A, E, R>) => Micro<A | B, E2, R | R2>;
1133
+ <A, E, R, B, E2, R2>(self: Micro<A, E, R>, f: (e: NoInfer<E>) => Micro<B, E2, R2>): Micro<A | B, E2, R | R2>;
1134
+ };
1135
+ /**
1136
+ * Catch any unexpected errors of the given `Micro` effect, allowing you to recover from them.
1137
+ *
1138
+ * @since 3.4.0
1139
+ * @experimental
1140
+ * @category error handling
1141
+ */
1142
+ export declare const catchUnexpected: {
1143
+ <E, B, E2, R2>(f: (defect: unknown) => Micro<B, E2, R2>): <A, R>(self: Micro<A, E, R>) => Micro<A | B, E | E2, R | R2>;
1144
+ <A, E, R, B, E2, R2>(self: Micro<A, E, R>, f: (defect: unknown) => Micro<B, E2, R2>): Micro<A | B, E | E2, R | R2>;
1145
+ };
1146
+ /**
1147
+ * Perform a side effect using the full `Failure` object of the given `Micro`.
1148
+ *
1149
+ * @since 3.4.0
1150
+ * @experimental
1151
+ * @category error handling
1152
+ */
1153
+ export declare const tapFailure: {
1154
+ <E, B, E2, R2>(f: (a: NoInfer<Failure<E>>) => Micro<B, E2, R2>): <A, R>(self: Micro<A, E, R>) => Micro<A, E | E2, R | R2>;
1155
+ <A, E, R, B, E2, R2>(self: Micro<A, E, R>, f: (a: NoInfer<Failure<E>>) => Micro<B, E2, R2>): Micro<A, E | E2, R | R2>;
1156
+ };
1157
+ /**
1158
+ * Perform a side effect using if a `Failure` object matches the specified
1159
+ * predicate.
1160
+ *
1161
+ * @since 3.4.0
1162
+ * @experimental
1163
+ * @category error handling
1164
+ */
1165
+ export declare const tapFailureIf: {
1166
+ <E, B, E2, R2, EB extends Failure<E>>(refinement: Refinement<Failure<E>, EB>, f: (a: EB) => Micro<B, E2, R2>): <A, R>(self: Micro<A, E, R>) => Micro<A, E | E2, R | R2>;
1167
+ <E, B, E2, R2>(predicate: (failure: NoInfer<Failure<E>>) => boolean, f: (a: NoInfer<Failure<E>>) => Micro<B, E2, R2>): <A, R>(self: Micro<A, E, R>) => Micro<A, E | E2, R | R2>;
1168
+ <A, E, R, B, E2, R2, EB extends Failure<E>>(self: Micro<A, E, R>, refinement: Refinement<Failure<E>, EB>, f: (a: EB) => Micro<B, E2, R2>): Micro<A, E | E2, R | R2>;
1169
+ <A, E, R, B, E2, R2>(self: Micro<A, E, R>, predicate: (failure: NoInfer<Failure<E>>) => boolean, f: (a: NoInfer<Failure<E>>) => Micro<B, E2, R2>): Micro<A, E | E2, R | R2>;
1170
+ };
1171
+ /**
1172
+ * Perform a side effect from expected errors of the given `Micro`.
1173
+ *
1174
+ * @since 3.4.0
1175
+ * @experimental
1176
+ * @category error handling
1177
+ */
1178
+ export declare const tapExpected: {
1179
+ <E, B, E2, R2>(f: (a: NoInfer<E>) => Micro<B, E2, R2>): <A, R>(self: Micro<A, E, R>) => Micro<A, E | E2, R | R2>;
1180
+ <A, E, R, B, E2, R2>(self: Micro<A, E, R>, f: (a: NoInfer<E>) => Micro<B, E2, R2>): Micro<A, E | E2, R | R2>;
1181
+ };
1182
+ /**
1183
+ * Perform a side effect from unexpected errors of the given `Micro`.
1184
+ *
1185
+ * @since 3.4.0
1186
+ * @experimental
1187
+ * @category error handling
1188
+ */
1189
+ export declare const tapUnexpected: {
1190
+ <E, B, E2, R2>(f: (defect: unknown) => Micro<B, E2, R2>): <A, R>(self: Micro<A, E, R>) => Micro<A, E | E2, R | R2>;
1191
+ <A, E, R, B, E2, R2>(self: Micro<A, E, R>, f: (defect: unknown) => Micro<B, E2, R2>): Micro<A, E | E2, R | R2>;
1192
+ };
1193
+ /**
1194
+ * Catch any expected errors that match the specified predicate.
1195
+ *
1196
+ * @since 3.4.0
1197
+ * @experimental
1198
+ * @category error handling
1199
+ */
1200
+ export declare const catchIf: {
1201
+ <E, EB extends E, B, E2, R2>(pred: Refinement<E, EB>, f: (a: NoInfer<EB>) => Micro<B, E2, R2>): <A, R>(self: Micro<A, E, R>) => Micro<A | B, E2, R | R2>;
1202
+ <E, B, E2, R2>(pred: Predicate<NoInfer<E>>, f: (a: NoInfer<E>) => Micro<B, E2, R2>): <A, R>(self: Micro<A, E, R>) => Micro<A | B, E2, R | R2>;
1203
+ <A, E, R, EB extends E, B, E2, R2>(self: Micro<A, E, R>, pred: Refinement<E, EB>, f: (a: NoInfer<EB>) => Micro<B, E2, R2>): Micro<A | B, E2, R | R2>;
1204
+ <A, E, R, B, E2, R2>(self: Micro<A, E, R>, pred: Predicate<NoInfer<E>>, f: (a: NoInfer<E>) => Micro<B, E2, R2>): Micro<A | B, E2, R | R2>;
1205
+ };
1206
+ /**
1207
+ * Recovers from the specified tagged error.
1208
+ *
1209
+ * @since 3.4.0
1210
+ * @experimental
1211
+ * @category error handling
1212
+ */
1213
+ export declare const catchTag: {
1214
+ <K extends E extends {
1215
+ _tag: string;
1216
+ } ? E["_tag"] : never, E, A1, E1, R1>(k: K, f: (e: Extract<E, {
1217
+ _tag: K;
1218
+ }>) => Micro<A1, E1, R1>): <A, R>(self: Micro<A, E, R>) => Micro<A1 | A, E1 | Exclude<E, {
1219
+ _tag: K;
1220
+ }>, R1 | R>;
1221
+ <A, E, R, K extends E extends {
1222
+ _tag: string;
1223
+ } ? E["_tag"] : never, R1, E1, A1>(self: Micro<A, E, R>, k: K, f: (e: Extract<E, {
1224
+ _tag: K;
1225
+ }>) => Micro<A1, E1, R1>): Micro<A | A1, E1 | Exclude<E, {
1226
+ _tag: K;
1227
+ }>, R | R1>;
1228
+ };
1229
+ /**
1230
+ * Transform the full `Failure` object of the given `Micro` effect.
1231
+ *
1232
+ * @since 3.4.0
1233
+ * @experimental
1234
+ * @category error handling
1235
+ */
1236
+ export declare const mapFailure: {
1237
+ <E, E2>(f: (a: Failure<E>) => Failure<E2>): <A, R>(self: Micro<A, E, R>) => Micro<A, E2, R>;
1238
+ <A, E, R, E2>(self: Micro<A, E, R>, f: (a: Failure<E>) => Failure<E2>): Micro<A, E2, R>;
1239
+ };
1240
+ /**
1241
+ * Transform any expected errors of the given `Micro` effect.
1242
+ *
1243
+ * @since 3.4.0
1244
+ * @experimental
1245
+ * @category error handling
1246
+ */
1247
+ export declare const mapError: {
1248
+ <E, E2>(f: (a: E) => E2): <A, R>(self: Micro<A, E, R>) => Micro<A, E2, R>;
1249
+ <A, E, R, E2>(self: Micro<A, E, R>, f: (a: E) => E2): Micro<A, E2, R>;
1250
+ };
1251
+ /**
1252
+ * Elevate any expected errors of the given `Micro` effect to unexpected errors,
1253
+ * resulting in an error type of `never`.
1254
+ *
1255
+ * @since 3.4.0
1256
+ * @experimental
1257
+ * @category error handling
1258
+ */
1259
+ export declare const orDie: <A, E, R>(self: Micro<A, E, R>) => Micro<A, never, R>;
1260
+ /**
1261
+ * Recover from all errors by succeeding with the given value.
1262
+ *
1263
+ * @since 3.4.0
1264
+ * @experimental
1265
+ * @category error handling
1266
+ */
1267
+ export declare const orElseSucceed: {
1268
+ <B>(f: LazyArg<B>): <A, E, R>(self: Micro<A, E, R>) => Micro<A | B, never, R>;
1269
+ <A, E, R, B>(self: Micro<A, E, R>, f: LazyArg<B>): Micro<A | B, never, R>;
1270
+ };
1271
+ /**
1272
+ * Ignore any expected errors of the given `Micro` effect, returning `void`.
1273
+ *
1274
+ * @since 3.4.0
1275
+ * @experimental
1276
+ * @category error handling
1277
+ */
1278
+ export declare const ignore: <A, E, R>(self: Micro<A, E, R>) => Micro<void, never, R>;
1279
+ /**
1280
+ * Ignore any expected errors of the given `Micro` effect, returning `void`.
1281
+ *
1282
+ * @since 3.4.0
1283
+ * @experimental
1284
+ * @category error handling
1285
+ */
1286
+ export declare const ignoreLogged: <A, E, R>(self: Micro<A, E, R>) => Micro<void, never, R>;
1287
+ /**
1288
+ * Replace the success value of the given `Micro` effect with an `Option`,
1289
+ * wrapping the success value in `Some` and returning `None` if the effect fails
1290
+ * with an expected error.
1291
+ *
1292
+ * @since 3.4.0
1293
+ * @experimental
1294
+ * @category error handling
1295
+ */
1296
+ export declare const option: <A, E, R>(self: Micro<A, E, R>) => Micro<Option.Option<A>, never, R>;
1297
+ /**
1298
+ * Replace the success value of the given `Micro` effect with an `Either`,
1299
+ * wrapping the success value in `Right` and wrapping any expected errors with
1300
+ * a `Left`.
1301
+ *
1302
+ * @since 3.4.0
1303
+ * @experimental
1304
+ * @category error handling
1305
+ */
1306
+ export declare const either: <A, E, R>(self: Micro<A, E, R>) => Micro<Either.Either<A, E>, never, R>;
1307
+ /**
1308
+ * Retry the given `Micro` effect using the provided options.
1309
+ *
1310
+ * @since 3.4.0
1311
+ * @experimental
1312
+ * @category error handling
1313
+ */
1314
+ export declare const retry: {
1315
+ <A, E>(options?: {
1316
+ while?: Predicate<E> | undefined;
1317
+ times?: number | undefined;
1318
+ delay?: DelayFn | undefined;
1319
+ } | undefined): <R>(self: Micro<A, E, R>) => Micro<A, E, R>;
1320
+ <A, E, R>(self: Micro<A, E, R>, options?: {
1321
+ while?: Predicate<E> | undefined;
1322
+ times?: number | undefined;
1323
+ delay?: DelayFn | undefined;
1324
+ } | undefined): Micro<A, E, R>;
1325
+ };
1326
+ /**
1327
+ * Add a stack trace to any failures that occur in the effect. The trace will be
1328
+ * added to the `traces` field of the `Failure` object.
1329
+ *
1330
+ * @since 3.4.0
1331
+ * @experimental
1332
+ * @category error handling
1333
+ */
1334
+ export declare const withTrace: {
1335
+ (name: string): <A, E, R>(self: Micro<A, E, R>) => Micro<A, E, R>;
1336
+ <A, E, R>(self: Micro<A, E, R>, name: string): Micro<A, E, R>;
1337
+ };
1338
+ /**
1339
+ * @since 3.4.0
1340
+ * @experimental
1341
+ * @category pattern matching
1342
+ */
1343
+ export declare const matchFailureMicro: {
1344
+ <E, A2, E2, R2, A, A3, E3, R3>(options: {
1345
+ readonly onFailure: (failure: Failure<E>) => Micro<A2, E2, R2>;
1346
+ readonly onSuccess: (a: A) => Micro<A3, E3, R3>;
1347
+ }): <R>(self: Micro<A, E, R>) => Micro<A2 | A3, E2 | E3, R2 | R3 | R>;
1348
+ <A, E, R, A2, E2, R2, A3, E3, R3>(self: Micro<A, E, R>, options: {
1349
+ readonly onFailure: (failure: Failure<E>) => Micro<A2, E2, R2>;
1350
+ readonly onSuccess: (a: A) => Micro<A3, E3, R3>;
1351
+ }): Micro<A2 | A3, E2 | E3, R2 | R3 | R>;
1352
+ };
1353
+ /**
1354
+ * @since 3.4.0
1355
+ * @experimental
1356
+ * @category pattern matching
1357
+ */
1358
+ export declare const matchFailure: {
1359
+ <E, A2, A, A3>(options: {
1360
+ readonly onFailure: (failure: Failure<E>) => A2;
1361
+ readonly onSuccess: (a: A) => A3;
1362
+ }): <R>(self: Micro<A, E, R>) => Micro<A2 | A3, never, R>;
1363
+ <A, E, R, A2, A3>(self: Micro<A, E, R>, options: {
1364
+ readonly onFailure: (failure: Failure<E>) => A2;
1365
+ readonly onSuccess: (a: A) => A3;
1366
+ }): Micro<A2 | A3, never, R>;
1367
+ };
1368
+ /**
1369
+ * @since 3.4.0
1370
+ * @experimental
1371
+ * @category pattern matching
1372
+ */
1373
+ export declare const matchMicro: {
1374
+ <E, A2, E2, R2, A, A3, E3, R3>(options: {
1375
+ readonly onFailure: (e: E) => Micro<A2, E2, R2>;
1376
+ readonly onSuccess: (a: A) => Micro<A3, E3, R3>;
1377
+ }): <R>(self: Micro<A, E, R>) => Micro<A2 | A3, E2 | E3, R2 | R3 | R>;
1378
+ <A, E, R, A2, E2, R2, A3, E3, R3>(self: Micro<A, E, R>, options: {
1379
+ readonly onFailure: (e: E) => Micro<A2, E2, R2>;
1380
+ readonly onSuccess: (a: A) => Micro<A3, E3, R3>;
1381
+ }): Micro<A2 | A3, E2 | E3, R2 | R3 | R>;
1382
+ };
1383
+ /**
1384
+ * @since 3.4.0
1385
+ * @experimental
1386
+ * @category pattern matching
1387
+ */
1388
+ export declare const match: {
1389
+ <E, A2, A, A3>(options: {
1390
+ readonly onFailure: (error: E) => A2;
1391
+ readonly onSuccess: (value: A) => A3;
1392
+ }): <R>(self: Micro<A, E, R>) => Micro<A2 | A3, never, R>;
1393
+ <A, E, R, A2, A3>(self: Micro<A, E, R>, options: {
1394
+ readonly onFailure: (error: E) => A2;
1395
+ readonly onSuccess: (value: A) => A3;
1396
+ }): Micro<A2 | A3, never, R>;
1397
+ };
1398
+ /**
1399
+ * Create a `Micro` effect that will sleep for the specified duration.
1400
+ *
1401
+ * @since 3.4.0
1402
+ * @experimental
1403
+ * @category delays & timeouts
1404
+ */
1405
+ export declare const sleep: (millis: number) => Micro<void>;
1406
+ /**
1407
+ * Returns an effect that will delay the execution of this effect by the
1408
+ * specified duration.
1409
+ *
1410
+ * @since 3.4.0
1411
+ * @experimental
1412
+ * @category delays & timeouts
1413
+ */
1414
+ export declare const delay: {
1415
+ (millis: number): <A, E, R>(self: Micro<A, E, R>) => Micro<A, E, R>;
1416
+ <A, E, R>(self: Micro<A, E, R>, millis: number): Micro<A, E, R>;
1417
+ };
1418
+ /**
1419
+ * Returns an effect that will timeout this effect, that will execute the
1420
+ * fallback effect if the timeout elapses before the effect has produced a value.
1421
+ *
1422
+ * If the timeout elapses, the running effect will be safely interrupted.
1423
+ *
1424
+ * @since 3.4.0
1425
+ * @experimental
1426
+ * @category delays & timeouts
1427
+ */
1428
+ export declare const timeoutOrElse: {
1429
+ <A2, E2, R2>(options: {
1430
+ readonly duration: number;
1431
+ readonly onTimeout: LazyArg<Micro<A2, E2, R2>>;
1432
+ }): <A, E, R>(self: Micro<A, E, R>) => Micro<A | A2, E | E2, R | R2>;
1433
+ <A, E, R, A2, E2, R2>(self: Micro<A, E, R>, options: {
1434
+ readonly duration: number;
1435
+ readonly onTimeout: LazyArg<Micro<A2, E2, R2>>;
1436
+ }): Micro<A | A2, E | E2, R | R2>;
1437
+ };
1438
+ /**
1439
+ * Returns an effect that will timeout this effect, succeeding with a `None`
1440
+ * if the timeout elapses before the effect has produced a value; and `Some` of
1441
+ * the produced value otherwise.
1442
+ *
1443
+ * If the timeout elapses, the running effect will be safely interrupted.
1444
+ *
1445
+ * @since 3.4.0
1446
+ * @experimental
1447
+ * @category delays & timeouts
1448
+ */
1449
+ export declare const timeout: {
1450
+ (millis: number): <A, E, R>(self: Micro<A, E, R>) => Micro<Option.Option<A>, E, R>;
1451
+ <A, E, R>(self: Micro<A, E, R>, millis: number): Micro<Option.Option<A>, E, R>;
1452
+ };
1453
+ /**
1454
+ * @since 3.4.0
1455
+ * @experimental
1456
+ * @category resources & finalization
1457
+ */
1458
+ export declare const MicroScopeTypeId: unique symbol;
1459
+ /**
1460
+ * @since 3.4.0
1461
+ * @experimental
1462
+ * @category resources & finalization
1463
+ */
1464
+ export type MicroScopeTypeId = typeof MicroScopeTypeId;
1465
+ /**
1466
+ * @since 3.4.0
1467
+ * @experimental
1468
+ * @category resources & finalization
1469
+ */
1470
+ export interface MicroScope {
1471
+ readonly [MicroScopeTypeId]: MicroScopeTypeId;
1472
+ readonly addFinalizer: (finalizer: (result: Result<unknown, unknown>) => Micro<void>) => Micro<void>;
1473
+ readonly fork: Micro<MicroScope.Closeable>;
1474
+ }
1475
+ /**
1476
+ * @since 3.4.0
1477
+ * @experimental
1478
+ * @category resources & finalization
1479
+ */
1480
+ export declare namespace MicroScope {
1481
+ /**
1482
+ * @since 3.4.0
1483
+ * @experimental
1484
+ * @category resources & finalization
1485
+ */
1486
+ interface Closeable extends MicroScope {
1487
+ readonly close: (result: Result<any, any>) => Micro<void>;
1488
+ }
1489
+ }
1490
+ /**
1491
+ * @since 3.4.0
1492
+ * @experimental
1493
+ * @category resources & finalization
1494
+ */
1495
+ export declare const MicroScope: Context.Tag<MicroScope, MicroScope>;
1496
+ /**
1497
+ * @since 3.4.0
1498
+ * @experimental
1499
+ * @category resources & finalization
1500
+ */
1501
+ export declare const scopeMake: Micro<MicroScope.Closeable>;
1502
+ /**
1503
+ * @since 3.4.0
1504
+ * @experimental
1505
+ * @category resources & finalization
1506
+ */
1507
+ export declare const scopeUnsafeMake: () => MicroScope.Closeable;
1508
+ /**
1509
+ * Access the current `MicroScope`.
1510
+ *
1511
+ * @since 3.4.0
1512
+ * @experimental
1513
+ * @category resources & finalization
1514
+ */
1515
+ export declare const scope: Micro<MicroScope, never, MicroScope>;
1516
+ /**
1517
+ * Provide a `MicroScope` to an effect.
1518
+ *
1519
+ * @since 3.4.0
1520
+ * @experimental
1521
+ * @category resources & finalization
1522
+ */
1523
+ export declare const provideScope: {
1524
+ (scope: MicroScope): <A, E, R>(self: Micro<A, E, R>) => Micro<A, E, Exclude<R, MicroScope>>;
1525
+ <A, E, R>(self: Micro<A, E, R>, scope: MicroScope): Micro<A, E, Exclude<R, MicroScope>>;
1526
+ };
1527
+ /**
1528
+ * Provide a `MicroScope` to the given effect, closing it after the effect has
1529
+ * finished executing.
1530
+ *
1531
+ * @since 3.4.0
1532
+ * @experimental
1533
+ * @category resources & finalization
1534
+ */
1535
+ export declare const scoped: <A, E, R>(self: Micro<A, E, R>) => Micro<A, E, Exclude<R, MicroScope>>;
1536
+ /**
1537
+ * Create a resource with a cleanup `Micro` effect, ensuring the cleanup is
1538
+ * executed when the `MicroScope` is closed.
1539
+ *
1540
+ * @since 3.4.0
1541
+ * @experimental
1542
+ * @category resources & finalization
1543
+ */
1544
+ export declare const acquireRelease: <A, E, R>(acquire: Micro<A, E, R>, release: (a: A, result: Result<unknown, unknown>) => Micro<void>) => Micro<A, E, R | MicroScope>;
1545
+ /**
1546
+ * Add a finalizer to the current `MicroScope`.
1547
+ *
1548
+ * @since 3.4.0
1549
+ * @experimental
1550
+ * @category resources & finalization
1551
+ */
1552
+ export declare const addFinalizer: (finalizer: (result: Result<unknown, unknown>) => Micro<void>) => Micro<void, never, MicroScope>;
1553
+ /**
1554
+ * When the `Micro` effect is completed, run the given finalizer effect with the
1555
+ * `Result` of the executed effect.
1556
+ *
1557
+ * @since 3.4.0
1558
+ * @experimental
1559
+ * @category resources & finalization
1560
+ */
1561
+ export declare const onResult: {
1562
+ <A, E, XE, XR>(f: (result: Result<A, E>) => Micro<void, XE, XR>): <R>(self: Micro<A, E, R>) => Micro<A, E | XE, R | XR>;
1563
+ <A, E, R, XE, XR>(self: Micro<A, E, R>, f: (result: Result<A, E>) => Micro<void, XE, XR>): Micro<A, E | XE, R | XR>;
1564
+ };
1565
+ /**
1566
+ * When the `Micro` effect is completed, run the given finalizer effect if it
1567
+ * matches the specified predicate.
1568
+ *
1569
+ * @since 3.4.0
1570
+ * @experimental
1571
+ * @category resources & finalization
1572
+ */
1573
+ export declare const onResultIf: {
1574
+ <A, E, XE, XR, B extends Result<A, E>>(refinement: Refinement<Result<A, E>, B>, f: (result: B) => Micro<void, XE, XR>): <R>(self: Micro<A, E, R>) => Micro<A, E | XE, R | XR>;
1575
+ <A, E, XE, XR>(predicate: Predicate<Result<NoInfer<A>, NoInfer<E>>>, f: (result: Result<NoInfer<A>, NoInfer<E>>) => Micro<void, XE, XR>): <R>(self: Micro<A, E, R>) => Micro<A, E | XE, R | XR>;
1576
+ <A, E, R, XE, XR, B extends Result<A, E>>(self: Micro<A, E, R>, refinement: Refinement<Result<A, E>, B>, f: (result: B) => Micro<void, XE, XR>): Micro<A, E | XE, R | XR>;
1577
+ <A, E, R, XE, XR>(self: Micro<A, E, R>, predicate: Predicate<Result<NoInfer<A>, NoInfer<E>>>, f: (result: Result<NoInfer<A>, NoInfer<E>>) => Micro<void, XE, XR>): Micro<A, E | XE, R | XR>;
1578
+ };
1579
+ /**
1580
+ * Regardless of the result of the this `Micro` effect, run the finalizer effect.
1581
+ *
1582
+ * @since 3.4.0
1583
+ * @experimental
1584
+ * @category resources & finalization
1585
+ */
1586
+ export declare const ensuring: {
1587
+ <XE, XR>(finalizer: Micro<void, XE, XR>): <A, E, R>(self: Micro<A, E, R>) => Micro<A, E | XE, R | XR>;
1588
+ <A, E, R, XE, XR>(self: Micro<A, E, R>, finalizer: Micro<void, XE, XR>): Micro<A, E | XE, R | XR>;
1589
+ };
1590
+ /**
1591
+ * When the `Micro` effect fails, run the given finalizer effect with the
1592
+ * `Failure` of the executed effect.
1593
+ *
1594
+ * @since 3.4.0
1595
+ * @experimental
1596
+ * @category resources & finalization
1597
+ */
1598
+ export declare const onFailure: {
1599
+ <A, E, XE, XR>(f: (failure: Failure<NoInfer<E>>) => Micro<void, XE, XR>): <R>(self: Micro<A, E, R>) => Micro<A, E | XE, R | XR>;
1600
+ <A, E, R, XE, XR>(self: Micro<A, E, R>, f: (failure: Failure<NoInfer<E>>) => Micro<void, XE, XR>): Micro<A, E | XE, R | XR>;
1601
+ };
1602
+ /**
1603
+ * If this `Micro` effect is aborted, run the finalizer effect.
1604
+ *
1605
+ * @since 3.4.0
1606
+ * @experimental
1607
+ * @category resources & finalization
1608
+ */
1609
+ export declare const onAbort: {
1610
+ <XE, XR>(finalizer: Micro<void, XE, XR>): <A, E, R>(self: Micro<A, E, R>) => Micro<A, E | XE, R | XR>;
1611
+ <A, E, R, XE, XR>(self: Micro<A, E, R>, finalizer: Micro<void, XE, XR>): Micro<A, E | XE, R | XR>;
1612
+ };
1613
+ /**
1614
+ * Acquire a resource, use it, and then release the resource when the `use`
1615
+ * effect has completed.
1616
+ *
1617
+ * @since 3.4.0
1618
+ * @experimental
1619
+ * @category resources & finalization
1620
+ */
1621
+ export declare const acquireUseRelease: <Resource, E, R, A, E2, R2, E3, R3>(acquire: Micro<Resource, E, R>, use: (a: Resource) => Micro<A, E2, R2>, release: (a: Resource, result: Result<A, E2>) => Micro<void, E3, R3>) => Micro<A, E | E2 | E3, R | R2 | R3>;
1622
+ /**
1623
+ * Abort the current `Micro` effect.
1624
+ *
1625
+ * @since 3.4.0
1626
+ * @experimental
1627
+ * @category interruption
1628
+ */
1629
+ export declare const abort: Micro<never>;
1630
+ /**
1631
+ * Wrap the given `Micro` effect in an uninterruptible region, preventing the
1632
+ * effect from being aborted.
1633
+ *
1634
+ * @since 3.4.0
1635
+ * @experimental
1636
+ * @category interruption
1637
+ */
1638
+ export declare const uninterruptible: <A, E, R>(self: Micro<A, E, R>) => Micro<A, E, R>;
1639
+ /**
1640
+ * Wrap the given `Micro` effect in an uninterruptible region, preventing the
1641
+ * effect from being aborted.
1642
+ *
1643
+ * You can use the `restore` function to restore a `Micro` effect to the
1644
+ * interruptibility state before the `uninterruptibleMask` was applied.
1645
+ *
1646
+ * @since 3.4.0
1647
+ * @experimental
1648
+ * @category interruption
1649
+ * @example
1650
+ * import * as Micro from "effect/Micro"
1651
+ *
1652
+ * Micro.uninterruptibleMask((restore) =>
1653
+ * Micro.sleep(1000).pipe( // uninterruptible
1654
+ * Micro.andThen(restore(Micro.sleep(1000))) // interruptible
1655
+ * )
1656
+ * )
1657
+ */
1658
+ 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>;
1659
+ /**
1660
+ * Wrap the given `Micro` effect in an interruptible region, allowing the effect
1661
+ * to be aborted.
1662
+ *
1663
+ * @since 3.4.0
1664
+ * @experimental
1665
+ * @category interruption
1666
+ */
1667
+ export declare const interruptible: <A, E, R>(self: Micro<A, E, R>) => Micro<A, E, R>;
1668
+ /**
1669
+ * @since 3.4.0
1670
+ * @experimental
1671
+ */
1672
+ export declare namespace All {
1673
+ /**
1674
+ * @since 3.4.0
1675
+ * @experimental
1676
+ */
1677
+ type MicroAny = Micro<any, any, any>;
1678
+ /**
1679
+ * @since 3.4.0
1680
+ * @experimental
1681
+ */
1682
+ type ReturnIterable<T extends Iterable<MicroAny>, Discard extends boolean> = [T] extends [
1683
+ Iterable<Micro<infer A, infer E, infer R>>
1684
+ ] ? Micro<Discard extends true ? void : Array<A>, E, R> : never;
1685
+ /**
1686
+ * @since 3.4.0
1687
+ * @experimental
1688
+ */
1689
+ type ReturnTuple<T extends ReadonlyArray<unknown>, Discard extends boolean> = Micro<Discard extends true ? void : T[number] extends never ? [] : {
1690
+ -readonly [K in keyof T]: T[K] extends Micro<infer _A, infer _E, infer _R> ? _A : never;
1691
+ }, T[number] extends never ? never : T[number] extends Micro<infer _A, infer _E, infer _R> ? _E : never, T[number] extends never ? never : T[number] extends Micro<infer _A, infer _E, infer _R> ? _R : never> extends infer X ? X : never;
1692
+ /**
1693
+ * @since 3.4.0
1694
+ * @experimental
1695
+ */
1696
+ type ReturnObject<T, Discard extends boolean> = [T] extends [{
1697
+ [K: string]: MicroAny;
1698
+ }] ? Micro<Discard extends true ? void : {
1699
+ -readonly [K in keyof T]: [T[K]] extends [Micro<infer _A, infer _E, infer _R>] ? _A : never;
1700
+ }, keyof T extends never ? never : T[keyof T] extends Micro<infer _A, infer _E, infer _R> ? _E : never, keyof T extends never ? never : T[keyof T] extends Micro<infer _A, infer _E, infer _R> ? _R : never> : never;
1701
+ /**
1702
+ * @since 3.4.0
1703
+ * @experimental
1704
+ */
1705
+ type IsDiscard<A> = [Extract<A, {
1706
+ readonly discard: true;
1707
+ }>] extends [never] ? false : true;
1708
+ /**
1709
+ * @since 3.4.0
1710
+ * @experimental
1711
+ */
1712
+ type Return<Arg extends Iterable<MicroAny> | Record<string, MicroAny>, O extends {
1713
+ readonly concurrency?: Concurrency | undefined;
1714
+ readonly discard?: boolean | undefined;
1715
+ }> = [Arg] extends [ReadonlyArray<MicroAny>] ? ReturnTuple<Arg, IsDiscard<O>> : [Arg] extends [Iterable<MicroAny>] ? ReturnIterable<Arg, IsDiscard<O>> : [Arg] extends [Record<string, MicroAny>] ? ReturnObject<Arg, IsDiscard<O>> : never;
1716
+ }
1717
+ /**
1718
+ * Runs all the provided effects in sequence respecting the structure provided in input.
1719
+ *
1720
+ * Supports multiple arguments, a single argument tuple / array or record / struct.
1721
+ *
1722
+ * @since 3.4.0
1723
+ * @experimental
1724
+ * @category collecting & elements
1725
+ */
1726
+ export declare const all: <const Arg extends Iterable<Micro<any, any, any>> | Record<string, Micro<any, any, any>>, O extends {
1727
+ readonly concurrency?: Concurrency | undefined;
1728
+ readonly discard?: boolean | undefined;
1729
+ }>(arg: Arg, options?: O) => All.Return<Arg, O>;
1730
+ /**
1731
+ * For each element of the provided iterable, run the effect and collect the results.
1732
+ *
1733
+ * If the `discard` option is set to `true`, the results will be discarded and
1734
+ * the effect will return `void`.
1735
+ *
1736
+ * The `concurrency` option can be set to control how many effects are run in
1737
+ * parallel. By default, the effects are run sequentially.
1738
+ *
1739
+ * @since 3.4.0
1740
+ * @experimental
1741
+ * @category collecting & elements
1742
+ */
1743
+ export declare const forEach: {
1744
+ <A, B, E, R>(iterable: Iterable<A>, f: (a: A, index: number) => Micro<B, E, R>, options?: {
1745
+ readonly concurrency?: Concurrency | undefined;
1746
+ readonly discard?: false | undefined;
1747
+ }): Micro<Array<B>, E, R>;
1748
+ <A, B, E, R>(iterable: Iterable<A>, f: (a: A, index: number) => Micro<B, E, R>, options: {
1749
+ readonly concurrency?: Concurrency | undefined;
1750
+ readonly discard: true;
1751
+ }): Micro<void, E, R>;
1752
+ };
1753
+ /**
1754
+ * Effectfully filter the elements of the provided iterable.
1755
+ *
1756
+ * Use the `concurrency` option to control how many elements are processed in parallel.
1757
+ *
1758
+ * @since 3.4.0
1759
+ * @experimental
1760
+ * @category collecting & elements
1761
+ */
1762
+ export declare const filter: <A, E, R>(iterable: Iterable<A>, f: (a: NoInfer<A>) => Micro<boolean, E, R>, options?: {
1763
+ readonly concurrency?: Concurrency | undefined;
1764
+ readonly negate?: boolean | undefined;
1765
+ }) => Micro<Array<A>, E, R>;
1766
+ /**
1767
+ * Effectfully filter the elements of the provided iterable.
1768
+ *
1769
+ * Use the `concurrency` option to control how many elements are processed in parallel.
1770
+ *
1771
+ * @since 3.4.0
1772
+ * @experimental
1773
+ * @category collecting & elements
1774
+ */
1775
+ export declare const filterMap: <A, B, E, R>(iterable: Iterable<A>, f: (a: NoInfer<A>) => Micro<Option.Option<B>, E, R>, options?: {
1776
+ readonly concurrency?: Concurrency | undefined;
1777
+ }) => Micro<Array<B>, E, R>;
1778
+ /**
1779
+ * Start a do notation block.
1780
+ *
1781
+ * @since 3.4.0
1782
+ * @experimental
1783
+ * @category do notation
1784
+ */
1785
+ export declare const Do: Micro<{}>;
1786
+ /**
1787
+ * Bind the success value of this `Micro` effect to the provided name.
1788
+ *
1789
+ * @since 3.4.0
1790
+ * @experimental
1791
+ * @category do notation
1792
+ */
1793
+ export declare const bindTo: {
1794
+ <N extends string>(name: N): <A, E, R>(self: Micro<A, E, R>) => Micro<{
1795
+ [K in N]: A;
1796
+ }, E, R>;
1797
+ <A, E, R, N extends string>(self: Micro<A, E, R>, name: N): Micro<{
1798
+ [K in N]: A;
1799
+ }, E, R>;
1800
+ };
1801
+ /**
1802
+ * Bind the success value of this `Micro` effect to the provided name.
1803
+ *
1804
+ * @since 3.4.0
1805
+ * @experimental
1806
+ * @category do notation
1807
+ */
1808
+ export declare const bind: {
1809
+ <N extends string, A extends Record<string, any>, B, E2, R2>(name: N, f: (a: A) => Micro<B, E2, R2>): <E, R>(self: Micro<A, E, R>) => Micro<Simplify<Omit<A, N> & {
1810
+ [K in N]: B;
1811
+ }>, E | E2, R | R2>;
1812
+ <A extends Record<string, any>, E, R, B, E2, R2, N extends string>(self: Micro<A, E, R>, name: N, f: (a: A) => Micro<B, E2, R2>): Micro<Simplify<Omit<A, N> & {
1813
+ [K in N]: B;
1814
+ }>, E | E2, R | R2>;
1815
+ };
1816
+ declare const let_: {
1817
+ <N extends string, A extends Record<string, any>, B>(name: N, f: (a: A) => B): <E, R>(self: Micro<A, E, R>) => Micro<Simplify<Omit<A, N> & {
1818
+ [K in N]: B;
1819
+ }>, E, R>;
1820
+ <A extends Record<string, any>, E, R, B, N extends string>(self: Micro<A, E, R>, name: N, f: (a: A) => B): Micro<Simplify<Omit<A, N> & {
1821
+ [K in N]: B;
1822
+ }>, E, R>;
1823
+ };
1824
+ export {
1825
+ /**
1826
+ * Bind the result of a synchronous computation to the given name.
1827
+ *
1828
+ * @since 3.4.0
1829
+ * @experimental
1830
+ * @category do notation
1831
+ */
1832
+ let_ as let };
1833
+ /**
1834
+ * @since 3.4.0
1835
+ * @experimental
1836
+ * @category handle & forking
1837
+ */
1838
+ export declare const HandleTypeId: unique symbol;
1839
+ /**
1840
+ * @since 3.4.0
1841
+ * @experimental
1842
+ * @category handle & forking
1843
+ */
1844
+ export type HandleTypeId = typeof HandleTypeId;
1845
+ /**
1846
+ * @since 3.4.0
1847
+ * @experimental
1848
+ * @category handle & forking
1849
+ */
1850
+ export interface Handle<A, E = never> {
1851
+ readonly [HandleTypeId]: HandleTypeId;
1852
+ readonly await: Micro<Result<A, E>>;
1853
+ readonly join: Micro<A, E>;
1854
+ readonly abort: Micro<Result<A, E>>;
1855
+ readonly unsafeAbort: () => void;
1856
+ readonly addObserver: (observer: (result: Result<A, E>) => void) => void;
1857
+ readonly removeObserver: (observer: (result: Result<A, E>) => void) => void;
1858
+ readonly unsafePoll: () => Result<A, E> | null;
1859
+ }
1860
+ /**
1861
+ * @since 3.4.0
1862
+ * @experimental
1863
+ * @category handle & forking
1864
+ */
1865
+ export declare const isHandle: (u: unknown) => u is Handle<unknown, unknown>;
1866
+ /**
1867
+ * Run the `Micro` effect in a new `Handle` that can be awaited, joined, or
1868
+ * aborted.
1869
+ *
1870
+ * When the parent `Micro` finishes, this `Micro` will be aborted.
1871
+ *
1872
+ * @since 3.4.0
1873
+ * @experimental
1874
+ * @category handle & forking
1875
+ */
1876
+ export declare const fork: <A, E, R>(self: Micro<A, E, R>) => Micro<Handle<A, E>, never, R>;
1877
+ /**
1878
+ * Run the `Micro` effect in a new `Handle` that can be awaited, joined, or
1879
+ * aborted.
1880
+ *
1881
+ * It will not be aborted when the parent `Micro` finishes.
1882
+ *
1883
+ * @since 3.4.0
1884
+ * @experimental
1885
+ * @category handle & forking
1886
+ */
1887
+ export declare const forkDaemon: <A, E, R>(self: Micro<A, E, R>) => Micro<Handle<A, E>, never, R>;
1888
+ /**
1889
+ * Run the `Micro` effect in a new `Handle` that can be awaited, joined, or
1890
+ * aborted.
1891
+ *
1892
+ * The lifetime of the handle will be attached to the provided `MicroScope`.
1893
+ *
1894
+ * @since 3.4.0
1895
+ * @experimental
1896
+ * @category handle & forking
1897
+ */
1898
+ export declare const forkIn: {
1899
+ (scope: MicroScope): <A, E, R>(self: Micro<A, E, R>) => Micro<Handle<A, E>, never, R>;
1900
+ <A, E, R>(self: Micro<A, E, R>, scope: MicroScope): Micro<Handle<A, E>, never, R>;
1901
+ };
1902
+ /**
1903
+ * Run the `Micro` effect in a new `Handle` that can be awaited, joined, or
1904
+ * aborted.
1905
+ *
1906
+ * The lifetime of the handle will be attached to the current `MicroScope`.
1907
+ *
1908
+ * @since 3.4.0
1909
+ * @experimental
1910
+ * @category handle & forking
1911
+ */
1912
+ export declare const forkScoped: <A, E, R>(self: Micro<A, E, R>) => Micro<Handle<A, E>, never, R | MicroScope>;
1913
+ /**
1914
+ * Execute the `Micro` effect and return a `Handle` that can be awaited, joined,
1915
+ * or aborted.
1916
+ *
1917
+ * You can listen for the result by adding an observer using the handle's
1918
+ * `addObserver` method.
1919
+ *
1920
+ * @since 3.4.0
1921
+ * @experimental
1922
+ * @category execution
1923
+ * @example
1924
+ * import * as Micro from "effect/Micro"
1925
+ *
1926
+ * const handle = Micro.succeed(42).pipe(
1927
+ * Micro.delay(1000),
1928
+ * Micro.runFork
1929
+ * )
1930
+ *
1931
+ * handle.addObserver((result) => {
1932
+ * console.log(result)
1933
+ * })
1934
+ */
1935
+ export declare const runFork: <A, E>(effect: Micro<A, E>, options?: {
1936
+ readonly signal?: AbortSignal | undefined;
1937
+ } | undefined) => Handle<A, E>;
1938
+ /**
1939
+ * Execute the `Micro` effect and return a `Promise` that resolves with the
1940
+ * `Result` of the computation.
1941
+ *
1942
+ * @since 3.4.0
1943
+ * @experimental
1944
+ * @category execution
1945
+ */
1946
+ export declare const runPromiseResult: <A, E>(effect: Micro<A, E>, options?: {
1947
+ readonly signal?: AbortSignal | undefined;
1948
+ } | undefined) => Promise<Result<A, E>>;
1949
+ /**
1950
+ * Execute the `Micro` effect and return a `Promise` that resolves with the
1951
+ * successful value of the computation.
1952
+ *
1953
+ * @since 3.4.0
1954
+ * @experimental
1955
+ * @category execution
1956
+ */
1957
+ export declare const runPromise: <A, E>(effect: Micro<A, E>, options?: {
1958
+ readonly signal?: AbortSignal | undefined;
1959
+ } | undefined) => Promise<A>;
1960
+ /**
1961
+ * Attempt to execute the `Micro` effect synchronously and return the `Result`.
1962
+ *
1963
+ * If any asynchronous effects are encountered, the function will return a
1964
+ * FailureUnexpected containing the `Handle`.
1965
+ *
1966
+ * @since 3.4.0
1967
+ * @experimental
1968
+ * @category execution
1969
+ */
1970
+ export declare const runSyncResult: <A, E>(effect: Micro<A, E>) => Result<A, E>;
1971
+ /**
1972
+ * Attempt to execute the `Micro` effect synchronously and return the success
1973
+ * value.
1974
+ *
1975
+ * @since 3.4.0
1976
+ * @experimental
1977
+ * @category execution
1978
+ */
1979
+ export declare const runSync: <A, E>(effect: Micro<A, E>) => A;
1980
+ /**
1981
+ * @since 3.4.0
1982
+ * @experimental
1983
+ * @category errors
1984
+ */
1985
+ export interface YieldableError extends Pipeable, Inspectable, Readonly<Error> {
1986
+ readonly [EffectTypeId]: Effect.VarianceStruct<never, this, never>;
1987
+ readonly [StreamTypeId]: Stream.VarianceStruct<never, this, never>;
1988
+ readonly [SinkTypeId]: Sink.VarianceStruct<never, unknown, never, this, never>;
1989
+ readonly [ChannelTypeId]: Channel.VarianceStruct<never, unknown, this, unknown, never, unknown, never>;
1990
+ readonly [TypeId]: Micro.Variance<never, this, never>;
1991
+ readonly [runSymbol]: (env: Env<any>, onResult: (result: Result<never, this>) => void) => void;
1992
+ [Symbol.iterator](): MicroIterator<Micro<never, this, never>>;
1993
+ }
1994
+ /**
1995
+ * @since 3.4.0
1996
+ * @experimental
1997
+ * @category errors
1998
+ */
1999
+ export declare const Error: new <A extends Record<string, any> = {}>(args: Equals<A, {}> extends true ? void : {
2000
+ readonly [P in keyof A]: A[P];
2001
+ }) => YieldableError & Readonly<A>;
2002
+ /**
2003
+ * @since 3.4.0
2004
+ * @experimental
2005
+ * @category errors
2006
+ */
2007
+ export declare const TaggedError: <Tag extends string>(tag: Tag) => new <A extends Record<string, any> = {}>(args: Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }) => YieldableError & {
2008
+ readonly _tag: Tag;
2009
+ } & Readonly<A>;
2010
+ //# sourceMappingURL=Micro.d.ts.map