effect 3.1.1 → 3.1.2
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 +10 -13
- package/dist/cjs/Array.js.map +1 -1
- package/dist/cjs/BigDecimal.js +14 -17
- package/dist/cjs/BigDecimal.js.map +1 -1
- package/dist/cjs/BigInt.js +41 -46
- package/dist/cjs/BigInt.js.map +1 -1
- package/dist/cjs/Boolean.js +13 -13
- package/dist/cjs/Brand.js +2 -2
- package/dist/cjs/Chunk.js +3 -3
- package/dist/cjs/Context.js +15 -20
- package/dist/cjs/Context.js.map +1 -1
- package/dist/cjs/Cron.js +3 -6
- package/dist/cjs/Cron.js.map +1 -1
- package/dist/cjs/Data.js +8 -13
- package/dist/cjs/Data.js.map +1 -1
- package/dist/cjs/Duration.js +1 -1
- package/dist/cjs/Effect.js +77 -9
- package/dist/cjs/Effect.js.map +1 -1
- package/dist/cjs/Either.js +117 -59
- package/dist/cjs/Either.js.map +1 -1
- package/dist/cjs/FiberHandle.js.map +1 -1
- package/dist/cjs/FiberMap.js.map +1 -1
- package/dist/cjs/FiberSet.js.map +1 -1
- package/dist/cjs/Function.js +2 -2
- package/dist/cjs/Function.js.map +1 -1
- package/dist/cjs/Iterable.js +10 -13
- package/dist/cjs/Iterable.js.map +1 -1
- package/dist/cjs/List.js +2 -2
- package/dist/cjs/Metric.js +5 -7
- package/dist/cjs/Metric.js.map +1 -1
- package/dist/cjs/Number.js +20 -21
- package/dist/cjs/Number.js.map +1 -1
- package/dist/cjs/Option.js +223 -164
- package/dist/cjs/Option.js.map +1 -1
- package/dist/cjs/Order.js +1 -2
- package/dist/cjs/Order.js.map +1 -1
- package/dist/cjs/Ordering.js +2 -2
- package/dist/cjs/Predicate.js +9 -12
- package/dist/cjs/Predicate.js.map +1 -1
- package/dist/cjs/Readable.js.map +1 -1
- package/dist/cjs/Record.js +35 -47
- package/dist/cjs/Record.js.map +1 -1
- package/dist/cjs/RegExp.js +1 -1
- package/dist/cjs/Request.js +2 -2
- package/dist/cjs/Request.js.map +1 -1
- package/dist/cjs/Stream.js +82 -4
- package/dist/cjs/Stream.js.map +1 -1
- package/dist/cjs/String.js +81 -111
- package/dist/cjs/String.js.map +1 -1
- package/dist/cjs/Struct.js +13 -19
- package/dist/cjs/Struct.js.map +1 -1
- package/dist/cjs/Subscribable.js.map +1 -1
- package/dist/cjs/Symbol.js +3 -3
- package/dist/cjs/TestAnnotation.js.map +1 -1
- package/dist/cjs/TestAnnotationMap.js.map +1 -1
- package/dist/cjs/TestAnnotations.js.map +1 -1
- package/dist/cjs/TestClock.js.map +1 -1
- package/dist/cjs/TestLive.js.map +1 -1
- package/dist/cjs/TestSized.js.map +1 -1
- package/dist/cjs/Trie.js +28 -44
- package/dist/cjs/Trie.js.map +1 -1
- package/dist/cjs/Utils.js.map +1 -1
- package/dist/cjs/internal/core-effect.js +4 -11
- package/dist/cjs/internal/core-effect.js.map +1 -1
- package/dist/cjs/internal/doNotation.js +23 -0
- package/dist/cjs/internal/doNotation.js.map +1 -0
- package/dist/cjs/internal/groupBy.js.map +1 -1
- package/dist/cjs/internal/stream.js +3 -7
- package/dist/cjs/internal/stream.js.map +1 -1
- package/dist/cjs/internal/version.js +1 -1
- package/dist/dts/Array.d.ts +10 -13
- package/dist/dts/Array.d.ts.map +1 -1
- package/dist/dts/BigDecimal.d.ts +14 -17
- package/dist/dts/BigDecimal.d.ts.map +1 -1
- package/dist/dts/BigInt.d.ts +41 -46
- package/dist/dts/BigInt.d.ts.map +1 -1
- package/dist/dts/Boolean.d.ts +13 -13
- package/dist/dts/Brand.d.ts +3 -3
- package/dist/dts/Chunk.d.ts +3 -3
- package/dist/dts/Context.d.ts +15 -20
- package/dist/dts/Context.d.ts.map +1 -1
- package/dist/dts/Cron.d.ts +3 -6
- package/dist/dts/Cron.d.ts.map +1 -1
- package/dist/dts/Data.d.ts +10 -16
- package/dist/dts/Data.d.ts.map +1 -1
- package/dist/dts/Duration.d.ts +1 -1
- package/dist/dts/Effect.d.ts +120 -26
- package/dist/dts/Effect.d.ts.map +1 -1
- package/dist/dts/Either.d.ts +155 -64
- package/dist/dts/Either.d.ts.map +1 -1
- package/dist/dts/FiberHandle.d.ts.map +1 -1
- package/dist/dts/FiberMap.d.ts.map +1 -1
- package/dist/dts/FiberSet.d.ts.map +1 -1
- package/dist/dts/Function.d.ts +4 -2
- package/dist/dts/Function.d.ts.map +1 -1
- package/dist/dts/HashMap.d.ts +2 -2
- package/dist/dts/Iterable.d.ts +10 -13
- package/dist/dts/Iterable.d.ts.map +1 -1
- package/dist/dts/List.d.ts +2 -2
- package/dist/dts/Metric.d.ts +5 -7
- package/dist/dts/Metric.d.ts.map +1 -1
- package/dist/dts/Number.d.ts +20 -21
- package/dist/dts/Number.d.ts.map +1 -1
- package/dist/dts/Option.d.ts +245 -155
- package/dist/dts/Option.d.ts.map +1 -1
- package/dist/dts/Order.d.ts +1 -2
- package/dist/dts/Order.d.ts.map +1 -1
- package/dist/dts/Ordering.d.ts +2 -2
- package/dist/dts/Predicate.d.ts +9 -12
- package/dist/dts/Predicate.d.ts.map +1 -1
- package/dist/dts/Readable.d.ts.map +1 -1
- package/dist/dts/Record.d.ts +35 -47
- package/dist/dts/Record.d.ts.map +1 -1
- package/dist/dts/RegExp.d.ts +1 -1
- package/dist/dts/Request.d.ts +2 -2
- package/dist/dts/Request.d.ts.map +1 -1
- package/dist/dts/Stream.d.ts +136 -31
- package/dist/dts/Stream.d.ts.map +1 -1
- package/dist/dts/String.d.ts +81 -111
- package/dist/dts/String.d.ts.map +1 -1
- package/dist/dts/Struct.d.ts +13 -19
- package/dist/dts/Struct.d.ts.map +1 -1
- package/dist/dts/Subscribable.d.ts.map +1 -1
- package/dist/dts/Symbol.d.ts +3 -3
- package/dist/dts/TestAnnotation.d.ts.map +1 -1
- package/dist/dts/TestAnnotationMap.d.ts.map +1 -1
- package/dist/dts/TestAnnotations.d.ts.map +1 -1
- package/dist/dts/TestClock.d.ts +1 -5
- package/dist/dts/TestClock.d.ts.map +1 -1
- package/dist/dts/TestLive.d.ts.map +1 -1
- package/dist/dts/TestSized.d.ts.map +1 -1
- package/dist/dts/Trie.d.ts +28 -44
- package/dist/dts/Trie.d.ts.map +1 -1
- package/dist/dts/Types.d.ts +10 -10
- package/dist/dts/Utils.d.ts.map +1 -1
- package/dist/dts/internal/doNotation.d.ts +2 -0
- package/dist/dts/internal/doNotation.d.ts.map +1 -0
- package/dist/dts/internal/stream.d.ts.map +1 -1
- package/dist/esm/Array.js +10 -13
- package/dist/esm/Array.js.map +1 -1
- package/dist/esm/BigDecimal.js +14 -17
- package/dist/esm/BigDecimal.js.map +1 -1
- package/dist/esm/BigInt.js +41 -46
- package/dist/esm/BigInt.js.map +1 -1
- package/dist/esm/Boolean.js +13 -13
- package/dist/esm/Brand.js +2 -2
- package/dist/esm/Chunk.js +3 -3
- package/dist/esm/Context.js +15 -20
- package/dist/esm/Context.js.map +1 -1
- package/dist/esm/Cron.js +3 -6
- package/dist/esm/Cron.js.map +1 -1
- package/dist/esm/Data.js +9 -15
- package/dist/esm/Data.js.map +1 -1
- package/dist/esm/Duration.js +1 -1
- package/dist/esm/Effect.js +101 -11
- package/dist/esm/Effect.js.map +1 -1
- package/dist/esm/Either.js +141 -61
- package/dist/esm/Either.js.map +1 -1
- package/dist/esm/FiberHandle.js.map +1 -1
- package/dist/esm/FiberMap.js.map +1 -1
- package/dist/esm/FiberSet.js.map +1 -1
- package/dist/esm/Function.js +2 -2
- package/dist/esm/Function.js.map +1 -1
- package/dist/esm/Iterable.js +10 -13
- package/dist/esm/Iterable.js.map +1 -1
- package/dist/esm/List.js +2 -2
- package/dist/esm/Metric.js +5 -7
- package/dist/esm/Metric.js.map +1 -1
- package/dist/esm/Number.js +20 -21
- package/dist/esm/Number.js.map +1 -1
- package/dist/esm/Option.js +249 -164
- package/dist/esm/Option.js.map +1 -1
- package/dist/esm/Order.js +1 -2
- package/dist/esm/Order.js.map +1 -1
- package/dist/esm/Ordering.js +2 -2
- package/dist/esm/Predicate.js +9 -12
- package/dist/esm/Predicate.js.map +1 -1
- package/dist/esm/Readable.js.map +1 -1
- package/dist/esm/Record.js +35 -47
- package/dist/esm/Record.js.map +1 -1
- package/dist/esm/RegExp.js +1 -1
- package/dist/esm/Request.js +2 -2
- package/dist/esm/Request.js.map +1 -1
- package/dist/esm/Stream.js +107 -6
- package/dist/esm/Stream.js.map +1 -1
- package/dist/esm/String.js +81 -111
- package/dist/esm/String.js.map +1 -1
- package/dist/esm/Struct.js +13 -19
- package/dist/esm/Struct.js.map +1 -1
- package/dist/esm/Subscribable.js.map +1 -1
- package/dist/esm/Symbol.js +3 -3
- package/dist/esm/TestAnnotation.js.map +1 -1
- package/dist/esm/TestAnnotationMap.js.map +1 -1
- package/dist/esm/TestAnnotations.js.map +1 -1
- package/dist/esm/TestClock.js.map +1 -1
- package/dist/esm/TestLive.js.map +1 -1
- package/dist/esm/TestSized.js.map +1 -1
- package/dist/esm/Trie.js +28 -44
- package/dist/esm/Trie.js.map +1 -1
- package/dist/esm/Utils.js.map +1 -1
- package/dist/esm/internal/core-effect.js +4 -11
- package/dist/esm/internal/core-effect.js.map +1 -1
- package/dist/esm/internal/doNotation.js +14 -0
- package/dist/esm/internal/doNotation.js.map +1 -0
- package/dist/esm/internal/groupBy.js.map +1 -1
- package/dist/esm/internal/stream.js +3 -7
- package/dist/esm/internal/stream.js.map +1 -1
- package/dist/esm/internal/version.js +1 -1
- package/package.json +1 -1
- package/src/Array.ts +10 -13
- package/src/BigDecimal.ts +14 -17
- package/src/BigInt.ts +41 -46
- package/src/Boolean.ts +13 -13
- package/src/Brand.ts +3 -3
- package/src/Chunk.ts +3 -3
- package/src/Context.ts +15 -20
- package/src/Cron.ts +3 -6
- package/src/Data.ts +10 -16
- package/src/Duration.ts +1 -1
- package/src/Effect.ts +122 -32
- package/src/Either.ts +161 -94
- package/src/FiberHandle.ts +1 -1
- package/src/FiberMap.ts +1 -1
- package/src/FiberSet.ts +1 -1
- package/src/Function.ts +4 -2
- package/src/HashMap.ts +2 -2
- package/src/Iterable.ts +10 -13
- package/src/List.ts +2 -2
- package/src/Metric.ts +5 -7
- package/src/Number.ts +20 -21
- package/src/Option.ts +250 -172
- package/src/Order.ts +1 -2
- package/src/Ordering.ts +2 -2
- package/src/Predicate.ts +9 -12
- package/src/Readable.ts +1 -1
- package/src/Record.ts +35 -47
- package/src/RegExp.ts +1 -1
- package/src/Request.ts +3 -3
- package/src/Stream.ts +137 -36
- package/src/String.ts +81 -111
- package/src/Struct.ts +13 -19
- package/src/Subscribable.ts +1 -1
- package/src/Symbol.ts +3 -3
- package/src/TestAnnotation.ts +1 -1
- package/src/TestAnnotationMap.ts +1 -1
- package/src/TestAnnotations.ts +1 -1
- package/src/TestClock.ts +1 -5
- package/src/TestLive.ts +1 -1
- package/src/TestSized.ts +1 -1
- package/src/Trie.ts +28 -44
- package/src/Types.ts +10 -10
- package/src/Utils.ts +2 -2
- package/src/internal/core-effect.ts +29 -45
- package/src/internal/doNotation.ts +77 -0
- package/src/internal/groupBy.ts +16 -16
- package/src/internal/stream.ts +34 -58
- package/src/internal/version.ts +1 -1
package/src/Either.ts
CHANGED
|
@@ -7,12 +7,13 @@ import type { LazyArg } from "./Function.js"
|
|
|
7
7
|
import { constNull, constUndefined, dual, identity } from "./Function.js"
|
|
8
8
|
import type { TypeLambda } from "./HKT.js"
|
|
9
9
|
import type { Inspectable } from "./Inspectable.js"
|
|
10
|
+
import * as doNotation from "./internal/doNotation.js"
|
|
10
11
|
import * as either from "./internal/either.js"
|
|
11
12
|
import type { Option } from "./Option.js"
|
|
12
13
|
import type { Pipeable } from "./Pipeable.js"
|
|
13
14
|
import type { Predicate, Refinement } from "./Predicate.js"
|
|
14
15
|
import { isFunction } from "./Predicate.js"
|
|
15
|
-
import type { Covariant,
|
|
16
|
+
import type { Covariant, NoInfer, NotFunction } from "./Types.js"
|
|
16
17
|
import type * as Unify from "./Unify.js"
|
|
17
18
|
import * as Gen from "./Utils.js"
|
|
18
19
|
|
|
@@ -129,7 +130,7 @@ export const left: <L>(left: L) => Either<never, L> = either.left
|
|
|
129
130
|
* the provided default as a `Left`.
|
|
130
131
|
*
|
|
131
132
|
* @example
|
|
132
|
-
* import
|
|
133
|
+
* import { Either } from "effect"
|
|
133
134
|
*
|
|
134
135
|
* assert.deepStrictEqual(Either.fromNullable(1, () => 'fallback'), Either.right(1))
|
|
135
136
|
* assert.deepStrictEqual(Either.fromNullable(null, () => 'fallback'), Either.left('fallback'))
|
|
@@ -148,8 +149,7 @@ export const fromNullable: {
|
|
|
148
149
|
|
|
149
150
|
/**
|
|
150
151
|
* @example
|
|
151
|
-
* import
|
|
152
|
-
* import * as Option from 'effect/Option'
|
|
152
|
+
* import { Either, Option } from "effect"
|
|
153
153
|
*
|
|
154
154
|
* assert.deepStrictEqual(Either.fromOption(Option.some(1), () => 'error'), Either.right(1))
|
|
155
155
|
* assert.deepStrictEqual(Either.fromOption(Option.none(), () => 'error'), Either.left('error'))
|
|
@@ -208,11 +208,11 @@ export {
|
|
|
208
208
|
* @param input - The value to test.
|
|
209
209
|
*
|
|
210
210
|
* @example
|
|
211
|
-
* import {
|
|
211
|
+
* import { Either } from "effect"
|
|
212
212
|
*
|
|
213
|
-
* assert.deepStrictEqual(isEither(right(1)), true)
|
|
214
|
-
* assert.deepStrictEqual(isEither(left("a")), true)
|
|
215
|
-
* assert.deepStrictEqual(isEither({ right: 1 }), false)
|
|
213
|
+
* assert.deepStrictEqual(Either.isEither(Either.right(1)), true)
|
|
214
|
+
* assert.deepStrictEqual(Either.isEither(Either.left("a")), true)
|
|
215
|
+
* assert.deepStrictEqual(Either.isEither({ right: 1 }), false)
|
|
216
216
|
*
|
|
217
217
|
* @category guards
|
|
218
218
|
* @since 2.0.0
|
|
@@ -225,10 +225,10 @@ export const isEither: (input: unknown) => input is Either<unknown, unknown> = e
|
|
|
225
225
|
* @param self - The `Either` to check.
|
|
226
226
|
*
|
|
227
227
|
* @example
|
|
228
|
-
* import {
|
|
228
|
+
* import { Either } from "effect"
|
|
229
229
|
*
|
|
230
|
-
* assert.deepStrictEqual(isLeft(right(1)), false)
|
|
231
|
-
* assert.deepStrictEqual(isLeft(left("a")), true)
|
|
230
|
+
* assert.deepStrictEqual(Either.isLeft(Either.right(1)), false)
|
|
231
|
+
* assert.deepStrictEqual(Either.isLeft(Either.left("a")), true)
|
|
232
232
|
*
|
|
233
233
|
* @category guards
|
|
234
234
|
* @since 2.0.0
|
|
@@ -241,10 +241,10 @@ export const isLeft: <R, L>(self: Either<R, L>) => self is Left<L, R> = either.i
|
|
|
241
241
|
* @param self - The `Either` to check.
|
|
242
242
|
*
|
|
243
243
|
* @example
|
|
244
|
-
* import {
|
|
244
|
+
* import { Either } from "effect"
|
|
245
245
|
*
|
|
246
|
-
* assert.deepStrictEqual(isRight(right(1)), true)
|
|
247
|
-
* assert.deepStrictEqual(isRight(left("a")), false)
|
|
246
|
+
* assert.deepStrictEqual(Either.isRight(Either.right(1)), true)
|
|
247
|
+
* assert.deepStrictEqual(Either.isRight(Either.left("a")), false)
|
|
248
248
|
*
|
|
249
249
|
* @category guards
|
|
250
250
|
* @since 2.0.0
|
|
@@ -257,11 +257,10 @@ export const isRight: <R, L>(self: Either<R, L>) => self is Right<L, R> = either
|
|
|
257
257
|
* Alias of {@link toOption}.
|
|
258
258
|
*
|
|
259
259
|
* @example
|
|
260
|
-
* import
|
|
261
|
-
* import * as E from 'effect/Either'
|
|
260
|
+
* import { Either, Option } from "effect"
|
|
262
261
|
*
|
|
263
|
-
* assert.deepStrictEqual(
|
|
264
|
-
* assert.deepStrictEqual(
|
|
262
|
+
* assert.deepStrictEqual(Either.getRight(Either.right('ok')), Option.some('ok'))
|
|
263
|
+
* assert.deepStrictEqual(Either.getRight(Either.left('err')), Option.none())
|
|
265
264
|
*
|
|
266
265
|
* @category getters
|
|
267
266
|
* @since 2.0.0
|
|
@@ -272,11 +271,10 @@ export const getRight: <R, L>(self: Either<R, L>) => Option<R> = either.getRight
|
|
|
272
271
|
* Converts a `Either` to an `Option` discarding the value.
|
|
273
272
|
*
|
|
274
273
|
* @example
|
|
275
|
-
* import
|
|
276
|
-
* import * as E from 'effect/Either'
|
|
274
|
+
* import { Either, Option } from "effect"
|
|
277
275
|
*
|
|
278
|
-
* assert.deepStrictEqual(
|
|
279
|
-
* assert.deepStrictEqual(
|
|
276
|
+
* assert.deepStrictEqual(Either.getLeft(Either.right('ok')), Option.none())
|
|
277
|
+
* assert.deepStrictEqual(Either.getLeft(Either.left('err')), Option.some('err'))
|
|
280
278
|
*
|
|
281
279
|
* @category getters
|
|
282
280
|
* @since 2.0.0
|
|
@@ -360,16 +358,15 @@ export const map: {
|
|
|
360
358
|
* if the value is a `Right` the inner value is applied to the `onRight` function.
|
|
361
359
|
*
|
|
362
360
|
* @example
|
|
363
|
-
* import
|
|
364
|
-
* import { pipe } from 'effect/Function'
|
|
361
|
+
* import { pipe, Either } from "effect"
|
|
365
362
|
*
|
|
366
363
|
* const onLeft = (strings: ReadonlyArray<string>): string => `strings: ${strings.join(', ')}`
|
|
367
364
|
*
|
|
368
365
|
* const onRight = (value: number): string => `Ok: ${value}`
|
|
369
366
|
*
|
|
370
|
-
* assert.deepStrictEqual(pipe(
|
|
367
|
+
* assert.deepStrictEqual(pipe(Either.right(1), Either.match({ onLeft, onRight })), 'Ok: 1')
|
|
371
368
|
* assert.deepStrictEqual(
|
|
372
|
-
* pipe(
|
|
369
|
+
* pipe(Either.left(['string 1', 'string 2']), Either.match({ onLeft, onRight })),
|
|
373
370
|
* 'strings: string 1, string 2'
|
|
374
371
|
* )
|
|
375
372
|
*
|
|
@@ -398,24 +395,23 @@ export const match: {
|
|
|
398
395
|
* If the predicate fails, set the left value with the result of the provided function.
|
|
399
396
|
*
|
|
400
397
|
* @example
|
|
401
|
-
* import
|
|
402
|
-
* import { pipe } from 'effect/Function'
|
|
398
|
+
* import { pipe, Either } from "effect"
|
|
403
399
|
*
|
|
404
400
|
* const isPositive = (n: number): boolean => n > 0
|
|
405
401
|
*
|
|
406
402
|
* assert.deepStrictEqual(
|
|
407
403
|
* pipe(
|
|
408
|
-
*
|
|
409
|
-
*
|
|
404
|
+
* Either.right(1),
|
|
405
|
+
* Either.filterOrLeft(isPositive, n => `${n} is not positive`)
|
|
410
406
|
* ),
|
|
411
|
-
*
|
|
407
|
+
* Either.right(1)
|
|
412
408
|
* )
|
|
413
409
|
* assert.deepStrictEqual(
|
|
414
410
|
* pipe(
|
|
415
|
-
*
|
|
416
|
-
*
|
|
411
|
+
* Either.right(0),
|
|
412
|
+
* Either.filterOrLeft(isPositive, n => `${n} is not positive`)
|
|
417
413
|
* ),
|
|
418
|
-
*
|
|
414
|
+
* Either.left("0 is not positive")
|
|
419
415
|
* )
|
|
420
416
|
*
|
|
421
417
|
* @since 2.0.0
|
|
@@ -455,7 +451,7 @@ export const merge: <R, L>(self: Either<R, L>) => L | R = match({
|
|
|
455
451
|
* Returns the wrapped value if it's a `Right` or a default value if is a `Left`.
|
|
456
452
|
*
|
|
457
453
|
* @example
|
|
458
|
-
* import
|
|
454
|
+
* import { Either } from "effect"
|
|
459
455
|
*
|
|
460
456
|
* assert.deepStrictEqual(Either.getOrElse(Either.right(1), (error) => error + "!"), 1)
|
|
461
457
|
* assert.deepStrictEqual(Either.getOrElse(Either.left("not a number"), (error) => error + "!"), "not a number!")
|
|
@@ -473,7 +469,7 @@ export const getOrElse: {
|
|
|
473
469
|
|
|
474
470
|
/**
|
|
475
471
|
* @example
|
|
476
|
-
* import
|
|
472
|
+
* import { Either } from "effect"
|
|
477
473
|
*
|
|
478
474
|
* assert.deepStrictEqual(Either.getOrNull(Either.right(1)), 1)
|
|
479
475
|
* assert.deepStrictEqual(Either.getOrNull(Either.left("a")), null)
|
|
@@ -485,7 +481,7 @@ export const getOrNull: <R, L>(self: Either<R, L>) => R | null = getOrElse(const
|
|
|
485
481
|
|
|
486
482
|
/**
|
|
487
483
|
* @example
|
|
488
|
-
* import
|
|
484
|
+
* import { Either } from "effect"
|
|
489
485
|
*
|
|
490
486
|
* assert.deepStrictEqual(Either.getOrUndefined(Either.right(1)), 1)
|
|
491
487
|
* assert.deepStrictEqual(Either.getOrUndefined(Either.left("a")), undefined)
|
|
@@ -504,13 +500,13 @@ export const getOrUndefined: <R, L>(self: Either<R, L>) => R | undefined = getOr
|
|
|
504
500
|
* @param onLeft - A function that will be called if the `Either` is `Left`. It returns the error to be thrown.
|
|
505
501
|
*
|
|
506
502
|
* @example
|
|
507
|
-
* import
|
|
503
|
+
* import { Either } from "effect"
|
|
508
504
|
*
|
|
509
505
|
* assert.deepStrictEqual(
|
|
510
|
-
*
|
|
506
|
+
* Either.getOrThrowWith(Either.right(1), () => new Error('Unexpected Left')),
|
|
511
507
|
* 1
|
|
512
508
|
* )
|
|
513
|
-
* assert.throws(() =>
|
|
509
|
+
* assert.throws(() => Either.getOrThrowWith(Either.left("error"), () => new Error('Unexpected Left')))
|
|
514
510
|
*
|
|
515
511
|
* @category getters
|
|
516
512
|
* @since 2.0.0
|
|
@@ -534,10 +530,10 @@ export const getOrThrowWith: {
|
|
|
534
530
|
* @throws `Error("getOrThrow called on a Left")`
|
|
535
531
|
*
|
|
536
532
|
* @example
|
|
537
|
-
* import
|
|
533
|
+
* import { Either } from "effect"
|
|
538
534
|
*
|
|
539
|
-
* assert.deepStrictEqual(
|
|
540
|
-
* assert.throws(() =>
|
|
535
|
+
* assert.deepStrictEqual(Either.getOrThrow(Either.right(1)), 1)
|
|
536
|
+
* assert.throws(() => Either.getOrThrow(Either.left("error")))
|
|
541
537
|
*
|
|
542
538
|
* @category getters
|
|
543
539
|
* @since 2.0.0
|
|
@@ -644,7 +640,7 @@ export const ap: {
|
|
|
644
640
|
* @param fields - the struct of `Either`s to be sequenced.
|
|
645
641
|
*
|
|
646
642
|
* @example
|
|
647
|
-
* import
|
|
643
|
+
* import { Either } from "effect"
|
|
648
644
|
*
|
|
649
645
|
* assert.deepStrictEqual(Either.all([Either.right(1), Either.right(2)]), Either.right([1, 2]))
|
|
650
646
|
* assert.deepStrictEqual(Either.all({ right: Either.right(1), b: Either.right("hello") }), Either.right({ right: 1, b: "hello" }))
|
|
@@ -742,77 +738,148 @@ export const gen: Gen.Gen<EitherTypeLambda, Gen.Adapter<EitherTypeLambda>> = (f)
|
|
|
742
738
|
// -------------------------------------------------------------------------------------
|
|
743
739
|
|
|
744
740
|
/**
|
|
745
|
-
*
|
|
741
|
+
* The "do simulation" in allows you to write code in a more declarative style, similar to the "do notation" in other programming languages. It provides a way to define variables and perform operations on them using functions like `bind` and `let`.
|
|
742
|
+
*
|
|
743
|
+
* Here's how the do simulation works:
|
|
744
|
+
*
|
|
745
|
+
* 1. Start the do simulation using the `Do` value
|
|
746
|
+
* 2. Within the do simulation scope, you can use the `bind` function to define variables and bind them to `Either` values
|
|
747
|
+
* 3. You can accumulate multiple `bind` statements to define multiple variables within the scope
|
|
748
|
+
* 4. Inside the do simulation scope, you can also use the `let` function to define variables and bind them to simple values
|
|
749
|
+
*
|
|
750
|
+
* @see {@link bind}
|
|
751
|
+
* @see {@link bindTo}
|
|
752
|
+
* @see {@link let_ let}
|
|
753
|
+
*
|
|
754
|
+
* @example
|
|
755
|
+
* import { Either, pipe } from "effect"
|
|
756
|
+
*
|
|
757
|
+
* const result = pipe(
|
|
758
|
+
* Either.Do,
|
|
759
|
+
* Either.bind("x", () => Either.right(2)),
|
|
760
|
+
* Either.bind("y", () => Either.right(3)),
|
|
761
|
+
* Either.let("sum", ({ x, y }) => x + y)
|
|
762
|
+
* )
|
|
763
|
+
* assert.deepStrictEqual(result, Either.right({ x: 2, y: 3, sum: 5 }))
|
|
764
|
+
*
|
|
746
765
|
* @category do notation
|
|
766
|
+
* @since 2.0.0
|
|
747
767
|
*/
|
|
748
768
|
export const Do: Either<{}> = right({})
|
|
749
769
|
|
|
750
770
|
/**
|
|
751
|
-
*
|
|
771
|
+
* The "do simulation" in allows you to write code in a more declarative style, similar to the "do notation" in other programming languages. It provides a way to define variables and perform operations on them using functions like `bind` and `let`.
|
|
772
|
+
*
|
|
773
|
+
* Here's how the do simulation works:
|
|
774
|
+
*
|
|
775
|
+
* 1. Start the do simulation using the `Do` value
|
|
776
|
+
* 2. Within the do simulation scope, you can use the `bind` function to define variables and bind them to `Either` values
|
|
777
|
+
* 3. You can accumulate multiple `bind` statements to define multiple variables within the scope
|
|
778
|
+
* 4. Inside the do simulation scope, you can also use the `let` function to define variables and bind them to simple values
|
|
779
|
+
*
|
|
780
|
+
* @see {@link Do}
|
|
781
|
+
* @see {@link bindTo}
|
|
782
|
+
* @see {@link let_ let}
|
|
783
|
+
*
|
|
784
|
+
* @example
|
|
785
|
+
* import { Either, pipe } from "effect"
|
|
786
|
+
*
|
|
787
|
+
* const result = pipe(
|
|
788
|
+
* Either.Do,
|
|
789
|
+
* Either.bind("x", () => Either.right(2)),
|
|
790
|
+
* Either.bind("y", () => Either.right(3)),
|
|
791
|
+
* Either.let("sum", ({ x, y }) => x + y)
|
|
792
|
+
* )
|
|
793
|
+
* assert.deepStrictEqual(result, Either.right({ x: 2, y: 3, sum: 5 }))
|
|
752
794
|
*
|
|
753
|
-
* @since 2.4.0
|
|
754
795
|
* @category do notation
|
|
796
|
+
* @since 2.0.0
|
|
755
797
|
*/
|
|
756
798
|
export const bind: {
|
|
757
|
-
<N extends string,
|
|
758
|
-
|
|
759
|
-
f: (
|
|
760
|
-
): <
|
|
761
|
-
<
|
|
762
|
-
self: Either<
|
|
763
|
-
|
|
764
|
-
f: (
|
|
765
|
-
): Either<
|
|
766
|
-
} =
|
|
767
|
-
self: Either<K, E>,
|
|
768
|
-
tag: Exclude<N, keyof K>,
|
|
769
|
-
f: (_: K) => Either<A, E2>
|
|
770
|
-
): Either<MergeRecord<K, { [k in N]: A }>, E2 | E> =>
|
|
771
|
-
flatMap(self, (k) =>
|
|
772
|
-
map(
|
|
773
|
-
f(k),
|
|
774
|
-
(a): MergeRecord<K, { [k in N]: A }> => ({ ...k, [tag]: a } as any)
|
|
775
|
-
)))
|
|
799
|
+
<N extends string, A extends object, B, L2>(
|
|
800
|
+
name: Exclude<N, keyof A>,
|
|
801
|
+
f: (a: A) => Either<B, L2>
|
|
802
|
+
): <L1>(self: Either<A, L1>) => Either<{ [K in N | keyof A]: K extends keyof A ? A[K] : B }, L1 | L2>
|
|
803
|
+
<A extends object, L1, N extends string, B, L2>(
|
|
804
|
+
self: Either<A, L1>,
|
|
805
|
+
name: Exclude<N, keyof A>,
|
|
806
|
+
f: (a: A) => Either<B, L2>
|
|
807
|
+
): Either<{ [K in N | keyof A]: K extends keyof A ? A[K] : B }, L1 | L2>
|
|
808
|
+
} = doNotation.bind<EitherTypeLambda>(map, flatMap)
|
|
776
809
|
|
|
777
810
|
/**
|
|
811
|
+
* The "do simulation" in allows you to write code in a more declarative style, similar to the "do notation" in other programming languages. It provides a way to define variables and perform operations on them using functions like `bind` and `let`.
|
|
812
|
+
*
|
|
813
|
+
* Here's how the do simulation works:
|
|
814
|
+
*
|
|
815
|
+
* 1. Start the do simulation using the `Do` value
|
|
816
|
+
* 2. Within the do simulation scope, you can use the `bind` function to define variables and bind them to `Either` values
|
|
817
|
+
* 3. You can accumulate multiple `bind` statements to define multiple variables within the scope
|
|
818
|
+
* 4. Inside the do simulation scope, you can also use the `let` function to define variables and bind them to simple values
|
|
819
|
+
*
|
|
820
|
+
* @see {@link Do}
|
|
821
|
+
* @see {@link bind}
|
|
822
|
+
* @see {@link let_ let}
|
|
823
|
+
*
|
|
824
|
+
* @example
|
|
825
|
+
* import { Either, pipe } from "effect"
|
|
826
|
+
*
|
|
827
|
+
* const result = pipe(
|
|
828
|
+
* Either.Do,
|
|
829
|
+
* Either.bind("x", () => Either.right(2)),
|
|
830
|
+
* Either.bind("y", () => Either.right(3)),
|
|
831
|
+
* Either.let("sum", ({ x, y }) => x + y)
|
|
832
|
+
* )
|
|
833
|
+
* assert.deepStrictEqual(result, Either.right({ x: 2, y: 3, sum: 5 }))
|
|
834
|
+
*
|
|
778
835
|
* @category do notation
|
|
779
|
-
* @since 2.
|
|
836
|
+
* @since 2.0.0
|
|
780
837
|
*/
|
|
781
838
|
export const bindTo: {
|
|
782
|
-
<N extends string>(
|
|
783
|
-
<
|
|
784
|
-
} =
|
|
785
|
-
2,
|
|
786
|
-
<A, E, N extends string>(self: Either<A, E>, tag: N): Either<Record<N, A>, E> =>
|
|
787
|
-
map(self, (a) => ({ [tag]: a } as Record<N, A>))
|
|
788
|
-
)
|
|
839
|
+
<N extends string>(name: N): <R, L>(self: Either<R, L>) => Either<{ [K in N]: R }, L>
|
|
840
|
+
<R, L, N extends string>(self: Either<R, L>, name: N): Either<{ [K in N]: R }, L>
|
|
841
|
+
} = doNotation.bindTo<EitherTypeLambda>(map)
|
|
789
842
|
|
|
790
843
|
const let_: {
|
|
791
|
-
<N extends string,
|
|
792
|
-
|
|
793
|
-
f: (
|
|
794
|
-
): <
|
|
795
|
-
<
|
|
796
|
-
self: Either<
|
|
797
|
-
|
|
798
|
-
f: (
|
|
799
|
-
): Either<
|
|
800
|
-
} =
|
|
801
|
-
self: Either<K, E>,
|
|
802
|
-
tag: Exclude<N, keyof K>,
|
|
803
|
-
f: (_: K) => A
|
|
804
|
-
): Either<MergeRecord<K, { [k in N]: A }>, E> =>
|
|
805
|
-
map(
|
|
806
|
-
self,
|
|
807
|
-
(k): MergeRecord<K, { [k in N]: A }> => ({ ...k, [tag]: f(k) } as any)
|
|
808
|
-
))
|
|
844
|
+
<N extends string, R extends object, B>(
|
|
845
|
+
name: Exclude<N, keyof R>,
|
|
846
|
+
f: (r: R) => B
|
|
847
|
+
): <L>(self: Either<R, L>) => Either<{ [K in N | keyof R]: K extends keyof R ? R[K] : B }, L>
|
|
848
|
+
<R extends object, L, N extends string, B>(
|
|
849
|
+
self: Either<R, L>,
|
|
850
|
+
name: Exclude<N, keyof R>,
|
|
851
|
+
f: (r: R) => B
|
|
852
|
+
): Either<{ [K in N | keyof R]: K extends keyof R ? R[K] : B }, L>
|
|
853
|
+
} = doNotation.let_<EitherTypeLambda>(map)
|
|
809
854
|
|
|
810
855
|
export {
|
|
811
856
|
/**
|
|
812
|
-
*
|
|
857
|
+
* The "do simulation" in allows you to write code in a more declarative style, similar to the "do notation" in other programming languages. It provides a way to define variables and perform operations on them using functions like `bind` and `let`.
|
|
858
|
+
*
|
|
859
|
+
* Here's how the do simulation works:
|
|
860
|
+
*
|
|
861
|
+
* 1. Start the do simulation using the `Do` value
|
|
862
|
+
* 2. Within the do simulation scope, you can use the `bind` function to define variables and bind them to `Either` values
|
|
863
|
+
* 3. You can accumulate multiple `bind` statements to define multiple variables within the scope
|
|
864
|
+
* 4. Inside the do simulation scope, you can also use the `let` function to define variables and bind them to simple values
|
|
865
|
+
*
|
|
866
|
+
* @see {@link Do}
|
|
867
|
+
* @see {@link bindTo}
|
|
868
|
+
* @see {@link bind}
|
|
869
|
+
*
|
|
870
|
+
* @example
|
|
871
|
+
* import { Either, pipe } from "effect"
|
|
872
|
+
*
|
|
873
|
+
* const result = pipe(
|
|
874
|
+
* Either.Do,
|
|
875
|
+
* Either.bind("x", () => Either.right(2)),
|
|
876
|
+
* Either.bind("y", () => Either.right(3)),
|
|
877
|
+
* Either.let("sum", ({ x, y }) => x + y)
|
|
878
|
+
* )
|
|
879
|
+
* assert.deepStrictEqual(result, Either.right({ x: 2, y: 3, sum: 5 }))
|
|
813
880
|
*
|
|
814
|
-
* @since 2.4.0
|
|
815
881
|
* @category do notation
|
|
882
|
+
* @since 2.0.0
|
|
816
883
|
*/
|
|
817
884
|
let_ as let
|
|
818
885
|
}
|
package/src/FiberHandle.ts
CHANGED
package/src/FiberMap.ts
CHANGED
package/src/FiberSet.ts
CHANGED
package/src/Function.ts
CHANGED
|
@@ -17,7 +17,7 @@ export interface FunctionTypeLambda extends TypeLambda {
|
|
|
17
17
|
* @param input - The value to test.
|
|
18
18
|
*
|
|
19
19
|
* @example
|
|
20
|
-
* import { isFunction } from
|
|
20
|
+
* import { isFunction } from "effect/Predicate"
|
|
21
21
|
*
|
|
22
22
|
* assert.deepStrictEqual(isFunction(isFunction), true)
|
|
23
23
|
* assert.deepStrictEqual(isFunction("function"), false)
|
|
@@ -154,7 +154,7 @@ export const dual: {
|
|
|
154
154
|
*
|
|
155
155
|
* @example
|
|
156
156
|
* import { pipe, apply } from "effect/Function"
|
|
157
|
-
* import { length } from
|
|
157
|
+
* import { length } from "effect/String"
|
|
158
158
|
*
|
|
159
159
|
* assert.deepStrictEqual(pipe(length, apply("hello")), 5)
|
|
160
160
|
*
|
|
@@ -408,6 +408,8 @@ export const untupled = <A extends ReadonlyArray<unknown>, B>(f: (a: A) => B): (
|
|
|
408
408
|
*
|
|
409
409
|
* @example
|
|
410
410
|
* import { pipe } from "effect/Function"
|
|
411
|
+
* // Alternatively, you can use the following import syntax, as `pipe` is also conveniently exported from the `effect` entry point:
|
|
412
|
+
* // import { pipe } from "effect"
|
|
411
413
|
*
|
|
412
414
|
* const length = (s: string): number => s.length
|
|
413
415
|
* const double = (n: number): number => n * 2
|
package/src/HashMap.ts
CHANGED
|
@@ -40,7 +40,7 @@ export declare namespace HashMap {
|
|
|
40
40
|
* This type-level utility extracts the key type `K` from a `HashMap<K, V>` type.
|
|
41
41
|
*
|
|
42
42
|
* @example
|
|
43
|
-
* import
|
|
43
|
+
* import { HashMap } from "effect"
|
|
44
44
|
*
|
|
45
45
|
* declare const hm: HashMap.HashMap<string, number>
|
|
46
46
|
*
|
|
@@ -55,7 +55,7 @@ export declare namespace HashMap {
|
|
|
55
55
|
* This type-level utility extracts the value type `V` from a `HashMap<K, V>` type.
|
|
56
56
|
*
|
|
57
57
|
* @example
|
|
58
|
-
* import
|
|
58
|
+
* import { HashMap } from "effect"
|
|
59
59
|
*
|
|
60
60
|
* declare const hm: HashMap.HashMap<string, number>
|
|
61
61
|
*
|
package/src/Iterable.ts
CHANGED
|
@@ -24,7 +24,7 @@ import type { NoInfer } from "./Types.js"
|
|
|
24
24
|
* **Note**. `length` is normalized to an integer >= 1.
|
|
25
25
|
*
|
|
26
26
|
* @example
|
|
27
|
-
* import { makeBy } from
|
|
27
|
+
* import { makeBy } from "effect/Iterable"
|
|
28
28
|
*
|
|
29
29
|
* assert.deepStrictEqual(Array.from(makeBy(n => n * 2, { length: 5 })), [0, 2, 4, 6, 8])
|
|
30
30
|
*
|
|
@@ -56,7 +56,7 @@ export const makeBy = <A>(f: (i: number) => A, options?: {
|
|
|
56
56
|
* If `end` is omitted, the range will not have an upper bound.
|
|
57
57
|
*
|
|
58
58
|
* @example
|
|
59
|
-
* import { range } from
|
|
59
|
+
* import { range } from "effect/Iterable"
|
|
60
60
|
*
|
|
61
61
|
* assert.deepStrictEqual(Array.from(range(1, 3)), [1, 2, 3])
|
|
62
62
|
*
|
|
@@ -78,7 +78,7 @@ export const range = (start: number, end?: number): Iterable<number> => {
|
|
|
78
78
|
* **Note**. `n` is normalized to an integer >= 1.
|
|
79
79
|
*
|
|
80
80
|
* @example
|
|
81
|
-
* import { replicate } from
|
|
81
|
+
* import { replicate } from "effect/Iterable"
|
|
82
82
|
*
|
|
83
83
|
* assert.deepStrictEqual(Array.from(replicate("a", 3)), ["a", "a", "a"])
|
|
84
84
|
*
|
|
@@ -129,7 +129,7 @@ export const prepend: {
|
|
|
129
129
|
* Prepends the specified prefix iterable to the beginning of the specified iterable.
|
|
130
130
|
*
|
|
131
131
|
* @example
|
|
132
|
-
* import
|
|
132
|
+
* import { Iterable } from "effect"
|
|
133
133
|
*
|
|
134
134
|
* assert.deepStrictEqual(
|
|
135
135
|
* Array.from(Iterable.prependAll([1, 2], ["a", "b"])),
|
|
@@ -806,11 +806,10 @@ export const filterMapWhile: {
|
|
|
806
806
|
* Retrieves the `Some` values from an `Iterable` of `Option`s.
|
|
807
807
|
*
|
|
808
808
|
* @example
|
|
809
|
-
* import {
|
|
810
|
-
* import { some, none } from "effect/Option"
|
|
809
|
+
* import { Iterable, Option } from "effect"
|
|
811
810
|
*
|
|
812
811
|
* assert.deepStrictEqual(
|
|
813
|
-
* Array.from(getSomes([some(1), none(), some(2)])),
|
|
812
|
+
* Array.from(Iterable.getSomes([Option.some(1), Option.none(), Option.some(2)])),
|
|
814
813
|
* [1, 2]
|
|
815
814
|
* )
|
|
816
815
|
*
|
|
@@ -823,11 +822,10 @@ export const getSomes: <A>(self: Iterable<Option<A>>) => Iterable<A> = filterMap
|
|
|
823
822
|
* Retrieves the `Left` values from an `Iterable` of `Either`s.
|
|
824
823
|
*
|
|
825
824
|
* @example
|
|
826
|
-
* import {
|
|
827
|
-
* import { right, left } from "effect/Either"
|
|
825
|
+
* import { Iterable, Either } from "effect"
|
|
828
826
|
*
|
|
829
827
|
* assert.deepStrictEqual(
|
|
830
|
-
* Array.from(getLefts([right(1), left("err"), right(2)])),
|
|
828
|
+
* Array.from(Iterable.getLefts([Either.right(1), Either.left("err"), Either.right(2)])),
|
|
831
829
|
* ["err"]
|
|
832
830
|
* )
|
|
833
831
|
*
|
|
@@ -840,11 +838,10 @@ export const getLefts = <R, L>(self: Iterable<Either<R, L>>): Iterable<L> => fil
|
|
|
840
838
|
* Retrieves the `Right` values from an `Iterable` of `Either`s.
|
|
841
839
|
*
|
|
842
840
|
* @example
|
|
843
|
-
* import {
|
|
844
|
-
* import { right, left } from "effect/Either"
|
|
841
|
+
* import { Iterable, Either } from "effect"
|
|
845
842
|
*
|
|
846
843
|
* assert.deepStrictEqual(
|
|
847
|
-
* Array.from(getRights([right(1), left("err"), right(2)])),
|
|
844
|
+
* Array.from(Iterable.getRights([Either.right(1), Either.left("err"), Either.right(2)])),
|
|
848
845
|
* [1, 2]
|
|
849
846
|
* )
|
|
850
847
|
*
|
package/src/List.ts
CHANGED
|
@@ -324,7 +324,7 @@ export const append: {
|
|
|
324
324
|
* If either list is non-empty, the result is also a non-empty list.
|
|
325
325
|
*
|
|
326
326
|
* @example
|
|
327
|
-
* import
|
|
327
|
+
* import { List } from "effect"
|
|
328
328
|
*
|
|
329
329
|
* assert.deepStrictEqual(
|
|
330
330
|
* List.make(1, 2).pipe(List.appendAll(List.make("a", "b")), List.toArray),
|
|
@@ -357,7 +357,7 @@ export const prepend: {
|
|
|
357
357
|
* If either list is non-empty, the result is also a non-empty list.
|
|
358
358
|
*
|
|
359
359
|
* @example
|
|
360
|
-
* import
|
|
360
|
+
* import { List } from "effect"
|
|
361
361
|
*
|
|
362
362
|
* assert.deepStrictEqual(
|
|
363
363
|
* List.make(1, 2).pipe(List.prependAll(List.make("a", "b")), List.toArray),
|
package/src/Metric.ts
CHANGED
|
@@ -165,7 +165,7 @@ export const mapInput: {
|
|
|
165
165
|
* - incremental - Set to 'true' for a counter that only increases. With this configuration, Effect ensures that non-incremental updates have no impact on the counter, making it exclusively suitable for counting upwards.
|
|
166
166
|
*
|
|
167
167
|
* @example
|
|
168
|
-
* import
|
|
168
|
+
* import { Metric } from "effect"
|
|
169
169
|
*
|
|
170
170
|
* const numberCounter = Metric.counter("count", {
|
|
171
171
|
* description: "A number counter"
|
|
@@ -206,7 +206,7 @@ export const counter: {
|
|
|
206
206
|
* @param description - An optional description of the Frequency metric.
|
|
207
207
|
*
|
|
208
208
|
* @example
|
|
209
|
-
* import
|
|
209
|
+
* import { Metric } from "effect"
|
|
210
210
|
*
|
|
211
211
|
* const errorFrequency = Metric.frequency("error_frequency", {
|
|
212
212
|
* description: "Counts the occurrences of errors."
|
|
@@ -254,7 +254,7 @@ export const fromMetricKey: <Type extends MetricKeyType.MetricKeyType<any, any>>
|
|
|
254
254
|
* - bigint - Indicates if the counter uses 'bigint' data type.
|
|
255
255
|
*
|
|
256
256
|
* @example
|
|
257
|
-
* import
|
|
257
|
+
* import { Metric } from "effect"
|
|
258
258
|
*
|
|
259
259
|
* const numberGauge = Metric.gauge("memory_usage", {
|
|
260
260
|
* description: "A gauge for memory usage"
|
|
@@ -288,8 +288,7 @@ export const gauge: {
|
|
|
288
288
|
* @param description - A description of the histogram metric.
|
|
289
289
|
*
|
|
290
290
|
* @example
|
|
291
|
-
* import
|
|
292
|
-
* import * as MetricBoundaries from "effect/MetricBoundaries"
|
|
291
|
+
* import { Metric, MetricBoundaries } from "effect"
|
|
293
292
|
*
|
|
294
293
|
* const latencyHistogram = Metric.histogram("latency_histogram",
|
|
295
294
|
* MetricBoundaries.linear({ start: 0, width: 10, count: 11 }),
|
|
@@ -393,8 +392,7 @@ export const sync: <Out>(evaluate: LazyArg<Out>) => Metric<void, unknown, Out> =
|
|
|
393
392
|
* - description - An optional description of the Summary metric.
|
|
394
393
|
*
|
|
395
394
|
* @example
|
|
396
|
-
* import
|
|
397
|
-
* import * as Chunk from "effect/Chunk"
|
|
395
|
+
* import { Metric, Chunk } from "effect"
|
|
398
396
|
*
|
|
399
397
|
* const responseTimesSummary = Metric.summary({
|
|
400
398
|
* name: "response_times_summary",
|