effect 3.10.18 → 3.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/Array.js +206 -0
- package/dist/cjs/Array.js.map +1 -1
- package/dist/cjs/BigDecimal.js +181 -24
- package/dist/cjs/BigDecimal.js.map +1 -1
- package/dist/cjs/BigInt.js +54 -0
- package/dist/cjs/BigInt.js.map +1 -1
- package/dist/cjs/Boolean.js +24 -0
- package/dist/cjs/Boolean.js.map +1 -1
- package/dist/cjs/Brand.js +4 -0
- package/dist/cjs/Brand.js.map +1 -1
- package/dist/cjs/Channel.js +44 -4
- package/dist/cjs/Channel.js.map +1 -1
- package/dist/cjs/Chunk.js +8 -0
- package/dist/cjs/Chunk.js.map +1 -1
- package/dist/cjs/Config.js +10 -1
- package/dist/cjs/Config.js.map +1 -1
- package/dist/cjs/Context.js +50 -1
- package/dist/cjs/Context.js.map +1 -1
- package/dist/cjs/Cron.js +81 -67
- package/dist/cjs/Cron.js.map +1 -1
- package/dist/cjs/Data.js +14 -0
- package/dist/cjs/Data.js.map +1 -1
- package/dist/cjs/DateTime.js +178 -664
- package/dist/cjs/DateTime.js.map +1 -1
- package/dist/cjs/Duration.js +2 -0
- package/dist/cjs/Duration.js.map +1 -1
- package/dist/cjs/Effect.js +296 -4
- package/dist/cjs/Effect.js.map +1 -1
- package/dist/cjs/Either.js +38 -2
- package/dist/cjs/Either.js.map +1 -1
- package/dist/cjs/FiberHandle.js +6 -0
- package/dist/cjs/FiberHandle.js.map +1 -1
- package/dist/cjs/FiberMap.js +6 -0
- package/dist/cjs/FiberMap.js.map +1 -1
- package/dist/cjs/FiberSet.js +6 -0
- package/dist/cjs/FiberSet.js.map +1 -1
- package/dist/cjs/Function.js +34 -0
- package/dist/cjs/Function.js.map +1 -1
- package/dist/cjs/GlobalValue.js +2 -0
- package/dist/cjs/GlobalValue.js.map +1 -1
- package/dist/cjs/HashMap.js.map +1 -1
- package/dist/cjs/Inspectable.js +8 -4
- package/dist/cjs/Inspectable.js.map +1 -1
- package/dist/cjs/Iterable.js +18 -0
- package/dist/cjs/Iterable.js.map +1 -1
- package/dist/cjs/JSONSchema.js.map +1 -1
- package/dist/cjs/List.js +4 -0
- package/dist/cjs/List.js.map +1 -1
- package/dist/cjs/Logger.js +26 -0
- package/dist/cjs/Logger.js.map +1 -1
- package/dist/cjs/Mailbox.js +2 -0
- package/dist/cjs/Mailbox.js.map +1 -1
- package/dist/cjs/ManagedRuntime.js +2 -0
- package/dist/cjs/ManagedRuntime.js.map +1 -1
- package/dist/cjs/Metric.js +10 -0
- package/dist/cjs/Metric.js.map +1 -1
- package/dist/cjs/Micro.js +1104 -1069
- package/dist/cjs/Micro.js.map +1 -1
- package/dist/cjs/Number.js +44 -0
- package/dist/cjs/Number.js.map +1 -1
- package/dist/cjs/Option.js +70 -0
- package/dist/cjs/Option.js.map +1 -1
- package/dist/cjs/Order.js +2 -0
- package/dist/cjs/Order.js.map +1 -1
- package/dist/cjs/Ordering.js +4 -0
- package/dist/cjs/Ordering.js.map +1 -1
- package/dist/cjs/Predicate.js +68 -0
- package/dist/cjs/Predicate.js.map +1 -1
- package/dist/cjs/Random.js +4 -0
- package/dist/cjs/Random.js.map +1 -1
- package/dist/cjs/RateLimiter.js +4 -0
- package/dist/cjs/RateLimiter.js.map +1 -1
- package/dist/cjs/RcMap.js +2 -0
- package/dist/cjs/RcMap.js.map +1 -1
- package/dist/cjs/RcRef.js +2 -0
- package/dist/cjs/RcRef.js.map +1 -1
- package/dist/cjs/Record.js +56 -0
- package/dist/cjs/Record.js.map +1 -1
- package/dist/cjs/Redacted.js +8 -0
- package/dist/cjs/Redacted.js.map +1 -1
- package/dist/cjs/RegExp.js +4 -0
- package/dist/cjs/RegExp.js.map +1 -1
- package/dist/cjs/Request.js +4 -0
- package/dist/cjs/Request.js.map +1 -1
- package/dist/cjs/RequestResolver.js +2 -0
- package/dist/cjs/RequestResolver.js.map +1 -1
- package/dist/cjs/Runtime.js +6 -0
- package/dist/cjs/Runtime.js.map +1 -1
- package/dist/cjs/STM.js.map +1 -1
- package/dist/cjs/Schema.js +91 -8
- package/dist/cjs/Schema.js.map +1 -1
- package/dist/cjs/Sink.js +9 -1
- package/dist/cjs/Sink.js.map +1 -1
- package/dist/cjs/Stream.js +179 -7
- package/dist/cjs/Stream.js.map +1 -1
- package/dist/cjs/String.js +62 -0
- package/dist/cjs/String.js.map +1 -1
- package/dist/cjs/Struct.js +12 -0
- package/dist/cjs/Struct.js.map +1 -1
- package/dist/cjs/Symbol.js +2 -0
- package/dist/cjs/Symbol.js.map +1 -1
- package/dist/cjs/Trie.js +56 -0
- package/dist/cjs/Trie.js.map +1 -1
- package/dist/cjs/Tuple.js +18 -0
- package/dist/cjs/Tuple.js.map +1 -1
- package/dist/cjs/Utils.js +7 -1
- package/dist/cjs/Utils.js.map +1 -1
- package/dist/cjs/internal/channel/channelExecutor.js +5 -9
- package/dist/cjs/internal/channel/channelExecutor.js.map +1 -1
- package/dist/cjs/internal/channel.js +156 -130
- package/dist/cjs/internal/channel.js.map +1 -1
- package/dist/cjs/internal/config.js +13 -4
- package/dist/cjs/internal/config.js.map +1 -1
- package/dist/cjs/internal/context.js +46 -3
- package/dist/cjs/internal/context.js.map +1 -1
- package/dist/cjs/internal/dateTime.js +747 -0
- package/dist/cjs/internal/dateTime.js.map +1 -0
- package/dist/cjs/internal/fiberRuntime.js +34 -11
- package/dist/cjs/internal/fiberRuntime.js.map +1 -1
- package/dist/cjs/internal/groupBy.js +9 -3
- package/dist/cjs/internal/groupBy.js.map +1 -1
- package/dist/cjs/internal/layer.js +1 -1
- package/dist/cjs/internal/layer.js.map +1 -1
- package/dist/cjs/internal/mailbox.js +1 -1
- package/dist/cjs/internal/mailbox.js.map +1 -1
- package/dist/cjs/internal/sink.js +25 -21
- package/dist/cjs/internal/sink.js.map +1 -1
- package/dist/cjs/internal/stream.js +70 -71
- package/dist/cjs/internal/stream.js.map +1 -1
- package/dist/cjs/internal/version.js +1 -1
- package/dist/cjs/internal/version.js.map +1 -1
- package/dist/dts/Array.d.ts +534 -0
- package/dist/dts/Array.d.ts.map +1 -1
- package/dist/dts/BigDecimal.d.ts +172 -1
- package/dist/dts/BigDecimal.d.ts.map +1 -1
- package/dist/dts/BigInt.d.ts +114 -0
- package/dist/dts/BigInt.d.ts.map +1 -1
- package/dist/dts/Boolean.d.ts +56 -0
- package/dist/dts/Boolean.d.ts.map +1 -1
- package/dist/dts/Brand.d.ts +6 -0
- package/dist/dts/Brand.d.ts.map +1 -1
- package/dist/dts/Channel.d.ts +66 -5
- package/dist/dts/Channel.d.ts.map +1 -1
- package/dist/dts/Chunk.d.ts +30 -0
- package/dist/dts/Chunk.d.ts.map +1 -1
- package/dist/dts/Config.d.ts +25 -1
- package/dist/dts/Config.d.ts.map +1 -1
- package/dist/dts/Context.d.ts +155 -0
- package/dist/dts/Context.d.ts.map +1 -1
- package/dist/dts/Cron.d.ts +21 -6
- package/dist/dts/Cron.d.ts.map +1 -1
- package/dist/dts/Data.d.ts +26 -0
- package/dist/dts/Data.d.ts.map +1 -1
- package/dist/dts/DateTime.d.ts +192 -49
- package/dist/dts/DateTime.d.ts.map +1 -1
- package/dist/dts/Duration.d.ts +2 -0
- package/dist/dts/Duration.d.ts.map +1 -1
- package/dist/dts/Effect.d.ts +658 -1
- package/dist/dts/Effect.d.ts.map +1 -1
- package/dist/dts/Either.d.ts +84 -2
- package/dist/dts/Either.d.ts.map +1 -1
- package/dist/dts/FiberHandle.d.ts +6 -0
- package/dist/dts/FiberHandle.d.ts.map +1 -1
- package/dist/dts/FiberMap.d.ts +6 -0
- package/dist/dts/FiberMap.d.ts.map +1 -1
- package/dist/dts/FiberSet.d.ts +6 -0
- package/dist/dts/FiberSet.d.ts.map +1 -1
- package/dist/dts/Function.d.ts +50 -0
- package/dist/dts/Function.d.ts.map +1 -1
- package/dist/dts/GlobalValue.d.ts +2 -0
- package/dist/dts/GlobalValue.d.ts.map +1 -1
- package/dist/dts/HashMap.d.ts +6 -0
- package/dist/dts/HashMap.d.ts.map +1 -1
- package/dist/dts/Inspectable.d.ts.map +1 -1
- package/dist/dts/Iterable.d.ts +26 -0
- package/dist/dts/Iterable.d.ts.map +1 -1
- package/dist/dts/JSONSchema.d.ts +1 -0
- package/dist/dts/JSONSchema.d.ts.map +1 -1
- package/dist/dts/List.d.ts +20 -0
- package/dist/dts/List.d.ts.map +1 -1
- package/dist/dts/Logger.d.ts +34 -0
- package/dist/dts/Logger.d.ts.map +1 -1
- package/dist/dts/Mailbox.d.ts +2 -0
- package/dist/dts/Mailbox.d.ts.map +1 -1
- package/dist/dts/ManagedRuntime.d.ts +2 -0
- package/dist/dts/ManagedRuntime.d.ts.map +1 -1
- package/dist/dts/Metric.d.ts +18 -0
- package/dist/dts/Metric.d.ts.map +1 -1
- package/dist/dts/Micro.d.ts +880 -863
- package/dist/dts/Micro.d.ts.map +1 -1
- package/dist/dts/Number.d.ts +104 -0
- package/dist/dts/Number.d.ts.map +1 -1
- package/dist/dts/Option.d.ts +142 -0
- package/dist/dts/Option.d.ts.map +1 -1
- package/dist/dts/Order.d.ts +2 -0
- package/dist/dts/Order.d.ts.map +1 -1
- package/dist/dts/Ordering.d.ts +8 -0
- package/dist/dts/Ordering.d.ts.map +1 -1
- package/dist/dts/Predicate.d.ts +104 -0
- package/dist/dts/Predicate.d.ts.map +1 -1
- package/dist/dts/Random.d.ts +4 -0
- package/dist/dts/Random.d.ts.map +1 -1
- package/dist/dts/RateLimiter.d.ts +4 -0
- package/dist/dts/RateLimiter.d.ts.map +1 -1
- package/dist/dts/RcMap.d.ts +6 -0
- package/dist/dts/RcMap.d.ts.map +1 -1
- package/dist/dts/RcRef.d.ts +2 -0
- package/dist/dts/RcRef.d.ts.map +1 -1
- package/dist/dts/Record.d.ts +136 -0
- package/dist/dts/Record.d.ts.map +1 -1
- package/dist/dts/Redacted.d.ts +8 -0
- package/dist/dts/Redacted.d.ts.map +1 -1
- package/dist/dts/RegExp.d.ts +4 -0
- package/dist/dts/RegExp.d.ts.map +1 -1
- package/dist/dts/Request.d.ts +4 -0
- package/dist/dts/Request.d.ts.map +1 -1
- package/dist/dts/RequestResolver.d.ts +6 -0
- package/dist/dts/RequestResolver.d.ts.map +1 -1
- package/dist/dts/Runtime.d.ts +18 -0
- package/dist/dts/Runtime.d.ts.map +1 -1
- package/dist/dts/STM.d.ts +2 -0
- package/dist/dts/STM.d.ts.map +1 -1
- package/dist/dts/Schema.d.ts +90 -0
- package/dist/dts/Schema.d.ts.map +1 -1
- package/dist/dts/Sink.d.ts +8 -0
- package/dist/dts/Sink.d.ts.map +1 -1
- package/dist/dts/Stream.d.ts +394 -32
- package/dist/dts/Stream.d.ts.map +1 -1
- package/dist/dts/String.d.ts +94 -0
- package/dist/dts/String.d.ts.map +1 -1
- package/dist/dts/Struct.d.ts +24 -0
- package/dist/dts/Struct.d.ts.map +1 -1
- package/dist/dts/Symbol.d.ts +2 -0
- package/dist/dts/Symbol.d.ts.map +1 -1
- package/dist/dts/Trie.d.ts +132 -0
- package/dist/dts/Trie.d.ts.map +1 -1
- package/dist/dts/Tuple.d.ts +42 -0
- package/dist/dts/Tuple.d.ts.map +1 -1
- package/dist/dts/Types.d.ts +24 -0
- package/dist/dts/Types.d.ts.map +1 -1
- package/dist/dts/Utils.d.ts +4 -0
- package/dist/dts/Utils.d.ts.map +1 -1
- package/dist/dts/internal/context.d.ts +1 -1
- package/dist/dts/internal/context.d.ts.map +1 -1
- package/dist/dts/internal/dateTime.d.ts +2 -0
- package/dist/dts/internal/dateTime.d.ts.map +1 -0
- package/dist/dts/internal/fiberRuntime.d.ts.map +1 -1
- package/dist/dts/internal/stream.d.ts.map +1 -1
- package/dist/esm/Array.js +208 -0
- package/dist/esm/Array.js.map +1 -1
- package/dist/esm/BigDecimal.js +175 -20
- package/dist/esm/BigDecimal.js.map +1 -1
- package/dist/esm/BigInt.js +54 -0
- package/dist/esm/BigInt.js.map +1 -1
- package/dist/esm/Boolean.js +24 -0
- package/dist/esm/Boolean.js.map +1 -1
- package/dist/esm/Brand.js +4 -0
- package/dist/esm/Brand.js.map +1 -1
- package/dist/esm/Channel.js +42 -2
- package/dist/esm/Channel.js.map +1 -1
- package/dist/esm/Chunk.js +8 -0
- package/dist/esm/Chunk.js.map +1 -1
- package/dist/esm/Config.js +9 -0
- package/dist/esm/Config.js.map +1 -1
- package/dist/esm/Context.js +49 -0
- package/dist/esm/Context.js.map +1 -1
- package/dist/esm/Cron.js +81 -67
- package/dist/esm/Cron.js.map +1 -1
- package/dist/esm/Data.js +16 -0
- package/dist/esm/Data.js.map +1 -1
- package/dist/esm/DateTime.js +176 -627
- package/dist/esm/DateTime.js.map +1 -1
- package/dist/esm/Duration.js +2 -0
- package/dist/esm/Duration.js.map +1 -1
- package/dist/esm/Effect.js +297 -0
- package/dist/esm/Effect.js.map +1 -1
- package/dist/esm/Either.js +40 -2
- package/dist/esm/Either.js.map +1 -1
- package/dist/esm/FiberHandle.js +6 -0
- package/dist/esm/FiberHandle.js.map +1 -1
- package/dist/esm/FiberMap.js +6 -0
- package/dist/esm/FiberMap.js.map +1 -1
- package/dist/esm/FiberSet.js +6 -0
- package/dist/esm/FiberSet.js.map +1 -1
- package/dist/esm/Function.js +34 -0
- package/dist/esm/Function.js.map +1 -1
- package/dist/esm/GlobalValue.js +2 -0
- package/dist/esm/GlobalValue.js.map +1 -1
- package/dist/esm/HashMap.js.map +1 -1
- package/dist/esm/Inspectable.js +8 -4
- package/dist/esm/Inspectable.js.map +1 -1
- package/dist/esm/Iterable.js +18 -0
- package/dist/esm/Iterable.js.map +1 -1
- package/dist/esm/JSONSchema.js.map +1 -1
- package/dist/esm/List.js +4 -0
- package/dist/esm/List.js.map +1 -1
- package/dist/esm/Logger.js +26 -0
- package/dist/esm/Logger.js.map +1 -1
- package/dist/esm/Mailbox.js +2 -0
- package/dist/esm/Mailbox.js.map +1 -1
- package/dist/esm/ManagedRuntime.js +2 -0
- package/dist/esm/ManagedRuntime.js.map +1 -1
- package/dist/esm/Metric.js +10 -0
- package/dist/esm/Metric.js.map +1 -1
- package/dist/esm/Micro.js +1077 -1037
- package/dist/esm/Micro.js.map +1 -1
- package/dist/esm/Number.js +44 -0
- package/dist/esm/Number.js.map +1 -1
- package/dist/esm/Option.js +72 -0
- package/dist/esm/Option.js.map +1 -1
- package/dist/esm/Order.js +2 -0
- package/dist/esm/Order.js.map +1 -1
- package/dist/esm/Ordering.js +4 -0
- package/dist/esm/Ordering.js.map +1 -1
- package/dist/esm/Predicate.js +68 -0
- package/dist/esm/Predicate.js.map +1 -1
- package/dist/esm/Random.js +4 -0
- package/dist/esm/Random.js.map +1 -1
- package/dist/esm/RateLimiter.js +4 -0
- package/dist/esm/RateLimiter.js.map +1 -1
- package/dist/esm/RcMap.js +2 -0
- package/dist/esm/RcMap.js.map +1 -1
- package/dist/esm/RcRef.js +2 -0
- package/dist/esm/RcRef.js.map +1 -1
- package/dist/esm/Record.js +56 -0
- package/dist/esm/Record.js.map +1 -1
- package/dist/esm/Redacted.js +8 -0
- package/dist/esm/Redacted.js.map +1 -1
- package/dist/esm/RegExp.js +4 -0
- package/dist/esm/RegExp.js.map +1 -1
- package/dist/esm/Request.js +4 -0
- package/dist/esm/Request.js.map +1 -1
- package/dist/esm/RequestResolver.js +2 -0
- package/dist/esm/RequestResolver.js.map +1 -1
- package/dist/esm/Runtime.js +6 -0
- package/dist/esm/Runtime.js.map +1 -1
- package/dist/esm/STM.js.map +1 -1
- package/dist/esm/Schema.js +88 -0
- package/dist/esm/Schema.js.map +1 -1
- package/dist/esm/Sink.js +8 -0
- package/dist/esm/Sink.js.map +1 -1
- package/dist/esm/Stream.js +183 -5
- package/dist/esm/Stream.js.map +1 -1
- package/dist/esm/String.js +62 -0
- package/dist/esm/String.js.map +1 -1
- package/dist/esm/Struct.js +12 -0
- package/dist/esm/Struct.js.map +1 -1
- package/dist/esm/Symbol.js +2 -0
- package/dist/esm/Symbol.js.map +1 -1
- package/dist/esm/Trie.js +56 -0
- package/dist/esm/Trie.js.map +1 -1
- package/dist/esm/Tuple.js +22 -0
- package/dist/esm/Tuple.js.map +1 -1
- package/dist/esm/Utils.js +5 -0
- package/dist/esm/Utils.js.map +1 -1
- package/dist/esm/internal/channel/channelExecutor.js +5 -7
- package/dist/esm/internal/channel/channelExecutor.js.map +1 -1
- package/dist/esm/internal/channel.js +152 -129
- package/dist/esm/internal/channel.js.map +1 -1
- package/dist/esm/internal/config.js +11 -3
- package/dist/esm/internal/config.js.map +1 -1
- package/dist/esm/internal/context.js +42 -2
- package/dist/esm/internal/context.js.map +1 -1
- package/dist/esm/internal/dateTime.js +704 -0
- package/dist/esm/internal/dateTime.js.map +1 -0
- package/dist/esm/internal/fiberRuntime.js +31 -9
- package/dist/esm/internal/fiberRuntime.js.map +1 -1
- package/dist/esm/internal/groupBy.js +9 -3
- package/dist/esm/internal/groupBy.js.map +1 -1
- package/dist/esm/internal/layer.js +1 -1
- package/dist/esm/internal/layer.js.map +1 -1
- package/dist/esm/internal/mailbox.js +1 -1
- package/dist/esm/internal/mailbox.js.map +1 -1
- package/dist/esm/internal/sink.js +23 -20
- package/dist/esm/internal/sink.js.map +1 -1
- package/dist/esm/internal/stream.js +66 -69
- package/dist/esm/internal/stream.js.map +1 -1
- package/dist/esm/internal/version.js +1 -1
- package/dist/esm/internal/version.js.map +1 -1
- package/package.json +1 -1
- package/src/Array.ts +534 -0
- package/src/BigDecimal.ts +247 -21
- package/src/BigInt.ts +114 -0
- package/src/Boolean.ts +56 -0
- package/src/Brand.ts +6 -0
- package/src/Channel.ts +81 -5
- package/src/Chunk.ts +32 -0
- package/src/Config.ts +26 -1
- package/src/Context.ts +163 -0
- package/src/Cron.ts +91 -68
- package/src/Data.ts +26 -0
- package/src/DateTime.ts +307 -757
- package/src/Duration.ts +2 -0
- package/src/Effect.ts +910 -1
- package/src/Either.ts +84 -2
- package/src/FiberHandle.ts +6 -0
- package/src/FiberMap.ts +6 -0
- package/src/FiberSet.ts +6 -0
- package/src/Function.ts +50 -0
- package/src/GlobalValue.ts +2 -0
- package/src/HashMap.ts +6 -0
- package/src/Inspectable.ts +11 -7
- package/src/Iterable.ts +26 -0
- package/src/JSONSchema.ts +1 -0
- package/src/List.ts +24 -0
- package/src/Logger.ts +34 -0
- package/src/Mailbox.ts +2 -0
- package/src/ManagedRuntime.ts +2 -0
- package/src/Metric.ts +18 -0
- package/src/Micro.ts +2007 -1745
- package/src/Number.ts +104 -0
- package/src/Option.ts +142 -0
- package/src/Order.ts +2 -0
- package/src/Ordering.ts +8 -0
- package/src/Predicate.ts +104 -0
- package/src/Random.ts +4 -0
- package/src/RateLimiter.ts +4 -0
- package/src/RcMap.ts +6 -0
- package/src/RcRef.ts +2 -0
- package/src/Record.ts +136 -0
- package/src/Redacted.ts +8 -0
- package/src/RegExp.ts +4 -0
- package/src/Request.ts +4 -0
- package/src/RequestResolver.ts +6 -0
- package/src/Runtime.ts +18 -0
- package/src/STM.ts +2 -0
- package/src/Schema.ts +124 -0
- package/src/Sink.ts +11 -0
- package/src/Stream.ts +399 -44
- package/src/String.ts +94 -0
- package/src/Struct.ts +24 -0
- package/src/Symbol.ts +2 -0
- package/src/Trie.ts +132 -0
- package/src/Tuple.ts +42 -0
- package/src/Types.ts +24 -0
- package/src/Utils.ts +8 -0
- package/src/internal/channel/channelExecutor.ts +37 -33
- package/src/internal/channel.ts +504 -467
- package/src/internal/config.ts +18 -6
- package/src/internal/context.ts +56 -4
- package/src/internal/dateTime.ts +1126 -0
- package/src/internal/fiberRuntime.ts +35 -16
- package/src/internal/groupBy.ts +13 -22
- package/src/internal/layer.ts +5 -8
- package/src/internal/mailbox.ts +6 -4
- package/src/internal/sink.ts +55 -35
- package/src/internal/stream.ts +299 -299
- package/src/internal/version.ts +1 -1
package/dist/dts/Micro.d.ts
CHANGED
|
@@ -1,23 +1,17 @@
|
|
|
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";
|
|
1
|
+
import type { Channel } from "./Channel.js";
|
|
8
2
|
import * as Context from "./Context.js";
|
|
9
|
-
import type { Effect,
|
|
3
|
+
import type { Effect, EffectUnify, EffectUnifyIgnore } from "./Effect.js";
|
|
4
|
+
import * as Effectable from "./Effectable.js";
|
|
10
5
|
import * as Either from "./Either.js";
|
|
11
|
-
import {
|
|
6
|
+
import type { LazyArg } from "./Function.js";
|
|
12
7
|
import type { TypeLambda } from "./HKT.js";
|
|
13
8
|
import type { Inspectable } from "./Inspectable.js";
|
|
14
9
|
import * as Option from "./Option.js";
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import type {
|
|
18
|
-
import type {
|
|
19
|
-
import type {
|
|
20
|
-
import type { Concurrency, Covariant, Equals, NoInfer, NotFunction, Simplify } from "./Types.js";
|
|
10
|
+
import type { Pipeable } from "./Pipeable.js";
|
|
11
|
+
import type { Predicate, Refinement } from "./Predicate.js";
|
|
12
|
+
import type { Sink } from "./Sink.js";
|
|
13
|
+
import type { Stream } from "./Stream.js";
|
|
14
|
+
import type { Concurrency, Covariant, Equals, NotFunction, Simplify } from "./Types.js";
|
|
21
15
|
import type * as Unify from "./Unify.js";
|
|
22
16
|
import { YieldWrap } from "./Utils.js";
|
|
23
17
|
/**
|
|
@@ -35,15 +29,15 @@ export type TypeId = typeof TypeId;
|
|
|
35
29
|
/**
|
|
36
30
|
* @since 3.4.0
|
|
37
31
|
* @experimental
|
|
38
|
-
* @category
|
|
32
|
+
* @category MicroExit
|
|
39
33
|
*/
|
|
40
|
-
export declare const
|
|
34
|
+
export declare const MicroExitTypeId: unique symbol;
|
|
41
35
|
/**
|
|
42
36
|
* @since 3.4.0
|
|
43
37
|
* @experimental
|
|
44
|
-
* @category
|
|
38
|
+
* @category MicroExit
|
|
45
39
|
*/
|
|
46
|
-
export type
|
|
40
|
+
export type MicroExitTypeId = typeof TypeId;
|
|
47
41
|
/**
|
|
48
42
|
* A lightweight alternative to the `Effect` data type, with a subset of the functionality.
|
|
49
43
|
*
|
|
@@ -53,7 +47,6 @@ export type runSymbol = typeof runSymbol;
|
|
|
53
47
|
*/
|
|
54
48
|
export interface Micro<out A, out E = never, out R = never> extends Effect<A, E, R> {
|
|
55
49
|
readonly [TypeId]: Micro.Variance<A, E, R>;
|
|
56
|
-
[runSymbol](env: Env<any>, onExit: (exit: MicroExit<A, E>) => void): void;
|
|
57
50
|
[Symbol.iterator](): MicroIterator<Micro<A, E, R>>;
|
|
58
51
|
[Unify.typeSymbol]?: unknown;
|
|
59
52
|
[Unify.unifySymbol]?: MicroUnify<this>;
|
|
@@ -126,32 +119,6 @@ export declare const isMicro: (u: unknown) => u is Micro<any, any, any>;
|
|
|
126
119
|
export interface MicroIterator<T extends Micro<any, any, any>> {
|
|
127
120
|
next(...args: ReadonlyArray<any>): IteratorResult<YieldWrap<T>, Micro.Success<T>>;
|
|
128
121
|
}
|
|
129
|
-
/**
|
|
130
|
-
* @since 3.8.4
|
|
131
|
-
* @experimental
|
|
132
|
-
* @category models
|
|
133
|
-
*/
|
|
134
|
-
export interface MicroClass {
|
|
135
|
-
new <A, E = never, R = never>(): Micro<A, E, R>;
|
|
136
|
-
}
|
|
137
|
-
declare const MicroBase: MicroClass;
|
|
138
|
-
/**
|
|
139
|
-
* @since 3.8.4
|
|
140
|
-
* @experimental
|
|
141
|
-
* @category constructors
|
|
142
|
-
*/
|
|
143
|
-
export declare abstract class Class<out A, out E = never, out R = never> extends MicroBase<A, E, R> {
|
|
144
|
-
/**
|
|
145
|
-
* @since 3.8.4
|
|
146
|
-
* @experimental
|
|
147
|
-
*/
|
|
148
|
-
abstract asMicro(): Micro<A, E, R>;
|
|
149
|
-
/**
|
|
150
|
-
* @since 3.8.4
|
|
151
|
-
* @experimental
|
|
152
|
-
*/
|
|
153
|
-
[runSymbol](env: Env<any>, onExit: (exit: MicroExit<A, E>) => void): void;
|
|
154
|
-
}
|
|
155
122
|
/**
|
|
156
123
|
* @since 3.4.6
|
|
157
124
|
* @experimental
|
|
@@ -286,1080 +253,1093 @@ export declare const causeWithTrace: {
|
|
|
286
253
|
<E>(self: MicroCause<E>, trace: string): MicroCause<E>;
|
|
287
254
|
};
|
|
288
255
|
/**
|
|
289
|
-
* @since 3.
|
|
290
|
-
* @experimental
|
|
291
|
-
* @category MicroExit
|
|
292
|
-
*/
|
|
293
|
-
export declare namespace MicroExit {
|
|
294
|
-
/**
|
|
295
|
-
* @since 3.4.6
|
|
296
|
-
* @experimental
|
|
297
|
-
* @category MicroExit
|
|
298
|
-
*/
|
|
299
|
-
type Success<A, E = never> = Either.Right<MicroCause<E>, A>;
|
|
300
|
-
/**
|
|
301
|
-
* @since 3.4.6
|
|
302
|
-
* @experimental
|
|
303
|
-
* @category MicroExit
|
|
304
|
-
*/
|
|
305
|
-
type Failure<A, E = never> = Either.Left<MicroCause<E>, A>;
|
|
306
|
-
}
|
|
307
|
-
/**
|
|
308
|
-
* The MicroExit type is a data type that represents the result of a Micro
|
|
309
|
-
* computation.
|
|
310
|
-
*
|
|
311
|
-
* It uses the `Either` data type to represent the success and failure cases.
|
|
312
|
-
*
|
|
313
|
-
* @since 3.4.6
|
|
256
|
+
* @since 3.11.0
|
|
314
257
|
* @experimental
|
|
315
|
-
* @category
|
|
258
|
+
* @category Fiber
|
|
316
259
|
*/
|
|
317
|
-
export
|
|
260
|
+
export declare const FiberTypeId: unique symbol;
|
|
318
261
|
/**
|
|
319
|
-
* @since 3.
|
|
262
|
+
* @since 3.11.0
|
|
320
263
|
* @experimental
|
|
321
|
-
* @category
|
|
264
|
+
* @category Fiber
|
|
322
265
|
*/
|
|
323
|
-
export
|
|
266
|
+
export type FiberTypeId = typeof FiberTypeId;
|
|
324
267
|
/**
|
|
325
|
-
* @since 3.
|
|
268
|
+
* @since 3.11.0
|
|
326
269
|
* @experimental
|
|
327
|
-
* @category
|
|
270
|
+
* @category Fiber
|
|
328
271
|
*/
|
|
329
|
-
export
|
|
272
|
+
export interface Fiber<out A, out E = never> {
|
|
273
|
+
readonly [FiberTypeId]: Fiber.Variance<A, E>;
|
|
274
|
+
readonly currentOpCount: number;
|
|
275
|
+
readonly getRef: <I, A>(ref: Context.Reference<I, A>) => A;
|
|
276
|
+
readonly context: Context.Context<never>;
|
|
277
|
+
readonly addObserver: (cb: (exit: MicroExit<A, E>) => void) => () => void;
|
|
278
|
+
readonly unsafeInterrupt: () => void;
|
|
279
|
+
readonly unsafePoll: () => MicroExit<A, E> | undefined;
|
|
280
|
+
}
|
|
330
281
|
/**
|
|
331
|
-
* @since 3.
|
|
282
|
+
* @since 3.11.0
|
|
332
283
|
* @experimental
|
|
333
|
-
* @category
|
|
284
|
+
* @category Fiber
|
|
334
285
|
*/
|
|
335
|
-
export declare
|
|
286
|
+
export declare namespace Fiber {
|
|
287
|
+
/**
|
|
288
|
+
* @since 3.11.0
|
|
289
|
+
* @experimental
|
|
290
|
+
* @category Fiber
|
|
291
|
+
*/
|
|
292
|
+
interface Variance<out A, out E = never> {
|
|
293
|
+
readonly _A: Covariant<A>;
|
|
294
|
+
readonly _E: Covariant<E>;
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
declare class FiberImpl<in out A = any, in out E = any> implements Fiber<A, E> {
|
|
298
|
+
context: Context.Context<never>;
|
|
299
|
+
interruptible: boolean;
|
|
300
|
+
readonly [FiberTypeId]: Fiber.Variance<A, E>;
|
|
301
|
+
readonly _stack: Array<Primitive>;
|
|
302
|
+
readonly _observers: Array<(exit: MicroExit<A, E>) => void>;
|
|
303
|
+
_exit: MicroExit<A, E> | undefined;
|
|
304
|
+
_children: Set<FiberImpl<any, any>> | undefined;
|
|
305
|
+
currentOpCount: number;
|
|
306
|
+
constructor(context: Context.Context<never>, interruptible?: boolean);
|
|
307
|
+
getRef<I, A>(ref: Context.Reference<I, A>): A;
|
|
308
|
+
addObserver(cb: (exit: MicroExit<A, E>) => void): () => void;
|
|
309
|
+
_interrupted: boolean;
|
|
310
|
+
unsafeInterrupt(): void;
|
|
311
|
+
unsafePoll(): MicroExit<A, E> | undefined;
|
|
312
|
+
evaluate(effect: Primitive): void;
|
|
313
|
+
runLoop(effect: Primitive): MicroExit<A, E> | Yield;
|
|
314
|
+
getCont<S extends successCont | failureCont>(symbol: S): (Primitive & Record<S, (value: any, fiber: FiberImpl) => Primitive>) | undefined;
|
|
315
|
+
_yielded: MicroExit<any, any> | (() => void) | undefined;
|
|
316
|
+
yieldWith(value: MicroExit<any, any> | (() => void)): Yield;
|
|
317
|
+
children(): Set<Fiber<any, any>>;
|
|
318
|
+
}
|
|
336
319
|
/**
|
|
337
|
-
* @since 3.
|
|
320
|
+
* @since 3.11.0
|
|
338
321
|
* @experimental
|
|
339
|
-
* @category
|
|
322
|
+
* @category Fiber
|
|
340
323
|
*/
|
|
341
|
-
export declare const
|
|
324
|
+
export declare const fiberAwait: <A, E>(self: Fiber<A, E>) => Micro<MicroExit<A, E>>;
|
|
342
325
|
/**
|
|
343
|
-
* @since 3.
|
|
326
|
+
* @since 3.11.0
|
|
344
327
|
* @experimental
|
|
345
|
-
* @category
|
|
328
|
+
* @category Fiber
|
|
346
329
|
*/
|
|
347
|
-
export declare const
|
|
330
|
+
export declare const fiberInterrupt: <A, E>(self: Fiber<A, E>) => Micro<void>;
|
|
348
331
|
/**
|
|
349
|
-
* @since 3.
|
|
332
|
+
* @since 3.11.0
|
|
350
333
|
* @experimental
|
|
351
|
-
* @category
|
|
334
|
+
* @category Fiber
|
|
352
335
|
*/
|
|
353
|
-
export declare const
|
|
336
|
+
export declare const fiberInterruptAll: <A extends Iterable<Fiber<any, any>>>(fibers: A) => Micro<void>;
|
|
337
|
+
declare const identifier: unique symbol;
|
|
338
|
+
type identifier = typeof identifier;
|
|
339
|
+
declare const evaluate: unique symbol;
|
|
340
|
+
type evaluate = typeof evaluate;
|
|
341
|
+
declare const successCont: unique symbol;
|
|
342
|
+
type successCont = typeof successCont;
|
|
343
|
+
declare const failureCont: unique symbol;
|
|
344
|
+
type failureCont = typeof failureCont;
|
|
345
|
+
declare const ensureCont: unique symbol;
|
|
346
|
+
type ensureCont = typeof ensureCont;
|
|
347
|
+
declare const Yield: unique symbol;
|
|
348
|
+
type Yield = typeof Yield;
|
|
349
|
+
interface Primitive {
|
|
350
|
+
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;
|
|
355
|
+
}
|
|
354
356
|
/**
|
|
355
|
-
*
|
|
357
|
+
* Creates a `Micro` effect that will succeed with the specified constant value.
|
|
358
|
+
*
|
|
359
|
+
* @since 3.4.0
|
|
356
360
|
* @experimental
|
|
357
|
-
* @category
|
|
361
|
+
* @category constructors
|
|
358
362
|
*/
|
|
359
|
-
export declare const
|
|
363
|
+
export declare const succeed: <A>(value: A) => Micro<A>;
|
|
360
364
|
/**
|
|
365
|
+
* Creates a `Micro` effect that will fail with the specified `MicroCause`.
|
|
366
|
+
*
|
|
361
367
|
* @since 3.4.6
|
|
362
368
|
* @experimental
|
|
363
|
-
* @category
|
|
369
|
+
* @category constructors
|
|
364
370
|
*/
|
|
365
|
-
export declare const
|
|
371
|
+
export declare const failCause: <E>(cause: MicroCause<E>) => Micro<never, E>;
|
|
366
372
|
/**
|
|
367
|
-
*
|
|
373
|
+
* Creates a `Micro` effect that will fail with the specified error.
|
|
374
|
+
*
|
|
375
|
+
* This will result in a `CauseFail`, where the error is tracked at the
|
|
376
|
+
* type level.
|
|
377
|
+
*
|
|
378
|
+
* @since 3.4.0
|
|
368
379
|
* @experimental
|
|
369
|
-
* @category
|
|
380
|
+
* @category constructors
|
|
370
381
|
*/
|
|
371
|
-
export declare const
|
|
382
|
+
export declare const fail: <E>(error: E) => Micro<never, E>;
|
|
372
383
|
/**
|
|
373
|
-
*
|
|
384
|
+
* Creates a `Micro` effect that will succeed with the lazily evaluated value.
|
|
385
|
+
*
|
|
386
|
+
* If the evaluation of the value throws an error, the effect will fail with
|
|
387
|
+
* `CauseDie`.
|
|
388
|
+
*
|
|
389
|
+
* @since 3.4.0
|
|
374
390
|
* @experimental
|
|
375
|
-
* @category
|
|
391
|
+
* @category constructors
|
|
376
392
|
*/
|
|
377
|
-
export declare const
|
|
393
|
+
export declare const sync: <A>(evaluate: LazyArg<A>) => Micro<A>;
|
|
378
394
|
/**
|
|
379
|
-
*
|
|
395
|
+
* Lazily creates a `Micro` effect from the given side-effect.
|
|
396
|
+
*
|
|
397
|
+
* @since 3.4.0
|
|
380
398
|
* @experimental
|
|
381
|
-
* @category
|
|
399
|
+
* @category constructors
|
|
382
400
|
*/
|
|
383
|
-
export declare const
|
|
401
|
+
export declare const suspend: <A, E, R>(evaluate: LazyArg<Micro<A, E, R>>) => Micro<A, E, R>;
|
|
384
402
|
/**
|
|
403
|
+
* Pause the execution of the current `Micro` effect, and resume it on the next
|
|
404
|
+
* scheduler tick.
|
|
405
|
+
*
|
|
385
406
|
* @since 3.4.0
|
|
386
407
|
* @experimental
|
|
387
|
-
* @category
|
|
408
|
+
* @category constructors
|
|
388
409
|
*/
|
|
389
|
-
export declare const
|
|
410
|
+
export declare const yieldNowWith: (priority?: number) => Micro<void>;
|
|
390
411
|
/**
|
|
412
|
+
* Pause the execution of the current `Micro` effect, and resume it on the next
|
|
413
|
+
* scheduler tick.
|
|
414
|
+
*
|
|
391
415
|
* @since 3.4.0
|
|
392
416
|
* @experimental
|
|
393
|
-
* @category
|
|
417
|
+
* @category constructors
|
|
394
418
|
*/
|
|
395
|
-
export
|
|
419
|
+
export declare const yieldNow: Micro<void>;
|
|
396
420
|
/**
|
|
421
|
+
* Creates a `Micro` effect that will succeed with `Option.Some` of the value.
|
|
422
|
+
*
|
|
397
423
|
* @since 3.4.0
|
|
398
424
|
* @experimental
|
|
399
|
-
* @category
|
|
425
|
+
* @category constructors
|
|
400
426
|
*/
|
|
401
|
-
export
|
|
402
|
-
readonly [EnvTypeId]: {
|
|
403
|
-
_R: Covariant<R>;
|
|
404
|
-
};
|
|
405
|
-
readonly refs: ReadonlyRecord<string, unknown>;
|
|
406
|
-
}
|
|
427
|
+
export declare const succeedSome: <A>(a: A) => Micro<Option.Option<A>>;
|
|
407
428
|
/**
|
|
429
|
+
* Creates a `Micro` effect that will succeed with `Option.None`.
|
|
430
|
+
*
|
|
408
431
|
* @since 3.4.0
|
|
409
432
|
* @experimental
|
|
410
|
-
* @category
|
|
433
|
+
* @category constructors
|
|
411
434
|
*/
|
|
412
|
-
export declare const
|
|
435
|
+
export declare const succeedNone: Micro<Option.Option<never>>;
|
|
413
436
|
/**
|
|
437
|
+
* Creates a `Micro` effect that will fail with the lazily evaluated `MicroCause`.
|
|
438
|
+
*
|
|
414
439
|
* @since 3.4.0
|
|
415
440
|
* @experimental
|
|
416
|
-
* @category
|
|
441
|
+
* @category constructors
|
|
417
442
|
*/
|
|
418
|
-
export declare const
|
|
443
|
+
export declare const failCauseSync: <E>(evaluate: LazyArg<MicroCause<E>>) => Micro<never, E>;
|
|
419
444
|
/**
|
|
445
|
+
* Creates a `Micro` effect that will die with the specified error.
|
|
446
|
+
*
|
|
447
|
+
* This will result in a `CauseDie`, where the error is not tracked at
|
|
448
|
+
* the type level.
|
|
449
|
+
*
|
|
420
450
|
* @since 3.4.0
|
|
421
451
|
* @experimental
|
|
422
|
-
* @category
|
|
452
|
+
* @category constructors
|
|
423
453
|
*/
|
|
424
|
-
export declare const
|
|
425
|
-
/**
|
|
426
|
-
* @since 3.4.0
|
|
427
|
-
* @experimental
|
|
428
|
-
* @category environment
|
|
429
|
-
*/
|
|
430
|
-
<A>(ref: EnvRef<A>): <R>(self: Env<R>) => A;
|
|
431
|
-
/**
|
|
432
|
-
* @since 3.4.0
|
|
433
|
-
* @experimental
|
|
434
|
-
* @category environment
|
|
435
|
-
*/
|
|
436
|
-
<A, R>(self: Env<R>, ref: EnvRef<A>): A;
|
|
437
|
-
};
|
|
454
|
+
export declare const die: (defect: unknown) => Micro<never>;
|
|
438
455
|
/**
|
|
439
|
-
*
|
|
456
|
+
* Creates a `Micro` effect that will fail with the lazily evaluated error.
|
|
457
|
+
*
|
|
458
|
+
* This will result in a `CauseFail`, where the error is tracked at the
|
|
459
|
+
* type level.
|
|
460
|
+
*
|
|
461
|
+
* @since 3.4.6
|
|
440
462
|
* @experimental
|
|
441
|
-
* @category
|
|
463
|
+
* @category constructors
|
|
442
464
|
*/
|
|
443
|
-
export declare const
|
|
444
|
-
/**
|
|
445
|
-
* @since 3.4.0
|
|
446
|
-
* @experimental
|
|
447
|
-
* @category environment
|
|
448
|
-
*/
|
|
449
|
-
<A>(ref: EnvRef<A>, value: A): <R>(self: Env<R>) => Env<R>;
|
|
450
|
-
/**
|
|
451
|
-
* @since 3.4.0
|
|
452
|
-
* @experimental
|
|
453
|
-
* @category environment
|
|
454
|
-
*/
|
|
455
|
-
<A, R>(self: Env<R>, ref: EnvRef<A>, value: A): Env<R>;
|
|
456
|
-
};
|
|
465
|
+
export declare const failSync: <E>(error: LazyArg<E>) => Micro<never, E>;
|
|
457
466
|
/**
|
|
467
|
+
* Converts an `Option` into a `Micro` effect, that will fail with
|
|
468
|
+
* `NoSuchElementException` if the option is `None`. Otherwise, it will succeed with the
|
|
469
|
+
* value of the option.
|
|
470
|
+
*
|
|
458
471
|
* @since 3.4.0
|
|
459
472
|
* @experimental
|
|
460
|
-
* @category
|
|
473
|
+
* @category constructors
|
|
461
474
|
*/
|
|
462
|
-
export declare const
|
|
463
|
-
/**
|
|
464
|
-
* @since 3.4.0
|
|
465
|
-
* @experimental
|
|
466
|
-
* @category environment
|
|
467
|
-
*/
|
|
468
|
-
(f: (map: Record<string, unknown>) => void): <R>(self: Env<R>) => Env<R>;
|
|
469
|
-
/**
|
|
470
|
-
* @since 3.4.0
|
|
471
|
-
* @experimental
|
|
472
|
-
* @category environment
|
|
473
|
-
*/
|
|
474
|
-
<R>(self: Env<R>, f: (map: Record<string, unknown>) => void): Env<R>;
|
|
475
|
-
};
|
|
475
|
+
export declare const fromOption: <A>(option: Option.Option<A>) => Micro<A, NoSuchElementException>;
|
|
476
476
|
/**
|
|
477
|
-
*
|
|
477
|
+
* Converts an `Either` into a `Micro` effect, that will fail with the left side
|
|
478
|
+
* of the either if it is a `Left`. Otherwise, it will succeed with the right
|
|
479
|
+
* side of the either.
|
|
478
480
|
*
|
|
479
481
|
* @since 3.4.0
|
|
480
482
|
* @experimental
|
|
481
|
-
* @category
|
|
483
|
+
* @category constructors
|
|
482
484
|
*/
|
|
483
|
-
export declare const
|
|
485
|
+
export declare const fromEither: <R, L>(either: Either.Either<R, L>) => Micro<R, L>;
|
|
486
|
+
declare const void_: Micro<void>;
|
|
487
|
+
export {
|
|
484
488
|
/**
|
|
485
|
-
*
|
|
486
|
-
* dependency at the type level.
|
|
487
|
-
*
|
|
488
|
-
* It will return an `Option` of the service, depending on whether it is
|
|
489
|
-
* available in the environment or not.
|
|
489
|
+
* A `Micro` effect that will succeed with `void` (`undefined`).
|
|
490
490
|
*
|
|
491
491
|
* @since 3.4.0
|
|
492
492
|
* @experimental
|
|
493
|
-
* @category
|
|
493
|
+
* @category constructors
|
|
494
494
|
*/
|
|
495
|
-
|
|
495
|
+
void_ as void };
|
|
496
|
+
declare const try_: <A, E>(options: {
|
|
497
|
+
try: LazyArg<A>;
|
|
498
|
+
catch: (error: unknown) => E;
|
|
499
|
+
}) => Micro<A, E>;
|
|
500
|
+
export {
|
|
496
501
|
/**
|
|
497
|
-
*
|
|
502
|
+
* The `Micro` equivalent of a try / catch block, which allows you to map
|
|
503
|
+
* thrown errors to a specific error type.
|
|
498
504
|
*
|
|
499
505
|
* @since 3.4.0
|
|
500
506
|
* @experimental
|
|
501
|
-
* @category
|
|
507
|
+
* @category constructors
|
|
508
|
+
* @example
|
|
509
|
+
* ```ts
|
|
510
|
+
* import { Micro } from "effect"
|
|
511
|
+
*
|
|
512
|
+
* Micro.try({
|
|
513
|
+
* try: () => throw new Error("boom"),
|
|
514
|
+
* catch: (cause) => new Error("caught", { cause })
|
|
515
|
+
* })
|
|
516
|
+
* ```
|
|
502
517
|
*/
|
|
503
|
-
|
|
518
|
+
try_ as try };
|
|
504
519
|
/**
|
|
505
|
-
*
|
|
520
|
+
* Wrap a `Promise` into a `Micro` effect. Any errors will result in a
|
|
521
|
+
* `CauseDie`.
|
|
506
522
|
*
|
|
507
523
|
* @since 3.4.0
|
|
508
524
|
* @experimental
|
|
509
|
-
* @category
|
|
525
|
+
* @category constructors
|
|
510
526
|
*/
|
|
511
|
-
export declare const
|
|
512
|
-
/**
|
|
513
|
-
* Set the value of the given `EnvRef` for the duration of the effect.
|
|
514
|
-
*
|
|
515
|
-
* @since 3.4.0
|
|
516
|
-
* @experimental
|
|
517
|
-
* @category environment
|
|
518
|
-
*/
|
|
519
|
-
<A>(fiberRef: EnvRef<A>, value: A): <XA, E, R>(self: Micro<XA, E, R>) => Micro<XA, E, R>;
|
|
520
|
-
/**
|
|
521
|
-
* Set the value of the given `EnvRef` for the duration of the effect.
|
|
522
|
-
*
|
|
523
|
-
* @since 3.4.0
|
|
524
|
-
* @experimental
|
|
525
|
-
* @category environment
|
|
526
|
-
*/
|
|
527
|
-
<XA, E, R, A>(self: Micro<XA, E, R>, fiberRef: EnvRef<A>, value: A): Micro<XA, E, R>;
|
|
528
|
-
};
|
|
527
|
+
export declare const promise: <A>(evaluate: (signal: AbortSignal) => PromiseLike<A>) => Micro<A>;
|
|
529
528
|
/**
|
|
530
|
-
*
|
|
529
|
+
* Wrap a `Promise` into a `Micro` effect. Any errors will be caught and
|
|
530
|
+
* converted into a specific error type.
|
|
531
531
|
*
|
|
532
532
|
* @since 3.4.0
|
|
533
533
|
* @experimental
|
|
534
|
-
* @category
|
|
535
|
-
|
|
536
|
-
|
|
534
|
+
* @category constructors
|
|
535
|
+
* @example
|
|
536
|
+
* ```ts
|
|
537
|
+
* import { Micro } from "effect"
|
|
538
|
+
*
|
|
539
|
+
* Micro.tryPromise({
|
|
540
|
+
* try: () => Promise.resolve("success"),
|
|
541
|
+
* catch: (cause) => new Error("caught", { cause })
|
|
542
|
+
* })
|
|
543
|
+
* ```
|
|
544
|
+
*/
|
|
545
|
+
export declare const tryPromise: <A, E>(options: {
|
|
546
|
+
readonly try: (signal: AbortSignal) => PromiseLike<A>;
|
|
547
|
+
readonly catch: (error: unknown) => E;
|
|
548
|
+
}) => Micro<A, E>;
|
|
537
549
|
/**
|
|
538
|
-
*
|
|
550
|
+
* Create a `Micro` effect using the current `Fiber`.
|
|
539
551
|
*
|
|
540
552
|
* @since 3.4.0
|
|
541
553
|
* @experimental
|
|
542
|
-
* @category
|
|
554
|
+
* @category constructors
|
|
543
555
|
*/
|
|
544
|
-
export declare const
|
|
556
|
+
export declare const withFiber: <A, E = never, R = never>(evaluate: (fiber: FiberImpl<A, E>) => Micro<A, E, R>) => Micro<A, E, R>;
|
|
557
|
+
/**
|
|
558
|
+
* Flush any yielded effects that are waiting to be executed.
|
|
559
|
+
*
|
|
560
|
+
* @since 3.4.0
|
|
561
|
+
* @experimental
|
|
562
|
+
* @category constructors
|
|
563
|
+
*/
|
|
564
|
+
export declare const yieldFlush: Micro<void>;
|
|
565
|
+
/**
|
|
566
|
+
* Create a `Micro` effect from an asynchronous computation.
|
|
567
|
+
*
|
|
568
|
+
* You can return a cleanup effect that will be run when the effect is aborted.
|
|
569
|
+
* It is also passed an `AbortSignal` that is triggered when the effect is
|
|
570
|
+
* aborted.
|
|
571
|
+
*
|
|
572
|
+
* @since 3.4.0
|
|
573
|
+
* @experimental
|
|
574
|
+
* @category constructors
|
|
575
|
+
*/
|
|
576
|
+
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>;
|
|
577
|
+
/**
|
|
578
|
+
* A `Micro` that will never succeed or fail. It wraps `setInterval` to prevent
|
|
579
|
+
* the Javascript runtime from exiting.
|
|
580
|
+
*
|
|
581
|
+
* @since 3.4.0
|
|
582
|
+
* @experimental
|
|
583
|
+
* @category constructors
|
|
584
|
+
*/
|
|
585
|
+
export declare const never: Micro<never>;
|
|
586
|
+
/**
|
|
587
|
+
* @since 3.4.0
|
|
588
|
+
* @experimental
|
|
589
|
+
* @category constructors
|
|
590
|
+
*/
|
|
591
|
+
export declare const gen: <Self, Eff extends YieldWrap<Micro<any, any, any>>, AEff>(...args: [self: Self, body: (this: Self) => Generator<Eff, AEff, never>] | [body: () => 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, infer _E, infer R>>] ? R : never>;
|
|
592
|
+
/**
|
|
593
|
+
* Create a `Micro` effect that will replace the success value of the given
|
|
594
|
+
* effect.
|
|
595
|
+
*
|
|
596
|
+
* @since 3.4.0
|
|
597
|
+
* @experimental
|
|
598
|
+
* @category mapping & sequencing
|
|
599
|
+
*/
|
|
600
|
+
export declare const as: {
|
|
545
601
|
/**
|
|
546
|
-
*
|
|
602
|
+
* Create a `Micro` effect that will replace the success value of the given
|
|
603
|
+
* effect.
|
|
547
604
|
*
|
|
548
605
|
* @since 3.4.0
|
|
549
606
|
* @experimental
|
|
550
|
-
* @category
|
|
607
|
+
* @category mapping & sequencing
|
|
551
608
|
*/
|
|
552
|
-
<
|
|
609
|
+
<A, B>(value: B): <E, R>(self: Micro<A, E, R>) => Micro<B, E, R>;
|
|
553
610
|
/**
|
|
554
|
-
*
|
|
611
|
+
* Create a `Micro` effect that will replace the success value of the given
|
|
612
|
+
* effect.
|
|
555
613
|
*
|
|
556
614
|
* @since 3.4.0
|
|
557
615
|
* @experimental
|
|
558
|
-
* @category
|
|
616
|
+
* @category mapping & sequencing
|
|
559
617
|
*/
|
|
560
|
-
<A, E, R,
|
|
618
|
+
<A, E, R, B>(self: Micro<A, E, R>, value: B): Micro<B, E, R>;
|
|
561
619
|
};
|
|
562
620
|
/**
|
|
563
|
-
*
|
|
621
|
+
* Wrap the success value of this `Micro` effect in an `Option.Some`.
|
|
564
622
|
*
|
|
565
623
|
* @since 3.4.0
|
|
566
624
|
* @experimental
|
|
567
|
-
* @category
|
|
625
|
+
* @category mapping & sequencing
|
|
568
626
|
*/
|
|
569
|
-
export declare const
|
|
627
|
+
export declare const asSome: <A, E, R>(self: Micro<A, E, R>) => Micro<Option.Option<A>, E, R>;
|
|
628
|
+
/**
|
|
629
|
+
* Swap the error and success types of the `Micro` effect.
|
|
630
|
+
*
|
|
631
|
+
* @since 3.4.0
|
|
632
|
+
* @experimental
|
|
633
|
+
* @category mapping & sequencing
|
|
634
|
+
*/
|
|
635
|
+
export declare const flip: <A, E, R>(self: Micro<A, E, R>) => Micro<E, A, R>;
|
|
636
|
+
/**
|
|
637
|
+
* A more flexible version of `flatMap`, that combines `map` and `flatMap` into
|
|
638
|
+
* a single api.
|
|
639
|
+
*
|
|
640
|
+
* It also allows you to pass in a `Micro` effect directly, which will be
|
|
641
|
+
* executed after the current effect.
|
|
642
|
+
*
|
|
643
|
+
* @since 3.4.0
|
|
644
|
+
* @experimental
|
|
645
|
+
* @category mapping & sequencing
|
|
646
|
+
*/
|
|
647
|
+
export declare const andThen: {
|
|
570
648
|
/**
|
|
571
|
-
*
|
|
649
|
+
* A more flexible version of `flatMap`, that combines `map` and `flatMap` into
|
|
650
|
+
* a single api.
|
|
651
|
+
*
|
|
652
|
+
* It also allows you to pass in a `Micro` effect directly, which will be
|
|
653
|
+
* executed after the current effect.
|
|
572
654
|
*
|
|
573
655
|
* @since 3.4.0
|
|
574
656
|
* @experimental
|
|
575
|
-
* @category
|
|
657
|
+
* @category mapping & sequencing
|
|
576
658
|
*/
|
|
577
|
-
<
|
|
659
|
+
<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>;
|
|
578
660
|
/**
|
|
579
|
-
*
|
|
661
|
+
* A more flexible version of `flatMap`, that combines `map` and `flatMap` into
|
|
662
|
+
* a single api.
|
|
663
|
+
*
|
|
664
|
+
* It also allows you to pass in a `Micro` effect directly, which will be
|
|
665
|
+
* executed after the current effect.
|
|
580
666
|
*
|
|
581
667
|
* @since 3.4.0
|
|
582
668
|
* @experimental
|
|
583
|
-
* @category
|
|
669
|
+
* @category mapping & sequencing
|
|
584
670
|
*/
|
|
585
|
-
<A, E, R
|
|
586
|
-
};
|
|
587
|
-
/**
|
|
588
|
-
* Create a service using the provided `Micro` effect, and add it to the
|
|
589
|
-
* current context.
|
|
590
|
-
*
|
|
591
|
-
* @since 3.4.6
|
|
592
|
-
* @experimental
|
|
593
|
-
* @category environment
|
|
594
|
-
*/
|
|
595
|
-
export declare const provideServiceEffect: {
|
|
671
|
+
<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>;
|
|
596
672
|
/**
|
|
597
|
-
*
|
|
598
|
-
*
|
|
673
|
+
* A more flexible version of `flatMap`, that combines `map` and `flatMap` into
|
|
674
|
+
* a single api.
|
|
599
675
|
*
|
|
600
|
-
*
|
|
676
|
+
* It also allows you to pass in a `Micro` effect directly, which will be
|
|
677
|
+
* executed after the current effect.
|
|
678
|
+
*
|
|
679
|
+
* @since 3.4.0
|
|
601
680
|
* @experimental
|
|
602
|
-
* @category
|
|
681
|
+
* @category mapping & sequencing
|
|
603
682
|
*/
|
|
604
|
-
<
|
|
683
|
+
<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>;
|
|
605
684
|
/**
|
|
606
|
-
*
|
|
607
|
-
*
|
|
685
|
+
* A more flexible version of `flatMap`, that combines `map` and `flatMap` into
|
|
686
|
+
* a single api.
|
|
608
687
|
*
|
|
609
|
-
*
|
|
688
|
+
* It also allows you to pass in a `Micro` effect directly, which will be
|
|
689
|
+
* executed after the current effect.
|
|
690
|
+
*
|
|
691
|
+
* @since 3.4.0
|
|
610
692
|
* @experimental
|
|
611
|
-
* @category
|
|
693
|
+
* @category mapping & sequencing
|
|
612
694
|
*/
|
|
613
|
-
<A, E, R,
|
|
695
|
+
<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>;
|
|
614
696
|
};
|
|
615
697
|
/**
|
|
616
|
-
*
|
|
617
|
-
*
|
|
618
|
-
*
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
readonly scheduleTask: (task: () => void, priority: number) => void;
|
|
622
|
-
readonly shouldYield: (env: Env<unknown>) => boolean;
|
|
623
|
-
readonly flush: () => void;
|
|
624
|
-
}
|
|
625
|
-
/**
|
|
626
|
-
* @since 3.5.9
|
|
698
|
+
* Execute a side effect from the success value of the `Micro` effect.
|
|
699
|
+
*
|
|
700
|
+
* It is similar to the `andThen` api, but the success value is ignored.
|
|
701
|
+
*
|
|
702
|
+
* @since 3.4.0
|
|
627
703
|
* @experimental
|
|
628
|
-
* @category
|
|
704
|
+
* @category mapping & sequencing
|
|
629
705
|
*/
|
|
630
|
-
export declare
|
|
631
|
-
private tasks;
|
|
632
|
-
private running;
|
|
633
|
-
/**
|
|
634
|
-
* @since 3.5.9
|
|
635
|
-
*/
|
|
636
|
-
scheduleTask(task: () => void, _priority: number): void;
|
|
706
|
+
export declare const tap: {
|
|
637
707
|
/**
|
|
638
|
-
*
|
|
708
|
+
* Execute a side effect from the success value of the `Micro` effect.
|
|
709
|
+
*
|
|
710
|
+
* It is similar to the `andThen` api, but the success value is ignored.
|
|
711
|
+
*
|
|
712
|
+
* @since 3.4.0
|
|
713
|
+
* @experimental
|
|
714
|
+
* @category mapping & sequencing
|
|
639
715
|
*/
|
|
640
|
-
|
|
716
|
+
<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>;
|
|
641
717
|
/**
|
|
642
|
-
*
|
|
718
|
+
* Execute a side effect from the success value of the `Micro` effect.
|
|
719
|
+
*
|
|
720
|
+
* It is similar to the `andThen` api, but the success value is ignored.
|
|
721
|
+
*
|
|
722
|
+
* @since 3.4.0
|
|
723
|
+
* @experimental
|
|
724
|
+
* @category mapping & sequencing
|
|
643
725
|
*/
|
|
644
|
-
|
|
726
|
+
<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>;
|
|
645
727
|
/**
|
|
646
|
-
*
|
|
728
|
+
* Execute a side effect from the success value of the `Micro` effect.
|
|
729
|
+
*
|
|
730
|
+
* It is similar to the `andThen` api, but the success value is ignored.
|
|
731
|
+
*
|
|
732
|
+
* @since 3.4.0
|
|
733
|
+
* @experimental
|
|
734
|
+
* @category mapping & sequencing
|
|
647
735
|
*/
|
|
648
|
-
|
|
736
|
+
<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>;
|
|
649
737
|
/**
|
|
650
|
-
*
|
|
738
|
+
* Execute a side effect from the success value of the `Micro` effect.
|
|
739
|
+
*
|
|
740
|
+
* It is similar to the `andThen` api, but the success value is ignored.
|
|
741
|
+
*
|
|
742
|
+
* @since 3.4.0
|
|
743
|
+
* @experimental
|
|
744
|
+
* @category mapping & sequencing
|
|
651
745
|
*/
|
|
652
|
-
|
|
653
|
-
}
|
|
746
|
+
<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>;
|
|
747
|
+
};
|
|
654
748
|
/**
|
|
749
|
+
* Replace the success value of the `Micro` effect with `void`.
|
|
750
|
+
*
|
|
655
751
|
* @since 3.4.0
|
|
656
752
|
* @experimental
|
|
657
|
-
* @category
|
|
753
|
+
* @category mapping & sequencing
|
|
658
754
|
*/
|
|
659
|
-
export declare const
|
|
755
|
+
export declare const asVoid: <A, E, R>(self: Micro<A, E, R>) => Micro<void, E, R>;
|
|
660
756
|
/**
|
|
661
|
-
*
|
|
757
|
+
* Access the `MicroExit` of the given `Micro` effect.
|
|
758
|
+
*
|
|
759
|
+
* @since 3.4.6
|
|
662
760
|
* @experimental
|
|
663
|
-
* @category
|
|
761
|
+
* @category mapping & sequencing
|
|
664
762
|
*/
|
|
665
|
-
export
|
|
763
|
+
export declare const exit: <A, E, R>(self: Micro<A, E, R>) => Micro<MicroExit<A, E>, never, R>;
|
|
666
764
|
/**
|
|
765
|
+
* Replace the error type of the given `Micro` with the full `MicroCause` object.
|
|
766
|
+
*
|
|
667
767
|
* @since 3.4.0
|
|
668
768
|
* @experimental
|
|
669
|
-
* @category
|
|
769
|
+
* @category mapping & sequencing
|
|
670
770
|
*/
|
|
671
|
-
export
|
|
672
|
-
readonly [EnvRefTypeId]: EnvRefTypeId;
|
|
673
|
-
readonly key: string;
|
|
674
|
-
readonly initial: A;
|
|
675
|
-
[Unify.typeSymbol]?: unknown;
|
|
676
|
-
[Unify.unifySymbol]?: EnvRefUnify<this>;
|
|
677
|
-
[Unify.ignoreSymbol]?: EnvRefUnifyIgnore;
|
|
678
|
-
}
|
|
771
|
+
export declare const sandbox: <A, E, R>(self: Micro<A, E, R>) => Micro<A, MicroCause<E>, R>;
|
|
679
772
|
/**
|
|
680
|
-
*
|
|
681
|
-
*
|
|
773
|
+
* Returns an effect that races all the specified effects,
|
|
774
|
+
* yielding the value of the first effect to succeed with a value. Losers of
|
|
775
|
+
* the race will be interrupted immediately
|
|
776
|
+
*
|
|
777
|
+
* @since 3.4.0
|
|
682
778
|
* @experimental
|
|
779
|
+
* @category sequencing
|
|
683
780
|
*/
|
|
684
|
-
export
|
|
685
|
-
[Unify.typeSymbol]?: any;
|
|
686
|
-
}> extends MicroUnify<A> {
|
|
687
|
-
EnvRef?: () => A[Unify.typeSymbol] extends EnvRef<infer A0> | infer _ ? EnvRef<A0> : never;
|
|
688
|
-
}
|
|
689
|
-
/**
|
|
690
|
-
* @category models
|
|
691
|
-
* @since 3.8.4
|
|
692
|
-
* @experimental
|
|
693
|
-
*/
|
|
694
|
-
export interface EnvRefUnifyIgnore extends MicroUnifyIgnore {
|
|
695
|
-
Micro?: true;
|
|
696
|
-
}
|
|
697
|
-
/**
|
|
698
|
-
* @since 3.4.0
|
|
699
|
-
* @experimental
|
|
700
|
-
* @category environment refs
|
|
701
|
-
*/
|
|
702
|
-
export declare const envRefMake: <A>(key: string, initial: LazyArg<A>) => EnvRef<A>;
|
|
703
|
-
/**
|
|
704
|
-
* @since 3.4.0
|
|
705
|
-
* @experimental
|
|
706
|
-
* @category environment refs
|
|
707
|
-
*/
|
|
708
|
-
export declare const currentAbortController: EnvRef<AbortController>;
|
|
709
|
-
/**
|
|
710
|
-
* @since 3.4.0
|
|
711
|
-
* @experimental
|
|
712
|
-
* @category environment refs
|
|
713
|
-
*/
|
|
714
|
-
export declare const currentAbortSignal: EnvRef<AbortSignal>;
|
|
715
|
-
/**
|
|
716
|
-
* @since 3.4.0
|
|
717
|
-
* @experimental
|
|
718
|
-
* @category environment refs
|
|
719
|
-
*/
|
|
720
|
-
export declare const currentContext: EnvRef<Context.Context<never>>;
|
|
721
|
-
/**
|
|
722
|
-
* @since 3.4.0
|
|
723
|
-
* @experimental
|
|
724
|
-
* @category environment refs
|
|
725
|
-
*/
|
|
726
|
-
export declare const currentConcurrency: EnvRef<"unbounded" | number>;
|
|
727
|
-
/**
|
|
728
|
-
* @since 3.4.0
|
|
729
|
-
* @experimental
|
|
730
|
-
* @category environment refs
|
|
731
|
-
*/
|
|
732
|
-
export declare const currentMaxDepthBeforeYield: EnvRef<number>;
|
|
781
|
+
export declare const raceAll: <Eff extends Micro<any, any, any>>(all: Iterable<Eff>) => Micro<Micro.Success<Eff>, Micro.Error<Eff>, Micro.Context<Eff>>;
|
|
733
782
|
/**
|
|
783
|
+
* Returns an effect that races all the specified effects,
|
|
784
|
+
* yielding the value of the first effect to succeed or fail. Losers of
|
|
785
|
+
* the race will be interrupted immediately
|
|
786
|
+
*
|
|
734
787
|
* @since 3.4.0
|
|
735
788
|
* @experimental
|
|
736
|
-
* @category
|
|
789
|
+
* @category sequencing
|
|
737
790
|
*/
|
|
738
|
-
export declare const
|
|
791
|
+
export declare const raceAllFirst: <Eff extends Micro<any, any, any>>(all: Iterable<Eff>) => Micro<Micro.Success<Eff>, Micro.Error<Eff>, Micro.Context<Eff>>;
|
|
739
792
|
/**
|
|
740
|
-
*
|
|
741
|
-
*
|
|
793
|
+
* 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
|
|
742
795
|
*
|
|
743
796
|
* @since 3.4.0
|
|
744
797
|
* @experimental
|
|
745
|
-
* @category
|
|
746
|
-
* @example
|
|
747
|
-
* import * as Micro from "effect/Micro"
|
|
748
|
-
*
|
|
749
|
-
* Micro.forEach([1, 2, 3], (n) => Micro.succeed(n), {
|
|
750
|
-
* concurrency: "inherit"
|
|
751
|
-
* }).pipe(
|
|
752
|
-
* Micro.withConcurrency(2) // use a concurrency of 2
|
|
753
|
-
* )
|
|
798
|
+
* @category sequencing
|
|
754
799
|
*/
|
|
755
|
-
export declare const
|
|
800
|
+
export declare const race: {
|
|
756
801
|
/**
|
|
757
|
-
*
|
|
758
|
-
*
|
|
802
|
+
* 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
|
|
759
804
|
*
|
|
760
805
|
* @since 3.4.0
|
|
761
806
|
* @experimental
|
|
762
|
-
* @category
|
|
763
|
-
* @example
|
|
764
|
-
* import * as Micro from "effect/Micro"
|
|
765
|
-
*
|
|
766
|
-
* Micro.forEach([1, 2, 3], (n) => Micro.succeed(n), {
|
|
767
|
-
* concurrency: "inherit"
|
|
768
|
-
* }).pipe(
|
|
769
|
-
* Micro.withConcurrency(2) // use a concurrency of 2
|
|
770
|
-
* )
|
|
807
|
+
* @category sequencing
|
|
771
808
|
*/
|
|
772
|
-
(
|
|
809
|
+
<A2, E2, R2>(that: Micro<A2, E2, R2>): <A, E, R>(self: Micro<A, E, R>) => Micro<A | A2, E | E2, R | R2>;
|
|
773
810
|
/**
|
|
774
|
-
*
|
|
775
|
-
*
|
|
811
|
+
* 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
|
|
776
813
|
*
|
|
777
814
|
* @since 3.4.0
|
|
778
815
|
* @experimental
|
|
779
|
-
* @category
|
|
780
|
-
* @example
|
|
781
|
-
* import * as Micro from "effect/Micro"
|
|
782
|
-
*
|
|
783
|
-
* Micro.forEach([1, 2, 3], (n) => Micro.succeed(n), {
|
|
784
|
-
* concurrency: "inherit"
|
|
785
|
-
* }).pipe(
|
|
786
|
-
* Micro.withConcurrency(2) // use a concurrency of 2
|
|
787
|
-
* )
|
|
816
|
+
* @category sequencing
|
|
788
817
|
*/
|
|
789
|
-
<A, E, R>(self: Micro<A, E, R>,
|
|
818
|
+
<A, E, R, A2, E2, R2>(self: Micro<A, E, R>, that: Micro<A2, E2, R2>): Micro<A | A2, E | E2, R | R2>;
|
|
790
819
|
};
|
|
791
820
|
/**
|
|
792
|
-
*
|
|
793
|
-
*
|
|
794
|
-
* result of the effect.
|
|
795
|
-
*
|
|
796
|
-
* @since 3.4.0
|
|
797
|
-
* @experimental
|
|
798
|
-
* @category constructors
|
|
799
|
-
*/
|
|
800
|
-
export declare const make: <R, A, E>(run: (env: Env<R>, onExit: (exit: MicroExit<A, E>) => void) => void) => Micro<A, E, R>;
|
|
801
|
-
/**
|
|
802
|
-
* Converts a `MicroExit` into a `Micro` effect.
|
|
803
|
-
*
|
|
804
|
-
* @since 3.4.6
|
|
805
|
-
* @experimental
|
|
806
|
-
* @category constructors
|
|
807
|
-
*/
|
|
808
|
-
export declare const fromExit: <A, E>(self: MicroExit<A, E>) => Micro<A, E>;
|
|
809
|
-
/**
|
|
810
|
-
* Converts a lazy `MicroExit` into a `Micro` effect.
|
|
811
|
-
*
|
|
812
|
-
* @since 3.4.6
|
|
813
|
-
* @experimental
|
|
814
|
-
* @category constructors
|
|
815
|
-
*/
|
|
816
|
-
export declare const fromExitSync: <A, E>(self: LazyArg<MicroExit<A, E>>) => Micro<A, E>;
|
|
817
|
-
/**
|
|
818
|
-
* Creates a `Micro` effect that will succeed with the specified constant value.
|
|
819
|
-
*
|
|
820
|
-
* @since 3.4.0
|
|
821
|
-
* @experimental
|
|
822
|
-
* @category constructors
|
|
823
|
-
*/
|
|
824
|
-
export declare const succeed: <A>(a: A) => Micro<A>;
|
|
825
|
-
/**
|
|
826
|
-
* Creates a `Micro` effect that will succeed with `Option.Some` of the value.
|
|
821
|
+
* 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
|
|
827
823
|
*
|
|
828
824
|
* @since 3.4.0
|
|
829
825
|
* @experimental
|
|
830
|
-
* @category
|
|
826
|
+
* @category sequencing
|
|
831
827
|
*/
|
|
832
|
-
export declare const
|
|
828
|
+
export declare const raceFirst: {
|
|
829
|
+
/**
|
|
830
|
+
* 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
|
|
832
|
+
*
|
|
833
|
+
* @since 3.4.0
|
|
834
|
+
* @experimental
|
|
835
|
+
* @category sequencing
|
|
836
|
+
*/
|
|
837
|
+
<A2, E2, R2>(that: Micro<A2, E2, R2>): <A, E, R>(self: Micro<A, E, R>) => Micro<A | A2, E | E2, R | R2>;
|
|
838
|
+
/**
|
|
839
|
+
* 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
|
|
841
|
+
*
|
|
842
|
+
* @since 3.4.0
|
|
843
|
+
* @experimental
|
|
844
|
+
* @category sequencing
|
|
845
|
+
*/
|
|
846
|
+
<A, E, R, A2, E2, R2>(self: Micro<A, E, R>, that: Micro<A2, E2, R2>): Micro<A | A2, E | E2, R | R2>;
|
|
847
|
+
};
|
|
833
848
|
/**
|
|
834
|
-
*
|
|
849
|
+
* Map the success value of this `Micro` effect to another `Micro` effect, then
|
|
850
|
+
* flatten the result.
|
|
835
851
|
*
|
|
836
852
|
* @since 3.4.0
|
|
837
853
|
* @experimental
|
|
838
|
-
* @category
|
|
854
|
+
* @category mapping & sequencing
|
|
839
855
|
*/
|
|
840
|
-
export declare const
|
|
856
|
+
export declare const flatMap: {
|
|
857
|
+
/**
|
|
858
|
+
* Map the success value of this `Micro` effect to another `Micro` effect, then
|
|
859
|
+
* flatten the result.
|
|
860
|
+
*
|
|
861
|
+
* @since 3.4.0
|
|
862
|
+
* @experimental
|
|
863
|
+
* @category mapping & sequencing
|
|
864
|
+
*/
|
|
865
|
+
<A, B, E2, R2>(f: (a: A) => Micro<B, E2, R2>): <E, R>(self: Micro<A, E, R>) => Micro<B, E | E2, R | R2>;
|
|
866
|
+
/**
|
|
867
|
+
* Map the success value of this `Micro` effect to another `Micro` effect, then
|
|
868
|
+
* flatten the result.
|
|
869
|
+
*
|
|
870
|
+
* @since 3.4.0
|
|
871
|
+
* @experimental
|
|
872
|
+
* @category mapping & sequencing
|
|
873
|
+
*/
|
|
874
|
+
<A, E, R, B, E2, R2>(self: Micro<A, E, R>, f: (a: A) => Micro<B, E2, R2>): Micro<B, E | E2, R | R2>;
|
|
875
|
+
};
|
|
841
876
|
/**
|
|
842
|
-
*
|
|
843
|
-
*
|
|
844
|
-
* This will result in a `CauseFail`, where the error is tracked at the
|
|
845
|
-
* type level.
|
|
877
|
+
* Flattens any nested `Micro` effects, merging the error and requirement types.
|
|
846
878
|
*
|
|
847
879
|
* @since 3.4.0
|
|
848
880
|
* @experimental
|
|
849
|
-
* @category
|
|
881
|
+
* @category mapping & sequencing
|
|
850
882
|
*/
|
|
851
|
-
export declare const
|
|
883
|
+
export declare const flatten: <A, E, R, E2, R2>(self: Micro<Micro<A, E, R>, E2, R2>) => Micro<A, E | E2, R | R2>;
|
|
852
884
|
/**
|
|
853
|
-
*
|
|
854
|
-
*
|
|
855
|
-
* This will result in a `CauseFail`, where the error is tracked at the
|
|
856
|
-
* type level.
|
|
885
|
+
* Transforms the success value of the `Micro` effect with the specified
|
|
886
|
+
* function.
|
|
857
887
|
*
|
|
858
888
|
* @since 3.4.0
|
|
859
889
|
* @experimental
|
|
860
|
-
* @category
|
|
890
|
+
* @category mapping & sequencing
|
|
861
891
|
*/
|
|
862
|
-
export declare const
|
|
892
|
+
export declare const map: {
|
|
893
|
+
/**
|
|
894
|
+
* Transforms the success value of the `Micro` effect with the specified
|
|
895
|
+
* function.
|
|
896
|
+
*
|
|
897
|
+
* @since 3.4.0
|
|
898
|
+
* @experimental
|
|
899
|
+
* @category mapping & sequencing
|
|
900
|
+
*/
|
|
901
|
+
<A, B>(f: (a: A) => B): <E, R>(self: Micro<A, E, R>) => Micro<B, E, R>;
|
|
902
|
+
/**
|
|
903
|
+
* Transforms the success value of the `Micro` effect with the specified
|
|
904
|
+
* function.
|
|
905
|
+
*
|
|
906
|
+
* @since 3.4.0
|
|
907
|
+
* @experimental
|
|
908
|
+
* @category mapping & sequencing
|
|
909
|
+
*/
|
|
910
|
+
<A, E, R, B>(self: Micro<A, E, R>, f: (a: A) => B): Micro<B, E, R>;
|
|
911
|
+
};
|
|
863
912
|
/**
|
|
864
|
-
*
|
|
865
|
-
*
|
|
866
|
-
* This will result in a `CauseDie`, where the error is not tracked at
|
|
867
|
-
* the type level.
|
|
913
|
+
* The MicroExit type is a data type that represents the result of a Micro
|
|
914
|
+
* computation.
|
|
868
915
|
*
|
|
869
|
-
*
|
|
870
|
-
* @experimental
|
|
871
|
-
* @category constructors
|
|
872
|
-
*/
|
|
873
|
-
export declare const die: (defect: unknown) => Micro<never>;
|
|
874
|
-
/**
|
|
875
|
-
* Creates a `Micro` effect that will fail with the specified `MicroCause`.
|
|
916
|
+
* It uses the `Either` data type to represent the success and failure cases.
|
|
876
917
|
*
|
|
877
918
|
* @since 3.4.6
|
|
878
919
|
* @experimental
|
|
879
|
-
* @category
|
|
920
|
+
* @category MicroExit
|
|
880
921
|
*/
|
|
881
|
-
export
|
|
922
|
+
export type MicroExit<A, E = never> = MicroExit.Success<A, E> | MicroExit.Failure<A, E>;
|
|
882
923
|
/**
|
|
883
|
-
* Creates a `Micro` effect that will fail with the lazily evaluated `MicroCause`.
|
|
884
|
-
*
|
|
885
924
|
* @since 3.4.6
|
|
886
925
|
* @experimental
|
|
887
|
-
* @category
|
|
888
|
-
*/
|
|
889
|
-
export declare const failCauseSync: <E>(cause: LazyArg<MicroCause<E>>) => Micro<never, E>;
|
|
890
|
-
/**
|
|
891
|
-
* Creates a `Micro` effect that will succeed with the lazily evaluated value.
|
|
892
|
-
*
|
|
893
|
-
* If the evaluation of the value throws an error, the effect will fail with
|
|
894
|
-
* `CauseDie`.
|
|
895
|
-
*
|
|
896
|
-
* @since 3.4.0
|
|
897
|
-
* @experimental
|
|
898
|
-
* @category constructors
|
|
926
|
+
* @category MicroExit
|
|
899
927
|
*/
|
|
900
|
-
export declare
|
|
928
|
+
export declare namespace MicroExit {
|
|
929
|
+
/**
|
|
930
|
+
* @since 3.4.6
|
|
931
|
+
* @experimental
|
|
932
|
+
* @category MicroExit
|
|
933
|
+
*/
|
|
934
|
+
interface Proto<out A, out E = never> extends Micro<A, E> {
|
|
935
|
+
readonly [MicroExitTypeId]: MicroExitTypeId;
|
|
936
|
+
}
|
|
937
|
+
/**
|
|
938
|
+
* @since 3.4.6
|
|
939
|
+
* @experimental
|
|
940
|
+
* @category MicroExit
|
|
941
|
+
*/
|
|
942
|
+
interface Success<out A, out E> extends Proto<A, E> {
|
|
943
|
+
readonly _tag: "Success";
|
|
944
|
+
readonly value: A;
|
|
945
|
+
}
|
|
946
|
+
/**
|
|
947
|
+
* @since 3.4.6
|
|
948
|
+
* @experimental
|
|
949
|
+
* @category MicroExit
|
|
950
|
+
*/
|
|
951
|
+
interface Failure<out A, out E> extends Proto<A, E> {
|
|
952
|
+
readonly _tag: "Failure";
|
|
953
|
+
readonly cause: MicroCause<E>;
|
|
954
|
+
}
|
|
955
|
+
}
|
|
901
956
|
/**
|
|
902
|
-
*
|
|
903
|
-
* `NoSuchElementException` if the option is `None`. Otherwise, it will succeed with the
|
|
904
|
-
* value of the option.
|
|
905
|
-
*
|
|
906
|
-
* @since 3.4.0
|
|
957
|
+
* @since 3.4.6
|
|
907
958
|
* @experimental
|
|
908
|
-
* @category
|
|
959
|
+
* @category MicroExit
|
|
909
960
|
*/
|
|
910
|
-
export declare const
|
|
961
|
+
export declare const isMicroExit: (u: unknown) => u is MicroExit<unknown, unknown>;
|
|
911
962
|
/**
|
|
912
|
-
*
|
|
913
|
-
* of the either if it is a `Left`. Otherwise, it will succeed with the right
|
|
914
|
-
* side of the either.
|
|
915
|
-
*
|
|
916
|
-
* @since 3.4.0
|
|
963
|
+
* @since 3.4.6
|
|
917
964
|
* @experimental
|
|
918
|
-
* @category
|
|
965
|
+
* @category MicroExit
|
|
919
966
|
*/
|
|
920
|
-
export declare const
|
|
967
|
+
export declare const exitSucceed: <A>(a: A) => MicroExit<A, never>;
|
|
921
968
|
/**
|
|
922
|
-
*
|
|
923
|
-
*
|
|
924
|
-
* @since 3.4.0
|
|
969
|
+
* @since 3.4.6
|
|
925
970
|
* @experimental
|
|
926
|
-
* @category
|
|
971
|
+
* @category MicroExit
|
|
927
972
|
*/
|
|
928
|
-
export declare const
|
|
929
|
-
declare const void_: Micro<void>;
|
|
930
|
-
export {
|
|
973
|
+
export declare const exitFailCause: <E>(cause: MicroCause<E>) => MicroExit<never, E>;
|
|
931
974
|
/**
|
|
932
|
-
*
|
|
933
|
-
*
|
|
934
|
-
* @since 3.4.0
|
|
975
|
+
* @since 3.4.6
|
|
935
976
|
* @experimental
|
|
936
|
-
* @category
|
|
977
|
+
* @category MicroExit
|
|
937
978
|
*/
|
|
938
|
-
|
|
979
|
+
export declare const exitInterrupt: MicroExit<never>;
|
|
939
980
|
/**
|
|
940
|
-
*
|
|
941
|
-
*
|
|
942
|
-
* You can return a cleanup effect that will be run when the effect is aborted.
|
|
943
|
-
* It is also passed an `AbortSignal` that is triggered when the effect is
|
|
944
|
-
* aborted.
|
|
945
|
-
*
|
|
946
|
-
* @since 3.4.0
|
|
981
|
+
* @since 3.4.6
|
|
947
982
|
* @experimental
|
|
948
|
-
* @category
|
|
983
|
+
* @category MicroExit
|
|
949
984
|
*/
|
|
950
|
-
export declare const
|
|
951
|
-
declare const try_: <A, E>(options: {
|
|
952
|
-
try: LazyArg<A>;
|
|
953
|
-
catch: (error: unknown) => E;
|
|
954
|
-
}) => Micro<A, E>;
|
|
955
|
-
export {
|
|
985
|
+
export declare const exitFail: <E>(e: E) => MicroExit<never, E>;
|
|
956
986
|
/**
|
|
957
|
-
*
|
|
958
|
-
* thrown errors to a specific error type.
|
|
959
|
-
*
|
|
960
|
-
* @since 3.4.0
|
|
987
|
+
* @since 3.4.6
|
|
961
988
|
* @experimental
|
|
962
|
-
* @category
|
|
963
|
-
* @example
|
|
964
|
-
* import { Micro } from "effect"
|
|
965
|
-
*
|
|
966
|
-
* Micro.try({
|
|
967
|
-
* try: () => throw new Error("boom"),
|
|
968
|
-
* catch: (cause) => new Error("caught", { cause })
|
|
969
|
-
* })
|
|
989
|
+
* @category MicroExit
|
|
970
990
|
*/
|
|
971
|
-
|
|
991
|
+
export declare const exitDie: (defect: unknown) => MicroExit<never>;
|
|
972
992
|
/**
|
|
973
|
-
*
|
|
974
|
-
* `CauseDie`.
|
|
975
|
-
*
|
|
976
|
-
* @since 3.4.0
|
|
993
|
+
* @since 3.4.6
|
|
977
994
|
* @experimental
|
|
978
|
-
* @category
|
|
995
|
+
* @category MicroExit
|
|
979
996
|
*/
|
|
980
|
-
export declare const
|
|
997
|
+
export declare const exitIsSuccess: <A, E>(self: MicroExit<A, E>) => self is MicroExit.Success<A, E>;
|
|
981
998
|
/**
|
|
982
|
-
*
|
|
983
|
-
* converted into a specific error type.
|
|
984
|
-
*
|
|
985
|
-
* @since 3.4.0
|
|
999
|
+
* @since 3.4.6
|
|
986
1000
|
* @experimental
|
|
987
|
-
* @category
|
|
988
|
-
* @example
|
|
989
|
-
* import { Micro } from "effect"
|
|
990
|
-
*
|
|
991
|
-
* Micro.tryPromise({
|
|
992
|
-
* try: () => Promise.resolve("success"),
|
|
993
|
-
* catch: (cause) => new Error("caught", { cause })
|
|
994
|
-
* })
|
|
1001
|
+
* @category MicroExit
|
|
995
1002
|
*/
|
|
996
|
-
export declare const
|
|
997
|
-
readonly try: (signal: AbortSignal) => PromiseLike<A>;
|
|
998
|
-
readonly catch: (error: unknown) => E;
|
|
999
|
-
}) => Micro<A, E>;
|
|
1003
|
+
export declare const exitIsFailure: <A, E>(self: MicroExit<A, E>) => self is MicroExit.Failure<A, E>;
|
|
1000
1004
|
/**
|
|
1001
|
-
*
|
|
1002
|
-
* iteration of the event loop.
|
|
1003
|
-
*
|
|
1004
|
-
* You can specify a priority for the task, which will determine when it is
|
|
1005
|
-
* executed relative to other tasks.
|
|
1006
|
-
*
|
|
1007
|
-
* @since 3.4.0
|
|
1005
|
+
* @since 3.4.6
|
|
1008
1006
|
* @experimental
|
|
1009
|
-
* @category
|
|
1007
|
+
* @category MicroExit
|
|
1010
1008
|
*/
|
|
1011
|
-
export declare const
|
|
1009
|
+
export declare const exitIsInterrupt: <A, E>(self: MicroExit<A, E>) => self is MicroExit.Failure<A, E> & {
|
|
1010
|
+
readonly cause: MicroCause.Interrupt;
|
|
1011
|
+
};
|
|
1012
1012
|
/**
|
|
1013
|
-
*
|
|
1014
|
-
* iteration of the event loop.
|
|
1015
|
-
*
|
|
1016
|
-
* @since 3.4.0
|
|
1013
|
+
* @since 3.4.6
|
|
1017
1014
|
* @experimental
|
|
1018
|
-
* @category
|
|
1015
|
+
* @category MicroExit
|
|
1019
1016
|
*/
|
|
1020
|
-
export declare const
|
|
1017
|
+
export declare const exitIsFail: <A, E>(self: MicroExit<A, E>) => self is MicroExit.Failure<A, E> & {
|
|
1018
|
+
readonly cause: MicroCause.Fail<E>;
|
|
1019
|
+
};
|
|
1021
1020
|
/**
|
|
1022
|
-
*
|
|
1023
|
-
*
|
|
1024
|
-
* @since 3.4.0
|
|
1021
|
+
* @since 3.4.6
|
|
1025
1022
|
* @experimental
|
|
1026
|
-
* @category
|
|
1023
|
+
* @category MicroExit
|
|
1027
1024
|
*/
|
|
1028
|
-
export declare const
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
*
|
|
1033
|
-
* @since 3.4.0
|
|
1025
|
+
export declare const exitIsDie: <A, E>(self: MicroExit<A, E>) => self is MicroExit.Failure<A, E> & {
|
|
1026
|
+
readonly cause: MicroCause.Die;
|
|
1027
|
+
};
|
|
1028
|
+
/**
|
|
1029
|
+
* @since 3.4.6
|
|
1034
1030
|
* @experimental
|
|
1035
|
-
* @category
|
|
1031
|
+
* @category MicroExit
|
|
1036
1032
|
*/
|
|
1037
|
-
export declare const
|
|
1033
|
+
export declare const exitVoid: MicroExit<void>;
|
|
1038
1034
|
/**
|
|
1039
|
-
* @since 3.
|
|
1035
|
+
* @since 3.11.0
|
|
1040
1036
|
* @experimental
|
|
1041
|
-
* @category
|
|
1037
|
+
* @category MicroExit
|
|
1042
1038
|
*/
|
|
1043
|
-
export declare const
|
|
1039
|
+
export declare const exitVoidAll: <I extends Iterable<MicroExit<any, any>>>(exits: I) => MicroExit<void, I extends Iterable<MicroExit<infer _A, infer _E>> ? _E : never>;
|
|
1044
1040
|
/**
|
|
1045
|
-
*
|
|
1046
|
-
*
|
|
1047
|
-
* @since 3.4.0
|
|
1041
|
+
* @since 3.5.9
|
|
1048
1042
|
* @experimental
|
|
1049
|
-
* @category
|
|
1043
|
+
* @category scheduler
|
|
1050
1044
|
*/
|
|
1051
|
-
export
|
|
1045
|
+
export interface MicroScheduler {
|
|
1046
|
+
readonly scheduleTask: (task: () => void, priority: number) => void;
|
|
1047
|
+
readonly shouldYield: (fiber: Fiber<unknown, unknown>) => boolean;
|
|
1048
|
+
readonly flush: () => void;
|
|
1049
|
+
}
|
|
1052
1050
|
/**
|
|
1053
|
-
*
|
|
1054
|
-
* function.
|
|
1055
|
-
*
|
|
1056
|
-
* @since 3.4.0
|
|
1051
|
+
* @since 3.5.9
|
|
1057
1052
|
* @experimental
|
|
1058
|
-
* @category
|
|
1053
|
+
* @category scheduler
|
|
1059
1054
|
*/
|
|
1060
|
-
export declare
|
|
1055
|
+
export declare class MicroSchedulerDefault implements MicroScheduler {
|
|
1056
|
+
private tasks;
|
|
1057
|
+
private running;
|
|
1061
1058
|
/**
|
|
1062
|
-
*
|
|
1063
|
-
* function.
|
|
1064
|
-
*
|
|
1065
|
-
* @since 3.4.0
|
|
1066
|
-
* @experimental
|
|
1067
|
-
* @category mapping & sequencing
|
|
1059
|
+
* @since 3.5.9
|
|
1068
1060
|
*/
|
|
1069
|
-
|
|
1061
|
+
scheduleTask(task: () => void, _priority: number): void;
|
|
1070
1062
|
/**
|
|
1071
|
-
*
|
|
1072
|
-
* function.
|
|
1073
|
-
*
|
|
1074
|
-
* @since 3.4.0
|
|
1075
|
-
* @experimental
|
|
1076
|
-
* @category mapping & sequencing
|
|
1063
|
+
* @since 3.5.9
|
|
1077
1064
|
*/
|
|
1078
|
-
|
|
1079
|
-
|
|
1065
|
+
afterScheduled: () => void;
|
|
1066
|
+
/**
|
|
1067
|
+
* @since 3.5.9
|
|
1068
|
+
*/
|
|
1069
|
+
runTasks(): void;
|
|
1070
|
+
/**
|
|
1071
|
+
* @since 3.5.9
|
|
1072
|
+
*/
|
|
1073
|
+
shouldYield(fiber: Fiber<unknown, unknown>): boolean;
|
|
1074
|
+
/**
|
|
1075
|
+
* @since 3.5.9
|
|
1076
|
+
*/
|
|
1077
|
+
flush(): void;
|
|
1078
|
+
}
|
|
1080
1079
|
/**
|
|
1081
|
-
*
|
|
1082
|
-
* effect.
|
|
1080
|
+
* Access the given `Context.Tag` from the environment.
|
|
1083
1081
|
*
|
|
1084
1082
|
* @since 3.4.0
|
|
1085
1083
|
* @experimental
|
|
1086
|
-
* @category
|
|
1084
|
+
* @category environment
|
|
1087
1085
|
*/
|
|
1088
|
-
export declare const
|
|
1086
|
+
export declare const service: {
|
|
1089
1087
|
/**
|
|
1090
|
-
*
|
|
1091
|
-
* effect.
|
|
1088
|
+
* Access the given `Context.Tag` from the environment.
|
|
1092
1089
|
*
|
|
1093
1090
|
* @since 3.4.0
|
|
1094
1091
|
* @experimental
|
|
1095
|
-
* @category
|
|
1092
|
+
* @category environment
|
|
1096
1093
|
*/
|
|
1097
|
-
<
|
|
1094
|
+
<I, S>(tag: Context.Reference<I, S>): Micro<S>;
|
|
1098
1095
|
/**
|
|
1099
|
-
*
|
|
1100
|
-
* effect.
|
|
1096
|
+
* Access the given `Context.Tag` from the environment.
|
|
1101
1097
|
*
|
|
1102
1098
|
* @since 3.4.0
|
|
1103
1099
|
* @experimental
|
|
1104
|
-
* @category
|
|
1100
|
+
* @category environment
|
|
1105
1101
|
*/
|
|
1106
|
-
<
|
|
1102
|
+
<I, S>(tag: Context.Tag<I, S>): Micro<S, never, I>;
|
|
1107
1103
|
};
|
|
1108
1104
|
/**
|
|
1109
|
-
*
|
|
1105
|
+
* Access the given `Context.Tag` from the environment, without tracking the
|
|
1106
|
+
* dependency at the type level.
|
|
1107
|
+
*
|
|
1108
|
+
* It will return an `Option` of the service, depending on whether it is
|
|
1109
|
+
* available in the environment or not.
|
|
1110
1110
|
*
|
|
1111
1111
|
* @since 3.4.0
|
|
1112
1112
|
* @experimental
|
|
1113
|
-
* @category
|
|
1113
|
+
* @category environment
|
|
1114
1114
|
*/
|
|
1115
|
-
export declare const
|
|
1115
|
+
export declare const serviceOption: <I, S>(tag: Context.Tag<I, S>) => Micro<Option.Option<S>>;
|
|
1116
1116
|
/**
|
|
1117
|
-
*
|
|
1118
|
-
* flatten the result.
|
|
1117
|
+
* Update the Context with the given mapping function.
|
|
1119
1118
|
*
|
|
1120
|
-
* @since 3.
|
|
1119
|
+
* @since 3.11.0
|
|
1121
1120
|
* @experimental
|
|
1122
|
-
* @category
|
|
1121
|
+
* @category environment
|
|
1123
1122
|
*/
|
|
1124
|
-
export declare const
|
|
1123
|
+
export declare const updateContext: {
|
|
1125
1124
|
/**
|
|
1126
|
-
*
|
|
1127
|
-
* flatten the result.
|
|
1125
|
+
* Update the Context with the given mapping function.
|
|
1128
1126
|
*
|
|
1129
|
-
* @since 3.
|
|
1127
|
+
* @since 3.11.0
|
|
1130
1128
|
* @experimental
|
|
1131
|
-
* @category
|
|
1129
|
+
* @category environment
|
|
1132
1130
|
*/
|
|
1133
|
-
<
|
|
1131
|
+
<R2, R>(f: (context: Context.Context<R2>) => Context.Context<NoInfer<R>>): <A, E>(self: Micro<A, E, R>) => Micro<A, E, R2>;
|
|
1134
1132
|
/**
|
|
1135
|
-
*
|
|
1136
|
-
* flatten the result.
|
|
1133
|
+
* Update the Context with the given mapping function.
|
|
1137
1134
|
*
|
|
1138
|
-
* @since 3.
|
|
1135
|
+
* @since 3.11.0
|
|
1139
1136
|
* @experimental
|
|
1140
|
-
* @category
|
|
1137
|
+
* @category environment
|
|
1141
1138
|
*/
|
|
1142
|
-
<A, E, R,
|
|
1139
|
+
<A, E, R, R2>(self: Micro<A, E, R>, f: (context: Context.Context<R2>) => Context.Context<NoInfer<R>>): Micro<A, E, R2>;
|
|
1143
1140
|
};
|
|
1144
1141
|
/**
|
|
1145
|
-
*
|
|
1146
|
-
*
|
|
1147
|
-
* @since 3.4.0
|
|
1148
|
-
* @experimental
|
|
1149
|
-
* @category mapping & sequencing
|
|
1150
|
-
*/
|
|
1151
|
-
export declare const flip: <A, E, R>(self: Micro<A, E, R>) => Micro<E, A, R>;
|
|
1152
|
-
/**
|
|
1153
|
-
* A more flexible version of `flatMap`, that combines `map` and `flatMap` into
|
|
1154
|
-
* a single api.
|
|
1155
|
-
*
|
|
1156
|
-
* It also allows you to pass in a `Micro` effect directly, which will be
|
|
1157
|
-
* executed after the current effect.
|
|
1142
|
+
* Update the service for the given `Context.Tag` in the environment.
|
|
1158
1143
|
*
|
|
1159
|
-
* @since 3.
|
|
1144
|
+
* @since 3.11.0
|
|
1160
1145
|
* @experimental
|
|
1161
|
-
* @category
|
|
1146
|
+
* @category environment
|
|
1162
1147
|
*/
|
|
1163
|
-
export declare const
|
|
1148
|
+
export declare const updateService: {
|
|
1164
1149
|
/**
|
|
1165
|
-
*
|
|
1166
|
-
* a single api.
|
|
1167
|
-
*
|
|
1168
|
-
* It also allows you to pass in a `Micro` effect directly, which will be
|
|
1169
|
-
* executed after the current effect.
|
|
1150
|
+
* Update the service for the given `Context.Tag` in the environment.
|
|
1170
1151
|
*
|
|
1171
|
-
* @since 3.
|
|
1152
|
+
* @since 3.11.0
|
|
1172
1153
|
* @experimental
|
|
1173
|
-
* @category
|
|
1154
|
+
* @category environment
|
|
1174
1155
|
*/
|
|
1175
|
-
<
|
|
1156
|
+
<I, A>(tag: Context.Reference<I, A>, f: (value: A) => A): <XA, E, R>(self: Micro<XA, E, R>) => Micro<XA, E, R>;
|
|
1176
1157
|
/**
|
|
1177
|
-
*
|
|
1178
|
-
* a single api.
|
|
1158
|
+
* Update the service for the given `Context.Tag` in the environment.
|
|
1179
1159
|
*
|
|
1180
|
-
*
|
|
1181
|
-
* executed after the current effect.
|
|
1182
|
-
*
|
|
1183
|
-
* @since 3.4.0
|
|
1160
|
+
* @since 3.11.0
|
|
1184
1161
|
* @experimental
|
|
1185
|
-
* @category
|
|
1162
|
+
* @category environment
|
|
1186
1163
|
*/
|
|
1187
|
-
<
|
|
1164
|
+
<I, A>(tag: Context.Tag<I, A>, f: (value: A) => A): <XA, E, R>(self: Micro<XA, E, R>) => Micro<XA, E, R | I>;
|
|
1188
1165
|
/**
|
|
1189
|
-
*
|
|
1190
|
-
* a single api.
|
|
1191
|
-
*
|
|
1192
|
-
* It also allows you to pass in a `Micro` effect directly, which will be
|
|
1193
|
-
* executed after the current effect.
|
|
1166
|
+
* Update the service for the given `Context.Tag` in the environment.
|
|
1194
1167
|
*
|
|
1195
|
-
* @since 3.
|
|
1168
|
+
* @since 3.11.0
|
|
1196
1169
|
* @experimental
|
|
1197
|
-
* @category
|
|
1170
|
+
* @category environment
|
|
1198
1171
|
*/
|
|
1199
|
-
<
|
|
1172
|
+
<XA, E, R, I, A>(self: Micro<XA, E, R>, tag: Context.Reference<I, A>, f: (value: A) => A): Micro<XA, E, R>;
|
|
1200
1173
|
/**
|
|
1201
|
-
*
|
|
1202
|
-
* a single api.
|
|
1203
|
-
*
|
|
1204
|
-
* It also allows you to pass in a `Micro` effect directly, which will be
|
|
1205
|
-
* executed after the current effect.
|
|
1174
|
+
* Update the service for the given `Context.Tag` in the environment.
|
|
1206
1175
|
*
|
|
1207
|
-
* @since 3.
|
|
1176
|
+
* @since 3.11.0
|
|
1208
1177
|
* @experimental
|
|
1209
|
-
* @category
|
|
1178
|
+
* @category environment
|
|
1210
1179
|
*/
|
|
1211
|
-
<
|
|
1180
|
+
<XA, E, R, I, A>(self: Micro<XA, E, R>, tag: Context.Tag<I, A>, f: (value: A) => A): Micro<XA, E, R | I>;
|
|
1212
1181
|
};
|
|
1213
1182
|
/**
|
|
1214
|
-
*
|
|
1183
|
+
* Access the current `Context` from the environment.
|
|
1215
1184
|
*
|
|
1216
|
-
*
|
|
1185
|
+
* @since 3.4.0
|
|
1186
|
+
* @experimental
|
|
1187
|
+
* @category environment
|
|
1188
|
+
*/
|
|
1189
|
+
export declare const context: <R>() => Micro<Context.Context<R>>;
|
|
1190
|
+
/**
|
|
1191
|
+
* Merge the given `Context` with the current context.
|
|
1217
1192
|
*
|
|
1218
1193
|
* @since 3.4.0
|
|
1219
1194
|
* @experimental
|
|
1220
|
-
* @category
|
|
1195
|
+
* @category environment
|
|
1221
1196
|
*/
|
|
1222
|
-
export declare const
|
|
1223
|
-
/**
|
|
1224
|
-
* Execute a side effect from the success value of the `Micro` effect.
|
|
1225
|
-
*
|
|
1226
|
-
* It is similar to the `andThen` api, but the success value is ignored.
|
|
1227
|
-
*
|
|
1228
|
-
* @since 3.4.0
|
|
1229
|
-
* @experimental
|
|
1230
|
-
* @category mapping & sequencing
|
|
1231
|
-
*/
|
|
1232
|
-
<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>;
|
|
1233
|
-
/**
|
|
1234
|
-
* Execute a side effect from the success value of the `Micro` effect.
|
|
1235
|
-
*
|
|
1236
|
-
* It is similar to the `andThen` api, but the success value is ignored.
|
|
1237
|
-
*
|
|
1238
|
-
* @since 3.4.0
|
|
1239
|
-
* @experimental
|
|
1240
|
-
* @category mapping & sequencing
|
|
1241
|
-
*/
|
|
1242
|
-
<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>;
|
|
1197
|
+
export declare const provideContext: {
|
|
1243
1198
|
/**
|
|
1244
|
-
*
|
|
1245
|
-
*
|
|
1246
|
-
* It is similar to the `andThen` api, but the success value is ignored.
|
|
1199
|
+
* Merge the given `Context` with the current context.
|
|
1247
1200
|
*
|
|
1248
1201
|
* @since 3.4.0
|
|
1249
1202
|
* @experimental
|
|
1250
|
-
* @category
|
|
1203
|
+
* @category environment
|
|
1251
1204
|
*/
|
|
1252
|
-
<A, E, R
|
|
1205
|
+
<XR>(context: Context.Context<XR>): <A, E, R>(self: Micro<A, E, R>) => Micro<A, E, Exclude<R, XR>>;
|
|
1253
1206
|
/**
|
|
1254
|
-
*
|
|
1255
|
-
*
|
|
1256
|
-
* It is similar to the `andThen` api, but the success value is ignored.
|
|
1207
|
+
* Merge the given `Context` with the current context.
|
|
1257
1208
|
*
|
|
1258
1209
|
* @since 3.4.0
|
|
1259
1210
|
* @experimental
|
|
1260
|
-
* @category
|
|
1211
|
+
* @category environment
|
|
1261
1212
|
*/
|
|
1262
|
-
<A, E, R,
|
|
1213
|
+
<A, E, R, XR>(self: Micro<A, E, R>, context: Context.Context<XR>): Micro<A, E, Exclude<R, XR>>;
|
|
1263
1214
|
};
|
|
1264
1215
|
/**
|
|
1265
|
-
*
|
|
1266
|
-
*
|
|
1267
|
-
* @since 3.4.0
|
|
1268
|
-
* @experimental
|
|
1269
|
-
* @category mapping & sequencing
|
|
1270
|
-
*/
|
|
1271
|
-
export declare const asVoid: <A, E, R>(self: Micro<A, E, R>) => Micro<void, E, R>;
|
|
1272
|
-
/**
|
|
1273
|
-
* Access the `MicroExit` of the given `Micro` effect.
|
|
1274
|
-
*
|
|
1275
|
-
* @since 3.4.6
|
|
1276
|
-
* @experimental
|
|
1277
|
-
* @category mapping & sequencing
|
|
1278
|
-
*/
|
|
1279
|
-
export declare const exit: <A, E, R>(self: Micro<A, E, R>) => Micro<MicroExit<A, E>, never, R>;
|
|
1280
|
-
/**
|
|
1281
|
-
* Replace the error type of the given `Micro` with the full `MicroCause` object.
|
|
1282
|
-
*
|
|
1283
|
-
* @since 3.4.0
|
|
1284
|
-
* @experimental
|
|
1285
|
-
* @category mapping & sequencing
|
|
1286
|
-
*/
|
|
1287
|
-
export declare const sandbox: <A, E, R>(self: Micro<A, E, R>) => Micro<A, MicroCause<E>, R>;
|
|
1288
|
-
/**
|
|
1289
|
-
* Returns an effect that races all the specified effects,
|
|
1290
|
-
* yielding the value of the first effect to succeed with a value. Losers of
|
|
1291
|
-
* the race will be interrupted immediately
|
|
1292
|
-
*
|
|
1293
|
-
* @since 3.4.0
|
|
1294
|
-
* @experimental
|
|
1295
|
-
* @category sequencing
|
|
1296
|
-
*/
|
|
1297
|
-
export declare const raceAll: <Eff extends Micro<any, any, any>>(all: Iterable<Eff>) => Micro<Micro.Success<Eff>, Micro.Error<Eff>, Micro.Context<Eff>>;
|
|
1298
|
-
/**
|
|
1299
|
-
* Returns an effect that races all the specified effects,
|
|
1300
|
-
* yielding the value of the first effect to succeed or fail. Losers of
|
|
1301
|
-
* the race will be interrupted immediately
|
|
1216
|
+
* Add the provided service to the current context.
|
|
1302
1217
|
*
|
|
1303
1218
|
* @since 3.4.0
|
|
1304
1219
|
* @experimental
|
|
1305
|
-
* @category
|
|
1220
|
+
* @category environment
|
|
1306
1221
|
*/
|
|
1307
|
-
export declare const
|
|
1222
|
+
export declare const provideService: {
|
|
1223
|
+
/**
|
|
1224
|
+
* Add the provided service to the current context.
|
|
1225
|
+
*
|
|
1226
|
+
* @since 3.4.0
|
|
1227
|
+
* @experimental
|
|
1228
|
+
* @category environment
|
|
1229
|
+
*/
|
|
1230
|
+
<I, S>(tag: Context.Tag<I, S>, service: S): <A, E, R>(self: Micro<A, E, R>) => Micro<A, E, Exclude<R, I>>;
|
|
1231
|
+
/**
|
|
1232
|
+
* Add the provided service to the current context.
|
|
1233
|
+
*
|
|
1234
|
+
* @since 3.4.0
|
|
1235
|
+
* @experimental
|
|
1236
|
+
* @category environment
|
|
1237
|
+
*/
|
|
1238
|
+
<A, E, R, I, S>(self: Micro<A, E, R>, tag: Context.Tag<I, S>, service: S): Micro<A, E, Exclude<R, I>>;
|
|
1239
|
+
};
|
|
1308
1240
|
/**
|
|
1309
|
-
*
|
|
1310
|
-
*
|
|
1241
|
+
* Create a service using the provided `Micro` effect, and add it to the
|
|
1242
|
+
* current context.
|
|
1311
1243
|
*
|
|
1312
|
-
* @since 3.4.
|
|
1244
|
+
* @since 3.4.6
|
|
1313
1245
|
* @experimental
|
|
1314
|
-
* @category
|
|
1246
|
+
* @category environment
|
|
1315
1247
|
*/
|
|
1316
|
-
export declare const
|
|
1248
|
+
export declare const provideServiceEffect: {
|
|
1317
1249
|
/**
|
|
1318
|
-
*
|
|
1319
|
-
*
|
|
1250
|
+
* Create a service using the provided `Micro` effect, and add it to the
|
|
1251
|
+
* current context.
|
|
1320
1252
|
*
|
|
1321
|
-
* @since 3.4.
|
|
1253
|
+
* @since 3.4.6
|
|
1322
1254
|
* @experimental
|
|
1323
|
-
* @category
|
|
1255
|
+
* @category environment
|
|
1324
1256
|
*/
|
|
1325
|
-
<
|
|
1257
|
+
<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>;
|
|
1326
1258
|
/**
|
|
1327
|
-
*
|
|
1328
|
-
*
|
|
1259
|
+
* Create a service using the provided `Micro` effect, and add it to the
|
|
1260
|
+
* current context.
|
|
1329
1261
|
*
|
|
1330
|
-
* @since 3.4.
|
|
1262
|
+
* @since 3.4.6
|
|
1331
1263
|
* @experimental
|
|
1332
|
-
* @category
|
|
1264
|
+
* @category environment
|
|
1333
1265
|
*/
|
|
1334
|
-
<A, E, R,
|
|
1266
|
+
<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>;
|
|
1335
1267
|
};
|
|
1268
|
+
declare const MaxOpsBeforeYield_base: Context.ReferenceClass<MaxOpsBeforeYield, "effect/Micro/currentMaxOpsBeforeYield", number>;
|
|
1336
1269
|
/**
|
|
1337
|
-
*
|
|
1338
|
-
*
|
|
1270
|
+
* @since 3.11.0
|
|
1271
|
+
* @experimental
|
|
1272
|
+
* @category references
|
|
1273
|
+
*/
|
|
1274
|
+
export declare class MaxOpsBeforeYield extends MaxOpsBeforeYield_base {
|
|
1275
|
+
}
|
|
1276
|
+
declare const CurrentConcurrency_base: Context.ReferenceClass<CurrentConcurrency, "effect/Micro/currentConcurrency", number | "unbounded">;
|
|
1277
|
+
/**
|
|
1278
|
+
* @since 3.11.0
|
|
1279
|
+
* @experimental
|
|
1280
|
+
* @category environment refs
|
|
1281
|
+
*/
|
|
1282
|
+
export declare class CurrentConcurrency extends CurrentConcurrency_base {
|
|
1283
|
+
}
|
|
1284
|
+
declare const CurrentScheduler_base: Context.ReferenceClass<CurrentScheduler, "effect/Micro/currentScheduler", MicroScheduler>;
|
|
1285
|
+
/**
|
|
1286
|
+
* @since 3.11.0
|
|
1287
|
+
* @experimental
|
|
1288
|
+
* @category environment refs
|
|
1289
|
+
*/
|
|
1290
|
+
export declare class CurrentScheduler extends CurrentScheduler_base {
|
|
1291
|
+
}
|
|
1292
|
+
/**
|
|
1293
|
+
* If you have a `Micro` that uses `concurrency: "inherit"`, you can use this
|
|
1294
|
+
* api to control the concurrency of that `Micro` when it is run.
|
|
1339
1295
|
*
|
|
1340
1296
|
* @since 3.4.0
|
|
1341
1297
|
* @experimental
|
|
1342
|
-
* @category
|
|
1298
|
+
* @category environment refs
|
|
1299
|
+
* @example
|
|
1300
|
+
* import * as Micro from "effect/Micro"
|
|
1301
|
+
*
|
|
1302
|
+
* Micro.forEach([1, 2, 3], (n) => Micro.succeed(n), {
|
|
1303
|
+
* concurrency: "inherit"
|
|
1304
|
+
* }).pipe(
|
|
1305
|
+
* Micro.withConcurrency(2) // use a concurrency of 2
|
|
1306
|
+
* )
|
|
1343
1307
|
*/
|
|
1344
|
-
export declare const
|
|
1308
|
+
export declare const withConcurrency: {
|
|
1345
1309
|
/**
|
|
1346
|
-
*
|
|
1347
|
-
*
|
|
1310
|
+
* If you have a `Micro` that uses `concurrency: "inherit"`, you can use this
|
|
1311
|
+
* api to control the concurrency of that `Micro` when it is run.
|
|
1348
1312
|
*
|
|
1349
1313
|
* @since 3.4.0
|
|
1350
1314
|
* @experimental
|
|
1351
|
-
* @category
|
|
1315
|
+
* @category environment refs
|
|
1316
|
+
* @example
|
|
1317
|
+
* import * as Micro from "effect/Micro"
|
|
1318
|
+
*
|
|
1319
|
+
* Micro.forEach([1, 2, 3], (n) => Micro.succeed(n), {
|
|
1320
|
+
* concurrency: "inherit"
|
|
1321
|
+
* }).pipe(
|
|
1322
|
+
* Micro.withConcurrency(2) // use a concurrency of 2
|
|
1323
|
+
* )
|
|
1352
1324
|
*/
|
|
1353
|
-
|
|
1325
|
+
(concurrency: "unbounded" | number): <A, E, R>(self: Micro<A, E, R>) => Micro<A, E, R>;
|
|
1354
1326
|
/**
|
|
1355
|
-
*
|
|
1356
|
-
*
|
|
1327
|
+
* If you have a `Micro` that uses `concurrency: "inherit"`, you can use this
|
|
1328
|
+
* api to control the concurrency of that `Micro` when it is run.
|
|
1357
1329
|
*
|
|
1358
1330
|
* @since 3.4.0
|
|
1359
1331
|
* @experimental
|
|
1360
|
-
* @category
|
|
1332
|
+
* @category environment refs
|
|
1333
|
+
* @example
|
|
1334
|
+
* import * as Micro from "effect/Micro"
|
|
1335
|
+
*
|
|
1336
|
+
* Micro.forEach([1, 2, 3], (n) => Micro.succeed(n), {
|
|
1337
|
+
* concurrency: "inherit"
|
|
1338
|
+
* }).pipe(
|
|
1339
|
+
* Micro.withConcurrency(2) // use a concurrency of 2
|
|
1340
|
+
* )
|
|
1361
1341
|
*/
|
|
1362
|
-
<A, E, R
|
|
1342
|
+
<A, E, R>(self: Micro<A, E, R>, concurrency: "unbounded" | number): Micro<A, E, R>;
|
|
1363
1343
|
};
|
|
1364
1344
|
/**
|
|
1365
1345
|
* Combine two `Micro` effects into a single effect that produces a tuple of
|
|
@@ -1653,6 +1633,84 @@ export declare const repeat: {
|
|
|
1653
1633
|
schedule?: MicroSchedule | undefined;
|
|
1654
1634
|
} | undefined): Micro<A, E, R>;
|
|
1655
1635
|
};
|
|
1636
|
+
/**
|
|
1637
|
+
* Replicates the given effect `n` times.
|
|
1638
|
+
*
|
|
1639
|
+
* @since 3.11.0
|
|
1640
|
+
* @experimental
|
|
1641
|
+
* @category repetition
|
|
1642
|
+
*/
|
|
1643
|
+
export declare const replicate: {
|
|
1644
|
+
/**
|
|
1645
|
+
* Replicates the given effect `n` times.
|
|
1646
|
+
*
|
|
1647
|
+
* @since 3.11.0
|
|
1648
|
+
* @experimental
|
|
1649
|
+
* @category repetition
|
|
1650
|
+
*/
|
|
1651
|
+
(n: number): <A, E, R>(self: Micro<A, E, R>) => Array<Micro<A, E, R>>;
|
|
1652
|
+
/**
|
|
1653
|
+
* Replicates the given effect `n` times.
|
|
1654
|
+
*
|
|
1655
|
+
* @since 3.11.0
|
|
1656
|
+
* @experimental
|
|
1657
|
+
* @category repetition
|
|
1658
|
+
*/
|
|
1659
|
+
<A, E, R>(self: Micro<A, E, R>, n: number): Array<Micro<A, E, R>>;
|
|
1660
|
+
};
|
|
1661
|
+
/**
|
|
1662
|
+
* Performs this effect the specified number of times and collects the
|
|
1663
|
+
* results.
|
|
1664
|
+
*
|
|
1665
|
+
* @since 3.11.0
|
|
1666
|
+
* @category repetition
|
|
1667
|
+
*/
|
|
1668
|
+
export declare const replicateEffect: {
|
|
1669
|
+
/**
|
|
1670
|
+
* Performs this effect the specified number of times and collects the
|
|
1671
|
+
* results.
|
|
1672
|
+
*
|
|
1673
|
+
* @since 3.11.0
|
|
1674
|
+
* @category repetition
|
|
1675
|
+
*/
|
|
1676
|
+
(n: number, options?: {
|
|
1677
|
+
readonly concurrency?: Concurrency | undefined;
|
|
1678
|
+
readonly discard?: false | undefined;
|
|
1679
|
+
}): <A, E, R>(self: Micro<A, E, R>) => Micro<Array<A>, E, R>;
|
|
1680
|
+
/**
|
|
1681
|
+
* Performs this effect the specified number of times and collects the
|
|
1682
|
+
* results.
|
|
1683
|
+
*
|
|
1684
|
+
* @since 3.11.0
|
|
1685
|
+
* @category repetition
|
|
1686
|
+
*/
|
|
1687
|
+
(n: number, options: {
|
|
1688
|
+
readonly concurrency?: Concurrency | undefined;
|
|
1689
|
+
readonly discard: true;
|
|
1690
|
+
}): <A, E, R>(self: Micro<A, E, R>) => Micro<void, E, R>;
|
|
1691
|
+
/**
|
|
1692
|
+
* Performs this effect the specified number of times and collects the
|
|
1693
|
+
* results.
|
|
1694
|
+
*
|
|
1695
|
+
* @since 3.11.0
|
|
1696
|
+
* @category repetition
|
|
1697
|
+
*/
|
|
1698
|
+
<A, E, R>(self: Micro<A, E, R>, n: number, options?: {
|
|
1699
|
+
readonly concurrency?: Concurrency | undefined;
|
|
1700
|
+
readonly discard?: false | undefined;
|
|
1701
|
+
}): Micro<Array<A>, E, R>;
|
|
1702
|
+
/**
|
|
1703
|
+
* Performs this effect the specified number of times and collects the
|
|
1704
|
+
* results.
|
|
1705
|
+
*
|
|
1706
|
+
* @since 3.11.0
|
|
1707
|
+
* @category repetition
|
|
1708
|
+
*/
|
|
1709
|
+
<A, E, R>(self: Micro<A, E, R>, n: number, options: {
|
|
1710
|
+
readonly concurrency?: Concurrency | undefined;
|
|
1711
|
+
readonly discard: true;
|
|
1712
|
+
}): Micro<void, E, R>;
|
|
1713
|
+
};
|
|
1656
1714
|
/**
|
|
1657
1715
|
* Repeat the given `Micro` effect forever, only stopping if the effect fails.
|
|
1658
1716
|
*
|
|
@@ -2741,6 +2799,31 @@ export declare const onExit: {
|
|
|
2741
2799
|
*/
|
|
2742
2800
|
<A, E, R, XE, XR>(self: Micro<A, E, R>, f: (exit: MicroExit<A, E>) => Micro<void, XE, XR>): Micro<A, E | XE, R | XR>;
|
|
2743
2801
|
};
|
|
2802
|
+
/**
|
|
2803
|
+
* Regardless of the result of the this `Micro` effect, run the finalizer effect.
|
|
2804
|
+
*
|
|
2805
|
+
* @since 3.4.0
|
|
2806
|
+
* @experimental
|
|
2807
|
+
* @category resources & finalization
|
|
2808
|
+
*/
|
|
2809
|
+
export declare const ensuring: {
|
|
2810
|
+
/**
|
|
2811
|
+
* Regardless of the result of the this `Micro` effect, run the finalizer effect.
|
|
2812
|
+
*
|
|
2813
|
+
* @since 3.4.0
|
|
2814
|
+
* @experimental
|
|
2815
|
+
* @category resources & finalization
|
|
2816
|
+
*/
|
|
2817
|
+
<XE, XR>(finalizer: Micro<void, XE, XR>): <A, E, R>(self: Micro<A, E, R>) => Micro<A, E | XE, R | XR>;
|
|
2818
|
+
/**
|
|
2819
|
+
* Regardless of the result of the this `Micro` effect, run the finalizer effect.
|
|
2820
|
+
*
|
|
2821
|
+
* @since 3.4.0
|
|
2822
|
+
* @experimental
|
|
2823
|
+
* @category resources & finalization
|
|
2824
|
+
*/
|
|
2825
|
+
<A, E, R, XE, XR>(self: Micro<A, E, R>, finalizer: Micro<void, XE, XR>): Micro<A, E | XE, R | XR>;
|
|
2826
|
+
};
|
|
2744
2827
|
/**
|
|
2745
2828
|
* When the `Micro` effect is completed, run the given finalizer effect if it
|
|
2746
2829
|
* matches the specified predicate.
|
|
@@ -2787,31 +2870,6 @@ export declare const onExitIf: {
|
|
|
2787
2870
|
*/
|
|
2788
2871
|
<A, E, R, XE, XR>(self: Micro<A, E, R>, predicate: Predicate<MicroExit<NoInfer<A>, NoInfer<E>>>, f: (exit: MicroExit<NoInfer<A>, NoInfer<E>>) => Micro<void, XE, XR>): Micro<A, E | XE, R | XR>;
|
|
2789
2872
|
};
|
|
2790
|
-
/**
|
|
2791
|
-
* Regardless of the result of the this `Micro` effect, run the finalizer effect.
|
|
2792
|
-
*
|
|
2793
|
-
* @since 3.4.0
|
|
2794
|
-
* @experimental
|
|
2795
|
-
* @category resources & finalization
|
|
2796
|
-
*/
|
|
2797
|
-
export declare const ensuring: {
|
|
2798
|
-
/**
|
|
2799
|
-
* Regardless of the result of the this `Micro` effect, run the finalizer effect.
|
|
2800
|
-
*
|
|
2801
|
-
* @since 3.4.0
|
|
2802
|
-
* @experimental
|
|
2803
|
-
* @category resources & finalization
|
|
2804
|
-
*/
|
|
2805
|
-
<XE, XR>(finalizer: Micro<void, XE, XR>): <A, E, R>(self: Micro<A, E, R>) => Micro<A, E | XE, R | XR>;
|
|
2806
|
-
/**
|
|
2807
|
-
* Regardless of the result of the this `Micro` effect, run the finalizer effect.
|
|
2808
|
-
*
|
|
2809
|
-
* @since 3.4.0
|
|
2810
|
-
* @experimental
|
|
2811
|
-
* @category resources & finalization
|
|
2812
|
-
*/
|
|
2813
|
-
<A, E, R, XE, XR>(self: Micro<A, E, R>, finalizer: Micro<void, XE, XR>): Micro<A, E | XE, R | XR>;
|
|
2814
|
-
};
|
|
2815
2873
|
/**
|
|
2816
2874
|
* When the `Micro` effect fails, run the given finalizer effect with the
|
|
2817
2875
|
* `MicroCause` of the executed effect.
|
|
@@ -2883,14 +2941,23 @@ export declare const acquireUseRelease: <Resource, E, R, A, E2, R2, E3, R3>(acqu
|
|
|
2883
2941
|
*/
|
|
2884
2942
|
export declare const interrupt: Micro<never>;
|
|
2885
2943
|
/**
|
|
2886
|
-
*
|
|
2887
|
-
*
|
|
2944
|
+
* Flag the effect as uninterruptible, which means that when the effect is
|
|
2945
|
+
* interrupted, it will be allowed to continue running until completion.
|
|
2888
2946
|
*
|
|
2889
2947
|
* @since 3.4.0
|
|
2890
2948
|
* @experimental
|
|
2891
|
-
* @category
|
|
2949
|
+
* @category flags
|
|
2892
2950
|
*/
|
|
2893
2951
|
export declare const uninterruptible: <A, E, R>(self: Micro<A, E, R>) => Micro<A, E, R>;
|
|
2952
|
+
/**
|
|
2953
|
+
* Flag the effect as interruptible, which means that when the effect is
|
|
2954
|
+
* interrupted, it will be interrupted immediately.
|
|
2955
|
+
*
|
|
2956
|
+
* @since 3.4.0
|
|
2957
|
+
* @experimental
|
|
2958
|
+
* @category flags
|
|
2959
|
+
*/
|
|
2960
|
+
export declare const interruptible: <A, E, R>(self: Micro<A, E, R>) => Micro<A, E, R>;
|
|
2894
2961
|
/**
|
|
2895
2962
|
* Wrap the given `Micro` effect in an uninterruptible region, preventing the
|
|
2896
2963
|
* effect from being aborted.
|
|
@@ -2902,6 +2969,7 @@ export declare const uninterruptible: <A, E, R>(self: Micro<A, E, R>) => Micro<A
|
|
|
2902
2969
|
* @experimental
|
|
2903
2970
|
* @category interruption
|
|
2904
2971
|
* @example
|
|
2972
|
+
* ```ts
|
|
2905
2973
|
* import * as Micro from "effect/Micro"
|
|
2906
2974
|
*
|
|
2907
2975
|
* Micro.uninterruptibleMask((restore) =>
|
|
@@ -2909,17 +2977,9 @@ export declare const uninterruptible: <A, E, R>(self: Micro<A, E, R>) => Micro<A
|
|
|
2909
2977
|
* Micro.andThen(restore(Micro.sleep(1000))) // interruptible
|
|
2910
2978
|
* )
|
|
2911
2979
|
* )
|
|
2980
|
+
* ```
|
|
2912
2981
|
*/
|
|
2913
2982
|
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>;
|
|
2914
|
-
/**
|
|
2915
|
-
* Wrap the given `Micro` effect in an interruptible region, allowing the effect
|
|
2916
|
-
* to be aborted.
|
|
2917
|
-
*
|
|
2918
|
-
* @since 3.4.0
|
|
2919
|
-
* @experimental
|
|
2920
|
-
* @category interruption
|
|
2921
|
-
*/
|
|
2922
|
-
export declare const interruptible: <A, E, R>(self: Micro<A, E, R>) => Micro<A, E, R>;
|
|
2923
2983
|
/**
|
|
2924
2984
|
* @since 3.4.0
|
|
2925
2985
|
* @experimental
|
|
@@ -2982,6 +3042,16 @@ export declare const all: <const Arg extends Iterable<Micro<any, any, any>> | Re
|
|
|
2982
3042
|
readonly concurrency?: Concurrency | undefined;
|
|
2983
3043
|
readonly discard?: boolean | undefined;
|
|
2984
3044
|
}>(arg: Arg, options?: O) => All.Return<Arg, O>;
|
|
3045
|
+
/**
|
|
3046
|
+
* @since 3.11.0
|
|
3047
|
+
* @experimental
|
|
3048
|
+
* @category collecting & elements
|
|
3049
|
+
*/
|
|
3050
|
+
export declare const whileLoop: <A, E, R>(options: {
|
|
3051
|
+
readonly while: LazyArg<boolean>;
|
|
3052
|
+
readonly body: LazyArg<Micro<A, E, R>>;
|
|
3053
|
+
readonly step: (a: A) => void;
|
|
3054
|
+
}) => Micro<void, E, R>;
|
|
2985
3055
|
/**
|
|
2986
3056
|
* For each element of the provided iterable, run the effect and collect the results.
|
|
2987
3057
|
*
|
|
@@ -3139,60 +3209,6 @@ export {
|
|
|
3139
3209
|
* @category do notation
|
|
3140
3210
|
*/
|
|
3141
3211
|
let_ as let };
|
|
3142
|
-
/**
|
|
3143
|
-
* @since 3.4.0
|
|
3144
|
-
* @experimental
|
|
3145
|
-
* @category handle & forking
|
|
3146
|
-
*/
|
|
3147
|
-
export declare const HandleTypeId: unique symbol;
|
|
3148
|
-
/**
|
|
3149
|
-
* @since 3.4.0
|
|
3150
|
-
* @experimental
|
|
3151
|
-
* @category handle & forking
|
|
3152
|
-
*/
|
|
3153
|
-
export type HandleTypeId = typeof HandleTypeId;
|
|
3154
|
-
/**
|
|
3155
|
-
* @since 3.4.0
|
|
3156
|
-
* @experimental
|
|
3157
|
-
* @category handle & forking
|
|
3158
|
-
*/
|
|
3159
|
-
export interface Handle<A, E = never> extends Micro<A, E> {
|
|
3160
|
-
readonly [HandleTypeId]: HandleTypeId;
|
|
3161
|
-
readonly await: Micro<MicroExit<A, E>>;
|
|
3162
|
-
readonly join: Micro<A, E>;
|
|
3163
|
-
readonly interrupt: Micro<MicroExit<A, E>>;
|
|
3164
|
-
readonly unsafeInterrupt: () => void;
|
|
3165
|
-
readonly addObserver: (observer: (exit: MicroExit<A, E>) => void) => void;
|
|
3166
|
-
readonly removeObserver: (observer: (exit: MicroExit<A, E>) => void) => void;
|
|
3167
|
-
readonly unsafePoll: () => MicroExit<A, E> | null;
|
|
3168
|
-
[Unify.typeSymbol]?: unknown;
|
|
3169
|
-
[Unify.unifySymbol]?: HandleUnify<this>;
|
|
3170
|
-
[Unify.ignoreSymbol]?: HandleUnifyIgnore;
|
|
3171
|
-
}
|
|
3172
|
-
/**
|
|
3173
|
-
* @category models
|
|
3174
|
-
* @since 3.8.4
|
|
3175
|
-
* @experimental
|
|
3176
|
-
*/
|
|
3177
|
-
export interface HandleUnify<A extends {
|
|
3178
|
-
[Unify.typeSymbol]?: any;
|
|
3179
|
-
}> extends MicroUnify<A> {
|
|
3180
|
-
Handle?: () => A[Unify.typeSymbol] extends Handle<infer A0, infer E0> | infer _ ? Handle<A0, E0> : never;
|
|
3181
|
-
}
|
|
3182
|
-
/**
|
|
3183
|
-
* @category models
|
|
3184
|
-
* @since 3.8.4
|
|
3185
|
-
* @experimental
|
|
3186
|
-
*/
|
|
3187
|
-
export interface HandleUnifyIgnore extends MicroUnifyIgnore {
|
|
3188
|
-
Micro?: true;
|
|
3189
|
-
}
|
|
3190
|
-
/**
|
|
3191
|
-
* @since 3.4.0
|
|
3192
|
-
* @experimental
|
|
3193
|
-
* @category handle & forking
|
|
3194
|
-
*/
|
|
3195
|
-
export declare const isHandle: (u: unknown) => u is Handle<unknown, unknown>;
|
|
3196
3212
|
/**
|
|
3197
3213
|
* Run the `Micro` effect in a new `Handle` that can be awaited, joined, or
|
|
3198
3214
|
* aborted.
|
|
@@ -3203,7 +3219,7 @@ export declare const isHandle: (u: unknown) => u is Handle<unknown, unknown>;
|
|
|
3203
3219
|
* @experimental
|
|
3204
3220
|
* @category handle & forking
|
|
3205
3221
|
*/
|
|
3206
|
-
export declare const fork: <A, E, R>(self: Micro<A, E, R>) => Micro<
|
|
3222
|
+
export declare const fork: <A, E, R>(self: Micro<A, E, R>) => Micro<Fiber<A, E>, never, R>;
|
|
3207
3223
|
/**
|
|
3208
3224
|
* Run the `Micro` effect in a new `Handle` that can be awaited, joined, or
|
|
3209
3225
|
* aborted.
|
|
@@ -3214,7 +3230,7 @@ export declare const fork: <A, E, R>(self: Micro<A, E, R>) => Micro<Handle<A, E>
|
|
|
3214
3230
|
* @experimental
|
|
3215
3231
|
* @category handle & forking
|
|
3216
3232
|
*/
|
|
3217
|
-
export declare const forkDaemon: <A, E, R>(self: Micro<A, E, R>) => Micro<
|
|
3233
|
+
export declare const forkDaemon: <A, E, R>(self: Micro<A, E, R>) => Micro<Fiber<A, E>, never, R>;
|
|
3218
3234
|
/**
|
|
3219
3235
|
* Run the `Micro` effect in a new `Handle` that can be awaited, joined, or
|
|
3220
3236
|
* aborted.
|
|
@@ -3236,7 +3252,7 @@ export declare const forkIn: {
|
|
|
3236
3252
|
* @experimental
|
|
3237
3253
|
* @category handle & forking
|
|
3238
3254
|
*/
|
|
3239
|
-
(scope: MicroScope): <A, E, R>(self: Micro<A, E, R>) => Micro<
|
|
3255
|
+
(scope: MicroScope): <A, E, R>(self: Micro<A, E, R>) => Micro<Fiber<A, E>, never, R>;
|
|
3240
3256
|
/**
|
|
3241
3257
|
* Run the `Micro` effect in a new `Handle` that can be awaited, joined, or
|
|
3242
3258
|
* aborted.
|
|
@@ -3247,7 +3263,7 @@ export declare const forkIn: {
|
|
|
3247
3263
|
* @experimental
|
|
3248
3264
|
* @category handle & forking
|
|
3249
3265
|
*/
|
|
3250
|
-
<A, E, R>(self: Micro<A, E, R>, scope: MicroScope): Micro<
|
|
3266
|
+
<A, E, R>(self: Micro<A, E, R>, scope: MicroScope): Micro<Fiber<A, E>, never, R>;
|
|
3251
3267
|
};
|
|
3252
3268
|
/**
|
|
3253
3269
|
* Run the `Micro` effect in a new `Handle` that can be awaited, joined, or
|
|
@@ -3259,7 +3275,7 @@ export declare const forkIn: {
|
|
|
3259
3275
|
* @experimental
|
|
3260
3276
|
* @category handle & forking
|
|
3261
3277
|
*/
|
|
3262
|
-
export declare const forkScoped: <A, E, R>(self: Micro<A, E, R>) => Micro<
|
|
3278
|
+
export declare const forkScoped: <A, E, R>(self: Micro<A, E, R>) => Micro<Fiber<A, E>, never, R | MicroScope>;
|
|
3263
3279
|
/**
|
|
3264
3280
|
* Execute the `Micro` effect and return a `Handle` that can be awaited, joined,
|
|
3265
3281
|
* or aborted.
|
|
@@ -3271,6 +3287,7 @@ export declare const forkScoped: <A, E, R>(self: Micro<A, E, R>) => Micro<Handle
|
|
|
3271
3287
|
* @experimental
|
|
3272
3288
|
* @category execution
|
|
3273
3289
|
* @example
|
|
3290
|
+
* ```ts
|
|
3274
3291
|
* import * as Micro from "effect/Micro"
|
|
3275
3292
|
*
|
|
3276
3293
|
* const handle = Micro.succeed(42).pipe(
|
|
@@ -3281,11 +3298,12 @@ export declare const forkScoped: <A, E, R>(self: Micro<A, E, R>) => Micro<Handle
|
|
|
3281
3298
|
* handle.addObserver((exit) => {
|
|
3282
3299
|
* console.log(exit)
|
|
3283
3300
|
* })
|
|
3301
|
+
* ```
|
|
3284
3302
|
*/
|
|
3285
3303
|
export declare const runFork: <A, E>(effect: Micro<A, E>, options?: {
|
|
3286
3304
|
readonly signal?: AbortSignal | undefined;
|
|
3287
3305
|
readonly scheduler?: MicroScheduler | undefined;
|
|
3288
|
-
} | undefined) =>
|
|
3306
|
+
} | undefined) => FiberImpl<A, E>;
|
|
3289
3307
|
/**
|
|
3290
3308
|
* Execute the `Micro` effect and return a `Promise` that resolves with the
|
|
3291
3309
|
* `MicroExit` of the computation.
|
|
@@ -3336,12 +3354,11 @@ export declare const runSync: <A, E>(effect: Micro<A, E>) => A;
|
|
|
3336
3354
|
* @category errors
|
|
3337
3355
|
*/
|
|
3338
3356
|
export interface YieldableError extends Pipeable, Inspectable, Readonly<Error> {
|
|
3339
|
-
readonly [EffectTypeId]: Effect.VarianceStruct<never, this, never>;
|
|
3340
|
-
readonly [StreamTypeId]: Stream.VarianceStruct<never, this, never>;
|
|
3341
|
-
readonly [SinkTypeId]: Sink.VarianceStruct<never, unknown, never, this, never>;
|
|
3342
|
-
readonly [ChannelTypeId]: Channel.VarianceStruct<never, unknown, this, unknown, never, unknown, never>;
|
|
3357
|
+
readonly [Effectable.EffectTypeId]: Effect.VarianceStruct<never, this, never>;
|
|
3358
|
+
readonly [Effectable.StreamTypeId]: Stream.VarianceStruct<never, this, never>;
|
|
3359
|
+
readonly [Effectable.SinkTypeId]: Sink.VarianceStruct<never, unknown, never, this, never>;
|
|
3360
|
+
readonly [Effectable.ChannelTypeId]: Channel.VarianceStruct<never, unknown, this, unknown, never, unknown, never>;
|
|
3343
3361
|
readonly [TypeId]: Micro.Variance<never, this, never>;
|
|
3344
|
-
readonly [runSymbol]: (env: Env<any>, onExit: (exit: MicroExit<never, this>) => void) => void;
|
|
3345
3362
|
[Symbol.iterator](): MicroIterator<Micro<never, this, never>>;
|
|
3346
3363
|
}
|
|
3347
3364
|
/**
|