diff --git a/.eslintrc.cjs b/.eslintrc.cjs index f8454714e..dbe4fe095 100644 --- a/.eslintrc.cjs +++ b/.eslintrc.cjs @@ -1,6 +1,6 @@ /* eslint-disable no-undef */ module.exports = { - ignorePatterns: ["dist", "build", "*.mjs", "docs", "*.md"], + ignorePatterns: ["dist", "build", "docs", "*.mjs", "*.md"], parser: "@typescript-eslint/parser", parserOptions: { ecmaVersion: 2018, diff --git a/.gitignore b/.gitignore index d6ac700d4..bf5473fd1 100644 --- a/.gitignore +++ b/.gitignore @@ -5,5 +5,5 @@ node_modules/ tmp/ dist/ build/ -docs/examples/ +docs/ .direnv/ diff --git a/docs/_config.yml b/docs/_config.yml deleted file mode 100644 index 1d30cabfe..000000000 --- a/docs/_config.yml +++ /dev/null @@ -1,9 +0,0 @@ -remote_theme: mikearnaldi/just-the-docs -search_enabled: true -aux_links: - "Docs": - - "//effect-ts.github.io/effect" - "API Reference": - - "//effect-ts.github.io/effect/docs/modules" - "GitHub": - - "//github.com/effect-ts/effect" diff --git a/docs/index.md b/docs/index.md deleted file mode 100644 index d77a44118..000000000 --- a/docs/index.md +++ /dev/null @@ -1,4 +0,0 @@ ---- -title: Home -nav_order: 1 ---- diff --git a/docs/modules/BigDecimal.ts.md b/docs/modules/BigDecimal.ts.md deleted file mode 100644 index 684fa92a6..000000000 --- a/docs/modules/BigDecimal.ts.md +++ /dev/null @@ -1,898 +0,0 @@ ---- -title: BigDecimal.ts -nav_order: 1 -parent: Modules ---- - -## BigDecimal overview - -This module provides utility functions and type class instances for working with the `BigDecimal` type in TypeScript. -It includes functions for basic arithmetic operations, as well as type class instances for `Equivalence` and `Order`. - -A `BigDecimal` allows storing any real number to arbitrary precision; which avoids common floating point errors -(such as 0.1 + 0.2 ≠ 0.3) at the cost of complexity. - -Internally, `BigDecimal` uses a `BigInt` object, paired with a 64-bit integer which determines the position of the -decimal point. Therefore, the precision _is not_ actually arbitrary, but limited to 263 decimal places. - -It is not recommended to convert a floating point number to a decimal directly, as the floating point representation -may be unexpected. - -Added in v2.0.0 - ---- - -

Table of contents

- -- [constructors](#constructors) - - [fromBigInt](#frombigint) - - [fromNumber](#fromnumber) - - [fromString](#fromstring) - - [make](#make) - - [unsafeFromString](#unsafefromstring) -- [conversions](#conversions) - - [toString](#tostring) - - [unsafeToNumber](#unsafetonumber) -- [guards](#guards) - - [isBigDecimal](#isbigdecimal) -- [instances](#instances) - - [Equivalence](#equivalence) - - [Order](#order) -- [math](#math) - - [abs](#abs) - - [clamp](#clamp) - - [divide](#divide) - - [max](#max) - - [min](#min) - - [multiply](#multiply) - - [negate](#negate) - - [remainder](#remainder) - - [sign](#sign) - - [subtract](#subtract) - - [sum](#sum) - - [unsafeDivide](#unsafedivide) - - [unsafeRemainder](#unsaferemainder) -- [models](#models) - - [BigDecimal (interface)](#bigdecimal-interface) -- [predicates](#predicates) - - [between](#between) - - [equals](#equals) - - [greaterThan](#greaterthan) - - [greaterThanOrEqualTo](#greaterthanorequalto) - - [isInteger](#isinteger) - - [isNegative](#isnegative) - - [isPositive](#ispositive) - - [isZero](#iszero) - - [lessThan](#lessthan) - - [lessThanOrEqualTo](#lessthanorequalto) -- [scaling](#scaling) - - [normalize](#normalize) - - [scale](#scale) -- [symbol](#symbol) - - [TypeId (type alias)](#typeid-type-alias) -- [symbols](#symbols) - - [TypeId](#typeid) - ---- - -# constructors - -## fromBigInt - -Creates a `BigDecimal` from a `bigint` value. - -**Signature** - -```ts -export declare const fromBigInt: (n: bigint) => BigDecimal -``` - -Added in v2.0.0 - -## fromNumber - -Creates a `BigDecimal` from a `number` value. - -It is not recommended to convert a floating point number to a decimal directly, -as the floating point representation may be unexpected. - -**Signature** - -```ts -export declare const fromNumber: (n: number) => BigDecimal -``` - -**Example** - -```ts -import { fromNumber, make } from "effect/BigDecimal" - -assert.deepStrictEqual(fromNumber(123), make(123n, 0)) -assert.deepStrictEqual(fromNumber(123.456), make(123456n, 3)) -``` - -Added in v2.0.0 - -## fromString - -Parses a numerical `string` into a `BigDecimal`. - -**Signature** - -```ts -export declare const fromString: (s: string) => Option.Option -``` - -**Example** - -```ts -import { fromString, make } from "effect/BigDecimal" -import { some, none } from "effect/Option" - -assert.deepStrictEqual(fromString("123"), some(make(123n, 0))) -assert.deepStrictEqual(fromString("123.456"), some(make(123456n, 3))) -assert.deepStrictEqual(fromString("123.abc"), none()) -``` - -Added in v2.0.0 - -## make - -Creates a `BigDecimal` from a `bigint` value and a scale. - -**Signature** - -```ts -export declare const make: (value: bigint, scale: number) => BigDecimal -``` - -Added in v2.0.0 - -## unsafeFromString - -Parses a numerical `string` into a `BigDecimal`. - -**Signature** - -```ts -export declare const unsafeFromString: (s: string) => BigDecimal -``` - -**Example** - -```ts -import { unsafeFromString, make } from "effect/BigDecimal" - -assert.deepStrictEqual(unsafeFromString("123"), make(123n, 0)) -assert.deepStrictEqual(unsafeFromString("123.456"), make(123456n, 3)) -assert.throws(() => unsafeFromString("123.abc")) -``` - -Added in v2.0.0 - -# conversions - -## toString - -Formats a given `BigDecimal` as a `string`. - -**Signature** - -```ts -export declare const toString: (n: BigDecimal) => string -``` - -**Example** - -```ts -import { toString, unsafeFromString } from "effect/BigDecimal" - -assert.deepStrictEqual(toString(unsafeFromString("-5")), "-5") -assert.deepStrictEqual(toString(unsafeFromString("123.456")), "123.456") -assert.deepStrictEqual(toString(unsafeFromString("-0.00000123")), "-0.00000123") -``` - -Added in v2.0.0 - -## unsafeToNumber - -Converts a `BigDecimal` to a `number`. - -This function will produce incorrect results if the `BigDecimal` exceeds the 64-bit range of a `number`. - -**Signature** - -```ts -export declare const unsafeToNumber: (n: BigDecimal) => number -``` - -**Example** - -```ts -import { unsafeToNumber, unsafeFromString } from "effect/BigDecimal" - -assert.deepStrictEqual(unsafeToNumber(unsafeFromString("123.456")), 123.456) -``` - -Added in v2.0.0 - -# guards - -## isBigDecimal - -Checks if a given value is a `BigDecimal`. - -**Signature** - -```ts -export declare const isBigDecimal: (u: unknown) => u is BigDecimal -``` - -Added in v2.0.0 - -# instances - -## Equivalence - -**Signature** - -```ts -export declare const Equivalence: equivalence.Equivalence -``` - -Added in v2.0.0 - -## Order - -**Signature** - -```ts -export declare const Order: order.Order -``` - -Added in v2.0.0 - -# math - -## abs - -Determines the absolute value of a given `BigDecimal`. - -**Signature** - -```ts -export declare const abs: (n: BigDecimal) => BigDecimal -``` - -**Example** - -```ts -import { abs, unsafeFromString } from "effect/BigDecimal" - -assert.deepStrictEqual(abs(unsafeFromString("-5")), unsafeFromString("5")) -assert.deepStrictEqual(abs(unsafeFromString("0")), unsafeFromString("0")) -assert.deepStrictEqual(abs(unsafeFromString("5")), unsafeFromString("5")) -``` - -Added in v2.0.0 - -## clamp - -Restricts the given `BigDecimal` to be within the range specified by the `minimum` and `maximum` values. - -- If the `BigDecimal` is less than the `minimum` value, the function returns the `minimum` value. -- If the `BigDecimal` is greater than the `maximum` value, the function returns the `maximum` value. -- Otherwise, it returns the original `BigDecimal`. - -**Signature** - -```ts -export declare const clamp: { - (options: { minimum: BigDecimal; maximum: BigDecimal }): (self: BigDecimal) => BigDecimal - (self: BigDecimal, options: { minimum: BigDecimal; maximum: BigDecimal }): BigDecimal -} -``` - -**Example** - -```ts -import * as BigDecimal from "effect/BigDecimal" - -const clamp = BigDecimal.clamp({ - minimum: BigDecimal.unsafeFromString("1"), - maximum: BigDecimal.unsafeFromString("5") -}) - -assert.deepStrictEqual(clamp(BigDecimal.unsafeFromString("3")), BigDecimal.unsafeFromString("3")) -assert.deepStrictEqual(clamp(BigDecimal.unsafeFromString("0")), BigDecimal.unsafeFromString("1")) -assert.deepStrictEqual(clamp(BigDecimal.unsafeFromString("6")), BigDecimal.unsafeFromString("5")) -``` - -Added in v2.0.0 - -## divide - -Provides a division operation on `BigDecimal`s. - -If the dividend is not a multiple of the divisor the result will be a `BigDecimal` value -which represents the integer division rounded down to the nearest integer. - -If the divisor is `0`, the result will be `None`. - -**Signature** - -```ts -export declare const divide: { - (that: BigDecimal): (self: BigDecimal) => Option.Option - (self: BigDecimal, that: BigDecimal): Option.Option -} -``` - -**Example** - -```ts -import { divide, unsafeFromString } from "effect/BigDecimal" -import { some, none } from "effect/Option" - -assert.deepStrictEqual(divide(unsafeFromString("6"), unsafeFromString("3")), some(unsafeFromString("2"))) -assert.deepStrictEqual(divide(unsafeFromString("6"), unsafeFromString("4")), some(unsafeFromString("1.5"))) -assert.deepStrictEqual(divide(unsafeFromString("6"), unsafeFromString("0")), none()) -``` - -Added in v2.0.0 - -## max - -Returns the maximum between two `BigDecimal`s. - -**Signature** - -```ts -export declare const max: { - (that: BigDecimal): (self: BigDecimal) => BigDecimal - (self: BigDecimal, that: BigDecimal): BigDecimal -} -``` - -**Example** - -```ts -import { max, unsafeFromString } from "effect/BigDecimal" - -assert.deepStrictEqual(max(unsafeFromString("2"), unsafeFromString("3")), unsafeFromString("3")) -``` - -Added in v2.0.0 - -## min - -Returns the minimum between two `BigDecimal`s. - -**Signature** - -```ts -export declare const min: { - (that: BigDecimal): (self: BigDecimal) => BigDecimal - (self: BigDecimal, that: BigDecimal): BigDecimal -} -``` - -**Example** - -```ts -import { min, unsafeFromString } from "effect/BigDecimal" - -assert.deepStrictEqual(min(unsafeFromString("2"), unsafeFromString("3")), unsafeFromString("2")) -``` - -Added in v2.0.0 - -## multiply - -Provides a multiplication operation on `BigDecimal`s. - -**Signature** - -```ts -export declare const multiply: { - (that: BigDecimal): (self: BigDecimal) => BigDecimal - (self: BigDecimal, that: BigDecimal): BigDecimal -} -``` - -**Example** - -```ts -import { multiply, unsafeFromString } from "effect/BigDecimal" - -assert.deepStrictEqual(multiply(unsafeFromString("2"), unsafeFromString("3")), unsafeFromString("6")) -``` - -Added in v2.0.0 - -## negate - -Provides a negate operation on `BigDecimal`s. - -**Signature** - -```ts -export declare const negate: (n: BigDecimal) => BigDecimal -``` - -**Example** - -```ts -import { negate, unsafeFromString } from "effect/BigDecimal" - -assert.deepStrictEqual(negate(unsafeFromString("3")), unsafeFromString("-3")) -assert.deepStrictEqual(negate(unsafeFromString("-6")), unsafeFromString("6")) -``` - -Added in v2.0.0 - -## remainder - -Returns the remainder left over when one operand is divided by a second operand. - -If the divisor is `0`, the result will be `None`. - -**Signature** - -```ts -export declare const remainder: { - (divisor: BigDecimal): (self: BigDecimal) => Option.Option - (self: BigDecimal, divisor: BigDecimal): Option.Option -} -``` - -**Example** - -```ts -import { remainder, unsafeFromString } from "effect/BigDecimal" -import { some } from "effect/Option" - -assert.deepStrictEqual(remainder(unsafeFromString("2"), unsafeFromString("2")), some(unsafeFromString("0"))) -assert.deepStrictEqual(remainder(unsafeFromString("3"), unsafeFromString("2")), some(unsafeFromString("1"))) -assert.deepStrictEqual(remainder(unsafeFromString("-4"), unsafeFromString("2")), some(unsafeFromString("0"))) -``` - -Added in v2.0.0 - -## sign - -Determines the sign of a given `BigDecimal`. - -**Signature** - -```ts -export declare const sign: (n: BigDecimal) => Ordering -``` - -**Example** - -```ts -import { sign, unsafeFromString } from "effect/BigDecimal" - -assert.deepStrictEqual(sign(unsafeFromString("-5")), -1) -assert.deepStrictEqual(sign(unsafeFromString("0")), 0) -assert.deepStrictEqual(sign(unsafeFromString("5")), 1) -``` - -Added in v2.0.0 - -## subtract - -Provides a subtraction operation on `BigDecimal`s. - -**Signature** - -```ts -export declare const subtract: { - (that: BigDecimal): (self: BigDecimal) => BigDecimal - (self: BigDecimal, that: BigDecimal): BigDecimal -} -``` - -**Example** - -```ts -import { subtract, unsafeFromString } from "effect/BigDecimal" - -assert.deepStrictEqual(subtract(unsafeFromString("2"), unsafeFromString("3")), unsafeFromString("-1")) -``` - -Added in v2.0.0 - -## sum - -Provides an addition operation on `BigDecimal`s. - -**Signature** - -```ts -export declare const sum: { - (that: BigDecimal): (self: BigDecimal) => BigDecimal - (self: BigDecimal, that: BigDecimal): BigDecimal -} -``` - -**Example** - -```ts -import { sum, unsafeFromString } from "effect/BigDecimal" - -assert.deepStrictEqual(sum(unsafeFromString("2"), unsafeFromString("3")), unsafeFromString("5")) -``` - -Added in v2.0.0 - -## unsafeDivide - -Provides an unsafe division operation on `BigDecimal`s. - -If the dividend is not a multiple of the divisor the result will be a `BigDecimal` value -which represents the integer division rounded down to the nearest integer. - -Throws a `RangeError` if the divisor is `0`. - -**Signature** - -```ts -export declare const unsafeDivide: { - (that: BigDecimal): (self: BigDecimal) => BigDecimal - (self: BigDecimal, that: BigDecimal): BigDecimal -} -``` - -**Example** - -```ts -import { unsafeDivide, unsafeFromString } from "effect/BigDecimal" - -assert.deepStrictEqual(unsafeDivide(unsafeFromString("6"), unsafeFromString("3")), unsafeFromString("2")) -assert.deepStrictEqual(unsafeDivide(unsafeFromString("6"), unsafeFromString("4")), unsafeFromString("1.5")) -``` - -Added in v2.0.0 - -## unsafeRemainder - -Returns the remainder left over when one operand is divided by a second operand. - -Throws a `RangeError` if the divisor is `0`. - -**Signature** - -```ts -export declare const unsafeRemainder: { - (divisor: BigDecimal): (self: BigDecimal) => BigDecimal - (self: BigDecimal, divisor: BigDecimal): BigDecimal -} -``` - -**Example** - -```ts -import { unsafeRemainder, unsafeFromString } from "effect/BigDecimal" - -assert.deepStrictEqual(unsafeRemainder(unsafeFromString("2"), unsafeFromString("2")), unsafeFromString("0")) -assert.deepStrictEqual(unsafeRemainder(unsafeFromString("3"), unsafeFromString("2")), unsafeFromString("1")) -assert.deepStrictEqual(unsafeRemainder(unsafeFromString("-4"), unsafeFromString("2")), unsafeFromString("0")) -``` - -Added in v2.0.0 - -# models - -## BigDecimal (interface) - -**Signature** - -```ts -export interface BigDecimal extends Equal.Equal, Pipeable, Inspectable { - readonly [TypeId]: TypeId - readonly value: bigint - readonly scale: number - /** @internal */ - normalized?: BigDecimal -} -``` - -Added in v2.0.0 - -# predicates - -## between - -Checks if a `BigDecimal` is between a `minimum` and `maximum` value (inclusive). - -**Signature** - -```ts -export declare const between: { - (options: { minimum: BigDecimal; maximum: BigDecimal }): (self: BigDecimal) => boolean - (self: BigDecimal, options: { minimum: BigDecimal; maximum: BigDecimal }): boolean -} -``` - -**Example** - -```ts -import * as BigDecimal from "effect/BigDecimal" - -const between = BigDecimal.between({ - minimum: BigDecimal.unsafeFromString("1"), - maximum: BigDecimal.unsafeFromString("5") -}) - -assert.deepStrictEqual(between(BigDecimal.unsafeFromString("3")), true) -assert.deepStrictEqual(between(BigDecimal.unsafeFromString("0")), false) -assert.deepStrictEqual(between(BigDecimal.unsafeFromString("6")), false) -``` - -Added in v2.0.0 - -## equals - -Checks if two `BigDecimal`s are equal. - -**Signature** - -```ts -export declare const equals: { - (that: BigDecimal): (self: BigDecimal) => boolean - (self: BigDecimal, that: BigDecimal): boolean -} -``` - -Added in v2.0.0 - -## greaterThan - -Returns `true` if the first argument is greater than the second, otherwise `false`. - -**Signature** - -```ts -export declare const greaterThan: { - (that: BigDecimal): (self: BigDecimal) => boolean - (self: BigDecimal, that: BigDecimal): boolean -} -``` - -**Example** - -```ts -import { greaterThan, unsafeFromString } from "effect/BigDecimal" - -assert.deepStrictEqual(greaterThan(unsafeFromString("2"), unsafeFromString("3")), false) -assert.deepStrictEqual(greaterThan(unsafeFromString("3"), unsafeFromString("3")), false) -assert.deepStrictEqual(greaterThan(unsafeFromString("4"), unsafeFromString("3")), true) -``` - -Added in v2.0.0 - -## greaterThanOrEqualTo - -Checks if a given `BigDecimal` is greater than or equal to the provided one. - -**Signature** - -```ts -export declare const greaterThanOrEqualTo: { - (that: BigDecimal): (self: BigDecimal) => boolean - (self: BigDecimal, that: BigDecimal): boolean -} -``` - -**Example** - -```ts -import { greaterThanOrEqualTo, unsafeFromString } from "effect/BigDecimal" - -assert.deepStrictEqual(greaterThanOrEqualTo(unsafeFromString("2"), unsafeFromString("3")), false) -assert.deepStrictEqual(greaterThanOrEqualTo(unsafeFromString("3"), unsafeFromString("3")), true) -assert.deepStrictEqual(greaterThanOrEqualTo(unsafeFromString("4"), unsafeFromString("3")), true) -``` - -Added in v2.0.0 - -## isInteger - -Checks if a given `BigDecimal` is an integer. - -**Signature** - -```ts -export declare const isInteger: (n: BigDecimal) => boolean -``` - -**Example** - -```ts -import { isInteger, unsafeFromString } from "effect/BigDecimal" - -assert.deepStrictEqual(isInteger(unsafeFromString("0")), true) -assert.deepStrictEqual(isInteger(unsafeFromString("1")), true) -assert.deepStrictEqual(isInteger(unsafeFromString("1.1")), false) -``` - -Added in v2.0.0 - -## isNegative - -Checks if a given `BigDecimal` is negative. - -**Signature** - -```ts -export declare const isNegative: (n: BigDecimal) => boolean -``` - -**Example** - -```ts -import { isNegative, unsafeFromString } from "effect/BigDecimal" - -assert.deepStrictEqual(isNegative(unsafeFromString("-1")), true) -assert.deepStrictEqual(isNegative(unsafeFromString("0")), false) -assert.deepStrictEqual(isNegative(unsafeFromString("1")), false) -``` - -Added in v2.0.0 - -## isPositive - -Checks if a given `BigDecimal` is positive. - -**Signature** - -```ts -export declare const isPositive: (n: BigDecimal) => boolean -``` - -**Example** - -```ts -import { isPositive, unsafeFromString } from "effect/BigDecimal" - -assert.deepStrictEqual(isPositive(unsafeFromString("-1")), false) -assert.deepStrictEqual(isPositive(unsafeFromString("0")), false) -assert.deepStrictEqual(isPositive(unsafeFromString("1")), true) -``` - -Added in v2.0.0 - -## isZero - -Checks if a given `BigDecimal` is `0`. - -**Signature** - -```ts -export declare const isZero: (n: BigDecimal) => boolean -``` - -**Example** - -```ts -import { isZero, unsafeFromString } from "effect/BigDecimal" - -assert.deepStrictEqual(isZero(unsafeFromString("0")), true) -assert.deepStrictEqual(isZero(unsafeFromString("1")), false) -``` - -Added in v2.0.0 - -## lessThan - -Returns `true` if the first argument is less than the second, otherwise `false`. - -**Signature** - -```ts -export declare const lessThan: { - (that: BigDecimal): (self: BigDecimal) => boolean - (self: BigDecimal, that: BigDecimal): boolean -} -``` - -**Example** - -```ts -import { lessThan, unsafeFromString } from "effect/BigDecimal" - -assert.deepStrictEqual(lessThan(unsafeFromString("2"), unsafeFromString("3")), true) -assert.deepStrictEqual(lessThan(unsafeFromString("3"), unsafeFromString("3")), false) -assert.deepStrictEqual(lessThan(unsafeFromString("4"), unsafeFromString("3")), false) -``` - -Added in v2.0.0 - -## lessThanOrEqualTo - -Checks if a given `BigDecimal` is less than or equal to the provided one. - -**Signature** - -```ts -export declare const lessThanOrEqualTo: { - (that: BigDecimal): (self: BigDecimal) => boolean - (self: BigDecimal, that: BigDecimal): boolean -} -``` - -**Example** - -```ts -import { lessThanOrEqualTo, unsafeFromString } from "effect/BigDecimal" - -assert.deepStrictEqual(lessThanOrEqualTo(unsafeFromString("2"), unsafeFromString("3")), true) -assert.deepStrictEqual(lessThanOrEqualTo(unsafeFromString("3"), unsafeFromString("3")), true) -assert.deepStrictEqual(lessThanOrEqualTo(unsafeFromString("4"), unsafeFromString("3")), false) -``` - -Added in v2.0.0 - -# scaling - -## normalize - -Normalizes a given `BigDecimal` by removing trailing zeros. - -**Signature** - -```ts -export declare const normalize: (self: BigDecimal) => BigDecimal -``` - -**Example** - -```ts -import { normalize, make, unsafeFromString } from "effect/BigDecimal" - -assert.deepStrictEqual(normalize(unsafeFromString("123.00000")), make(123n, 0)) -assert.deepStrictEqual(normalize(unsafeFromString("12300000")), make(123n, -5)) -``` - -Added in v2.0.0 - -## scale - -Scales a given `BigDecimal` to the specified scale. - -If the given scale is smaller than the current scale, the value will be rounded down to -the nearest integer. - -**Signature** - -```ts -export declare const scale: (self: BigDecimal, scale: number) => BigDecimal -``` - -Added in v2.0.0 - -# symbol - -## TypeId (type alias) - -**Signature** - -```ts -export type TypeId = typeof TypeId -``` - -Added in v2.0.0 - -# symbols - -## TypeId - -**Signature** - -```ts -export declare const TypeId: typeof TypeId -``` - -Added in v2.0.0 diff --git a/docs/modules/BigInt.ts.md b/docs/modules/BigInt.ts.md deleted file mode 100644 index 799a67ba8..000000000 --- a/docs/modules/BigInt.ts.md +++ /dev/null @@ -1,624 +0,0 @@ ---- -title: BigInt.ts -nav_order: 2 -parent: Modules ---- - -## BigInt overview - -This module provides utility functions and type class instances for working with the `bigint` type in TypeScript. -It includes functions for basic arithmetic operations, as well as type class instances for -`Equivalence` and `Order`. - -Added in v2.0.0 - ---- - -

Table of contents

- -- [guards](#guards) - - [isBigInt](#isbigint) -- [instances](#instances) - - [Equivalence](#equivalence) - - [Order](#order) -- [math](#math) - - [abs](#abs) - - [decrement](#decrement) - - [divide](#divide) - - [gcd](#gcd) - - [increment](#increment) - - [lcm](#lcm) - - [multiply](#multiply) - - [multiplyAll](#multiplyall) - - [sign](#sign) - - [sqrt](#sqrt) - - [subtract](#subtract) - - [sum](#sum) - - [sumAll](#sumall) - - [unsafeDivide](#unsafedivide) - - [unsafeSqrt](#unsafesqrt) -- [predicates](#predicates) - - [between](#between) - - [greaterThan](#greaterthan) - - [greaterThanOrEqualTo](#greaterthanorequalto) - - [lessThan](#lessthan) - - [lessThanOrEqualTo](#lessthanorequalto) -- [utils](#utils) - - [clamp](#clamp) - - [max](#max) - - [min](#min) - ---- - -# guards - -## isBigInt - -Tests if a value is a `bigint`. - -**Signature** - -```ts -export declare const isBigInt: (u: unknown) => u is bigint -``` - -**Example** - -```ts -import { isBigInt } from "effect/BigInt" - -assert.deepStrictEqual(isBigInt(1n), true) -assert.deepStrictEqual(isBigInt(1), false) -``` - -Added in v2.0.0 - -# instances - -## Equivalence - -**Signature** - -```ts -export declare const Equivalence: equivalence.Equivalence -``` - -Added in v2.0.0 - -## Order - -**Signature** - -```ts -export declare const Order: order.Order -``` - -Added in v2.0.0 - -# math - -## abs - -Determines the absolute value of a given `bigint`. - -**Signature** - -```ts -export declare const abs: (n: bigint) => bigint -``` - -**Example** - -```ts -import { abs } from "effect/BigInt" - -assert.deepStrictEqual(abs(-5n), 5n) -assert.deepStrictEqual(abs(0n), 0n) -assert.deepStrictEqual(abs(5n), 5n) -``` - -Added in v2.0.0 - -## decrement - -Decrements a number by `1n`. - -**Signature** - -```ts -export declare const decrement: (n: bigint) => bigint -``` - -**Example** - -```ts -import { decrement } from "effect/BigInt" - -assert.deepStrictEqual(decrement(3n), 2n) -``` - -Added in v2.0.0 - -## divide - -Provides a division operation on `bigint`s. - -If the dividend is not a multiple of the divisor the result will be a `bigint` value -which represents the integer division rounded down to the nearest integer. - -Returns `None` if the divisor is `0n`. - -**Signature** - -```ts -export declare const divide: { - (that: bigint): (self: bigint) => Option.Option - (self: bigint, that: bigint): Option.Option -} -``` - -**Example** - -```ts -import { divide } from "effect/BigInt" -import { some, none } from "effect/Option" - -assert.deepStrictEqual(divide(6n, 3n), some(2n)) -assert.deepStrictEqual(divide(6n, 0n), none()) -``` - -Added in v2.0.0 - -## gcd - -Determines the greatest common divisor of two `bigint`s. - -**Signature** - -```ts -export declare const gcd: { (that: bigint): (self: bigint) => bigint; (self: bigint, that: bigint): bigint } -``` - -**Example** - -```ts -import { gcd } from "effect/BigInt" - -assert.deepStrictEqual(gcd(2n, 3n), 1n) -assert.deepStrictEqual(gcd(2n, 4n), 2n) -assert.deepStrictEqual(gcd(16n, 24n), 8n) -``` - -Added in v2.0.0 - -## increment - -Returns the result of adding `1n` to a given number. - -**Signature** - -```ts -export declare const increment: (n: bigint) => bigint -``` - -**Example** - -```ts -import { increment } from "effect/BigInt" - -assert.deepStrictEqual(increment(2n), 3n) -``` - -Added in v2.0.0 - -## lcm - -Determines the least common multiple of two `bigint`s. - -**Signature** - -```ts -export declare const lcm: { (that: bigint): (self: bigint) => bigint; (self: bigint, that: bigint): bigint } -``` - -**Example** - -```ts -import { lcm } from "effect/BigInt" - -assert.deepStrictEqual(lcm(2n, 3n), 6n) -assert.deepStrictEqual(lcm(2n, 4n), 4n) -assert.deepStrictEqual(lcm(16n, 24n), 48n) -``` - -Added in v2.0.0 - -## multiply - -Provides a multiplication operation on `bigint`s. - -**Signature** - -```ts -export declare const multiply: { (that: bigint): (self: bigint) => bigint; (self: bigint, that: bigint): bigint } -``` - -**Example** - -```ts -import { multiply } from "effect/BigInt" - -assert.deepStrictEqual(multiply(2n, 3n), 6n) -``` - -Added in v2.0.0 - -## multiplyAll - -Takes an `Iterable` of `bigint`s and returns their multiplication as a single `number`. - -**Signature** - -```ts -export declare const multiplyAll: (collection: Iterable) => bigint -``` - -**Example** - -```ts -import { multiplyAll } from "effect/BigInt" - -assert.deepStrictEqual(multiplyAll([2n, 3n, 4n]), 24n) -``` - -Added in v2.0.0 - -## sign - -Determines the sign of a given `bigint`. - -**Signature** - -```ts -export declare const sign: (n: bigint) => Ordering -``` - -**Example** - -```ts -import { sign } from "effect/BigInt" - -assert.deepStrictEqual(sign(-5n), -1) -assert.deepStrictEqual(sign(0n), 0) -assert.deepStrictEqual(sign(5n), 1) -``` - -Added in v2.0.0 - -## sqrt - -Determines the square root of a given `bigint` safely. Returns `none` if the given `bigint` is negative. - -**Signature** - -```ts -export declare const sqrt: (n: bigint) => Option.Option -``` - -**Example** - -```ts -import { sqrt } from "effect/BigInt" -import * as Option from "effect/Option" - -assert.deepStrictEqual(sqrt(4n), Option.some(2n)) -assert.deepStrictEqual(sqrt(9n), Option.some(3n)) -assert.deepStrictEqual(sqrt(16n), Option.some(4n)) -assert.deepStrictEqual(sqrt(-1n), Option.none()) -``` - -Added in v2.0.0 - -## subtract - -Provides a subtraction operation on `bigint`s. - -**Signature** - -```ts -export declare const subtract: { (that: bigint): (self: bigint) => bigint; (self: bigint, that: bigint): bigint } -``` - -**Example** - -```ts -import { subtract } from "effect/BigInt" - -assert.deepStrictEqual(subtract(2n, 3n), -1n) -``` - -Added in v2.0.0 - -## sum - -Provides an addition operation on `bigint`s. - -**Signature** - -```ts -export declare const sum: { (that: bigint): (self: bigint) => bigint; (self: bigint, that: bigint): bigint } -``` - -**Example** - -```ts -import { sum } from "effect/BigInt" - -assert.deepStrictEqual(sum(2n, 3n), 5n) -``` - -Added in v2.0.0 - -## sumAll - -Takes an `Iterable` of `bigint`s and returns their sum as a single `bigint - -**Signature** - -```ts -export declare const sumAll: (collection: Iterable) => bigint -``` - -**Example** - -```ts -import { sumAll } from "effect/BigInt" - -assert.deepStrictEqual(sumAll([2n, 3n, 4n]), 9n) -``` - -Added in v2.0.0 - -## unsafeDivide - -Provides a division operation on `bigint`s. - -If the dividend is not a multiple of the divisor the result will be a `bigint` value -which represents the integer division rounded down to the nearest integer. - -Throws a `RangeError` if the divisor is `0n`. - -**Signature** - -```ts -export declare const unsafeDivide: { (that: bigint): (self: bigint) => bigint; (self: bigint, that: bigint): bigint } -``` - -**Example** - -```ts -import { unsafeDivide } from "effect/BigInt" - -assert.deepStrictEqual(unsafeDivide(6n, 3n), 2n) -assert.deepStrictEqual(unsafeDivide(6n, 4n), 1n) -``` - -Added in v2.0.0 - -## unsafeSqrt - -Determines the square root of a given `bigint` unsafely. Throws if the given `bigint` is negative. - -**Signature** - -```ts -export declare const unsafeSqrt: (n: bigint) => bigint -``` - -**Example** - -```ts -import { unsafeSqrt } from "effect/BigInt" - -assert.deepStrictEqual(unsafeSqrt(4n), 2n) -assert.deepStrictEqual(unsafeSqrt(9n), 3n) -assert.deepStrictEqual(unsafeSqrt(16n), 4n) -``` - -Added in v2.0.0 - -# predicates - -## between - -Checks if a `bigint` is between a `minimum` and `maximum` value (inclusive). - -**Signature** - -```ts -export declare const between: { - (options: { minimum: bigint; maximum: bigint }): (self: bigint) => boolean - (self: bigint, options: { minimum: bigint; maximum: bigint }): boolean -} -``` - -**Example** - -```ts -import * as BigInt from "effect/BigInt" - -const between = BigInt.between({ minimum: 0n, maximum: 5n }) - -assert.deepStrictEqual(between(3n), true) -assert.deepStrictEqual(between(-1n), false) -assert.deepStrictEqual(between(6n), false) -``` - -Added in v2.0.0 - -## greaterThan - -Returns `true` if the first argument is greater than the second, otherwise `false`. - -**Signature** - -```ts -export declare const greaterThan: { (that: bigint): (self: bigint) => boolean; (self: bigint, that: bigint): boolean } -``` - -**Example** - -```ts -import { greaterThan } from "effect/BigInt" - -assert.deepStrictEqual(greaterThan(2n, 3n), false) -assert.deepStrictEqual(greaterThan(3n, 3n), false) -assert.deepStrictEqual(greaterThan(4n, 3n), true) -``` - -Added in v2.0.0 - -## greaterThanOrEqualTo - -Returns a function that checks if a given `bigint` is greater than or equal to the provided one. - -**Signature** - -```ts -export declare const greaterThanOrEqualTo: { - (that: bigint): (self: bigint) => boolean - (self: bigint, that: bigint): boolean -} -``` - -**Example** - -```ts -import { greaterThanOrEqualTo } from "effect/BigInt" - -assert.deepStrictEqual(greaterThanOrEqualTo(2n, 3n), false) -assert.deepStrictEqual(greaterThanOrEqualTo(3n, 3n), true) -assert.deepStrictEqual(greaterThanOrEqualTo(4n, 3n), true) -``` - -Added in v2.0.0 - -## lessThan - -Returns `true` if the first argument is less than the second, otherwise `false`. - -**Signature** - -```ts -export declare const lessThan: { (that: bigint): (self: bigint) => boolean; (self: bigint, that: bigint): boolean } -``` - -**Example** - -```ts -import { lessThan } from "effect/BigInt" - -assert.deepStrictEqual(lessThan(2n, 3n), true) -assert.deepStrictEqual(lessThan(3n, 3n), false) -assert.deepStrictEqual(lessThan(4n, 3n), false) -``` - -Added in v2.0.0 - -## lessThanOrEqualTo - -Returns a function that checks if a given `bigint` is less than or equal to the provided one. - -**Signature** - -```ts -export declare const lessThanOrEqualTo: { - (that: bigint): (self: bigint) => boolean - (self: bigint, that: bigint): boolean -} -``` - -**Example** - -```ts -import { lessThanOrEqualTo } from "effect/BigInt" - -assert.deepStrictEqual(lessThanOrEqualTo(2n, 3n), true) -assert.deepStrictEqual(lessThanOrEqualTo(3n, 3n), true) -assert.deepStrictEqual(lessThanOrEqualTo(4n, 3n), false) -``` - -Added in v2.0.0 - -# utils - -## clamp - -Restricts the given `bigint` to be within the range specified by the `minimum` and `maximum` values. - -- If the `bigint` is less than the `minimum` value, the function returns the `minimum` value. -- If the `bigint` is greater than the `maximum` value, the function returns the `maximum` value. -- Otherwise, it returns the original `bigint`. - -**Signature** - -```ts -export declare const clamp: { - (options: { minimum: bigint; maximum: bigint }): (self: bigint) => bigint - (self: bigint, options: { minimum: bigint; maximum: bigint }): bigint -} -``` - -**Example** - -```ts -import * as BigInt from "effect/BigInt" - -const clamp = BigInt.clamp({ minimum: 1n, maximum: 5n }) - -assert.equal(clamp(3n), 3n) -assert.equal(clamp(0n), 1n) -assert.equal(clamp(6n), 5n) -``` - -Added in v2.0.0 - -## max - -Returns the maximum between two `bigint`s. - -**Signature** - -```ts -export declare const max: { (that: bigint): (self: bigint) => bigint; (self: bigint, that: bigint): bigint } -``` - -**Example** - -```ts -import { max } from "effect/BigInt" - -assert.deepStrictEqual(max(2n, 3n), 3n) -``` - -Added in v2.0.0 - -## min - -Returns the minimum between two `bigint`s. - -**Signature** - -```ts -export declare const min: { (that: bigint): (self: bigint) => bigint; (self: bigint, that: bigint): bigint } -``` - -**Example** - -```ts -import { min } from "effect/BigInt" - -assert.deepStrictEqual(min(2n, 3n), 2n) -``` - -Added in v2.0.0 diff --git a/docs/modules/Boolean.ts.md b/docs/modules/Boolean.ts.md deleted file mode 100644 index 43901b767..000000000 --- a/docs/modules/Boolean.ts.md +++ /dev/null @@ -1,338 +0,0 @@ ---- -title: Boolean.ts -nav_order: 3 -parent: Modules ---- - -## Boolean overview - -This module provides utility functions and type class instances for working with the `boolean` type in TypeScript. -It includes functions for basic boolean operations, as well as type class instances for -`Equivalence` and `Order`. - -Added in v2.0.0 - ---- - -

Table of contents

- -- [combinators](#combinators) - - [and](#and) - - [eqv](#eqv) - - [implies](#implies) - - [nand](#nand) - - [nor](#nor) - - [not](#not) - - [or](#or) - - [xor](#xor) -- [guards](#guards) - - [isBoolean](#isboolean) -- [instances](#instances) - - [Equivalence](#equivalence) - - [Order](#order) -- [pattern matching](#pattern-matching) - - [match](#match) -- [utils](#utils) - - [every](#every) - - [some](#some) - ---- - -# combinators - -## and - -Combines two boolean using AND: `self && that`. - -**Signature** - -```ts -export declare const and: { (that: boolean): (self: boolean) => boolean; (self: boolean, that: boolean): boolean } -``` - -**Example** - -```ts -import { and } from "effect/Boolean" - -assert.deepStrictEqual(and(true, true), true) -assert.deepStrictEqual(and(true, false), false) -assert.deepStrictEqual(and(false, true), false) -assert.deepStrictEqual(and(false, false), false) -``` - -Added in v2.0.0 - -## eqv - -Combines two booleans using EQV (aka XNOR): `!xor(self, that)`. - -**Signature** - -```ts -export declare const eqv: { (that: boolean): (self: boolean) => boolean; (self: boolean, that: boolean): boolean } -``` - -**Example** - -```ts -import { eqv } from "effect/Boolean" - -assert.deepStrictEqual(eqv(true, true), true) -assert.deepStrictEqual(eqv(true, false), false) -assert.deepStrictEqual(eqv(false, true), false) -assert.deepStrictEqual(eqv(false, false), true) -``` - -Added in v2.0.0 - -## implies - -Combines two booleans using an implication: `(!self || that)`. - -**Signature** - -```ts -export declare const implies: { (that: boolean): (self: boolean) => boolean; (self: boolean, that: boolean): boolean } -``` - -**Example** - -```ts -import { implies } from "effect/Boolean" - -assert.deepStrictEqual(implies(true, true), true) -assert.deepStrictEqual(implies(true, false), false) -assert.deepStrictEqual(implies(false, true), true) -assert.deepStrictEqual(implies(false, false), true) -``` - -Added in v2.0.0 - -## nand - -Combines two boolean using NAND: `!(self && that)`. - -**Signature** - -```ts -export declare const nand: { (that: boolean): (self: boolean) => boolean; (self: boolean, that: boolean): boolean } -``` - -**Example** - -```ts -import { nand } from "effect/Boolean" - -assert.deepStrictEqual(nand(true, true), false) -assert.deepStrictEqual(nand(true, false), true) -assert.deepStrictEqual(nand(false, true), true) -assert.deepStrictEqual(nand(false, false), true) -``` - -Added in v2.0.0 - -## nor - -Combines two booleans using NOR: `!(self || that)`. - -**Signature** - -```ts -export declare const nor: { (that: boolean): (self: boolean) => boolean; (self: boolean, that: boolean): boolean } -``` - -**Example** - -```ts -import { nor } from "effect/Boolean" - -assert.deepStrictEqual(nor(true, true), false) -assert.deepStrictEqual(nor(true, false), false) -assert.deepStrictEqual(nor(false, true), false) -assert.deepStrictEqual(nor(false, false), true) -``` - -Added in v2.0.0 - -## not - -Negates the given boolean: `!self` - -**Signature** - -```ts -export declare const not: (self: boolean) => boolean -``` - -**Example** - -```ts -import { not } from "effect/Boolean" - -assert.deepStrictEqual(not(true), false) -assert.deepStrictEqual(not(false), true) -``` - -Added in v2.0.0 - -## or - -Combines two boolean using OR: `self || that`. - -**Signature** - -```ts -export declare const or: { (that: boolean): (self: boolean) => boolean; (self: boolean, that: boolean): boolean } -``` - -**Example** - -```ts -import { or } from "effect/Boolean" - -assert.deepStrictEqual(or(true, true), true) -assert.deepStrictEqual(or(true, false), true) -assert.deepStrictEqual(or(false, true), true) -assert.deepStrictEqual(or(false, false), false) -``` - -Added in v2.0.0 - -## xor - -Combines two booleans using XOR: `(!self && that) || (self && !that)`. - -**Signature** - -```ts -export declare const xor: { (that: boolean): (self: boolean) => boolean; (self: boolean, that: boolean): boolean } -``` - -**Example** - -```ts -import { xor } from "effect/Boolean" - -assert.deepStrictEqual(xor(true, true), false) -assert.deepStrictEqual(xor(true, false), true) -assert.deepStrictEqual(xor(false, true), true) -assert.deepStrictEqual(xor(false, false), false) -``` - -Added in v2.0.0 - -# guards - -## isBoolean - -Tests if a value is a `boolean`. - -**Signature** - -```ts -export declare const isBoolean: (input: unknown) => input is boolean -``` - -**Example** - -```ts -import { isBoolean } from "effect/Boolean" - -assert.deepStrictEqual(isBoolean(true), true) -assert.deepStrictEqual(isBoolean("true"), false) -``` - -Added in v2.0.0 - -# instances - -## Equivalence - -**Signature** - -```ts -export declare const Equivalence: equivalence.Equivalence -``` - -Added in v2.0.0 - -## Order - -**Signature** - -```ts -export declare const Order: order.Order -``` - -Added in v2.0.0 - -# pattern matching - -## match - -This function returns the result of either of the given functions depending on the value of the boolean parameter. -It is useful when you have to run one of two functions depending on the boolean value. - -**Signature** - -```ts -export declare const match: { - (options: { readonly onFalse: LazyArg; readonly onTrue: LazyArg }): (value: boolean) => A | B - (value: boolean, options: { readonly onFalse: LazyArg; readonly onTrue: LazyArg }): A | B -} -``` - -**Example** - -```ts -import * as B from "effect/Boolean" - -assert.deepStrictEqual(B.match(true, { onFalse: () => "It's false!", onTrue: () => "It's true!" }), "It's true!") -``` - -Added in v2.0.0 - -# utils - -## every - -This utility function is used to check if all the elements in a collection of boolean values are `true`. - -**Signature** - -```ts -export declare const every: (collection: Iterable) => boolean -``` - -**Example** - -```ts -import { every } from "effect/Boolean" - -assert.deepStrictEqual(every([true, true, true]), true) -assert.deepStrictEqual(every([true, false, true]), false) -``` - -Added in v2.0.0 - -## some - -This utility function is used to check if at least one of the elements in a collection of boolean values is `true`. - -**Signature** - -```ts -export declare const some: (collection: Iterable) => boolean -``` - -**Example** - -```ts -import { some } from "effect/Boolean" - -assert.deepStrictEqual(some([true, false, true]), true) -assert.deepStrictEqual(some([false, false, false]), false) -``` - -Added in v2.0.0 diff --git a/docs/modules/Brand.ts.md b/docs/modules/Brand.ts.md deleted file mode 100644 index 5fe47b1e1..000000000 --- a/docs/modules/Brand.ts.md +++ /dev/null @@ -1,387 +0,0 @@ ---- -title: Brand.ts -nav_order: 4 -parent: Modules ---- - -## Brand overview - -This module provides types and utility functions to create and work with branded types, -which are TypeScript types with an added type tag to prevent accidental usage of a value in the wrong context. - -The `refined` and `nominal` functions are both used to create branded types in TypeScript. -The main difference between them is that `refined` allows for validation of the data, while `nominal` does not. - -The `nominal` function is used to create a new branded type that has the same underlying type as the input, but with a different name. -This is useful when you want to distinguish between two values of the same type that have different meanings. -The `nominal` function does not perform any validation of the input data. - -On the other hand, the `refined` function is used to create a new branded type that has the same underlying type as the input, -but with a different name, and it also allows for validation of the input data. -The `refined` function takes a predicate that is used to validate the input data. -If the input data fails the validation, a `BrandErrors` is returned, which provides information about the specific validation failure. - -Added in v2.0.0 - ---- - -

Table of contents

- -- [alias](#alias) - - [Branded (type alias)](#branded-type-alias) -- [combining](#combining) - - [all](#all) -- [constructors](#constructors) - - [error](#error) - - [errors](#errors) - - [nominal](#nominal) - - [refined](#refined) -- [models](#models) - - [Brand (interface)](#brand-interface) -- [symbols](#symbols) - - [BrandTypeId](#brandtypeid) - - [BrandTypeId (type alias)](#brandtypeid-type-alias) - - [RefinedConstructorsTypeId](#refinedconstructorstypeid) - - [RefinedConstructorsTypeId (type alias)](#refinedconstructorstypeid-type-alias) -- [utils](#utils) - - [Brand (namespace)](#brand-namespace) - - [BrandErrors (interface)](#branderrors-interface) - - [Constructor (interface)](#constructor-interface) - - [RefinementError (interface)](#refinementerror-interface) - - [Brands (type alias)](#brands-type-alias) - - [EnsureCommonBase (type alias)](#ensurecommonbase-type-alias) - - [FromConstructor (type alias)](#fromconstructor-type-alias) - - [Unbranded (type alias)](#unbranded-type-alias) - ---- - -# alias - -## Branded (type alias) - -**Signature** - -```ts -export type Branded = A & Brand -``` - -Added in v2.0.0 - -# combining - -## all - -Combines two or more brands together to form a single branded type. -This API is useful when you want to validate that the input data passes multiple brand validators. - -**Signature** - -```ts -export declare const all: , ...Brand.Constructor[]]>( - ...brands: Brand.EnsureCommonBase -) => Brand.Constructor< - Types.UnionToIntersection<{ [B in keyof Brands]: Brand.FromConstructor }[number]> extends infer X extends - Brand - ? X - : Brand -> -``` - -**Example** - -```ts -import * as Brand from "effect/Brand" - -type Int = number & Brand.Brand<"Int"> -const Int = Brand.refined( - (n) => Number.isInteger(n), - (n) => Brand.error(`Expected ${n} to be an integer`) -) -type Positive = number & Brand.Brand<"Positive"> -const Positive = Brand.refined( - (n) => n > 0, - (n) => Brand.error(`Expected ${n} to be positive`) -) - -const PositiveInt = Brand.all(Int, Positive) - -assert.strictEqual(PositiveInt(1), 1) -assert.throws(() => PositiveInt(1.1)) -``` - -Added in v2.0.0 - -# constructors - -## error - -Returns a `BrandErrors` that contains a single `RefinementError`. - -**Signature** - -```ts -export declare const error: (message: string, meta?: unknown) => Brand.BrandErrors -``` - -Added in v2.0.0 - -## errors - -Takes a variable number of `BrandErrors` and returns a single `BrandErrors` that contains all refinement errors. - -**Signature** - -```ts -export declare const errors: (...errors: Array) => Brand.BrandErrors -``` - -Added in v2.0.0 - -## nominal - -This function returns a `Brand.Constructor` that **does not apply any runtime checks**, it just returns the provided value. -It can be used to create nominal types that allow distinguishing between two values of the same type but with different meanings. - -If you also want to perform some validation, see {@link refined}. - -**Signature** - -```ts -export declare const nominal:
>() => Brand.Constructor -``` - -**Example** - -```ts -import * as Brand from "effect/Brand" - -type UserId = number & Brand.Brand<"UserId"> - -const UserId = Brand.nominal() - -assert.strictEqual(UserId(1), 1) -``` - -Added in v2.0.0 - -## refined - -Returns a `Brand.Constructor` that can construct a branded type from an unbranded value using the provided `refinement` -predicate as validation of the input data. - -If you don't want to perform any validation but only distinguish between two values of the same type but with different meanings, -see {@link nominal}. - -**Signature** - -```ts -export declare const refined: >( - refinement: Predicate>, - onFailure: (a: Brand.Unbranded) => Brand.BrandErrors -) => Brand.Constructor -``` - -**Example** - -```ts -import * as Brand from "effect/Brand" - -type Int = number & Brand.Brand<"Int"> - -const Int = Brand.refined( - (n) => Number.isInteger(n), - (n) => Brand.error(`Expected ${n} to be an integer`) -) - -assert.strictEqual(Int(1), 1) -assert.throws(() => Int(1.1)) -``` - -Added in v2.0.0 - -# models - -## Brand (interface) - -A generic interface that defines a branded type. - -**Signature** - -```ts -export interface Brand { - readonly [BrandTypeId]: { - readonly [k in K]: K - } -} -``` - -Added in v2.0.0 - -# symbols - -## BrandTypeId - -**Signature** - -```ts -export declare const BrandTypeId: typeof BrandTypeId -``` - -Added in v2.0.0 - -## BrandTypeId (type alias) - -**Signature** - -```ts -export type BrandTypeId = typeof BrandTypeId -``` - -Added in v2.0.0 - -## RefinedConstructorsTypeId - -**Signature** - -```ts -export declare const RefinedConstructorsTypeId: typeof RefinedConstructorsTypeId -``` - -Added in v2.0.0 - -## RefinedConstructorsTypeId (type alias) - -**Signature** - -```ts -export type RefinedConstructorsTypeId = typeof RefinedConstructorsTypeId -``` - -Added in v2.0.0 - -# utils - -## Brand (namespace) - -Added in v2.0.0 - -### BrandErrors (interface) - -Represents a list of refinement errors. - -**Signature** - -```ts -export interface BrandErrors extends ReadonlyArray {} -``` - -Added in v2.0.0 - -### Constructor (interface) - -**Signature** - -```ts -export interface Constructor> { - readonly [RefinedConstructorsTypeId]: RefinedConstructorsTypeId - /** - * Constructs a branded type from a value of type `A`, throwing an error if - * the provided `A` is not valid. - */ - (args: Brand.Unbranded): A - /** - * Constructs a branded type from a value of type `A`, returning `Some` - * if the provided `A` is valid, `None` otherwise. - */ - readonly option: (args: Brand.Unbranded) => Option.Option - /** - * Constructs a branded type from a value of type `A`, returning `Right` - * if the provided `A` is valid, `Left` otherwise. - */ - readonly either: (args: Brand.Unbranded) => Either.Either - /** - * Attempts to refine the provided value of type `A`, returning `true` if - * the provided `A` is valid, `false` otherwise. - */ - readonly is: Refinement, Brand.Unbranded & A> -} -``` - -Added in v2.0.0 - -### RefinementError (interface) - -Represents an error that occurs when the provided value of the branded type does not pass the refinement predicate. - -**Signature** - -```ts -export interface RefinementError { - readonly meta: unknown - readonly message: string -} -``` - -Added in v2.0.0 - -### Brands (type alias) - -A utility type to extract the brands from a branded type. - -**Signature** - -```ts -export type Brands

= P extends Brand - ? Types.UnionToIntersection< - { - [k in keyof P[BrandTypeId]]: k extends string | symbol ? Brand : never - }[keyof P[BrandTypeId]] - > - : never -``` - -Added in v2.0.0 - -### EnsureCommonBase (type alias) - -A utility type that checks that all brands have the same base type. - -**Signature** - -```ts -export type EnsureCommonBase, ...Array>]> = { - [B in keyof Brands]: Brand.Unbranded> extends Brand.Unbranded< - Brand.FromConstructor - > - ? Brand.Unbranded> extends Brand.Unbranded> - ? Brands[B] - : Brands[B] - : "ERROR: All brands should have the same base type" -} -``` - -Added in v2.0.0 - -### FromConstructor (type alias) - -A utility type to extract a branded type from a `Brand.Constructor`. - -**Signature** - -```ts -export type FromConstructor = A extends Brand.Constructor ? B : never -``` - -Added in v2.0.0 - -### Unbranded (type alias) - -A utility type to extract the value type from a brand. - -**Signature** - -```ts -export type Unbranded

= P extends infer Q & Brands

? Q : P -``` - -Added in v2.0.0 diff --git a/docs/modules/Cache.ts.md b/docs/modules/Cache.ts.md deleted file mode 100644 index 7436922a0..000000000 --- a/docs/modules/Cache.ts.md +++ /dev/null @@ -1,323 +0,0 @@ ---- -title: Cache.ts -nav_order: 5 -parent: Modules ---- - -## Cache overview - -Added in v2.0.0 - ---- - -

Table of contents

- -- [constructors](#constructors) - - [make](#make) - - [makeCacheStats](#makecachestats) - - [makeEntryStats](#makeentrystats) - - [makeWith](#makewith) -- [models](#models) - - [Cache (interface)](#cache-interface) - - [CacheStats (interface)](#cachestats-interface) - - [ConsumerCache (interface)](#consumercache-interface) - - [EntryStats (interface)](#entrystats-interface) - - [Lookup (type alias)](#lookup-type-alias) -- [symbols](#symbols) - - [CacheTypeId](#cachetypeid) - - [CacheTypeId (type alias)](#cachetypeid-type-alias) -- [utils](#utils) - - [Cache (namespace)](#cache-namespace) - - [Variance (interface)](#variance-interface) - ---- - -# constructors - -## make - -Constructs a new cache with the specified capacity, time to live, and -lookup function. - -**Signature** - -```ts -export declare const make: (options: { - readonly capacity: number - readonly timeToLive: Duration.DurationInput - readonly lookup: Lookup -}) => Effect.Effect> -``` - -Added in v2.0.0 - -## makeCacheStats - -Constructs a new `CacheStats` from the specified values. - -**Signature** - -```ts -export declare const makeCacheStats: (options: { - readonly hits: number - readonly misses: number - readonly size: number -}) => CacheStats -``` - -Added in v2.0.0 - -## makeEntryStats - -Constructs a new `EntryStats` from the specified values. - -**Signature** - -```ts -export declare const makeEntryStats: (loadedMillis: number) => EntryStats -``` - -Added in v2.0.0 - -## makeWith - -Constructs a new cache with the specified capacity, time to live, and -lookup function, where the time to live can depend on the `Exit` value -returned by the lookup function. - -**Signature** - -```ts -export declare const makeWith: (options: { - readonly capacity: number - readonly lookup: Lookup - readonly timeToLive: (exit: Exit.Exit) => Duration.DurationInput -}) => Effect.Effect> -``` - -Added in v2.0.0 - -# models - -## Cache (interface) - -A `Cache` is defined in terms of a lookup function that, given a key of -type `Key`, can either fail with an error of type `Error` or succeed with a -value of type `Value`. Getting a value from the cache will either return -the previous result of the lookup function if it is available or else -compute a new result with the lookup function, put it in the cache, and -return it. - -A cache also has a specified capacity and time to live. When the cache is -at capacity the least recently accessed values in the cache will be -removed to make room for new values. Getting a value with a life older than -the specified time to live will result in a new value being computed with -the lookup function and returned when available. - -The cache is safe for concurrent access. If multiple fibers attempt to get -the same key the lookup function will only be computed once and the result -will be returned to all fibers. - -**Signature** - -```ts -export interface Cache extends ConsumerCache { - /** - * Retrieves the value associated with the specified key if it exists. - * Otherwise computes the value with the lookup function, puts it in the - * cache, and returns it. - */ - readonly get: (key: Key) => Effect.Effect - - /** - * Retrieves the value associated with the specified key if it exists as a left. - * Otherwise computes the value with the lookup function, puts it in the - * cache, and returns it as a right. - */ - readonly getEither: (key: Key) => Effect.Effect> - - /** - * Computes the value associated with the specified key, with the lookup - * function, and puts it in the cache. The difference between this and - * `get` method is that `refresh` triggers (re)computation of the value - * without invalidating it in the cache, so any request to the associated - * key can still be served while the value is being re-computed/retrieved - * by the lookup function. Additionally, `refresh` always triggers the - * lookup function, disregarding the last `Error`. - */ - readonly refresh: (key: Key) => Effect.Effect - - /** - * Associates the specified value with the specified key in the cache. - */ - readonly set: (key: Key, value: Value) => Effect.Effect -} -``` - -Added in v2.0.0 - -## CacheStats (interface) - -`CacheStats` represents a snapshot of statistics for the cache as of a -point in time. - -**Signature** - -```ts -export interface CacheStats { - readonly hits: number - readonly misses: number - readonly size: number -} -``` - -Added in v2.0.0 - -## ConsumerCache (interface) - -A ConsumerCache models a portion of a cache which is safe to share without allowing to create new values or access existing ones. - -It can be used safely to give over control for request management without leaking writer side details. - -**Signature** - -```ts -export interface ConsumerCache extends Cache.Variance { - /** - * Retrieves the value associated with the specified key if it exists. - * Otherwise returns `Option.none`. - */ - readonly getOption: (key: Key) => Effect.Effect> - - /** - * Retrieves the value associated with the specified key if it exists and the - * lookup function has completed. Otherwise returns `Option.none`. - */ - readonly getOptionComplete: (key: Key) => Effect.Effect> - - /** - * Returns statistics for this cache. - */ - readonly cacheStats: Effect.Effect - - /** - * Returns whether a value associated with the specified key exists in the - * cache. - */ - readonly contains: (key: Key) => Effect.Effect - - /** - * Returns statistics for the specified entry. - */ - readonly entryStats: (key: Key) => Effect.Effect> - - /** - * Invalidates the value associated with the specified key. - */ - readonly invalidate: (key: Key) => Effect.Effect - - /** - * Invalidates the value associated with the specified key if the predicate holds. - */ - readonly invalidateWhen: (key: Key, when: (value: Value) => boolean) => Effect.Effect - - /** - * Invalidates all values in the cache. - */ - readonly invalidateAll: Effect.Effect - - /** - * Returns the approximate number of values in the cache. - */ - readonly size: Effect.Effect - - /** - * Returns an approximation of the values in the cache. - */ - readonly keys: Effect.Effect> - - /** - * Returns an approximation of the values in the cache. - */ - readonly values: Effect.Effect> - - /** - * Returns an approximation of the values in the cache. - */ - readonly entries: Effect.Effect> -} -``` - -Added in v2.0.0 - -## EntryStats (interface) - -Represents a snapshot of statistics for an entry in the cache. - -**Signature** - -```ts -export interface EntryStats { - readonly loadedMillis: number -} -``` - -Added in v2.0.0 - -## Lookup (type alias) - -A `Lookup` represents a lookup function that, given a key of type `Key`, can -return an effect that will either produce a value of type `Value` or fail -with an error of type `Error` using an environment of type `Environment`. - -**Signature** - -```ts -export type Lookup = (key: Key) => Effect.Effect -``` - -Added in v2.0.0 - -# symbols - -## CacheTypeId - -**Signature** - -```ts -export declare const CacheTypeId: typeof CacheTypeId -``` - -Added in v2.0.0 - -## CacheTypeId (type alias) - -**Signature** - -```ts -export type CacheTypeId = typeof CacheTypeId -``` - -Added in v2.0.0 - -# utils - -## Cache (namespace) - -Added in v2.0.0 - -### Variance (interface) - -**Signature** - -```ts -export interface Variance { - readonly [CacheTypeId]: { - readonly _Key: (_: Key) => void - readonly _Error: (_: never) => Error - readonly _Value: (_: never) => Value - } -} -``` - -Added in v2.0.0 diff --git a/docs/modules/Cause.ts.md b/docs/modules/Cause.ts.md deleted file mode 100644 index 56836aab9..000000000 --- a/docs/modules/Cause.ts.md +++ /dev/null @@ -1,1241 +0,0 @@ ---- -title: Cause.ts -nav_order: 6 -parent: Modules ---- - -## Cause overview - -The `Effect` type is polymorphic in values of type `E` and we can -work with any error type that we want. However, there is a lot of information -that is not inside an arbitrary `E` value. So as a result, an `Effect` needs -somewhere to store things like unexpected errors or defects, stack and -execution traces, causes of fiber interruptions, and so forth. - -Effect-TS is very strict about preserving the full information related to a -failure. It captures all type of errors into the `Cause` data type. `Effect` -uses the `Cause` data type to store the full story of failure. So its -error model is lossless. It doesn't throw information related to the failure -result. So we can figure out exactly what happened during the operation of -our effects. - -It is important to note that `Cause` is an underlying data type representing -errors occuring within an `Effect` workflow. Thus, we don't usually deal with -`Cause`s directly. Even though it is not a data type that we deal with very -often, the `Cause` of a failing `Effect` workflow can be accessed at any -time, which gives us total access to all parallel and sequential errors in -occurring within our codebase. - -Added in v2.0.0 - ---- - -

Table of contents

- -- [constructors](#constructors) - - [die](#die) - - [empty](#empty) - - [fail](#fail) - - [interrupt](#interrupt) - - [parallel](#parallel) - - [sequential](#sequential) -- [destructors](#destructors) - - [squash](#squash) - - [squashWith](#squashwith) -- [elements](#elements) - - [contains](#contains) - - [find](#find) -- [errors](#errors) - - [IllegalArgumentException](#illegalargumentexception) - - [InterruptedException](#interruptedexception) - - [NoSuchElementException](#nosuchelementexception) - - [RuntimeException](#runtimeexception) - - [originalError](#originalerror) -- [filtering](#filtering) - - [filter](#filter) -- [folding](#folding) - - [match](#match) - - [reduce](#reduce) - - [reduceWithContext](#reducewithcontext) -- [getters](#getters) - - [defects](#defects) - - [dieOption](#dieoption) - - [failureOption](#failureoption) - - [failureOrCause](#failureorcause) - - [failures](#failures) - - [flipCauseOption](#flipcauseoption) - - [interruptOption](#interruptoption) - - [interruptors](#interruptors) - - [isDie](#isdie) - - [isEmpty](#isempty) - - [isFailure](#isfailure) - - [isInterrupted](#isinterrupted) - - [isInterruptedOnly](#isinterruptedonly) - - [keepDefects](#keepdefects) - - [linearize](#linearize) - - [size](#size) - - [stripFailures](#stripfailures) - - [stripSomeDefects](#stripsomedefects) -- [mapping](#mapping) - - [as](#as) - - [map](#map) -- [models](#models) - - [Cause (type alias)](#cause-type-alias) - - [CauseReducer (interface)](#causereducer-interface) - - [Die (interface)](#die-interface) - - [Empty (interface)](#empty-interface) - - [Fail (interface)](#fail-interface) - - [IllegalArgumentException (interface)](#illegalargumentexception-interface) - - [Interrupt (interface)](#interrupt-interface) - - [InterruptedException (interface)](#interruptedexception-interface) - - [InvalidPubSubCapacityException (interface)](#invalidpubsubcapacityexception-interface) - - [NoSuchElementException (interface)](#nosuchelementexception-interface) - - [Parallel (interface)](#parallel-interface) - - [RuntimeException (interface)](#runtimeexception-interface) - - [Sequential (interface)](#sequential-interface) -- [refinements](#refinements) - - [isCause](#iscause) - - [isDieType](#isdietype) - - [isEmptyType](#isemptytype) - - [isFailType](#isfailtype) - - [isIllegalArgumentException](#isillegalargumentexception) - - [isInterruptType](#isinterrupttype) - - [isInterruptedException](#isinterruptedexception) - - [isNoSuchElementException](#isnosuchelementexception) - - [isParallelType](#isparalleltype) - - [isRuntimeException](#isruntimeexception) - - [isSequentialType](#issequentialtype) -- [rendering](#rendering) - - [pretty](#pretty) -- [sequencing](#sequencing) - - [flatMap](#flatmap) - - [flatten](#flatten) -- [symbols](#symbols) - - [CauseTypeId](#causetypeid) - - [CauseTypeId (type alias)](#causetypeid-type-alias) - - [IllegalArgumentExceptionTypeId](#illegalargumentexceptiontypeid) - - [IllegalArgumentExceptionTypeId (type alias)](#illegalargumentexceptiontypeid-type-alias) - - [InterruptedExceptionTypeId](#interruptedexceptiontypeid) - - [InterruptedExceptionTypeId (type alias)](#interruptedexceptiontypeid-type-alias) - - [InvalidPubSubCapacityExceptionTypeId](#invalidpubsubcapacityexceptiontypeid) - - [InvalidPubSubCapacityExceptionTypeId (type alias)](#invalidpubsubcapacityexceptiontypeid-type-alias) - - [NoSuchElementExceptionTypeId](#nosuchelementexceptiontypeid) - - [NoSuchElementExceptionTypeId (type alias)](#nosuchelementexceptiontypeid-type-alias) - - [RuntimeExceptionTypeId](#runtimeexceptiontypeid) - - [RuntimeExceptionTypeId (type alias)](#runtimeexceptiontypeid-type-alias) -- [utils](#utils) - - [Cause (namespace)](#cause-namespace) - - [Variance (interface)](#variance-interface) - ---- - -# constructors - -## die - -Constructs a new `Die` cause from the specified `defect`. - -**Signature** - -```ts -export declare const die: (defect: unknown) => Cause -``` - -Added in v2.0.0 - -## empty - -Constructs a new `Empty` cause. - -**Signature** - -```ts -export declare const empty: Cause -``` - -Added in v2.0.0 - -## fail - -Constructs a new `Fail` cause from the specified `error`. - -**Signature** - -```ts -export declare const fail: (error: E) => Cause -``` - -Added in v2.0.0 - -## interrupt - -Constructs a new `Interrupt` cause from the specified `fiberId`. - -**Signature** - -```ts -export declare const interrupt: (fiberId: FiberId.FiberId) => Cause -``` - -Added in v2.0.0 - -## parallel - -Constructs a new `Parallel` cause from the specified `left` and `right` -causes. - -**Signature** - -```ts -export declare const parallel: (left: Cause, right: Cause) => Cause -``` - -Added in v2.0.0 - -## sequential - -Constructs a new `Sequential` cause from the specified pecified `left` and -`right` causes. - -**Signature** - -```ts -export declare const sequential: (left: Cause, right: Cause) => Cause -``` - -Added in v2.0.0 - -# destructors - -## squash - -Squashes a `Cause` down to a single defect, chosen to be the "most important" -defect. - -**Signature** - -```ts -export declare const squash: (self: Cause) => unknown -``` - -Added in v2.0.0 - -## squashWith - -Squashes a `Cause` down to a single defect, chosen to be the "most important" -defect. If a recoverable error is found, the provided function will be used -to map the error a defect, and the resulting value will be returned. - -**Signature** - -```ts -export declare const squashWith: { - (f: (error: E) => unknown): (self: Cause) => unknown - (self: Cause, f: (error: E) => unknown): unknown -} -``` - -Added in v2.0.0 - -# elements - -## contains - -Returns `true` if the `self` cause contains or is equal to `that` cause, -`false` otherwise. - -**Signature** - -```ts -export declare const contains: { - (that: Cause): (self: Cause) => boolean - (self: Cause, that: Cause): boolean -} -``` - -Added in v2.0.0 - -## find - -Uses the provided partial function to search the specified cause and attempt -to extract information from it. - -**Signature** - -```ts -export declare const find: { - (pf: (cause: Cause) => Option.Option): (self: Cause) => Option.Option - (self: Cause, pf: (cause: Cause) => Option.Option): Option.Option -} -``` - -Added in v2.0.0 - -# errors - -## IllegalArgumentException - -Represents a checked exception which occurs when an invalid argument is -provided to a method. - -**Signature** - -```ts -export declare const IllegalArgumentException: (message?: string) => IllegalArgumentException -``` - -Added in v2.0.0 - -## InterruptedException - -Represents a checked exception which occurs when a `Fiber` is interrupted. - -**Signature** - -```ts -export declare const InterruptedException: (message?: string) => InterruptedException -``` - -Added in v2.0.0 - -## NoSuchElementException - -Represents a checked exception which occurs when an expected element was -unable to be found. - -**Signature** - -```ts -export declare const NoSuchElementException: (message?: string) => NoSuchElementException -``` - -Added in v2.0.0 - -## RuntimeException - -Represents a generic checked exception which occurs at runtime. - -**Signature** - -```ts -export declare const RuntimeException: (message?: string) => RuntimeException -``` - -Added in v2.0.0 - -## originalError - -Returns the original, unproxied, instance of a thrown error - -**Signature** - -```ts -export declare const originalError: (obj: E) => E -``` - -Added in v2.0.0 - -# filtering - -## filter - -Filters causes which match the provided predicate out of the specified cause. - -**Signature** - -```ts -export declare const filter: { - (predicate: Predicate>): (self: Cause) => Cause - (self: Cause, predicate: Predicate>): Cause -} -``` - -Added in v2.0.0 - -# folding - -## match - -Folds the specified cause into a value of type `Z`. - -**Signature** - -```ts -export declare const match: { - (options: { - readonly onEmpty: Z - readonly onFail: (error: E) => Z - readonly onDie: (defect: unknown) => Z - readonly onInterrupt: (fiberId: FiberId.FiberId) => Z - readonly onSequential: (left: Z, right: Z) => Z - readonly onParallel: (left: Z, right: Z) => Z - }): (self: Cause) => Z - ( - self: Cause, - options: { - readonly onEmpty: Z - readonly onFail: (error: E) => Z - readonly onDie: (defect: unknown) => Z - readonly onInterrupt: (fiberId: FiberId.FiberId) => Z - readonly onSequential: (left: Z, right: Z) => Z - readonly onParallel: (left: Z, right: Z) => Z - } - ): Z -} -``` - -Added in v2.0.0 - -## reduce - -Reduces the specified cause into a value of type `Z`, beginning with the -provided `zero` value. - -**Signature** - -```ts -export declare const reduce: { - (zero: Z, pf: (accumulator: Z, cause: Cause) => Option.Option): (self: Cause) => Z - (self: Cause, zero: Z, pf: (accumulator: Z, cause: Cause) => Option.Option): Z -} -``` - -Added in v2.0.0 - -## reduceWithContext - -Reduces the specified cause into a value of type `Z` using a `Cause.Reducer`. -Also allows for accessing the provided context during reduction. - -**Signature** - -```ts -export declare const reduceWithContext: { - (context: C, reducer: CauseReducer): (self: Cause) => Z - (self: Cause, context: C, reducer: CauseReducer): Z -} -``` - -Added in v2.0.0 - -# getters - -## defects - -Returns a `List` of all unrecoverable defects in the specified cause. - -**Signature** - -```ts -export declare const defects: (self: Cause) => Chunk.Chunk -``` - -Added in v2.0.0 - -## dieOption - -Returns the defect associated with the first `Die` in this `Cause`, if one -exists. - -**Signature** - -```ts -export declare const dieOption: (self: Cause) => Option.Option -``` - -Added in v2.0.0 - -## failureOption - -Returns the `E` associated with the first `Fail` in this `Cause`, if one -exists. - -**Signature** - -```ts -export declare const failureOption: (self: Cause) => Option.Option -``` - -Added in v2.0.0 - -## failureOrCause - -Returns the first checked error on the `Left` if available, if there are -no checked errors return the rest of the `Cause` that is known to contain -only `Die` or `Interrupt` causes. - -**Signature** - -```ts -export declare const failureOrCause: (self: Cause) => Either.Either> -``` - -Added in v2.0.0 - -## failures - -Returns a `List` of all recoverable errors of type `E` in the specified -cause. - -**Signature** - -```ts -export declare const failures: (self: Cause) => Chunk.Chunk -``` - -Added in v2.0.0 - -## flipCauseOption - -Converts the specified `Cause>` to an `Option>` by -recursively stripping out any failures with the error `None`. - -**Signature** - -```ts -export declare const flipCauseOption: (self: Cause>) => Option.Option> -``` - -Added in v2.0.0 - -## interruptOption - -Returns the `FiberId` associated with the first `Interrupt` in the specified -cause, if one exists. - -**Signature** - -```ts -export declare const interruptOption: (self: Cause) => Option.Option -``` - -Added in v2.0.0 - -## interruptors - -Returns a `HashSet` of `FiberId`s for all fibers that interrupted the fiber -described by the specified cause. - -**Signature** - -```ts -export declare const interruptors: (self: Cause) => HashSet.HashSet -``` - -Added in v2.0.0 - -## isDie - -Returns `true` if the specified cause contains a defect, `false` otherwise. - -**Signature** - -```ts -export declare const isDie: (self: Cause) => boolean -``` - -Added in v2.0.0 - -## isEmpty - -Returns `true` if the specified cause is empty, `false` otherwise. - -**Signature** - -```ts -export declare const isEmpty: (self: Cause) => boolean -``` - -Added in v2.0.0 - -## isFailure - -Returns `true` if the specified cause contains a failure, `false` otherwise. - -**Signature** - -```ts -export declare const isFailure: (self: Cause) => boolean -``` - -Added in v2.0.0 - -## isInterrupted - -Returns `true` if the specified cause contains an interruption, `false` -otherwise. - -**Signature** - -```ts -export declare const isInterrupted: (self: Cause) => boolean -``` - -Added in v2.0.0 - -## isInterruptedOnly - -Returns `true` if the specified cause contains only interruptions (without -any `Die` or `Fail` causes), `false` otherwise. - -**Signature** - -```ts -export declare const isInterruptedOnly: (self: Cause) => boolean -``` - -Added in v2.0.0 - -## keepDefects - -Remove all `Fail` and `Interrupt` nodes from the specified cause, and return -a cause containing only `Die` cause/finalizer defects. - -**Signature** - -```ts -export declare const keepDefects: (self: Cause) => Option.Option> -``` - -Added in v2.0.0 - -## linearize - -Linearizes the specified cause into a `HashSet` of parallel causes where each -parallel cause contains a linear sequence of failures. - -**Signature** - -```ts -export declare const linearize: (self: Cause) => HashSet.HashSet> -``` - -Added in v2.0.0 - -## size - -Returns the size of the cause, calculated as the number of individual `Cause` -nodes found in the `Cause` semiring structure. - -**Signature** - -```ts -export declare const size: (self: Cause) => number -``` - -Added in v2.0.0 - -## stripFailures - -Remove all `Fail` and `Interrupt` nodes from the specified cause, and return -a cause containing only `Die` cause/finalizer defects. - -**Signature** - -```ts -export declare const stripFailures: (self: Cause) => Cause -``` - -Added in v2.0.0 - -## stripSomeDefects - -Remove all `Die` causes that the specified partial function is defined at, -returning `Some` with the remaining causes or `None` if there are no -remaining causes. - -**Signature** - -```ts -export declare const stripSomeDefects: { - (pf: (defect: unknown) => Option.Option): (self: Cause) => Option.Option> - (self: Cause, pf: (defect: unknown) => Option.Option): Option.Option> -} -``` - -Added in v2.0.0 - -# mapping - -## as - -**Signature** - -```ts -export declare const as: { - (error: E2): (self: Cause) => Cause - (self: Cause, error: E2): Cause -} -``` - -Added in v2.0.0 - -## map - -**Signature** - -```ts -export declare const map: { - (f: (e: E) => E2): (self: Cause) => Cause - (self: Cause, f: (e: E) => E2): Cause -} -``` - -Added in v2.0.0 - -# models - -## Cause (type alias) - -A `Cause` represents the full history of a failure resulting from running an -`Effect` workflow. - -Effect-TS uses a data structure from functional programming called a semiring -to represent the `Cause` data type. This allows us to take a base type `E` -(which represents the error type of an `Effect`) and capture the sequential -and parallel composition of errors in a fully lossless fashion. - -**Signature** - -```ts -export type Cause = Empty | Fail | Die | Interrupt | Sequential | Parallel -``` - -Added in v2.0.0 - -## CauseReducer (interface) - -Represents a set of methods that can be used to reduce a `Cause` to a -specified value of type `Z` with access to a context of type `C`. - -**Signature** - -```ts -export interface CauseReducer { - readonly emptyCase: (context: C) => Z - readonly failCase: (context: C, error: E) => Z - readonly dieCase: (context: C, defect: unknown) => Z - readonly interruptCase: (context: C, fiberId: FiberId.FiberId) => Z - readonly sequentialCase: (context: C, left: Z, right: Z) => Z - readonly parallelCase: (context: C, left: Z, right: Z) => Z -} -``` - -Added in v2.0.0 - -## Die (interface) - -The `Die` cause represents a `Cause` which failed as a result of a defect, or -in other words, an unexpected error. - -type `E`. - -**Signature** - -```ts -export interface Die extends Cause.Variance, Equal.Equal, Pipeable, Inspectable { - readonly _tag: "Die" - readonly defect: unknown -} -``` - -Added in v2.0.0 - -## Empty (interface) - -The `Empty` cause represents a lack of errors. - -**Signature** - -```ts -export interface Empty extends Cause.Variance, Equal.Equal, Pipeable, Inspectable { - readonly _tag: "Empty" -} -``` - -Added in v2.0.0 - -## Fail (interface) - -The `Fail` cause represents a `Cause` which failed with an expected error of -type `E`. - -**Signature** - -```ts -export interface Fail extends Cause.Variance, Equal.Equal, Pipeable, Inspectable { - readonly _tag: "Fail" - readonly error: E -} -``` - -Added in v2.0.0 - -## IllegalArgumentException (interface) - -Represents a checked exception which occurs when an invalid argument is -provided to a method. - -**Signature** - -```ts -export interface IllegalArgumentException { - readonly _tag: "IllegalArgumentException" - readonly [IllegalArgumentExceptionTypeId]: IllegalArgumentExceptionTypeId - readonly message?: string -} -``` - -Added in v2.0.0 - -## Interrupt (interface) - -The `Interrupt` cause represents failure due to `Fiber` interruption, which -contains the `FiberId` of the interrupted `Fiber`. - -**Signature** - -```ts -export interface Interrupt extends Cause.Variance, Equal.Equal, Pipeable, Inspectable { - readonly _tag: "Interrupt" - readonly fiberId: FiberId.FiberId -} -``` - -Added in v2.0.0 - -## InterruptedException (interface) - -Represents a checked exception which occurs when a `Fiber` is interrupted. - -**Signature** - -```ts -export interface InterruptedException { - readonly _tag: "InterruptedException" - readonly [InterruptedExceptionTypeId]: InterruptedExceptionTypeId - readonly message?: string -} -``` - -Added in v2.0.0 - -## InvalidPubSubCapacityException (interface) - -Represents a checked exception which occurs when attempting to construct a -`PubSub` with an invalid capacity. - -**Signature** - -```ts -export interface InvalidPubSubCapacityException { - readonly _tag: "InvalidPubSubCapacityException" - readonly [InvalidPubSubCapacityExceptionTypeId]: InvalidPubSubCapacityExceptionTypeId - readonly message?: string -} -``` - -Added in v2.0.0 - -## NoSuchElementException (interface) - -Represents a checked exception which occurs when an expected element was -unable to be found. - -**Signature** - -```ts -export interface NoSuchElementException { - readonly _tag: "NoSuchElementException" - readonly [NoSuchElementExceptionTypeId]: NoSuchElementExceptionTypeId - readonly message?: string -} -``` - -Added in v2.0.0 - -## Parallel (interface) - -The `Parallel` cause represents the composition of two causes which occurred -in parallel. - -In Effect-TS programs, it is possible that two operations may be performed in -parallel. In these cases, the `Effect` workflow can fail for more than one -reason. If both computations fail, then there are actually two errors which -occurred in parallel. In these cases, the errors can be represented by the -`Parallel` cause. - -**Signature** - -```ts -export interface Parallel extends Cause.Variance, Equal.Equal, Pipeable, Inspectable { - readonly _tag: "Parallel" - readonly left: Cause - readonly right: Cause -} -``` - -Added in v2.0.0 - -## RuntimeException (interface) - -Represents a generic checked exception which occurs at runtime. - -**Signature** - -```ts -export interface RuntimeException { - readonly _tag: "RuntimeException" - readonly [RuntimeExceptionTypeId]: RuntimeExceptionTypeId - readonly message?: string -} -``` - -Added in v2.0.0 - -## Sequential (interface) - -The `Sequential` cause represents the composition of two causes which occurred -sequentially. - -For example, if we perform Effect-TS's analog of `try-finally` (i.e. -`Effect.ensuring`), and both the `try` and `finally` blocks fail, we have two -errors which occurred sequentially. In these cases, the errors can be -represented by the `Sequential` cause. - -**Signature** - -```ts -export interface Sequential extends Cause.Variance, Equal.Equal, Pipeable, Inspectable { - readonly _tag: "Sequential" - readonly left: Cause - readonly right: Cause -} -``` - -Added in v2.0.0 - -# refinements - -## isCause - -Returns `true` if the specified value is a `Cause`, `false` otherwise. - -**Signature** - -```ts -export declare const isCause: (u: unknown) => u is Cause -``` - -Added in v2.0.0 - -## isDieType - -Returns `true` if the specified `Cause` is a `Die` type, `false` -otherwise. - -**Signature** - -```ts -export declare const isDieType: (self: Cause) => self is Die -``` - -Added in v2.0.0 - -## isEmptyType - -Returns `true` if the specified `Cause` is an `Empty` type, `false` -otherwise. - -**Signature** - -```ts -export declare const isEmptyType: (self: Cause) => self is Empty -``` - -Added in v2.0.0 - -## isFailType - -Returns `true` if the specified `Cause` is a `Fail` type, `false` -otherwise. - -**Signature** - -```ts -export declare const isFailType: (self: Cause) => self is Fail -``` - -Added in v2.0.0 - -## isIllegalArgumentException - -Returns `true` if the specified value is an `IllegalArgumentException`, `false` -otherwise. - -**Signature** - -```ts -export declare const isIllegalArgumentException: (u: unknown) => u is IllegalArgumentException -``` - -Added in v2.0.0 - -## isInterruptType - -Returns `true` if the specified `Cause` is an `Interrupt` type, `false` -otherwise. - -**Signature** - -```ts -export declare const isInterruptType: (self: Cause) => self is Interrupt -``` - -Added in v2.0.0 - -## isInterruptedException - -Returns `true` if the specified value is an `InterruptedException`, `false` -otherwise. - -**Signature** - -```ts -export declare const isInterruptedException: (u: unknown) => u is InterruptedException -``` - -Added in v2.0.0 - -## isNoSuchElementException - -Returns `true` if the specified value is an `NoSuchElementException`, `false` -otherwise. - -**Signature** - -```ts -export declare const isNoSuchElementException: (u: unknown) => u is NoSuchElementException -``` - -Added in v2.0.0 - -## isParallelType - -Returns `true` if the specified `Cause` is a `Parallel` type, `false` -otherwise. - -**Signature** - -```ts -export declare const isParallelType: (self: Cause) => self is Parallel -``` - -Added in v2.0.0 - -## isRuntimeException - -Returns `true` if the specified value is an `RuntimeException`, `false` -otherwise. - -**Signature** - -```ts -export declare const isRuntimeException: (u: unknown) => u is RuntimeException -``` - -Added in v2.0.0 - -## isSequentialType - -Returns `true` if the specified `Cause` is a `Sequential` type, `false` -otherwise. - -**Signature** - -```ts -export declare const isSequentialType: (self: Cause) => self is Sequential -``` - -Added in v2.0.0 - -# rendering - -## pretty - -Returns the specified `Cause` as a pretty-printed string. - -**Signature** - -```ts -export declare const pretty: (cause: Cause) => string -``` - -Added in v2.0.0 - -# sequencing - -## flatMap - -**Signature** - -```ts -export declare const flatMap: { - (f: (e: E) => Cause): (self: Cause) => Cause - (self: Cause, f: (e: E) => Cause): Cause -} -``` - -Added in v2.0.0 - -## flatten - -**Signature** - -```ts -export declare const flatten: (self: Cause>) => Cause -``` - -Added in v2.0.0 - -# symbols - -## CauseTypeId - -**Signature** - -```ts -export declare const CauseTypeId: typeof CauseTypeId -``` - -Added in v2.0.0 - -## CauseTypeId (type alias) - -**Signature** - -```ts -export type CauseTypeId = typeof CauseTypeId -``` - -Added in v2.0.0 - -## IllegalArgumentExceptionTypeId - -**Signature** - -```ts -export declare const IllegalArgumentExceptionTypeId: typeof IllegalArgumentExceptionTypeId -``` - -Added in v2.0.0 - -## IllegalArgumentExceptionTypeId (type alias) - -**Signature** - -```ts -export type IllegalArgumentExceptionTypeId = typeof IllegalArgumentExceptionTypeId -``` - -Added in v2.0.0 - -## InterruptedExceptionTypeId - -**Signature** - -```ts -export declare const InterruptedExceptionTypeId: typeof InterruptedExceptionTypeId -``` - -Added in v2.0.0 - -## InterruptedExceptionTypeId (type alias) - -**Signature** - -```ts -export type InterruptedExceptionTypeId = typeof InterruptedExceptionTypeId -``` - -Added in v2.0.0 - -## InvalidPubSubCapacityExceptionTypeId - -**Signature** - -```ts -export declare const InvalidPubSubCapacityExceptionTypeId: typeof InvalidPubSubCapacityExceptionTypeId -``` - -Added in v2.0.0 - -## InvalidPubSubCapacityExceptionTypeId (type alias) - -**Signature** - -```ts -export type InvalidPubSubCapacityExceptionTypeId = typeof InvalidPubSubCapacityExceptionTypeId -``` - -Added in v2.0.0 - -## NoSuchElementExceptionTypeId - -**Signature** - -```ts -export declare const NoSuchElementExceptionTypeId: typeof NoSuchElementExceptionTypeId -``` - -Added in v2.0.0 - -## NoSuchElementExceptionTypeId (type alias) - -**Signature** - -```ts -export type NoSuchElementExceptionTypeId = typeof NoSuchElementExceptionTypeId -``` - -Added in v2.0.0 - -## RuntimeExceptionTypeId - -**Signature** - -```ts -export declare const RuntimeExceptionTypeId: typeof RuntimeExceptionTypeId -``` - -Added in v2.0.0 - -## RuntimeExceptionTypeId (type alias) - -**Signature** - -```ts -export type RuntimeExceptionTypeId = typeof RuntimeExceptionTypeId -``` - -Added in v2.0.0 - -# utils - -## Cause (namespace) - -Added in v2.0.0 - -### Variance (interface) - -**Signature** - -```ts -export interface Variance { - readonly [CauseTypeId]: { - readonly _E: (_: never) => E - } -} -``` - -Added in v2.0.0 diff --git a/docs/modules/Channel.ts.md b/docs/modules/Channel.ts.md deleted file mode 100644 index 3c5c16033..000000000 --- a/docs/modules/Channel.ts.md +++ /dev/null @@ -1,2835 +0,0 @@ ---- -title: Channel.ts -nav_order: 7 -parent: Modules ---- - -## Channel overview - -Added in v2.0.0 - ---- - -

Table of contents

- -- [constructors](#constructors) - - [acquireReleaseOut](#acquirereleaseout) - - [acquireUseRelease](#acquireuserelease) - - [buffer](#buffer) - - [bufferChunk](#bufferchunk) - - [concatAll](#concatall) - - [concatAllWith](#concatallwith) - - [fail](#fail) - - [failCause](#failcause) - - [failCauseSync](#failcausesync) - - [failSync](#failsync) - - [fromEffect](#fromeffect) - - [fromEither](#fromeither) - - [fromInput](#frominput) - - [fromOption](#fromoption) - - [fromPubSub](#frompubsub) - - [fromPubSubScoped](#frompubsubscoped) - - [fromQueue](#fromqueue) - - [identity](#identity) - - [never](#never) - - [read](#read) - - [readOrFail](#readorfail) - - [readWith](#readwith) - - [readWithCause](#readwithcause) - - [scoped](#scoped) - - [succeed](#succeed) - - [suspend](#suspend) - - [sync](#sync) - - [unit](#unit) - - [unwrap](#unwrap) - - [unwrapScoped](#unwrapscoped) - - [write](#write) - - [writeAll](#writeall) - - [writeChunk](#writechunk) -- [context](#context) - - [context](#context-1) - - [contextWith](#contextwith) - - [contextWithChannel](#contextwithchannel) - - [contextWithEffect](#contextwitheffect) - - [mapInputContext](#mapinputcontext) - - [provideContext](#providecontext) - - [provideLayer](#providelayer) - - [provideService](#provideservice) - - [provideSomeLayer](#providesomelayer) - - [updateService](#updateservice) -- [destructors](#destructors) - - [run](#run) - - [runCollect](#runcollect) - - [runDrain](#rundrain) - - [toPubSub](#topubsub) - - [toPull](#topull) - - [toQueue](#toqueue) - - [toSink](#tosink) - - [toStream](#tostream) -- [error handling](#error-handling) - - [catchAll](#catchall) - - [catchAllCause](#catchallcause) - - [orDie](#ordie) - - [orDieWith](#ordiewith) - - [orElse](#orelse) -- [errors](#errors) - - [ChannelException](#channelexception) -- [mapping](#mapping) - - [as](#as) - - [asUnit](#asunit) - - [map](#map) - - [mapEffect](#mapeffect) - - [mapError](#maperror) - - [mapErrorCause](#maperrorcause) - - [mapOut](#mapout) - - [mapOutEffect](#mapouteffect) - - [mapOutEffectPar](#mapouteffectpar) - - [mergeMap](#mergemap) -- [models](#models) - - [Channel (interface)](#channel-interface) - - [ChannelException (interface)](#channelexception-interface) - - [ChannelUnify (interface)](#channelunify-interface) - - [ChannelUnifyIgnore (interface)](#channelunifyignore-interface) -- [refinements](#refinements) - - [isChannelException](#ischannelexception) -- [sequencing](#sequencing) - - [flatMap](#flatmap) - - [flatten](#flatten) -- [symbols](#symbols) - - [ChannelExceptionTypeId](#channelexceptiontypeid) - - [ChannelExceptionTypeId (type alias)](#channelexceptiontypeid-type-alias) - - [ChannelTypeId](#channeltypeid) - - [ChannelTypeId (type alias)](#channeltypeid-type-alias) -- [tracing](#tracing) - - [withSpan](#withspan) -- [utils](#utils) - - [Channel (namespace)](#channel-namespace) - - [Variance (interface)](#variance-interface) - - [VarianceStruct (interface)](#variancestruct-interface) - - [collect](#collect) - - [concatMap](#concatmap) - - [concatMapWith](#concatmapwith) - - [concatMapWithCustom](#concatmapwithcustom) - - [concatOut](#concatout) - - [doneCollect](#donecollect) - - [drain](#drain) - - [embedInput](#embedinput) - - [emitCollect](#emitcollect) - - [ensuring](#ensuring) - - [ensuringWith](#ensuringwith) - - [foldCauseChannel](#foldcausechannel) - - [foldChannel](#foldchannel) - - [interruptWhen](#interruptwhen) - - [interruptWhenDeferred](#interruptwhendeferred) - - [mapInput](#mapinput) - - [mapInputEffect](#mapinputeffect) - - [mapInputError](#mapinputerror) - - [mapInputErrorEffect](#mapinputerroreffect) - - [mapInputIn](#mapinputin) - - [mapInputInEffect](#mapinputineffect) - - [mergeAll](#mergeall) - - [mergeAllUnbounded](#mergeallunbounded) - - [mergeAllUnboundedWith](#mergeallunboundedwith) - - [mergeAllWith](#mergeallwith) - - [mergeOut](#mergeout) - - [mergeOutWith](#mergeoutwith) - - [mergeWith](#mergewith) - - [pipeTo](#pipeto) - - [pipeToOrFail](#pipetoorfail) - - [repeated](#repeated) -- [zipping](#zipping) - - [zip](#zip) - - [zipLeft](#zipleft) - - [zipRight](#zipright) - ---- - -# constructors - -## acquireReleaseOut - -**Signature** - -```ts -export declare const acquireReleaseOut: ( - self: Effect.Effect, - release: (z: Z, e: Exit.Exit) => Effect.Effect -) => Channel -``` - -Added in v2.0.0 - -## acquireUseRelease - -**Signature** - -```ts -export declare const acquireUseRelease: ( - acquire: Effect.Effect, - use: (a: Acquired) => Channel, - release: (a: Acquired, exit: Exit.Exit) => Effect.Effect -) => Channel -``` - -Added in v2.0.0 - -## buffer - -Creates a channel backed by a buffer. When the buffer is empty, the channel -will simply passthrough its input as output. However, when the buffer is -non-empty, the value inside the buffer will be passed along as output. - -**Signature** - -```ts -export declare const buffer: (options: { - readonly empty: InElem - readonly isEmpty: Predicate - readonly ref: Ref.Ref -}) => Channel -``` - -Added in v2.0.0 - -## bufferChunk - -**Signature** - -```ts -export declare const bufferChunk: ( - ref: Ref.Ref> -) => Channel, InDone, InErr, Chunk.Chunk, InDone> -``` - -Added in v2.0.0 - -## concatAll - -Concat sequentially a channel of channels. - -**Signature** - -```ts -export declare const concatAll: ( - channels: Channel, any> -) => Channel -``` - -Added in v2.0.0 - -## concatAllWith - -Concat sequentially a channel of channels. - -**Signature** - -```ts -export declare const concatAllWith: < - Env, - InErr, - InElem, - InDone, - OutErr, - OutElem, - OutDone, - OutDone2, - OutDone3, - Env2, - InErr2, - InElem2, - InDone2, - OutErr2 ->( - channels: Channel< - Env, - InErr, - InElem, - InDone, - OutErr, - Channel, - OutDone2 - >, - f: (o: OutDone, o1: OutDone) => OutDone, - g: (o: OutDone, o2: OutDone2) => OutDone3 -) => Channel -``` - -Added in v2.0.0 - -## fail - -Constructs a channel that fails immediately with the specified error. - -**Signature** - -```ts -export declare const fail: (error: E) => Channel -``` - -Added in v2.0.0 - -## failCause - -Constructs a channel that fails immediately with the specified `Cause`. - -**Signature** - -```ts -export declare const failCause: (cause: Cause.Cause) => Channel -``` - -Added in v2.0.0 - -## failCauseSync - -Constructs a channel that succeeds immediately with the specified lazily -evaluated `Cause`. - -**Signature** - -```ts -export declare const failCauseSync: ( - evaluate: LazyArg> -) => Channel -``` - -Added in v2.0.0 - -## failSync - -Constructs a channel that succeeds immediately with the specified lazily -evaluated value. - -**Signature** - -```ts -export declare const failSync: (evaluate: LazyArg) => Channel -``` - -Added in v2.0.0 - -## fromEffect - -Use an effect to end a channel. - -**Signature** - -```ts -export declare const fromEffect: ( - effect: Effect.Effect -) => Channel -``` - -Added in v2.0.0 - -## fromEither - -Constructs a channel from an `Either`. - -**Signature** - -```ts -export declare const fromEither: ( - either: Either.Either -) => Channel -``` - -Added in v2.0.0 - -## fromInput - -Construct a `Channel` from an `AsyncInputConsumer`. - -**Signature** - -```ts -export declare const fromInput: ( - input: SingleProducerAsyncInput.AsyncInputConsumer -) => Channel -``` - -Added in v2.0.0 - -## fromOption - -Construct a `Channel` from an `Option`. - -**Signature** - -```ts -export declare const fromOption:
( - option: Option.Option -) => Channel, never, A> -``` - -Added in v2.0.0 - -## fromPubSub - -Construct a `Channel` from a `PubSub`. - -**Signature** - -```ts -export declare const fromPubSub: ( - pubsub: PubSub.PubSub, Elem>> -) => Channel -``` - -Added in v2.0.0 - -## fromPubSubScoped - -Construct a `Channel` from a `PubSub` within a scoped effect. - -**Signature** - -```ts -export declare const fromPubSubScoped: ( - pubsub: PubSub.PubSub, Elem>> -) => Effect.Effect> -``` - -Added in v2.0.0 - -## fromQueue - -Construct a `Channel` from a `Queue`. - -**Signature** - -```ts -export declare const fromQueue: ( - queue: Queue.Dequeue, Elem>> -) => Channel -``` - -Added in v2.0.0 - -## identity - -**Signature** - -```ts -export declare const identity: () => Channel -``` - -Added in v2.0.0 - -## never - -Returns a channel that never completes - -**Signature** - -```ts -export declare const never: Channel -``` - -Added in v2.0.0 - -## read - -**Signature** - -```ts -export declare const read: () => Channel, never, In> -``` - -Added in v2.0.0 - -## readOrFail - -**Signature** - -```ts -export declare const readOrFail: (error: E) => Channel -``` - -Added in v2.0.0 - -## readWith - -**Signature** - -```ts -export declare const readWith: < - Env, - InErr, - InElem, - InDone, - OutErr, - OutElem, - OutDone, - Env2, - OutErr2, - OutElem2, - OutDone2, - Env3, - OutErr3, - OutElem3, - OutDone3 ->(options: { - readonly onInput: (input: InElem) => Channel - readonly onFailure: (error: InErr) => Channel - readonly onDone: (done: InDone) => Channel -}) => Channel< - Env | Env2 | Env3, - InErr, - InElem, - InDone, - OutErr | OutErr2 | OutErr3, - OutElem | OutElem2 | OutElem3, - OutDone | OutDone2 | OutDone3 -> -``` - -Added in v2.0.0 - -## readWithCause - -**Signature** - -```ts -export declare const readWithCause: < - Env, - InErr, - InElem, - InDone, - OutErr, - OutElem, - OutDone, - Env2, - OutErr2, - OutElem2, - OutDone2, - Env3, - OutErr3, - OutElem3, - OutDone3 ->(options: { - readonly onInput: (input: InElem) => Channel - readonly onFailure: (cause: Cause.Cause) => Channel - readonly onDone: (done: InDone) => Channel -}) => Channel< - Env | Env2 | Env3, - InErr, - InElem, - InDone, - OutErr | OutErr2 | OutErr3, - OutElem | OutElem2 | OutElem3, - OutDone | OutDone2 | OutDone3 -> -``` - -Added in v2.0.0 - -## scoped - -Use a scoped effect to emit an output element. - -**Signature** - -```ts -export declare const scoped: ( - effect: Effect.Effect -) => Channel, unknown, unknown, unknown, E, A, unknown> -``` - -Added in v2.0.0 - -## succeed - -Constructs a channel that succeeds immediately with the specified value. - -**Signature** - -```ts -export declare const succeed: (value: A) => Channel -``` - -Added in v2.0.0 - -## suspend - -Lazily constructs a channel from the given side effect. - -**Signature** - -```ts -export declare const suspend: ( - evaluate: LazyArg> -) => Channel -``` - -Added in v2.0.0 - -## sync - -Constructs a channel that succeeds immediately with the specified lazy value. - -**Signature** - -```ts -export declare const sync: ( - evaluate: LazyArg -) => Channel -``` - -Added in v2.0.0 - -## unit - -**Signature** - -```ts -export declare const unit: Channel -``` - -Added in v2.0.0 - -## unwrap - -Makes a channel from an effect that returns a channel in case of success. - -**Signature** - -```ts -export declare const unwrap: ( - channel: Effect.Effect> -) => Channel -``` - -Added in v2.0.0 - -## unwrapScoped - -Makes a channel from a managed that returns a channel in case of success. - -**Signature** - -```ts -export declare const unwrapScoped: ( - self: Effect.Effect> -) => Channel, InErr, InElem, InDone, E | OutErr, OutElem, OutDone> -``` - -Added in v2.0.0 - -## write - -Writes a single value to the channel. - -**Signature** - -```ts -export declare const write: (out: OutElem) => Channel -``` - -Added in v2.0.0 - -## writeAll - -Writes a sequence of values to the channel. - -**Signature** - -```ts -export declare const writeAll: ( - ...outs: OutElems -) => Channel -``` - -Added in v2.0.0 - -## writeChunk - -Writes a `Chunk` of values to the channel. - -**Signature** - -```ts -export declare const writeChunk: ( - outs: Chunk.Chunk -) => Channel -``` - -Added in v2.0.0 - -# context - -## context - -Accesses the whole context of the channel. - -**Signature** - -```ts -export declare const context: () => Channel> -``` - -Added in v2.0.0 - -## contextWith - -Accesses the context of the channel with the specified function. - -**Signature** - -```ts -export declare const contextWith: ( - f: (env: Context.Context) => OutDone -) => Channel -``` - -Added in v2.0.0 - -## contextWithChannel - -Accesses the context of the channel in the context of a channel. - -**Signature** - -```ts -export declare const contextWithChannel: ( - f: (env: Context.Context) => Channel -) => Channel -``` - -Added in v2.0.0 - -## contextWithEffect - -Accesses the context of the channel in the context of an effect. - -**Signature** - -```ts -export declare const contextWithEffect: ( - f: (env: Context.Context) => Effect.Effect -) => Channel -``` - -Added in v2.0.0 - -## mapInputContext - -Transforms the context being provided to the channel with the specified -function. - -**Signature** - -```ts -export declare const mapInputContext: { - ( - f: (env: Context.Context) => Context.Context - ): ( - self: Channel - ) => Channel - ( - self: Channel, - f: (env: Context.Context) => Context.Context - ): Channel -} -``` - -Added in v2.0.0 - -## provideContext - -Provides the channel with its required context, which eliminates its -dependency on `Env`. - -**Signature** - -```ts -export declare const provideContext: { - ( - env: Context.Context - ): ( - self: Channel - ) => Channel - ( - self: Channel, - env: Context.Context - ): Channel -} -``` - -Added in v2.0.0 - -## provideLayer - -Provides a layer to the channel, which translates it to another level. - -**Signature** - -```ts -export declare const provideLayer: { - ( - layer: Layer.Layer - ): ( - self: Channel - ) => Channel - ( - self: Channel, - layer: Layer.Layer - ): Channel -} -``` - -Added in v2.0.0 - -## provideService - -Provides the effect with the single service it requires. If the effect -requires more than one service use `provideContext` instead. - -**Signature** - -```ts -export declare const provideService: { - >( - tag: T, - service: Context.Tag.Service - ): ( - self: Channel - ) => Channel>, InErr, InElem, InDone, OutErr, OutElem, OutDone> - >( - self: Channel, - tag: T, - service: Context.Tag.Service - ): Channel>, InErr, InElem, InDone, OutErr, OutElem, OutDone> -} -``` - -Added in v2.0.0 - -## provideSomeLayer - -Splits the context into two parts, providing one part using the -specified layer and leaving the remainder `Env0`. - -**Signature** - -```ts -export declare const provideSomeLayer: { - ( - layer: Layer.Layer - ): ( - self: Channel - ) => Channel, InErr, InElem, InDone, OutErr2 | OutErr, OutElem, OutDone> - ( - self: Channel, - layer: Layer.Layer - ): Channel, InErr, InElem, InDone, OutErr | OutErr2, OutElem, OutDone> -} -``` - -Added in v2.0.0 - -## updateService - -Updates a service in the context of this channel. - -**Signature** - -```ts -export declare const updateService: { - >( - tag: T, - f: (resource: Context.Tag.Service) => Context.Tag.Service - ): ( - self: Channel - ) => Channel - >( - self: Channel, - tag: T, - f: (resource: Context.Tag.Service) => Context.Tag.Service - ): Channel -} -``` - -Added in v2.0.0 - -# destructors - -## run - -Runs a channel until the end is received. - -**Signature** - -```ts -export declare const run: ( - self: Channel -) => Effect.Effect -``` - -Added in v2.0.0 - -## runCollect - -Run the channel until it finishes with a done value or fails with an error -and collects its emitted output elements. - -The channel must not read any input. - -**Signature** - -```ts -export declare const runCollect: ( - self: Channel -) => Effect.Effect, OutDone]> -``` - -Added in v2.0.0 - -## runDrain - -Runs a channel until the end is received. - -**Signature** - -```ts -export declare const runDrain: ( - self: Channel -) => Effect.Effect -``` - -Added in v2.0.0 - -## toPubSub - -Converts a `Channel` to a `PubSub`. - -**Signature** - -```ts -export declare const toPubSub: ( - pubsub: PubSub.PubSub, Elem>> -) => Channel -``` - -Added in v2.0.0 - -## toPull - -Returns a scoped `Effect` that can be used to repeatedly pull elements from -the constructed `Channel`. The pull effect fails with the channel's failure -in case the channel fails, or returns either the channel's done value or an -emitted element. - -**Signature** - -```ts -export declare const toPull: ( - self: Channel -) => Effect.Effect>> -``` - -Added in v2.0.0 - -## toQueue - -Converts a `Channel` to a `Queue`. - -**Signature** - -```ts -export declare const toQueue: ( - queue: Queue.Enqueue, Elem>> -) => Channel -``` - -Added in v2.0.0 - -## toSink - -Converts this channel to a `Sink`. - -**Signature** - -```ts -export declare const toSink: ( - self: Channel, unknown, OutErr, Chunk.Chunk, OutDone> -) => Sink.Sink -``` - -Added in v2.0.0 - -## toStream - -Converts this channel to a `Stream`. - -**Signature** - -```ts -export declare const toStream: ( - self: Channel, OutDone> -) => Stream.Stream -``` - -Added in v2.0.0 - -# error handling - -## catchAll - -Returns a new channel that is the same as this one, except if this channel -errors for any typed error, then the returned channel will switch over to -using the fallback channel returned by the specified error handler. - -**Signature** - -```ts -export declare const catchAll: { - ( - f: (error: OutErr) => Channel - ): ( - self: Channel - ) => Channel< - Env1 | Env, - InErr & InErr1, - InElem & InElem1, - InDone & InDone1, - OutErr1, - OutElem1 | OutElem, - OutDone1 | OutDone - > - ( - self: Channel, - f: (error: OutErr) => Channel - ): Channel< - Env | Env1, - InErr & InErr1, - InElem & InElem1, - InDone & InDone1, - OutErr1, - OutElem | OutElem1, - OutDone | OutDone1 - > -} -``` - -Added in v2.0.0 - -## catchAllCause - -Returns a new channel that is the same as this one, except if this channel -errors for any typed error, then the returned channel will switch over to -using the fallback channel returned by the specified error handler. - -**Signature** - -```ts -export declare const catchAllCause: { - ( - f: (cause: Cause.Cause) => Channel - ): ( - self: Channel - ) => Channel< - Env1 | Env, - InErr & InErr1, - InElem & InElem1, - InDone & InDone1, - OutErr1, - OutElem1 | OutElem, - OutDone1 | OutDone - > - ( - self: Channel, - f: (cause: Cause.Cause) => Channel - ): Channel< - Env | Env1, - InErr & InErr1, - InElem & InElem1, - InDone & InDone1, - OutErr1, - OutElem | OutElem1, - OutDone | OutDone1 - > -} -``` - -Added in v2.0.0 - -## orDie - -Translates channel failure into death of the fiber, making all failures -unchecked and not a part of the type of the channel. - -**Signature** - -```ts -export declare const orDie: { - ( - error: LazyArg - ): ( - self: Channel - ) => Channel - ( - self: Channel, - error: LazyArg - ): Channel -} -``` - -Added in v2.0.0 - -## orDieWith - -Keeps none of the errors, and terminates the fiber with them, using the -specified function to convert the `OutErr` into a defect. - -**Signature** - -```ts -export declare const orDieWith: { - ( - f: (e: OutErr) => unknown - ): ( - self: Channel - ) => Channel - ( - self: Channel, - f: (e: OutErr) => unknown - ): Channel -} -``` - -Added in v2.0.0 - -## orElse - -Returns a new channel that will perform the operations of this one, until -failure, and then it will switch over to the operations of the specified -fallback channel. - -**Signature** - -```ts -export declare const orElse: { - ( - that: LazyArg> - ): ( - self: Channel - ) => Channel< - Env1 | Env, - InErr & InErr1, - InElem & InElem1, - InDone & InDone1, - OutErr1, - OutElem1 | OutElem, - OutDone1 | OutDone - > - ( - self: Channel, - that: LazyArg> - ): Channel< - Env | Env1, - InErr & InErr1, - InElem & InElem1, - InDone & InDone1, - OutErr1, - OutElem | OutElem1, - OutDone | OutDone1 - > -} -``` - -Added in v2.0.0 - -# errors - -## ChannelException - -Represents a generic checked exception which occurs when a `Channel` is -executed. - -**Signature** - -```ts -export declare const ChannelException: (error: E) => ChannelException -``` - -Added in v2.0.0 - -# mapping - -## as - -Returns a new channel that is the same as this one, except the terminal -value of the channel is the specified constant value. - -This method produces the same result as mapping this channel to the -specified constant value. - -**Signature** - -```ts -export declare const as: { - ( - value: OutDone2 - ): ( - self: Channel - ) => Channel - ( - self: Channel, - value: OutDone2 - ): Channel -} -``` - -Added in v2.0.0 - -## asUnit - -**Signature** - -```ts -export declare const asUnit: ( - self: Channel -) => Channel -``` - -Added in v2.0.0 - -## map - -Returns a new channel, which is the same as this one, except the terminal -value of the returned channel is created by applying the specified function -to the terminal value of this channel. - -**Signature** - -```ts -export declare const map: { - ( - f: (out: OutDone) => OutDone2 - ): ( - self: Channel - ) => Channel - ( - self: Channel, - f: (out: OutDone) => OutDone2 - ): Channel -} -``` - -Added in v2.0.0 - -## mapEffect - -Returns a new channel, which is the same as this one, except the terminal -value of the returned channel is created by applying the specified -effectful function to the terminal value of this channel. - -**Signature** - -```ts -export declare const mapEffect: { - ( - f: (o: OutDone) => Effect.Effect - ): ( - self: Channel - ) => Channel - ( - self: Channel, - f: (o: OutDone) => Effect.Effect - ): Channel -} -``` - -Added in v2.0.0 - -## mapError - -Returns a new channel, which is the same as this one, except the failure -value of the returned channel is created by applying the specified function -to the failure value of this channel. - -**Signature** - -```ts -export declare const mapError: { - ( - f: (err: OutErr) => OutErr2 - ): ( - self: Channel - ) => Channel - ( - self: Channel, - f: (err: OutErr) => OutErr2 - ): Channel -} -``` - -Added in v2.0.0 - -## mapErrorCause - -A more powerful version of `mapError` which also surfaces the `Cause` -of the channel failure. - -**Signature** - -```ts -export declare const mapErrorCause: { - ( - f: (cause: Cause.Cause) => Cause.Cause - ): ( - self: Channel - ) => Channel - ( - self: Channel, - f: (cause: Cause.Cause) => Cause.Cause - ): Channel -} -``` - -Added in v2.0.0 - -## mapOut - -Maps the output of this channel using the specified function. - -**Signature** - -```ts -export declare const mapOut: { - ( - f: (o: OutElem) => OutElem2 - ): ( - self: Channel - ) => Channel - ( - self: Channel, - f: (o: OutElem) => OutElem2 - ): Channel -} -``` - -Added in v2.0.0 - -## mapOutEffect - -Creates a channel that is like this channel but the given effectful function -gets applied to each emitted output element. - -**Signature** - -```ts -export declare const mapOutEffect: { - ( - f: (o: OutElem) => Effect.Effect - ): ( - self: Channel - ) => Channel - ( - self: Channel, - f: (o: OutElem) => Effect.Effect - ): Channel -} -``` - -Added in v2.0.0 - -## mapOutEffectPar - -Creates a channel that is like this channel but the given ZIO function gets -applied to each emitted output element, taking `n` elements at once and -mapping them in parallel. - -**Signature** - -```ts -export declare const mapOutEffectPar: { - ( - f: (o: OutElem) => Effect.Effect, - n: number - ): ( - self: Channel - ) => Channel - ( - self: Channel, - f: (o: OutElem) => Effect.Effect, - n: number - ): Channel -} -``` - -Added in v2.0.0 - -## mergeMap - -Returns a new channel which creates a new channel for each emitted element -and merges some of them together. Different merge strategies control what -happens if there are more than the given maximum number of channels gets -created. See `Channel.mergeAll`. - -**Signature** - -```ts -export declare const mergeMap: { - ( - f: (outElem: OutElem) => Channel, - options: { - readonly concurrency: number | "unbounded" - readonly bufferSize?: number | undefined - readonly mergeStrategy?: MergeStrategy.MergeStrategy | undefined - } - ): ( - self: Channel - ) => Channel - ( - self: Channel, - f: (outElem: OutElem) => Channel, - options: { - readonly concurrency: number | "unbounded" - readonly bufferSize?: number | undefined - readonly mergeStrategy?: MergeStrategy.MergeStrategy | undefined - } - ): Channel -} -``` - -Added in v2.0.0 - -# models - -## Channel (interface) - -A `Channel` is a nexus of I/O operations, which supports both reading and -writing. A channel may read values of type `InElem` and write values of type -`OutElem`. When the channel finishes, it yields a value of type `OutDone`. A -channel may fail with a value of type `OutErr`. - -Channels are the foundation of Streams: both streams and sinks are built on -channels. Most users shouldn't have to use channels directly, as streams and -sinks are much more convenient and cover all common use cases. However, when -adding new stream and sink operators, or doing something highly specialized, -it may be useful to use channels directly. - -Channels compose in a variety of ways: - -- **Piping**: One channel can be piped to another channel, assuming the - input type of the second is the same as the output type of the first. -- **Sequencing**: The terminal value of one channel can be used to create - another channel, and both the first channel and the function that makes - the second channel can be composed into a channel. -- **Concatenating**: The output of one channel can be used to create other - channels, which are all concatenated together. The first channel and the - function that makes the other channels can be composed into a channel. - -**Signature** - -```ts -export interface Channel - extends Channel.Variance, - Pipeable { - [Unify.typeSymbol]?: unknown - [Unify.unifySymbol]?: ChannelUnify - [Unify.ignoreSymbol]?: ChannelUnifyIgnore -} -``` - -Added in v2.0.0 - -## ChannelException (interface) - -Represents a generic checked exception which occurs when a `Channel` is -executed. - -**Signature** - -```ts -export interface ChannelException { - readonly _tag: "ChannelException" - readonly [ChannelExceptionTypeId]: ChannelExceptionTypeId - readonly error: E -} -``` - -Added in v2.0.0 - -## ChannelUnify (interface) - -**Signature** - -```ts -export interface ChannelUnify extends Effect.EffectUnify { - Channel?: () => A[Unify.typeSymbol] extends - | Channel - | infer _ - ? Channel - : never -} -``` - -Added in v2.0.0 - -## ChannelUnifyIgnore (interface) - -**Signature** - -```ts -export interface ChannelUnifyIgnore extends Effect.EffectUnifyIgnore { - Channel?: true -} -``` - -Added in v2.0.0 - -# refinements - -## isChannelException - -Returns `true` if the specified value is an `ChannelException`, `false` -otherwise. - -**Signature** - -```ts -export declare const isChannelException: (u: unknown) => u is ChannelException -``` - -Added in v2.0.0 - -# sequencing - -## flatMap - -Returns a new channel, which sequentially combines this channel, together -with the provided factory function, which creates a second channel based on -the terminal value of this channel. The result is a channel that will first -perform the functions of this channel, before performing the functions of -the created channel (including yielding its terminal value). - -**Signature** - -```ts -export declare const flatMap: { - ( - f: (d: OutDone) => Channel - ): ( - self: Channel - ) => Channel< - Env1 | Env, - InErr & InErr1, - InElem & InElem1, - InDone & InDone1, - OutErr1 | OutErr, - OutElem1 | OutElem, - OutDone2 - > - ( - self: Channel, - f: (d: OutDone) => Channel - ): Channel< - Env | Env1, - InErr & InErr1, - InElem & InElem1, - InDone & InDone1, - OutErr | OutErr1, - OutElem | OutElem1, - OutDone2 - > -} -``` - -Added in v2.0.0 - -## flatten - -Returns a new channel, which flattens the terminal value of this channel. -This function may only be called if the terminal value of this channel is -another channel of compatible types. - -**Signature** - -```ts -export declare const flatten: < - Env, - InErr, - InElem, - InDone, - OutErr, - OutElem, - Env1, - InErr1, - InElem1, - InDone1, - OutErr1, - OutElem1, - OutDone2 ->( - self: Channel< - Env, - InErr, - InElem, - InDone, - OutErr, - OutElem, - Channel - > -) => Channel< - Env | Env1, - InErr & InErr1, - InElem & InElem1, - InDone & InDone1, - OutErr | OutErr1, - OutElem | OutElem1, - OutDone2 -> -``` - -Added in v2.0.0 - -# symbols - -## ChannelExceptionTypeId - -**Signature** - -```ts -export declare const ChannelExceptionTypeId: typeof ChannelExceptionTypeId -``` - -Added in v2.0.0 - -## ChannelExceptionTypeId (type alias) - -**Signature** - -```ts -export type ChannelExceptionTypeId = typeof ChannelExceptionTypeId -``` - -Added in v2.0.0 - -## ChannelTypeId - -**Signature** - -```ts -export declare const ChannelTypeId: typeof ChannelTypeId -``` - -Added in v2.0.0 - -## ChannelTypeId (type alias) - -**Signature** - -```ts -export type ChannelTypeId = typeof ChannelTypeId -``` - -Added in v2.0.0 - -# tracing - -## withSpan - -Wraps the channel with a new span for tracing. - -**Signature** - -```ts -export declare const withSpan: { - ( - name: string, - options?: { - readonly attributes?: Record | undefined - readonly links?: ReadonlyArray | undefined - readonly parent?: Tracer.ParentSpan | undefined - readonly root?: boolean | undefined - readonly context?: Context.Context | undefined - } - ): ( - self: Channel - ) => Channel - ( - self: Channel, - name: string, - options?: { - readonly attributes?: Record | undefined - readonly links?: ReadonlyArray | undefined - readonly parent?: Tracer.ParentSpan | undefined - readonly root?: boolean | undefined - readonly context?: Context.Context | undefined - } - ): Channel -} -``` - -Added in v2.0.0 - -# utils - -## Channel (namespace) - -Added in v2.0.0 - -### Variance (interface) - -**Signature** - -```ts -export interface Variance { - readonly [ChannelTypeId]: VarianceStruct -} -``` - -Added in v2.0.0 - -### VarianceStruct (interface) - -**Signature** - -```ts -export interface VarianceStruct { - _Env: (_: never) => Env - _InErr: (_: InErr) => void - _InElem: (_: InElem) => void - _InDone: (_: InDone) => void - _OutErr: (_: never) => OutErr - _OutElem: (_: never) => OutElem - _OutDone: (_: never) => OutDone -} -``` - -Added in v2.0.0 - -## collect - -Returns a new channel, which is the same as this one, except its outputs -are filtered and transformed by the specified partial function. - -**Signature** - -```ts -export declare const collect: { - ( - pf: (o: OutElem) => Option.Option - ): ( - self: Channel - ) => Channel - ( - self: Channel, - pf: (o: OutElem) => Option.Option - ): Channel -} -``` - -Added in v2.0.0 - -## concatMap - -Returns a new channel whose outputs are fed to the specified factory -function, which creates new channels in response. These new channels are -sequentially concatenated together, and all their outputs appear as outputs -of the newly returned channel. - -**Signature** - -```ts -export declare const concatMap: { - ( - f: (o: OutElem) => Channel - ): ( - self: Channel - ) => Channel - ( - self: Channel, - f: (o: OutElem) => Channel - ): Channel -} -``` - -Added in v2.0.0 - -## concatMapWith - -Returns a new channel whose outputs are fed to the specified factory -function, which creates new channels in response. These new channels are -sequentially concatenated together, and all their outputs appear as outputs -of the newly returned channel. The provided merging function is used to -merge the terminal values of all channels into the single terminal value of -the returned channel. - -**Signature** - -```ts -export declare const concatMapWith: { - ( - f: (o: OutElem) => Channel, - g: (o: OutDone, o1: OutDone) => OutDone, - h: (o: OutDone, o2: OutDone2) => OutDone3 - ): ( - self: Channel - ) => Channel - < - Env, - InErr, - InElem, - InDone, - OutErr, - OutElem, - OutElem2, - OutDone, - OutDone2, - OutDone3, - Env2, - InErr2, - InElem2, - InDone2, - OutErr2 - >( - self: Channel, - f: (o: OutElem) => Channel, - g: (o: OutDone, o1: OutDone) => OutDone, - h: (o: OutDone, o2: OutDone2) => OutDone3 - ): Channel -} -``` - -Added in v2.0.0 - -## concatMapWithCustom - -Returns a new channel whose outputs are fed to the specified factory -function, which creates new channels in response. These new channels are -sequentially concatenated together, and all their outputs appear as outputs -of the newly returned channel. The provided merging function is used to -merge the terminal values of all channels into the single terminal value of -the returned channel. - -**Signature** - -```ts -export declare const concatMapWithCustom: { - ( - f: (o: OutElem) => Channel, - g: (o: OutDone, o1: OutDone) => OutDone, - h: (o: OutDone, o2: OutDone2) => OutDone3, - onPull: ( - upstreamPullRequest: UpstreamPullRequest.UpstreamPullRequest - ) => UpstreamPullStrategy.UpstreamPullStrategy, - onEmit: (elem: OutElem2) => ChildExecutorDecision.ChildExecutorDecision - ): ( - self: Channel - ) => Channel - < - Env, - InErr, - InElem, - InDone, - OutErr, - OutElem, - OutElem2, - OutDone, - OutDone2, - OutDone3, - Env2, - InErr2, - InElem2, - InDone2, - OutErr2 - >( - self: Channel, - f: (o: OutElem) => Channel, - g: (o: OutDone, o1: OutDone) => OutDone, - h: (o: OutDone, o2: OutDone2) => OutDone3, - onPull: ( - upstreamPullRequest: UpstreamPullRequest.UpstreamPullRequest - ) => UpstreamPullStrategy.UpstreamPullStrategy, - onEmit: (elem: OutElem2) => ChildExecutorDecision.ChildExecutorDecision - ): Channel -} -``` - -Added in v2.0.0 - -## concatOut - -Returns a new channel, which is the concatenation of all the channels that -are written out by this channel. This method may only be called on channels -that output other channels. - -**Signature** - -```ts -export declare const concatOut: ( - self: Channel< - Env, - InErr, - InElem, - InDone, - OutErr, - Channel, - OutDone - > -) => Channel -``` - -Added in v2.0.0 - -## doneCollect - -Returns a new channel, which is the same as this one, except that all the -outputs are collected and bundled into a tuple together with the terminal -value of this channel. - -As the channel returned from this channel collects all of this channel's -output into an in- memory chunk, it is not safe to call this method on -channels that output a large or unbounded number of values. - -**Signature** - -```ts -export declare const doneCollect: ( - self: Channel -) => Channel, OutDone]> -``` - -Added in v2.0.0 - -## drain - -Returns a new channel which reads all the elements from upstream's output -channel and ignores them, then terminates with the upstream result value. - -**Signature** - -```ts -export declare const drain: ( - self: Channel -) => Channel -``` - -Added in v2.0.0 - -## embedInput - -Returns a new channel which connects the given `AsyncInputProducer` as -this channel's input. - -**Signature** - -```ts -export declare const embedInput: { - ( - input: SingleProducerAsyncInput.AsyncInputProducer - ): ( - self: Channel - ) => Channel - ( - self: Channel, - input: SingleProducerAsyncInput.AsyncInputProducer - ): Channel -} -``` - -Added in v2.0.0 - -## emitCollect - -Returns a new channel that collects the output and terminal value of this -channel, which it then writes as output of the returned channel. - -**Signature** - -```ts -export declare const emitCollect: ( - self: Channel -) => Channel, OutDone], void> -``` - -Added in v2.0.0 - -## ensuring - -Returns a new channel with an attached finalizer. The finalizer is -guaranteed to be executed so long as the channel begins execution (and -regardless of whether or not it completes). - -**Signature** - -```ts -export declare const ensuring: { - ( - finalizer: Effect.Effect - ): ( - self: Channel - ) => Channel - ( - self: Channel, - finalizer: Effect.Effect - ): Channel -} -``` - -Added in v2.0.0 - -## ensuringWith - -Returns a new channel with an attached finalizer. The finalizer is -guaranteed to be executed so long as the channel begins execution (and -regardless of whether or not it completes). - -**Signature** - -```ts -export declare const ensuringWith: { - ( - finalizer: (e: Exit.Exit) => Effect.Effect - ): ( - self: Channel - ) => Channel - ( - self: Channel, - finalizer: (e: Exit.Exit) => Effect.Effect - ): Channel -} -``` - -Added in v2.0.0 - -## foldCauseChannel - -Folds over the result of this channel including any cause of termination. - -**Signature** - -```ts -export declare const foldCauseChannel: { - < - Env1, - Env2, - InErr1, - InErr2, - InElem1, - InElem2, - InDone1, - InDone2, - OutErr, - OutErr2, - OutErr3, - OutElem1, - OutElem2, - OutDone, - OutDone2, - OutDone3 - >(options: { - readonly onFailure: (c: Cause.Cause) => Channel - readonly onSuccess: (o: OutDone) => Channel - }): ( - self: Channel - ) => Channel< - Env1 | Env2 | Env, - InErr & InErr1 & InErr2, - InElem & InElem1 & InElem2, - InDone & InDone1 & InDone2, - OutErr2 | OutErr3, - OutElem1 | OutElem2 | OutElem, - OutDone2 | OutDone3 - > - < - Env, - InErr, - InElem, - InDone, - OutElem, - Env1, - Env2, - InErr1, - InErr2, - InElem1, - InElem2, - InDone1, - InDone2, - OutErr, - OutErr2, - OutErr3, - OutElem1, - OutElem2, - OutDone, - OutDone2, - OutDone3 - >( - self: Channel, - options: { - readonly onFailure: ( - c: Cause.Cause - ) => Channel - readonly onSuccess: (o: OutDone) => Channel - } - ): Channel< - Env | Env1 | Env2, - InErr & InErr1 & InErr2, - InElem & InElem1 & InElem2, - InDone & InDone1 & InDone2, - OutErr2 | OutErr3, - OutElem | OutElem1 | OutElem2, - OutDone2 | OutDone3 - > -} -``` - -Added in v2.0.0 - -## foldChannel - -Folds over the result of this channel. - -**Signature** - -```ts -export declare const foldChannel: { - < - Env1, - Env2, - InErr1, - InErr2, - InElem1, - InElem2, - InDone1, - InDone2, - OutErr, - OutErr1, - OutErr2, - OutElem1, - OutElem2, - OutDone, - OutDone1, - OutDone2 - >(options: { - readonly onFailure: (error: OutErr) => Channel - readonly onSuccess: (done: OutDone) => Channel - }): ( - self: Channel - ) => Channel< - Env1 | Env2 | Env, - InErr & InErr1 & InErr2, - InElem & InElem1 & InElem2, - InDone & InDone1 & InDone2, - OutErr1 | OutErr2, - OutElem1 | OutElem2 | OutElem, - OutDone1 | OutDone2 - > - < - Env, - InErr, - InElem, - InDone, - OutElem, - Env1, - Env2, - InErr1, - InErr2, - InElem1, - InElem2, - InDone1, - InDone2, - OutErr, - OutErr1, - OutErr2, - OutElem1, - OutElem2, - OutDone, - OutDone1, - OutDone2 - >( - self: Channel, - options: { - readonly onFailure: (error: OutErr) => Channel - readonly onSuccess: (done: OutDone) => Channel - } - ): Channel< - Env | Env1 | Env2, - InErr & InErr1 & InErr2, - InElem & InElem1 & InElem2, - InDone & InDone1 & InDone2, - OutErr1 | OutErr2, - OutElem | OutElem1 | OutElem2, - OutDone1 | OutDone2 - > -} -``` - -Added in v2.0.0 - -## interruptWhen - -Returns a new channel, which is the same as this one, except it will be -interrupted when the specified effect completes. If the effect completes -successfully before the underlying channel is done, then the returned -channel will yield the success value of the effect as its terminal value. -On the other hand, if the underlying channel finishes first, then the -returned channel will yield the success value of the underlying channel as -its terminal value. - -**Signature** - -```ts -export declare const interruptWhen: { - ( - effect: Effect.Effect - ): ( - self: Channel - ) => Channel - ( - self: Channel, - effect: Effect.Effect - ): Channel -} -``` - -Added in v2.0.0 - -## interruptWhenDeferred - -Returns a new channel, which is the same as this one, except it will be -interrupted when the specified deferred is completed. If the deferred is -completed before the underlying channel is done, then the returned channel -will yield the value of the deferred. Otherwise, if the underlying channel -finishes first, then the returned channel will yield the value of the -underlying channel. - -**Signature** - -```ts -export declare const interruptWhenDeferred: { - ( - deferred: Deferred.Deferred - ): ( - self: Channel - ) => Channel - ( - self: Channel, - deferred: Deferred.Deferred - ): Channel -} -``` - -Added in v2.0.0 - -## mapInput - -Returns a new channel which is the same as this one but applies the given -function to the input channel's done value. - -**Signature** - -```ts -export declare const mapInput: { - ( - f: (a: InDone0) => InDone - ): ( - self: Channel - ) => Channel - ( - self: Channel, - f: (a: InDone0) => InDone - ): Channel -} -``` - -Added in v2.0.0 - -## mapInputEffect - -Returns a new channel which is the same as this one but applies the given -effectual function to the input channel's done value. - -**Signature** - -```ts -export declare const mapInputEffect: { - ( - f: (i: InDone0) => Effect.Effect - ): ( - self: Channel - ) => Channel - ( - self: Channel, - f: (i: InDone0) => Effect.Effect - ): Channel -} -``` - -Added in v2.0.0 - -## mapInputError - -Returns a new channel which is the same as this one but applies the given -function to the input channel's error value. - -**Signature** - -```ts -export declare const mapInputError: { - ( - f: (a: InErr0) => InErr - ): ( - self: Channel - ) => Channel - ( - self: Channel, - f: (a: InErr0) => InErr - ): Channel -} -``` - -Added in v2.0.0 - -## mapInputErrorEffect - -Returns a new channel which is the same as this one but applies the given -effectual function to the input channel's error value. - -**Signature** - -```ts -export declare const mapInputErrorEffect: { - ( - f: (error: InErr0) => Effect.Effect - ): ( - self: Channel - ) => Channel - ( - self: Channel, - f: (error: InErr0) => Effect.Effect - ): Channel -} -``` - -Added in v2.0.0 - -## mapInputIn - -Returns a new channel which is the same as this one but applies the given -function to the input channel's output elements. - -**Signature** - -```ts -export declare const mapInputIn: { - ( - f: (a: InElem0) => InElem - ): ( - self: Channel - ) => Channel - ( - self: Channel, - f: (a: InElem0) => InElem - ): Channel -} -``` - -Added in v2.0.0 - -## mapInputInEffect - -Returns a new channel which is the same as this one but applies the given -effectual function to the input channel's output elements. - -**Signature** - -```ts -export declare const mapInputInEffect: { - ( - f: (a: InElem0) => Effect.Effect - ): ( - self: Channel - ) => Channel - ( - self: Channel, - f: (a: InElem0) => Effect.Effect - ): Channel -} -``` - -Added in v2.0.0 - -## mergeAll - -**Signature** - -```ts -export declare const mergeAll: (options: { - readonly concurrency: number | "unbounded" - readonly bufferSize?: number | undefined - readonly mergeStrategy?: MergeStrategy.MergeStrategy | undefined -}) => ( - channels: Channel< - Env, - InErr, - InElem, - InDone, - OutErr, - Channel, - unknown - > -) => Channel -``` - -Added in v2.0.0 - -## mergeAllUnbounded - -**Signature** - -```ts -export declare const mergeAllUnbounded: < - Env, - Env1, - InErr, - InErr1, - InElem, - InElem1, - InDone, - InDone1, - OutErr, - OutErr1, - OutElem ->( - channels: Channel< - Env, - InErr, - InElem, - InDone, - OutErr, - Channel, - unknown - > -) => Channel -``` - -Added in v2.0.0 - -## mergeAllUnboundedWith - -**Signature** - -```ts -export declare const mergeAllUnboundedWith: < - Env, - Env1, - InErr, - InErr1, - InElem, - InElem1, - InDone, - InDone1, - OutErr, - OutErr1, - OutElem, - OutDone ->( - channels: Channel< - Env, - InErr, - InElem, - InDone, - OutErr, - Channel, - OutDone - >, - f: (o1: OutDone, o2: OutDone) => OutDone -) => Channel -``` - -Added in v2.0.0 - -## mergeAllWith - -**Signature** - -```ts -export declare const mergeAllWith: ({ - bufferSize, - concurrency, - mergeStrategy -}: { - readonly concurrency: number | "unbounded" - readonly bufferSize?: number | undefined - readonly mergeStrategy?: MergeStrategy.MergeStrategy | undefined -}) => ( - channels: Channel< - Env, - InErr, - InElem, - InDone, - OutErr, - Channel, - OutDone - >, - f: (o1: OutDone, o2: OutDone) => OutDone -) => Channel -``` - -Added in v2.0.0 - -## mergeOut - -Returns a new channel which merges a number of channels emitted by this -channel using the back pressuring merge strategy. See `Channel.mergeAll`. - -**Signature** - -```ts -export declare const mergeOut: { - ( - n: number - ): ( - self: Channel< - Env, - InErr, - InElem, - InDone, - OutErr, - Channel, - OutDone - > - ) => Channel - ( - self: Channel< - Env, - InErr, - InElem, - InDone, - OutErr, - Channel, - OutDone - >, - n: number - ): Channel -} -``` - -Added in v2.0.0 - -## mergeOutWith - -Returns a new channel which merges a number of channels emitted by this -channel using the back pressuring merge strategy and uses a given function -to merge each completed subchannel's result value. See -`Channel.mergeAll`. - -**Signature** - -```ts -export declare const mergeOutWith: { - ( - n: number, - f: (o1: OutDone1, o2: OutDone1) => OutDone1 - ): ( - self: Channel< - Env, - InErr, - InElem, - InDone, - OutErr, - Channel, - OutDone1 - > - ) => Channel - ( - self: Channel< - Env, - InErr, - InElem, - InDone, - OutErr, - Channel, - OutDone1 - >, - n: number, - f: (o1: OutDone1, o2: OutDone1) => OutDone1 - ): Channel -} -``` - -Added in v2.0.0 - -## mergeWith - -Returns a new channel, which is the merge of this channel and the specified -channel, where the behavior of the returned channel on left or right early -termination is decided by the specified `leftDone` and `rightDone` merge -decisions. - -**Signature** - -```ts -export declare const mergeWith: { - < - Env1, - InErr1, - InElem1, - InDone1, - OutErr, - OutErr1, - OutErr2, - OutErr3, - OutElem1, - OutDone, - OutDone1, - OutDone2, - OutDone3 - >(options: { - readonly other: Channel - readonly onSelfDone: ( - exit: Exit.Exit - ) => MergeDecision.MergeDecision - readonly onOtherDone: ( - ex: Exit.Exit - ) => MergeDecision.MergeDecision - }): ( - self: Channel - ) => Channel< - Env1 | Env, - InErr & InErr1, - InElem & InElem1, - InDone & InDone1, - OutErr2 | OutErr3, - OutElem1 | OutElem, - OutDone2 | OutDone3 - > - < - Env, - InErr, - InElem, - InDone, - OutElem, - Env1, - InErr1, - InElem1, - InDone1, - OutErr, - OutErr1, - OutErr2, - OutErr3, - OutElem1, - OutDone, - OutDone1, - OutDone2, - OutDone3 - >( - self: Channel, - options: { - readonly other: Channel - readonly onSelfDone: ( - exit: Exit.Exit - ) => MergeDecision.MergeDecision - readonly onOtherDone: ( - ex: Exit.Exit - ) => MergeDecision.MergeDecision - } - ): Channel< - Env | Env1, - InErr & InErr1, - InElem & InElem1, - InDone & InDone1, - OutErr2 | OutErr3, - OutElem | OutElem1, - OutDone2 | OutDone3 - > -} -``` - -Added in v2.0.0 - -## pipeTo - -Returns a new channel that pipes the output of this channel into the -specified channel. The returned channel has the input type of this channel, -and the output type of the specified channel, terminating with the value of -the specified channel. - -**Signature** - -```ts -export declare const pipeTo: { - ( - that: Channel - ): ( - self: Channel - ) => Channel - ( - self: Channel, - that: Channel - ): Channel -} -``` - -Added in v2.0.0 - -## pipeToOrFail - -Returns a new channel that pipes the output of this channel into the -specified channel and preserves this channel's failures without providing -them to the other channel for observation. - -**Signature** - -```ts -export declare const pipeToOrFail: { - ( - that: Channel - ): ( - self: Channel - ) => Channel - ( - self: Channel, - that: Channel - ): Channel -} -``` - -Added in v2.0.0 - -## repeated - -Creates a channel which repeatedly runs this channel. - -**Signature** - -```ts -export declare const repeated: ( - self: Channel -) => Channel -``` - -Added in v2.0.0 - -# zipping - -## zip - -Returns a new channel that is the sequential composition of this channel -and the specified channel. The returned channel terminates with a tuple of -the terminal values of both channels. - -**Signature** - -```ts -export declare const zip: { - ( - that: Channel, - options?: { readonly concurrent?: boolean | undefined } - ): ( - self: Channel - ) => Channel< - Env1 | Env, - InErr & InErr1, - InElem & InElem1, - InDone & InDone1, - OutErr1 | OutErr, - OutElem1 | OutElem, - readonly [OutDone, OutDone1] - > - ( - self: Channel, - that: Channel, - options?: { readonly concurrent?: boolean | undefined } - ): Channel< - Env | Env1, - InErr & InErr1, - InElem & InElem1, - InDone & InDone1, - OutErr | OutErr1, - OutElem | OutElem1, - readonly [OutDone, OutDone1] - > -} -``` - -Added in v2.0.0 - -## zipLeft - -Returns a new channel that is the sequential composition of this channel -and the specified channel. The returned channel terminates with the -terminal value of this channel. - -**Signature** - -```ts -export declare const zipLeft: { - ( - that: Channel, - options?: { readonly concurrent?: boolean | undefined } - ): ( - self: Channel - ) => Channel< - Env1 | Env, - InErr & InErr1, - InElem & InElem1, - InDone & InDone1, - OutErr1 | OutErr, - OutElem1 | OutElem, - OutDone - > - ( - self: Channel, - that: Channel, - options?: { readonly concurrent?: boolean | undefined } - ): Channel< - Env | Env1, - InErr & InErr1, - InElem & InElem1, - InDone & InDone1, - OutErr | OutErr1, - OutElem | OutElem1, - OutDone - > -} -``` - -Added in v2.0.0 - -## zipRight - -Returns a new channel that is the sequential composition of this channel -and the specified channel. The returned channel terminates with the -terminal value of that channel. - -**Signature** - -```ts -export declare const zipRight: { - ( - that: Channel, - options?: { readonly concurrent?: boolean | undefined } - ): ( - self: Channel - ) => Channel< - Env1 | Env, - InErr & InErr1, - InElem & InElem1, - InDone & InDone1, - OutErr1 | OutErr, - OutElem1 | OutElem, - OutDone1 - > - ( - self: Channel, - that: Channel, - options?: { readonly concurrent?: boolean | undefined } - ): Channel< - Env | Env1, - InErr & InErr1, - InElem & InElem1, - InDone & InDone1, - OutErr | OutErr1, - OutElem | OutElem1, - OutDone1 - > -} -``` - -Added in v2.0.0 diff --git a/docs/modules/ChildExecutorDecision.ts.md b/docs/modules/ChildExecutorDecision.ts.md deleted file mode 100644 index 4420ae3c2..000000000 --- a/docs/modules/ChildExecutorDecision.ts.md +++ /dev/null @@ -1,245 +0,0 @@ ---- -title: ChildExecutorDecision.ts -nav_order: 8 -parent: Modules ---- - -## ChildExecutorDecision overview - -Added in v2.0.0 - ---- - -

Table of contents

- -- [constructors](#constructors) - - [Close](#close) - - [Continue](#continue) - - [Yield](#yield) -- [folding](#folding) - - [match](#match) -- [models](#models) - - [ChildExecutorDecision (type alias)](#childexecutordecision-type-alias) - - [Close (interface)](#close-interface) - - [Continue (interface)](#continue-interface) - - [Yield (interface)](#yield-interface) -- [refinements](#refinements) - - [isChildExecutorDecision](#ischildexecutordecision) - - [isClose](#isclose) - - [isContinue](#iscontinue) - - [isYield](#isyield) -- [symbols](#symbols) - - [ChildExecutorDecisionTypeId](#childexecutordecisiontypeid) - - [ChildExecutorDecisionTypeId (type alias)](#childexecutordecisiontypeid-type-alias) -- [utils](#utils) - - [ChildExecutorDecision (namespace)](#childexecutordecision-namespace) - - [Proto (interface)](#proto-interface) - ---- - -# constructors - -## Close - -**Signature** - -```ts -export declare const Close: (value: unknown) => ChildExecutorDecision -``` - -Added in v2.0.0 - -## Continue - -**Signature** - -```ts -export declare const Continue: (_: void) => ChildExecutorDecision -``` - -Added in v2.0.0 - -## Yield - -**Signature** - -```ts -export declare const Yield: (_: void) => ChildExecutorDecision -``` - -Added in v2.0.0 - -# folding - -## match - -Folds over a `ChildExecutorDecision` to produce a value of type `A`. - -**Signature** - -```ts -export declare const match: { -
(options: { - readonly onContinue: () => A - readonly onClose: (value: unknown) => A - readonly onYield: () => A - }): (self: ChildExecutorDecision) => A - ( - self: ChildExecutorDecision, - options: { readonly onContinue: () => A; readonly onClose: (value: unknown) => A; readonly onYield: () => A } - ): A -} -``` - -Added in v2.0.0 - -# models - -## ChildExecutorDecision (type alias) - -**Signature** - -```ts -export type ChildExecutorDecision = Continue | Close | Yield -``` - -Added in v2.0.0 - -## Close (interface) - -Close the current substream with a given value and pass execution to the -next substream - -**Signature** - -```ts -export interface Close extends ChildExecutorDecision.Proto { - readonly _tag: "Close" - readonly value: unknown -} -``` - -Added in v2.0.0 - -## Continue (interface) - -Continue executing the current substream - -**Signature** - -```ts -export interface Continue extends ChildExecutorDecision.Proto { - readonly _tag: "Continue" -} -``` - -Added in v2.0.0 - -## Yield (interface) - -Pass execution to the next substream. This either pulls a new element -from upstream, or yields to an already created active substream. - -**Signature** - -```ts -export interface Yield extends ChildExecutorDecision.Proto { - readonly _tag: "Yield" -} -``` - -Added in v2.0.0 - -# refinements - -## isChildExecutorDecision - -Returns `true` if the specified value is a `ChildExecutorDecision`, `false` -otherwise. - -**Signature** - -```ts -export declare const isChildExecutorDecision: (u: unknown) => u is ChildExecutorDecision -``` - -Added in v2.0.0 - -## isClose - -Returns `true` if the specified `ChildExecutorDecision` is a `Close`, `false` -otherwise. - -**Signature** - -```ts -export declare const isClose: (self: ChildExecutorDecision) => self is Close -``` - -Added in v2.0.0 - -## isContinue - -Returns `true` if the specified `ChildExecutorDecision` is a `Continue`, -`false` otherwise. - -**Signature** - -```ts -export declare const isContinue: (self: ChildExecutorDecision) => self is Continue -``` - -Added in v2.0.0 - -## isYield - -Returns `true` if the specified `ChildExecutorDecision` is a `Yield`, `false` -otherwise. - -**Signature** - -```ts -export declare const isYield: (self: ChildExecutorDecision) => self is Yield -``` - -Added in v2.0.0 - -# symbols - -## ChildExecutorDecisionTypeId - -**Signature** - -```ts -export declare const ChildExecutorDecisionTypeId: typeof ChildExecutorDecisionTypeId -``` - -Added in v2.0.0 - -## ChildExecutorDecisionTypeId (type alias) - -**Signature** - -```ts -export type ChildExecutorDecisionTypeId = typeof ChildExecutorDecisionTypeId -``` - -Added in v2.0.0 - -# utils - -## ChildExecutorDecision (namespace) - -Added in v2.0.0 - -### Proto (interface) - -**Signature** - -```ts -export interface Proto { - readonly [ChildExecutorDecisionTypeId]: ChildExecutorDecisionTypeId -} -``` - -Added in v2.0.0 diff --git a/docs/modules/Chunk.ts.md b/docs/modules/Chunk.ts.md deleted file mode 100644 index 29af0b281..000000000 --- a/docs/modules/Chunk.ts.md +++ /dev/null @@ -1,1328 +0,0 @@ ---- -title: Chunk.ts -nav_order: 9 -parent: Modules ---- - -## Chunk overview - -Added in v2.0.0 - ---- - -

Table of contents

- -- [combinators](#combinators) - - [forEach](#foreach) -- [concatenating](#concatenating) - - [append](#append) - - [appendAll](#appendall) - - [appendAllNonEmpty](#appendallnonempty) - - [prepend](#prepend) - - [prependAll](#prependall) - - [prependAllNonEmpty](#prependallnonempty) -- [constructors](#constructors) - - [empty](#empty) - - [isChunk](#ischunk) - - [make](#make) - - [makeBy](#makeby) - - [of](#of) - - [range](#range) -- [conversions](#conversions) - - [fromIterable](#fromiterable) - - [toArray](#toarray) - - [toReadonlyArray](#toreadonlyarray) -- [elements](#elements) - - [chunksOf](#chunksof) - - [contains](#contains) - - [containsWith](#containswith) - - [dedupe](#dedupe) - - [every](#every) - - [findFirst](#findfirst) - - [findFirstIndex](#findfirstindex) - - [findLast](#findlast) - - [findLastIndex](#findlastindex) - - [get](#get) - - [head](#head) - - [headNonEmpty](#headnonempty) - - [intersection](#intersection) - - [isEmpty](#isempty) - - [isNonEmpty](#isnonempty) - - [last](#last) - - [reverse](#reverse) - - [size](#size) - - [some](#some) - - [sort](#sort) - - [sortWith](#sortwith) - - [split](#split) - - [splitAt](#splitat) - - [splitWhere](#splitwhere) - - [tail](#tail) - - [tailNonEmpty](#tailnonempty) - - [takeRight](#takeright) - - [takeWhile](#takewhile) - - [union](#union) - - [unzip](#unzip) - - [zip](#zip) - - [zipWith](#zipwith) -- [equivalence](#equivalence) - - [getEquivalence](#getequivalence) -- [filtering](#filtering) - - [compact](#compact) - - [dedupeAdjacent](#dedupeadjacent) - - [filter](#filter) - - [filterMap](#filtermap) - - [filterMapWhile](#filtermapwhile) - - [partition](#partition) - - [partitionMap](#partitionmap) - - [separate](#separate) -- [folding](#folding) - - [join](#join) - - [mapAccum](#mapaccum) - - [reduce](#reduce) - - [reduceRight](#reduceright) -- [mapping](#mapping) - - [map](#map) -- [model](#model) - - [NonEmptyChunk (interface)](#nonemptychunk-interface) -- [models](#models) - - [Chunk (interface)](#chunk-interface) -- [sequencing](#sequencing) - - [flatMap](#flatmap) - - [flatMapNonEmpty](#flatmapnonempty) - - [flatten](#flatten) - - [flattenNonEmpty](#flattennonempty) -- [symbol](#symbol) - - [TypeId (type alias)](#typeid-type-alias) -- [type lambdas](#type-lambdas) - - [ChunkTypeLambda (interface)](#chunktypelambda-interface) -- [unsafe](#unsafe) - - [unsafeFromArray](#unsafefromarray) - - [unsafeFromNonEmptyArray](#unsafefromnonemptyarray) - - [unsafeGet](#unsafeget) - - [unsafeHead](#unsafehead) - - [unsafeLast](#unsafelast) -- [utils](#utils) - - [Chunk (namespace)](#chunk-namespace) - - [Infer (type alias)](#infer-type-alias) - - [With (type alias)](#with-type-alias) - - [drop](#drop) - - [dropRight](#dropright) - - [dropWhile](#dropwhile) - - [modify](#modify) - - [modifyOption](#modifyoption) - - [remove](#remove) - - [replace](#replace) - - [replaceOption](#replaceoption) - - [take](#take) - ---- - -# combinators - -## forEach - -Applies the specified function to each element of the `List`. - -**Signature** - -```ts -export declare const forEach: { - (f: (a: A) => B): (self: Chunk
) => void - (self: Chunk, f: (a: A) => B): void -} -``` - -Added in v2.0.0 - -# concatenating - -## append - -Appends the specified element to the end of the `Chunk`. - -**Signature** - -```ts -export declare const append: { - (a: A2): (self: Chunk) => NonEmptyChunk - (self: Chunk, a: A2): NonEmptyChunk -} -``` - -Added in v2.0.0 - -## appendAll - -Concatenates the two chunks - -**Signature** - -```ts -export declare const appendAll: { - (that: Chunk): (self: Chunk) => Chunk - (self: Chunk, that: Chunk): Chunk -} -``` - -Added in v2.0.0 - -## appendAllNonEmpty - -**Signature** - -```ts -export declare const appendAllNonEmpty: { - (that: NonEmptyChunk): (self: Chunk) => NonEmptyChunk - (that: Chunk): (self: NonEmptyChunk) => NonEmptyChunk - (self: Chunk, that: NonEmptyChunk): NonEmptyChunk - (self: NonEmptyChunk, that: Chunk): NonEmptyChunk -} -``` - -Added in v2.0.0 - -## prepend - -Prepend an element to the front of a `Chunk`, creating a new `NonEmptyChunk`. - -**Signature** - -```ts -export declare const prepend: { - (elem: B): (self: Chunk) => NonEmptyChunk - (self: Chunk, elem: B): NonEmptyChunk -} -``` - -Added in v2.0.0 - -## prependAll - -**Signature** - -```ts -export declare const prependAll: { - (that: Chunk): (self: Chunk) => Chunk - (self: Chunk, that: Chunk): Chunk -} -``` - -Added in v2.0.0 - -## prependAllNonEmpty - -**Signature** - -```ts -export declare const prependAllNonEmpty: { - (that: NonEmptyChunk): (self: Chunk) => NonEmptyChunk - (that: Chunk): (self: NonEmptyChunk) => NonEmptyChunk - (self: Chunk, that: NonEmptyChunk): NonEmptyChunk - (self: NonEmptyChunk, that: Chunk): NonEmptyChunk -} -``` - -Added in v2.0.0 - -# constructors - -## empty - -**Signature** - -```ts -export declare const empty: () => Chunk -``` - -Added in v2.0.0 - -## isChunk - -Checks if `u` is a `Chunk` - -**Signature** - -```ts -export declare const isChunk: { (u: Iterable): u is Chunk; (u: unknown): u is Chunk } -``` - -Added in v2.0.0 - -## make - -Builds a `NonEmptyChunk` from an non-empty collection of elements. - -**Signature** - -```ts -export declare const make: (...as: As) => NonEmptyChunk -``` - -Added in v2.0.0 - -## makeBy - -Return a Chunk of length n with element i initialized with f(i). - -**Note**. `n` is normalized to an integer >= 1. - -**Signature** - -```ts -export declare const makeBy: { - (f: (i: number) => A): (n: number) => NonEmptyChunk - (n: number, f: (i: number) => A): NonEmptyChunk -} -``` - -Added in v2.0.0 - -## of - -Builds a `NonEmptyChunk` from a single element. - -**Signature** - -```ts -export declare const of: (a: A) => NonEmptyChunk -``` - -Added in v2.0.0 - -## range - -Create a non empty `Chunk` containing a range of integers, including both endpoints. - -**Signature** - -```ts -export declare const range: (start: number, end: number) => NonEmptyChunk -``` - -Added in v2.0.0 - -# conversions - -## fromIterable - -Converts from an `Iterable` - -**Signature** - -```ts -export declare const fromIterable: (self: Iterable) => Chunk -``` - -Added in v2.0.0 - -## toArray - -Converts the specified `Chunk` to a `Array`. - -**Signature** - -```ts -export declare const toArray: (self: Chunk) => A[] -``` - -Added in v2.0.0 - -## toReadonlyArray - -Converts the specified `Chunk` to a `ReadonlyArray`. - -**Signature** - -```ts -export declare const toReadonlyArray: (self: Chunk) => readonly A[] -``` - -Added in v2.0.0 - -# elements - -## chunksOf - -Groups elements in chunks of up to `n` elements. - -**Signature** - -```ts -export declare const chunksOf: { - (n: number): (self: Chunk) => Chunk> - (self: Chunk, n: number): Chunk> -} -``` - -Added in v2.0.0 - -## contains - -Returns a function that checks if a `Chunk` contains a given value using the default `Equivalence`. - -**Signature** - -```ts -export declare const contains: { (a: A): (self: Chunk) => boolean; (self: Chunk, a: A): boolean } -``` - -Added in v2.0.0 - -## containsWith - -Returns a function that checks if a `Chunk` contains a given value using a provided `isEquivalent` function. - -**Signature** - -```ts -export declare const containsWith: (isEquivalent: (self: A, that: A) => boolean) => { - (a: A): (self: Chunk) => boolean - (self: Chunk, a: A): boolean -} -``` - -Added in v2.0.0 - -## dedupe - -Remove duplicates from an array, keeping the first occurrence of an element. - -**Signature** - -```ts -export declare const dedupe: (self: Chunk) => Chunk -``` - -Added in v2.0.0 - -## every - -Check if a predicate holds true for every `Chunk` element. - -**Signature** - -```ts -export declare const every: { - (refinement: Refinement): (self: Chunk) => self is Chunk - (predicate: Predicate): (self: Chunk) => boolean - (self: Chunk, refinement: Refinement): self is Chunk - (self: Chunk, predicate: Predicate): boolean -} -``` - -Added in v2.0.0 - -## findFirst - -Returns the first element that satisfies the specified -predicate, or `None` if no such element exists. - -**Signature** - -```ts -export declare const findFirst: { - (refinement: Refinement): (self: Chunk) => Option - (predicate: Predicate): (self: Chunk) => Option - (self: Chunk, refinement: Refinement): Option - (self: Chunk, predicate: Predicate): Option -} -``` - -Added in v2.0.0 - -## findFirstIndex - -Return the first index for which a predicate holds. - -**Signature** - -```ts -export declare const findFirstIndex: { - (predicate: Predicate): (self: Chunk) => Option - (self: Chunk, predicate: Predicate): Option -} -``` - -Added in v2.0.0 - -## findLast - -Find the last element for which a predicate holds. - -**Signature** - -```ts -export declare const findLast: { - (refinement: Refinement): (self: Chunk) => Option - (predicate: Predicate): (self: Chunk) => Option - (self: Chunk, refinement: Refinement): Option - (self: Chunk, predicate: Predicate): Option -} -``` - -Added in v2.0.0 - -## findLastIndex - -Return the last index for which a predicate holds. - -**Signature** - -```ts -export declare const findLastIndex: { - (predicate: Predicate): (self: Chunk) => Option - (self: Chunk, predicate: Predicate): Option -} -``` - -Added in v2.0.0 - -## get - -This function provides a safe way to read a value at a particular index from a `Chunk`. - -**Signature** - -```ts -export declare const get: { - (index: number): (self: Chunk) => Option - (self: Chunk, index: number): Option -} -``` - -Added in v2.0.0 - -## head - -Returns the first element of this chunk if it exists. - -**Signature** - -```ts -export declare const head: (self: Chunk) => Option -``` - -Added in v2.0.0 - -## headNonEmpty - -Returns the first element of this non empty chunk. - -**Signature** - -```ts -export declare const headNonEmpty: (self: NonEmptyChunk) => A -``` - -Added in v2.0.0 - -## intersection - -Creates a Chunk of unique values that are included in all given Chunks. - -The order and references of result values are determined by the Chunk. - -**Signature** - -```ts -export declare const intersection: { - (that: Chunk): (self: Chunk) => Chunk - (self: Chunk, that: Chunk): Chunk -} -``` - -Added in v2.0.0 - -## isEmpty - -Determines if the chunk is empty. - -**Signature** - -```ts -export declare const isEmpty: (self: Chunk) => boolean -``` - -Added in v2.0.0 - -## isNonEmpty - -Determines if the chunk is not empty. - -**Signature** - -```ts -export declare const isNonEmpty: (self: Chunk) => self is NonEmptyChunk -``` - -Added in v2.0.0 - -## last - -Returns the last element of this chunk if it exists. - -**Signature** - -```ts -export declare const last: (self: Chunk) => Option -``` - -Added in v2.0.0 - -## reverse - -**Signature** - -```ts -export declare const reverse: (self: Chunk) => Chunk -``` - -Added in v2.0.0 - -## size - -Retireves the size of the chunk - -**Signature** - -```ts -export declare const size: (self: Chunk) => number -``` - -Added in v2.0.0 - -## some - -Check if a predicate holds true for some `Chunk` element. - -**Signature** - -```ts -export declare const some: { - (predicate: Predicate): (self: Chunk) => self is NonEmptyChunk - (self: Chunk, predicate: Predicate): self is NonEmptyChunk -} -``` - -Added in v2.0.0 - -## sort - -Sort the elements of a Chunk in increasing order, creating a new Chunk. - -**Signature** - -```ts -export declare const sort: { - (O: Order.Order): (self: Chunk) => Chunk - (self: Chunk, O: Order.Order): Chunk -} -``` - -Added in v2.0.0 - -## sortWith - -**Signature** - -```ts -export declare const sortWith: { - (f: (a: A) => B, order: Order.Order): (self: Chunk) => Chunk - (self: Chunk, f: (a: A) => B, order: Order.Order): Chunk -} -``` - -Added in v2.0.0 - -## split - -Splits this chunk into `n` equally sized chunks. - -**Signature** - -```ts -export declare const split: { - (n: number): (self: Chunk) => Chunk> - (self: Chunk, n: number): Chunk> -} -``` - -Added in v2.0.0 - -## splitAt - -Returns two splits of this chunk at the specified index. - -**Signature** - -```ts -export declare const splitAt: { - (n: number): (self: Chunk) => [Chunk, Chunk] - (self: Chunk, n: number): [Chunk, Chunk] -} -``` - -Added in v2.0.0 - -## splitWhere - -Splits this chunk on the first element that matches this predicate. - -**Signature** - -```ts -export declare const splitWhere: { - (predicate: Predicate): (self: Chunk) => [Chunk, Chunk] - (self: Chunk, predicate: Predicate): [Chunk, Chunk] -} -``` - -Added in v2.0.0 - -## tail - -Returns every elements after the first. - -**Signature** - -```ts -export declare const tail: (self: Chunk) => Option> -``` - -Added in v2.0.0 - -## tailNonEmpty - -Returns every elements after the first. - -**Signature** - -```ts -export declare const tailNonEmpty: (self: NonEmptyChunk) => Chunk -``` - -Added in v2.0.0 - -## takeRight - -Takes the last `n` elements. - -**Signature** - -```ts -export declare const takeRight: { - (n: number): (self: Chunk) => Chunk - (self: Chunk, n: number): Chunk -} -``` - -Added in v2.0.0 - -## takeWhile - -Takes all elements so long as the predicate returns true. - -**Signature** - -```ts -export declare const takeWhile: { - (predicate: Predicate): (self: Chunk) => Chunk - (self: Chunk, predicate: Predicate): Chunk -} -``` - -Added in v2.0.0 - -## union - -Creates a Chunks of unique values, in order, from all given Chunks. - -**Signature** - -```ts -export declare const union: { - (that: Chunk): (self: Chunk) => Chunk - (self: Chunk, that: Chunk): Chunk -} -``` - -Added in v2.0.0 - -## unzip - -Takes a `Chunk` of pairs and return two corresponding `Chunk`s. - -Note: The function is reverse of `zip`. - -**Signature** - -```ts -export declare const unzip: (self: Chunk) => [Chunk, Chunk] -``` - -Added in v2.0.0 - -## zip - -Zips this chunk pointwise with the specified chunk. - -**Signature** - -```ts -export declare const zip: { - (that: Chunk): (self: Chunk) => Chunk<[A, B]> - (self: Chunk, that: Chunk): Chunk<[A, B]> -} -``` - -Added in v2.0.0 - -## zipWith - -Zips this chunk pointwise with the specified chunk using the specified combiner. - -**Signature** - -```ts -export declare const zipWith: { - (that: Chunk, f: (a: A, b: B) => C): (self: Chunk) => Chunk - (self: Chunk, that: Chunk, f: (a: A, b: B) => C): Chunk -} -``` - -Added in v2.0.0 - -# equivalence - -## getEquivalence - -Compares the two chunks of equal length using the specified function - -**Signature** - -```ts -export declare const getEquivalence: (isEquivalent: Equivalence.Equivalence) => Equivalence.Equivalence> -``` - -Added in v2.0.0 - -# filtering - -## compact - -Filter out optional values - -**Signature** - -```ts -export declare const compact: (self: Chunk>) => Chunk -``` - -Added in v2.0.0 - -## dedupeAdjacent - -Deduplicates adjacent elements that are identical. - -**Signature** - -```ts -export declare const dedupeAdjacent: (self: Chunk) => Chunk -``` - -Added in v2.0.0 - -## filter - -Returns a filtered and mapped subset of the elements. - -**Signature** - -```ts -export declare const filter: { - (refinement: Refinement): (self: Chunk) => Chunk - (predicate: Predicate): (self: Chunk) => Chunk - (self: Chunk, refinement: Refinement): Chunk - (self: Chunk, predicate: Predicate): Chunk -} -``` - -Added in v2.0.0 - -## filterMap - -Returns a filtered and mapped subset of the elements. - -**Signature** - -```ts -export declare const filterMap: { - (f: (a: A, i: number) => Option): (self: Chunk) => Chunk - (self: Chunk, f: (a: A, i: number) => Option): Chunk -} -``` - -Added in v2.0.0 - -## filterMapWhile - -Transforms all elements of the chunk for as long as the specified function returns some value - -**Signature** - -```ts -export declare const filterMapWhile: { - (f: (a: A) => Option): (self: Chunk) => Chunk - (self: Chunk, f: (a: A) => Option): Chunk -} -``` - -Added in v2.0.0 - -## partition - -Separate elements based on a predicate that also exposes the index of the element. - -**Signature** - -```ts -export declare const partition: { - (refinement: Refinement): (self: Chunk) => [Chunk>, Chunk] - (predicate: (a: A) => boolean): (self: Chunk) => [Chunk, Chunk] - (self: Chunk, refinement: Refinement): [Chunk>, Chunk] - (self: Chunk, predicate: (a: A) => boolean): [Chunk, Chunk] -} -``` - -Added in v2.0.0 - -## partitionMap - -Partitions the elements of this chunk into two chunks using f. - -**Signature** - -```ts -export declare const partitionMap: { - (f: (a: A) => Either): (self: Chunk) => [Chunk, Chunk] - (self: Chunk, f: (a: A) => Either): [Chunk, Chunk] -} -``` - -Added in v2.0.0 - -## separate - -Partitions the elements of this chunk into two chunks. - -**Signature** - -```ts -export declare const separate: (self: Chunk>) => [Chunk, Chunk] -``` - -Added in v2.0.0 - -# folding - -## join - -Joins the elements together with "sep" in the middle. - -**Signature** - -```ts -export declare const join: { - (sep: string): (self: Chunk) => string - (self: Chunk, sep: string): string -} -``` - -Added in v2.0.0 - -## mapAccum - -Statefully maps over the chunk, producing new elements of type `B`. - -**Signature** - -```ts -export declare const mapAccum: { - (s: S, f: (s: S, a: A) => readonly [S, B]): (self: Chunk) => [S, Chunk] - (self: Chunk, s: S, f: (s: S, a: A) => readonly [S, B]): [S, Chunk] -} -``` - -Added in v2.0.0 - -## reduce - -**Signature** - -```ts -export declare const reduce: { - (b: B, f: (b: B, a: A, i: number) => B): (self: Chunk) => B - (self: Chunk, b: B, f: (b: B, a: A, i: number) => B): B -} -``` - -Added in v2.0.0 - -## reduceRight - -**Signature** - -```ts -export declare const reduceRight: { - (b: B, f: (b: B, a: A, i: number) => B): (self: Chunk) => B - (self: Chunk, b: B, f: (b: B, a: A, i: number) => B): B -} -``` - -Added in v2.0.0 - -# mapping - -## map - -Returns a chunk with the elements mapped by the specified f function. - -**Signature** - -```ts -export declare const map: { - , B>(f: (a: Chunk.Infer, i: number) => B): (self: T) => Chunk.With - , B>(self: T, f: (a: Chunk.Infer, i: number) => B): Chunk.With -} -``` - -Added in v2.0.0 - -# model - -## NonEmptyChunk (interface) - -**Signature** - -```ts -export interface NonEmptyChunk extends Chunk, NonEmptyIterable {} -``` - -Added in v2.0.0 - -# models - -## Chunk (interface) - -**Signature** - -```ts -export interface Chunk extends Iterable, Equal.Equal, Pipeable, Inspectable { - readonly [TypeId]: { - readonly _A: (_: never) => A - } - readonly length: number - /** @internal */ - right: Chunk - /** @internal */ - left: Chunk - /** @internal */ - backing: Backing - /** @internal */ - depth: number -} -``` - -Added in v2.0.0 - -# sequencing - -## flatMap - -Returns a chunk with the elements mapped by the specified function. - -**Signature** - -```ts -export declare const flatMap: { - (f: (a: A, i: number) => Chunk): (self: Chunk) => Chunk - (self: Chunk, f: (a: A, i: number) => Chunk): Chunk -} -``` - -Added in v2.0.0 - -## flatMapNonEmpty - -**Signature** - -```ts -export declare const flatMapNonEmpty: { - (f: (a: A, i: number) => NonEmptyChunk): (self: NonEmptyChunk) => NonEmptyChunk - (self: NonEmptyChunk, f: (a: A, i: number) => NonEmptyChunk): NonEmptyChunk -} -``` - -Added in v2.0.0 - -## flatten - -Flattens a chunk of chunks into a single chunk by concatenating all chunks. - -**Signature** - -```ts -export declare const flatten: (self: Chunk>) => Chunk -``` - -Added in v2.0.0 - -## flattenNonEmpty - -**Signature** - -```ts -export declare const flattenNonEmpty: (self: NonEmptyChunk>) => NonEmptyChunk -``` - -Added in v2.0.0 - -# symbol - -## TypeId (type alias) - -**Signature** - -```ts -export type TypeId = typeof TypeId -``` - -Added in v2.0.0 - -# type lambdas - -## ChunkTypeLambda (interface) - -**Signature** - -```ts -export interface ChunkTypeLambda extends TypeLambda { - readonly type: Chunk -} -``` - -Added in v2.0.0 - -# unsafe - -## unsafeFromArray - -Wraps an array into a chunk without copying, unsafe on mutable arrays - -**Signature** - -```ts -export declare const unsafeFromArray: (self: readonly A[]) => Chunk -``` - -Added in v2.0.0 - -## unsafeFromNonEmptyArray - -Wraps an array into a chunk without copying, unsafe on mutable arrays - -**Signature** - -```ts -export declare const unsafeFromNonEmptyArray: (self: readonly [A, ...A[]]) => NonEmptyChunk -``` - -Added in v2.0.0 - -## unsafeGet - -Gets an element unsafely, will throw on out of bounds - -**Signature** - -```ts -export declare const unsafeGet: { (index: number): (self: Chunk) => A; (self: Chunk, index: number): A } -``` - -Added in v2.0.0 - -## unsafeHead - -Returns the first element of this chunk. - -**Signature** - -```ts -export declare const unsafeHead: (self: Chunk) => A -``` - -Added in v2.0.0 - -## unsafeLast - -Returns the last element of this chunk. - -**Signature** - -```ts -export declare const unsafeLast: (self: Chunk) => A -``` - -Added in v2.0.0 - -# utils - -## Chunk (namespace) - -Added in v2.0.0 - -### Infer (type alias) - -**Signature** - -```ts -export type Infer> = T extends Chunk ? A : never -``` - -Added in v2.0.0 - -### With (type alias) - -**Signature** - -```ts -export type With, A> = T extends NonEmptyChunk ? NonEmptyChunk : Chunk -``` - -Added in v2.0.0 - -## drop - -Drops the first up to `n` elements from the chunk - -**Signature** - -```ts -export declare const drop: { (n: number): (self: Chunk) => Chunk; (self: Chunk, n: number): Chunk } -``` - -Added in v2.0.0 - -## dropRight - -Drops the last `n` elements. - -**Signature** - -```ts -export declare const dropRight: { - (n: number): (self: Chunk) => Chunk - (self: Chunk, n: number): Chunk -} -``` - -Added in v2.0.0 - -## dropWhile - -Drops all elements so long as the predicate returns true. - -**Signature** - -```ts -export declare const dropWhile: { - (f: (a: A) => boolean): (self: Chunk) => Chunk - (self: Chunk, f: (a: A) => boolean): Chunk -} -``` - -Added in v2.0.0 - -## modify - -Apply a function to the element at the specified index, creating a new `Chunk`, -or returning the input if the index is out of bounds. - -**Signature** - -```ts -export declare const modify: { - (i: number, f: (a: A) => B): (self: Chunk) => Chunk - (self: Chunk, i: number, f: (a: A) => B): Chunk -} -``` - -Added in v2.0.0 - -## modifyOption - -**Signature** - -```ts -export declare const modifyOption: { - (i: number, f: (a: A) => B): (self: Chunk) => Option> - (self: Chunk, i: number, f: (a: A) => B): Option> -} -``` - -Added in v2.0.0 - -## remove - -Delete the element at the specified index, creating a new `Chunk`, -or returning the input if the index is out of bounds. - -**Signature** - -```ts -export declare const remove: { (i: number): (self: Chunk) => Chunk; (self: Chunk, i: number): Chunk } -``` - -Added in v2.0.0 - -## replace - -Change the element at the specified index, creating a new `Chunk`, -or returning the input if the index is out of bounds. - -**Signature** - -```ts -export declare const replace: { - (i: number, b: B): (self: Chunk) => Chunk - (self: Chunk, i: number, b: B): Chunk -} -``` - -Added in v2.0.0 - -## replaceOption - -**Signature** - -```ts -export declare const replaceOption: { - (i: number, b: B): (self: Chunk) => Option> - (self: Chunk, i: number, b: B): Option> -} -``` - -Added in v2.0.0 - -## take - -Takes the first up to `n` elements from the chunk - -**Signature** - -```ts -export declare const take: { (n: number): (self: Chunk) => Chunk; (self: Chunk, n: number): Chunk } -``` - -Added in v2.0.0 diff --git a/docs/modules/Clock.ts.md b/docs/modules/Clock.ts.md deleted file mode 100644 index 44f1848d8..000000000 --- a/docs/modules/Clock.ts.md +++ /dev/null @@ -1,190 +0,0 @@ ---- -title: Clock.ts -nav_order: 10 -parent: Modules ---- - -## Clock overview - -Added in v2.0.0 - ---- - -

Table of contents

- -- [constructors](#constructors) - - [clockWith](#clockwith) - - [currentTimeMillis](#currenttimemillis) - - [currentTimeNanos](#currenttimenanos) - - [make](#make) - - [sleep](#sleep) -- [context](#context) - - [Clock](#clock) -- [models](#models) - - [CancelToken (type alias)](#canceltoken-type-alias) - - [Clock (interface)](#clock-interface) - - [ClockScheduler (interface)](#clockscheduler-interface) - - [Task (type alias)](#task-type-alias) -- [symbols](#symbols) - - [ClockTypeId](#clocktypeid) - - [ClockTypeId (type alias)](#clocktypeid-type-alias) - ---- - -# constructors - -## clockWith - -**Signature** - -```ts -export declare const clockWith: (f: (clock: Clock) => Effect.Effect) => Effect.Effect -``` - -Added in v2.0.0 - -## currentTimeMillis - -**Signature** - -```ts -export declare const currentTimeMillis: Effect.Effect -``` - -Added in v2.0.0 - -## currentTimeNanos - -**Signature** - -```ts -export declare const currentTimeNanos: Effect.Effect -``` - -Added in v2.0.0 - -## make - -**Signature** - -```ts -export declare const make: (_: void) => Clock -``` - -Added in v2.0.0 - -## sleep - -**Signature** - -```ts -export declare const sleep: (duration: Duration.DurationInput) => Effect.Effect -``` - -Added in v2.0.0 - -# context - -## Clock - -**Signature** - -```ts -export declare const Clock: Context.Tag -``` - -Added in v2.0.0 - -# models - -## CancelToken (type alias) - -**Signature** - -```ts -export type CancelToken = () => boolean -``` - -Added in v2.0.0 - -## Clock (interface) - -Represents a time-based clock which provides functionality related to time -and scheduling. - -**Signature** - -```ts -export interface Clock { - readonly [ClockTypeId]: ClockTypeId - /** - * Unsafely returns the current time in milliseconds. - */ - readonly unsafeCurrentTimeMillis: () => number - /** - * Returns the current time in milliseconds. - */ - readonly currentTimeMillis: Effect.Effect - /** - * Unsafely returns the current time in nanoseconds. - */ - readonly unsafeCurrentTimeNanos: () => bigint - /** - * Returns the current time in nanoseconds. - */ - readonly currentTimeNanos: Effect.Effect - /** - * Asynchronously sleeps for the specified duration. - */ - readonly sleep: (duration: Duration.Duration) => Effect.Effect -} -``` - -Added in v2.0.0 - -## ClockScheduler (interface) - -**Signature** - -```ts -export interface ClockScheduler { - /** - * Unsafely schedules the specified task for the specified duration. - */ - readonly unsafeSchedule: (task: Task, duration: Duration.Duration) => CancelToken -} -``` - -Added in v2.0.0 - -## Task (type alias) - -**Signature** - -```ts -export type Task = () => void -``` - -Added in v2.0.0 - -# symbols - -## ClockTypeId - -**Signature** - -```ts -export declare const ClockTypeId: typeof ClockTypeId -``` - -Added in v2.0.0 - -## ClockTypeId (type alias) - -**Signature** - -```ts -export type ClockTypeId = typeof ClockTypeId -``` - -Added in v2.0.0 diff --git a/docs/modules/Config.ts.md b/docs/modules/Config.ts.md deleted file mode 100644 index 617982959..000000000 --- a/docs/modules/Config.ts.md +++ /dev/null @@ -1,631 +0,0 @@ ---- -title: Config.ts -nav_order: 11 -parent: Modules ---- - -## Config overview - -Added in v2.0.0 - ---- - -

Table of contents

- -- [constructors](#constructors) - - [all](#all) - - [array](#array) - - [boolean](#boolean) - - [chunk](#chunk) - - [date](#date) - - [fail](#fail) - - [hashMap](#hashmap) - - [hashSet](#hashset) - - [integer](#integer) - - [logLevel](#loglevel) - - [number](#number) - - [primitive](#primitive) - - [secret](#secret) - - [string](#string) - - [succeed](#succeed) - - [suspend](#suspend) - - [sync](#sync) - - [unwrap](#unwrap) -- [models](#models) - - [Config (interface)](#config-interface) -- [refinements](#refinements) - - [isConfig](#isconfig) -- [symbols](#symbols) - - [ConfigTypeId](#configtypeid) - - [ConfigTypeId (type alias)](#configtypeid-type-alias) -- [utils](#utils) - - [Config (namespace)](#config-namespace) - - [Primitive (interface)](#primitive-interface) - - [Variance (interface)](#variance-interface) - - [Wrap (type alias)](#wrap-type-alias) - - [map](#map) - - [mapAttempt](#mapattempt) - - [mapOrFail](#maporfail) - - [nested](#nested) - - [option](#option) - - [orElse](#orelse) - - [orElseIf](#orelseif) - - [repeat](#repeat) - - [validate](#validate) - - [withDefault](#withdefault) - - [withDescription](#withdescription) - - [zip](#zip) - - [zipWith](#zipwith) - ---- - -# constructors - -## all - -Constructs a config from a tuple / struct / arguments of configs. - -**Signature** - -```ts -export declare const all: > | Record>>( - arg: Arg -) => Config< - [Arg] extends [readonly Config[]] - ? { -readonly [K in keyof Arg]: [Arg[K]] extends [Config] ? A : never } - : [Arg] extends [Iterable>] - ? A[] - : [Arg] extends [Record>] - ? { -readonly [K in keyof Arg]: [Arg[K]] extends [Config] ? A : never } - : never -> -``` - -Added in v2.0.0 - -## array - -Constructs a config for an array of values. - -**Signature** - -```ts -export declare const array:
(config: Config, name?: string | undefined) => Config -``` - -Added in v2.0.0 - -## boolean - -Constructs a config for a boolean value. - -**Signature** - -```ts -export declare const boolean: (name?: string | undefined) => Config -``` - -Added in v2.0.0 - -## chunk - -Constructs a config for a sequence of values. - -**Signature** - -```ts -export declare const chunk: (config: Config, name?: string | undefined) => Config> -``` - -Added in v2.0.0 - -## date - -Constructs a config for a date value. - -**Signature** - -```ts -export declare const date: (name?: string | undefined) => Config -``` - -Added in v2.0.0 - -## fail - -Constructs a config that fails with the specified message. - -**Signature** - -```ts -export declare const fail: (message: string) => Config -``` - -Added in v2.0.0 - -## hashMap - -Constructs a config for a sequence of values. - -**Signature** - -```ts -export declare const hashMap: (config: Config, name?: string | undefined) => Config> -``` - -Added in v2.0.0 - -## hashSet - -Constructs a config for a sequence of values. - -**Signature** - -```ts -export declare const hashSet: (config: Config, name?: string | undefined) => Config> -``` - -Added in v2.0.0 - -## integer - -Constructs a config for a integer value. - -**Signature** - -```ts -export declare const integer: (name?: string | undefined) => Config -``` - -Added in v2.0.0 - -## logLevel - -Constructs a config for a `LogLevel` value. - -**Signature** - -```ts -export declare const logLevel: (name?: string | undefined) => Config -``` - -Added in v2.0.0 - -## number - -Constructs a config for a float value. - -**Signature** - -```ts -export declare const number: (name?: string | undefined) => Config -``` - -Added in v2.0.0 - -## primitive - -Constructs a new primitive config. - -**Signature** - -```ts -export declare const primitive: ( - description: string, - parse: (text: string) => Either.Either -) => Config -``` - -Added in v2.0.0 - -## secret - -Constructs a config for a secret value. - -**Signature** - -```ts -export declare const secret: (name?: string | undefined) => Config -``` - -Added in v2.0.0 - -## string - -Constructs a config for a string value. - -**Signature** - -```ts -export declare const string: (name?: string | undefined) => Config -``` - -Added in v2.0.0 - -## succeed - -Constructs a config which contains the specified value. - -**Signature** - -```ts -export declare const succeed: (value: A) => Config -``` - -Added in v2.0.0 - -## suspend - -Lazily constructs a config. - -**Signature** - -```ts -export declare const suspend: (config: LazyArg>) => Config -``` - -Added in v2.0.0 - -## sync - -Constructs a config which contains the specified lazy value. - -**Signature** - -```ts -export declare const sync: (value: LazyArg) => Config -``` - -Added in v2.0.0 - -## unwrap - -Constructs a config from some configuration wrapped with the `Wrap` utility type. - -For example: - -``` -import { Config, unwrap } from "./Config" - -interface Options { key: string } - -const makeConfig = (config: Config.Wrap): Config => unwrap(config) -``` - -**Signature** - -```ts -export declare const unwrap: (wrapped: Config.Wrap) => Config -``` - -Added in v2.0.0 - -# models - -## Config (interface) - -A `Config` describes the structure of some configuration data. - -**Signature** - -```ts -export interface Config extends Config.Variance, Pipeable {} -``` - -Added in v2.0.0 - -# refinements - -## isConfig - -This function returns `true` if the specified value is an `Config` value, -`false` otherwise. - -This function can be useful for checking the type of a value before -attempting to operate on it as an `Config` value. For example, you could -use `isConfig` to check the type of a value before using it as an -argument to a function that expects an `Config` value. - -**Signature** - -```ts -export declare const isConfig: (u: unknown) => u is Config -``` - -Added in v2.0.0 - -# symbols - -## ConfigTypeId - -**Signature** - -```ts -export declare const ConfigTypeId: typeof ConfigTypeId -``` - -Added in v2.0.0 - -## ConfigTypeId (type alias) - -**Signature** - -```ts -export type ConfigTypeId = typeof ConfigTypeId -``` - -Added in v2.0.0 - -# utils - -## Config (namespace) - -Added in v2.0.0 - -### Primitive (interface) - -**Signature** - -```ts -export interface Primitive extends Config { - readonly description: string - readonly parse: (text: string) => Either.Either -} -``` - -Added in v2.0.0 - -### Variance (interface) - -**Signature** - -```ts -export interface Variance { - readonly [ConfigTypeId]: { - readonly _A: (_: never) => A - } -} -``` - -Added in v2.0.0 - -### Wrap (type alias) - -Wraps a nested structure, converting all primitives to a `Config`. - -`Config.Wrap<{ key: string }>` becomes `{ key: Config }` - -To create the resulting config, use the `unwrap` constructor. - -**Signature** - -```ts -export type Wrap = - | (A extends Record - ? { - [K in keyof A]: Wrap - } - : never) - | Config -``` - -Added in v2.0.0 - -## map - -Returns a config whose structure is the same as this one, but which produces -a different value, constructed using the specified function. - -**Signature** - -```ts -export declare const map: { - (f: (a: A) => B): (self: Config) => Config - (self: Config, f: (a: A) => B): Config -} -``` - -Added in v2.0.0 - -## mapAttempt - -Returns a config whose structure is the same as this one, but which may -produce a different value, constructed using the specified function, which -may throw exceptions that will be translated into validation errors. - -**Signature** - -```ts -export declare const mapAttempt: { - (f: (a: A) => B): (self: Config) => Config - (self: Config, f: (a: A) => B): Config -} -``` - -Added in v2.0.0 - -## mapOrFail - -Returns a new config whose structure is the samea as this one, but which -may produce a different value, constructed using the specified fallible -function. - -**Signature** - -```ts -export declare const mapOrFail: { - (f: (a: A) => Either.Either): (self: Config) => Config - (self: Config, f: (a: A) => Either.Either): Config -} -``` - -Added in v2.0.0 - -## nested - -Returns a config that has this configuration nested as a property of the -specified name. - -**Signature** - -```ts -export declare const nested: { - (name: string): (self: Config) => Config - (self: Config, name: string): Config -} -``` - -Added in v2.0.0 - -## option - -Returns an optional version of this config, which will be `None` if the -data is missing from configuration, and `Some` otherwise. - -**Signature** - -```ts -export declare const option: (self: Config) => Config> -``` - -Added in v2.0.0 - -## orElse - -Returns a config whose structure is preferentially described by this -config, but which falls back to the specified config if there is an issue -reading from this config. - -**Signature** - -```ts -export declare const orElse: { - (that: LazyArg>): (self: Config) => Config - (self: Config, that: LazyArg>): Config -} -``` - -Added in v2.0.0 - -## orElseIf - -Returns configuration which reads from this configuration, but which falls -back to the specified configuration if reading from this configuration -fails with an error satisfying the specified predicate. - -**Signature** - -```ts -export declare const orElseIf: { - (options: { - readonly if: Predicate - readonly orElse: LazyArg> - }): (self: Config) => Config - ( - self: Config, - options: { readonly if: Predicate; readonly orElse: LazyArg> } - ): Config -} -``` - -Added in v2.0.0 - -## repeat - -Returns a config that describes a sequence of values, each of which has the -structure of this config. - -**Signature** - -```ts -export declare const repeat: (self: Config) => Config -``` - -Added in v2.0.0 - -## validate - -Returns a config that describes the same structure as this one, but which -performs validation during loading. - -**Signature** - -```ts -export declare const validate: { - (options: { - readonly message: string - readonly validation: Refinement - }): (self: Config) => Config - (options: { readonly message: string; readonly validation: Predicate }): (self: Config) => Config - ( - self: Config, - options: { readonly message: string; readonly validation: Refinement } - ): Config - (self: Config, options: { readonly message: string; readonly validation: Predicate }): Config -} -``` - -Added in v2.0.0 - -## withDefault - -Returns a config that describes the same structure as this one, but has the -specified default value in case the information cannot be found. - -**Signature** - -```ts -export declare const withDefault: { - (def: A2): (self: Config) => Config - (self: Config, def: A2): Config -} -``` - -Added in v2.0.0 - -## withDescription - -Adds a description to this configuration, which is intended for humans. - -**Signature** - -```ts -export declare const withDescription: { - (description: string): (self: Config) => Config - (self: Config, description: string): Config -} -``` - -Added in v2.0.0 - -## zip - -Returns a config that is the composition of this config and the specified -config. - -**Signature** - -```ts -export declare const zip: { - (that: Config): (self: Config) => Config<[A, B]> - (self: Config, that: Config): Config<[A, B]> -} -``` - -Added in v2.0.0 - -## zipWith - -Returns a config that is the composes this config and the specified config -using the provided function. - -**Signature** - -```ts -export declare const zipWith: { - (that: Config, f: (a: A, b: B) => C): (self: Config) => Config - (self: Config, that: Config, f: (a: A, b: B) => C): Config -} -``` - -Added in v2.0.0 diff --git a/docs/modules/ConfigError.ts.md b/docs/modules/ConfigError.ts.md deleted file mode 100644 index dd54c1814..000000000 --- a/docs/modules/ConfigError.ts.md +++ /dev/null @@ -1,427 +0,0 @@ ---- -title: ConfigError.ts -nav_order: 12 -parent: Modules ---- - -## ConfigError overview - -Added in v2.0.0 - ---- - -

Table of contents

- -- [constructors](#constructors) - - [And](#and) - - [InvalidData](#invaliddata) - - [MissingData](#missingdata) - - [Or](#or) - - [SourceUnavailable](#sourceunavailable) - - [Unsupported](#unsupported) -- [folding](#folding) - - [reduceWithContext](#reducewithcontext) -- [models](#models) - - [And (interface)](#and-interface) - - [ConfigError (type alias)](#configerror-type-alias) - - [ConfigErrorReducer (interface)](#configerrorreducer-interface) - - [InvalidData (interface)](#invaliddata-interface) - - [MissingData (interface)](#missingdata-interface) - - [Options (interface)](#options-interface) - - [Or (interface)](#or-interface) - - [SourceUnavailable (interface)](#sourceunavailable-interface) - - [Unsupported (interface)](#unsupported-interface) -- [refinements](#refinements) - - [isAnd](#isand) - - [isConfigError](#isconfigerror) - - [isInvalidData](#isinvaliddata) - - [isMissingData](#ismissingdata) - - [isOr](#isor) - - [isSourceUnavailable](#issourceunavailable) - - [isUnsupported](#isunsupported) -- [symbols](#symbols) - - [ConfigErrorTypeId](#configerrortypeid) - - [ConfigErrorTypeId (type alias)](#configerrortypeid-type-alias) -- [utils](#utils) - - [ConfigError (namespace)](#configerror-namespace) - - [Proto (interface)](#proto-interface) - - [Reducer (type alias)](#reducer-type-alias) - - [isMissingDataOnly](#ismissingdataonly) - - [prefixed](#prefixed) - ---- - -# constructors - -## And - -**Signature** - -```ts -export declare const And: (self: ConfigError, that: ConfigError) => ConfigError -``` - -Added in v2.0.0 - -## InvalidData - -**Signature** - -```ts -export declare const InvalidData: (path: Array, message: string, options?: Options) => ConfigError -``` - -Added in v2.0.0 - -## MissingData - -**Signature** - -```ts -export declare const MissingData: (path: Array, message: string, options?: Options) => ConfigError -``` - -Added in v2.0.0 - -## Or - -**Signature** - -```ts -export declare const Or: (self: ConfigError, that: ConfigError) => ConfigError -``` - -Added in v2.0.0 - -## SourceUnavailable - -**Signature** - -```ts -export declare const SourceUnavailable: ( - path: Array, - message: string, - cause: Cause.Cause, - options?: Options -) => ConfigError -``` - -Added in v2.0.0 - -## Unsupported - -**Signature** - -```ts -export declare const Unsupported: (path: Array, message: string, options?: Options) => ConfigError -``` - -Added in v2.0.0 - -# folding - -## reduceWithContext - -**Signature** - -```ts -export declare const reduceWithContext: { - (context: C, reducer: ConfigErrorReducer): (self: ConfigError) => Z - (self: ConfigError, context: C, reducer: ConfigErrorReducer): Z -} -``` - -Added in v2.0.0 - -# models - -## And (interface) - -**Signature** - -```ts -export interface And extends ConfigError.Proto { - readonly _tag: "And" - readonly left: ConfigError - readonly right: ConfigError -} -``` - -Added in v2.0.0 - -## ConfigError (type alias) - -The possible ways that loading configuration data may fail. - -**Signature** - -```ts -export type ConfigError = And | Or | InvalidData | MissingData | SourceUnavailable | Unsupported -``` - -Added in v2.0.0 - -## ConfigErrorReducer (interface) - -**Signature** - -```ts -export interface ConfigErrorReducer { - readonly andCase: (context: C, left: Z, right: Z) => Z - readonly orCase: (context: C, left: Z, right: Z) => Z - readonly invalidDataCase: (context: C, path: Array, message: string) => Z - readonly missingDataCase: (context: C, path: Array, message: string) => Z - readonly sourceUnavailableCase: (context: C, path: Array, message: string, cause: Cause.Cause) => Z - readonly unsupportedCase: (context: C, path: Array, message: string) => Z -} -``` - -Added in v2.0.0 - -## InvalidData (interface) - -**Signature** - -```ts -export interface InvalidData extends ConfigError.Proto { - readonly _tag: "InvalidData" - readonly path: Array - readonly message: string -} -``` - -Added in v2.0.0 - -## MissingData (interface) - -**Signature** - -```ts -export interface MissingData extends ConfigError.Proto { - readonly _tag: "MissingData" - readonly path: Array - readonly message: string -} -``` - -Added in v2.0.0 - -## Options (interface) - -**Signature** - -```ts -export interface Options { - readonly pathDelim: string -} -``` - -Added in v2.0.0 - -## Or (interface) - -**Signature** - -```ts -export interface Or extends ConfigError.Proto { - readonly _tag: "Or" - readonly left: ConfigError - readonly right: ConfigError -} -``` - -Added in v2.0.0 - -## SourceUnavailable (interface) - -**Signature** - -```ts -export interface SourceUnavailable extends ConfigError.Proto { - readonly _tag: "SourceUnavailable" - readonly path: Array - readonly message: string - readonly cause: Cause.Cause -} -``` - -Added in v2.0.0 - -## Unsupported (interface) - -**Signature** - -```ts -export interface Unsupported extends ConfigError.Proto { - readonly _tag: "Unsupported" - readonly path: Array - readonly message: string -} -``` - -Added in v2.0.0 - -# refinements - -## isAnd - -Returns `true` if the specified `ConfigError` is an `And`, `false` otherwise. - -**Signature** - -```ts -export declare const isAnd: (self: ConfigError) => self is And -``` - -Added in v2.0.0 - -## isConfigError - -Returns `true` if the specified value is a `ConfigError`, `false` otherwise. - -**Signature** - -```ts -export declare const isConfigError: (u: unknown) => u is ConfigError -``` - -Added in v2.0.0 - -## isInvalidData - -Returns `true` if the specified `ConfigError` is an `InvalidData`, `false` -otherwise. - -**Signature** - -```ts -export declare const isInvalidData: (self: ConfigError) => self is InvalidData -``` - -Added in v2.0.0 - -## isMissingData - -Returns `true` if the specified `ConfigError` is an `MissingData`, `false` -otherwise. - -**Signature** - -```ts -export declare const isMissingData: (self: ConfigError) => self is MissingData -``` - -Added in v2.0.0 - -## isOr - -Returns `true` if the specified `ConfigError` is an `Or`, `false` otherwise. - -**Signature** - -```ts -export declare const isOr: (self: ConfigError) => self is Or -``` - -Added in v2.0.0 - -## isSourceUnavailable - -Returns `true` if the specified `ConfigError` is a `SourceUnavailable`, -`false` otherwise. - -**Signature** - -```ts -export declare const isSourceUnavailable: (self: ConfigError) => self is SourceUnavailable -``` - -Added in v2.0.0 - -## isUnsupported - -Returns `true` if the specified `ConfigError` is an `Unsupported`, `false` -otherwise. - -**Signature** - -```ts -export declare const isUnsupported: (self: ConfigError) => self is Unsupported -``` - -Added in v2.0.0 - -# symbols - -## ConfigErrorTypeId - -**Signature** - -```ts -export declare const ConfigErrorTypeId: typeof ConfigErrorTypeId -``` - -Added in v2.0.0 - -## ConfigErrorTypeId (type alias) - -**Signature** - -```ts -export type ConfigErrorTypeId = typeof ConfigErrorTypeId -``` - -Added in v2.0.0 - -# utils - -## ConfigError (namespace) - -Added in v2.0.0 - -### Proto (interface) - -**Signature** - -```ts -export interface Proto { - readonly [ConfigErrorTypeId]: ConfigErrorTypeId -} -``` - -Added in v2.0.0 - -### Reducer (type alias) - -**Signature** - -```ts -export type Reducer = ConfigErrorReducer -``` - -Added in v2.0.0 - -## isMissingDataOnly - -Returns `true` if the specified `ConfigError` contains only `MissingData` errors, `false` otherwise. - -**Signature** - -```ts -export declare const isMissingDataOnly: (self: ConfigError) => boolean -``` - -Added in v2.0.0 - -## prefixed - -**Signature** - -```ts -export declare const prefixed: { - (prefix: Array): (self: ConfigError) => ConfigError - (self: ConfigError, prefix: Array): ConfigError -} -``` - -Added in v2.0.0 diff --git a/docs/modules/ConfigProvider.ts.md b/docs/modules/ConfigProvider.ts.md deleted file mode 100644 index 83d4e809d..000000000 --- a/docs/modules/ConfigProvider.ts.md +++ /dev/null @@ -1,443 +0,0 @@ ---- -title: ConfigProvider.ts -nav_order: 13 -parent: Modules ---- - -## ConfigProvider overview - -Added in v2.0.0 - ---- - -

Table of contents

- -- [combinators](#combinators) - - [constantCase](#constantcase) - - [kebabCase](#kebabcase) - - [lowerCase](#lowercase) - - [snakeCase](#snakecase) - - [upperCase](#uppercase) - - [within](#within) -- [constructors](#constructors) - - [fromEnv](#fromenv) - - [fromFlat](#fromflat) - - [fromMap](#frommap) - - [make](#make) - - [makeFlat](#makeflat) -- [context](#context) - - [ConfigProvider](#configprovider) -- [models](#models) - - [ConfigProvider (interface)](#configprovider-interface) -- [symbols](#symbols) - - [ConfigProviderTypeId](#configprovidertypeid) - - [ConfigProviderTypeId (type alias)](#configprovidertypeid-type-alias) - - [FlatConfigProviderTypeId](#flatconfigprovidertypeid) - - [FlatConfigProviderTypeId (type alias)](#flatconfigprovidertypeid-type-alias) -- [utils](#utils) - - [ConfigProvider (namespace)](#configprovider-namespace) - - [Flat (interface)](#flat-interface) - - [FromEnvConfig (interface)](#fromenvconfig-interface) - - [FromMapConfig (interface)](#frommapconfig-interface) - - [Proto (interface)](#proto-interface) - - [mapInputPath](#mapinputpath) - - [nested](#nested) - - [orElse](#orelse) - - [unnested](#unnested) - ---- - -# combinators - -## constantCase - -Returns a new config provider that will automatically convert all property -names to constant case. This can be utilized to adapt the names of -configuration properties from the default naming convention of camel case -to the naming convention of a config provider. - -**Signature** - -```ts -export declare const constantCase: (self: ConfigProvider) => ConfigProvider -``` - -Added in v2.0.0 - -## kebabCase - -Returns a new config provider that will automatically convert all property -names to kebab case. This can be utilized to adapt the names of -configuration properties from the default naming convention of camel case -to the naming convention of a config provider. - -**Signature** - -```ts -export declare const kebabCase: (self: ConfigProvider) => ConfigProvider -``` - -Added in v2.0.0 - -## lowerCase - -Returns a new config provider that will automatically convert all property -names to lower case. This can be utilized to adapt the names of -configuration properties from the default naming convention of camel case -to the naming convention of a config provider. - -**Signature** - -```ts -export declare const lowerCase: (self: ConfigProvider) => ConfigProvider -``` - -Added in v2.0.0 - -## snakeCase - -Returns a new config provider that will automatically convert all property -names to upper case. This can be utilized to adapt the names of -configuration properties from the default naming convention of camel case -to the naming convention of a config provider. - -**Signature** - -```ts -export declare const snakeCase: (self: ConfigProvider) => ConfigProvider -``` - -Added in v2.0.0 - -## upperCase - -Returns a new config provider that will automatically convert all property -names to upper case. This can be utilized to adapt the names of -configuration properties from the default naming convention of camel case -to the naming convention of a config provider. - -**Signature** - -```ts -export declare const upperCase: (self: ConfigProvider) => ConfigProvider -``` - -Added in v2.0.0 - -## within - -Returns a new config provider that transforms the config provider with the -specified function within the specified path. - -**Signature** - -```ts -export declare const within: { - (path: ReadonlyArray, f: (self: ConfigProvider) => ConfigProvider): (self: ConfigProvider) => ConfigProvider - (self: ConfigProvider, path: ReadonlyArray, f: (self: ConfigProvider) => ConfigProvider): ConfigProvider -} -``` - -Added in v2.0.0 - -# constructors - -## fromEnv - -A config provider that loads configuration from context variables, -using the default System service. - -**Signature** - -```ts -export declare const fromEnv: (config?: ConfigProvider.FromEnvConfig) => ConfigProvider -``` - -Added in v2.0.0 - -## fromFlat - -Constructs a new `ConfigProvider` from a key/value (flat) provider, where -nesting is embedded into the string keys. - -**Signature** - -```ts -export declare const fromFlat: (flat: ConfigProvider.Flat) => ConfigProvider -``` - -Added in v2.0.0 - -## fromMap - -Constructs a ConfigProvider using a map and the specified delimiter string, -which determines how to split the keys in the map into path segments. - -**Signature** - -```ts -export declare const fromMap: ( - map: Map, - config?: Partial -) => ConfigProvider -``` - -Added in v2.0.0 - -## make - -Creates a new config provider. - -**Signature** - -```ts -export declare const make: (options: { - readonly load:
(config: Config.Config) => Effect.Effect - readonly flattened: ConfigProvider.Flat -}) => ConfigProvider -``` - -Added in v2.0.0 - -## makeFlat - -Creates a new flat config provider. - -**Signature** - -```ts -export declare const makeFlat: (options: { - readonly load: ( - path: ReadonlyArray, - config: Config.Config.Primitive, - split: boolean - ) => Effect.Effect - readonly enumerateChildren: ( - path: ReadonlyArray - ) => Effect.Effect> - readonly patch: PathPatch.PathPatch -}) => ConfigProvider.Flat -``` - -Added in v2.0.0 - -# context - -## ConfigProvider - -The service tag for `ConfigProvider`. - -**Signature** - -```ts -export declare const ConfigProvider: Context.Tag -``` - -Added in v2.0.0 - -# models - -## ConfigProvider (interface) - -A ConfigProvider is a service that provides configuration given a description -of the structure of that configuration. - -**Signature** - -```ts -export interface ConfigProvider extends ConfigProvider.Proto, Pipeable { - /** - * Loads the specified configuration, or fails with a config error. - */ - readonly load: (config: Config.Config) => Effect.Effect - /** - * Flattens this config provider into a simplified config provider that knows - * only how to deal with flat (key/value) properties. - */ - readonly flattened: ConfigProvider.Flat -} -``` - -Added in v2.0.0 - -# symbols - -## ConfigProviderTypeId - -**Signature** - -```ts -export declare const ConfigProviderTypeId: typeof ConfigProviderTypeId -``` - -Added in v2.0.0 - -## ConfigProviderTypeId (type alias) - -**Signature** - -```ts -export type ConfigProviderTypeId = typeof ConfigProviderTypeId -``` - -Added in v2.0.0 - -## FlatConfigProviderTypeId - -**Signature** - -```ts -export declare const FlatConfigProviderTypeId: typeof FlatConfigProviderTypeId -``` - -Added in v2.0.0 - -## FlatConfigProviderTypeId (type alias) - -**Signature** - -```ts -export type FlatConfigProviderTypeId = typeof FlatConfigProviderTypeId -``` - -Added in v2.0.0 - -# utils - -## ConfigProvider (namespace) - -Added in v2.0.0 - -### Flat (interface) - -A simplified config provider that knows only how to deal with flat -(key/value) properties. Because these providers are common, there is -special support for implementing them. - -**Signature** - -```ts -export interface Flat { - readonly [FlatConfigProviderTypeId]: FlatConfigProviderTypeId - readonly patch: PathPatch.PathPatch - readonly load: ( - path: ReadonlyArray, - config: Config.Config.Primitive, - split?: boolean - ) => Effect.Effect> - readonly enumerateChildren: ( - path: ReadonlyArray - ) => Effect.Effect> -} -``` - -Added in v2.0.0 - -### FromEnvConfig (interface) - -**Signature** - -```ts -export interface FromEnvConfig { - readonly pathDelim: string - readonly seqDelim: string -} -``` - -Added in v2.0.0 - -### FromMapConfig (interface) - -**Signature** - -```ts -export interface FromMapConfig { - readonly pathDelim: string - readonly seqDelim: string -} -``` - -Added in v2.0.0 - -### Proto (interface) - -**Signature** - -```ts -export interface Proto { - readonly [ConfigProviderTypeId]: ConfigProviderTypeId -} -``` - -Added in v2.0.0 - -## mapInputPath - -Returns a new config provider that will automatically tranform all path -configuration names with the specified function. This can be utilized to -adapt the names of configuration properties from one naming convention to -another. - -**Signature** - -```ts -export declare const mapInputPath: { - (f: (path: string) => string): (self: ConfigProvider) => ConfigProvider - (self: ConfigProvider, f: (path: string) => string): ConfigProvider -} -``` - -Added in v2.0.0 - -## nested - -Returns a new config provider that will automatically nest all -configuration under the specified property name. This can be utilized to -aggregate separate configuration sources that are all required to load a -single configuration value. - -**Signature** - -```ts -export declare const nested: { - (name: string): (self: ConfigProvider) => ConfigProvider - (self: ConfigProvider, name: string): ConfigProvider -} -``` - -Added in v2.0.0 - -## orElse - -Returns a new config provider that preferentially loads configuration data -from this one, but which will fall back to the specified alternate provider -if there are any issues loading the configuration from this provider. - -**Signature** - -```ts -export declare const orElse: { - (that: LazyArg): (self: ConfigProvider) => ConfigProvider - (self: ConfigProvider, that: LazyArg): ConfigProvider -} -``` - -Added in v2.0.0 - -## unnested - -Returns a new config provider that will automatically un-nest all -configuration under the specified property name. This can be utilized to -de-aggregate separate configuration sources that are all required to load a -single configuration value. - -**Signature** - -```ts -export declare const unnested: { - (name: string): (self: ConfigProvider) => ConfigProvider - (self: ConfigProvider, name: string): ConfigProvider -} -``` - -Added in v2.0.0 diff --git a/docs/modules/ConfigProviderPathPatch.ts.md b/docs/modules/ConfigProviderPathPatch.ts.md deleted file mode 100644 index 12f49ce6a..000000000 --- a/docs/modules/ConfigProviderPathPatch.ts.md +++ /dev/null @@ -1,173 +0,0 @@ ---- -title: ConfigProviderPathPatch.ts -nav_order: 14 -parent: Modules ---- - -## ConfigProviderPathPatch overview - -Added in v2.0.0 - ---- - -

Table of contents

- -- [constructors](#constructors) - - [andThen](#andthen) - - [empty](#empty) - - [mapName](#mapname) - - [nested](#nested) - - [unnested](#unnested) -- [models](#models) - - [AndThen (interface)](#andthen-interface) - - [Empty (interface)](#empty-interface) - - [MapName (interface)](#mapname-interface) - - [Nested (interface)](#nested-interface) - - [PathPatch (type alias)](#pathpatch-type-alias) - - [Unnested (interface)](#unnested-interface) - ---- - -# constructors - -## andThen - -**Signature** - -```ts -export declare const andThen: { - (that: PathPatch): (self: PathPatch) => PathPatch - (self: PathPatch, that: PathPatch): PathPatch -} -``` - -Added in v2.0.0 - -## empty - -**Signature** - -```ts -export declare const empty: PathPatch -``` - -Added in v2.0.0 - -## mapName - -**Signature** - -```ts -export declare const mapName: { - (f: (string: string) => string): (self: PathPatch) => PathPatch - (self: PathPatch, f: (string: string) => string): PathPatch -} -``` - -Added in v2.0.0 - -## nested - -**Signature** - -```ts -export declare const nested: { - (name: string): (self: PathPatch) => PathPatch - (self: PathPatch, name: string): PathPatch -} -``` - -Added in v2.0.0 - -## unnested - -**Signature** - -```ts -export declare const unnested: { - (name: string): (self: PathPatch) => PathPatch - (self: PathPatch, name: string): PathPatch -} -``` - -Added in v2.0.0 - -# models - -## AndThen (interface) - -**Signature** - -```ts -export interface AndThen { - readonly _tag: "AndThen" - readonly first: PathPatch - readonly second: PathPatch -} -``` - -Added in v2.0.0 - -## Empty (interface) - -**Signature** - -```ts -export interface Empty { - readonly _tag: "Empty" -} -``` - -Added in v2.0.0 - -## MapName (interface) - -**Signature** - -```ts -export interface MapName { - readonly _tag: "MapName" - readonly f: (string: string) => string -} -``` - -Added in v2.0.0 - -## Nested (interface) - -**Signature** - -```ts -export interface Nested { - readonly _tag: "Nested" - readonly name: string -} -``` - -Added in v2.0.0 - -## PathPatch (type alias) - -Represents a description of how to modify the path to a configuration -value. - -**Signature** - -```ts -export type PathPatch = Empty | AndThen | MapName | Nested | Unnested -``` - -Added in v2.0.0 - -## Unnested (interface) - -**Signature** - -```ts -export interface Unnested { - readonly _tag: "Unnested" - readonly name: string -} -``` - -Added in v2.0.0 diff --git a/docs/modules/ConfigSecret.ts.md b/docs/modules/ConfigSecret.ts.md deleted file mode 100644 index a75ca4440..000000000 --- a/docs/modules/ConfigSecret.ts.md +++ /dev/null @@ -1,157 +0,0 @@ ---- -title: ConfigSecret.ts -nav_order: 15 -parent: Modules ---- - -## ConfigSecret overview - -Added in v2.0.0 - ---- - -

Table of contents

- -- [constructors](#constructors) - - [fromChunk](#fromchunk) - - [fromString](#fromstring) - - [make](#make) -- [getters](#getters) - - [value](#value) -- [models](#models) - - [ConfigSecret (interface)](#configsecret-interface) -- [refinements](#refinements) - - [isConfigSecret](#isconfigsecret) -- [symbols](#symbols) - - [ConfigSecretTypeId](#configsecrettypeid) - - [ConfigSecretTypeId (type alias)](#configsecrettypeid-type-alias) -- [unsafe](#unsafe) - - [unsafeWipe](#unsafewipe) -- [utils](#utils) - - [ConfigSecret (namespace)](#configsecret-namespace) - - [Proto (interface)](#proto-interface) - ---- - -# constructors - -## fromChunk - -**Signature** - -```ts -export declare const fromChunk: (chunk: Chunk.Chunk) => ConfigSecret -``` - -Added in v2.0.0 - -## fromString - -**Signature** - -```ts -export declare const fromString: (text: string) => ConfigSecret -``` - -Added in v2.0.0 - -## make - -**Signature** - -```ts -export declare const make: (bytes: Array) => ConfigSecret -``` - -Added in v2.0.0 - -# getters - -## value - -**Signature** - -```ts -export declare const value: (self: ConfigSecret) => string -``` - -Added in v2.0.0 - -# models - -## ConfigSecret (interface) - -**Signature** - -```ts -export interface ConfigSecret extends ConfigSecret.Proto, Equal.Equal { - /** @internal */ - readonly raw: Array -} -``` - -Added in v2.0.0 - -# refinements - -## isConfigSecret - -**Signature** - -```ts -export declare const isConfigSecret: (u: unknown) => u is ConfigSecret -``` - -Added in v2.0.0 - -# symbols - -## ConfigSecretTypeId - -**Signature** - -```ts -export declare const ConfigSecretTypeId: typeof ConfigSecretTypeId -``` - -Added in v2.0.0 - -## ConfigSecretTypeId (type alias) - -**Signature** - -```ts -export type ConfigSecretTypeId = typeof ConfigSecretTypeId -``` - -Added in v2.0.0 - -# unsafe - -## unsafeWipe - -**Signature** - -```ts -export declare const unsafeWipe: (self: ConfigSecret) => void -``` - -Added in v2.0.0 - -# utils - -## ConfigSecret (namespace) - -Added in v2.0.0 - -### Proto (interface) - -**Signature** - -```ts -export interface Proto { - readonly [ConfigSecretTypeId]: ConfigSecretTypeId -} -``` - -Added in v2.0.0 diff --git a/docs/modules/Console.ts.md b/docs/modules/Console.ts.md deleted file mode 100644 index 8d3bca0be..000000000 --- a/docs/modules/Console.ts.md +++ /dev/null @@ -1,364 +0,0 @@ ---- -title: Console.ts -nav_order: 16 -parent: Modules ---- - -## Console overview - -Added in v2.0.0 - ---- - -

Table of contents

- -- [accessor](#accessor) - - [assert](#assert) - - [clear](#clear) - - [consoleWith](#consolewith) - - [count](#count) - - [countReset](#countreset) - - [debug](#debug) - - [dir](#dir) - - [dirxml](#dirxml) - - [error](#error) - - [group](#group) - - [info](#info) - - [log](#log) - - [table](#table) - - [time](#time) - - [timeLog](#timelog) - - [trace](#trace) - - [warn](#warn) - - [withGroup](#withgroup) - - [withTime](#withtime) -- [default services](#default-services) - - [setConsole](#setconsole) - - [withConsole](#withconsole) -- [model](#model) - - [Console (interface)](#console-interface) - - [UnsafeConsole (interface)](#unsafeconsole-interface) -- [type ids](#type-ids) - - [TypeId](#typeid) - - [TypeId (type alias)](#typeid-type-alias) - ---- - -# accessor - -## assert - -**Signature** - -```ts -export declare const assert: (condition: boolean, ...args: ReadonlyArray) => Effect -``` - -Added in v2.0.0 - -## clear - -**Signature** - -```ts -export declare const clear: Effect -``` - -Added in v2.0.0 - -## consoleWith - -**Signature** - -```ts -export declare const consoleWith: (f: (console: Console) => Effect) => Effect -``` - -Added in v2.0.0 - -## count - -**Signature** - -```ts -export declare const count: (label?: string) => Effect -``` - -Added in v2.0.0 - -## countReset - -**Signature** - -```ts -export declare const countReset: (label?: string) => Effect -``` - -Added in v2.0.0 - -## debug - -**Signature** - -```ts -export declare const debug: (...args: ReadonlyArray) => Effect -``` - -Added in v2.0.0 - -## dir - -**Signature** - -```ts -export declare const dir: (item: any, options?: any) => Effect -``` - -Added in v2.0.0 - -## dirxml - -**Signature** - -```ts -export declare const dirxml: (...args: ReadonlyArray) => Effect -``` - -Added in v2.0.0 - -## error - -**Signature** - -```ts -export declare const error: (...args: ReadonlyArray) => Effect -``` - -Added in v2.0.0 - -## group - -**Signature** - -```ts -export declare const group: (options?: { - label?: string | undefined - collapsed?: boolean | undefined -}) => Effect -``` - -Added in v2.0.0 - -## info - -**Signature** - -```ts -export declare const info: (...args: ReadonlyArray) => Effect -``` - -Added in v2.0.0 - -## log - -**Signature** - -```ts -export declare const log: (...args: ReadonlyArray) => Effect -``` - -Added in v2.0.0 - -## table - -**Signature** - -```ts -export declare const table: (tabularData: any, properties?: ReadonlyArray) => Effect -``` - -Added in v2.0.0 - -## time - -**Signature** - -```ts -export declare const time: (label?: string) => Effect -``` - -Added in v2.0.0 - -## timeLog - -**Signature** - -```ts -export declare const timeLog: (label?: string, ...args: ReadonlyArray) => Effect -``` - -Added in v2.0.0 - -## trace - -**Signature** - -```ts -export declare const trace: (...args: ReadonlyArray) => Effect -``` - -Added in v2.0.0 - -## warn - -**Signature** - -```ts -export declare const warn: (...args: ReadonlyArray) => Effect -``` - -Added in v2.0.0 - -## withGroup - -**Signature** - -```ts -export declare const withGroup: { - (options?: { - readonly label?: string | undefined - readonly collapsed?: boolean | undefined - }): (self: Effect) => Effect - ( - self: Effect, - options?: { readonly label?: string | undefined; readonly collapsed?: boolean | undefined } - ): Effect -} -``` - -Added in v2.0.0 - -## withTime - -**Signature** - -```ts -export declare const withTime: { - (label?: string): (self: Effect) => Effect - (self: Effect, label?: string): Effect -} -``` - -Added in v2.0.0 - -# default services - -## setConsole - -**Signature** - -```ts -export declare const setConsole:
(console: A) => Layer.Layer -``` - -Added in v2.0.0 - -## withConsole - -**Signature** - -```ts -export declare const withConsole: { - (console: A): (effect: Effect) => Effect - (effect: Effect, console: A): Effect -} -``` - -Added in v2.0.0 - -# model - -## Console (interface) - -**Signature** - -```ts -export interface Console { - readonly [TypeId]: TypeId - readonly assert: (condition: boolean, ...args: ReadonlyArray) => Effect - readonly clear: Effect - readonly count: (label?: string) => Effect - readonly countReset: (label?: string) => Effect - readonly debug: (...args: ReadonlyArray) => Effect - readonly dir: (item: any, options?: any) => Effect - readonly dirxml: (...args: ReadonlyArray) => Effect - readonly error: (...args: ReadonlyArray) => Effect - readonly group: (options?: { - readonly label?: string | undefined - readonly collapsed?: boolean | undefined - }) => Effect - readonly groupEnd: Effect - readonly info: (...args: ReadonlyArray) => Effect - readonly log: (...args: ReadonlyArray) => Effect - readonly table: (tabularData: any, properties?: ReadonlyArray) => Effect - readonly time: (label?: string) => Effect - readonly timeEnd: (label?: string) => Effect - readonly timeLog: (label?: string, ...args: ReadonlyArray) => Effect - readonly trace: (...args: ReadonlyArray) => Effect - readonly warn: (...args: ReadonlyArray) => Effect - readonly unsafe: UnsafeConsole -} -``` - -Added in v2.0.0 - -## UnsafeConsole (interface) - -**Signature** - -```ts -export interface UnsafeConsole { - readonly assert: (condition: boolean, ...args: ReadonlyArray) => void - readonly clear: () => void - readonly count: (label?: string) => void - readonly countReset: (label?: string) => void - readonly debug: (...args: ReadonlyArray) => void - readonly dir: (item: any, options?: any) => void - readonly dirxml: (...args: ReadonlyArray) => void - readonly error: (...args: ReadonlyArray) => void - readonly group: (options?: { readonly label?: string | undefined; readonly collapsed?: boolean | undefined }) => void - readonly groupEnd: () => void - readonly info: (...args: ReadonlyArray) => void - readonly log: (...args: ReadonlyArray) => void - readonly table: (tabularData: any, properties?: ReadonlyArray) => void - readonly time: (label?: string) => void - readonly timeEnd: (label?: string) => void - readonly timeLog: (label?: string, ...args: ReadonlyArray) => void - readonly trace: (...args: ReadonlyArray) => void - readonly warn: (...args: ReadonlyArray) => void -} -``` - -Added in v2.0.0 - -# type ids - -## TypeId - -**Signature** - -```ts -export declare const TypeId: typeof TypeId -``` - -Added in v2.0.0 - -## TypeId (type alias) - -**Signature** - -```ts -export type TypeId = typeof TypeId -``` - -Added in v2.0.0 diff --git a/docs/modules/Context.ts.md b/docs/modules/Context.ts.md deleted file mode 100644 index 108408a2f..000000000 --- a/docs/modules/Context.ts.md +++ /dev/null @@ -1,509 +0,0 @@ ---- -title: Context.ts -nav_order: 17 -parent: Modules ---- - -## Context overview - -This module provides a data structure called `Context` that can be used for dependency injection in effectful -programs. It is essentially a table mapping `Tag`s to their implementations (called `Service`s), and can be used to -manage dependencies in a type-safe way. The `Context` data structure is essentially a way of providing access to a set -of related services that can be passed around as a single unit. This module provides functions to create, modify, and -query the contents of a `Context`, as well as a number of utility types for working with tags and services. - -Added in v2.0.0 - ---- - -

Table of contents

- -- [constructors](#constructors) - - [Tag](#tag) - - [empty](#empty) - - [make](#make) - - [unsafeMake](#unsafemake) -- [getters](#getters) - - [get](#get) - - [getOption](#getoption) -- [guards](#guards) - - [isContext](#iscontext) - - [isTag](#istag) -- [models](#models) - - [Context (interface)](#context-interface) - - [Tag (interface)](#tag-interface) - - [TagUnify (interface)](#tagunify-interface) - - [TagUnifyIgnore (interface)](#tagunifyignore-interface) - - [ValidTagsById (type alias)](#validtagsbyid-type-alias) -- [symbol](#symbol) - - [TagTypeId (type alias)](#tagtypeid-type-alias) - - [TypeId (type alias)](#typeid-type-alias) -- [unsafe](#unsafe) - - [unsafeGet](#unsafeget) -- [utils](#utils) - - [Tag (namespace)](#tag-namespace) - - [Identifier (type alias)](#identifier-type-alias) - - [Service (type alias)](#service-type-alias) - - [add](#add) - - [merge](#merge) - - [omit](#omit) - - [pick](#pick) - ---- - -# constructors - -## Tag - -Creates a new `Tag` instance with an optional key parameter. - -Specifying the `key` will make the `Tag` global, meaning two tags with the same -key will map to the same instance. - -Note: this is useful for cases where live reload can happen and it is -desireable to preserve the instance across reloads. - -**Signature** - -```ts -export declare const Tag: (identifier?: unknown) => Tag -``` - -**Example** - -```ts -import * as Context from "effect/Context" - -assert.strictEqual(Context.Tag() === Context.Tag(), false) -assert.strictEqual(Context.Tag("PORT") === Context.Tag("PORT"), true) -``` - -Added in v2.0.0 - -## empty - -Returns an empty `Context`. - -**Signature** - -```ts -export declare const empty: () => Context -``` - -**Example** - -```ts -import * as Context from "effect/Context" - -assert.strictEqual(Context.isContext(Context.empty()), true) -``` - -Added in v2.0.0 - -## make - -Creates a new `Context` with a single service associated to the tag. - -**Signature** - -```ts -export declare const make: >(tag: T, service: Tag.Service) => Context> -``` - -**Example** - -```ts -import * as Context from "effect/Context" - -const Port = Context.Tag<{ PORT: number }>() - -const Services = Context.make(Port, { PORT: 8080 }) - -assert.deepStrictEqual(Context.get(Services, Port), { PORT: 8080 }) -``` - -Added in v2.0.0 - -## unsafeMake - -**Signature** - -```ts -export declare const unsafeMake: (unsafeMap: Map, any>) => Context -``` - -Added in v2.0.0 - -# getters - -## get - -Get a service from the context that corresponds to the given tag. - -**Signature** - -```ts -export declare const get: { - >(tag: T): (self: Context) => Tag.Service - >(self: Context, tag: T): Tag.Service -} -``` - -**Example** - -```ts -import * as Context from "effect/Context" -import { pipe } from "effect/Function" - -const Port = Context.Tag<{ PORT: number }>() -const Timeout = Context.Tag<{ TIMEOUT: number }>() - -const Services = pipe(Context.make(Port, { PORT: 8080 }), Context.add(Timeout, { TIMEOUT: 5000 })) - -assert.deepStrictEqual(Context.get(Services, Timeout), { TIMEOUT: 5000 }) -``` - -Added in v2.0.0 - -## getOption - -Get the value associated with the specified tag from the context wrapped in an `Option` object. If the tag is not -found, the `Option` object will be `None`. - -**Signature** - -```ts -export declare const getOption: { - (tag: Tag): (self: Context) => Option - (self: Context, tag: Tag): Option -} -``` - -**Example** - -```ts -import * as Context from "effect/Context" -import * as O from "effect/Option" - -const Port = Context.Tag<{ PORT: number }>() -const Timeout = Context.Tag<{ TIMEOUT: number }>() - -const Services = Context.make(Port, { PORT: 8080 }) - -assert.deepStrictEqual(Context.getOption(Services, Port), O.some({ PORT: 8080 })) -assert.deepStrictEqual(Context.getOption(Services, Timeout), O.none()) -``` - -Added in v2.0.0 - -# guards - -## isContext - -Checks if the provided argument is a `Context`. - -**Signature** - -```ts -export declare const isContext: (input: unknown) => input is Context -``` - -**Example** - -```ts -import * as Context from "effect/Context" - -assert.strictEqual(Context.isContext(Context.empty()), true) -``` - -Added in v2.0.0 - -## isTag - -Checks if the provided argument is a `Tag`. - -**Signature** - -```ts -export declare const isTag: (input: unknown) => input is Tag -``` - -**Example** - -```ts -import * as Context from "effect/Context" - -assert.strictEqual(Context.isTag(Context.Tag()), true) -``` - -Added in v2.0.0 - -# models - -## Context (interface) - -**Signature** - -```ts -export interface Context extends Equal, Pipeable, Inspectable { - readonly [TypeId]: { - readonly _S: (_: Services) => unknown - } - readonly unsafeMap: Map, any> -} -``` - -Added in v2.0.0 - -## Tag (interface) - -**Signature** - -```ts -export interface Tag extends Pipeable, Inspectable { - readonly _tag: "Tag" - readonly _op: "Tag" - readonly [TagTypeId]: { - readonly _S: (_: Service) => Service - readonly _I: (_: Identifier) => Identifier - } - readonly of: (self: Service) => Service - readonly context: (self: Service) => Context - readonly stack?: string | undefined - readonly identifier?: unknown - [Unify.typeSymbol]?: unknown - [Unify.unifySymbol]?: TagUnify - [Unify.ignoreSymbol]?: TagUnifyIgnore -} -``` - -Added in v2.0.0 - -## TagUnify (interface) - -**Signature** - -```ts -export interface TagUnify
{ - Tag?: () => A[Unify.typeSymbol] extends Tag | infer _ ? Tag : never -} -``` - -Added in v2.0.0 - -## TagUnifyIgnore (interface) - -**Signature** - -```ts -export interface TagUnifyIgnore {} -``` - -Added in v2.0.0 - -## ValidTagsById (type alias) - -**Signature** - -```ts -export type ValidTagsById = R extends infer S ? Tag : never -``` - -Added in v2.0.0 - -# symbol - -## TagTypeId (type alias) - -**Signature** - -```ts -export type TagTypeId = typeof TagTypeId -``` - -Added in v2.0.0 - -## TypeId (type alias) - -**Signature** - -```ts -export type TypeId = typeof TypeId -``` - -Added in v2.0.0 - -# unsafe - -## unsafeGet - -Get a service from the context that corresponds to the given tag. -This function is unsafe because if the tag is not present in the context, a runtime error will be thrown. - -For a safer version see {@link getOption}. - -**Signature** - -```ts -export declare const unsafeGet: { - (tag: Tag): (self: Context) => S - (self: Context, tag: Tag): S -} -``` - -**Example** - -```ts -import * as Context from "effect/Context" - -const Port = Context.Tag<{ PORT: number }>() -const Timeout = Context.Tag<{ TIMEOUT: number }>() - -const Services = Context.make(Port, { PORT: 8080 }) - -assert.deepStrictEqual(Context.unsafeGet(Services, Port), { PORT: 8080 }) -assert.throws(() => Context.unsafeGet(Services, Timeout)) -``` - -Added in v2.0.0 - -# utils - -## Tag (namespace) - -Added in v2.0.0 - -### Identifier (type alias) - -**Signature** - -```ts -export type Identifier> = T extends Tag ? A : never -``` - -Added in v2.0.0 - -### Service (type alias) - -**Signature** - -```ts -export type Service> = T extends Tag ? A : never -``` - -Added in v2.0.0 - -## add - -Adds a service to a given `Context`. - -**Signature** - -```ts -export declare const add: { - >( - tag: T, - service: Tag.Service - ): (self: Context) => Context> - >( - self: Context, - tag: T, - service: Tag.Service - ): Context> -} -``` - -**Example** - -```ts -import * as Context from "effect/Context" -import { pipe } from "effect/Function" - -const Port = Context.Tag<{ PORT: number }>() -const Timeout = Context.Tag<{ TIMEOUT: number }>() - -const someContext = Context.make(Port, { PORT: 8080 }) - -const Services = pipe(someContext, Context.add(Timeout, { TIMEOUT: 5000 })) - -assert.deepStrictEqual(Context.get(Services, Port), { PORT: 8080 }) -assert.deepStrictEqual(Context.get(Services, Timeout), { TIMEOUT: 5000 }) -``` - -Added in v2.0.0 - -## merge - -Merges two `Context`s, returning a new `Context` containing the services of both. - -**Signature** - -```ts -export declare const merge: { - (that: Context): (self: Context) => Context - (self: Context, that: Context): Context -} -``` - -**Example** - -```ts -import * as Context from "effect/Context" - -const Port = Context.Tag<{ PORT: number }>() -const Timeout = Context.Tag<{ TIMEOUT: number }>() - -const firstContext = Context.make(Port, { PORT: 8080 }) -const secondContext = Context.make(Timeout, { TIMEOUT: 5000 }) - -const Services = Context.merge(firstContext, secondContext) - -assert.deepStrictEqual(Context.get(Services, Port), { PORT: 8080 }) -assert.deepStrictEqual(Context.get(Services, Timeout), { TIMEOUT: 5000 }) -``` - -Added in v2.0.0 - -## omit - -**Signature** - -```ts -export declare const omit: []>( - ...tags: S -) => (self: Context) => Context }[keyof S]>> -``` - -Added in v2.0.0 - -## pick - -Returns a new `Context` that contains only the specified services. - -**Signature** - -```ts -export declare const pick: []>( - ...tags: S -) => (self: Context) => Context<{ [k in keyof S]: Tag.Identifier }[number]> -``` - -**Example** - -```ts -import * as Context from "effect/Context" -import { pipe } from "effect/Function" -import * as O from "effect/Option" - -const Port = Context.Tag<{ PORT: number }>() -const Timeout = Context.Tag<{ TIMEOUT: number }>() - -const someContext = pipe(Context.make(Port, { PORT: 8080 }), Context.add(Timeout, { TIMEOUT: 5000 })) - -const Services = pipe(someContext, Context.pick(Port)) - -assert.deepStrictEqual(Context.getOption(Services, Port), O.some({ PORT: 8080 })) -assert.deepStrictEqual(Context.getOption(Services, Timeout), O.none()) -``` - -Added in v2.0.0 diff --git a/docs/modules/Data.ts.md b/docs/modules/Data.ts.md deleted file mode 100644 index 7df133243..000000000 --- a/docs/modules/Data.ts.md +++ /dev/null @@ -1,591 +0,0 @@ ---- -title: Data.ts -nav_order: 18 -parent: Modules ---- - -## Data overview - -Added in v2.0.0 - ---- - -

Table of contents

- -- [constructors](#constructors) - - [Class](#class) - - [Error](#error) - - [Structural](#structural) - - [TaggedClass](#taggedclass) - - [TaggedError](#taggederror) - - [array](#array) - - [case](#case) - - [struct](#struct) - - [tagged](#tagged) - - [taggedEnum](#taggedenum) - - [tuple](#tuple) - - [unsafeArray](#unsafearray) - - [unsafeStruct](#unsafestruct) -- [models](#models) - - [Case (interface)](#case-interface) - - [Data (type alias)](#data-type-alias) - - [TaggedEnum (type alias)](#taggedenum-type-alias) - - [YieldableError (interface)](#yieldableerror-interface) -- [utils](#utils) - - [Case (namespace)](#case-namespace) - - [Constructor (interface)](#constructor-interface) - - [TaggedEnum (namespace)](#taggedenum-namespace) - - [WithGenerics (interface)](#withgenerics-interface) - - [Args (type alias)](#args-type-alias) - - [Kind (type alias)](#kind-type-alias) - - [Value (type alias)](#value-type-alias) - ---- - -# constructors - -## Class - -Provides a constructor for a Case Class. - -**Signature** - -```ts -export declare const Class: new
>( - args: Types.Equals, {}> extends true - ? void - : { readonly [P in keyof A as P extends keyof Equal.Equal ? never : P]: A[P] } -) => Data> -``` - -**Example** - -```ts -import * as Data from "effect/Data" -import * as Equal from "effect/Equal" - -class Person extends Data.Class<{ readonly name: string }> {} - -// Creating instances of Person -const mike1 = new Person({ name: "Mike" }) -const mike2 = new Person({ name: "Mike" }) -const john = new Person({ name: "John" }) - -// Checking equality -assert.deepStrictEqual(Equal.equals(mike1, mike2), true) -assert.deepStrictEqual(Equal.equals(mike1, john), false) -``` - -Added in v2.0.0 - -## Error - -Provides a constructor for a Case Class. - -**Signature** - -```ts -export declare const Error: new >( - args: Types.Equals, {}> extends true - ? void - : { readonly [P in keyof A as P extends keyof Equal.Equal ? never : P]: A[P] } -) => YieldableError & Readonly -``` - -Added in v2.0.0 - -## Structural - -**Signature** - -```ts -export declare const Structural: new ( - args: Types.Equals, {}> extends true - ? void - : { readonly [P in keyof A as P extends keyof Equal.Equal ? never : P]: A[P] } -) => Case -``` - -Added in v2.0.0 - -## TaggedClass - -Provides a Tagged constructor for a Case Class. - -**Signature** - -```ts -export declare const TaggedClass: ( - tag: Tag -) => new >( - args: Types.Equals, {}> extends true - ? void - : { readonly [P in keyof A as P extends "_tag" | keyof Equal.Equal ? never : P]: A[P] } -) => Data & { readonly _tag: Tag }> -``` - -**Example** - -```ts -import * as Data from "effect/Data" -import * as Equal from "effect/Equal" - -class Person extends Data.TaggedClass("Person")<{ readonly name: string }> {} - -// Creating instances of Person -const mike1 = new Person({ name: "Mike" }) -const mike2 = new Person({ name: "Mike" }) -const john = new Person({ name: "John" }) - -// Checking equality -assert.deepStrictEqual(Equal.equals(mike1, mike2), true) -assert.deepStrictEqual(Equal.equals(mike1, john), false) - -assert.deepStrictEqual(mike1._tag, "Person") -``` - -Added in v2.0.0 - -## TaggedError - -**Signature** - -```ts -export declare const TaggedError: ( - tag: Tag -) => new >( - args: Types.Equals, {}> extends true - ? void - : { readonly [P in keyof A as P extends "_tag" | keyof Equal.Equal ? never : P]: A[P] } -) => YieldableError & { readonly _tag: Tag } & Readonly -``` - -Added in v2.0.0 - -## array - -**Signature** - -```ts -export declare const array: (as: As) => Data> -``` - -**Example** - -```ts -import * as Data from "effect/Data" -import * as Equal from "effect/Equal" - -const alice = Data.struct({ name: "Alice", age: 30 }) -const bob = Data.struct({ name: "Bob", age: 40 }) - -const persons = Data.array([alice, bob]) - -assert.deepStrictEqual( - Equal.equals(persons, Data.array([Data.struct({ name: "Alice", age: 30 }), Data.struct({ name: "Bob", age: 40 })])), - true -) -``` - -Added in v2.0.0 - -## case - -Provides a constructor for the specified `Case`. - -**Signature** - -```ts -export declare const case: () => Case.Constructor -``` - -**Example** - -```ts -import * as Data from "effect/Data" -import * as Equal from "effect/Equal" - -// Extending Data.Case to implement Equal -interface Person extends Data.Case { - readonly name: string -} - -// Creating a constructor for the specified Case -const Person = Data.case() - -// Creating instances of Person -const mike1 = Person({ name: "Mike" }) -const mike2 = Person({ name: "Mike" }) -const john = Person({ name: "John" }) - -// Checking equality -assert.deepStrictEqual(Equal.equals(mike1, mike2), true) -assert.deepStrictEqual(Equal.equals(mike1, john), false) -``` - -Added in v2.0.0 - -## struct - -**Signature** - -```ts -export declare const struct: >(a: A) => Data<{ readonly [P in keyof A]: A[P] }> -``` - -**Example** - -```ts -import * as Data from "effect/Data" -import * as Equal from "effect/Equal" - -const alice = Data.struct({ name: "Alice", age: 30 }) - -const bob = Data.struct({ name: "Bob", age: 40 }) - -assert.deepStrictEqual(Equal.equals(alice, alice), true) -assert.deepStrictEqual(Equal.equals(alice, Data.struct({ name: "Alice", age: 30 })), true) - -assert.deepStrictEqual(Equal.equals(alice, { name: "Alice", age: 30 }), false) -assert.deepStrictEqual(Equal.equals(alice, bob), false) -``` - -Added in v2.0.0 - -## tagged - -Provides a tagged constructor for the specified `Case`. - -**Signature** - -```ts -export declare const tagged: (tag: A["_tag"]) => Case.Constructor -``` - -**Example** - -```ts -import * as Data from "effect/Data" - -interface Person extends Data.Case { - readonly _tag: "Person" // the tag - readonly name: string -} - -const Person = Data.tagged("Person") - -const mike = Person({ name: "Mike" }) - -assert.deepEqual(mike, { _tag: "Person", name: "Mike" }) -``` - -Added in v2.0.0 - -## taggedEnum - -Create a constructor for a tagged union of `Data` structs. - -You can also pass a `TaggedEnum.WithGenerics` if you want to add generics to -the constructor. - -**Signature** - -```ts -export declare const taggedEnum: { - >(): { - readonly [Tag in Z["taggedEnum"]["_tag"]]: ( - args: TaggedEnum.Args< - TaggedEnum.Kind, - Tag, - Extract, { readonly _tag: Tag }> - > - ) => Extract, { readonly _tag: Tag }> - } - >(): { - readonly [Tag in Z["taggedEnum"]["_tag"]]: ( - args: TaggedEnum.Args< - TaggedEnum.Kind, - Tag, - Extract, { readonly _tag: Tag }> - > - ) => Extract, { readonly _tag: Tag }> - } - >(): { - readonly [Tag in Z["taggedEnum"]["_tag"]]: ( - args: TaggedEnum.Args< - TaggedEnum.Kind, - Tag, - Extract, { readonly _tag: Tag }> - > - ) => Extract, { readonly _tag: Tag }> - } - >(): { - readonly [Tag in Z["taggedEnum"]["_tag"]]: ( - args: TaggedEnum.Args< - TaggedEnum.Kind, - Tag, - Extract, { readonly _tag: Tag }> - > - ) => Extract, { readonly _tag: Tag }> - } - (): { - readonly [Tag in A["_tag"]]: Case.Constructor, "_tag"> - } -} -``` - -**Example** - -```ts -import * as Data from "effect/Data" - -const { BadRequest, NotFound } = Data.taggedEnum< - | Data.Data<{ readonly _tag: "BadRequest"; readonly status: 400; readonly message: string }> - | Data.Data<{ readonly _tag: "NotFound"; readonly status: 404; readonly message: string }> ->() - -const notFound = NotFound({ status: 404, message: "Not Found" }) -``` - -**Example** - -```ts -import * as Data from "effect/Data" - -type MyResult = Data.TaggedEnum<{ - Failure: { readonly error: E } - Success: { readonly value: A } -}> -interface MyResultDefinition extends Data.TaggedEnum.WithGenerics<2> { - readonly taggedEnum: MyResult -} -const { Failure, Success } = Data.taggedEnum() - -const success = Success({ value: 1 }) -``` - -Added in v2.0.0 - -## tuple - -**Signature** - -```ts -export declare const tuple: (...as: As) => Data> -``` - -**Example** - -```ts -import * as Data from "effect/Data" -import * as Equal from "effect/Equal" - -const alice = Data.tuple("Alice", 30) - -const bob = Data.tuple("Bob", 40) - -assert.deepStrictEqual(Equal.equals(alice, alice), true) -assert.deepStrictEqual(Equal.equals(alice, Data.tuple("Alice", 30)), true) - -assert.deepStrictEqual(Equal.equals(alice, ["Alice", 30]), false) -assert.deepStrictEqual(Equal.equals(alice, bob), false) -``` - -Added in v2.0.0 - -## unsafeArray - -**Signature** - -```ts -export declare const unsafeArray: (as: As) => Data> -``` - -Added in v2.0.0 - -## unsafeStruct - -**Signature** - -```ts -export declare const unsafeStruct: >(as: A) => Data<{ readonly [P in keyof A]: A[P] }> -``` - -Added in v2.0.0 - -# models - -## Case (interface) - -`Case` represents a datatype similar to a case class in Scala. Namely, a -datatype created using `Case` will, by default, provide an implementation -for a constructor, `Hash`, and `Equal`. - -**Signature** - -```ts -export interface Case extends Equal.Equal {} -``` - -Added in v2.0.0 - -## Data (type alias) - -**Signature** - -```ts -export type Data = { readonly [P in keyof A]: A[P] } & Equal.Equal -``` - -Added in v2.0.0 - -## TaggedEnum (type alias) - -Create a tagged enum data type, which is a union of `Data` structs. - -```ts -import * as Data from "effect/Data" - -type HttpError = Data.TaggedEnum<{ - BadRequest: { readonly status: 400; readonly message: string } - NotFound: { readonly status: 404; readonly message: string } -}> - -// Equivalent to: -type HttpErrorPlain = - | Data.Data<{ - readonly _tag: "BadRequest" - readonly status: 400 - readonly message: string - }> - | Data.Data<{ - readonly _tag: "NotFound" - readonly status: 404 - readonly message: string - }> -``` - -**Signature** - -```ts -export type TaggedEnum> & UntaggedChildren> = keyof A extends infer Tag - ? Tag extends keyof A - ? Data> - : never - : never -``` - -Added in v2.0.0 - -## YieldableError (interface) - -**Signature** - -```ts -export interface YieldableError extends Case, Pipeable, Readonly { - readonly [Effectable.EffectTypeId]: Effect.Effect.VarianceStruct - readonly [Effectable.StreamTypeId]: Effect.Effect.VarianceStruct - readonly [Effectable.SinkTypeId]: Sink.Sink.VarianceStruct - readonly [Effectable.ChannelTypeId]: Channel.Channel.VarianceStruct< - never, - unknown, - unknown, - unknown, - this, - never, - never - > -} -``` - -Added in v2.0.0 - -# utils - -## Case (namespace) - -Added in v2.0.0 - -### Constructor (interface) - -**Signature** - -```ts -export interface Constructor { - ( - args: Types.Equals, {}> extends true - ? void - : { readonly [P in keyof A as P extends Tag | keyof Equal.Equal ? never : P]: A[P] } - ): A -} -``` - -Added in v2.0.0 - -## TaggedEnum (namespace) - -Added in v2.0.0 - -### WithGenerics (interface) - -**Signature** - -```ts -export interface WithGenerics { - readonly taggedEnum: Data<{ readonly _tag: string }> - readonly numberOfGenerics: Count - - readonly A: unknown - readonly B: unknown - readonly C: unknown - readonly D: unknown -} -``` - -Added in v2.0.0 - -### Args (type alias) - -**Signature** - -```ts -export type Args< - A extends { readonly _tag: string } & Equal.Equal, - K extends A["_tag"], - E = Extract -> = { readonly [K in keyof E as K extends "_tag" | keyof Case ? never : K]: E[K] } extends infer T - ? {} extends T - ? void - : T - : never -``` - -Added in v2.0.0 - -### Kind (type alias) - -**Signature** - -```ts -export type Kind, A = unknown, B = unknown, C = unknown, D = unknown> = (Z & { - readonly A: A - readonly B: B - readonly C: C - readonly D: D -})["taggedEnum"] -``` - -Added in v2.0.0 - -### Value (type alias) - -**Signature** - -```ts -export type Value = Extract< - A, - { readonly _tag: K } -> -``` - -Added in v2.0.0 diff --git a/docs/modules/DefaultServices.ts.md b/docs/modules/DefaultServices.ts.md deleted file mode 100644 index c82c65a08..000000000 --- a/docs/modules/DefaultServices.ts.md +++ /dev/null @@ -1,63 +0,0 @@ ---- -title: DefaultServices.ts -nav_order: 19 -parent: Modules ---- - -## DefaultServices overview - -Added in v2.0.0 - ---- - -

Table of contents

- -- [constructors](#constructors) - - [liveServices](#liveservices) -- [fiberRefs](#fiberrefs) - - [currentServices](#currentservices) -- [models](#models) - - [DefaultServices (type alias)](#defaultservices-type-alias) - ---- - -# constructors - -## liveServices - -**Signature** - -```ts -export declare const liveServices: Context.Context -``` - -Added in v2.0.0 - -# fiberRefs - -## currentServices - -**Signature** - -```ts -export declare const currentServices: FiberRef.FiberRef> -``` - -Added in v2.0.0 - -# models - -## DefaultServices (type alias) - -**Signature** - -```ts -export type DefaultServices = - | Clock.Clock - | Console.Console - | Random.Random - | ConfigProvider.ConfigProvider - | Tracer.Tracer -``` - -Added in v2.0.0 diff --git a/docs/modules/Deferred.ts.md b/docs/modules/Deferred.ts.md deleted file mode 100644 index 289791204..000000000 --- a/docs/modules/Deferred.ts.md +++ /dev/null @@ -1,418 +0,0 @@ ---- -title: Deferred.ts -nav_order: 20 -parent: Modules ---- - -## Deferred overview - -Added in v2.0.0 - ---- - -

Table of contents

- -- [constructors](#constructors) - - [make](#make) - - [makeAs](#makeas) -- [getters](#getters) - - [await](#await) - - [isDone](#isdone) - - [poll](#poll) -- [models](#models) - - [Deferred (interface)](#deferred-interface) -- [symbols](#symbols) - - [DeferredTypeId](#deferredtypeid) - - [DeferredTypeId (type alias)](#deferredtypeid-type-alias) -- [unsafe](#unsafe) - - [unsafeDone](#unsafedone) - - [unsafeMake](#unsafemake) -- [utils](#utils) - - [Deferred (namespace)](#deferred-namespace) - - [Variance (interface)](#variance-interface) - - [complete](#complete) - - [completeWith](#completewith) - - [die](#die) - - [dieSync](#diesync) - - [done](#done) - - [fail](#fail) - - [failCause](#failcause) - - [failCauseSync](#failcausesync) - - [failSync](#failsync) - - [interrupt](#interrupt) - - [interruptWith](#interruptwith) - - [succeed](#succeed) - - [sync](#sync) - ---- - -# constructors - -## make - -Creates a new `Deferred`. - -**Signature** - -```ts -export declare const make: () => Effect.Effect> -``` - -Added in v2.0.0 - -## makeAs - -Creates a new `Deferred` from the specified `FiberId`. - -**Signature** - -```ts -export declare const makeAs: (fiberId: FiberId.FiberId) => Effect.Effect> -``` - -Added in v2.0.0 - -# getters - -## await - -Retrieves the value of the `Deferred`, suspending the fiber running the -workflow until the result is available. - -**Signature** - -```ts -export declare const await: (self: Deferred) => Effect.Effect -``` - -Added in v2.0.0 - -## isDone - -Returns `true` if this `Deferred` has already been completed with a value or -an error, `false` otherwise. - -**Signature** - -```ts -export declare const isDone: (self: Deferred) => Effect.Effect -``` - -Added in v2.0.0 - -## poll - -Returns a `Some>` from the `Deferred` if this `Deferred` has -already been completed, `None` otherwise. - -**Signature** - -```ts -export declare const poll: ( - self: Deferred -) => Effect.Effect>> -``` - -Added in v2.0.0 - -# models - -## Deferred (interface) - -A `Deferred` represents an asynchronous variable that can be set exactly -once, with the ability for an arbitrary number of fibers to suspend (by -calling `Deferred.await`) and automatically resume when the variable is set. - -`Deferred` can be used for building primitive actions whose completions -require the coordinated action of multiple fibers, and for building -higher-level concurrent or asynchronous structures. - -**Signature** - -```ts -export interface Deferred extends Deferred.Variance, Pipeable { - /** @internal */ - readonly state: MutableRef.MutableRef> - /** @internal */ - readonly blockingOn: FiberId.FiberId -} -``` - -Added in v2.0.0 - -# symbols - -## DeferredTypeId - -**Signature** - -```ts -export declare const DeferredTypeId: typeof DeferredTypeId -``` - -Added in v2.0.0 - -## DeferredTypeId (type alias) - -**Signature** - -```ts -export type DeferredTypeId = typeof DeferredTypeId -``` - -Added in v2.0.0 - -# unsafe - -## unsafeDone - -Unsafely exits the `Deferred` with the specified `Exit` value, which will be -propagated to all fibers waiting on the value of the `Deferred`. - -**Signature** - -```ts -export declare const unsafeDone: (self: Deferred, effect: Effect.Effect) => void -``` - -Added in v2.0.0 - -## unsafeMake - -Unsafely creates a new `Deferred` from the specified `FiberId`. - -**Signature** - -```ts -export declare const unsafeMake: (fiberId: FiberId.FiberId) => Deferred -``` - -Added in v2.0.0 - -# utils - -## Deferred (namespace) - -Added in v2.0.0 - -### Variance (interface) - -**Signature** - -```ts -export interface Variance { - readonly [DeferredTypeId]: { - readonly _E: (_: never) => E - readonly _A: (_: never) => A - } -} -``` - -Added in v2.0.0 - -## complete - -Completes the deferred with the result of the specified effect. If the -deferred has already been completed, the method will produce false. - -Note that `Deferred.completeWith` will be much faster, so consider using -that if you do not need to memoize the result of the specified effect. - -**Signature** - -```ts -export declare const complete: { - (effect: Effect.Effect): (self: Deferred) => Effect.Effect - (self: Deferred, effect: Effect.Effect): Effect.Effect -} -``` - -Added in v2.0.0 - -## completeWith - -Completes the deferred with the result of the specified effect. If the -deferred has already been completed, the method will produce false. - -**Signature** - -```ts -export declare const completeWith: { - (effect: Effect.Effect): (self: Deferred) => Effect.Effect - (self: Deferred, effect: Effect.Effect): Effect.Effect -} -``` - -Added in v2.0.0 - -## die - -Kills the `Deferred` with the specified defect, which will be propagated to -all fibers waiting on the value of the `Deferred`. - -**Signature** - -```ts -export declare const die: { - (defect: unknown): (self: Deferred) => Effect.Effect - (self: Deferred, defect: unknown): Effect.Effect -} -``` - -Added in v2.0.0 - -## dieSync - -Kills the `Deferred` with the specified defect, which will be propagated to -all fibers waiting on the value of the `Deferred`. - -**Signature** - -```ts -export declare const dieSync: { - (evaluate: LazyArg): (self: Deferred) => Effect.Effect - (self: Deferred, evaluate: LazyArg): Effect.Effect -} -``` - -Added in v2.0.0 - -## done - -Exits the `Deferred` with the specified `Exit` value, which will be -propagated to all fibers waiting on the value of the `Deferred`. - -**Signature** - -```ts -export declare const done: { - (exit: Exit.Exit): (self: Deferred) => Effect.Effect - (self: Deferred, exit: Exit.Exit): Effect.Effect -} -``` - -Added in v2.0.0 - -## fail - -Fails the `Deferred` with the specified error, which will be propagated to -all fibers waiting on the value of the `Deferred`. - -**Signature** - -```ts -export declare const fail: { - (error: E):
(self: Deferred) => Effect.Effect - (self: Deferred, error: E): Effect.Effect -} -``` - -Added in v2.0.0 - -## failCause - -Fails the `Deferred` with the specified `Cause`, which will be propagated to -all fibers waiting on the value of the `Deferred`. - -**Signature** - -```ts -export declare const failCause: { - (cause: Cause.Cause): (self: Deferred) => Effect.Effect - (self: Deferred, cause: Cause.Cause): Effect.Effect -} -``` - -Added in v2.0.0 - -## failCauseSync - -Fails the `Deferred` with the specified `Cause`, which will be propagated to -all fibers waiting on the value of the `Deferred`. - -**Signature** - -```ts -export declare const failCauseSync: { - (evaluate: LazyArg>): (self: Deferred) => Effect.Effect - (self: Deferred, evaluate: LazyArg>): Effect.Effect -} -``` - -Added in v2.0.0 - -## failSync - -Fails the `Deferred` with the specified error, which will be propagated to -all fibers waiting on the value of the `Deferred`. - -**Signature** - -```ts -export declare const failSync: { - (evaluate: LazyArg): (self: Deferred) => Effect.Effect - (self: Deferred, evaluate: LazyArg): Effect.Effect -} -``` - -Added in v2.0.0 - -## interrupt - -Completes the `Deferred` with interruption. This will interrupt all fibers -waiting on the value of the `Deferred` with the `FiberId` of the fiber -calling this method. - -**Signature** - -```ts -export declare const interrupt: (self: Deferred) => Effect.Effect -``` - -Added in v2.0.0 - -## interruptWith - -Completes the `Deferred` with interruption. This will interrupt all fibers -waiting on the value of the `Deferred` with the specified `FiberId`. - -**Signature** - -```ts -export declare const interruptWith: { - (fiberId: FiberId.FiberId): (self: Deferred) => Effect.Effect - (self: Deferred, fiberId: FiberId.FiberId): Effect.Effect -} -``` - -Added in v2.0.0 - -## succeed - -Completes the `Deferred` with the specified value. - -**Signature** - -```ts -export declare const succeed: { - (value: A): (self: Deferred) => Effect.Effect - (self: Deferred, value: A): Effect.Effect -} -``` - -Added in v2.0.0 - -## sync - -Completes the `Deferred` with the specified lazily evaluated value. - -**Signature** - -```ts -export declare const sync: { - (evaluate: LazyArg): (self: Deferred) => Effect.Effect - (self: Deferred, evaluate: LazyArg): Effect.Effect -} -``` - -Added in v2.0.0 diff --git a/docs/modules/Differ.ts.md b/docs/modules/Differ.ts.md deleted file mode 100644 index de9fb9620..000000000 --- a/docs/modules/Differ.ts.md +++ /dev/null @@ -1,506 +0,0 @@ ---- -title: Differ.ts -nav_order: 21 -parent: Modules ---- - -## Differ overview - -Added in v2.0.0 - ---- - -

Table of contents

- -- [constructors](#constructors) - - [chunk](#chunk) - - [environment](#environment) - - [hashMap](#hashmap) - - [hashSet](#hashset) - - [make](#make) -- [models](#models) - - [Differ (interface)](#differ-interface) -- [patch](#patch) - - [combine](#combine) - - [diff](#diff) - - [empty](#empty) - - [patch](#patch-1) -- [symbol](#symbol) - - [TypeId](#typeid) - - [TypeId (type alias)](#typeid-type-alias) -- [utils](#utils) - - [Differ (namespace)](#differ-namespace) - - [Chunk (namespace)](#chunk-namespace) - - [Patch (interface)](#patch-interface) - - [TypeId (type alias)](#typeid-type-alias-1) - - [Context (namespace)](#context-namespace) - - [Patch (interface)](#patch-interface-1) - - [TypeId (type alias)](#typeid-type-alias-2) - - [HashMap (namespace)](#hashmap-namespace) - - [Patch (interface)](#patch-interface-2) - - [TypeId (type alias)](#typeid-type-alias-3) - - [HashSet (namespace)](#hashset-namespace) - - [Patch (interface)](#patch-interface-3) - - [TypeId (type alias)](#typeid-type-alias-4) - - [Or (namespace)](#or-namespace) - - [Patch (interface)](#patch-interface-4) - - [TypeId (type alias)](#typeid-type-alias-5) - - [orElseEither](#orelseeither) - - [transform](#transform) - - [update](#update) - - [updateWith](#updatewith) - - [zip](#zip) - ---- - -# constructors - -## chunk - -Constructs a differ that knows how to diff a `Chunk` of values given a -differ that knows how to diff the values. - -**Signature** - -```ts -export declare const chunk: ( - differ: Differ -) => Differ, Differ.Chunk.Patch> -``` - -Added in v2.0.0 - -## environment - -Constructs a differ that knows how to diff `Env` values. - -**Signature** - -```ts -export declare const environment:
() => Differ, Differ.Context.Patch> -``` - -Added in v2.0.0 - -## hashMap - -Constructs a differ that knows how to diff a `HashMap` of keys and values given -a differ that knows how to diff the values. - -**Signature** - -```ts -export declare const hashMap: ( - differ: Differ -) => Differ, Differ.HashMap.Patch> -``` - -Added in v2.0.0 - -## hashSet - -Constructs a differ that knows how to diff a `HashSet` of values. - -**Signature** - -```ts -export declare const hashSet: () => Differ, Differ.HashSet.Patch> -``` - -Added in v2.0.0 - -## make - -Constructs a new `Differ`. - -**Signature** - -```ts -export declare const make: (params: { - readonly empty: Patch - readonly diff: (oldValue: Value, newValue: Value) => Patch - readonly combine: (first: Patch, second: Patch) => Patch - readonly patch: (patch: Patch, oldValue: Value) => Value -}) => Differ -``` - -Added in v2.0.0 - -# models - -## Differ (interface) - -A `Differ` knows how to compare an old value and new value of -type `Value` to produce a patch of type `Patch` that describes the -differences between those values. A `Differ` also knows how to apply a patch -to an old value to produce a new value that represents the old value updated -with the changes described by the patch. - -A `Differ` can be used to construct a `FiberRef` supporting compositional -updates using the `FiberRef.makePatch` constructor. - -The `Differ` companion object contains constructors for `Differ` values for -common data types such as `Chunk`, `HashMap`, and `HashSet``. In addition, -`Differ`values can be transformed using the `transform`operator and combined -using the`orElseEither`and`zip`operators. This allows creating`Differ` -values for arbitrarily complex data types compositionally. - -**Signature** - -```ts -export interface Differ { - readonly [TypeId]: { - readonly _V: (_: Value) => Value - readonly _P: (_: Patch) => Patch - } - readonly empty: Patch - readonly diff: (oldValue: Value, newValue: Value) => Patch - readonly combine: (first: Patch, second: Patch) => Patch - readonly patch: (patch: Patch, oldValue: Value) => Value -} -``` - -Added in v2.0.0 - -# patch - -## combine - -Combines two patches to produce a new patch that describes the updates of -the first patch and then the updates of the second patch. The combine -operation should be associative. In addition, if the combine operation is -commutative then joining multiple fibers concurrently will result in -deterministic `FiberRef` values. - -**Signature** - -```ts -export declare const combine: { - (first: Patch, second: Patch): (self: Differ) => Patch - (self: Differ, first: Patch, second: Patch): Patch -} -``` - -Added in v2.0.0 - -## diff - -**Signature** - -```ts -export declare const diff: { - (oldValue: Value, newValue: Value): (self: Differ) => Patch - (self: Differ, oldValue: Value, newValue: Value): Patch -} -``` - -Added in v2.0.0 - -## empty - -An empty patch that describes no changes. - -**Signature** - -```ts -export declare const empty: (self: Differ) => Patch -``` - -Added in v2.0.0 - -## patch - -Applies a patch to an old value to produce a new value that is equal to the -old value with the updates described by the patch. - -**Signature** - -```ts -export declare const patch: { - (patch: Patch, oldValue: Value): (self: Differ) => Value - (self: Differ, patch: Patch, oldValue: Value): Value -} -``` - -Added in v2.0.0 - -# symbol - -## TypeId - -**Signature** - -```ts -export declare const TypeId: typeof TypeId -``` - -Added in v2.0.0 - -## TypeId (type alias) - -**Signature** - -```ts -export type TypeId = typeof TypeId -``` - -Added in v2.0.0 - -# utils - -## Differ (namespace) - -Added in v2.0.0 - -### Chunk (namespace) - -Added in v2.0.0 - -#### Patch (interface) - -A patch which describes updates to a chunk of values. - -**Signature** - -```ts -export interface Patch extends Equal { - readonly [ChunkPatchTypeId]: { - readonly _Value: (_: Value) => Value - readonly _Patch: (_: Patch) => Patch - } -} -``` - -Added in v2.0.0 - -#### TypeId (type alias) - -**Signature** - -```ts -export type TypeId = typeof ChunkPatchTypeId -``` - -Added in v2.0.0 - -### Context (namespace) - -Added in v2.0.0 - -#### Patch (interface) - -A `Patch` describes an update that transforms a `Env` -to a `Env` as a data structure. This allows combining updates to -different services in the environment in a compositional way. - -**Signature** - -```ts -export interface Patch extends Equal { - readonly [ContextPatchTypeId]: { - readonly _Input: (_: Input) => void - readonly _Output: (_: never) => Output - } -} -``` - -Added in v2.0.0 - -#### TypeId (type alias) - -**Signature** - -```ts -export type TypeId = typeof ContextPatchTypeId -``` - -Added in v2.0.0 - -### HashMap (namespace) - -Added in v2.0.0 - -#### Patch (interface) - -A patch which describes updates to a map of keys and values. - -**Signature** - -```ts -export interface Patch extends Equal { - readonly [HashMapPatchTypeId]: { - readonly _Key: (_: Key) => Key - readonly _Value: (_: Value) => Value - readonly _Patch: (_: Patch) => Patch - } -} -``` - -Added in v2.0.0 - -#### TypeId (type alias) - -**Signature** - -```ts -export type TypeId = typeof HashMapPatchTypeId -``` - -Added in v2.0.0 - -### HashSet (namespace) - -Added in v2.0.0 - -#### Patch (interface) - -A patch which describes updates to a set of values. - -**Signature** - -```ts -export interface Patch extends Equal { - readonly [HashSetPatchTypeId]: { - readonly _Value: (_: Value) => Value - } -} -``` - -Added in v2.0.0 - -#### TypeId (type alias) - -**Signature** - -```ts -export type TypeId = typeof HashSetPatchTypeId -``` - -Added in v2.0.0 - -### Or (namespace) - -Added in v2.0.0 - -#### Patch (interface) - -A patch which describes updates to either one value or another. - -**Signature** - -```ts -export interface Patch extends Equal { - readonly [OrPatchTypeId]: { - readonly _Value: (_: Value) => Value - readonly _Value2: (_: Value2) => Value2 - readonly _Patch: (_: Patch) => Patch - readonly _Patch2: (_: Patch2) => Patch2 - } -} -``` - -Added in v2.0.0 - -#### TypeId (type alias) - -**Signature** - -```ts -export type TypeId = typeof OrPatchTypeId -``` - -Added in v2.0.0 - -## orElseEither - -Combines this differ and the specified differ to produce a differ that -knows how to diff the sum of their values. - -**Signature** - -```ts -export declare const orElseEither: { - ( - that: Differ - ): ( - self: Differ - ) => Differ, Differ.Or.Patch> - ( - self: Differ, - that: Differ - ): Differ, Differ.Or.Patch> -} -``` - -Added in v2.0.0 - -## transform - -Transforms the type of values that this differ knows how to differ using -the specified functions that map the new and old value types to each other. - -**Signature** - -```ts -export declare const transform: { - (options: { - readonly toNew: (value: Value) => Value2 - readonly toOld: (value: Value2) => Value - }): (self: Differ) => Differ - ( - self: Differ, - options: { readonly toNew: (value: Value) => Value2; readonly toOld: (value: Value2) => Value } - ): Differ -} -``` - -Added in v2.0.0 - -## update - -Constructs a differ that just diffs two values by returning a function that -sets the value to the new value. This differ does not support combining -multiple updates to the value compositionally and should only be used when -there is no compositional way to update them. - -**Signature** - -```ts -export declare const update: () => Differ A> -``` - -Added in v2.0.0 - -## updateWith - -A variant of `update` that allows specifying the function that will be used -to combine old values with new values. - -**Signature** - -```ts -export declare const updateWith: (f: (x: A, y: A) => A) => Differ A> -``` - -Added in v2.0.0 - -## zip - -Combines this differ and the specified differ to produce a new differ that -knows how to diff the product of their values. - -**Signature** - -```ts -export declare const zip: { - ( - that: Differ - ): (self: Differ) => Differ - ( - self: Differ, - that: Differ - ): Differ -} -``` - -Added in v2.0.0 diff --git a/docs/modules/Duration.ts.md b/docs/modules/Duration.ts.md deleted file mode 100644 index 626468215..000000000 --- a/docs/modules/Duration.ts.md +++ /dev/null @@ -1,528 +0,0 @@ ---- -title: Duration.ts -nav_order: 22 -parent: Modules ---- - -## Duration overview - -Added in v2.0.0 - ---- - -

Table of contents

- -- [constructors](#constructors) - - [days](#days) - - [hours](#hours) - - [infinity](#infinity) - - [micros](#micros) - - [millis](#millis) - - [minutes](#minutes) - - [nanos](#nanos) - - [seconds](#seconds) - - [weeks](#weeks) - - [zero](#zero) -- [getters](#getters) - - [toHrTime](#tohrtime) - - [toMillis](#tomillis) - - [toNanos](#tonanos) - - [toSeconds](#toseconds) - - [unsafeToNanos](#unsafetonanos) -- [guards](#guards) - - [isDuration](#isduration) -- [instances](#instances) - - [Equivalence](#equivalence) - - [Order](#order) -- [math](#math) - - [sum](#sum) - - [times](#times) -- [models](#models) - - [Duration (interface)](#duration-interface) - - [DurationInput (type alias)](#durationinput-type-alias) - - [DurationValue (type alias)](#durationvalue-type-alias) - - [Unit (type alias)](#unit-type-alias) -- [pattern matching](#pattern-matching) - - [match](#match) - - [matchWith](#matchwith) -- [predicates](#predicates) - - [between](#between) - - [equals](#equals) - - [greaterThan](#greaterthan) - - [greaterThanOrEqualTo](#greaterthanorequalto) - - [lessThan](#lessthan) - - [lessThanOrEqualTo](#lessthanorequalto) -- [symbol](#symbol) - - [TypeId (type alias)](#typeid-type-alias) -- [utils](#utils) - - [clamp](#clamp) - - [decode](#decode) - - [max](#max) - - [min](#min) - ---- - -# constructors - -## days - -**Signature** - -```ts -export declare const days: (days: number) => Duration -``` - -Added in v2.0.0 - -## hours - -**Signature** - -```ts -export declare const hours: (hours: number) => Duration -``` - -Added in v2.0.0 - -## infinity - -**Signature** - -```ts -export declare const infinity: Duration -``` - -Added in v2.0.0 - -## micros - -**Signature** - -```ts -export declare const micros: (micros: bigint) => Duration -``` - -Added in v2.0.0 - -## millis - -**Signature** - -```ts -export declare const millis: (millis: number) => Duration -``` - -Added in v2.0.0 - -## minutes - -**Signature** - -```ts -export declare const minutes: (minutes: number) => Duration -``` - -Added in v2.0.0 - -## nanos - -**Signature** - -```ts -export declare const nanos: (nanos: bigint) => Duration -``` - -Added in v2.0.0 - -## seconds - -**Signature** - -```ts -export declare const seconds: (seconds: number) => Duration -``` - -Added in v2.0.0 - -## weeks - -**Signature** - -```ts -export declare const weeks: (weeks: number) => Duration -``` - -Added in v2.0.0 - -## zero - -**Signature** - -```ts -export declare const zero: Duration -``` - -Added in v2.0.0 - -# getters - -## toHrTime - -**Signature** - -```ts -export declare const toHrTime: (self: DurationInput) => [seconds: number, nanos: number] -``` - -Added in v2.0.0 - -## toMillis - -**Signature** - -```ts -export declare const toMillis: (self: DurationInput) => number -``` - -Added in v2.0.0 - -## toNanos - -Get the duration in nanoseconds as a bigint. - -If the duration is infinite, returns `Option.none()` - -**Signature** - -```ts -export declare const toNanos: (self: DurationInput) => Option.Option -``` - -Added in v2.0.0 - -## toSeconds - -**Signature** - -```ts -export declare const toSeconds: (self: DurationInput) => number -``` - -Added in v2.0.0 - -## unsafeToNanos - -Get the duration in nanoseconds as a bigint. - -If the duration is infinite, it throws an error. - -**Signature** - -```ts -export declare const unsafeToNanos: (self: DurationInput) => bigint -``` - -Added in v2.0.0 - -# guards - -## isDuration - -**Signature** - -```ts -export declare const isDuration: (u: unknown) => u is Duration -``` - -Added in v2.0.0 - -# instances - -## Equivalence - -**Signature** - -```ts -export declare const Equivalence: equivalence.Equivalence -``` - -Added in v2.0.0 - -## Order - -**Signature** - -```ts -export declare const Order: order.Order -``` - -Added in v2.0.0 - -# math - -## sum - -**Signature** - -```ts -export declare const sum: { - (that: DurationInput): (self: DurationInput) => Duration - (self: DurationInput, that: DurationInput): Duration -} -``` - -Added in v2.0.0 - -## times - -**Signature** - -```ts -export declare const times: { - (times: number): (self: DurationInput) => Duration - (self: DurationInput, times: number): Duration -} -``` - -Added in v2.0.0 - -# models - -## Duration (interface) - -**Signature** - -```ts -export interface Duration extends Equal.Equal, Pipeable, Inspectable { - readonly [TypeId]: TypeId - readonly value: DurationValue -} -``` - -Added in v2.0.0 - -## DurationInput (type alias) - -**Signature** - -```ts -export type DurationInput = - | Duration - | number // millis - | bigint // nanos - | `${number} ${Unit}` -``` - -Added in v2.0.0 - -## DurationValue (type alias) - -**Signature** - -```ts -export type DurationValue = { _tag: "Millis"; millis: number } | { _tag: "Nanos"; nanos: bigint } | { _tag: "Infinity" } -``` - -Added in v2.0.0 - -## Unit (type alias) - -**Signature** - -```ts -export type Unit = "nanos" | "micros" | "millis" | "seconds" | "minutes" | "hours" | "days" | "weeks" -``` - -Added in v2.0.0 - -# pattern matching - -## match - -**Signature** - -```ts -export declare const match: { - (options: { - readonly onMillis: (millis: number) => A - readonly onNanos: (nanos: bigint) => B - }): (self: DurationInput) => A | B - ( - self: DurationInput, - options: { readonly onMillis: (millis: number) => A; readonly onNanos: (nanos: bigint) => B } - ): A | B -} -``` - -Added in v2.0.0 - -## matchWith - -**Signature** - -```ts -export declare const matchWith: { - ( - that: DurationInput, - options: { - readonly onMillis: (self: number, that: number) => A - readonly onNanos: (self: bigint, that: bigint) => B - } - ): (self: DurationInput) => A | B - ( - self: DurationInput, - that: DurationInput, - options: { - readonly onMillis: (self: number, that: number) => A - readonly onNanos: (self: bigint, that: bigint) => B - } - ): A | B -} -``` - -Added in v2.0.0 - -# predicates - -## between - -Checks if a `Duration` is between a `minimum` and `maximum` value. - -**Signature** - -```ts -export declare const between: { - (options: { minimum: DurationInput; maximum: DurationInput }): (self: DurationInput) => boolean - (self: DurationInput, options: { minimum: DurationInput; maximum: DurationInput }): boolean -} -``` - -Added in v2.0.0 - -## equals - -**Signature** - -```ts -export declare const equals: { - (that: DurationInput): (self: DurationInput) => boolean - (self: DurationInput, that: DurationInput): boolean -} -``` - -Added in v2.0.0 - -## greaterThan - -**Signature** - -```ts -export declare const greaterThan: { - (that: DurationInput): (self: DurationInput) => boolean - (self: DurationInput, that: DurationInput): boolean -} -``` - -Added in v2.0.0 - -## greaterThanOrEqualTo - -**Signature** - -```ts -export declare const greaterThanOrEqualTo: { - (that: DurationInput): (self: DurationInput) => boolean - (self: DurationInput, that: DurationInput): boolean -} -``` - -Added in v2.0.0 - -## lessThan - -**Signature** - -```ts -export declare const lessThan: { - (that: DurationInput): (self: DurationInput) => boolean - (self: DurationInput, that: DurationInput): boolean -} -``` - -Added in v2.0.0 - -## lessThanOrEqualTo - -**Signature** - -```ts -export declare const lessThanOrEqualTo: { - (that: DurationInput): (self: DurationInput) => boolean - (self: DurationInput, that: DurationInput): boolean -} -``` - -Added in v2.0.0 - -# symbol - -## TypeId (type alias) - -**Signature** - -```ts -export type TypeId = typeof TypeId -``` - -Added in v2.0.0 - -# utils - -## clamp - -**Signature** - -```ts -export declare const clamp: { - (options: { minimum: DurationInput; maximum: DurationInput }): (self: DurationInput) => Duration - (self: DurationInput, options: { minimum: DurationInput; maximum: DurationInput }): Duration -} -``` - -Added in v2.0.0 - -## decode - -**Signature** - -```ts -export declare const decode: (input: DurationInput) => Duration -``` - -Added in v2.0.0 - -## max - -**Signature** - -```ts -export declare const max: { - (that: DurationInput): (self: DurationInput) => Duration - (self: DurationInput, that: DurationInput): Duration -} -``` - -Added in v2.0.0 - -## min - -**Signature** - -```ts -export declare const min: { - (that: DurationInput): (self: DurationInput) => Duration - (self: DurationInput, that: DurationInput): Duration -} -``` - -Added in v2.0.0 diff --git a/docs/modules/Effect.ts.md b/docs/modules/Effect.ts.md deleted file mode 100644 index f57371191..000000000 --- a/docs/modules/Effect.ts.md +++ /dev/null @@ -1,6495 +0,0 @@ ---- -title: Effect.ts -nav_order: 23 -parent: Modules ---- - -## Effect overview - -Added in v2.0.0 - ---- - -

Table of contents

- -- [alternatives](#alternatives) - - [orDie](#ordie) - - [orDieWith](#ordiewith) - - [orElse](#orelse) - - [orElseFail](#orelsefail) - - [orElseSucceed](#orelsesucceed) -- [caching](#caching) - - [cached](#cached) - - [cachedFunction](#cachedfunction) - - [cachedInvalidateWithTTL](#cachedinvalidatewithttl) - - [cachedWithTTL](#cachedwithttl) - - [once](#once) -- [clock](#clock) - - [clock](#clock-1) - - [clockWith](#clockwith) - - [withClock](#withclock) -- [collecting & elements](#collecting--elements) - - [all](#all) - - [allSuccesses](#allsuccesses) - - [allWith](#allwith) - - [dropUntil](#dropuntil) - - [dropWhile](#dropwhile) - - [every](#every) - - [exists](#exists) - - [filter](#filter) - - [findFirst](#findfirst) - - [firstSuccessOf](#firstsuccessof) - - [forEach](#foreach) - - [head](#head) - - [mergeAll](#mergeall) - - [partition](#partition) - - [reduce](#reduce) - - [reduceEffect](#reduceeffect) - - [reduceRight](#reduceright) - - [reduceWhile](#reducewhile) - - [replicate](#replicate) - - [replicateEffect](#replicateeffect) - - [takeUntil](#takeuntil) - - [takeWhile](#takewhile) - - [validateAll](#validateall) - - [validateFirst](#validatefirst) -- [combining](#combining) - - [ap](#ap) -- [config](#config) - - [config](#config-1) - - [configProviderWith](#configproviderwith) - - [withConfigProvider](#withconfigprovider) - - [withConfigProviderScoped](#withconfigproviderscoped) -- [constructors](#constructors) - - [async](#async) - - [asyncEffect](#asynceffect) - - [asyncEither](#asynceither) - - [asyncOption](#asyncoption) - - [die](#die) - - [dieMessage](#diemessage) - - [dieSync](#diesync) - - [fail](#fail) - - [failCause](#failcause) - - [failCauseSync](#failcausesync) - - [failSync](#failsync) - - [gen](#gen) - - [never](#never) - - [none](#none) - - [promise](#promise) - - [succeed](#succeed) - - [succeedNone](#succeednone) - - [succeedSome](#succeedsome) - - [suspend](#suspend) - - [sync](#sync) - - [unit](#unit) - - [withClockScoped](#withclockscoped) - - [yieldNow](#yieldnow) -- [context](#context) - - [context](#context-1) - - [contextWith](#contextwith) - - [contextWithEffect](#contextwitheffect) - - [mapInputContext](#mapinputcontext) - - [provide](#provide) - - [provideService](#provideservice) - - [provideServiceEffect](#provideserviceeffect) - - [serviceConstants](#serviceconstants) - - [serviceFunction](#servicefunction) - - [serviceFunctionEffect](#servicefunctioneffect) - - [serviceFunctions](#servicefunctions) - - [serviceMembers](#servicemembers) - - [serviceOption](#serviceoption) - - [updateService](#updateservice) -- [conversions](#conversions) - - [either](#either) - - [exit](#exit) - - [intoDeferred](#intodeferred) - - [option](#option) -- [delays & timeouts](#delays--timeouts) - - [delay](#delay) - - [sleep](#sleep) - - [timed](#timed) - - [timedWith](#timedwith) - - [timeout](#timeout) - - [timeoutFail](#timeoutfail) - - [timeoutFailCause](#timeoutfailcause) - - [timeoutTo](#timeoutto) -- [do notation](#do-notation) - - [Do](#do) - - [bind](#bind) - - [bindTo](#bindto) - - [let](#let) -- [error handling](#error-handling) - - [catch](#catch) - - [catchAll](#catchall) - - [catchAllCause](#catchallcause) - - [catchAllDefect](#catchalldefect) - - [catchIf](#catchif) - - [catchSome](#catchsome) - - [catchSomeCause](#catchsomecause) - - [catchSomeDefect](#catchsomedefect) - - [catchTag](#catchtag) - - [catchTags](#catchtags) - - [cause](#cause) - - [eventually](#eventually) - - [ignore](#ignore) - - [ignoreLogged](#ignorelogged) - - [parallelErrors](#parallelerrors) - - [retry](#retry) - - [retryN](#retryn) - - [retryOrElse](#retryorelse) - - [retryUntil](#retryuntil) - - [retryUntilEffect](#retryuntileffect) - - [retryWhile](#retrywhile) - - [retryWhileEffect](#retrywhileeffect) - - [sandbox](#sandbox) - - [try](#try) - - [tryMap](#trymap) - - [tryMapPromise](#trymappromise) - - [tryPromise](#trypromise) - - [unsandbox](#unsandbox) -- [execution](#execution) - - [runCallback](#runcallback) - - [runFork](#runfork) - - [runPromise](#runpromise) - - [runPromiseExit](#runpromiseexit) - - [runSync](#runsync) - - [runSyncExit](#runsyncexit) -- [fiber refs](#fiber-refs) - - [getFiberRefs](#getfiberrefs) - - [inheritFiberRefs](#inheritfiberrefs) - - [locally](#locally) - - [locallyScoped](#locallyscoped) - - [locallyScopedWith](#locallyscopedwith) - - [locallyWith](#locallywith) - - [patchFiberRefs](#patchfiberrefs) - - [setFiberRefs](#setfiberrefs) - - [updateFiberRefs](#updatefiberrefs) -- [filtering & conditionals](#filtering--conditionals) - - [filterOrDie](#filterordie) - - [filterOrDieMessage](#filterordiemessage) - - [filterOrElse](#filterorelse) - - [filterOrFail](#filterorfail) - - [if](#if) - - [unless](#unless) - - [unlessEffect](#unlesseffect) - - [when](#when) - - [whenEffect](#wheneffect) - - [whenFiberRef](#whenfiberref) - - [whenRef](#whenref) -- [getters & folding](#getters--folding) - - [isFailure](#isfailure) - - [isSuccess](#issuccess) - - [match](#match) - - [matchCause](#matchcause) - - [matchCauseEffect](#matchcauseeffect) - - [matchEffect](#matcheffect) -- [interruption](#interruption) - - [allowInterrupt](#allowinterrupt) - - [checkInterruptible](#checkinterruptible) - - [disconnect](#disconnect) - - [interrupt](#interrupt) - - [interruptWith](#interruptwith) - - [interruptible](#interruptible) - - [interruptibleMask](#interruptiblemask) - - [onInterrupt](#oninterrupt) - - [uninterruptible](#uninterruptible) - - [uninterruptibleMask](#uninterruptiblemask) -- [logging](#logging) - - [annotateLogs](#annotatelogs) - - [log](#log) - - [logAnnotations](#logannotations) - - [logDebug](#logdebug) - - [logError](#logerror) - - [logFatal](#logfatal) - - [logInfo](#loginfo) - - [logTrace](#logtrace) - - [logWarning](#logwarning) - - [withLogSpan](#withlogspan) - - [withUnhandledErrorLogLevel](#withunhandlederrorloglevel) -- [mapping](#mapping) - - [as](#as) - - [asSome](#assome) - - [asSomeError](#assomeerror) - - [asUnit](#asunit) - - [flip](#flip) - - [flipWith](#flipwith) - - [map](#map) - - [mapAccum](#mapaccum) - - [mapBoth](#mapboth) - - [mapError](#maperror) - - [mapErrorCause](#maperrorcause) - - [merge](#merge) - - [negate](#negate) -- [metrics](#metrics) - - [labelMetrics](#labelmetrics) - - [labelMetricsScoped](#labelmetricsscoped) - - [labelMetricsScopedSet](#labelmetricsscopedset) - - [labelMetricsSet](#labelmetricsset) - - [metricLabels](#metriclabels) - - [tagMetrics](#tagmetrics) - - [tagMetricsScoped](#tagmetricsscoped) - - [withMetric](#withmetric) -- [models](#models) - - [Adapter (interface)](#adapter-interface) - - [Blocked (interface)](#blocked-interface) - - [Effect (interface)](#effect-interface) - - [EffectGen (interface)](#effectgen-interface) - - [EffectUnify (interface)](#effectunify-interface) - - [EffectUnifyIgnore (interface)](#effectunifyignore-interface) -- [optionality](#optionality) - - [fromNullable](#fromnullable) - - [optionFromOptional](#optionfromoptional) -- [random](#random) - - [random](#random-1) - - [randomWith](#randomwith) -- [refinements](#refinements) - - [isEffect](#iseffect) -- [repetition / recursion](#repetition--recursion) - - [forever](#forever) - - [iterate](#iterate) - - [loop](#loop) - - [repeat](#repeat) - - [repeatN](#repeatn) - - [repeatOrElse](#repeatorelse) - - [repeatUntil](#repeatuntil) - - [repeatUntilEffect](#repeatuntileffect) - - [repeatWhile](#repeatwhile) - - [repeatWhileEffect](#repeatwhileeffect) - - [schedule](#schedule) - - [scheduleForked](#scheduleforked) - - [scheduleFrom](#schedulefrom) - - [whileLoop](#whileloop) -- [requests & batching](#requests--batching) - - [blocked](#blocked) - - [cacheRequestResult](#cacherequestresult) - - [flatMapStep](#flatmapstep) - - [request](#request) - - [runRequestBlock](#runrequestblock) - - [step](#step) - - [withRequestBatching](#withrequestbatching) - - [withRequestCache](#withrequestcache) - - [withRequestCaching](#withrequestcaching) -- [runtime](#runtime) - - [getRuntimeFlags](#getruntimeflags) - - [patchRuntimeFlags](#patchruntimeflags) - - [runtime](#runtime-1) - - [withRuntimeFlagsPatch](#withruntimeflagspatch) - - [withRuntimeFlagsPatchScoped](#withruntimeflagspatchscoped) -- [scheduler](#scheduler) - - [withScheduler](#withscheduler) -- [scoping, resources & finalization](#scoping-resources--finalization) - - [acquireRelease](#acquirerelease) - - [acquireReleaseInterruptible](#acquirereleaseinterruptible) - - [acquireUseRelease](#acquireuserelease) - - [addFinalizer](#addfinalizer) - - [ensuring](#ensuring) - - [finalizersMask](#finalizersmask) - - [onError](#onerror) - - [onExit](#onexit) - - [parallelFinalizers](#parallelfinalizers) - - [scope](#scope) - - [scopeWith](#scopewith) - - [scoped](#scoped) - - [sequentialFinalizers](#sequentialfinalizers) - - [using](#using) - - [withEarlyRelease](#withearlyrelease) -- [semaphore](#semaphore) - - [Permit (interface)](#permit-interface) - - [Semaphore (interface)](#semaphore-interface) - - [makeSemaphore](#makesemaphore) - - [unsafeMakeSemaphore](#unsafemakesemaphore) -- [sequencing](#sequencing) - - [flatMap](#flatmap) - - [flatten](#flatten) - - [race](#race) - - [raceAll](#raceall) - - [raceFirst](#racefirst) - - [raceWith](#racewith) - - [summarized](#summarized) - - [tap](#tap) - - [tapBoth](#tapboth) - - [tapDefect](#tapdefect) - - [tapError](#taperror) - - [tapErrorCause](#taperrorcause) - - [tapErrorTag](#taperrortag) -- [supervision & fibers](#supervision--fibers) - - [awaitAllChildren](#awaitallchildren) - - [daemonChildren](#daemonchildren) - - [descriptor](#descriptor) - - [descriptorWith](#descriptorwith) - - [diffFiberRefs](#difffiberrefs) - - [ensuringChild](#ensuringchild) - - [ensuringChildren](#ensuringchildren) - - [fiberId](#fiberid) - - [fiberIdWith](#fiberidwith) - - [fork](#fork) - - [forkAll](#forkall) - - [forkDaemon](#forkdaemon) - - [forkIn](#forkin) - - [forkScoped](#forkscoped) - - [forkWithErrorHandler](#forkwitherrorhandler) - - [fromFiber](#fromfiber) - - [fromFiberEffect](#fromfibereffect) - - [supervised](#supervised) - - [transplant](#transplant) - - [withConcurrency](#withconcurrency) -- [symbols](#symbols) - - [EffectTypeId](#effecttypeid) - - [EffectTypeId (type alias)](#effecttypeid-type-alias) -- [tracing](#tracing) - - [annotateCurrentSpan](#annotatecurrentspan) - - [annotateSpans](#annotatespans) - - [currentParentSpan](#currentparentspan) - - [currentSpan](#currentspan) - - [linkSpans](#linkspans) - - [makeSpan](#makespan) - - [makeSpanScoped](#makespanscoped) - - [spanAnnotations](#spanannotations) - - [spanLinks](#spanlinks) - - [tracer](#tracer) - - [tracerWith](#tracerwith) - - [useSpan](#usespan) - - [withParentSpan](#withparentspan) - - [withSpan](#withspan) - - [withSpanScoped](#withspanscoped) - - [withTracer](#withtracer) - - [withTracerScoped](#withtracerscoped) - - [withTracerTiming](#withtracertiming) -- [type lambdas](#type-lambdas) - - [EffectTypeLambda (interface)](#effecttypelambda-interface) -- [unify](#unify) - - [unified](#unified) - - [unifiedFn](#unifiedfn) -- [utils](#utils) - - [All (namespace)](#all-namespace) - - [EffectAny (type alias)](#effectany-type-alias) - - [ExtractMode (type alias)](#extractmode-type-alias) - - [IsDiscard (type alias)](#isdiscard-type-alias) - - [Return (type alias)](#return-type-alias) - - [ReturnIterable (type alias)](#returniterable-type-alias) - - [ReturnObject (type alias)](#returnobject-type-alias) - - [ReturnTuple (type alias)](#returntuple-type-alias) - - [Effect (namespace)](#effect-namespace) - - [Variance (interface)](#variance-interface) - - [VarianceStruct (interface)](#variancestruct-interface) - - [Context (type alias)](#context-type-alias) - - [Error (type alias)](#error-type-alias) - - [Success (type alias)](#success-type-alias) - - [Unify (type alias)](#unify-type-alias) - - [MergeRecord (type alias)](#mergerecord-type-alias) - - [withMaxOpsBeforeYield](#withmaxopsbeforeyield) - - [withSchedulingPriority](#withschedulingpriority) -- [zipping](#zipping) - - [validate](#validate) - - [validateWith](#validatewith) - - [zip](#zip) - - [zipLeft](#zipleft) - - [zipRight](#zipright) - - [zipWith](#zipwith) - ---- - -# alternatives - -## orDie - -Translates effect failure into death of the fiber, making all failures -unchecked and not a part of the type of the effect. - -**Signature** - -```ts -export declare const orDie: (self: Effect) => Effect -``` - -Added in v2.0.0 - -## orDieWith - -Keeps none of the errors, and terminates the fiber with them, using the -specified function to convert the `E` into a `Throwable`. - -**Signature** - -```ts -export declare const orDieWith: { - (f: (error: E) => unknown): (self: Effect) => Effect - (self: Effect, f: (error: E) => unknown): Effect -} -``` - -Added in v2.0.0 - -## orElse - -Executes this effect and returns its value, if it succeeds, but otherwise -executes the specified effect. - -**Signature** - -```ts -export declare const orElse: { - (that: LazyArg>): (self: Effect) => Effect - (self: Effect, that: LazyArg>): Effect -} -``` - -Added in v2.0.0 - -## orElseFail - -Executes this effect and returns its value, if it succeeds, but otherwise -fails with the specified error. - -**Signature** - -```ts -export declare const orElseFail: { - (evaluate: LazyArg): (self: Effect) => Effect - (self: Effect, evaluate: LazyArg): Effect -} -``` - -Added in v2.0.0 - -## orElseSucceed - -Executes this effect and returns its value, if it succeeds, but -otherwise succeeds with the specified value. - -**Signature** - -```ts -export declare const orElseSucceed: { - (evaluate: LazyArg): (self: Effect) => Effect - (self: Effect, evaluate: LazyArg): Effect -} -``` - -Added in v2.0.0 - -# caching - -## cached - -Returns an effect that, if evaluated, will return the lazily computed -result of this effect. - -**Signature** - -```ts -export declare const cached: (self: Effect) => Effect> -``` - -Added in v2.0.0 - -## cachedFunction - -Returns a memoized version of the specified effectual function. - -**Signature** - -```ts -export declare const cachedFunction: ( - f: (a: A) => Effect, - eq?: Equivalence
| undefined -) => Effect Effect> -``` - -Added in v2.0.0 - -## cachedInvalidateWithTTL - -Returns an effect that, if evaluated, will return the cached result of this -effect. Cached results will expire after `timeToLive` duration. In -addition, returns an effect that can be used to invalidate the current -cached value before the `timeToLive` duration expires. - -**Signature** - -```ts -export declare const cachedInvalidateWithTTL: { - ( - timeToLive: Duration.DurationInput - ): (self: Effect) => Effect, Effect]> - ( - self: Effect, - timeToLive: Duration.DurationInput - ): Effect, Effect]> -} -``` - -Added in v2.0.0 - -## cachedWithTTL - -Returns an effect that, if evaluated, will return the cached result of this -effect. Cached results will expire after `timeToLive` duration. - -**Signature** - -```ts -export declare const cachedWithTTL: { - (timeToLive: Duration.DurationInput): (self: Effect) => Effect> - (self: Effect, timeToLive: Duration.DurationInput): Effect> -} -``` - -Added in v2.0.0 - -## once - -Returns an effect that will be executed at most once, even if it is -evaluated multiple times. - -**Signature** - -```ts -export declare const once: (self: Effect) => Effect> -``` - -**Example** - -```ts -import * as Effect from "effect/Effect" -import * as Console from "effect/Console" - -const program = Effect.gen(function* (_) { - const twice = Console.log("twice") - yield* _(twice, Effect.repeatN(1)) - const once = yield* _(Console.log("once"), Effect.once) - yield* _(once, Effect.repeatN(1)) -}) - -Effect.runFork(program) -// Output: -// twice -// twice -// once -``` - -Added in v2.0.0 - -# clock - -## clock - -Retreives the `Clock` service from the context - -**Signature** - -```ts -export declare const clock: Effect -``` - -Added in v2.0.0 - -## clockWith - -Retreives the `Clock` service from the context and provides it to the -specified effectful function. - -**Signature** - -```ts -export declare const clockWith: (f: (clock: Clock.Clock) => Effect) => Effect -``` - -Added in v2.0.0 - -## withClock - -Executes the specified workflow with the specified implementation of the -clock service. - -**Signature** - -```ts -export declare const withClock: { - (value: A): (effect: Effect) => Effect - (effect: Effect, value: A): Effect -} -``` - -Added in v2.0.0 - -# collecting & elements - -## all - -Runs all the provided effects in sequence respecting the structure provided in input. - -Supports multiple arguments, a single argument tuple / array or record / struct. - -**Signature** - -```ts -export declare const all: < - const Arg extends Iterable> | Record>, - O extends { - readonly concurrency?: Concurrency | undefined - readonly batching?: boolean | "inherit" | undefined - readonly discard?: boolean | undefined - readonly mode?: "default" | "validate" | "either" | undefined - } ->( - arg: Arg, - options?: O | undefined -) => All.Return -``` - -Added in v2.0.0 - -## allSuccesses - -Evaluate and run each effect in the structure and collect the results, -discarding results from failed effects. - -**Signature** - -```ts -export declare const allSuccesses: ( - elements: Iterable>, - options?: { readonly concurrency?: Concurrency | undefined; readonly batching?: boolean | "inherit" | undefined } -) => Effect -``` - -Added in v2.0.0 - -## allWith - -Data-last variant of `Effect.all`. - -Runs all the provided effects in sequence respecting the structure provided in input. - -Supports multiple arguments, a single argument tuple / array or record / struct. - -**Signature** - -```ts -export declare const allWith: < - O extends { - readonly concurrency?: Concurrency | undefined - readonly batching?: boolean | "inherit" | undefined - readonly discard?: boolean | undefined - readonly mode?: "default" | "validate" | "either" | undefined - } ->( - options?: O | undefined -) => > | Record>>( - arg: Arg -) => All.Return -``` - -Added in v2.0.0 - -## dropUntil - -Drops all elements until the effectful predicate returns true. - -**Signature** - -```ts -export declare const dropUntil: { - (predicate: (a: A, i: number) => Effect): (elements: Iterable) => Effect - (elements: Iterable, predicate: (a: A, i: number) => Effect): Effect -} -``` - -Added in v2.0.0 - -## dropWhile - -Drops all elements so long as the predicate returns true. - -**Signature** - -```ts -export declare const dropWhile: { - (f: (a: A, i: number) => Effect): (elements: Iterable) => Effect - (elements: Iterable, f: (a: A, i: number) => Effect): Effect -} -``` - -Added in v2.0.0 - -## every - -Determines whether all elements of the `Collection` satisfies the effectual -predicate `f`. - -**Signature** - -```ts -export declare const every: { - (f: (a: A, i: number) => Effect): (elements: Iterable) => Effect - (elements: Iterable, f: (a: A, i: number) => Effect): Effect -} -``` - -Added in v2.0.0 - -## exists - -Determines whether any element of the `Iterable` satisfies the effectual -predicate `f`. - -**Signature** - -```ts -export declare const exists: { - ( - f: (a: A, i: number) => Effect, - options?: { readonly concurrency?: Concurrency | undefined; readonly batching?: boolean | "inherit" | undefined } - ): (elements: Iterable) => Effect - ( - elements: Iterable, - f: (a: A, i: number) => Effect, - options?: { readonly concurrency?: Concurrency | undefined; readonly batching?: boolean | "inherit" | undefined } - ): Effect -} -``` - -Added in v2.0.0 - -## filter - -Filters the collection using the specified effectful predicate. - -**Signature** - -```ts -export declare const filter: { - ( - f: (a: A, i: number) => Effect, - options?: { - readonly concurrency?: Concurrency | undefined - readonly batching?: boolean | "inherit" | undefined - readonly negate?: boolean | undefined - } - ): (elements: Iterable) => Effect - ( - elements: Iterable, - f: (a: A, i: number) => Effect, - options?: { - readonly concurrency?: Concurrency | undefined - readonly batching?: boolean | "inherit" | undefined - readonly negate?: boolean | undefined - } - ): Effect -} -``` - -Added in v2.0.0 - -## findFirst - -Returns the first element that satisfies the effectful predicate. - -**Signature** - -```ts -export declare const findFirst: { - (f: (a: A, i: number) => Effect): (elements: Iterable) => Effect> - (elements: Iterable, f: (a: A, i: number) => Effect): Effect> -} -``` - -Added in v2.0.0 - -## firstSuccessOf - -This function takes an iterable of `Effect` values and returns a new -`Effect` value that represents the first `Effect` value in the iterable -that succeeds. If all of the `Effect` values in the iterable fail, then -the resulting `Effect` value will fail as well. - -This function is sequential, meaning that the `Effect` values in the -iterable will be executed in sequence, and the first one that succeeds -will determine the outcome of the resulting `Effect` value. - -**Signature** - -```ts -export declare const firstSuccessOf: (effects: Iterable>) => Effect -``` - -Added in v2.0.0 - -## forEach - -**Signature** - -```ts -export declare const forEach: { - ( - f: (a: A, i: number) => Effect, - options?: { - readonly concurrency?: Concurrency | undefined - readonly batching?: boolean | "inherit" | undefined - readonly discard?: false | undefined - } - ): (self: Iterable) => Effect - ( - f: (a: A, i: number) => Effect, - options: { - readonly concurrency?: Concurrency | undefined - readonly batching?: boolean | "inherit" | undefined - readonly discard: true - } - ): (self: Iterable) => Effect - ( - self: Iterable, - f: (a: A, i: number) => Effect, - options?: { - readonly concurrency?: Concurrency | undefined - readonly batching?: boolean | "inherit" | undefined - readonly discard?: false | undefined - } - ): Effect - ( - self: Iterable, - f: (a: A, i: number) => Effect, - options: { - readonly concurrency?: Concurrency | undefined - readonly batching?: boolean | "inherit" | undefined - readonly discard: true - } - ): Effect -} -``` - -Added in v2.0.0 - -## head - -Returns a successful effect with the head of the collection if the collection -is non-empty, or fails with the error `None` if the collection is empty. - -**Signature** - -```ts -export declare const head: (self: Effect>) => Effect, A> -``` - -Added in v2.0.0 - -## mergeAll - -Merges an `Iterable>` to a single effect, working -sequentially. - -**Signature** - -```ts -export declare const mergeAll: { - ( - zero: Z, - f: (z: Z, a: A, i: number) => Z, - options?: { readonly concurrency?: Concurrency | undefined; readonly batching?: boolean | "inherit" | undefined } - ): (elements: Iterable>) => Effect - ( - elements: Iterable>, - zero: Z, - f: (z: Z, a: A, i: number) => Z, - options?: { readonly concurrency?: Concurrency | undefined; readonly batching?: boolean | "inherit" | undefined } - ): Effect -} -``` - -Added in v2.0.0 - -## partition - -Feeds elements of type `A` to a function `f` that returns an effect. -Collects all successes and failures in a tupled fashion. - -**Signature** - -```ts -export declare const partition: { - ( - f: (a: A) => Effect, - options?: { readonly concurrency?: Concurrency | undefined; readonly batching?: boolean | "inherit" | undefined } - ): (elements: Iterable) => Effect - ( - elements: Iterable, - f: (a: A) => Effect, - options?: { readonly concurrency?: Concurrency | undefined; readonly batching?: boolean | "inherit" | undefined } - ): Effect -} -``` - -Added in v2.0.0 - -## reduce - -Folds an `Iterable` using an effectual function f, working sequentially -from left to right. - -**Signature** - -```ts -export declare const reduce: { - (zero: Z, f: (z: Z, a: A, i: number) => Effect): (elements: Iterable) => Effect - (elements: Iterable, zero: Z, f: (z: Z, a: A, i: number) => Effect): Effect -} -``` - -Added in v2.0.0 - -## reduceEffect - -Reduces an `Iterable>` to a single effect. - -**Signature** - -```ts -export declare const reduceEffect: { - ( - zero: Effect, - f: (acc: A, a: A, i: number) => A, - options?: { readonly concurrency?: Concurrency | undefined; readonly batching?: boolean | "inherit" | undefined } - ): (elements: Iterable>) => Effect - ( - elements: Iterable>, - zero: Effect, - f: (acc: A, a: A, i: number) => A, - options?: { readonly concurrency?: Concurrency | undefined; readonly batching?: boolean | "inherit" | undefined } - ): Effect -} -``` - -Added in v2.0.0 - -## reduceRight - -Folds an `Iterable` using an effectual function f, working sequentially from left to right. - -**Signature** - -```ts -export declare const reduceRight: { - (zero: Z, f: (a: A, z: Z, i: number) => Effect): (elements: Iterable) => Effect - (elements: Iterable, zero: Z, f: (a: A, z: Z, i: number) => Effect): Effect -} -``` - -Added in v2.0.0 - -## reduceWhile - -Folds over the elements in this chunk from the left, stopping the fold early -when the predicate is not satisfied. - -**Signature** - -```ts -export declare const reduceWhile: { - ( - zero: Z, - options: { readonly while: Predicate; readonly body: (s: Z, a: A, i: number) => Effect } - ): (elements: Iterable) => Effect - ( - elements: Iterable, - zero: Z, - options: { readonly while: Predicate; readonly body: (s: Z, a: A, i: number) => Effect } - ): Effect -} -``` - -Added in v2.0.0 - -## replicate - -Replicates the given effect `n` times. - -**Signature** - -```ts -export declare const replicate: { - (n: number): (self: Effect) => Effect[] - (self: Effect, n: number): Effect[] -} -``` - -Added in v2.0.0 - -## replicateEffect - -Performs this effect the specified number of times and collects the -results. - -**Signature** - -```ts -export declare const replicateEffect: { - ( - n: number, - options?: { - readonly concurrency?: Concurrency | undefined - readonly batching?: boolean | "inherit" | undefined - readonly discard?: false | undefined - } - ): (self: Effect) => Effect - ( - n: number, - options: { - readonly concurrency?: Concurrency | undefined - readonly batching?: boolean | "inherit" | undefined - readonly discard: true - } - ): (self: Effect) => Effect - ( - self: Effect, - n: number, - options?: { - readonly concurrency?: Concurrency | undefined - readonly batching?: boolean | "inherit" | undefined - readonly discard?: false | undefined - } - ): Effect - ( - self: Effect, - n: number, - options: { - readonly concurrency?: Concurrency | undefined - readonly batching?: boolean | "inherit" | undefined - readonly discard: true - } - ): Effect -} -``` - -Added in v2.0.0 - -## takeUntil - -Takes elements until the effectual predicate returns true. - -**Signature** - -```ts -export declare const takeUntil: { - (predicate: (a: A, i: number) => Effect): (elements: Iterable) => Effect - (elements: Iterable, predicate: (a: A, i: number) => Effect): Effect -} -``` - -Added in v2.0.0 - -## takeWhile - -Takes all elements so long as the effectual predicate returns true. - -**Signature** - -```ts -export declare const takeWhile: { - (predicate: (a: A, i: number) => Effect): (elements: Iterable) => Effect - (elements: Iterable, predicate: (a: A, i: number) => Effect): Effect -} -``` - -Added in v2.0.0 - -## validateAll - -Feeds elements of type `A` to `f` and accumulates all errors in error -channel or successes in success channel. - -This combinator is lossy meaning that if there are errors all successes -will be lost. To retain all information please use `partition`. - -**Signature** - -```ts -export declare const validateAll: { - ( - f: (a: A, i: number) => Effect, - options?: { - readonly concurrency?: Concurrency | undefined - readonly batching?: boolean | "inherit" | undefined - readonly discard?: false | undefined - } - ): (elements: Iterable) => Effect - ( - f: (a: A, i: number) => Effect, - options: { - readonly concurrency?: Concurrency | undefined - readonly batching?: boolean | "inherit" | undefined - readonly discard: true - } - ): (elements: Iterable) => Effect - ( - elements: Iterable, - f: (a: A, i: number) => Effect, - options?: { - readonly concurrency?: Concurrency | undefined - readonly batching?: boolean | "inherit" | undefined - readonly discard?: false | undefined - } - ): Effect - ( - elements: Iterable, - f: (a: A, i: number) => Effect, - options: { - readonly concurrency?: Concurrency | undefined - readonly batching?: boolean | "inherit" | undefined - readonly discard: true - } - ): Effect -} -``` - -Added in v2.0.0 - -## validateFirst - -Feeds elements of type `A` to `f` until it succeeds. Returns first success -or the accumulation of all errors. - -If `elements` is empty then `Effect.fail([])` is returned. - -**Signature** - -```ts -export declare const validateFirst: { - ( - f: (a: A, i: number) => Effect, - options?: { readonly concurrency?: Concurrency | undefined; readonly batching?: boolean | "inherit" | undefined } - ): (elements: Iterable) => Effect - ( - elements: Iterable, - f: (a: A, i: number) => Effect, - options?: { readonly concurrency?: Concurrency | undefined; readonly batching?: boolean | "inherit" | undefined } - ): Effect -} -``` - -**Example** - -```ts -import * as Effect from "effect/Effect" -import * as Exit from "effect/Exit" - -const f = (n: number) => (n > 0 ? Effect.succeed(n) : Effect.fail(`${n} is negative`)) - -assert.deepStrictEqual(Effect.runSyncExit(Effect.validateFirst([], f)), Exit.fail([])) -assert.deepStrictEqual(Effect.runSyncExit(Effect.validateFirst([1, 2], f)), Exit.succeed(1)) -assert.deepStrictEqual(Effect.runSyncExit(Effect.validateFirst([1, -1], f)), Exit.succeed(1)) -assert.deepStrictEqual(Effect.runSyncExit(Effect.validateFirst([-1, 2], f)), Exit.succeed(2)) -assert.deepStrictEqual( - Effect.runSyncExit(Effect.validateFirst([-1, -2], f)), - Exit.fail(["-1 is negative", "-2 is negative"]) -) -``` - -Added in v2.0.0 - -# combining - -## ap - -**Signature** - -```ts -export declare const ap: { - (that: Effect): (self: Effect B>) => Effect - (self: Effect B>, that: Effect): Effect -} -``` - -Added in v2.0.0 - -# config - -## config - -Uses the default config provider to load the specified config, or fail with -an error of type Config.Error. - -**Signature** - -```ts -export declare const config: (config: Config) => Effect -``` - -Added in v2.0.0 - -## configProviderWith - -Retrieves the default config provider, and passes it to the specified -function, which may return an effect that uses the provider to perform some -work or compute some value. - -**Signature** - -```ts -export declare const configProviderWith: ( - f: (configProvider: ConfigProvider) => Effect -) => Effect -``` - -Added in v2.0.0 - -## withConfigProvider - -Executes the specified workflow with the specified configuration provider. - -**Signature** - -```ts -export declare const withConfigProvider: { - (value: ConfigProvider): (effect: Effect) => Effect - (effect: Effect, value: ConfigProvider): Effect -} -``` - -Added in v2.0.0 - -## withConfigProviderScoped - -Sets the configuration provider to the specified value and restores it to its original value -when the scope is closed. - -**Signature** - -```ts -export declare const withConfigProviderScoped: (value: ConfigProvider) => Effect -``` - -Added in v2.0.0 - -# constructors - -## async - -Imports an asynchronous side-effect into a pure `Effect` value. -The callback function `Effect => void` must be called at most once. - -If an Effect is returned by the registration function, it will be executed -if the fiber executing the effect is interrupted. - -The registration function can also receive an `AbortSignal` if required for -interruption. - -The `FiberId` of the fiber that may complete the async callback may be -provided to allow for better diagnostics. - -**Signature** - -```ts -export declare const async: ( - register: (callback: (_: Effect) => void, signal: AbortSignal) => void | Effect, - blockingOn?: FiberId.FiberId -) => Effect -``` - -Added in v2.0.0 - -## asyncEffect - -Converts an asynchronous, callback-style API into an `Effect`, which will -be executed asynchronously. - -With this variant, the registration function may return a an `Effect`. - -**Signature** - -```ts -export declare const asyncEffect: ( - register: (callback: (_: Effect) => void) => Effect -) => Effect -``` - -Added in v2.0.0 - -## asyncEither - -Imports an asynchronous side-effect into an effect. It has the option of -returning the value synchronously, which is useful in cases where it cannot -be determined if the effect is synchronous or asynchronous until the register -is actually executed. It also has the option of returning a canceler, -which will be used by the runtime to cancel the asynchronous effect if the fiber -executing the effect is interrupted. - -If the register function returns a value synchronously, then the callback -function `Effect => void` must not be called. Otherwise the callback -function must be called at most once. - -The `FiberId` of the fiber that may complete the async callback may be -provided to allow for better diagnostics. - -**Signature** - -```ts -export declare const asyncEither: ( - register: (callback: (effect: Effect) => void) => Either.Either, Effect>, - blockingOn?: FiberId.FiberId -) => Effect -``` - -Added in v2.0.0 - -## asyncOption - -Imports an asynchronous effect into a pure `Effect` value, possibly returning -the value synchronously. - -If the register function returns a value synchronously, then the callback -function `Effect => void` must not be called. Otherwise the callback -function must be called at most once. - -The `FiberId` of the fiber that may complete the async callback may be -provided to allow for better diagnostics. - -**Signature** - -```ts -export declare const asyncOption: ( - register: (callback: (_: Effect) => void) => Option.Option>, - blockingOn?: FiberId.FiberId -) => Effect -``` - -Added in v2.0.0 - -## die - -**Signature** - -```ts -export declare const die: (defect: unknown) => Effect -``` - -Added in v2.0.0 - -## dieMessage - -Returns an effect that dies with a `RuntimeException` having the specified -text message. This method can be used for terminating a fiber because a -defect has been detected in the code. - -**Signature** - -```ts -export declare const dieMessage: (message: string) => Effect -``` - -Added in v2.0.0 - -## dieSync - -**Signature** - -```ts -export declare const dieSync: (evaluate: LazyArg) => Effect -``` - -Added in v2.0.0 - -## fail - -**Signature** - -```ts -export declare const fail: (error: E) => Effect -``` - -Added in v2.0.0 - -## failCause - -**Signature** - -```ts -export declare const failCause: (cause: Cause.Cause) => Effect -``` - -Added in v2.0.0 - -## failCauseSync - -**Signature** - -```ts -export declare const failCauseSync: (evaluate: LazyArg>) => Effect -``` - -Added in v2.0.0 - -## failSync - -**Signature** - -```ts -export declare const failSync: (evaluate: LazyArg) => Effect -``` - -Added in v2.0.0 - -## gen - -**Signature** - -```ts -export declare const gen: { - , AEff>( - f: (resume: Adapter) => Generator - ): Effect< - [Eff] extends [never] ? never : [Eff] extends [EffectGen] ? R : never, - [Eff] extends [never] ? never : [Eff] extends [EffectGen] ? E : never, - AEff - > - , AEff>( - self: Self, - f: (this: Self, resume: Adapter) => Generator - ): Effect< - [Eff] extends [never] ? never : [Eff] extends [EffectGen] ? R : never, - [Eff] extends [never] ? never : [Eff] extends [EffectGen] ? E : never, - AEff - > -} -``` - -Added in v2.0.0 - -## never - -Returns a effect that will never produce anything. The moral equivalent of -`while(true) {}`, only without the wasted CPU cycles. - -**Signature** - -```ts -export declare const never: Effect -``` - -Added in v2.0.0 - -## none - -Requires the option produced by this value to be `None`. - -**Signature** - -```ts -export declare const none: (self: Effect>) => Effect, void> -``` - -Added in v2.0.0 - -## promise - -Like `tryPromise` but produces a defect in case of errors. - -An optional `AbortSignal` can be provided to allow for interruption of the -wrapped Promise api. - -**Signature** - -```ts -export declare const promise: (evaluate: (signal: AbortSignal) => Promise) => Effect -``` - -Added in v2.0.0 - -## succeed - -**Signature** - -```ts -export declare const succeed: (value: A) => Effect -``` - -Added in v2.0.0 - -## succeedNone - -Returns an effect which succeeds with `None`. - -**Signature** - -```ts -export declare const succeedNone: Effect> -``` - -Added in v2.0.0 - -## succeedSome - -Returns an effect which succeeds with the value wrapped in a `Some`. - -**Signature** - -```ts -export declare const succeedSome: (value: A) => Effect> -``` - -Added in v2.0.0 - -## suspend - -**Signature** - -```ts -export declare const suspend: (effect: LazyArg>) => Effect -``` - -Added in v2.0.0 - -## sync - -**Signature** - -```ts -export declare const sync: (evaluate: LazyArg) => Effect -``` - -Added in v2.0.0 - -## unit - -**Signature** - -```ts -export declare const unit: Effect -``` - -Added in v2.0.0 - -## withClockScoped - -Sets the implementation of the clock service to the specified value and -restores it to its original value when the scope is closed. - -**Signature** - -```ts -export declare const withClockScoped: (value: A) => Effect -``` - -Added in v2.0.0 - -## yieldNow - -**Signature** - -```ts -export declare const yieldNow: (options?: { readonly priority?: number | undefined }) => Effect -``` - -Added in v2.0.0 - -# context - -## context - -**Signature** - -```ts -export declare const context: () => Effect> -``` - -Added in v2.0.0 - -## contextWith - -Accesses the context of the effect. - -**Signature** - -```ts -export declare const contextWith: (f: (context: Context.Context) => A) => Effect -``` - -Added in v2.0.0 - -## contextWithEffect - -Effectually accesses the context of the effect. - -**Signature** - -```ts -export declare const contextWithEffect: ( - f: (context: Context.Context) => Effect -) => Effect -``` - -Added in v2.0.0 - -## mapInputContext - -Provides some of the context required to run this effect, -leaving the remainder `R0`. - -**Signature** - -```ts -export declare const mapInputContext: { - (f: (context: Context.Context) => Context.Context): (self: Effect) => Effect - (self: Effect, f: (context: Context.Context) => Context.Context): Effect -} -``` - -Added in v2.0.0 - -## provide - -Splits the context into two parts, providing one part using the -specified layer/context/runtime and leaving the remainder `R0` - -**Signature** - -```ts -export declare const provide: { - ( - layer: Layer.Layer - ): (self: Effect) => Effect, E2 | E, A> - (context: Context.Context): (self: Effect) => Effect, E, A> - (runtime: Runtime.Runtime): (self: Effect) => Effect, E, A> - (self: Effect, layer: Layer.Layer): Effect, E | E2, A> - (self: Effect, context: Context.Context): Effect, E, A> - (self: Effect, runtime: Runtime.Runtime): Effect, E, A> -} -``` - -Added in v2.0.0 - -## provideService - -Provides the effect with the single service it requires. If the effect -requires more than one service use `provideContext` instead. - -**Signature** - -```ts -export declare const provideService: { - >( - tag: T, - service: Context.Tag.Service - ): (self: Effect) => Effect>, E, A> - >( - self: Effect, - tag: T, - service: Context.Tag.Service - ): Effect>, E, A> -} -``` - -Added in v2.0.0 - -## provideServiceEffect - -Provides the effect with the single service it requires. If the effect -requires more than one service use `provideContext` instead. - -**Signature** - -```ts -export declare const provideServiceEffect: { - , R1, E1>( - tag: T, - effect: Effect> - ): (self: Effect) => Effect>, E1 | E, A> - , R1, E1>( - self: Effect, - tag: T, - effect: Effect> - ): Effect>, E | E1, A> -} -``` - -Added in v2.0.0 - -## serviceConstants - -**Signature** - -```ts -export declare const serviceConstants: ( - tag: Context.Tag -) => { - [k in { [k in keyof S]: S[k] extends Effect ? k : never }[keyof S]]: S[k] extends Effect< - infer R, - infer E, - infer A - > - ? Effect - : never -} -``` - -Added in v2.0.0 - -## serviceFunction - -**Signature** - -```ts -export declare const serviceFunction: , Args extends any[], A>( - service: T, - f: (_: Context.Tag.Service) => (...args: Args) => A -) => (...args: Args) => Effect, never, A> -``` - -Added in v2.0.0 - -## serviceFunctionEffect - -**Signature** - -```ts -export declare const serviceFunctionEffect: , Args extends any[], R, E, A>( - service: T, - f: (_: Context.Tag.Service) => (...args: Args) => Effect -) => (...args: Args) => Effect, E, A> -``` - -Added in v2.0.0 - -## serviceFunctions - -**Signature** - -```ts -export declare const serviceFunctions: ( - tag: Context.Tag -) => { - [k in { - [k in keyof S]: S[k] extends (...args: Array) => Effect ? k : never - }[keyof S]]: S[k] extends (...args: infer Args) => Effect - ? (...args: Args) => Effect - : never -} -``` - -Added in v2.0.0 - -## serviceMembers - -**Signature** - -```ts -export declare const serviceMembers: ( - tag: Context.Tag -) => { - functions: { - [k in { - [k in keyof S]: S[k] extends (...args: Array) => Effect ? k : never - }[keyof S]]: S[k] extends (...args: infer Args) => Effect - ? (...args: Args) => Effect - : never - } - constants: { - [k in { [k in keyof S]: S[k] extends Effect ? k : never }[keyof S]]: S[k] extends Effect< - infer R, - infer E, - infer A - > - ? Effect - : never - } -} -``` - -Added in v2.0.0 - -## serviceOption - -**Signature** - -```ts -export declare const serviceOption: (tag: Context.Tag) => Effect> -``` - -Added in v2.0.0 - -## updateService - -Updates the service with the required service entry. - -**Signature** - -```ts -export declare const updateService: { - >( - tag: T, - f: (service: Context.Tag.Service) => Context.Tag.Service - ): (self: Effect) => Effect, E, A> - >( - self: Effect, - tag: T, - f: (service: Context.Tag.Service) => Context.Tag.Service - ): Effect, E, A> -} -``` - -Added in v2.0.0 - -# conversions - -## either - -Returns an effect whose failure and success have been lifted into an -`Either`. The resulting effect cannot fail, because the failure case has -been exposed as part of the `Either` success case. - -This method is useful for recovering from effects that may fail. - -The error parameter of the returned `Effect` is `never`, since it is -guaranteed the effect does not model failure. - -**Signature** - -```ts -export declare const either: (self: Effect) => Effect> -``` - -Added in v2.0.0 - -## exit - -**Signature** - -```ts -export declare const exit: (self: Effect) => Effect> -``` - -Added in v2.0.0 - -## intoDeferred - -**Signature** - -```ts -export declare const intoDeferred: { - (deferred: Deferred.Deferred): (self: Effect) => Effect - (self: Effect, deferred: Deferred.Deferred): Effect -} -``` - -Added in v2.0.0 - -## option - -Executes this effect, skipping the error but returning optionally the -success. - -**Signature** - -```ts -export declare const option: (self: Effect) => Effect> -``` - -Added in v2.0.0 - -# delays & timeouts - -## delay - -Returns an effect that is delayed from this effect by the specified -`Duration`. - -**Signature** - -```ts -export declare const delay: { - (duration: Duration.DurationInput): (self: Effect) => Effect - (self: Effect, duration: Duration.DurationInput): Effect -} -``` - -Added in v2.0.0 - -## sleep - -Returns an effect that suspends for the specified duration. This method is -asynchronous, and does not actually block the fiber executing the effect. - -**Signature** - -```ts -export declare const sleep: (duration: Duration.DurationInput) => Effect -``` - -Added in v2.0.0 - -## timed - -Returns a new effect that executes this one and times the execution. - -**Signature** - -```ts -export declare const timed: (self: Effect) => Effect -``` - -Added in v2.0.0 - -## timedWith - -A more powerful variation of `timed` that allows specifying the clock. - -**Signature** - -```ts -export declare const timedWith: { - ( - nanoseconds: Effect - ): (self: Effect) => Effect - ( - self: Effect, - nanoseconds: Effect - ): Effect -} -``` - -Added in v2.0.0 - -## timeout - -Returns an effect that will timeout this effect, returning `None` if the -timeout elapses before the effect has produced a value; and returning -`Some` of the produced value otherwise. - -If the timeout elapses without producing a value, the running effect will -be safely interrupted. - -WARNING: The effect returned by this method will not itself return until -the underlying effect is actually interrupted. This leads to more -predictable resource utilization. If early return is desired, then instead -of using `effect.timeout(d)`, use `effect.disconnect.timeout(d)`, which -first disconnects the effect's interruption signal before performing the -timeout, resulting in earliest possible return, before an underlying effect -has been successfully interrupted. - -**Signature** - -```ts -export declare const timeout: { - (duration: Duration.DurationInput): (self: Effect) => Effect> - (self: Effect, duration: Duration.DurationInput): Effect> -} -``` - -Added in v2.0.0 - -## timeoutFail - -The same as `timeout`, but instead of producing a `None` in the event of -timeout, it will produce the specified error. - -**Signature** - -```ts -export declare const timeoutFail: { - (options: { - readonly onTimeout: LazyArg - readonly duration: Duration.DurationInput - }): (self: Effect) => Effect - ( - self: Effect, - options: { readonly onTimeout: LazyArg; readonly duration: Duration.DurationInput } - ): Effect -} -``` - -Added in v2.0.0 - -## timeoutFailCause - -The same as `timeout`, but instead of producing a `None` in the event of -timeout, it will produce the specified failure. - -**Signature** - -```ts -export declare const timeoutFailCause: { - (options: { - readonly onTimeout: LazyArg> - readonly duration: Duration.DurationInput - }): (self: Effect) => Effect - ( - self: Effect, - options: { readonly onTimeout: LazyArg>; readonly duration: Duration.DurationInput } - ): Effect -} -``` - -Added in v2.0.0 - -## timeoutTo - -Returns an effect that will timeout this effect, returning either the -default value if the timeout elapses before the effect has produced a -value or returning the result of applying the function `onSuccess` to the -success value of the effect. - -If the timeout elapses without producing a value, the running effect will -be safely interrupted. - -**Signature** - -```ts -export declare const timeoutTo: { - (options: { - readonly onTimeout: LazyArg - readonly onSuccess: (a: A) => B - readonly duration: Duration.DurationInput - }): (self: Effect) => Effect - ( - self: Effect, - options: { - readonly onTimeout: LazyArg - readonly onSuccess: (a: A) => B - readonly duration: Duration.DurationInput - } - ): Effect -} -``` - -Added in v2.0.0 - -# do notation - -## Do - -**Signature** - -```ts -export declare const Do: Effect -``` - -Added in v2.0.0 - -## bind - -Binds an effectful value in a `do` scope - -**Signature** - -```ts -export declare const bind: { - ( - tag: Exclude, - f: (_: K) => Effect - ): (self: Effect) => Effect> - ( - self: Effect, - tag: Exclude, - f: (_: K) => Effect - ): Effect> -} -``` - -Added in v2.0.0 - -## bindTo - -**Signature** - -```ts -export declare const bindTo: { - (tag: N): (self: Effect) => Effect> - (self: Effect, tag: N): Effect> -} -``` - -Added in v2.0.0 - -## let - -Like bind for values - -**Signature** - -```ts -export declare const let: { - ( - tag: Exclude, - f: (_: K) => A - ): (self: Effect) => Effect> - ( - self: Effect, - tag: Exclude, - f: (_: K) => A - ): Effect> -} -``` - -Added in v2.0.0 - -# error handling - -## catch - -Recovers from specified error. - -**Signature** - -```ts -export declare const catch: { (discriminator: N, options: { readonly failure: K; readonly onFailure: (error: Extract) => Effect; }): (self: Effect) => Effect, A1 | A>; (self: Effect, discriminator: N, options: { readonly failure: K; readonly onFailure: (error: Extract) => Effect; }): Effect, A | A1>; } -``` - -Added in v2.0.0 - -## catchAll - -Recovers from all recoverable errors. - -**Note**: that `Effect.catchAll` will not recover from unrecoverable defects. To -recover from both recoverable and unrecoverable errors use -`Effect.catchAllCause`. - -**Signature** - -```ts -export declare const catchAll: { - (f: (e: E) => Effect): (self: Effect) => Effect - (self: Effect, f: (e: E) => Effect): Effect -} -``` - -Added in v2.0.0 - -## catchAllCause - -Recovers from both recoverable and unrecoverable errors. - -See `absorb`, `sandbox`, `mapErrorCause` for other functions that can -recover from defects. - -**Signature** - -```ts -export declare const catchAllCause: { - ( - f: (cause: Cause.Cause) => Effect - ): (self: Effect) => Effect - ( - self: Effect, - f: (cause: Cause.Cause) => Effect - ): Effect -} -``` - -Added in v2.0.0 - -## catchAllDefect - -Recovers from all defects with provided function. - -**WARNING**: There is no sensible way to recover from defects. This -method should be used only at the boundary between Effect and an external -system, to transmit information on a defect for diagnostic or explanatory -purposes. - -**Signature** - -```ts -export declare const catchAllDefect: { - ( - f: (defect: unknown) => Effect - ): (self: Effect) => Effect - ( - self: Effect, - f: (defect: unknown) => Effect - ): Effect -} -``` - -Added in v2.0.0 - -## catchIf - -Recovers from errors that match the given predicate. - -**Signature** - -```ts -export declare const catchIf: { - ( - refinement: Refinement, - f: (e: EB) => Effect - ): (self: Effect) => Effect, A2 | A> - ( - predicate: Predicate, - f: (e: EX) => Effect - ): (self: Effect) => Effect - ( - self: Effect, - refinement: Refinement, - f: (e: EB) => Effect - ): Effect, A | A2> - ( - self: Effect, - predicate: Predicate, - f: (e: EX) => Effect - ): Effect -} -``` - -Added in v2.0.0 - -## catchSome - -Recovers from some or all of the error cases. - -**Signature** - -```ts -export declare const catchSome: { - ( - pf: (e: E) => Option.Option> - ): (self: Effect) => Effect - ( - self: Effect, - pf: (e: E) => Option.Option> - ): Effect -} -``` - -Added in v2.0.0 - -## catchSomeCause - -Recovers from some or all of the error cases with provided cause. - -**Signature** - -```ts -export declare const catchSomeCause: { - ( - f: (cause: Cause.Cause) => Option.Option> - ): (self: Effect) => Effect - ( - self: Effect, - f: (cause: Cause.Cause) => Option.Option> - ): Effect -} -``` - -Added in v2.0.0 - -## catchSomeDefect - -Recovers from some or all of the defects with provided partial function. - -**WARNING**: There is no sensible way to recover from defects. This -method should be used only at the boundary between Effect and an external -system, to transmit information on a defect for diagnostic or explanatory -purposes. - -**Signature** - -```ts -export declare const catchSomeDefect: { - ( - pf: (defect: unknown) => Option.Option> - ): (self: Effect) => Effect - ( - self: Effect, - pf: (defect: unknown) => Option.Option> - ): Effect -} -``` - -Added in v2.0.0 - -## catchTag - -Recovers from the specified tagged error. - -**Signature** - -```ts -export declare const catchTag: { - ( - k: K, - f: (e: Extract) => Effect - ): (self: Effect) => Effect, A1 | A> - ( - self: Effect, - k: K, - f: (e: Extract) => Effect - ): Effect, A | A1> -} -``` - -Added in v2.0.0 - -## catchTags - -Recovers from the specified tagged errors. - -**Signature** - -```ts -export declare const catchTags: { - < - E, - Cases extends E extends { _tag: string } - ? { [K in E["_tag"]]+?: ((error: Extract) => Effect) | undefined } - : {} - >( - cases: Cases - ): ( - self: Effect - ) => Effect< - | R - | { - [K in keyof Cases]: Cases[K] extends (...args: Array) => Effect ? R : never - }[keyof Cases], - | Exclude - | { - [K in keyof Cases]: Cases[K] extends (...args: Array) => Effect ? E : never - }[keyof Cases], - | A - | { - [K in keyof Cases]: Cases[K] extends (...args: Array) => Effect ? A : never - }[keyof Cases] - > - < - R, - E, - A, - Cases extends E extends { _tag: string } - ? { [K in E["_tag"]]+?: ((error: Extract) => Effect) | undefined } - : {} - >( - self: Effect, - cases: Cases - ): Effect< - | R - | { - [K in keyof Cases]: Cases[K] extends (...args: Array) => Effect ? R : never - }[keyof Cases], - | Exclude - | { - [K in keyof Cases]: Cases[K] extends (...args: Array) => Effect ? E : never - }[keyof Cases], - | A - | { - [K in keyof Cases]: Cases[K] extends (...args: Array) => Effect ? A : never - }[keyof Cases] - > -} -``` - -Added in v2.0.0 - -## cause - -Returns an effect that succeeds with the cause of failure of this effect, -or `Cause.empty` if the effect did succeed. - -**Signature** - -```ts -export declare const cause: (self: Effect) => Effect> -``` - -Added in v2.0.0 - -## eventually - -Returns an effect that ignores errors and runs repeatedly until it -eventually succeeds. - -**Signature** - -```ts -export declare const eventually: (self: Effect) => Effect -``` - -Added in v2.0.0 - -## ignore - -Returns a new effect that ignores the success or failure of this effect. - -**Signature** - -```ts -export declare const ignore: (self: Effect) => Effect -``` - -Added in v2.0.0 - -## ignoreLogged - -Returns a new effect that ignores the success or failure of this effect, -but which also logs failures at the Debug level, just in case the failure -turns out to be important. - -**Signature** - -```ts -export declare const ignoreLogged: (self: Effect) => Effect -``` - -Added in v2.0.0 - -## parallelErrors - -Exposes all parallel errors in a single call. - -**Signature** - -```ts -export declare const parallelErrors: (self: Effect) => Effect -``` - -Added in v2.0.0 - -## retry - -Retries with the specified retry policy. Retries are done following the -failure of the original `io` (up to a fixed maximum with `once` or `recurs` -for example), so that that `io.retry(Schedule.once)` means "execute `io` -and in case of failure, try again once". - -**Signature** - -```ts -export declare const retry: { - (policy: Schedule.Schedule): (self: Effect) => Effect - (self: Effect, policy: Schedule.Schedule): Effect -} -``` - -Added in v2.0.0 - -## retryN - -Retries this effect the specified number of times. - -**Signature** - -```ts -export declare const retryN: { - (n: number): (self: Effect) => Effect - (self: Effect, n: number): Effect -} -``` - -Added in v2.0.0 - -## retryOrElse - -Retries with the specified schedule, until it fails, and then both the -value produced by the schedule together with the last error are passed to -the recovery function. - -**Signature** - -```ts -export declare const retryOrElse: { - ( - policy: Schedule.Schedule, - orElse: (e: E, out: A1) => Effect - ): (self: Effect) => Effect - ( - self: Effect, - policy: Schedule.Schedule, - orElse: (e: E, out: A1) => Effect - ): Effect -} -``` - -Added in v2.0.0 - -## retryUntil - -Retries this effect until its error satisfies the specified predicate. - -**Signature** - -```ts -export declare const retryUntil: { - (f: Refinement): (self: Effect) => Effect - (f: Predicate): (self: Effect) => Effect - (self: Effect, f: Refinement): Effect - (self: Effect, f: Predicate): Effect -} -``` - -Added in v2.0.0 - -## retryUntilEffect - -Retries this effect until its error satisfies the specified effectful -predicate. - -**Signature** - -```ts -export declare const retryUntilEffect: { - (f: (e: E) => Effect): (self: Effect) => Effect - (self: Effect, f: (e: E) => Effect): Effect -} -``` - -Added in v2.0.0 - -## retryWhile - -Retries this effect while its error satisfies the specified predicate. - -**Signature** - -```ts -export declare const retryWhile: { - (f: Predicate): (self: Effect) => Effect - (self: Effect, f: Predicate): Effect -} -``` - -Added in v2.0.0 - -## retryWhileEffect - -Retries this effect while its error satisfies the specified effectful -predicate. - -**Signature** - -```ts -export declare const retryWhileEffect: { - (f: (e: E) => Effect): (self: Effect) => Effect - (self: Effect, f: (e: E) => Effect): Effect -} -``` - -Added in v2.0.0 - -## sandbox - -Exposes the full `Cause` of failure for the specified effect. - -**Signature** - -```ts -export declare const sandbox: (self: Effect) => Effect, A> -``` - -Added in v2.0.0 - -## try - -Imports a synchronous side-effect into a pure `Effect` value, translating any -thrown exceptions into typed failed effects creating with `Effect.fail`. - -**Signature** - -```ts -export declare const try: { (options: { readonly try: LazyArg; readonly catch: (error: unknown) => E; }): Effect; (evaluate: LazyArg): Effect; } -``` - -Added in v2.0.0 - -## tryMap - -Returns an effect whose success is mapped by the specified side effecting -`try` function, translating any promise rejections into typed failed effects -via the `catch` function. - -**Signature** - -```ts -export declare const tryMap: { - (options: { - readonly try: (a: A) => B - readonly catch: (error: unknown) => E1 - }): (self: Effect) => Effect - ( - self: Effect, - options: { readonly try: (a: A) => B; readonly catch: (error: unknown) => E1 } - ): Effect -} -``` - -Added in v2.0.0 - -## tryMapPromise - -Returns an effect whose success is mapped by the specified side effecting -`try` function, translating any promise rejections into typed failed effects -via the `catch` function. - -An optional `AbortSignal` can be provided to allow for interruption of the -wrapped Promise api. - -**Signature** - -```ts -export declare const tryMapPromise: { - (options: { - readonly try: (a: A, signal: AbortSignal) => Promise - readonly catch: (error: unknown) => E1 - }): (self: Effect) => Effect - ( - self: Effect, - options: { readonly try: (a: A, signal: AbortSignal) => Promise; readonly catch: (error: unknown) => E1 } - ): Effect -} -``` - -Added in v2.0.0 - -## tryPromise - -Create an `Effect` that when executed will construct `promise` and wait for -its result, errors will produce failure as `unknown`. - -An optional `AbortSignal` can be provided to allow for interruption of the -wrapped Promise api. - -**Signature** - -```ts -export declare const tryPromise: { - (options: { - readonly try: (signal: AbortSignal) => Promise - readonly catch: (error: unknown) => E - }): Effect - (try_: (signal: AbortSignal) => Promise): Effect -} -``` - -Added in v2.0.0 - -## unsandbox - -The inverse operation `sandbox(effect)` - -Terminates with exceptions on the `Left` side of the `Either` error, if it -exists. Otherwise extracts the contained `Effect` - -**Signature** - -```ts -export declare const unsandbox: (self: Effect, A>) => Effect -``` - -Added in v2.0.0 - -# execution - -## runCallback - -**Signature** - -```ts -export declare const runCallback: ( - effect: Effect, - onExit?: ((exit: Exit.Exit) => void) | undefined -) => Runtime.Cancel -``` - -Added in v2.0.0 - -## runFork - -**Signature** - -```ts -export declare const runFork: (effect: Effect) => Fiber.RuntimeFiber -``` - -Added in v2.0.0 - -## runPromise - -Runs an `Effect` workflow, returning a `Promise` which resolves with the -result of the workflow or rejects with an error. - -**Signature** - -```ts -export declare const runPromise: (effect: Effect) => Promise -``` - -Added in v2.0.0 - -## runPromiseExit - -Runs an `Effect` workflow, returning a `Promise` which resolves with the -`Exit` value of the workflow. - -**Signature** - -```ts -export declare const runPromiseExit: (effect: Effect) => Promise> -``` - -Added in v2.0.0 - -## runSync - -**Signature** - -```ts -export declare const runSync: (effect: Effect) => A -``` - -Added in v2.0.0 - -## runSyncExit - -**Signature** - -```ts -export declare const runSyncExit: (effect: Effect) => Exit.Exit -``` - -Added in v2.0.0 - -# fiber refs - -## getFiberRefs - -Returns a collection of all `FiberRef` values for the fiber running this -effect. - -**Signature** - -```ts -export declare const getFiberRefs: Effect -``` - -Added in v2.0.0 - -## inheritFiberRefs - -Inherits values from all `FiberRef` instances into current fiber. - -**Signature** - -```ts -export declare const inheritFiberRefs: (childFiberRefs: FiberRefs.FiberRefs) => Effect -``` - -Added in v2.0.0 - -## locally - -**Signature** - -```ts -export declare const locally: { - (self: FiberRef.FiberRef, value: A): (use: Effect) => Effect - (use: Effect, self: FiberRef.FiberRef, value: A): Effect -} -``` - -Added in v2.0.0 - -## locallyScoped - -**Signature** - -```ts -export declare const locallyScoped: { - (value: A): (self: FiberRef.FiberRef) => Effect - (self: FiberRef.FiberRef, value: A): Effect -} -``` - -Added in v2.0.0 - -## locallyScopedWith - -**Signature** - -```ts -export declare const locallyScopedWith: { - (f: (a: A) => A): (self: FiberRef.FiberRef) => Effect - (self: FiberRef.FiberRef, f: (a: A) => A): Effect -} -``` - -Added in v2.0.0 - -## locallyWith - -**Signature** - -```ts -export declare const locallyWith: { - (self: FiberRef.FiberRef, f: (a: A) => A): (use: Effect) => Effect - (use: Effect, self: FiberRef.FiberRef, f: (a: A) => A): Effect -} -``` - -Added in v2.0.0 - -## patchFiberRefs - -Applies the specified changes to the `FiberRef` values for the fiber -running this workflow. - -**Signature** - -```ts -export declare const patchFiberRefs: (patch: FiberRefsPatch.FiberRefsPatch) => Effect -``` - -Added in v2.0.0 - -## setFiberRefs - -Sets the `FiberRef` values for the fiber running this effect to the values -in the specified collection of `FiberRef` values. - -**Signature** - -```ts -export declare const setFiberRefs: (fiberRefs: FiberRefs.FiberRefs) => Effect -``` - -Added in v2.0.0 - -## updateFiberRefs - -Updates the `FiberRef` values for the fiber running this effect using the -specified function. - -**Signature** - -```ts -export declare const updateFiberRefs: ( - f: (fiberId: FiberId.Runtime, fiberRefs: FiberRefs.FiberRefs) => FiberRefs.FiberRefs -) => Effect -``` - -Added in v2.0.0 - -# filtering & conditionals - -## filterOrDie - -Filter the specified effect with the provided function, dying with specified -defect if the predicate fails. - -**Signature** - -```ts -export declare const filterOrDie: { - ( - filter: Refinement, - orDieWith: (a: X) => unknown - ): (self: Effect) => Effect - ( - filter: Predicate, - orDieWith: (a: Y) => unknown - ): (self: Effect) => Effect - ( - self: Effect, - filter: Refinement, - orDieWith: (a: X) => unknown - ): Effect - ( - self: Effect, - filter: Predicate, - orDieWith: (a: Y) => unknown - ): Effect -} -``` - -Added in v2.0.0 - -## filterOrDieMessage - -Filter the specified effect with the provided function, dying with specified -message if the predicate fails. - -**Signature** - -```ts -export declare const filterOrDieMessage: { - (filter: Refinement, message: string): (self: Effect) => Effect - (filter: Predicate, message: string): (self: Effect) => Effect - (self: Effect, filter: Refinement, message: string): Effect - (self: Effect, filter: Predicate, message: string): Effect -} -``` - -Added in v2.0.0 - -## filterOrElse - -Filters the specified effect with the provided function returning the value -of the effect if it is successful, otherwise returns the value of `orElse`. - -**Signature** - -```ts -export declare const filterOrElse: { - ( - filter: Refinement, - orElse: (a: X) => Effect - ): (self: Effect) => Effect - ( - filter: Predicate, - orElse: (a: Y) => Effect - ): (self: Effect) => Effect - ( - self: Effect, - filter: Refinement, - orElse: (a: X) => Effect - ): Effect - ( - self: Effect, - filter: Predicate, - orElse: (a: Y) => Effect - ): Effect -} -``` - -Added in v2.0.0 - -## filterOrFail - -Filter the specified effect with the provided function, failing with specified -error if the predicate fails. - -**Signature** - -```ts -export declare const filterOrFail: { - ( - filter: Refinement, - orFailWith: (a: X) => E2 - ): (self: Effect) => Effect - ( - filter: Predicate, - orFailWith: (a: Y) => E2 - ): (self: Effect) => Effect - ( - self: Effect, - filter: Refinement, - orFailWith: (a: X) => E2 - ): Effect - ( - self: Effect, - filter: Predicate, - orFailWith: (a: Y) => E2 - ): Effect -} -``` - -Added in v2.0.0 - -## if - -Runs `onTrue` if the result of `self` is `true` and `onFalse` otherwise. - -**Signature** - -```ts -export declare const if: { (options: { readonly onTrue: Effect; readonly onFalse: Effect; }): (self: boolean | Effect) => Effect; (self: boolean, options: { readonly onTrue: Effect; readonly onFalse: Effect; }): Effect; (self: Effect, options: { readonly onTrue: Effect; readonly onFalse: Effect; }): Effect; } -``` - -Added in v2.0.0 - -## unless - -The moral equivalent of `if (!p) exp`. - -**Signature** - -```ts -export declare const unless: { - (predicate: LazyArg): (self: Effect) => Effect> - (self: Effect, predicate: LazyArg): Effect> -} -``` - -Added in v2.0.0 - -## unlessEffect - -The moral equivalent of `if (!p) exp` when `p` has side-effects. - -**Signature** - -```ts -export declare const unlessEffect: { - ( - predicate: Effect - ): (self: Effect) => Effect> - (self: Effect, predicate: Effect): Effect> -} -``` - -Added in v2.0.0 - -## when - -The moral equivalent of `if (p) exp`. - -**Signature** - -```ts -export declare const when: { - (predicate: LazyArg): (self: Effect) => Effect> - (self: Effect, predicate: LazyArg): Effect> -} -``` - -Added in v2.0.0 - -## whenEffect - -**Signature** - -```ts -export declare const whenEffect: { - ( - predicate: Effect - ): (effect: Effect) => Effect> - (self: Effect, predicate: Effect): Effect> -} -``` - -Added in v2.0.0 - -## whenFiberRef - -Executes this workflow when value of the specified `FiberRef` satisfies the -predicate. - -**Signature** - -```ts -export declare const whenFiberRef: { - ( - fiberRef: FiberRef.FiberRef, - predicate: Predicate - ): (self: Effect) => Effect]> - ( - self: Effect, - fiberRef: FiberRef.FiberRef, - predicate: Predicate - ): Effect]> -} -``` - -Added in v2.0.0 - -## whenRef - -Executes this workflow when the value of the `Ref` satisfies the predicate. - -**Signature** - -```ts -export declare const whenRef: { - (ref: Ref.Ref, predicate: Predicate): (self: Effect) => Effect]> - (self: Effect, ref: Ref.Ref, predicate: Predicate): Effect]> -} -``` - -Added in v2.0.0 - -# getters & folding - -## isFailure - -Returns `true` if this effect is a failure, `false` otherwise. - -**Signature** - -```ts -export declare const isFailure: (self: Effect) => Effect -``` - -Added in v2.0.0 - -## isSuccess - -Returns `true` if this effect is a success, `false` otherwise. - -**Signature** - -```ts -export declare const isSuccess: (self: Effect) => Effect -``` - -Added in v2.0.0 - -## match - -Folds over the failure value or the success value to yield an effect that -does not fail, but succeeds with the value returned by the left or right -function passed to `match`. - -**Signature** - -```ts -export declare const match: { - (options: { - readonly onFailure: (error: E) => A2 - readonly onSuccess: (value: A) => A3 - }): (self: Effect) => Effect - ( - self: Effect, - options: { readonly onFailure: (error: E) => A2; readonly onSuccess: (value: A) => A3 } - ): Effect -} -``` - -Added in v2.0.0 - -## matchCause - -**Signature** - -```ts -export declare const matchCause: { - (options: { - readonly onFailure: (cause: Cause.Cause) => A2 - readonly onSuccess: (a: A) => A3 - }): (self: Effect) => Effect - ( - self: Effect, - options: { readonly onFailure: (cause: Cause.Cause) => A2; readonly onSuccess: (a: A) => A3 } - ): Effect -} -``` - -Added in v2.0.0 - -## matchCauseEffect - -**Signature** - -```ts -export declare const matchCauseEffect: { - (options: { - readonly onFailure: (cause: Cause.Cause) => Effect - readonly onSuccess: (a: A) => Effect - }): (self: Effect) => Effect - ( - self: Effect, - options: { - readonly onFailure: (cause: Cause.Cause) => Effect - readonly onSuccess: (a: A) => Effect - } - ): Effect -} -``` - -Added in v2.0.0 - -## matchEffect - -**Signature** - -```ts -export declare const matchEffect: { - (options: { - readonly onFailure: (e: E) => Effect - readonly onSuccess: (a: A) => Effect - }): (self: Effect) => Effect - ( - self: Effect, - options: { readonly onFailure: (e: E) => Effect; readonly onSuccess: (a: A) => Effect } - ): Effect -} -``` - -Added in v2.0.0 - -# interruption - -## allowInterrupt - -This function checks if any fibers are attempting to interrupt the current -fiber, and if so, performs self-interruption. - -Note that this allows for interruption to occur in uninterruptible regions. - -**Signature** - -```ts -export declare const allowInterrupt: Effect -``` - -Added in v2.0.0 - -## checkInterruptible - -Checks the interrupt status, and produces the effect returned by the -specified callback. - -**Signature** - -```ts -export declare const checkInterruptible: (f: (isInterruptible: boolean) => Effect) => Effect -``` - -Added in v2.0.0 - -## disconnect - -Returns an effect whose interruption will be disconnected from the -fiber's own interruption, being performed in the background without -slowing down the fiber's interruption. - -This method is useful to create "fast interrupting" effects. For -example, if you call this on a bracketed effect, then even if the -effect is "stuck" in acquire or release, its interruption will return -immediately, while the acquire / release are performed in the -background. - -See timeout and race for other applications. - -**Signature** - -```ts -export declare const disconnect: (self: Effect) => Effect -``` - -Added in v2.0.0 - -## interrupt - -**Signature** - -```ts -export declare const interrupt: Effect -``` - -Added in v2.0.0 - -## interruptWith - -**Signature** - -```ts -export declare const interruptWith: (fiberId: FiberId.FiberId) => Effect -``` - -Added in v2.0.0 - -## interruptible - -**Signature** - -```ts -export declare const interruptible: (self: Effect) => Effect -``` - -Added in v2.0.0 - -## interruptibleMask - -**Signature** - -```ts -export declare const interruptibleMask: ( - f: (restore: (effect: Effect) => Effect) => Effect -) => Effect -``` - -Added in v2.0.0 - -## onInterrupt - -**Signature** - -```ts -export declare const onInterrupt: { - ( - cleanup: (interruptors: HashSet.HashSet) => Effect - ): (self: Effect) => Effect - ( - self: Effect, - cleanup: (interruptors: HashSet.HashSet) => Effect - ): Effect -} -``` - -Added in v2.0.0 - -## uninterruptible - -**Signature** - -```ts -export declare const uninterruptible: (self: Effect) => Effect -``` - -Added in v2.0.0 - -## uninterruptibleMask - -**Signature** - -```ts -export declare const uninterruptibleMask: ( - f: (restore: (effect: Effect) => Effect) => Effect -) => Effect -``` - -Added in v2.0.0 - -# logging - -## annotateLogs - -Annotates each log in this effect with the specified log annotation. - -**Signature** - -```ts -export declare const annotateLogs: { - (key: string, value: unknown): (effect: Effect) => Effect - (values: Record): (effect: Effect) => Effect - (effect: Effect, key: string, value: unknown): Effect - (effect: Effect, values: Record): Effect -} -``` - -Added in v2.0.0 - -## log - -Logs the specified message or cause at the current log level. - -You can set the current log level using `FiberRef.currentLogLevel`. - -**Signature** - -```ts -export declare const log: ( - messageOrCause: A, - supplementary?: (A extends Cause.Cause ? unknown : Cause.Cause) | undefined -) => Effect -``` - -Added in v2.0.0 - -## logAnnotations - -Retrieves the log annotations associated with the current scope. - -**Signature** - -```ts -export declare const logAnnotations: Effect> -``` - -Added in v2.0.0 - -## logDebug - -Logs the specified message or cause at the Debug log level. - -**Signature** - -```ts -export declare const logDebug: ( - messageOrCause: A, - supplementary?: (A extends Cause.Cause ? unknown : Cause.Cause) | undefined -) => Effect -``` - -Added in v2.0.0 - -## logError - -Logs the specified message or cause at the Error log level. - -**Signature** - -```ts -export declare const logError: ( - messageOrCause: A, - supplementary?: (A extends Cause.Cause ? unknown : Cause.Cause) | undefined -) => Effect -``` - -Added in v2.0.0 - -## logFatal - -Logs the specified message or cause at the Fatal log level. - -**Signature** - -```ts -export declare const logFatal: ( - messageOrCause: A, - supplementary?: (A extends Cause.Cause ? unknown : Cause.Cause) | undefined -) => Effect -``` - -Added in v2.0.0 - -## logInfo - -Logs the specified message or cause at the Info log level. - -**Signature** - -```ts -export declare const logInfo: ( - messageOrCause: A, - supplementary?: (A extends Cause.Cause ? unknown : Cause.Cause) | undefined -) => Effect -``` - -Added in v2.0.0 - -## logTrace - -Logs the specified message or cause at the Trace log level. - -**Signature** - -```ts -export declare const logTrace: ( - messageOrCause: A, - supplementary?: (A extends Cause.Cause ? unknown : Cause.Cause) | undefined -) => Effect -``` - -Added in v2.0.0 - -## logWarning - -Logs the specified message or cause at the Warning log level. - -**Signature** - -```ts -export declare const logWarning: ( - messageOrCause: A, - supplementary?: (A extends Cause.Cause ? unknown : Cause.Cause) | undefined -) => Effect -``` - -Added in v2.0.0 - -## withLogSpan - -Adjusts the label for the current logging span. - -**Signature** - -```ts -export declare const withLogSpan: { - (label: string): (effect: Effect) => Effect - (effect: Effect, label: string): Effect -} -``` - -Added in v2.0.0 - -## withUnhandledErrorLogLevel - -Decides wether child fibers will report or not unhandled errors via the logger - -**Signature** - -```ts -export declare const withUnhandledErrorLogLevel: { - (level: Option.Option): (self: Effect) => Effect - (self: Effect, level: Option.Option): Effect -} -``` - -Added in v2.0.0 - -# mapping - -## as - -This function maps the success value of an `Effect` value to a specified -constant value. - -**Signature** - -```ts -export declare const as: { - (value: B): (self: Effect) => Effect - (self: Effect, value: B): Effect -} -``` - -Added in v2.0.0 - -## asSome - -This function maps the success value of an `Effect` value to a `Some` value -in an `Option` value. If the original `Effect` value fails, the returned -`Effect` value will also fail. - -**Signature** - -```ts -export declare const asSome: (self: Effect) => Effect> -``` - -Added in v2.0.0 - -## asSomeError - -This function maps the error value of an `Effect` value to a `Some` value -in an `Option` value. If the original `Effect` value succeeds, the returned -`Effect` value will also succeed. - -**Signature** - -```ts -export declare const asSomeError: (self: Effect) => Effect, A> -``` - -Added in v2.0.0 - -## asUnit - -This function maps the success value of an `Effect` value to `void`. If the -original `Effect` value succeeds, the returned `Effect` value will also -succeed. If the original `Effect` value fails, the returned `Effect` value -will fail with the same error. - -**Signature** - -```ts -export declare const asUnit: (self: Effect) => Effect -``` - -Added in v2.0.0 - -## flip - -Returns an effect that swaps the error/success cases. This allows you to -use all methods on the error channel, possibly before flipping back. - -**Signature** - -```ts -export declare const flip: (self: Effect) => Effect -``` - -Added in v2.0.0 - -## flipWith - -Swaps the error/value parameters, applies the function `f` and flips the -parameters back - -**Signature** - -```ts -export declare const flipWith: { - ( - f: (effect: Effect) => Effect - ): (self: Effect) => Effect - (self: Effect, f: (effect: Effect) => Effect): Effect -} -``` - -Added in v2.0.0 - -## map - -**Signature** - -```ts -export declare const map: { - (f: (a: A) => B): (self: Effect) => Effect - (self: Effect, f: (a: A) => B): Effect -} -``` - -Added in v2.0.0 - -## mapAccum - -Statefully and effectfully maps over the elements of this chunk to produce -new elements. - -**Signature** - -```ts -export declare const mapAccum: { - ( - zero: Z, - f: (z: Z, a: A, i: number) => Effect - ): (elements: Iterable) => Effect - ( - elements: Iterable, - zero: Z, - f: (z: Z, a: A, i: number) => Effect - ): Effect -} -``` - -Added in v2.0.0 - -## mapBoth - -Returns an effect whose failure and success channels have been mapped by -the specified `onFailure` and `onSuccess` functions. - -**Signature** - -```ts -export declare const mapBoth: { - (options: { - readonly onFailure: (e: E) => E2 - readonly onSuccess: (a: A) => A2 - }): (self: Effect) => Effect - ( - self: Effect, - options: { readonly onFailure: (e: E) => E2; readonly onSuccess: (a: A) => A2 } - ): Effect -} -``` - -Added in v2.0.0 - -## mapError - -Returns an effect with its error channel mapped using the specified function. - -**Signature** - -```ts -export declare const mapError: { - (f: (e: E) => E2): (self: Effect) => Effect - (self: Effect, f: (e: E) => E2): Effect -} -``` - -Added in v2.0.0 - -## mapErrorCause - -Returns an effect with its full cause of failure mapped using the specified -function. This can be used to transform errors while preserving the -original structure of `Cause`. - -See `absorb`, `sandbox`, `catchAllCause` for other functions for dealing -with defects. - -**Signature** - -```ts -export declare const mapErrorCause: { - (f: (cause: Cause.Cause) => Cause.Cause): (self: Effect) => Effect - (self: Effect, f: (cause: Cause.Cause) => Cause.Cause): Effect -} -``` - -Added in v2.0.0 - -## merge - -Returns a new effect where the error channel has been merged into the -success channel to their common combined type. - -**Signature** - -```ts -export declare const merge: (self: Effect) => Effect -``` - -Added in v2.0.0 - -## negate - -Returns a new effect where boolean value of this effect is negated. - -**Signature** - -```ts -export declare const negate: (self: Effect) => Effect -``` - -Added in v2.0.0 - -# metrics - -## labelMetrics - -Tags each metric in this effect with the specific tag. - -**Signature** - -```ts -export declare const labelMetrics: { - (labels: Iterable): (self: Effect) => Effect - (self: Effect, labels: Iterable): Effect -} -``` - -Added in v2.0.0 - -## labelMetricsScoped - -Tags each metric in a scope with a the specific tag. - -**Signature** - -```ts -export declare const labelMetricsScoped: ( - labels: ReadonlyArray -) => Effect -``` - -Added in v2.0.0 - -## labelMetricsScopedSet - -Tags each metric in a scope with a the specific tag. - -**Signature** - -```ts -export declare const labelMetricsScopedSet: ( - labels: HashSet.HashSet -) => Effect -``` - -Added in v2.0.0 - -## labelMetricsSet - -Tags each metric in this effect with the specific tag. - -**Signature** - -```ts -export declare const labelMetricsSet: { - (labels: HashSet.HashSet): (self: Effect) => Effect - (self: Effect, labels: HashSet.HashSet): Effect -} -``` - -Added in v2.0.0 - -## metricLabels - -Retrieves the metric labels associated with the current scope. - -**Signature** - -```ts -export declare const metricLabels: Effect> -``` - -Added in v2.0.0 - -## tagMetrics - -Tags each metric in this effect with the specific tag. - -**Signature** - -```ts -export declare const tagMetrics: { - (key: string, value: string): (effect: Effect) => Effect - (values: Record): (effect: Effect) => Effect - (effect: Effect, key: string, value: string): Effect - (effect: Effect, values: Record): Effect -} -``` - -Added in v2.0.0 - -## tagMetricsScoped - -Tags each metric in a scope with a the specific tag. - -**Signature** - -```ts -export declare const tagMetricsScoped: (key: string, value: string) => Effect -``` - -Added in v2.0.0 - -## withMetric - -**Signature** - -```ts -export declare const withMetric: { - (metric: Metric.Metric): (self: Effect) => Effect - (self: Effect, metric: Metric.Metric): Effect -} -``` - -Added in v2.0.0 - -# models - -## Adapter (interface) - -**Signature** - -```ts -export interface Adapter { - (self: Effect): EffectGen - (a: A, ab: (a: A) => Effect<_R, _E, _A>): EffectGen<_R, _E, _A> - (a: A, ab: (a: A) => B, bc: (b: B) => Effect<_R, _E, _A>): EffectGen<_R, _E, _A> - (a: A, ab: (a: A) => B, bc: (b: B) => C, cd: (c: C) => Effect<_R, _E, _A>): EffectGen<_R, _E, _A> - ( - a: A, - ab: (a: A) => B, - bc: (b: B) => C, - cd: (c: C) => D, - de: (d: D) => Effect<_R, _E, _A> - ): EffectGen<_R, _E, _A> - ( - a: A, - ab: (a: A) => B, - bc: (b: B) => C, - cd: (c: C) => D, - de: (d: D) => E, - ef: (e: E) => Effect<_R, _E, _A> - ): EffectGen<_R, _E, _A> - ( - a: A, - ab: (a: A) => B, - bc: (b: B) => C, - cd: (c: C) => D, - de: (d: D) => E, - ef: (e: E) => F, - fg: (f: F) => Effect<_R, _E, _A> - ): EffectGen<_R, _E, _A> - ( - a: A, - ab: (a: A) => B, - bc: (b: B) => C, - cd: (c: C) => D, - de: (d: D) => E, - ef: (e: E) => F, - fg: (f: F) => G, - gh: (g: G) => Effect<_R, _E, _A> - ): EffectGen<_R, _E, _A> - ( - a: A, - ab: (a: A) => B, - bc: (b: B) => C, - cd: (c: C) => D, - de: (d: D) => E, - ef: (e: E) => F, - fg: (f: F) => G, - gh: (g: G) => H, - hi: (g: H) => Effect<_R, _E, _A> - ): EffectGen<_R, _E, _A> - ( - a: A, - ab: (a: A) => B, - bc: (b: B) => C, - cd: (c: C) => D, - de: (d: D) => E, - ef: (e: E) => F, - fg: (f: F) => G, - gh: (g: G) => H, - hi: (h: H) => I, - ij: (i: I) => Effect<_R, _E, _A> - ): EffectGen<_R, _E, _A> - ( - a: A, - ab: (a: A) => B, - bc: (b: B) => C, - cd: (c: C) => D, - de: (d: D) => E, - ef: (e: E) => F, - fg: (f: F) => G, - gh: (g: G) => H, - hi: (h: H) => I, - ij: (i: I) => J, - jk: (j: J) => Effect<_R, _E, _A> - ): EffectGen<_R, _E, _A> - ( - a: A, - ab: (a: A) => B, - bc: (b: B) => C, - cd: (c: C) => D, - de: (d: D) => E, - ef: (e: E) => F, - fg: (f: F) => G, - gh: (g: G) => H, - hi: (h: H) => I, - ij: (i: I) => J, - jk: (j: J) => K, - kl: (k: K) => Effect<_R, _E, _A> - ): EffectGen<_R, _E, _A> - ( - a: A, - ab: (a: A) => B, - bc: (b: B) => C, - cd: (c: C) => D, - de: (d: D) => E, - ef: (e: E) => F, - fg: (f: F) => G, - gh: (g: G) => H, - hi: (h: H) => I, - ij: (i: I) => J, - jk: (j: J) => K, - kl: (k: K) => L, - lm: (l: L) => Effect<_R, _E, _A> - ): EffectGen<_R, _E, _A> - ( - a: A, - ab: (a: A) => B, - bc: (b: B) => C, - cd: (c: C) => D, - de: (d: D) => E, - ef: (e: E) => F, - fg: (f: F) => G, - gh: (g: G) => H, - hi: (h: H) => I, - ij: (i: I) => J, - jk: (j: J) => K, - kl: (k: K) => L, - lm: (l: L) => M, - mn: (m: M) => Effect<_R, _E, _A> - ): EffectGen<_R, _E, _A> - ( - a: A, - ab: (a: A) => B, - bc: (b: B) => C, - cd: (c: C) => D, - de: (d: D) => E, - ef: (e: E) => F, - fg: (f: F) => G, - gh: (g: G) => H, - hi: (h: H) => I, - ij: (i: I) => J, - jk: (j: J) => K, - kl: (k: K) => L, - lm: (l: L) => M, - mn: (m: M) => N, - no: (n: N) => Effect<_R, _E, _A> - ): EffectGen<_R, _E, _A> - ( - a: A, - ab: (a: A) => B, - bc: (b: B) => C, - cd: (c: C) => D, - de: (d: D) => E, - ef: (e: E) => F, - fg: (f: F) => G, - gh: (g: G) => H, - hi: (h: H) => I, - ij: (i: I) => J, - jk: (j: J) => K, - kl: (k: K) => L, - lm: (l: L) => M, - mn: (m: M) => N, - no: (n: N) => O, - op: (o: O) => Effect<_R, _E, _A> - ): EffectGen<_R, _E, _A> - ( - a: A, - ab: (a: A) => B, - bc: (b: B) => C, - cd: (c: C) => D, - de: (d: D) => E, - ef: (e: E) => F, - fg: (f: F) => G, - gh: (g: G) => H, - hi: (h: H) => I, - ij: (i: I) => J, - jk: (j: J) => K, - kl: (k: K) => L, - lm: (l: L) => M, - mn: (m: M) => N, - no: (n: N) => O, - op: (o: O) => P, - pq: (p: P) => Effect<_R, _E, _A> - ): EffectGen<_R, _E, _A> - ( - a: A, - ab: (a: A) => B, - bc: (b: B) => C, - cd: (c: C) => D, - de: (d: D) => E, - ef: (e: E) => F, - fg: (f: F) => G, - gh: (g: G) => H, - hi: (h: H) => I, - ij: (i: I) => J, - jk: (j: J) => K, - kl: (k: K) => L, - lm: (l: L) => M, - mn: (m: M) => N, - no: (n: N) => O, - op: (o: O) => P, - pq: (p: P) => Q, - qr: (q: Q) => Effect<_R, _E, _A> - ): EffectGen<_R, _E, _A> - ( - a: A, - ab: (a: A) => B, - bc: (b: B) => C, - cd: (c: C) => D, - de: (d: D) => E, - ef: (e: E) => F, - fg: (f: F) => G, - gh: (g: G) => H, - hi: (h: H) => I, - ij: (i: I) => J, - jk: (j: J) => K, - kl: (k: K) => L, - lm: (l: L) => M, - mn: (m: M) => N, - no: (n: N) => O, - op: (o: O) => P, - pq: (p: P) => Q, - qr: (q: Q) => R, - rs: (r: R) => Effect<_R, _E, _A> - ): EffectGen<_R, _E, _A> - ( - a: A, - ab: (a: A) => B, - bc: (b: B) => C, - cd: (c: C) => D, - de: (d: D) => E, - ef: (e: E) => F, - fg: (f: F) => G, - gh: (g: G) => H, - hi: (h: H) => I, - ij: (i: I) => J, - jk: (j: J) => K, - kl: (k: K) => L, - lm: (l: L) => M, - mn: (m: M) => N, - no: (n: N) => O, - op: (o: O) => P, - pq: (p: P) => Q, - qr: (q: Q) => R, - rs: (r: R) => S, - st: (s: S) => Effect<_R, _E, _A> - ): EffectGen<_R, _E, _A> - ( - a: A, - ab: (a: A) => B, - bc: (b: B) => C, - cd: (c: C) => D, - de: (d: D) => E, - ef: (e: E) => F, - fg: (f: F) => G, - gh: (g: G) => H, - hi: (h: H) => I, - ij: (i: I) => J, - jk: (j: J) => K, - kl: (k: K) => L, - lm: (l: L) => M, - mn: (m: M) => N, - no: (n: N) => O, - op: (o: O) => P, - pq: (p: P) => Q, - qr: (q: Q) => R, - rs: (r: R) => S, - st: (s: S) => T, - tu: (s: T) => Effect<_R, _E, _A> - ): EffectGen<_R, _E, _A> -} -``` - -Added in v2.0.0 - -## Blocked (interface) - -**Signature** - -```ts -export interface Blocked extends Effect { - readonly _op: "Blocked" - readonly i0: RequestBlock - readonly i1: Effect -} -``` - -Added in v2.0.0 - -## Effect (interface) - -The `Effect` interface defines a value that lazily describes a workflow or job. -The workflow requires some context `R`, and may fail with an error of type `E`, -or succeed with a value of type `A`. - -`Effect` values model resourceful interaction with the outside world, including -synchronous, asynchronous, concurrent, and parallel interaction. They use a -fiber-based concurrency model, with built-in support for scheduling, fine-grained -interruption, structured concurrency, and high scalability. - -To run an `Effect` value, you need a `Runtime`, which is a type that is capable -of executing `Effect` values. - -**Signature** - -```ts -export interface Effect extends Effect.Variance, Equal.Equal, Pipeable { - readonly [Unify.typeSymbol]?: unknown - readonly [Unify.unifySymbol]?: EffectUnify - readonly [Unify.ignoreSymbol]?: EffectUnifyIgnore -} -``` - -Added in v2.0.0 - -## EffectGen (interface) - -**Signature** - -```ts -export interface EffectGen { - readonly _R: () => R - readonly _E: () => E - readonly _A: () => A - readonly value: Effect - - [Symbol.iterator](): Generator, A> -} -``` - -Added in v2.0.0 - -## EffectUnify (interface) - -**Signature** - -```ts -export interface EffectUnify - extends Either.EitherUnify, - Option.OptionUnify, - Context.TagUnify { - Effect?: () => A[Unify.typeSymbol] extends Effect | infer _ ? Effect : never -} -``` - -Added in v2.0.0 - -## EffectUnifyIgnore (interface) - -**Signature** - -```ts -export interface EffectUnifyIgnore { - Tag?: true - Option?: true - Either?: true -} -``` - -Added in v2.0.0 - -# optionality - -## fromNullable - -Returns an effect that errors with `NoSuchElementException` if the value is -null or undefined, otherwise succeeds with the value. - -**Signature** - -```ts -export declare const fromNullable: (value: A) => Effect> -``` - -Added in v2.0.0 - -## optionFromOptional - -Wraps the success value of this effect with `Option.some`, and maps -`Cause.NoSuchElementException` to `Option.none`. - -**Signature** - -```ts -export declare const optionFromOptional: ( - self: Effect -) => Effect, Option.Option> -``` - -Added in v2.0.0 - -# random - -## random - -Retreives the `Random` service from the context. - -**Signature** - -```ts -export declare const random: Effect -``` - -Added in v2.0.0 - -## randomWith - -Retreives the `Random` service from the context and uses it to run the -specified workflow. - -**Signature** - -```ts -export declare const randomWith: (f: (random: Random.Random) => Effect) => Effect -``` - -Added in v2.0.0 - -# refinements - -## isEffect - -This function returns `true` if the specified value is an `Effect` value, -`false` otherwise. - -This function can be useful for checking the type of a value before -attempting to operate on it as an `Effect` value. For example, you could -use `isEffect` to check the type of a value before using it as an -argument to a function that expects an `Effect` value. - -**Signature** - -```ts -export declare const isEffect: (u: unknown) => u is Effect -``` - -Added in v2.0.0 - -# repetition / recursion - -## forever - -Repeats this effect forever (until the first error). - -**Signature** - -```ts -export declare const forever: (self: Effect) => Effect -``` - -Added in v2.0.0 - -## iterate - -The `Effect.iterate` function allows you to iterate with an effectful operation. It uses an effectful `body` operation to change the state during each iteration and continues the iteration as long as the `while` function evaluates to `true`: - -```ts -Effect.iterate(initial, options: { while, body }) -``` - -We can think of `Effect.iterate` as equivalent to a `while` loop in JavaScript: - -```ts -let result = initial - -while (options.while(result)) { - result = options.body(result) -} - -return result -``` - -**Signature** - -```ts -export declare const iterate: { - ( - initial: A, - options: { readonly while: Refinement; readonly body: (b: B) => Effect } - ): Effect - ( - initial: A, - options: { readonly while: (a: A) => boolean; readonly body: (a: A) => Effect } - ): Effect -} -``` - -Added in v2.0.0 - -## loop - -The `Effect.loop` function allows you to repeatedly change the state based on an `step` function until a condition given by the `while` function is evaluated to `true`: - -```ts -Effect.loop(initial, options: { while, step, body }) -``` - -It collects all intermediate states in an array and returns it as the final result. - -We can think of Effect.loop as equivalent to a while loop in JavaScript: - -```ts -let state = initial -const result = [] - -while (options.while(state)) { - result.push(options.body(state)) - state = options.step(state) -} - -return result -``` - -**Signature** - -```ts -export declare const loop: { - ( - initial: A, - options: { - readonly while: Refinement - readonly step: (b: B) => A - readonly body: (b: B) => Effect - readonly discard?: false | undefined - } - ): Effect - ( - initial: A, - options: { - readonly while: (a: A) => boolean - readonly step: (a: A) => A - readonly body: (a: A) => Effect - readonly discard?: false | undefined - } - ): Effect - ( - initial: A, - options: { - readonly while: Refinement - readonly step: (b: B) => A - readonly body: (b: B) => Effect - readonly discard: true - } - ): Effect - ( - initial: A, - options: { - readonly while: (a: A) => boolean - readonly step: (a: A) => A - readonly body: (a: A) => Effect - readonly discard: true - } - ): Effect -} -``` - -Added in v2.0.0 - -## repeat - -Returns a new effect that repeats this effect according to the specified -schedule or until the first failure. Scheduled recurrences are in addition -to the first execution, so that `io.repeat(Schedule.once)` yields an effect -that executes `io`, and then if that succeeds, executes `io` an additional -time. - -**Signature** - -```ts -export declare const repeat: { - ( - schedule: Schedule.Schedule - ): (self: Effect) => Effect - (self: Effect, schedule: Schedule.Schedule): Effect -} -``` - -Added in v2.0.0 - -## repeatN - -Returns a new effect that repeats this effect the specified number of times -or until the first failure. Repeats are in addition to the first execution, -so that `io.repeatN(1)` yields an effect that executes `io`, and then if -that succeeds, executes `io` an additional time. - -**Signature** - -```ts -export declare const repeatN: { - (n: number): (self: Effect) => Effect - (self: Effect, n: number): Effect -} -``` - -Added in v2.0.0 - -## repeatOrElse - -Returns a new effect that repeats this effect according to the specified -schedule or until the first failure, at which point, the failure value and -schedule output are passed to the specified handler. - -Scheduled recurrences are in addition to the first execution, so that -`pipe(effect, Effect.repeat(Schedule.once()))` yields an effect that executes -`effect`, and then if that succeeds, executes `effect` an additional time. - -**Signature** - -```ts -export declare const repeatOrElse: { - ( - schedule: Schedule.Schedule, - orElse: (error: E, option: Option.Option) => Effect - ): (self: Effect) => Effect - ( - self: Effect, - schedule: Schedule.Schedule, - orElse: (error: E, option: Option.Option) => Effect - ): Effect -} -``` - -Added in v2.0.0 - -## repeatUntil - -Repeats this effect until its value satisfies the specified predicate or -until the first failure. - -**Signature** - -```ts -export declare const repeatUntil: { - (f: Refinement): (self: Effect) => Effect - (f: Predicate): (self: Effect) => Effect - (self: Effect, f: Predicate): Effect - (self: Effect, f: Predicate): Effect -} -``` - -Added in v2.0.0 - -## repeatUntilEffect - -Repeats this effect until its value satisfies the specified effectful -predicate or until the first failure. - -**Signature** - -```ts -export declare const repeatUntilEffect: { - (f: (a: A) => Effect): (self: Effect) => Effect - (self: Effect, f: (a: A) => Effect): Effect -} -``` - -Added in v2.0.0 - -## repeatWhile - -Repeats this effect while its value satisfies the specified effectful -predicate or until the first failure. - -**Signature** - -```ts -export declare const repeatWhile: { - (f: Predicate): (self: Effect) => Effect - (self: Effect, f: Predicate): Effect -} -``` - -Added in v2.0.0 - -## repeatWhileEffect - -Repeats this effect while its value satisfies the specified effectful -predicate or until the first failure. - -**Signature** - -```ts -export declare const repeatWhileEffect: { - (f: (a: A) => Effect): (self: Effect) => Effect - (self: Effect, f: (a: A) => Effect): Effect -} -``` - -Added in v2.0.0 - -## schedule - -Runs this effect according to the specified schedule. - -See `scheduleFrom` for a variant that allows the schedule's decision to -depend on the result of this effect. - -**Signature** - -```ts -export declare const schedule: { - (schedule: Schedule.Schedule): (self: Effect) => Effect - (self: Effect, schedule: Schedule.Schedule): Effect -} -``` - -Added in v2.0.0 - -## scheduleForked - -Runs this effect according to the specified schedule in a new fiber -attached to the current scope. - -**Signature** - -```ts -export declare const scheduleForked: { - ( - schedule: Schedule.Schedule - ): (self: Effect) => Effect> - ( - self: Effect, - schedule: Schedule.Schedule - ): Effect> -} -``` - -Added in v2.0.0 - -## scheduleFrom - -Runs this effect according to the specified schedule starting from the -specified input value. - -**Signature** - -```ts -export declare const scheduleFrom: { - ( - initial: In, - schedule: Schedule.Schedule - ): (self: Effect) => Effect - ( - self: Effect, - initial: In, - schedule: Schedule.Schedule - ): Effect -} -``` - -Added in v2.0.0 - -## whileLoop - -**Signature** - -```ts -export declare const whileLoop: (options: { - readonly while: LazyArg - readonly body: LazyArg> - readonly step: (a: A) => void -}) => Effect -``` - -Added in v2.0.0 - -# requests & batching - -## blocked - -**Signature** - -```ts -export declare const blocked: ( - blockedRequests: RequestBlock, - _continue: Effect -) => Blocked -``` - -Added in v2.0.0 - -## cacheRequestResult - -**Signature** - -```ts -export declare const cacheRequestResult: >( - request: A, - result: Request.Request.Result -) => Effect -``` - -Added in v2.0.0 - -## flatMapStep - -**Signature** - -```ts -export declare const flatMapStep: ( - self: Effect, - f: (step: Exit.Exit | Blocked) => Effect -) => Effect -``` - -Added in v2.0.0 - -## request - -**Signature** - -```ts -export declare const request: < - A extends Request.Request, - Ds extends RequestResolver | Effect> ->( - request: A, - dataSource: Ds -) => Effect< - [Ds] extends [Effect] ? Effect.Context : never, - Request.Request.Error, - Request.Request.Success -> -``` - -Added in v2.0.0 - -## runRequestBlock - -**Signature** - -```ts -export declare const runRequestBlock: (blockedRequests: RequestBlock) => Blocked -``` - -Added in v2.0.0 - -## step - -**Signature** - -```ts -export declare const step: (self: Effect) => Effect | Blocked> -``` - -Added in v2.0.0 - -## withRequestBatching - -**Signature** - -```ts -export declare const withRequestBatching: { - (requestBatching: boolean): (self: Effect) => Effect - (self: Effect, requestBatching: boolean): Effect -} -``` - -Added in v2.0.0 - -## withRequestCache - -**Signature** - -```ts -export declare const withRequestCache: { - (cache: Request.Cache): (self: Effect) => Effect - (self: Effect, cache: Request.Cache): Effect -} -``` - -Added in v2.0.0 - -## withRequestCaching - -**Signature** - -```ts -export declare const withRequestCaching: { - (strategy: boolean): (self: Effect) => Effect - (self: Effect, strategy: boolean): Effect -} -``` - -Added in v2.0.0 - -# runtime - -## getRuntimeFlags - -Retrieves an effect that succeeds with the current runtime flags, which -govern behavior and features of the runtime system. - -**Signature** - -```ts -export declare const getRuntimeFlags: Effect -``` - -Added in v2.0.0 - -## patchRuntimeFlags - -**Signature** - -```ts -export declare const patchRuntimeFlags: (patch: RuntimeFlagsPatch.RuntimeFlagsPatch) => Effect -``` - -Added in v2.0.0 - -## runtime - -Returns an effect that accesses the runtime, which can be used to -(unsafely) execute tasks. This is useful for integration with legacy code -that must call back into Effect code. - -**Signature** - -```ts -export declare const runtime: () => Effect> -``` - -Added in v2.0.0 - -## withRuntimeFlagsPatch - -**Signature** - -```ts -export declare const withRuntimeFlagsPatch: { - (update: RuntimeFlagsPatch.RuntimeFlagsPatch): (self: Effect) => Effect - (self: Effect, update: RuntimeFlagsPatch.RuntimeFlagsPatch): Effect -} -``` - -Added in v2.0.0 - -## withRuntimeFlagsPatchScoped - -**Signature** - -```ts -export declare const withRuntimeFlagsPatchScoped: ( - update: RuntimeFlagsPatch.RuntimeFlagsPatch -) => Effect -``` - -Added in v2.0.0 - -# scheduler - -## withScheduler - -Sets the provided scheduler for usage in the wrapped effect - -**Signature** - -```ts -export declare const withScheduler: { - (scheduler: Scheduler.Scheduler): (self: Effect) => Effect - (self: Effect, scheduler: Scheduler.Scheduler): Effect -} -``` - -Added in v2.0.0 - -# scoping, resources & finalization - -## acquireRelease - -This function constructs a scoped resource from an `acquire` and `release` -`Effect` value. - -If the `acquire` `Effect` value successfully completes execution, then the -`release` `Effect` value will be added to the finalizers associated with the -scope of this `Effect` value, and it is guaranteed to be run when the scope -is closed. - -The `acquire` and `release` `Effect` values will be run uninterruptibly. -Additionally, the `release` `Effect` value may depend on the `Exit` value -specified when the scope is closed. - -**Signature** - -```ts -export declare const acquireRelease: { - ( - release: (a: A, exit: Exit.Exit) => Effect - ): (acquire: Effect) => Effect - ( - acquire: Effect, - release: (a: A, exit: Exit.Exit) => Effect - ): Effect -} -``` - -Added in v2.0.0 - -## acquireReleaseInterruptible - -This function constructs a scoped resource from an `acquire` and `release` -`Effect` value. - -If the `acquire` `Effect` value successfully completes execution, then the -`release` `Effect` value will be added to the finalizers associated with the -scope of this `Effect` value, and it is guaranteed to be run when the scope -is closed. - -The `acquire` `Effect` values will be run interruptibly. -The `release` `Effect` values will be run uninterruptibly. - -Additionally, the `release` `Effect` value may depend on the `Exit` value -specified when the scope is closed. - -**Signature** - -```ts -export declare const acquireReleaseInterruptible: { - ( - release: (exit: Exit.Exit) => Effect - ): (acquire: Effect) => Effect - ( - acquire: Effect, - release: (exit: Exit.Exit) => Effect - ): Effect -} -``` - -Added in v2.0.0 - -## acquireUseRelease - -This function is used to ensure that an `Effect` value that represents the -acquisition of a resource (for example, opening a file, launching a thread, -etc.) will not be interrupted, and that the resource will always be released -when the `Effect` value completes execution. - -`acquireUseRelease` does the following: - -1. Ensures that the `Effect` value that acquires the resource will not be - interrupted. Note that acquisition may still fail due to internal - reasons (such as an uncaught exception). -2. Ensures that the `release` `Effect` value will not be interrupted, - and will be executed as long as the acquisition `Effect` value - successfully acquires the resource. - -During the time period between the acquisition and release of the resource, -the `use` `Effect` value will be executed. - -If the `release` `Effect` value fails, then the entire `Effect` value will -fail, even if the `use` `Effect` value succeeds. If this fail-fast behavior -is not desired, errors produced by the `release` `Effect` value can be caught -and ignored. - -**Signature** - -```ts -export declare const acquireUseRelease: { - ( - use: (a: A) => Effect, - release: (a: A, exit: Exit.Exit) => Effect - ): (acquire: Effect) => Effect - ( - acquire: Effect, - use: (a: A) => Effect, - release: (a: A, exit: Exit.Exit) => Effect - ): Effect -} -``` - -Added in v2.0.0 - -## addFinalizer - -This function adds a finalizer to the scope of the calling `Effect` value. -The finalizer is guaranteed to be run when the scope is closed, and it may -depend on the `Exit` value that the scope is closed with. - -**Signature** - -```ts -export declare const addFinalizer: ( - finalizer: (exit: Exit.Exit) => Effect -) => Effect -``` - -Added in v2.0.0 - -## ensuring - -Returns an effect that, if this effect _starts_ execution, then the -specified `finalizer` is guaranteed to be executed, whether this effect -succeeds, fails, or is interrupted. - -For use cases that need access to the effect's result, see `onExit`. - -Finalizers offer very powerful guarantees, but they are low-level, and -should generally not be used for releasing resources. For higher-level -logic built on `ensuring`, see the `acquireRelease` family of methods. - -**Signature** - -```ts -export declare const ensuring: { - (finalizer: Effect): (self: Effect) => Effect - (self: Effect, finalizer: Effect): Effect -} -``` - -Added in v2.0.0 - -## finalizersMask - -**Signature** - -```ts -export declare const finalizersMask: ( - strategy: ExecutionStrategy -) => ( - self: (restore: (self: Effect) => Effect) => Effect -) => Effect -``` - -Added in v2.0.0 - -## onError - -Runs the specified effect if this effect fails, providing the error to the -effect if it exists. The provided effect will not be interrupted. - -**Signature** - -```ts -export declare const onError: { - ( - cleanup: (cause: Cause.Cause) => Effect - ): (self: Effect) => Effect - ( - self: Effect, - cleanup: (cause: Cause.Cause) => Effect - ): Effect -} -``` - -Added in v2.0.0 - -## onExit - -Ensures that a cleanup functions runs, whether this effect succeeds, fails, -or is interrupted. - -**Signature** - -```ts -export declare const onExit: { - ( - cleanup: (exit: Exit.Exit) => Effect - ): (self: Effect) => Effect - ( - self: Effect, - cleanup: (exit: Exit.Exit) => Effect - ): Effect -} -``` - -Added in v2.0.0 - -## parallelFinalizers - -**Signature** - -```ts -export declare const parallelFinalizers: (self: Effect) => Effect -``` - -Added in v2.0.0 - -## scope - -**Signature** - -```ts -export declare const scope: Effect -``` - -Added in v2.0.0 - -## scopeWith - -Accesses the current scope and uses it to perform the specified effect. - -**Signature** - -```ts -export declare const scopeWith: (f: (scope: Scope.Scope) => Effect) => Effect -``` - -Added in v2.0.0 - -## scoped - -Scopes all resources uses in this workflow to the lifetime of the workflow, -ensuring that their finalizers are run as soon as this workflow completes -execution, whether by success, failure, or interruption. - -**Signature** - -```ts -export declare const scoped: (effect: Effect) => Effect, E, A> -``` - -Added in v2.0.0 - -## sequentialFinalizers - -Returns a new scoped workflow that runs finalizers added to the scope of -this workflow sequentially in the reverse of the order in which they were -added. Note that finalizers are run sequentially by default so this only -has meaning if used within a scope where finalizers are being run in -parallel. - -**Signature** - -```ts -export declare const sequentialFinalizers: (self: Effect) => Effect -``` - -Added in v2.0.0 - -## using - -Scopes all resources acquired by `resource` to the lifetime of `use` -without effecting the scope of any resources acquired by `use`. - -**Signature** - -```ts -export declare const using: { - ( - use: (a: A) => Effect - ): (self: Effect) => Effect, E2 | E, A2> - ( - self: Effect, - use: (a: A) => Effect - ): Effect, E | E2, A2> -} -``` - -Added in v2.0.0 - -## withEarlyRelease - -Returns a new scoped workflow that returns the result of this workflow as -well as a finalizer that can be run to close the scope of this workflow. - -**Signature** - -```ts -export declare const withEarlyRelease: ( - self: Effect -) => Effect, A]> -``` - -Added in v2.0.0 - -# semaphore - -## Permit (interface) - -**Signature** - -```ts -export interface Permit { - readonly index: number -} -``` - -Added in v2.0.0 - -## Semaphore (interface) - -**Signature** - -```ts -export interface Semaphore { - readonly withPermits: (permits: number) => (self: Effect) => Effect - readonly take: (permits: number) => Effect - readonly release: (permits: number) => Effect -} -``` - -Added in v2.0.0 - -## makeSemaphore - -Creates a new Semaphore - -**Signature** - -```ts -export declare const makeSemaphore: (permits: number) => Effect -``` - -Added in v2.0.0 - -## unsafeMakeSemaphore - -Unsafely creates a new Semaphore - -**Signature** - -```ts -export declare const unsafeMakeSemaphore: (permits: number) => Semaphore -``` - -Added in v2.0.0 - -# sequencing - -## flatMap - -This function is a pipeable operator that maps over an `Effect` value, -flattening the result of the mapping function into a new `Effect` value. - -**Signature** - -```ts -export declare const flatMap: { - (f: (a: A) => Effect): (self: Effect) => Effect - (self: Effect, f: (a: A) => Effect): Effect -} -``` - -Added in v2.0.0 - -## flatten - -**Signature** - -```ts -export declare const flatten: (self: Effect>) => Effect -``` - -Added in v2.0.0 - -## race - -Returns an effect that races this effect with the specified effect, -returning the first successful `A` from the faster side. If one effect -succeeds, the other will be interrupted. If neither succeeds, then the -effect will fail with some error. - -**Signature** - -```ts -export declare const race: { - (that: Effect): (self: Effect) => Effect - (self: Effect, that: Effect): Effect -} -``` - -Added in v2.0.0 - -## raceAll - -Returns an effect that races this effect with all the specified effects, -yielding the value of the first effect to succeed with a value. Losers of -the race will be interrupted immediately - -**Signature** - -```ts -export declare const raceAll: (effects: Iterable>) => Effect -``` - -Added in v2.0.0 - -## raceFirst - -Returns an effect that races this effect with the specified effect, -yielding the first result to complete, whether by success or failure. If -neither effect completes, then the composed effect will not complete. - -WARNING: The raced effect will safely interrupt the "loser", but will not -resume until the loser has been cleanly terminated. If early return is -desired, then instead of performing `l raceFirst r`, perform -`l.disconnect raceFirst r.disconnect`, which disconnects left and right -interrupt signal, allowing a fast return, with interruption performed -in the background. - -**Signature** - -```ts -export declare const raceFirst: { - (that: Effect): (self: Effect) => Effect - (self: Effect, that: Effect): Effect -} -``` - -Added in v2.0.0 - -## raceWith - -Returns an effect that races this effect with the specified effect, calling -the specified finisher as soon as one result or the other has been computed. - -**Signature** - -```ts -export declare const raceWith: { - ( - other: Effect, - options: { - readonly onSelfDone: (exit: Exit.Exit, fiber: Fiber.Fiber) => Effect - readonly onOtherDone: (exit: Exit.Exit, fiber: Fiber.Fiber) => Effect - } - ): (self: Effect) => Effect - ( - self: Effect, - other: Effect, - options: { - readonly onSelfDone: (exit: Exit.Exit, fiber: Fiber.Fiber) => Effect - readonly onOtherDone: (exit: Exit.Exit, fiber: Fiber.Fiber) => Effect - } - ): Effect -} -``` - -Added in v2.0.0 - -## summarized - -Summarizes a effect by computing some value before and after execution, and -then combining the values to produce a summary, together with the result of -execution. - -**Signature** - -```ts -export declare const summarized: { - ( - summary: Effect, - f: (start: B, end: B) => C - ): (self: Effect) => Effect - ( - self: Effect, - summary: Effect, - f: (start: B, end: B) => C - ): Effect -} -``` - -Added in v2.0.0 - -## tap - -**Signature** - -```ts -export declare const tap: { - ( - f: (a: X) => Effect - ): (self: Effect) => Effect - (self: Effect, f: (a: X) => Effect): Effect -} -``` - -Added in v2.0.0 - -## tapBoth - -Returns an effect that effectfully "peeks" at the failure or success of -this effect. - -**Signature** - -```ts -export declare const tapBoth: { - (options: { - readonly onFailure: (e: XE) => Effect - readonly onSuccess: (a: XA) => Effect - }): (self: Effect) => Effect - ( - self: Effect, - options: { readonly onFailure: (e: XE) => Effect; readonly onSuccess: (a: XA) => Effect } - ): Effect -} -``` - -Added in v2.0.0 - -## tapDefect - -Returns an effect that effectually "peeks" at the defect of this effect. - -**Signature** - -```ts -export declare const tapDefect: { - ( - f: (cause: Cause.Cause) => Effect - ): (self: Effect) => Effect - ( - self: Effect, - f: (cause: Cause.Cause) => Effect - ): Effect -} -``` - -Added in v2.0.0 - -## tapError - -Returns an effect that effectfully "peeks" at the failure of this effect. - -**Signature** - -```ts -export declare const tapError: { - ( - f: (e: XE) => Effect - ): (self: Effect) => Effect - (self: Effect, f: (e: XE) => Effect): Effect -} -``` - -Added in v2.0.0 - -## tapErrorCause - -Returns an effect that effectually "peeks" at the cause of the failure of -this effect. - -**Signature** - -```ts -export declare const tapErrorCause: { - ( - f: (cause: Cause.Cause) => Effect - ): (self: Effect) => Effect - ( - self: Effect, - f: (cause: Cause.Cause) => Effect - ): Effect -} -``` - -Added in v2.0.0 - -## tapErrorTag - -Returns an effect that effectfully "peeks" at the specific tagged failure of this effect. - -**Signature** - -```ts -export declare const tapErrorTag: { - ( - k: K, - f: (e: Extract) => Effect - ): (self: Effect) => Effect - ( - self: Effect, - k: K, - f: (e: Extract) => Effect - ): Effect -} -``` - -Added in v2.0.0 - -# supervision & fibers - -## awaitAllChildren - -Returns a new effect that will not succeed with its value before first -waiting for the end of all child fibers forked by the effect. - -**Signature** - -```ts -export declare const awaitAllChildren: (self: Effect) => Effect -``` - -Added in v2.0.0 - -## daemonChildren - -Returns a new workflow that will not supervise any fibers forked by this -workflow. - -**Signature** - -```ts -export declare const daemonChildren: (self: Effect) => Effect -``` - -Added in v2.0.0 - -## descriptor - -Constructs an effect with information about the current `Fiber`. - -**Signature** - -```ts -export declare const descriptor: Effect -``` - -Added in v2.0.0 - -## descriptorWith - -Constructs an effect based on information about the current `Fiber`. - -**Signature** - -```ts -export declare const descriptorWith: ( - f: (descriptor: Fiber.Fiber.Descriptor) => Effect -) => Effect -``` - -Added in v2.0.0 - -## diffFiberRefs - -Returns a new workflow that executes this one and captures the changes in -`FiberRef` values. - -**Signature** - -```ts -export declare const diffFiberRefs: (self: Effect) => Effect -``` - -Added in v2.0.0 - -## ensuringChild - -Acts on the children of this fiber (collected into a single fiber), -guaranteeing the specified callback will be invoked, whether or not this -effect succeeds. - -**Signature** - -```ts -export declare const ensuringChild: { - ( - f: (fiber: Fiber.Fiber>) => Effect - ): (self: Effect) => Effect - ( - self: Effect, - f: (fiber: Fiber.Fiber>) => Effect - ): Effect -} -``` - -Added in v2.0.0 - -## ensuringChildren - -Acts on the children of this fiber, guaranteeing the specified callback -will be invoked, whether or not this effect succeeds. - -**Signature** - -```ts -export declare const ensuringChildren: { - ( - children: (fibers: ReadonlyArray>) => Effect - ): (self: Effect) => Effect - ( - self: Effect, - children: (fibers: ReadonlyArray>) => Effect - ): Effect -} -``` - -Added in v2.0.0 - -## fiberId - -**Signature** - -```ts -export declare const fiberId: Effect -``` - -Added in v2.0.0 - -## fiberIdWith - -**Signature** - -```ts -export declare const fiberIdWith: (f: (descriptor: FiberId.Runtime) => Effect) => Effect -``` - -Added in v2.0.0 - -## fork - -Returns an effect that forks this effect into its own separate fiber, -returning the fiber immediately, without waiting for it to begin executing -the effect. - -You can use the `fork` method whenever you want to execute an effect in a -new fiber, concurrently and without "blocking" the fiber executing other -effects. Using fibers can be tricky, so instead of using this method -directly, consider other higher-level methods, such as `raceWith`, -`zipPar`, and so forth. - -The fiber returned by this method has methods to interrupt the fiber and to -wait for it to finish executing the effect. See `Fiber` for more -information. - -Whenever you use this method to launch a new fiber, the new fiber is -attached to the parent fiber's scope. This means when the parent fiber -terminates, the child fiber will be terminated as well, ensuring that no -fibers leak. This behavior is called "auto supervision", and if this -behavior is not desired, you may use the `forkDaemon` or `forkIn` methods. - -**Signature** - -```ts -export declare const fork: (self: Effect) => Effect> -``` - -Added in v2.0.0 - -## forkAll - -Returns an effect that forks all of the specified values, and returns a -composite fiber that produces a list of their results, in order. - -**Signature** - -```ts -export declare const forkAll: { - (options?: { - readonly discard?: false | undefined - }): (effects: Iterable>) => Effect> - (options: { readonly discard: true }): (effects: Iterable>) => Effect - ( - effects: Iterable>, - options?: { readonly discard?: false | undefined } - ): Effect> - (effects: Iterable>, options: { readonly discard: true }): Effect -} -``` - -Added in v2.0.0 - -## forkDaemon - -Forks the effect into a new fiber attached to the global scope. Because the -new fiber is attached to the global scope, when the fiber executing the -returned effect terminates, the forked fiber will continue running. - -**Signature** - -```ts -export declare const forkDaemon: (self: Effect) => Effect> -``` - -Added in v2.0.0 - -## forkIn - -Forks the effect in the specified scope. The fiber will be interrupted -when the scope is closed. - -**Signature** - -```ts -export declare const forkIn: { - (scope: Scope.Scope): (self: Effect) => Effect> - (self: Effect, scope: Scope.Scope): Effect> -} -``` - -Added in v2.0.0 - -## forkScoped - -Forks the fiber in a `Scope`, interrupting it when the scope is closed. - -**Signature** - -```ts -export declare const forkScoped: ( - self: Effect -) => Effect> -``` - -Added in v2.0.0 - -## forkWithErrorHandler - -Like fork but handles an error with the provided handler. - -**Signature** - -```ts -export declare const forkWithErrorHandler: { - ( - handler: (e: E) => Effect - ): (self: Effect) => Effect> - ( - self: Effect, - handler: (e: E) => Effect - ): Effect> -} -``` - -Added in v2.0.0 - -## fromFiber - -Creates an `Effect` value that represents the exit value of the specified -fiber. - -**Signature** - -```ts -export declare const fromFiber: (fiber: Fiber.Fiber) => Effect -``` - -Added in v2.0.0 - -## fromFiberEffect - -Creates an `Effect` value that represents the exit value of the specified -fiber. - -**Signature** - -```ts -export declare const fromFiberEffect: (fiber: Effect>) => Effect -``` - -Added in v2.0.0 - -## supervised - -Returns an effect with the behavior of this one, but where all child fibers -forked in the effect are reported to the specified supervisor. - -**Signature** - -```ts -export declare const supervised: { - (supervisor: Supervisor.Supervisor): (self: Effect) => Effect - (self: Effect, supervisor: Supervisor.Supervisor): Effect -} -``` - -Added in v2.0.0 - -## transplant - -Transplants specified effects so that when those effects fork other -effects, the forked effects will be governed by the scope of the fiber that -executes this effect. - -This can be used to "graft" deep grandchildren onto a higher-level scope, -effectively extending their lifespans into the parent scope. - -**Signature** - -```ts -export declare const transplant: ( - f: (grafter: (effect: Effect) => Effect) => Effect -) => Effect -``` - -Added in v2.0.0 - -## withConcurrency - -**Signature** - -```ts -export declare const withConcurrency: { - (concurrency: number | "unbounded"): (self: Effect) => Effect - (self: Effect, concurrency: number | "unbounded"): Effect -} -``` - -Added in v2.0.0 - -# symbols - -## EffectTypeId - -**Signature** - -```ts -export declare const EffectTypeId: typeof EffectTypeId -``` - -Added in v2.0.0 - -## EffectTypeId (type alias) - -**Signature** - -```ts -export type EffectTypeId = typeof EffectTypeId -``` - -Added in v2.0.0 - -# tracing - -## annotateCurrentSpan - -Adds an annotation to the current span if available - -**Signature** - -```ts -export declare const annotateCurrentSpan: { - (key: string, value: unknown): Effect - (values: Record): Effect -} -``` - -Added in v2.0.0 - -## annotateSpans - -Adds an annotation to each span in this effect. - -**Signature** - -```ts -export declare const annotateSpans: { - (key: string, value: unknown): (effect: Effect) => Effect - (values: Record): (effect: Effect) => Effect - (effect: Effect, key: string, value: unknown): Effect - (effect: Effect, values: Record): Effect -} -``` - -Added in v2.0.0 - -## currentParentSpan - -**Signature** - -```ts -export declare const currentParentSpan: Effect> -``` - -Added in v2.0.0 - -## currentSpan - -**Signature** - -```ts -export declare const currentSpan: Effect> -``` - -Added in v2.0.0 - -## linkSpans - -For all spans in this effect, add a link with the provided span. - -**Signature** - -```ts -export declare const linkSpans: { - (span: Tracer.ParentSpan, attributes?: Record): (self: Effect) => Effect - (self: Effect, span: Tracer.ParentSpan, attributes?: Record): Effect -} -``` - -Added in v2.0.0 - -## makeSpan - -Create a new span for tracing. - -**Signature** - -```ts -export declare const makeSpan: ( - name: string, - options?: { - readonly attributes?: Record | undefined - readonly links?: ReadonlyArray | undefined - readonly parent?: Tracer.ParentSpan | undefined - readonly root?: boolean | undefined - readonly context?: Context.Context | undefined - } -) => Effect -``` - -Added in v2.0.0 - -## makeSpanScoped - -Create a new span for tracing, and automatically close it when the Scope -finalizes. - -The span is not added to the current span stack, so no child spans will be -created for it. - -**Signature** - -```ts -export declare const makeSpanScoped: ( - name: string, - options?: { - readonly attributes?: Record | undefined - readonly links?: ReadonlyArray | undefined - readonly parent?: Tracer.ParentSpan | undefined - readonly root?: boolean | undefined - readonly context?: Context.Context | undefined - } -) => Effect -``` - -Added in v2.0.0 - -## spanAnnotations - -**Signature** - -```ts -export declare const spanAnnotations: Effect> -``` - -Added in v2.0.0 - -## spanLinks - -**Signature** - -```ts -export declare const spanLinks: Effect> -``` - -Added in v2.0.0 - -## tracer - -**Signature** - -```ts -export declare const tracer: Effect -``` - -Added in v2.0.0 - -## tracerWith - -**Signature** - -```ts -export declare const tracerWith: (f: (tracer: Tracer.Tracer) => Effect) => Effect -``` - -Added in v2.0.0 - -## useSpan - -Create a new span for tracing, and automatically close it when the effect -completes. - -The span is not added to the current span stack, so no child spans will be -created for it. - -**Signature** - -```ts -export declare const useSpan: { - (name: string, evaluate: (span: Tracer.Span) => Effect): Effect - ( - name: string, - options: { - readonly attributes?: Record | undefined - readonly links?: ReadonlyArray | undefined - readonly parent?: Tracer.ParentSpan | undefined - readonly root?: boolean | undefined - readonly context?: Context.Context | undefined - }, - evaluate: (span: Tracer.Span) => Effect - ): Effect -} -``` - -Added in v2.0.0 - -## withParentSpan - -Adds the provided span to the current span stack. - -**Signature** - -```ts -export declare const withParentSpan: { - (span: Tracer.ParentSpan): (self: Effect) => Effect, E, A> - (self: Effect, span: Tracer.ParentSpan): Effect, E, A> -} -``` - -Added in v2.0.0 - -## withSpan - -Wraps the effect with a new span for tracing. - -**Signature** - -```ts -export declare const withSpan: { - ( - name: string, - options?: { - readonly attributes?: Record | undefined - readonly links?: ReadonlyArray | undefined - readonly parent?: Tracer.ParentSpan | undefined - readonly root?: boolean | undefined - readonly context?: Context.Context | undefined - } - ): (self: Effect) => Effect, E, A> - ( - self: Effect, - name: string, - options?: { - readonly attributes?: Record | undefined - readonly links?: ReadonlyArray | undefined - readonly parent?: Tracer.ParentSpan | undefined - readonly root?: boolean | undefined - readonly context?: Context.Context | undefined - } - ): Effect, E, A> -} -``` - -Added in v2.0.0 - -## withSpanScoped - -Wraps the effect with a new span for tracing. - -The span is ended when the Scope is finalized. - -**Signature** - -```ts -export declare const withSpanScoped: { - ( - name: string, - options?: { - readonly attributes?: Record | undefined - readonly links?: ReadonlyArray | undefined - readonly parent?: Tracer.ParentSpan | undefined - readonly root?: boolean | undefined - readonly context?: Context.Context | undefined - } - ): (self: Effect) => Effect, E, A> - ( - self: Effect, - name: string, - options?: { - readonly attributes?: Record | undefined - readonly links?: ReadonlyArray | undefined - readonly parent?: Tracer.ParentSpan | undefined - readonly root?: boolean | undefined - readonly context?: Context.Context | undefined - } - ): Effect, E, A> -} -``` - -Added in v2.0.0 - -## withTracer - -**Signature** - -```ts -export declare const withTracer: { - (value: Tracer.Tracer): (effect: Effect) => Effect - (effect: Effect, value: Tracer.Tracer): Effect -} -``` - -Added in v2.0.0 - -## withTracerScoped - -**Signature** - -```ts -export declare const withTracerScoped: (value: Tracer.Tracer) => Effect -``` - -Added in v2.0.0 - -## withTracerTiming - -**Signature** - -```ts -export declare const withTracerTiming: { - (enabled: boolean): (effect: Effect) => Effect - (effect: Effect, enabled: boolean): Effect -} -``` - -Added in v2.0.0 - -# type lambdas - -## EffectTypeLambda (interface) - -**Signature** - -```ts -export interface EffectTypeLambda extends TypeLambda { - readonly type: Effect -} -``` - -Added in v2.0.0 - -# unify - -## unified - -Used to unify effects that would otherwise be `Effect | Effect` - -**Signature** - -```ts -export declare const unified: >(f: Ret) => Effect.Unify -``` - -Added in v2.0.0 - -## unifiedFn - -Used to unify functions that would otherwise return `Effect | Effect` - -**Signature** - -```ts -export declare const unifiedFn: >( - f: (...args: Args) => Ret -) => (...args: Args) => Effect.Unify -``` - -Added in v2.0.0 - -# utils - -## All (namespace) - -Added in v2.0.0 - -### EffectAny (type alias) - -**Signature** - -```ts -export type EffectAny = Effect -``` - -Added in v2.0.0 - -### ExtractMode (type alias) - -**Signature** - -```ts -export type ExtractMode = [A] extends [{ mode: infer M }] ? M : "default" -``` - -Added in v2.0.0 - -### IsDiscard (type alias) - -**Signature** - -```ts -export type IsDiscard = [Extract] extends [never] ? false : true -``` - -Added in v2.0.0 - -### Return (type alias) - -**Signature** - -```ts -export type Return< - Arg extends Iterable | Record, - O extends { - readonly concurrency?: Concurrency | undefined - readonly batching?: boolean | "inherit" | undefined - readonly discard?: boolean | undefined - readonly mode?: "default" | "validate" | "either" | undefined - } -> = [Arg] extends [ReadonlyArray] - ? ReturnTuple, ExtractMode> - : [Arg] extends [Iterable] - ? ReturnIterable, ExtractMode> - : [Arg] extends [Record] - ? ReturnObject, ExtractMode> - : never -``` - -Added in v2.0.0 - -### ReturnIterable (type alias) - -**Signature** - -```ts -export type ReturnIterable, Discard extends boolean, Mode> = [T] extends [ - Iterable> -] - ? Effect< - R, - Mode extends "either" ? never : Mode extends "validate" ? Array> : E, - Discard extends true ? void : Mode extends "either" ? Array> : Array - > - : never -``` - -Added in v2.0.0 - -### ReturnObject (type alias) - -**Signature** - -```ts -export type ReturnObject = [T] extends [{ [K: string]: EffectAny }] - ? Effect< - keyof T extends never - ? never - : [T[keyof T]] extends [{ [EffectTypeId]: { _R: (_: never) => infer R } }] - ? R - : never, - Mode extends "either" - ? never - : keyof T extends never - ? never - : Mode extends "validate" - ? { - -readonly [K in keyof T]: [T[K]] extends [Effect.Variance] - ? Option.Option<_E> - : never - } - : [T[keyof T]] extends [{ [EffectTypeId]: { _E: (_: never) => infer E } }] - ? E - : never, - Discard extends true - ? void - : Mode extends "either" - ? { - -readonly [K in keyof T]: [T[K]] extends [Effect.Variance] - ? Either.Either<_E, _A> - : never - } - : { -readonly [K in keyof T]: [T[K]] extends [Effect.Variance] ? _A : never } - > - : never -``` - -Added in v2.0.0 - -### ReturnTuple (type alias) - -**Signature** - -```ts -export type ReturnTuple, Discard extends boolean, Mode> = Effect< - T[number] extends never ? never : [T[number]] extends [{ [EffectTypeId]: { _R: (_: never) => infer R } }] ? R : never, - Mode extends "either" - ? never - : T[number] extends never - ? never - : Mode extends "validate" - ? { - -readonly [K in keyof T]: [T[K]] extends [Effect.Variance] - ? Option.Option<_E> - : never - } - : [T[number]] extends [{ [EffectTypeId]: { _E: (_: never) => infer E } }] - ? E - : never, - Discard extends true - ? void - : T[number] extends never - ? [] - : Mode extends "either" - ? { - -readonly [K in keyof T]: [T[K]] extends [Effect.Variance] - ? Either.Either<_E, _A> - : never - } - : { -readonly [K in keyof T]: [T[K]] extends [Effect.Variance] ? _A : never } -> extends infer X - ? X - : never -``` - -Added in v2.0.0 - -## Effect (namespace) - -Added in v2.0.0 - -### Variance (interface) - -**Signature** - -```ts -export interface Variance { - readonly [EffectTypeId]: VarianceStruct -} -``` - -Added in v2.0.0 - -### VarianceStruct (interface) - -**Signature** - -```ts -export interface VarianceStruct { - readonly _V: string - readonly _R: (_: never) => R - readonly _E: (_: never) => E - readonly _A: (_: never) => A -} -``` - -Added in v2.0.0 - -### Context (type alias) - -**Signature** - -```ts -export type Context> = [T] extends [Effect] ? _R : never -``` - -Added in v2.0.0 - -### Error (type alias) - -**Signature** - -```ts -export type Error> = [T] extends [Effect] ? _E : never -``` - -Added in v2.0.0 - -### Success (type alias) - -**Signature** - -```ts -export type Success> = [T] extends [Effect] ? _A : never -``` - -Added in v2.0.0 - -### Unify (type alias) - -**Signature** - -```ts -export type Unify> = Effect, Error, Success> -``` - -Added in v2.0.0 - -## MergeRecord (type alias) - -**Signature** - -```ts -export type MergeRecord = { - [k in keyof K | keyof H]: k extends keyof K ? K[k] : k extends keyof H ? H[k] : never -} extends infer X - ? X - : never -``` - -Added in v2.0.0 - -## withMaxOpsBeforeYield - -Sets the maximum number of operations before yield by the default schedulers - -**Signature** - -```ts -export declare const withMaxOpsBeforeYield: { - (priority: number): (self: Effect) => Effect - (self: Effect, priority: number): Effect -} -``` - -Added in v2.0.0 - -## withSchedulingPriority - -Sets the scheduling priority used when yielding - -**Signature** - -```ts -export declare const withSchedulingPriority: { - (priority: number): (self: Effect) => Effect - (self: Effect, priority: number): Effect -} -``` - -Added in v2.0.0 - -# zipping - -## validate - -Sequentially zips the this result with the specified result. Combines both -`Cause`s when both effects fail. - -**Signature** - -```ts -export declare const validate: { - ( - that: Effect, - options?: { readonly concurrent?: boolean | undefined; readonly batching?: boolean | "inherit" | undefined } - ): (self: Effect) => Effect - ( - self: Effect, - that: Effect, - options?: { readonly concurrent?: boolean | undefined; readonly batching?: boolean | "inherit" | undefined } - ): Effect -} -``` - -Added in v2.0.0 - -## validateWith - -Sequentially zips this effect with the specified effect using the specified -combiner function. Combines the causes in case both effect fail. - -**Signature** - -```ts -export declare const validateWith: { - ( - that: Effect, - f: (a: A, b: B) => C, - options?: { readonly concurrent?: boolean | undefined; readonly batching?: boolean | "inherit" | undefined } - ): (self: Effect) => Effect - ( - self: Effect, - that: Effect, - f: (a: A, b: B) => C, - options?: { readonly concurrent?: boolean | undefined; readonly batching?: boolean | "inherit" | undefined } - ): Effect -} -``` - -Added in v2.0.0 - -## zip - -**Signature** - -```ts -export declare const zip: { - ( - that: Effect, - options?: { readonly concurrent?: boolean | undefined; readonly batching?: boolean | "inherit" | undefined } - ): (self: Effect) => Effect - ( - self: Effect, - that: Effect, - options?: { readonly concurrent?: boolean | undefined; readonly batching?: boolean | "inherit" | undefined } - ): Effect -} -``` - -Added in v2.0.0 - -## zipLeft - -**Signature** - -```ts -export declare const zipLeft: { - ( - that: Effect, - options?: { readonly concurrent?: boolean | undefined; readonly batching?: boolean | "inherit" | undefined } - ): (self: Effect) => Effect - ( - self: Effect, - that: Effect, - options?: { readonly concurrent?: boolean | undefined; readonly batching?: boolean | "inherit" | undefined } - ): Effect -} -``` - -Added in v2.0.0 - -## zipRight - -**Signature** - -```ts -export declare const zipRight: { - ( - that: Effect, - options?: { readonly concurrent?: boolean | undefined; readonly batching?: boolean | "inherit" | undefined } - ): (self: Effect) => Effect - ( - self: Effect, - that: Effect, - options?: { readonly concurrent?: boolean | undefined; readonly batching?: boolean | "inherit" | undefined } - ): Effect -} -``` - -Added in v2.0.0 - -## zipWith - -**Signature** - -```ts -export declare const zipWith: { - ( - that: Effect, - f: (a: A, b: A2) => B, - options?: { readonly concurrent?: boolean | undefined; readonly batching?: boolean | "inherit" | undefined } - ): (self: Effect) => Effect - ( - self: Effect, - that: Effect, - f: (a: A, b: A2) => B, - options?: { readonly concurrent?: boolean | undefined; readonly batching?: boolean | "inherit" | undefined } - ): Effect -} -``` - -Added in v2.0.0 diff --git a/docs/modules/Effectable.ts.md b/docs/modules/Effectable.ts.md deleted file mode 100644 index d69ae5324..000000000 --- a/docs/modules/Effectable.ts.md +++ /dev/null @@ -1,206 +0,0 @@ ---- -title: Effectable.ts -nav_order: 24 -parent: Modules ---- - -## Effectable overview - -Added in v2.0.0 - ---- - -

Table of contents

- -- [constructors](#constructors) - - [Class (class)](#class-class) - - [commit (method)](#commit-method) - - [StructuralClass (class)](#structuralclass-class) - - [commit (method)](#commit-method-1) -- [models](#models) - - [CommitPrimitive (interface)](#commitprimitive-interface) -- [prototypes](#prototypes) - - [CommitPrototype](#commitprototype) - - [EffectPrototype](#effectprototype) - - [StructuralCommitPrototype](#structuralcommitprototype) -- [type ids](#type-ids) - - [ChannelTypeId](#channeltypeid) - - [ChannelTypeId (type alias)](#channeltypeid-type-alias) - - [EffectTypeId](#effecttypeid) - - [EffectTypeId (type alias)](#effecttypeid-type-alias) - - [SinkTypeId](#sinktypeid) - - [SinkTypeId (type alias)](#sinktypeid-type-alias) - - [StreamTypeId](#streamtypeid) - - [StreamTypeId (type alias)](#streamtypeid-type-alias) - ---- - -# constructors - -## Class (class) - -**Signature** - -```ts -export declare class Class -``` - -Added in v2.0.0 - -### commit (method) - -**Signature** - -```ts -abstract commit(): Effect.Effect -``` - -Added in v2.0.0 - -## StructuralClass (class) - -**Signature** - -```ts -export declare class StructuralClass -``` - -Added in v2.0.0 - -### commit (method) - -**Signature** - -```ts -abstract commit(): Effect.Effect -``` - -Added in v2.0.0 - -# models - -## CommitPrimitive (interface) - -**Signature** - -```ts -export interface CommitPrimitive { - new (): Effect.Effect -} -``` - -Added in v2.0.0 - -# prototypes - -## CommitPrototype - -**Signature** - -```ts -export declare const CommitPrototype: Effect.Effect -``` - -Added in v2.0.0 - -## EffectPrototype - -**Signature** - -```ts -export declare const EffectPrototype: Effect.Effect -``` - -Added in v2.0.0 - -## StructuralCommitPrototype - -**Signature** - -```ts -export declare const StructuralCommitPrototype: Effect.Effect -``` - -Added in v2.0.0 - -# type ids - -## ChannelTypeId - -**Signature** - -```ts -export declare const ChannelTypeId: typeof Channel.ChannelTypeId -``` - -Added in v2.0.0 - -## ChannelTypeId (type alias) - -**Signature** - -```ts -export type ChannelTypeId = Channel.ChannelTypeId -``` - -Added in v2.0.0 - -## EffectTypeId - -**Signature** - -```ts -export declare const EffectTypeId: typeof Effect.EffectTypeId -``` - -Added in v2.0.0 - -## EffectTypeId (type alias) - -**Signature** - -```ts -export type EffectTypeId = Effect.EffectTypeId -``` - -Added in v2.0.0 - -## SinkTypeId - -**Signature** - -```ts -export declare const SinkTypeId: typeof Sink.SinkTypeId -``` - -Added in v2.0.0 - -## SinkTypeId (type alias) - -**Signature** - -```ts -export type SinkTypeId = Sink.SinkTypeId -``` - -Added in v2.0.0 - -## StreamTypeId - -**Signature** - -```ts -export declare const StreamTypeId: typeof Stream.StreamTypeId -``` - -Added in v2.0.0 - -## StreamTypeId (type alias) - -**Signature** - -```ts -export type StreamTypeId = Stream.StreamTypeId -``` - -Added in v2.0.0 diff --git a/docs/modules/Either.ts.md b/docs/modules/Either.ts.md deleted file mode 100644 index 91f22b4ba..000000000 --- a/docs/modules/Either.ts.md +++ /dev/null @@ -1,746 +0,0 @@ ---- -title: Either.ts -nav_order: 25 -parent: Modules ---- - -## Either overview - -Added in v2.0.0 - ---- - -

Table of contents

- -- [combining](#combining) - - [all](#all) - - [ap](#ap) - - [flatMap](#flatmap) - - [zipWith](#zipwith) -- [constructors](#constructors) - - [fromNullable](#fromnullable) - - [fromOption](#fromoption) - - [left](#left) - - [right](#right) - - [try](#try) -- [equivalence](#equivalence) - - [getEquivalence](#getequivalence) -- [error handling](#error-handling) - - [orElse](#orelse) -- [generators](#generators) - - [gen](#gen) -- [getters](#getters) - - [getLeft](#getleft) - - [getOrElse](#getorelse) - - [getOrNull](#getornull) - - [getOrThrow](#getorthrow) - - [getOrThrowWith](#getorthrowwith) - - [getOrUndefined](#getorundefined) - - [getRight](#getright) - - [merge](#merge) -- [guards](#guards) - - [isEither](#iseither) - - [isLeft](#isleft) - - [isRight](#isright) -- [mapping](#mapping) - - [flip](#flip) - - [map](#map) - - [mapBoth](#mapboth) - - [mapLeft](#mapleft) -- [models](#models) - - [Either (type alias)](#either-type-alias) - - [EitherUnify (interface)](#eitherunify-interface) - - [EitherUnifyIgnore (interface)](#eitherunifyignore-interface) - - [Left (interface)](#left-interface) - - [Right (interface)](#right-interface) -- [pattern matching](#pattern-matching) - - [match](#match) -- [symbols](#symbols) - - [TypeId](#typeid) - - [TypeId (type alias)](#typeid-type-alias) -- [type lambdas](#type-lambdas) - - [EitherTypeLambda (interface)](#eithertypelambda-interface) - ---- - -# combining - -## all - -Takes a structure of `Option`s and returns an `Option` of values with the same structure. - -- If a tuple is supplied, then the returned `Option` will contain a tuple with the same length. -- If a struct is supplied, then the returned `Option` will contain a struct with the same keys. -- If an iterable is supplied, then the returned `Option` will contain an array. - -**Signature** - -```ts -export declare const all: > | Record>>( - input: I -) => [I] extends [readonly Either[]] - ? Either< - I[number] extends never ? never : [I[number]] extends [Either] ? E : never, - { -readonly [K in keyof I]: [I[K]] extends [Either] ? A : never } - > - : [I] extends [Iterable>] - ? Either - : Either< - I[keyof I] extends never ? never : [I[keyof I]] extends [Either] ? E : never, - { -readonly [K in keyof I]: [I[K]] extends [Either] ? A : never } - > -``` - -**Example** - -```ts -import * as Either from "effect/Either" - -assert.deepStrictEqual(Either.all([Either.right(1), Either.right(2)]), Either.right([1, 2])) -assert.deepStrictEqual(Either.all({ a: Either.right(1), b: Either.right("hello") }), Either.right({ a: 1, b: "hello" })) -assert.deepStrictEqual(Either.all({ a: Either.right(1), b: Either.left("error") }), Either.left("error")) -``` - -Added in v2.0.0 - -## ap - -**Signature** - -```ts -export declare const ap: { - (that: Either): (self: Either B>) => Either - (self: Either B>, that: Either): Either -} -``` - -Added in v2.0.0 - -## flatMap - -**Signature** - -```ts -export declare const flatMap: { - (f: (a: A) => Either): (self: Either) => Either - (self: Either, f: (a: A) => Either): Either -} -``` - -Added in v2.0.0 - -## zipWith - -**Signature** - -```ts -export declare const zipWith: { - (that: Either, f: (a: A, b: A2) => B): (self: Either) => Either - (self: Either, that: Either, f: (a: A, b: A2) => B): Either -} -``` - -Added in v2.0.0 - -# constructors - -## fromNullable - -Takes a lazy default and a nullable value, if the value is not nully (`null` or `undefined`), turn it into a `Right`, if the value is nully use -the provided default as a `Left`. - -**Signature** - -```ts -export declare const fromNullable: { - (onNullable: (a: A) => E): (self: A) => Either> - (self: A, onNullable: (a: A) => E): Either> -} -``` - -**Example** - -```ts -import * as Either from "effect/Either" - -assert.deepStrictEqual( - Either.fromNullable(1, () => "fallback"), - Either.right(1) -) -assert.deepStrictEqual( - Either.fromNullable(null, () => "fallback"), - Either.left("fallback") -) -``` - -Added in v2.0.0 - -## fromOption - -**Signature** - -```ts -export declare const fromOption: { - (self: Option
, onNone: () => E): Either - (onNone: () => E): (self: Option) => Either -} -``` - -**Example** - -```ts -import * as Either from "effect/Either" -import * as Option from "effect/Option" - -assert.deepStrictEqual( - Either.fromOption(Option.some(1), () => "error"), - Either.right(1) -) -assert.deepStrictEqual( - Either.fromOption(Option.none(), () => "error"), - Either.left("error") -) -``` - -Added in v2.0.0 - -## left - -Constructs a new `Either` holding a `Left` value. This usually represents a failure, due to the right-bias of this -structure. - -**Signature** - -```ts -export declare const left: (e: E) => Either -``` - -Added in v2.0.0 - -## right - -Constructs a new `Either` holding a `Right` value. This usually represents a successful value due to the right bias -of this structure. - -**Signature** - -```ts -export declare const right: (a: A) => Either -``` - -Added in v2.0.0 - -## try - -Imports a synchronous side-effect into a pure `Either` value, translating any -thrown exceptions into typed failed eithers creating with `Either.left`. - -**Signature** - -```ts -export declare const try: { (options: { readonly try: LazyArg; readonly catch: (error: unknown) => E; }): Either; (evaluate: LazyArg): Either; } -``` - -Added in v2.0.0 - -# equivalence - -## getEquivalence - -**Signature** - -```ts -export declare const getEquivalence: ( - EE: Equivalence.Equivalence, - EA: Equivalence.Equivalence -) => Equivalence.Equivalence> -``` - -Added in v2.0.0 - -# error handling - -## orElse - -Returns `self` if it is a `Right` or `that` otherwise. - -**Signature** - -```ts -export declare const orElse: { - (that: (e1: E1) => Either): (self: Either) => Either - (self: Either, that: (e1: E1) => Either): Either -} -``` - -Added in v2.0.0 - -# generators - -## gen - -**Signature** - -```ts -export declare const gen: Gen.Gen> -``` - -Added in v2.0.0 - -# getters - -## getLeft - -Converts a `Either` to an `Option` discarding the value. - -**Signature** - -```ts -export declare const getLeft: (self: Either) => Option -``` - -**Example** - -```ts -import * as O from "effect/Option" -import * as E from "effect/Either" - -assert.deepStrictEqual(E.getLeft(E.right("ok")), O.none()) -assert.deepStrictEqual(E.getLeft(E.left("err")), O.some("err")) -``` - -Added in v2.0.0 - -## getOrElse - -Returns the wrapped value if it's a `Right` or a default value if is a `Left`. - -**Signature** - -```ts -export declare const getOrElse: { - (onLeft: (e: E) => B): (self: Either) => B | A - (self: Either, onLeft: (e: E) => B): A | B -} -``` - -**Example** - -```ts -import * as Either from "effect/Either" - -assert.deepStrictEqual( - Either.getOrElse(Either.right(1), (error) => error + "!"), - 1 -) -assert.deepStrictEqual( - Either.getOrElse(Either.left("not a number"), (error) => error + "!"), - "not a number!" -) -``` - -Added in v2.0.0 - -## getOrNull - -**Signature** - -```ts -export declare const getOrNull: (self: Either) => A | null -``` - -**Example** - -```ts -import * as Either from "effect/Either" - -assert.deepStrictEqual(Either.getOrNull(Either.right(1)), 1) -assert.deepStrictEqual(Either.getOrNull(Either.left("a")), null) -``` - -Added in v2.0.0 - -## getOrThrow - -Extracts the value of an `Either` or throws if the `Either` is `Left`. - -The thrown error is a default error. To configure the error thrown, see {@link getOrThrowWith}. - -**Signature** - -```ts -export declare const getOrThrow: (self: Either) => A -``` - -**Example** - -```ts -import * as E from "effect/Either" - -assert.deepStrictEqual(E.getOrThrow(E.right(1)), 1) -assert.throws(() => E.getOrThrow(E.left("error"))) -``` - -Added in v2.0.0 - -## getOrThrowWith - -Extracts the value of an `Either` or throws if the `Either` is `Left`. - -If a default error is sufficient for your use case and you don't need to configure the thrown error, see {@link getOrThrow}. - -**Signature** - -```ts -export declare const getOrThrowWith: { - (onLeft: (e: E) => unknown): (self: Either) => A - (self: Either, onLeft: (e: E) => unknown): A -} -``` - -**Example** - -```ts -import * as E from "effect/Either" - -assert.deepStrictEqual( - E.getOrThrowWith(E.right(1), () => new Error("Unexpected Left")), - 1 -) -assert.throws(() => E.getOrThrowWith(E.left("error"), () => new Error("Unexpected Left"))) -``` - -Added in v2.0.0 - -## getOrUndefined - -**Signature** - -```ts -export declare const getOrUndefined: (self: Either) => A | undefined -``` - -**Example** - -```ts -import * as Either from "effect/Either" - -assert.deepStrictEqual(Either.getOrUndefined(Either.right(1)), 1) -assert.deepStrictEqual(Either.getOrUndefined(Either.left("a")), undefined) -``` - -Added in v2.0.0 - -## getRight - -Converts a `Either` to an `Option` discarding the `Left`. - -Alias of {@link toOption}. - -**Signature** - -```ts -export declare const getRight: (self: Either) => Option -``` - -**Example** - -```ts -import * as O from "effect/Option" -import * as E from "effect/Either" - -assert.deepStrictEqual(E.getRight(E.right("ok")), O.some("ok")) -assert.deepStrictEqual(E.getRight(E.left("err")), O.none()) -``` - -Added in v2.0.0 - -## merge - -**Signature** - -```ts -export declare const merge: (self: Either) => E | A -``` - -Added in v2.0.0 - -# guards - -## isEither - -Tests if a value is a `Either`. - -**Signature** - -```ts -export declare const isEither: (input: unknown) => input is Either -``` - -**Example** - -```ts -import { isEither, left, right } from "effect/Either" - -assert.deepStrictEqual(isEither(right(1)), true) -assert.deepStrictEqual(isEither(left("a")), true) -assert.deepStrictEqual(isEither({ right: 1 }), false) -``` - -Added in v2.0.0 - -## isLeft - -Determine if a `Either` is a `Left`. - -**Signature** - -```ts -export declare const isLeft: (self: Either) => self is Left -``` - -**Example** - -```ts -import { isLeft, left, right } from "effect/Either" - -assert.deepStrictEqual(isLeft(right(1)), false) -assert.deepStrictEqual(isLeft(left("a")), true) -``` - -Added in v2.0.0 - -## isRight - -Determine if a `Either` is a `Right`. - -**Signature** - -```ts -export declare const isRight: (self: Either) => self is Right -``` - -**Example** - -```ts -import { isRight, left, right } from "effect/Either" - -assert.deepStrictEqual(isRight(right(1)), true) -assert.deepStrictEqual(isRight(left("a")), false) -``` - -Added in v2.0.0 - -# mapping - -## flip - -Returns an `Either` that swaps the error/success cases. This allows you to -use all methods on the error channel, possibly before flipping back. - -**Signature** - -```ts -export declare const flip: (self: Either) => Either -``` - -Added in v2.0.0 - -## map - -Maps the `Right` side of an `Either` value to a new `Either` value. - -**Signature** - -```ts -export declare const map: { - (f: (a: A) => B): (self: Either) => Either - (self: Either, f: (a: A) => B): Either -} -``` - -Added in v2.0.0 - -## mapBoth - -**Signature** - -```ts -export declare const mapBoth: { - (options: { - readonly onLeft: (e: E1) => E2 - readonly onRight: (a: A) => B - }): (self: Either) => Either - ( - self: Either, - options: { readonly onLeft: (e: E1) => E2; readonly onRight: (a: A) => B } - ): Either -} -``` - -Added in v2.0.0 - -## mapLeft - -Maps the `Left` side of an `Either` value to a new `Either` value. - -**Signature** - -```ts -export declare const mapLeft: { - (f: (e: E) => G): (self: Either) => Either - (self: Either, f: (e: E) => G): Either -} -``` - -Added in v2.0.0 - -# models - -## Either (type alias) - -**Signature** - -```ts -export type Either = Left | Right -``` - -Added in v2.0.0 - -## EitherUnify (interface) - -**Signature** - -```ts -export interface EitherUnify { - Either?: () => A[Unify.typeSymbol] extends Either | infer _ ? Either : never -} -``` - -Added in v2.0.0 - -## EitherUnifyIgnore (interface) - -**Signature** - -```ts -export interface EitherUnifyIgnore {} -``` - -Added in v2.0.0 - -## Left (interface) - -**Signature** - -```ts -export interface Left extends Data.Case, Pipeable, Inspectable { - readonly _tag: "Left" - readonly _op: "Left" - readonly left: E - readonly [TypeId]: { - readonly _A: (_: never) => A - readonly _E: (_: never) => E - } - [Unify.typeSymbol]?: unknown - [Unify.unifySymbol]?: EitherUnify - [Unify.ignoreSymbol]?: EitherUnifyIgnore -} -``` - -Added in v2.0.0 - -## Right (interface) - -**Signature** - -```ts -export interface Right extends Data.Case, Pipeable, Inspectable { - readonly _tag: "Right" - readonly _op: "Right" - readonly right: A - readonly [TypeId]: { - readonly _A: (_: never) => A - readonly _E: (_: never) => E - } - [Unify.typeSymbol]?: unknown - [Unify.unifySymbol]?: EitherUnify - [Unify.ignoreSymbol]?: EitherUnifyIgnore -} -``` - -Added in v2.0.0 - -# pattern matching - -## match - -Takes two functions and an `Either` value, if the value is a `Left` the inner value is applied to the `onLeft function, -if the value is a `Right`the inner value is applied to the`onRight` function. - -**Signature** - -```ts -export declare const match: { - (options: { - readonly onLeft: (e: E) => B - readonly onRight: (a: A) => C - }): (self: Either) => B | C - (self: Either, options: { readonly onLeft: (e: E) => B; readonly onRight: (a: A) => C }): B | C -} -``` - -**Example** - -```ts -import * as E from "effect/Either" -import { pipe } from "effect/Function" - -const onLeft = (strings: ReadonlyArray): string => `strings: ${strings.join(", ")}` - -const onRight = (value: number): string => `Ok: ${value}` - -assert.deepStrictEqual(pipe(E.right(1), E.match({ onLeft, onRight })), "Ok: 1") -assert.deepStrictEqual( - pipe(E.left(["string 1", "string 2"]), E.match({ onLeft, onRight })), - "strings: string 1, string 2" -) -``` - -Added in v2.0.0 - -# symbols - -## TypeId - -**Signature** - -```ts -export declare const TypeId: typeof TypeId -``` - -Added in v2.0.0 - -## TypeId (type alias) - -**Signature** - -```ts -export type TypeId = typeof TypeId -``` - -Added in v2.0.0 - -# type lambdas - -## EitherTypeLambda (interface) - -**Signature** - -```ts -export interface EitherTypeLambda extends TypeLambda { - readonly type: Either -} -``` - -Added in v2.0.0 diff --git a/docs/modules/Encoding.ts.md b/docs/modules/Encoding.ts.md deleted file mode 100644 index 491521294..000000000 --- a/docs/modules/Encoding.ts.md +++ /dev/null @@ -1,223 +0,0 @@ ---- -title: Encoding.ts -nav_order: 26 -parent: Modules ---- - -## Encoding overview - -This module provides encoding & decoding functionality for: - -- base64 (RFC4648) -- base64 (URL) -- hex - -Added in v2.0.0 - ---- - -

Table of contents

- -- [decoding](#decoding) - - [decodeBase64](#decodebase64) - - [decodeBase64String](#decodebase64string) - - [decodeBase64Url](#decodebase64url) - - [decodeBase64UrlString](#decodebase64urlstring) - - [decodeHex](#decodehex) - - [decodeHexString](#decodehexstring) -- [encoding](#encoding) - - [encodeBase64](#encodebase64) - - [encodeBase64Url](#encodebase64url) - - [encodeHex](#encodehex) -- [errors](#errors) - - [DecodeException](#decodeexception) -- [models](#models) - - [DecodeException (interface)](#decodeexception-interface) -- [refinements](#refinements) - - [isDecodeException](#isdecodeexception) -- [symbols](#symbols) - - [DecodeExceptionTypeId](#decodeexceptiontypeid) - - [DecodeExceptionTypeId (type alias)](#decodeexceptiontypeid-type-alias) - ---- - -# decoding - -## decodeBase64 - -Decodes a base64 (RFC4648) encoded `string` into a `Uint8Array`. - -**Signature** - -```ts -export declare const decodeBase64: (str: string) => Either.Either -``` - -Added in v2.0.0 - -## decodeBase64String - -Decodes a base64 (RFC4648) encoded `string` into a UTF-8 `string`. - -**Signature** - -```ts -export declare const decodeBase64String: (str: string) => Either.Either -``` - -Added in v2.0.0 - -## decodeBase64Url - -Decodes a base64 (URL) encoded `string` into a `Uint8Array`. - -**Signature** - -```ts -export declare const decodeBase64Url: (str: string) => Either.Either -``` - -Added in v2.0.0 - -## decodeBase64UrlString - -Decodes a base64 (URL) encoded `string` into a UTF-8 `string`. - -**Signature** - -```ts -export declare const decodeBase64UrlString: (str: string) => Either.Either -``` - -Added in v2.0.0 - -## decodeHex - -Decodes a hex encoded `string` into a `Uint8Array`. - -**Signature** - -```ts -export declare const decodeHex: (str: string) => Either.Either -``` - -Added in v2.0.0 - -## decodeHexString - -Decodes a hex encoded `string` into a UTF-8 `string`. - -**Signature** - -```ts -export declare const decodeHexString: (str: string) => Either.Either -``` - -Added in v2.0.0 - -# encoding - -## encodeBase64 - -Encodes the given value into a base64 (RFC4648) `string`. - -**Signature** - -```ts -export declare const encodeBase64: (input: Uint8Array | string) => string -``` - -Added in v2.0.0 - -## encodeBase64Url - -Encodes the given value into a base64 (URL) `string`. - -**Signature** - -```ts -export declare const encodeBase64Url: (input: Uint8Array | string) => string -``` - -Added in v2.0.0 - -## encodeHex - -Encodes the given value into a hex `string`. - -**Signature** - -```ts -export declare const encodeHex: (input: Uint8Array | string) => string -``` - -Added in v2.0.0 - -# errors - -## DecodeException - -Creates a checked exception which occurs when decoding fails. - -**Signature** - -```ts -export declare const DecodeException: (input: string, message?: string) => DecodeException -``` - -Added in v2.0.0 - -# models - -## DecodeException (interface) - -Represents a checked exception which occurs when decoding fails. - -**Signature** - -```ts -export interface DecodeException { - readonly _tag: "DecodeException" - readonly [DecodeExceptionTypeId]: DecodeExceptionTypeId - readonly input: string - readonly message?: string -} -``` - -Added in v2.0.0 - -# refinements - -## isDecodeException - -Returns `true` if the specified value is an `DecodeException`, `false` otherwise. - -**Signature** - -```ts -export declare const isDecodeException: (u: unknown) => u is DecodeException -``` - -Added in v2.0.0 - -# symbols - -## DecodeExceptionTypeId - -**Signature** - -```ts -export declare const DecodeExceptionTypeId: typeof DecodeExceptionTypeId -``` - -Added in v2.0.0 - -## DecodeExceptionTypeId (type alias) - -**Signature** - -```ts -export type DecodeExceptionTypeId = typeof DecodeExceptionTypeId -``` - -Added in v2.0.0 diff --git a/docs/modules/Equal.ts.md b/docs/modules/Equal.ts.md deleted file mode 100644 index b13eaa1f5..000000000 --- a/docs/modules/Equal.ts.md +++ /dev/null @@ -1,89 +0,0 @@ ---- -title: Equal.ts -nav_order: 27 -parent: Modules ---- - -## Equal overview - -Added in v2.0.0 - ---- - -

Table of contents

- -- [equality](#equality) - - [equals](#equals) -- [guards](#guards) - - [isEqual](#isequal) -- [instances](#instances) - - [equivalence](#equivalence) -- [models](#models) - - [Equal (interface)](#equal-interface) -- [symbols](#symbols) - - [symbol](#symbol) - ---- - -# equality - -## equals - -**Signature** - -```ts -export declare function equals(that: B):
(self: A) => boolean -export declare function equals(self: A, that: B): boolean -``` - -Added in v2.0.0 - -# guards - -## isEqual - -**Signature** - -```ts -export declare const isEqual: (u: unknown) => u is Equal -``` - -Added in v2.0.0 - -# instances - -## equivalence - -**Signature** - -```ts -export declare const equivalence: () => Equivalence -``` - -Added in v2.0.0 - -# models - -## Equal (interface) - -**Signature** - -```ts -export interface Equal extends Hash.Hash { - readonly [symbol]: (that: Equal) => boolean -} -``` - -Added in v2.0.0 - -# symbols - -## symbol - -**Signature** - -```ts -export declare const symbol: typeof symbol -``` - -Added in v2.0.0 diff --git a/docs/modules/Equivalence.ts.md b/docs/modules/Equivalence.ts.md deleted file mode 100644 index 0271ababb..000000000 --- a/docs/modules/Equivalence.ts.md +++ /dev/null @@ -1,297 +0,0 @@ ---- -title: Equivalence.ts -nav_order: 28 -parent: Modules ---- - -## Equivalence overview - -This module provides an implementation of the `Equivalence` type class, which defines a binary relation -that is reflexive, symmetric, and transitive. In other words, it defines a notion of equivalence between values of a certain type. -These properties are also known in mathematics as an "equivalence relation". - -Added in v2.0.0 - ---- - -

Table of contents

- -- [combinators](#combinators) - - [array](#array) - - [mapInput](#mapinput) - - [struct](#struct) - - [tuple](#tuple) -- [combining](#combining) - - [all](#all) - - [combine](#combine) - - [combineAll](#combineall) - - [combineMany](#combinemany) - - [product](#product) - - [productMany](#productmany) -- [constructors](#constructors) - - [make](#make) - - [strict](#strict) -- [instances](#instances) - - [Date](#date) - - [bigint](#bigint) - - [boolean](#boolean) - - [number](#number) - - [string](#string) - - [symbol](#symbol) -- [type class](#type-class) - - [Equivalence (interface)](#equivalence-interface) -- [type lambdas](#type-lambdas) - - [EquivalenceTypeLambda (interface)](#equivalencetypelambda-interface) - ---- - -# combinators - -## array - -Creates a new `Equivalence` for an array of values based on a given `Equivalence` for the elements of the array. - -**Signature** - -```ts -export declare const array:
(item: Equivalence) => Equivalence -``` - -Added in v2.0.0 - -## mapInput - -**Signature** - -```ts -export declare const mapInput: { - (f: (b: B) => A): (self: Equivalence) => Equivalence - (self: Equivalence, f: (b: B) => A): Equivalence -} -``` - -Added in v2.0.0 - -## struct - -Given a struct of `Equivalence`s returns a new `Equivalence` that compares values of a struct -by applying each `Equivalence` to the corresponding property of the struct. - -**Signature** - -```ts -export declare const struct: >>( - fields: R -) => Equivalence<{ readonly [K in keyof R]: [R[K]] extends [Equivalence] ? A : never }> -``` - -Added in v2.0.0 - -## tuple - -Similar to `Promise.all` but operates on `Equivalence`s. - -``` -[Equivalence, Equivalence, ...] -> Equivalence<[A, B, ...]> -``` - -Given a tuple of `Equivalence`s returns a new `Equivalence` that compares values of a tuple -by applying each `Equivalence` to the corresponding element of the tuple. - -**Signature** - -```ts -export declare const tuple: []>( - ...elements: T -) => Equivalence] ? A : never }>> -``` - -Added in v2.0.0 - -# combining - -## all - -**Signature** - -```ts -export declare const all: (collection: Iterable>) => Equivalence -``` - -Added in v2.0.0 - -## combine - -**Signature** - -```ts -export declare const combine: { - (that: Equivalence): (self: Equivalence) => Equivalence - (self: Equivalence, that: Equivalence): Equivalence -} -``` - -Added in v2.0.0 - -## combineAll - -**Signature** - -```ts -export declare const combineAll: (collection: Iterable>) => Equivalence -``` - -Added in v2.0.0 - -## combineMany - -**Signature** - -```ts -export declare const combineMany: { - (collection: Iterable>): (self: Equivalence) => Equivalence - (self: Equivalence, collection: Iterable>): Equivalence -} -``` - -Added in v2.0.0 - -## product - -**Signature** - -```ts -export declare const product: { - (that: Equivalence): (self: Equivalence) => Equivalence - (self: Equivalence, that: Equivalence): Equivalence -} -``` - -Added in v2.0.0 - -## productMany - -**Signature** - -```ts -export declare const productMany: ( - self: Equivalence, - collection: Iterable> -) => Equivalence -``` - -Added in v2.0.0 - -# constructors - -## make - -**Signature** - -```ts -export declare const make: (isEquivalent: (self: A, that: A) => boolean) => Equivalence -``` - -Added in v2.0.0 - -## strict - -Return an `Equivalence` that uses strict equality (===) to compare values. - -**Signature** - -```ts -export declare const strict: () => Equivalence -``` - -Added in v2.0.0 - -# instances - -## Date - -**Signature** - -```ts -export declare const Date: Equivalence -``` - -Added in v2.0.0 - -## bigint - -**Signature** - -```ts -export declare const bigint: Equivalence -``` - -Added in v2.0.0 - -## boolean - -**Signature** - -```ts -export declare const boolean: Equivalence -``` - -Added in v2.0.0 - -## number - -**Signature** - -```ts -export declare const number: Equivalence -``` - -Added in v2.0.0 - -## string - -**Signature** - -```ts -export declare const string: Equivalence -``` - -Added in v2.0.0 - -## symbol - -**Signature** - -```ts -export declare const symbol: Equivalence -``` - -Added in v2.0.0 - -# type class - -## Equivalence (interface) - -**Signature** - -```ts -export interface Equivalence { - (self: A, that: A): boolean -} -``` - -Added in v2.0.0 - -# type lambdas - -## EquivalenceTypeLambda (interface) - -**Signature** - -```ts -export interface EquivalenceTypeLambda extends TypeLambda { - readonly type: Equivalence -} -``` - -Added in v2.0.0 diff --git a/docs/modules/ExecutionStrategy.ts.md b/docs/modules/ExecutionStrategy.ts.md deleted file mode 100644 index fdb85741e..000000000 --- a/docs/modules/ExecutionStrategy.ts.md +++ /dev/null @@ -1,189 +0,0 @@ ---- -title: ExecutionStrategy.ts -nav_order: 29 -parent: Modules ---- - -## ExecutionStrategy overview - -Added in v2.0.0 - ---- - -

Table of contents

- -- [constructors](#constructors) - - [parallel](#parallel) - - [parallelN](#paralleln) - - [sequential](#sequential) -- [folding](#folding) - - [match](#match) -- [models](#models) - - [ExecutionStrategy (type alias)](#executionstrategy-type-alias) - - [Parallel (interface)](#parallel-interface) - - [ParallelN (interface)](#paralleln-interface) - - [Sequential (interface)](#sequential-interface) -- [refinements](#refinements) - - [isParallel](#isparallel) - - [isParallelN](#isparalleln) - - [isSequential](#issequential) - ---- - -# constructors - -## parallel - -Execute effects in parallel. - -**Signature** - -```ts -export declare const parallel: ExecutionStrategy -``` - -Added in v2.0.0 - -## parallelN - -Execute effects in parallel, up to the specified number of concurrent fibers. - -**Signature** - -```ts -export declare const parallelN: (parallelism: number) => ExecutionStrategy -``` - -Added in v2.0.0 - -## sequential - -Execute effects sequentially. - -**Signature** - -```ts -export declare const sequential: ExecutionStrategy -``` - -Added in v2.0.0 - -# folding - -## match - -Folds over the specified `ExecutionStrategy` using the provided case -functions. - -**Signature** - -```ts -export declare const match: { -
(onSequential: LazyArg, onParallel: LazyArg, onParallelN: (n: number) => A): (self: ExecutionStrategy) => A - (self: ExecutionStrategy, onSequential: LazyArg, onParallel: LazyArg, onParallelN: (n: number) => A): A -} -``` - -Added in v2.0.0 - -# models - -## ExecutionStrategy (type alias) - -Describes a strategy for evaluating multiple effects, potentially in -parallel. - -There are 3 possible execution strategies: `Sequential`, `Parallel`, -`ParallelN`. - -**Signature** - -```ts -export type ExecutionStrategy = Sequential | Parallel | ParallelN -``` - -Added in v2.0.0 - -## Parallel (interface) - -Execute effects in parallel. - -**Signature** - -```ts -export interface Parallel { - readonly _tag: "Parallel" -} -``` - -Added in v2.0.0 - -## ParallelN (interface) - -Execute effects in parallel, up to the specified number of concurrent fibers. - -**Signature** - -```ts -export interface ParallelN { - readonly _tag: "ParallelN" - readonly parallelism: number -} -``` - -Added in v2.0.0 - -## Sequential (interface) - -Execute effects sequentially. - -**Signature** - -```ts -export interface Sequential { - readonly _tag: "Sequential" -} -``` - -Added in v2.0.0 - -# refinements - -## isParallel - -Returns `true` if the specified `ExecutionStrategy` is an instance of -`Sequential`, `false` otherwise. - -**Signature** - -```ts -export declare const isParallel: (self: ExecutionStrategy) => self is Parallel -``` - -Added in v2.0.0 - -## isParallelN - -Returns `true` if the specified `ExecutionStrategy` is an instance of -`Sequential`, `false` otherwise. - -**Signature** - -```ts -export declare const isParallelN: (self: ExecutionStrategy) => self is ParallelN -``` - -Added in v2.0.0 - -## isSequential - -Returns `true` if the specified `ExecutionStrategy` is an instance of -`Sequential`, `false` otherwise. - -**Signature** - -```ts -export declare const isSequential: (self: ExecutionStrategy) => self is Sequential -``` - -Added in v2.0.0 diff --git a/docs/modules/Exit.ts.md b/docs/modules/Exit.ts.md deleted file mode 100644 index 50a5497f2..000000000 --- a/docs/modules/Exit.ts.md +++ /dev/null @@ -1,698 +0,0 @@ ---- -title: Exit.ts -nav_order: 30 -parent: Modules ---- - -## Exit overview - -Added in v2.0.0 - ---- - -

Table of contents

- -- [constructors](#constructors) - - [all](#all) - - [die](#die) - - [fail](#fail) - - [failCause](#failcause) - - [interrupt](#interrupt) - - [succeed](#succeed) - - [unit](#unit) -- [conversions](#conversions) - - [fromEither](#fromeither) - - [fromOption](#fromoption) -- [elements](#elements) - - [exists](#exists) -- [folding](#folding) - - [match](#match) - - [matchEffect](#matcheffect) -- [getters](#getters) - - [causeOption](#causeoption) - - [getOrElse](#getorelse) - - [isInterrupted](#isinterrupted) -- [mapping](#mapping) - - [as](#as) - - [asUnit](#asunit) - - [map](#map) - - [mapBoth](#mapboth) - - [mapError](#maperror) - - [mapErrorCause](#maperrorcause) -- [models](#models) - - [Exit (type alias)](#exit-type-alias) - - [ExitUnify (interface)](#exitunify-interface) - - [ExitUnifyIgnore (interface)](#exitunifyignore-interface) - - [Failure (interface)](#failure-interface) - - [Success (interface)](#success-interface) -- [refinements](#refinements) - - [isExit](#isexit) - - [isFailure](#isfailure) - - [isSuccess](#issuccess) -- [sequencing](#sequencing) - - [flatMap](#flatmap) - - [flatMapEffect](#flatmapeffect) - - [flatten](#flatten) -- [traversing](#traversing) - - [forEachEffect](#foreacheffect) -- [zipping](#zipping) - - [zip](#zip) - - [zipLeft](#zipleft) - - [zipPar](#zippar) - - [zipParLeft](#zipparleft) - - [zipParRight](#zipparright) - - [zipRight](#zipright) - - [zipWith](#zipwith) - ---- - -# constructors - -## all - -Collects all of the specified exit values into a `Some>>`. If -the provided iterable contains no elements, `None` will be returned. - -**Signature** - -```ts -export declare const all: ( - exits: Iterable>, - options?: { readonly parallel?: boolean | undefined } -) => Option.Option> -``` - -Added in v2.0.0 - -## die - -Constructs a new `Exit.Failure` from the specified unrecoverable defect. - -**Signature** - -```ts -export declare const die: (defect: unknown) => Exit -``` - -Added in v2.0.0 - -## fail - -Constructs a new `Exit.Failure` from the specified recoverable error of type -`E`. - -**Signature** - -```ts -export declare const fail: (error: E) => Exit -``` - -Added in v2.0.0 - -## failCause - -Constructs a new `Exit.Failure` from the specified `Cause` of type `E`. - -**Signature** - -```ts -export declare const failCause: (cause: Cause.Cause) => Exit -``` - -Added in v2.0.0 - -## interrupt - -Constructs a new `Exit.Failure` from the specified `FiberId` indicating that -the `Fiber` running an `Effect` workflow was terminated due to interruption. - -**Signature** - -```ts -export declare const interrupt: (fiberId: FiberId.FiberId) => Exit -``` - -Added in v2.0.0 - -## succeed - -Constructs a new `Exit.Success` containing the specified value of type `A`. - -**Signature** - -```ts -export declare const succeed:
(value: A) => Exit -``` - -Added in v2.0.0 - -## unit - -Represents an `Exit` which succeeds with `undefined`. - -**Signature** - -```ts -export declare const unit: Exit -``` - -Added in v2.0.0 - -# conversions - -## fromEither - -Converts an `Either` into an `Exit`. - -**Signature** - -```ts -export declare const fromEither: (either: Either.Either) => Exit -``` - -Added in v2.0.0 - -## fromOption - -Converts an `Option` into an `Exit`. - -**Signature** - -```ts -export declare const fromOption: (option: Option.Option) => Exit -``` - -Added in v2.0.0 - -# elements - -## exists - -Executes the predicate on the value of the specified exit if it is a -`Success`, otherwise returns `false`. - -**Signature** - -```ts -export declare const exists: { - (predicate: Predicate): (self: Exit) => boolean - (self: Exit, predicate: Predicate): boolean -} -``` - -Added in v2.0.0 - -# folding - -## match - -**Signature** - -```ts -export declare const match: { - (options: { - readonly onFailure: (cause: Cause.Cause) => Z1 - readonly onSuccess: (a: A) => Z2 - }): (self: Exit) => Z1 | Z2 - ( - self: Exit, - options: { readonly onFailure: (cause: Cause.Cause) => Z1; readonly onSuccess: (a: A) => Z2 } - ): Z1 | Z2 -} -``` - -Added in v2.0.0 - -## matchEffect - -**Signature** - -```ts -export declare const matchEffect: { - (options: { - readonly onFailure: (cause: Cause.Cause) => Effect.Effect - readonly onSuccess: (a: A) => Effect.Effect - }): (self: Exit) => Effect.Effect - ( - self: Exit, - options: { - readonly onFailure: (cause: Cause.Cause) => Effect.Effect - readonly onSuccess: (a: A) => Effect.Effect - } - ): Effect.Effect -} -``` - -Added in v2.0.0 - -# getters - -## causeOption - -Returns a `Some>` if the specified exit is a `Failure`, `None` -otherwise. - -**Signature** - -```ts -export declare const causeOption: (self: Exit) => Option.Option> -``` - -Added in v2.0.0 - -## getOrElse - -Returns the `A` if specified exit is a `Success`, otherwise returns the -alternate `A` value computed from the specified function which receives the -`Cause` of the exit `Failure`. - -**Signature** - -```ts -export declare const getOrElse: { - (orElse: (cause: Cause.Cause) => A2): (self: Exit) => A2 | A1 - (self: Exit, orElse: (cause: Cause.Cause) => A2): A1 | A2 -} -``` - -Added in v2.0.0 - -## isInterrupted - -Returns `true` if the specified exit is a `Failure` **and** the `Cause` of -the failure was due to interruption, `false` otherwise. - -**Signature** - -```ts -export declare const isInterrupted: (self: Exit) => boolean -``` - -Added in v2.0.0 - -# mapping - -## as - -Maps the `Success` value of the specified exit to the provided constant -value. - -**Signature** - -```ts -export declare const as: { - (value: A2): (self: Exit) => Exit - (self: Exit, value: A2): Exit -} -``` - -Added in v2.0.0 - -## asUnit - -Maps the `Success` value of the specified exit to a void. - -**Signature** - -```ts -export declare const asUnit: (self: Exit) => Exit -``` - -Added in v2.0.0 - -## map - -Maps over the `Success` value of the specified exit using the provided -function. - -**Signature** - -```ts -export declare const map: { - (f: (a: A) => B): (self: Exit) => Exit - (self: Exit, f: (a: A) => B): Exit -} -``` - -Added in v2.0.0 - -## mapBoth - -Maps over the `Success` and `Failure` cases of the specified exit using the -provided functions. - -**Signature** - -```ts -export declare const mapBoth: { - (options: { - readonly onFailure: (e: E) => E2 - readonly onSuccess: (a: A) => A2 - }): (self: Exit) => Exit - ( - self: Exit, - options: { readonly onFailure: (e: E) => E2; readonly onSuccess: (a: A) => A2 } - ): Exit -} -``` - -Added in v2.0.0 - -## mapError - -Maps over the error contained in the `Failure` of the specified exit using -the provided function. - -**Signature** - -```ts -export declare const mapError: { - (f: (e: E) => E2): (self: Exit) => Exit - (self: Exit, f: (e: E) => E2): Exit -} -``` - -Added in v2.0.0 - -## mapErrorCause - -Maps over the `Cause` contained in the `Failure` of the specified exit using -the provided function. - -**Signature** - -```ts -export declare const mapErrorCause: { - (f: (cause: Cause.Cause) => Cause.Cause): (self: Exit) => Exit - (self: Exit, f: (cause: Cause.Cause) => Cause.Cause): Exit -} -``` - -Added in v2.0.0 - -# models - -## Exit (type alias) - -An `Exit` describes the result of a executing an `Effect` workflow. - -There are two possible values for an `Exit`: - -- `Exit.Success` contain a success value of type `A` -- `Exit.Failure` contains a failure `Cause` of type `E` - -**Signature** - -```ts -export type Exit = Failure | Success -``` - -Added in v2.0.0 - -## ExitUnify (interface) - -**Signature** - -```ts -export interface ExitUnify extends Effect.EffectUnify { - Exit?: () => A[Unify.typeSymbol] extends Exit | infer _ ? Exit : never -} -``` - -Added in v2.0.0 - -## ExitUnifyIgnore (interface) - -**Signature** - -```ts -export interface ExitUnifyIgnore extends Effect.EffectUnifyIgnore { - Effect?: true -} -``` - -Added in v2.0.0 - -## Failure (interface) - -Represents a failed `Effect` workflow containing the `Cause` of the failure -of type `E`. - -**Signature** - -```ts -export interface Failure extends Effect.Effect, Pipeable, Inspectable { - readonly _tag: "Failure" - readonly _op: "Failure" - readonly cause: Cause.Cause - [Unify.typeSymbol]?: unknown - [Unify.unifySymbol]?: ExitUnify - [Unify.ignoreSymbol]?: ExitUnifyIgnore - /** @internal */ - readonly i0: Cause.Cause -} -``` - -Added in v2.0.0 - -## Success (interface) - -Represents a successful `Effect` workflow and containing the returned value -of type `A`. - -**Signature** - -```ts -export interface Success extends Effect.Effect, Pipeable, Inspectable { - readonly _tag: "Success" - readonly _op: "Success" - readonly value: A - [Unify.typeSymbol]?: unknown - [Unify.unifySymbol]?: ExitUnify - [Unify.ignoreSymbol]?: ExitUnifyIgnore - /** @internal */ - readonly i0: A -} -``` - -Added in v2.0.0 - -# refinements - -## isExit - -Returns `true` if the specified value is an `Exit`, `false` otherwise. - -**Signature** - -```ts -export declare const isExit: (u: unknown) => u is Exit -``` - -Added in v2.0.0 - -## isFailure - -Returns `true` if the specified `Exit` is a `Failure`, `false` otherwise. - -**Signature** - -```ts -export declare const isFailure: (self: Exit) => self is Failure -``` - -Added in v2.0.0 - -## isSuccess - -Returns `true` if the specified `Exit` is a `Success`, `false` otherwise. - -**Signature** - -```ts -export declare const isSuccess: (self: Exit) => self is Success -``` - -Added in v2.0.0 - -# sequencing - -## flatMap - -**Signature** - -```ts -export declare const flatMap: { - (f: (a: A) => Exit): (self: Exit) => Exit - (self: Exit, f: (a: A) => Exit): Exit -} -``` - -Added in v2.0.0 - -## flatMapEffect - -**Signature** - -```ts -export declare const flatMapEffect: { - ( - f: (a: A) => Effect.Effect> - ): (self: Exit) => Effect.Effect> - (self: Exit, f: (a: A) => Effect.Effect>): Effect.Effect> -} -``` - -Added in v2.0.0 - -## flatten - -**Signature** - -```ts -export declare const flatten: (self: Exit>) => Exit -``` - -Added in v2.0.0 - -# traversing - -## forEachEffect - -**Signature** - -```ts -export declare const forEachEffect: { - (f: (a: A) => Effect.Effect): (self: Exit) => Effect.Effect> - (self: Exit, f: (a: A) => Effect.Effect): Effect.Effect> -} -``` - -Added in v2.0.0 - -# zipping - -## zip - -Sequentially zips the this result with the specified result or else returns -the failed `Cause`. - -**Signature** - -```ts -export declare const zip: { - (that: Exit): (self: Exit) => Exit - (self: Exit, that: Exit): Exit -} -``` - -Added in v2.0.0 - -## zipLeft - -Sequentially zips the this result with the specified result discarding the -second element of the tuple or else returns the failed `Cause`. - -**Signature** - -```ts -export declare const zipLeft: { - (that: Exit): (self: Exit) => Exit - (self: Exit, that: Exit): Exit -} -``` - -Added in v2.0.0 - -## zipPar - -Parallelly zips the this result with the specified result or else returns -the failed `Cause`. - -**Signature** - -```ts -export declare const zipPar: { - (that: Exit): (self: Exit) => Exit - (self: Exit, that: Exit): Exit -} -``` - -Added in v2.0.0 - -## zipParLeft - -Parallelly zips the this result with the specified result discarding the -second element of the tuple or else returns the failed `Cause`. - -**Signature** - -```ts -export declare const zipParLeft: { - (that: Exit): (self: Exit) => Exit - (self: Exit, that: Exit): Exit -} -``` - -Added in v2.0.0 - -## zipParRight - -Parallelly zips the this result with the specified result discarding the -first element of the tuple or else returns the failed `Cause`. - -**Signature** - -```ts -export declare const zipParRight: { - (that: Exit): (self: Exit) => Exit - (self: Exit, that: Exit): Exit -} -``` - -Added in v2.0.0 - -## zipRight - -Sequentially zips the this result with the specified result discarding the -first element of the tuple or else returns the failed `Cause`. - -**Signature** - -```ts -export declare const zipRight: { - (that: Exit): (self: Exit) => Exit - (self: Exit, that: Exit): Exit -} -``` - -Added in v2.0.0 - -## zipWith - -Zips this exit together with that exit using the specified combination -functions. - -**Signature** - -```ts -export declare const zipWith: { - ( - that: Exit, - options: { - readonly onSuccess: (a: A, b: B) => C - readonly onFailure: (cause: Cause.Cause, cause2: Cause.Cause) => Cause.Cause - } - ): (self: Exit) => Exit - ( - self: Exit, - that: Exit, - options: { - readonly onSuccess: (a: A, b: B) => C - readonly onFailure: (cause: Cause.Cause, cause2: Cause.Cause) => Cause.Cause - } - ): Exit -} -``` - -Added in v2.0.0 diff --git a/docs/modules/Fiber.ts.md b/docs/modules/Fiber.ts.md deleted file mode 100644 index 851a91403..000000000 --- a/docs/modules/Fiber.ts.md +++ /dev/null @@ -1,956 +0,0 @@ ---- -title: Fiber.ts -nav_order: 31 -parent: Modules ---- - -## Fiber overview - -Added in v2.0.0 - ---- - -

Table of contents

- -- [alternatives](#alternatives) - - [orElse](#orelse) - - [orElseEither](#orelseeither) -- [constructors](#constructors) - - [all](#all) - - [done](#done) - - [fail](#fail) - - [failCause](#failcause) - - [interrupted](#interrupted) - - [never](#never) - - [roots](#roots) - - [succeed](#succeed) - - [unit](#unit) - - [unsafeRoots](#unsaferoots) -- [conversions](#conversions) - - [fromEffect](#fromeffect) -- [destructors](#destructors) - - [awaitAll](#awaitall) - - [dump](#dump) - - [dumpAll](#dumpall) - - [inheritAll](#inheritall) - - [join](#join) - - [joinAll](#joinall) - - [pretty](#pretty) - - [scoped](#scoped) -- [folding](#folding) - - [match](#match) -- [getters](#getters) - - [await](#await) - - [children](#children) - - [id](#id) - - [poll](#poll) - - [status](#status) -- [instances](#instances) - - [Order](#order) -- [interruption](#interruption) - - [interrupt](#interrupt) - - [interruptAll](#interruptall) - - [interruptAllAs](#interruptallas) - - [interruptAs](#interruptas) - - [interruptAsFork](#interruptasfork) - - [interruptFork](#interruptfork) -- [mapping](#mapping) - - [map](#map) - - [mapEffect](#mapeffect) - - [mapFiber](#mapfiber) -- [models](#models) - - [Fiber (interface)](#fiber-interface) - - [RuntimeFiber (interface)](#runtimefiber-interface) -- [refinements](#refinements) - - [isFiber](#isfiber) - - [isRuntimeFiber](#isruntimefiber) -- [symbols](#symbols) - - [FiberTypeId](#fibertypeid) - - [FiberTypeId (type alias)](#fibertypeid-type-alias) - - [RuntimeFiberTypeId](#runtimefibertypeid) - - [RuntimeFiberTypeId (type alias)](#runtimefibertypeid-type-alias) -- [utilities](#utilities) - - [getCurrentFiber](#getcurrentfiber) -- [utils](#utils) - - [Fiber (namespace)](#fiber-namespace) - - [Descriptor (interface)](#descriptor-interface) - - [Dump (interface)](#dump-interface) - - [RuntimeVariance (interface)](#runtimevariance-interface) - - [Variance (interface)](#variance-interface) - - [Runtime (type alias)](#runtime-type-alias) -- [zipping](#zipping) - - [zip](#zip) - - [zipLeft](#zipleft) - - [zipRight](#zipright) - - [zipWith](#zipwith) - ---- - -# alternatives - -## orElse - -Returns a fiber that prefers `this` fiber, but falls back to the `that` one -when `this` one fails. Interrupting the returned fiber will interrupt both -fibers, sequentially, from left to right. - -**Signature** - -```ts -export declare const orElse: { - (that: Fiber): (self: Fiber) => Fiber - (self: Fiber, that: Fiber): Fiber -} -``` - -Added in v2.0.0 - -## orElseEither - -Returns a fiber that prefers `this` fiber, but falls back to the `that` one -when `this` one fails. Interrupting the returned fiber will interrupt both -fibers, sequentially, from left to right. - -**Signature** - -```ts -export declare const orElseEither: { - (that: Fiber): (self: Fiber) => Fiber> - (self: Fiber, that: Fiber): Fiber> -} -``` - -Added in v2.0.0 - -# constructors - -## all - -Collects all fibers into a single fiber producing an in-order list of the -results. - -**Signature** - -```ts -export declare const all: (fibers: Iterable>) => Fiber -``` - -Added in v2.0.0 - -## done - -A fiber that is done with the specified `Exit` value. - -**Signature** - -```ts -export declare const done: (exit: Exit.Exit) => Fiber -``` - -Added in v2.0.0 - -## fail - -A fiber that has already failed with the specified value. - -**Signature** - -```ts -export declare const fail: (error: E) => Fiber -``` - -Added in v2.0.0 - -## failCause - -Creates a `Fiber` that has already failed with the specified cause. - -**Signature** - -```ts -export declare const failCause: (cause: Cause.Cause) => Fiber -``` - -Added in v2.0.0 - -## interrupted - -Constructrs a `Fiber` that is already interrupted. - -**Signature** - -```ts -export declare const interrupted: (fiberId: FiberId.FiberId) => Fiber -``` - -Added in v2.0.0 - -## never - -A fiber that never fails or succeeds. - -**Signature** - -```ts -export declare const never: Fiber -``` - -Added in v2.0.0 - -## roots - -Returns a chunk containing all root fibers. - -**Signature** - -```ts -export declare const roots: Effect.Effect[]> -``` - -Added in v2.0.0 - -## succeed - -Returns a fiber that has already succeeded with the specified value. - -**Signature** - -```ts -export declare const succeed:
(value: A) => Fiber -``` - -Added in v2.0.0 - -## unit - -A fiber that has already succeeded with unit. - -**Signature** - -```ts -export declare const unit: Fiber -``` - -Added in v2.0.0 - -## unsafeRoots - -Returns a chunk containing all root fibers. - -**Signature** - -```ts -export declare const unsafeRoots: (_: void) => Array> -``` - -Added in v2.0.0 - -# conversions - -## fromEffect - -Lifts an `Effect` into a `Fiber`. - -**Signature** - -```ts -export declare const fromEffect: (effect: Effect.Effect) => Effect.Effect> -``` - -Added in v2.0.0 - -# destructors - -## awaitAll - -Awaits on all fibers to be completed, successfully or not. - -**Signature** - -```ts -export declare const awaitAll: (fibers: Iterable>) => Effect.Effect -``` - -Added in v2.0.0 - -## dump - -**Signature** - -```ts -export declare const dump: (self: RuntimeFiber) => Effect.Effect -``` - -Added in v2.0.0 - -## dumpAll - -**Signature** - -```ts -export declare const dumpAll: ( - fibers: Iterable> -) => Effect.Effect> -``` - -Added in v2.0.0 - -## inheritAll - -Inherits values from all `FiberRef` instances into current fiber. This -will resume immediately. - -**Signature** - -```ts -export declare const inheritAll: (self: Fiber) => Effect.Effect -``` - -Added in v2.0.0 - -## join - -Joins the fiber, which suspends the joining fiber until the result of the -fiber has been determined. Attempting to join a fiber that has erred will -result in a catchable error. Joining an interrupted fiber will result in an -"inner interruption" of this fiber, unlike interruption triggered by -another fiber, "inner interruption" can be caught and recovered. - -**Signature** - -```ts -export declare const join: (self: Fiber) => Effect.Effect -``` - -Added in v2.0.0 - -## joinAll - -Joins all fibers, awaiting their _successful_ completion. Attempting to -join a fiber that has erred will result in a catchable error, _if_ that -error does not result from interruption. - -**Signature** - -```ts -export declare const joinAll: (fibers: Iterable>) => Effect.Effect -``` - -Added in v2.0.0 - -## pretty - -Pretty-prints a `RuntimeFiber`. - -**Signature** - -```ts -export declare const pretty: (self: RuntimeFiber) => Effect.Effect -``` - -Added in v2.0.0 - -## scoped - -Converts this fiber into a scoped effect. The fiber is interrupted when the -scope is closed. - -**Signature** - -```ts -export declare const scoped: (self: Fiber) => Effect.Effect> -``` - -Added in v2.0.0 - -# folding - -## match - -Folds over the `Fiber` or `RuntimeFiber`. - -**Signature** - -```ts -export declare const match: { - (options: { - readonly onFiber: (fiber: Fiber) => Z - readonly onRuntimeFiber: (fiber: RuntimeFiber) => Z - }): (self: Fiber) => Z - ( - self: Fiber, - options: { readonly onFiber: (fiber: Fiber) => Z; readonly onRuntimeFiber: (fiber: RuntimeFiber) => Z } - ): Z -} -``` - -Added in v2.0.0 - -# getters - -## await - -Awaits the fiber, which suspends the awaiting fiber until the result of the -fiber has been determined. - -**Signature** - -```ts -export declare const await: (self: Fiber) => Effect.Effect> -``` - -Added in v2.0.0 - -## children - -Retrieves the immediate children of the fiber. - -**Signature** - -```ts -export declare const children: (self: Fiber) => Effect.Effect>> -``` - -Added in v2.0.0 - -## id - -The identity of the fiber. - -**Signature** - -```ts -export declare const id: (self: Fiber) => FiberId.FiberId -``` - -Added in v2.0.0 - -## poll - -Tentatively observes the fiber, but returns immediately if it is not -already done. - -**Signature** - -```ts -export declare const poll: (self: Fiber) => Effect.Effect>> -``` - -Added in v2.0.0 - -## status - -Returns the `FiberStatus` of a `RuntimeFiber`. - -**Signature** - -```ts -export declare const status: (self: RuntimeFiber) => Effect.Effect -``` - -Added in v2.0.0 - -# instances - -## Order - -**Signature** - -```ts -export declare const Order: order.Order> -``` - -Added in v2.0.0 - -# interruption - -## interrupt - -Interrupts the fiber from whichever fiber is calling this method. If the -fiber has already exited, the returned effect will resume immediately. -Otherwise, the effect will resume when the fiber exits. - -**Signature** - -```ts -export declare const interrupt: (self: Fiber) => Effect.Effect> -``` - -Added in v2.0.0 - -## interruptAll - -Interrupts all fibers, awaiting their interruption. - -**Signature** - -```ts -export declare const interruptAll: (fibers: Iterable>) => Effect.Effect -``` - -Added in v2.0.0 - -## interruptAllAs - -Interrupts all fibers as by the specified fiber, awaiting their -interruption. - -**Signature** - -```ts -export declare const interruptAllAs: { - (fiberId: FiberId.FiberId): (fibers: Iterable>) => Effect.Effect - (fibers: Iterable>, fiberId: FiberId.FiberId): Effect.Effect -} -``` - -Added in v2.0.0 - -## interruptAs - -Interrupts the fiber as if interrupted from the specified fiber. If the -fiber has already exited, the returned effect will resume immediately. -Otherwise, the effect will resume when the fiber exits. - -**Signature** - -```ts -export declare const interruptAs: { - (fiberId: FiberId.FiberId): (self: Fiber) => Effect.Effect> - (self: Fiber, fiberId: FiberId.FiberId): Effect.Effect> -} -``` - -Added in v2.0.0 - -## interruptAsFork - -Interrupts the fiber as if interrupted from the specified fiber. If the -fiber has already exited, the returned effect will resume immediately. -Otherwise, the effect will resume when the fiber exits. - -**Signature** - -```ts -export declare const interruptAsFork: { - (fiberId: FiberId.FiberId): (self: Fiber) => Effect.Effect - (self: Fiber, fiberId: FiberId.FiberId): Effect.Effect -} -``` - -Added in v2.0.0 - -## interruptFork - -Interrupts the fiber from whichever fiber is calling this method. The -interruption will happen in a separate daemon fiber, and the returned -effect will always resume immediately without waiting. - -**Signature** - -```ts -export declare const interruptFork: (self: Fiber) => Effect.Effect -``` - -Added in v2.0.0 - -# mapping - -## map - -Maps over the value the Fiber computes. - -**Signature** - -```ts -export declare const map: { - (f: (a: A) => B): (self: Fiber) => Fiber - (self: Fiber, f: (a: A) => B): Fiber -} -``` - -Added in v2.0.0 - -## mapEffect - -Effectually maps over the value the fiber computes. - -**Signature** - -```ts -export declare const mapEffect: { - (f: (a: A) => Effect.Effect): (self: Fiber) => Fiber - (self: Fiber, f: (a: A) => Effect.Effect): Fiber -} -``` - -Added in v2.0.0 - -## mapFiber - -Passes the success of this fiber to the specified callback, and continues -with the fiber that it returns. - -**Signature** - -```ts -export declare const mapFiber: { - (f: (a: A) => Fiber): (self: Fiber) => Effect.Effect> - (self: Fiber, f: (a: A) => Fiber): Effect.Effect> -} -``` - -Added in v2.0.0 - -# models - -## Fiber (interface) - -A fiber is a lightweight thread of execution that never consumes more than a -whole thread (but may consume much less, depending on contention and -asynchronicity). Fibers are spawned by forking effects, which run -concurrently with the parent effect. - -Fibers can be joined, yielding their result to other fibers, or interrupted, -which terminates the fiber, safely releasing all resources. - -**Signature** - -```ts -export interface Fiber extends Fiber.Variance, Pipeable { - /** - * The identity of the fiber. - */ - readonly id: () => FiberId.FiberId - - /** - * Awaits the fiber, which suspends the awaiting fiber until the result of the - * fiber has been determined. - */ - readonly await: Effect.Effect> - - /** - * Retrieves the immediate children of the fiber. - */ - readonly children: Effect.Effect>> - - /** - * Inherits values from all `FiberRef` instances into current fiber. This - * will resume immediately. - */ - readonly inheritAll: Effect.Effect - - /** - * Tentatively observes the fiber, but returns immediately if it is not - * already done. - */ - readonly poll: Effect.Effect>> - - /** - * In the background, interrupts the fiber as if interrupted from the - * specified fiber. If the fiber has already exited, the returned effect will - * resume immediately. Otherwise, the effect will resume when the fiber exits. - */ - readonly interruptAsFork: (fiberId: FiberId.FiberId) => Effect.Effect -} -``` - -Added in v2.0.0 - -## RuntimeFiber (interface) - -A runtime fiber that is executing an effect. Runtime fibers have an -identity and a trace. - -**Signature** - -```ts -export interface RuntimeFiber extends Fiber, Fiber.RuntimeVariance { - /** - * Reads the current number of ops that have occurred since the last yield - */ - get currentOpCount(): number - - /** - * Reads the current value of a fiber ref - */ - readonly getFiberRef: (fiberRef: FiberRef) => X - - /** - * The identity of the fiber. - */ - readonly id: () => FiberId.Runtime - - /** - * The status of the fiber. - */ - readonly status: Effect.Effect - - /** - * Returns the current `RuntimeFlags` the fiber is running with. - */ - readonly runtimeFlags: Effect.Effect - - /** - * Adds an observer to the list of observers. - */ - readonly addObserver: (observer: (exit: Exit.Exit) => void) => void - - /** - * Removes the specified observer from the list of observers that will be - * notified when the fiber exits. - */ - readonly removeObserver: (observer: (exit: Exit.Exit) => void) => void - - /** - * Retrieves all fiber refs of the fiber. - */ - readonly getFiberRefs: () => FiberRefs.FiberRefs - - /** - * Unsafely observes the fiber, but returns immediately if it is not - * already done. - */ - readonly unsafePoll: () => Exit.Exit | null -} -``` - -Added in v2.0.0 - -# refinements - -## isFiber - -Returns `true` if the specified value is a `Fiber`, `false` otherwise. - -**Signature** - -```ts -export declare const isFiber: (u: unknown) => u is Fiber -``` - -Added in v2.0.0 - -## isRuntimeFiber - -Returns `true` if the specified `Fiber` is a `RuntimeFiber`, `false` -otherwise. - -**Signature** - -```ts -export declare const isRuntimeFiber: (self: Fiber) => self is RuntimeFiber -``` - -Added in v2.0.0 - -# symbols - -## FiberTypeId - -**Signature** - -```ts -export declare const FiberTypeId: typeof FiberTypeId -``` - -Added in v2.0.0 - -## FiberTypeId (type alias) - -**Signature** - -```ts -export type FiberTypeId = typeof FiberTypeId -``` - -Added in v2.0.0 - -## RuntimeFiberTypeId - -**Signature** - -```ts -export declare const RuntimeFiberTypeId: typeof RuntimeFiberTypeId -``` - -Added in v2.0.0 - -## RuntimeFiberTypeId (type alias) - -**Signature** - -```ts -export type RuntimeFiberTypeId = typeof RuntimeFiberTypeId -``` - -Added in v2.0.0 - -# utilities - -## getCurrentFiber - -Gets the current fiber if one is running. - -**Signature** - -```ts -export declare const getCurrentFiber: () => Option.Option> -``` - -Added in v2.0.0 - -# utils - -## Fiber (namespace) - -Added in v2.0.0 - -### Descriptor (interface) - -A record containing information about a `Fiber`. - -**Signature** - -```ts -export interface Descriptor { - /** - * The fiber's unique identifier. - */ - readonly id: FiberId.FiberId - /** - * The status of the fiber. - */ - readonly status: FiberStatus.FiberStatus - /** - * The set of fibers attempting to interrupt the fiber or its ancestors. - */ - readonly interruptors: HashSet.HashSet -} -``` - -Added in v2.0.0 - -### Dump (interface) - -**Signature** - -```ts -export interface Dump { - /** - * The fiber's unique identifier. - */ - readonly id: FiberId.Runtime - /** - * The status of the fiber. - */ - readonly status: FiberStatus.FiberStatus -} -``` - -Added in v2.0.0 - -### RuntimeVariance (interface) - -**Signature** - -```ts -export interface RuntimeVariance { - readonly [RuntimeFiberTypeId]: { - readonly _E: (_: never) => E - readonly _A: (_: never) => A - } -} -``` - -Added in v2.0.0 - -### Variance (interface) - -**Signature** - -```ts -export interface Variance { - readonly [FiberTypeId]: { - readonly _E: (_: never) => E - readonly _A: (_: never) => A - } -} -``` - -Added in v2.0.0 - -### Runtime (type alias) - -**Signature** - -```ts -export type Runtime = RuntimeFiber -``` - -Added in v2.0.0 - -# zipping - -## zip - -Zips this fiber and the specified fiber together, producing a tuple of -their output. - -**Signature** - -```ts -export declare const zip: { - (that: Fiber): (self: Fiber) => Fiber - (self: Fiber, that: Fiber): Fiber -} -``` - -Added in v2.0.0 - -## zipLeft - -Same as `zip` but discards the output of that `Fiber`. - -**Signature** - -```ts -export declare const zipLeft: { - (that: Fiber): (self: Fiber) => Fiber - (self: Fiber, that: Fiber): Fiber -} -``` - -Added in v2.0.0 - -## zipRight - -Same as `zip` but discards the output of this `Fiber`. - -**Signature** - -```ts -export declare const zipRight: { - (that: Fiber): (self: Fiber) => Fiber - (self: Fiber, that: Fiber): Fiber -} -``` - -Added in v2.0.0 - -## zipWith - -Zips this fiber with the specified fiber, combining their results using the -specified combiner function. Both joins and interruptions are performed in -sequential order from left to right. - -**Signature** - -```ts -export declare const zipWith: { - (that: Fiber, f: (a: A, b: B) => C): (self: Fiber) => Fiber - (self: Fiber, that: Fiber, f: (a: A, b: B) => C): Fiber -} -``` - -Added in v2.0.0 diff --git a/docs/modules/FiberId.ts.md b/docs/modules/FiberId.ts.md deleted file mode 100644 index d6920aab3..000000000 --- a/docs/modules/FiberId.ts.md +++ /dev/null @@ -1,320 +0,0 @@ ---- -title: FiberId.ts -nav_order: 32 -parent: Modules ---- - -## FiberId overview - -Added in v2.0.0 - ---- - -

Table of contents

- -- [constructors](#constructors) - - [combine](#combine) - - [combineAll](#combineall) - - [composite](#composite) - - [make](#make) - - [none](#none) - - [runtime](#runtime) -- [destructors](#destructors) - - [ids](#ids) - - [threadName](#threadname) - - [toOption](#tooption) - - [toSet](#toset) -- [models](#models) - - [Composite (interface)](#composite-interface) - - [FiberId (type alias)](#fiberid-type-alias) - - [None (interface)](#none-interface) - - [Runtime (interface)](#runtime-interface) -- [refinements](#refinements) - - [isComposite](#iscomposite) - - [isFiberId](#isfiberid) - - [isNone](#isnone) - - [isRuntime](#isruntime) -- [symbols](#symbols) - - [FiberIdTypeId](#fiberidtypeid) - - [FiberIdTypeId (type alias)](#fiberidtypeid-type-alias) -- [unsafe](#unsafe) - - [unsafeMake](#unsafemake) -- [utils](#utils) - - [getOrElse](#getorelse) - ---- - -# constructors - -## combine - -Combine two `FiberId`s. - -**Signature** - -```ts -export declare const combine: { (that: FiberId): (self: FiberId) => FiberId; (self: FiberId, that: FiberId): FiberId } -``` - -Added in v2.0.0 - -## combineAll - -Combines a set of `FiberId`s into a single `FiberId`. - -**Signature** - -```ts -export declare const combineAll: (fiberIds: HashSet.HashSet) => FiberId -``` - -Added in v2.0.0 - -## composite - -**Signature** - -```ts -export declare const composite: (left: FiberId, right: FiberId) => FiberId -``` - -Added in v2.0.0 - -## make - -Creates a new `FiberId`. - -**Signature** - -```ts -export declare const make: (id: number, startTimeSeconds: number) => FiberId -``` - -Added in v2.0.0 - -## none - -**Signature** - -```ts -export declare const none: FiberId -``` - -Added in v2.0.0 - -## runtime - -**Signature** - -```ts -export declare const runtime: (id: number, startTimeMillis: number) => FiberId -``` - -Added in v2.0.0 - -# destructors - -## ids - -Get the set of identifiers for this `FiberId`. - -**Signature** - -```ts -export declare const ids: (self: FiberId) => HashSet.HashSet -``` - -Added in v2.0.0 - -## threadName - -Creates a string representing the name of the current thread of execution -represented by the specified `FiberId`. - -**Signature** - -```ts -export declare const threadName: (self: FiberId) => string -``` - -Added in v2.0.0 - -## toOption - -Convert a `FiberId` into an `Option`. - -**Signature** - -```ts -export declare const toOption: (self: FiberId) => Option.Option -``` - -Added in v2.0.0 - -## toSet - -Convert a `FiberId` into a `HashSet`. - -**Signature** - -```ts -export declare const toSet: (self: FiberId) => HashSet.HashSet -``` - -Added in v2.0.0 - -# models - -## Composite (interface) - -**Signature** - -```ts -export interface Composite extends Equal.Equal, Inspectable { - readonly [FiberIdTypeId]: FiberIdTypeId - readonly _tag: "Composite" - readonly left: FiberId - readonly right: FiberId -} -``` - -Added in v2.0.0 - -## FiberId (type alias) - -**Signature** - -```ts -export type FiberId = None | Runtime | Composite -``` - -Added in v2.0.0 - -## None (interface) - -**Signature** - -```ts -export interface None extends Equal.Equal, Inspectable { - readonly [FiberIdTypeId]: FiberIdTypeId - readonly _tag: "None" -} -``` - -Added in v2.0.0 - -## Runtime (interface) - -**Signature** - -```ts -export interface Runtime extends Equal.Equal, Inspectable { - readonly [FiberIdTypeId]: FiberIdTypeId - readonly _tag: "Runtime" - readonly id: number - readonly startTimeMillis: number -} -``` - -Added in v2.0.0 - -# refinements - -## isComposite - -Returns `true` if the `FiberId` is a `Composite`, `false` otherwise. - -**Signature** - -```ts -export declare const isComposite: (self: FiberId) => self is Composite -``` - -Added in v2.0.0 - -## isFiberId - -Returns `true` if the specified unknown value is a `FiberId`, `false` -otherwise. - -**Signature** - -```ts -export declare const isFiberId: (self: unknown) => self is FiberId -``` - -Added in v2.0.0 - -## isNone - -Returns `true` if the `FiberId` is a `None`, `false` otherwise. - -**Signature** - -```ts -export declare const isNone: (self: FiberId) => self is None -``` - -Added in v2.0.0 - -## isRuntime - -Returns `true` if the `FiberId` is a `Runtime`, `false` otherwise. - -**Signature** - -```ts -export declare const isRuntime: (self: FiberId) => self is Runtime -``` - -Added in v2.0.0 - -# symbols - -## FiberIdTypeId - -**Signature** - -```ts -export declare const FiberIdTypeId: typeof FiberIdTypeId -``` - -Added in v2.0.0 - -## FiberIdTypeId (type alias) - -**Signature** - -```ts -export type FiberIdTypeId = typeof FiberIdTypeId -``` - -Added in v2.0.0 - -# unsafe - -## unsafeMake - -Unsafely creates a new `FiberId`. - -**Signature** - -```ts -export declare const unsafeMake: (_: void) => Runtime -``` - -Added in v2.0.0 - -# utils - -## getOrElse - -Returns this `FiberId` if it is not `None`, otherwise returns that `FiberId`. - -**Signature** - -```ts -export declare const getOrElse: { (that: FiberId): (self: FiberId) => FiberId; (self: FiberId, that: FiberId): FiberId } -``` - -Added in v2.0.0 diff --git a/docs/modules/FiberRef.ts.md b/docs/modules/FiberRef.ts.md deleted file mode 100644 index 897f511d8..000000000 --- a/docs/modules/FiberRef.ts.md +++ /dev/null @@ -1,631 +0,0 @@ ---- -title: FiberRef.ts -nav_order: 33 -parent: Modules ---- - -## FiberRef overview - -Added in v2.0.0 - ---- - -

Table of contents

- -- [constructors](#constructors) - - [make](#make) - - [makeContext](#makecontext) - - [makeRuntimeFlags](#makeruntimeflags) - - [makeWith](#makewith) - - [unsafeMake](#unsafemake) - - [unsafeMakeContext](#unsafemakecontext) - - [unsafeMakeHashSet](#unsafemakehashset) - - [unsafeMakePatch](#unsafemakepatch) - - [unsafeMakeSupervisor](#unsafemakesupervisor) -- [fiberRefs](#fiberrefs) - - [currentContext](#currentcontext) - - [currentLogAnnotations](#currentlogannotations) - - [currentLogLevel](#currentloglevel) - - [currentLogSpan](#currentlogspan) - - [currentLoggers](#currentloggers) - - [currentMaxOpsBeforeYield](#currentmaxopsbeforeyield) - - [currentMetricLabels](#currentmetriclabels) - - [currentMinimumLogLevel](#currentminimumloglevel) - - [currentRequestBatchingEnabled](#currentrequestbatchingenabled) - - [currentRequestCache](#currentrequestcache) - - [currentRequestCacheEnabled](#currentrequestcacheenabled) - - [currentRuntimeFlags](#currentruntimeflags) - - [currentScheduler](#currentscheduler) - - [currentSchedulingPriority](#currentschedulingpriority) - - [currentSupervisor](#currentsupervisor) - - [currentTracerSpanAnnotations](#currenttracerspanannotations) - - [currentTracerSpanLinks](#currenttracerspanlinks) - - [currentTracerTimingEnabled](#currenttracertimingenabled) - - [interruptedCause](#interruptedcause) - - [unhandledErrorLogLevel](#unhandlederrorloglevel) -- [getters](#getters) - - [get](#get) -- [model](#model) - - [FiberRef (interface)](#fiberref-interface) -- [models](#models) - - [Variance (interface)](#variance-interface) -- [symbols](#symbols) - - [FiberRefTypeId](#fiberreftypeid) - - [FiberRefTypeId (type alias)](#fiberreftypeid-type-alias) -- [utils](#utils) - - [delete](#delete) - - [getAndSet](#getandset) - - [getAndUpdate](#getandupdate) - - [getAndUpdateSome](#getandupdatesome) - - [getWith](#getwith) - - [modify](#modify) - - [modifySome](#modifysome) - - [reset](#reset) - - [set](#set) - - [update](#update) - - [updateAndGet](#updateandget) - - [updateSome](#updatesome) - - [updateSomeAndGet](#updatesomeandget) - ---- - -# constructors - -## make - -**Signature** - -```ts -export declare const make:
( - initial: A, - options?: - | { readonly fork?: ((a: A) => A) | undefined; readonly join?: ((left: A, right: A) => A) | undefined } - | undefined -) => Effect.Effect> -``` - -Added in v2.0.0 - -## makeContext - -**Signature** - -```ts -export declare const makeContext: ( - initial: Context.Context -) => Effect.Effect>> -``` - -Added in v2.0.0 - -## makeRuntimeFlags - -**Signature** - -```ts -export declare const makeRuntimeFlags: ( - initial: RuntimeFlags.RuntimeFlags -) => Effect.Effect> -``` - -Added in v2.0.0 - -## makeWith - -**Signature** - -```ts -export declare const makeWith: ( - ref: LazyArg> -) => Effect.Effect> -``` - -Added in v2.0.0 - -## unsafeMake - -**Signature** - -```ts -export declare const unsafeMake: ( - initial: Value, - options?: - | { - readonly fork?: ((a: Value) => Value) | undefined - readonly join?: ((left: Value, right: Value) => Value) | undefined - } - | undefined -) => FiberRef -``` - -Added in v2.0.0 - -## unsafeMakeContext - -**Signature** - -```ts -export declare const unsafeMakeContext: (initial: Context.Context) => FiberRef> -``` - -Added in v2.0.0 - -## unsafeMakeHashSet - -**Signature** - -```ts -export declare const unsafeMakeHashSet: (initial: HashSet.HashSet) => FiberRef> -``` - -Added in v2.0.0 - -## unsafeMakePatch - -**Signature** - -```ts -export declare const unsafeMakePatch: ( - initial: Value, - options: { - readonly differ: Differ.Differ - readonly fork: Patch - readonly join?: ((oldV: Value, newV: Value) => Value) | undefined - } -) => FiberRef -``` - -Added in v2.0.0 - -## unsafeMakeSupervisor - -**Signature** - -```ts -export declare const unsafeMakeSupervisor: (initial: Supervisor.Supervisor) => FiberRef> -``` - -Added in v2.0.0 - -# fiberRefs - -## currentContext - -**Signature** - -```ts -export declare const currentContext: FiberRef> -``` - -Added in v2.0.0 - -## currentLogAnnotations - -**Signature** - -```ts -export declare const currentLogAnnotations: FiberRef> -``` - -Added in v2.0.0 - -## currentLogLevel - -**Signature** - -```ts -export declare const currentLogLevel: FiberRef -``` - -Added in v2.0.0 - -## currentLogSpan - -**Signature** - -```ts -export declare const currentLogSpan: FiberRef> -``` - -Added in v2.0.0 - -## currentLoggers - -**Signature** - -```ts -export declare const currentLoggers: FiberRef>> -``` - -Added in v2.0.0 - -## currentMaxOpsBeforeYield - -**Signature** - -```ts -export declare const currentMaxOpsBeforeYield: FiberRef -``` - -Added in v2.0.0 - -## currentMetricLabels - -**Signature** - -```ts -export declare const currentMetricLabels: FiberRef> -``` - -Added in v2.0.0 - -## currentMinimumLogLevel - -**Signature** - -```ts -export declare const currentMinimumLogLevel: FiberRef -``` - -Added in v2.0.0 - -## currentRequestBatchingEnabled - -**Signature** - -```ts -export declare const currentRequestBatchingEnabled: FiberRef -``` - -Added in v2.0.0 - -## currentRequestCache - -**Signature** - -```ts -export declare const currentRequestCache: FiberRef -``` - -Added in v2.0.0 - -## currentRequestCacheEnabled - -**Signature** - -```ts -export declare const currentRequestCacheEnabled: FiberRef -``` - -Added in v2.0.0 - -## currentRuntimeFlags - -**Signature** - -```ts -export declare const currentRuntimeFlags: FiberRef -``` - -Added in v2.0.0 - -## currentScheduler - -**Signature** - -```ts -export declare const currentScheduler: FiberRef -``` - -Added in v2.0.0 - -## currentSchedulingPriority - -**Signature** - -```ts -export declare const currentSchedulingPriority: FiberRef -``` - -Added in v2.0.0 - -## currentSupervisor - -**Signature** - -```ts -export declare const currentSupervisor: FiberRef> -``` - -Added in v2.0.0 - -## currentTracerSpanAnnotations - -**Signature** - -```ts -export declare const currentTracerSpanAnnotations: FiberRef> -``` - -Added in v2.0.0 - -## currentTracerSpanLinks - -**Signature** - -```ts -export declare const currentTracerSpanLinks: FiberRef> -``` - -Added in v2.0.0 - -## currentTracerTimingEnabled - -**Signature** - -```ts -export declare const currentTracerTimingEnabled: FiberRef -``` - -Added in v2.0.0 - -## interruptedCause - -**Signature** - -```ts -export declare const interruptedCause: FiberRef> -``` - -Added in v2.0.0 - -## unhandledErrorLogLevel - -**Signature** - -```ts -export declare const unhandledErrorLogLevel: FiberRef> -``` - -Added in v2.0.0 - -# getters - -## get - -**Signature** - -```ts -export declare const get: (self: FiberRef) => Effect.Effect -``` - -Added in v2.0.0 - -# model - -## FiberRef (interface) - -**Signature** - -```ts -export interface FiberRef extends Variance, Pipeable { - /** @internal */ - readonly initial: A - /** @internal */ - readonly diff: (oldValue: A, newValue: A) => unknown - /** @internal */ - readonly combine: (first: unknown, second: unknown) => unknown - /** @internal */ - readonly patch: (patch: unknown) => (oldValue: A) => A - /** @internal */ - readonly fork: unknown - /** @internal */ - readonly join: (oldValue: A, newValue: A) => A -} -``` - -Added in v2.0.0 - -# models - -## Variance (interface) - -**Signature** - -```ts -export interface Variance { - readonly [FiberRefTypeId]: { - readonly _A: (_: never) => A - } -} -``` - -Added in v2.0.0 - -# symbols - -## FiberRefTypeId - -**Signature** - -```ts -export declare const FiberRefTypeId: typeof FiberRefTypeId -``` - -Added in v2.0.0 - -## FiberRefTypeId (type alias) - -**Signature** - -```ts -export type FiberRefTypeId = typeof FiberRefTypeId -``` - -Added in v2.0.0 - -# utils - -## delete - -**Signature** - -```ts -export declare const delete: (self: FiberRef) => Effect.Effect -``` - -Added in v2.0.0 - -## getAndSet - -**Signature** - -```ts -export declare const getAndSet: { - (value: A): (self: FiberRef) => Effect.Effect - (self: FiberRef, value: A): Effect.Effect -} -``` - -Added in v2.0.0 - -## getAndUpdate - -**Signature** - -```ts -export declare const getAndUpdate: { - (f: (a: A) => A): (self: FiberRef) => Effect.Effect - (self: FiberRef, f: (a: A) => A): Effect.Effect -} -``` - -Added in v2.0.0 - -## getAndUpdateSome - -**Signature** - -```ts -export declare const getAndUpdateSome: { - (pf: (a: A) => Option.Option): (self: FiberRef) => Effect.Effect - (self: FiberRef, pf: (a: A) => Option.Option): Effect.Effect -} -``` - -Added in v2.0.0 - -## getWith - -**Signature** - -```ts -export declare const getWith: { - (f: (a: A) => Effect.Effect): (self: FiberRef) => Effect.Effect - (self: FiberRef, f: (a: A) => Effect.Effect): Effect.Effect -} -``` - -Added in v2.0.0 - -## modify - -**Signature** - -```ts -export declare const modify: { - (f: (a: A) => readonly [B, A]): (self: FiberRef) => Effect.Effect - (self: FiberRef, f: (a: A) => readonly [B, A]): Effect.Effect -} -``` - -Added in v2.0.0 - -## modifySome - -**Signature** - -```ts -export declare const modifySome: ( - self: FiberRef, - def: B, - f: (a: A) => Option.Option -) => Effect.Effect -``` - -Added in v2.0.0 - -## reset - -**Signature** - -```ts -export declare const reset: (self: FiberRef) => Effect.Effect -``` - -Added in v2.0.0 - -## set - -**Signature** - -```ts -export declare const set: { - (value: A): (self: FiberRef) => Effect.Effect - (self: FiberRef, value: A): Effect.Effect -} -``` - -Added in v2.0.0 - -## update - -**Signature** - -```ts -export declare const update: { - (f: (a: A) => A): (self: FiberRef) => Effect.Effect - (self: FiberRef, f: (a: A) => A): Effect.Effect -} -``` - -Added in v2.0.0 - -## updateAndGet - -**Signature** - -```ts -export declare const updateAndGet: { - (f: (a: A) => A): (self: FiberRef) => Effect.Effect - (self: FiberRef, f: (a: A) => A): Effect.Effect -} -``` - -Added in v2.0.0 - -## updateSome - -**Signature** - -```ts -export declare const updateSome: { - (pf: (a: A) => Option.Option): (self: FiberRef) => Effect.Effect - (self: FiberRef, pf: (a: A) => Option.Option): Effect.Effect -} -``` - -Added in v2.0.0 - -## updateSomeAndGet - -**Signature** - -```ts -export declare const updateSomeAndGet: { - (pf: (a: A) => Option.Option): (self: FiberRef) => Effect.Effect - (self: FiberRef, pf: (a: A) => Option.Option): Effect.Effect -} -``` - -Added in v2.0.0 diff --git a/docs/modules/FiberRefs.ts.md b/docs/modules/FiberRefs.ts.md deleted file mode 100644 index daefe7a8b..000000000 --- a/docs/modules/FiberRefs.ts.md +++ /dev/null @@ -1,235 +0,0 @@ ---- -title: FiberRefs.ts -nav_order: 34 -parent: Modules ---- - -## FiberRefs overview - -Added in v2.0.0 - ---- - -

Table of contents

- -- [constructors](#constructors) - - [empty](#empty) -- [getters](#getters) - - [fiberRefs](#fiberrefs) - - [get](#get) - - [getOrDefault](#getordefault) -- [models](#models) - - [FiberRefs (interface)](#fiberrefs-interface) -- [symbols](#symbols) - - [FiberRefsSym](#fiberrefssym) - - [FiberRefsSym (type alias)](#fiberrefssym-type-alias) -- [unsafe](#unsafe) - - [unsafeMake](#unsafemake) -- [utils](#utils) - - [delete](#delete) - - [forkAs](#forkas) - - [joinAs](#joinas) - - [setAll](#setall) - - [updatedAs](#updatedas) - ---- - -# constructors - -## empty - -The empty collection of `FiberRef` values. - -**Signature** - -```ts -export declare const empty: () => FiberRefs -``` - -Added in v2.0.0 - -# getters - -## fiberRefs - -Returns a set of each `FiberRef` in this collection. - -**Signature** - -```ts -export declare const fiberRefs: (self: FiberRefs) => HashSet.HashSet> -``` - -Added in v2.0.0 - -## get - -Gets the value of the specified `FiberRef` in this collection of `FiberRef` -values if it exists or `None` otherwise. - -**Signature** - -```ts -export declare const get: { -
(fiberRef: FiberRef.FiberRef): (self: FiberRefs) => Option.Option - (self: FiberRefs, fiberRef: FiberRef.FiberRef): Option.Option -} -``` - -Added in v2.0.0 - -## getOrDefault - -Gets the value of the specified `FiberRef` in this collection of `FiberRef` -values if it exists or the `initial` value of the `FiberRef` otherwise. - -**Signature** - -```ts -export declare const getOrDefault: { - (fiberRef: FiberRef.FiberRef): (self: FiberRefs) => A - (self: FiberRefs, fiberRef: FiberRef.FiberRef): A -} -``` - -Added in v2.0.0 - -# models - -## FiberRefs (interface) - -`FiberRefs` is a data type that represents a collection of `FiberRef` values. - -This allows safely propagating `FiberRef` values across fiber boundaries, for -example between an asynchronous producer and consumer. - -**Signature** - -```ts -export interface FiberRefs extends Pipeable { - readonly [FiberRefsSym]: FiberRefsSym - readonly locals: Map, Arr.NonEmptyReadonlyArray> -} -``` - -Added in v2.0.0 - -# symbols - -## FiberRefsSym - -**Signature** - -```ts -export declare const FiberRefsSym: typeof FiberRefsSym -``` - -Added in v2.0.0 - -## FiberRefsSym (type alias) - -**Signature** - -```ts -export type FiberRefsSym = typeof FiberRefsSym -``` - -Added in v2.0.0 - -# unsafe - -## unsafeMake - -Note: it will not copy the provided Map, make sure to provide a fresh one. - -**Signature** - -```ts -export declare const unsafeMake: ( - fiberRefLocals: Map, Arr.NonEmptyReadonlyArray> -) => FiberRefs -``` - -Added in v2.0.0 - -# utils - -## delete - -Deletes the specified `FiberRef` from the `FibterRefs`. - -**Signature** - -```ts -export declare const delete: { (fiberRef: FiberRef.FiberRef): (self: FiberRefs) => FiberRefs; (self: FiberRefs, fiberRef: FiberRef.FiberRef): FiberRefs; } -``` - -Added in v2.0.0 - -## forkAs - -Forks this collection of fiber refs as the specified child fiber id. This -will potentially modify the value of the fiber refs, as determined by the -individual fiber refs that make up the collection. - -**Signature** - -```ts -export declare const forkAs: { - (childId: FiberId.Runtime): (self: FiberRefs) => FiberRefs - (self: FiberRefs, childId: FiberId.Runtime): FiberRefs -} -``` - -Added in v2.0.0 - -## joinAs - -Joins this collection of fiber refs to the specified collection, as the -specified fiber id. This will perform diffing and merging to ensure -preservation of maximum information from both child and parent refs. - -**Signature** - -```ts -export declare const joinAs: { - (fiberId: FiberId.Runtime, that: FiberRefs): (self: FiberRefs) => FiberRefs - (self: FiberRefs, fiberId: FiberId.Runtime, that: FiberRefs): FiberRefs -} -``` - -Added in v2.0.0 - -## setAll - -Set each ref to either its value or its default. - -**Signature** - -```ts -export declare const setAll: (self: FiberRefs) => Effect.Effect -``` - -Added in v2.0.0 - -## updatedAs - -Updates the value of the specified `FiberRef` using the provided `FiberId` - -**Signature** - -```ts -export declare const updatedAs: { - (options: { - readonly fiberId: FiberId.Runtime - readonly fiberRef: FiberRef.FiberRef - readonly value: A - }): (self: FiberRefs) => FiberRefs - ( - self: FiberRefs, - options: { readonly fiberId: FiberId.Runtime; readonly fiberRef: FiberRef.FiberRef; readonly value: A } - ): FiberRefs -} -``` - -Added in v2.0.0 diff --git a/docs/modules/FiberRefsPatch.ts.md b/docs/modules/FiberRefsPatch.ts.md deleted file mode 100644 index a7ef7196f..000000000 --- a/docs/modules/FiberRefsPatch.ts.md +++ /dev/null @@ -1,173 +0,0 @@ ---- -title: FiberRefsPatch.ts -nav_order: 35 -parent: Modules ---- - -## FiberRefsPatch overview - -Added in v2.0.0 - ---- - -

Table of contents

- -- [constructors](#constructors) - - [combine](#combine) - - [diff](#diff) - - [empty](#empty) -- [destructors](#destructors) - - [patch](#patch) -- [models](#models) - - [Add (interface)](#add-interface) - - [AndThen (interface)](#andthen-interface) - - [Empty (interface)](#empty-interface) - - [FiberRefsPatch (type alias)](#fiberrefspatch-type-alias) - - [Remove (interface)](#remove-interface) - - [Update (interface)](#update-interface) - ---- - -# constructors - -## combine - -Combines this patch and the specified patch to create a new patch that -describes applying the changes from this patch and the specified patch -sequentially. - -**Signature** - -```ts -export declare const combine: { - (that: FiberRefsPatch): (self: FiberRefsPatch) => FiberRefsPatch - (self: FiberRefsPatch, that: FiberRefsPatch): FiberRefsPatch -} -``` - -Added in v2.0.0 - -## diff - -Constructs a patch that describes the changes between the specified -collections of `FiberRef` - -**Signature** - -```ts -export declare const diff: (oldValue: FiberRefs.FiberRefs, newValue: FiberRefs.FiberRefs) => FiberRefsPatch -``` - -Added in v2.0.0 - -## empty - -**Signature** - -```ts -export declare const empty: FiberRefsPatch -``` - -Added in v2.0.0 - -# destructors - -## patch - -Applies the changes described by this patch to the specified collection -of `FiberRef` values. - -**Signature** - -```ts -export declare const patch: { - (fiberId: FiberId.Runtime, oldValue: FiberRefs.FiberRefs): (self: FiberRefsPatch) => FiberRefs.FiberRefs - (self: FiberRefsPatch, fiberId: FiberId.Runtime, oldValue: FiberRefs.FiberRefs): FiberRefs.FiberRefs -} -``` - -Added in v2.0.0 - -# models - -## Add (interface) - -**Signature** - -```ts -export interface Add { - readonly _tag: "Add" - readonly fiberRef: FiberRef.FiberRef - readonly value: unknown -} -``` - -Added in v2.0.0 - -## AndThen (interface) - -**Signature** - -```ts -export interface AndThen { - readonly _tag: "AndThen" - readonly first: FiberRefsPatch - readonly second: FiberRefsPatch -} -``` - -Added in v2.0.0 - -## Empty (interface) - -**Signature** - -```ts -export interface Empty { - readonly _tag: "Empty" -} -``` - -Added in v2.0.0 - -## FiberRefsPatch (type alias) - -A `FiberRefsPatch` captures the changes in `FiberRef` values made by a single -fiber as a value. This allows fibers to apply the changes made by a workflow -without inheriting all the `FiberRef` values of the fiber that executed the -workflow. - -**Signature** - -```ts -export type FiberRefsPatch = Empty | Add | Remove | Update | AndThen -``` - -Added in v2.0.0 - -## Remove (interface) - -**Signature** - -```ts -export interface Remove { - readonly _tag: "Remove" - readonly fiberRef: FiberRef.FiberRef -} -``` - -Added in v2.0.0 - -## Update (interface) - -**Signature** - -```ts -export interface Update { - readonly _tag: "Update" - readonly fiberRef: FiberRef.FiberRef - readonly patch: unknown -} -``` - -Added in v2.0.0 diff --git a/docs/modules/FiberStatus.ts.md b/docs/modules/FiberStatus.ts.md deleted file mode 100644 index 1358116fd..000000000 --- a/docs/modules/FiberStatus.ts.md +++ /dev/null @@ -1,193 +0,0 @@ ---- -title: FiberStatus.ts -nav_order: 36 -parent: Modules ---- - -## FiberStatus overview - -Added in v2.0.0 - ---- - -

Table of contents

- -- [constructors](#constructors) - - [done](#done) - - [running](#running) - - [suspended](#suspended) -- [models](#models) - - [Done (interface)](#done-interface) - - [FiberStatus (type alias)](#fiberstatus-type-alias) - - [Running (interface)](#running-interface) - - [Suspended (interface)](#suspended-interface) -- [refinements](#refinements) - - [isDone](#isdone) - - [isFiberStatus](#isfiberstatus) - - [isRunning](#isrunning) - - [isSuspended](#issuspended) -- [symbols](#symbols) - - [FiberStatusTypeId](#fiberstatustypeid) - - [FiberStatusTypeId (type alias)](#fiberstatustypeid-type-alias) - ---- - -# constructors - -## done - -**Signature** - -```ts -export declare const done: FiberStatus -``` - -Added in v2.0.0 - -## running - -**Signature** - -```ts -export declare const running: (runtimeFlags: RuntimeFlags.RuntimeFlags) => FiberStatus -``` - -Added in v2.0.0 - -## suspended - -**Signature** - -```ts -export declare const suspended: (runtimeFlags: RuntimeFlags.RuntimeFlags, blockingOn: FiberId.FiberId) => FiberStatus -``` - -Added in v2.0.0 - -# models - -## Done (interface) - -**Signature** - -```ts -export interface Done extends Equal.Equal { - readonly _tag: "Done" - readonly [FiberStatusTypeId]: FiberStatusTypeId -} -``` - -Added in v2.0.0 - -## FiberStatus (type alias) - -**Signature** - -```ts -export type FiberStatus = Done | Running | Suspended -``` - -Added in v2.0.0 - -## Running (interface) - -**Signature** - -```ts -export interface Running extends Equal.Equal { - readonly _tag: "Running" - readonly [FiberStatusTypeId]: FiberStatusTypeId - readonly runtimeFlags: RuntimeFlags.RuntimeFlags -} -``` - -Added in v2.0.0 - -## Suspended (interface) - -**Signature** - -```ts -export interface Suspended extends Equal.Equal { - readonly _tag: "Suspended" - readonly [FiberStatusTypeId]: FiberStatusTypeId - readonly runtimeFlags: RuntimeFlags.RuntimeFlags - readonly blockingOn: FiberId.FiberId -} -``` - -Added in v2.0.0 - -# refinements - -## isDone - -Returns `true` if the specified `FiberStatus` is `Done`, `false` otherwise. - -**Signature** - -```ts -export declare const isDone: (self: FiberStatus) => self is Done -``` - -Added in v2.0.0 - -## isFiberStatus - -Returns `true` if the specified value is a `FiberStatus`, `false` otherwise. - -**Signature** - -```ts -export declare const isFiberStatus: (u: unknown) => u is FiberStatus -``` - -Added in v2.0.0 - -## isRunning - -Returns `true` if the specified `FiberStatus` is `Running`, `false` -otherwise. - -**Signature** - -```ts -export declare const isRunning: (self: FiberStatus) => self is Running -``` - -Added in v2.0.0 - -## isSuspended - -Returns `true` if the specified `FiberStatus` is `Suspended`, `false` -otherwise. - -**Signature** - -```ts -export declare const isSuspended: (self: FiberStatus) => self is Suspended -``` - -Added in v2.0.0 - -# symbols - -## FiberStatusTypeId - -**Signature** - -```ts -export declare const FiberStatusTypeId: typeof FiberStatusTypeId -``` - -Added in v2.0.0 - -## FiberStatusTypeId (type alias) - -**Signature** - -```ts -export type FiberStatusTypeId = typeof FiberStatusTypeId -``` - -Added in v2.0.0 diff --git a/docs/modules/Function.ts.md b/docs/modules/Function.ts.md deleted file mode 100644 index cd026571f..000000000 --- a/docs/modules/Function.ts.md +++ /dev/null @@ -1,859 +0,0 @@ ---- -title: Function.ts -nav_order: 37 -parent: Modules ---- - -## Function overview - -Added in v2.0.0 - ---- - -

Table of contents

- -- [guards](#guards) - - [isFunction](#isfunction) -- [type lambdas](#type-lambdas) - - [FunctionTypeLambda (interface)](#functiontypelambda-interface) -- [utils](#utils) - - [FunctionN (interface)](#functionn-interface) - - [LazyArg (interface)](#lazyarg-interface) - - [SK](#sk) - - [absurd](#absurd) - - [apply](#apply) - - [compose](#compose) - - [constFalse](#constfalse) - - [constNull](#constnull) - - [constTrue](#consttrue) - - [constUndefined](#constundefined) - - [constVoid](#constvoid) - - [constant](#constant) - - [dual](#dual) - - [flip](#flip) - - [flow](#flow) - - [hole](#hole) - - [identity](#identity) - - [pipe](#pipe) - - [tupled](#tupled) - - [unsafeCoerce](#unsafecoerce) - - [untupled](#untupled) - ---- - -# guards - -## isFunction - -Tests if a value is a `function`. - -**Signature** - -```ts -export declare const isFunction: (input: unknown) => input is Function -``` - -**Example** - -```ts -import { isFunction } from "effect/Predicate" - -assert.deepStrictEqual(isFunction(isFunction), true) -assert.deepStrictEqual(isFunction("function"), false) -``` - -Added in v2.0.0 - -# type lambdas - -## FunctionTypeLambda (interface) - -**Signature** - -```ts -export interface FunctionTypeLambda extends TypeLambda { - readonly type: (a: this["In"]) => this["Target"] -} -``` - -Added in v2.0.0 - -# utils - -## FunctionN (interface) - -**Signature** - -```ts -export interface FunctionN
, B> { - (...args: A): B -} -``` - -**Example** - -```ts -import { FunctionN } from "effect/Function" - -const sum: FunctionN<[number, number], number> = (a, b) => a + b -``` - -Added in v2.0.0 - -## LazyArg (interface) - -A lazy argument. - -**Signature** - -```ts -export interface LazyArg { - (): A -} -``` - -**Example** - -```ts -import { LazyArg, constant } from "effect/Function" - -const constNull: LazyArg = constant(null) -``` - -Added in v2.0.0 - -## SK - -The SK combinator, also known as the "S-K combinator" or "S-combinator", is a fundamental combinator in the -lambda calculus and the SKI combinator calculus. - -This function is useful for discarding the first argument passed to it and returning the second argument. - -**Signature** - -```ts -export declare const SK: (_: A, b: B) => B -``` - -**Example** - -```ts -import { SK } from "effect/Function" - -assert.deepStrictEqual(SK(0, "hello"), "hello") -``` - -Added in v2.0.0 - -## absurd - -The `absurd` function is a stub for cases where a value of type `never` is encountered in your code, -meaning that it should be impossible for this code to be executed. - -This function is particularly when it's necessary to specify that certain cases are impossible. - -**Signature** - -```ts -export declare const absurd: (_: never) => A -``` - -Added in v2.0.0 - -## apply - -Apply a function to a given value. - -**Signature** - -```ts -export declare const apply: (a: A) => (self: (a: A) => B) => B -``` - -**Example** - -```ts -import { pipe, apply } from "effect/Function" -import { length } from "effect/String" - -assert.deepStrictEqual(pipe(length, apply("hello")), 5) -``` - -Added in v2.0.0 - -## compose - -Composes two functions, `ab` and `bc` into a single function that takes in an argument `a` of type `A` and returns a result of type `C`. -The result is obtained by first applying the `ab` function to `a` and then applying the `bc` function to the result of `ab`. - -**Signature** - -```ts -export declare const compose: { - (bc: (b: B) => C): (self: (a: A) => B) => (a: A) => C - (self: (a: A) => B, bc: (b: B) => C): (a: A) => C -} -``` - -**Example** - -```ts -import { compose } from "effect/Function" - -const increment = (n: number) => n + 1 -const square = (n: number) => n * n - -assert.strictEqual(compose(increment, square)(2), 9) -``` - -Added in v2.0.0 - -## constFalse - -A thunk that returns always `false`. - -**Signature** - -```ts -export declare const constFalse: LazyArg -``` - -**Example** - -```ts -import { constFalse } from "effect/Function" - -assert.deepStrictEqual(constFalse(), false) -``` - -Added in v2.0.0 - -## constNull - -A thunk that returns always `null`. - -**Signature** - -```ts -export declare const constNull: LazyArg -``` - -**Example** - -```ts -import { constNull } from "effect/Function" - -assert.deepStrictEqual(constNull(), null) -``` - -Added in v2.0.0 - -## constTrue - -A thunk that returns always `true`. - -**Signature** - -```ts -export declare const constTrue: LazyArg -``` - -**Example** - -```ts -import { constTrue } from "effect/Function" - -assert.deepStrictEqual(constTrue(), true) -``` - -Added in v2.0.0 - -## constUndefined - -A thunk that returns always `undefined`. - -**Signature** - -```ts -export declare const constUndefined: LazyArg -``` - -**Example** - -```ts -import { constUndefined } from "effect/Function" - -assert.deepStrictEqual(constUndefined(), undefined) -``` - -Added in v2.0.0 - -## constVoid - -A thunk that returns always `void`. - -**Signature** - -```ts -export declare const constVoid: LazyArg -``` - -**Example** - -```ts -import { constVoid } from "effect/Function" - -assert.deepStrictEqual(constVoid(), undefined) -``` - -Added in v2.0.0 - -## constant - -Creates a constant value that never changes. - -This is useful when you want to pass a value to a higher-order function (a function that takes another function as its argument) -and want that inner function to always use the same value, no matter how many times it is called. - -**Signature** - -```ts -export declare const constant: (value: A) => LazyArg -``` - -**Example** - -```ts -import { constant } from "effect/Function" - -const constNull = constant(null) - -assert.deepStrictEqual(constNull(), null) -assert.deepStrictEqual(constNull(), null) -``` - -Added in v2.0.0 - -## dual - -Creates a function that can be used in a data-last (aka `pipe`able) or -data-first style. - -The first parameter to `dual` is either the arity of the uncurried function -or a predicate that determines if the function is being used in a data-first -or data-last style. - -Using the arity is the most common use case, but there are some cases where -you may want to use a predicate. For example, if you have a function that -takes an optional argument, you can use a predicate to determine if the -function is being used in a data-first or data-last style. - -**Signature** - -```ts -export declare const dual: { - ) => any, DataFirst extends (...args: Array) => any>( - arity: Parameters["length"], - body: DataFirst - ): DataLast & DataFirst - ) => any, DataFirst extends (...args: Array) => any>( - isDataFirst: (args: IArguments) => boolean, - body: DataFirst - ): DataLast & DataFirst -} -``` - -**Example** - -```ts -import { dual, pipe } from "effect/Function" - -// Exampe using arity to determine data-first or data-last style -const sum: { - (that: number): (self: number) => number - (self: number, that: number): number -} = dual(2, (self: number, that: number): number => self + that) - -assert.deepStrictEqual(sum(2, 3), 5) -assert.deepStrictEqual(pipe(2, sum(3)), 5) - -// Example using a predicate to determine data-first or data-last style -const sum2: { - (that: number): (self: number) => number - (self: number, that: number): number -} = dual( - (args) => args.length === 1, - (self: number, that: number): number => self + that -) - -assert.deepStrictEqual(sum(2, 3), 5) -assert.deepStrictEqual(pipe(2, sum(3)), 5) -``` - -Added in v2.0.0 - -## flip - -Reverses the order of arguments for a curried function. - -**Signature** - -```ts -export declare const flip: ( - f: (...a: A) => (...b: B) => C -) => (...b: B) => (...a: A) => C -``` - -**Example** - -```ts -import { flip } from "effect/Function" - -const f = (a: number) => (b: string) => a - b.length - -assert.deepStrictEqual(flip(f)("aaa")(2), -1) -``` - -Added in v2.0.0 - -## flow - -Performs left-to-right function composition. The first argument may have any arity, the remaining arguments must be unary. - -See also [`pipe`](#pipe). - -**Signature** - -```ts -export declare function flow, B>(ab: (...a: A) => B): (...a: A) => B -export declare function flow, B, C>( - ab: (...a: A) => B, - bc: (b: B) => C -): (...a: A) => C -export declare function flow, B, C, D>( - ab: (...a: A) => B, - bc: (b: B) => C, - cd: (c: C) => D -): (...a: A) => D -export declare function flow, B, C, D, E>( - ab: (...a: A) => B, - bc: (b: B) => C, - cd: (c: C) => D, - de: (d: D) => E -): (...a: A) => E -export declare function flow, B, C, D, E, F>( - ab: (...a: A) => B, - bc: (b: B) => C, - cd: (c: C) => D, - de: (d: D) => E, - ef: (e: E) => F -): (...a: A) => F -export declare function flow, B, C, D, E, F, G>( - ab: (...a: A) => B, - bc: (b: B) => C, - cd: (c: C) => D, - de: (d: D) => E, - ef: (e: E) => F, - fg: (f: F) => G -): (...a: A) => G -export declare function flow, B, C, D, E, F, G, H>( - ab: (...a: A) => B, - bc: (b: B) => C, - cd: (c: C) => D, - de: (d: D) => E, - ef: (e: E) => F, - fg: (f: F) => G, - gh: (g: G) => H -): (...a: A) => H -export declare function flow, B, C, D, E, F, G, H, I>( - ab: (...a: A) => B, - bc: (b: B) => C, - cd: (c: C) => D, - de: (d: D) => E, - ef: (e: E) => F, - fg: (f: F) => G, - gh: (g: G) => H, - hi: (h: H) => I -): (...a: A) => I -export declare function flow, B, C, D, E, F, G, H, I, J>( - ab: (...a: A) => B, - bc: (b: B) => C, - cd: (c: C) => D, - de: (d: D) => E, - ef: (e: E) => F, - fg: (f: F) => G, - gh: (g: G) => H, - hi: (h: H) => I, - ij: (i: I) => J -): (...a: A) => J -``` - -**Example** - -```ts -import { flow } from "effect/Function" - -const len = (s: string): number => s.length -const double = (n: number): number => n * 2 - -const f = flow(len, double) - -assert.strictEqual(f("aaa"), 6) -``` - -Added in v2.0.0 - -## hole - -Type hole simulation. - -**Signature** - -```ts -export declare const hole: () => T -``` - -Added in v2.0.0 - -## identity - -The identity function, i.e. A function that returns its input argument. - -**Signature** - -```ts -export declare const identity: (a: A) => A -``` - -**Example** - -```ts -import { identity } from "effect/Function" - -assert.deepStrictEqual(identity(5), 5) -``` - -Added in v2.0.0 - -## pipe - -Pipes the value of an expression into a pipeline of functions. - -This is useful in combination with data-last functions as a simulation of methods: - -``` -as.map(f).filter(g) -> pipe(as, map(f), filter(g)) -``` - -**Signature** - -```ts -export declare function pipe(a: A): A -export declare function pipe(a: A, ab: (a: A) => B): B -export declare function pipe(a: A, ab: (a: A) => B, bc: (b: B) => C): C -export declare function pipe(a: A, ab: (a: A) => B, bc: (b: B) => C, cd: (c: C) => D): D -export declare function pipe(a: A, ab: (a: A) => B, bc: (b: B) => C, cd: (c: C) => D, de: (d: D) => E): E -export declare function pipe( - a: A, - ab: (a: A) => B, - bc: (b: B) => C, - cd: (c: C) => D, - de: (d: D) => E, - ef: (e: E) => F -): F -export declare function pipe( - a: A, - ab: (a: A) => B, - bc: (b: B) => C, - cd: (c: C) => D, - de: (d: D) => E, - ef: (e: E) => F, - fg: (f: F) => G -): G -export declare function pipe( - a: A, - ab: (a: A) => B, - bc: (b: B) => C, - cd: (c: C) => D, - de: (d: D) => E, - ef: (e: E) => F, - fg: (f: F) => G, - gh: (g: G) => H -): H -export declare function pipe( - a: A, - ab: (a: A) => B, - bc: (b: B) => C, - cd: (c: C) => D, - de: (d: D) => E, - ef: (e: E) => F, - fg: (f: F) => G, - gh: (g: G) => H, - hi: (h: H) => I -): I -export declare function pipe( - a: A, - ab: (a: A) => B, - bc: (b: B) => C, - cd: (c: C) => D, - de: (d: D) => E, - ef: (e: E) => F, - fg: (f: F) => G, - gh: (g: G) => H, - hi: (h: H) => I, - ij: (i: I) => J -): J -export declare function pipe( - a: A, - ab: (a: A) => B, - bc: (b: B) => C, - cd: (c: C) => D, - de: (d: D) => E, - ef: (e: E) => F, - fg: (f: F) => G, - gh: (g: G) => H, - hi: (h: H) => I, - ij: (i: I) => J, - jk: (j: J) => K -): K -export declare function pipe( - a: A, - ab: (a: A) => B, - bc: (b: B) => C, - cd: (c: C) => D, - de: (d: D) => E, - ef: (e: E) => F, - fg: (f: F) => G, - gh: (g: G) => H, - hi: (h: H) => I, - ij: (i: I) => J, - jk: (j: J) => K, - kl: (k: K) => L -): L -export declare function pipe( - a: A, - ab: (a: A) => B, - bc: (b: B) => C, - cd: (c: C) => D, - de: (d: D) => E, - ef: (e: E) => F, - fg: (f: F) => G, - gh: (g: G) => H, - hi: (h: H) => I, - ij: (i: I) => J, - jk: (j: J) => K, - kl: (k: K) => L, - lm: (l: L) => M -): M -export declare function pipe( - a: A, - ab: (a: A) => B, - bc: (b: B) => C, - cd: (c: C) => D, - de: (d: D) => E, - ef: (e: E) => F, - fg: (f: F) => G, - gh: (g: G) => H, - hi: (h: H) => I, - ij: (i: I) => J, - jk: (j: J) => K, - kl: (k: K) => L, - lm: (l: L) => M, - mn: (m: M) => N -): N -export declare function pipe( - a: A, - ab: (a: A) => B, - bc: (b: B) => C, - cd: (c: C) => D, - de: (d: D) => E, - ef: (e: E) => F, - fg: (f: F) => G, - gh: (g: G) => H, - hi: (h: H) => I, - ij: (i: I) => J, - jk: (j: J) => K, - kl: (k: K) => L, - lm: (l: L) => M, - mn: (m: M) => N, - no: (n: N) => O -): O -export declare function pipe( - a: A, - ab: (a: A) => B, - bc: (b: B) => C, - cd: (c: C) => D, - de: (d: D) => E, - ef: (e: E) => F, - fg: (f: F) => G, - gh: (g: G) => H, - hi: (h: H) => I, - ij: (i: I) => J, - jk: (j: J) => K, - kl: (k: K) => L, - lm: (l: L) => M, - mn: (m: M) => N, - no: (n: N) => O, - op: (o: O) => P -): P -export declare function pipe( - a: A, - ab: (a: A) => B, - bc: (b: B) => C, - cd: (c: C) => D, - de: (d: D) => E, - ef: (e: E) => F, - fg: (f: F) => G, - gh: (g: G) => H, - hi: (h: H) => I, - ij: (i: I) => J, - jk: (j: J) => K, - kl: (k: K) => L, - lm: (l: L) => M, - mn: (m: M) => N, - no: (n: N) => O, - op: (o: O) => P, - pq: (p: P) => Q -): Q -export declare function pipe( - a: A, - ab: (a: A) => B, - bc: (b: B) => C, - cd: (c: C) => D, - de: (d: D) => E, - ef: (e: E) => F, - fg: (f: F) => G, - gh: (g: G) => H, - hi: (h: H) => I, - ij: (i: I) => J, - jk: (j: J) => K, - kl: (k: K) => L, - lm: (l: L) => M, - mn: (m: M) => N, - no: (n: N) => O, - op: (o: O) => P, - pq: (p: P) => Q, - qr: (q: Q) => R -): R -export declare function pipe( - a: A, - ab: (a: A) => B, - bc: (b: B) => C, - cd: (c: C) => D, - de: (d: D) => E, - ef: (e: E) => F, - fg: (f: F) => G, - gh: (g: G) => H, - hi: (h: H) => I, - ij: (i: I) => J, - jk: (j: J) => K, - kl: (k: K) => L, - lm: (l: L) => M, - mn: (m: M) => N, - no: (n: N) => O, - op: (o: O) => P, - pq: (p: P) => Q, - qr: (q: Q) => R, - rs: (r: R) => S -): S -export declare function pipe( - a: A, - ab: (a: A) => B, - bc: (b: B) => C, - cd: (c: C) => D, - de: (d: D) => E, - ef: (e: E) => F, - fg: (f: F) => G, - gh: (g: G) => H, - hi: (h: H) => I, - ij: (i: I) => J, - jk: (j: J) => K, - kl: (k: K) => L, - lm: (l: L) => M, - mn: (m: M) => N, - no: (n: N) => O, - op: (o: O) => P, - pq: (p: P) => Q, - qr: (q: Q) => R, - rs: (r: R) => S, - st: (s: S) => T -): T -``` - -**Example** - -```ts -import { pipe } from "effect/Function" - -const length = (s: string): number => s.length -const double = (n: number): number => n * 2 -const decrement = (n: number): number => n - 1 - -assert.deepStrictEqual(pipe(length("hello"), double, decrement), 9) -``` - -Added in v2.0.0 - -## tupled - -Creates a tupled version of this function: instead of `n` arguments, it accepts a single tuple argument. - -**Signature** - -```ts -export declare const tupled: (f: (...a: A) => B) => (a: A) => B -``` - -**Example** - -```ts -import { tupled } from "effect/Function" - -const sumTupled = tupled((x: number, y: number): number => x + y) - -assert.deepStrictEqual(sumTupled([1, 2]), 3) -``` - -Added in v2.0.0 - -## unsafeCoerce - -Casts the result to the specified type. - -**Signature** - -```ts -export declare const unsafeCoerce: (a: A) => B -``` - -**Example** - -```ts -import { unsafeCoerce, identity } from "effect/Function" - -assert.deepStrictEqual(unsafeCoerce, identity) -``` - -Added in v2.0.0 - -## untupled - -Inverse function of `tupled` - -**Signature** - -```ts -export declare const untupled: (f: (a: A) => B) => (...a: A) => B -``` - -**Example** - -```ts -import { untupled } from "effect/Function" - -const getFirst = untupled((tuple: [A, B]): A => tuple[0]) - -assert.deepStrictEqual(getFirst(1, 2), 1) -``` - -Added in v2.0.0 diff --git a/docs/modules/GlobalValue.ts.md b/docs/modules/GlobalValue.ts.md deleted file mode 100644 index 8bea2b5c9..000000000 --- a/docs/modules/GlobalValue.ts.md +++ /dev/null @@ -1,30 +0,0 @@ ---- -title: GlobalValue.ts -nav_order: 38 -parent: Modules ---- - -## GlobalValue overview - -Added in v2.0.0 - ---- - -

Table of contents

- -- [utils](#utils) - - [globalValue](#globalvalue) - ---- - -# utils - -## globalValue - -**Signature** - -```ts -export declare const globalValue:
(id: unknown, compute: () => A) => A -``` - -Added in v2.0.0 diff --git a/docs/modules/GroupBy.ts.md b/docs/modules/GroupBy.ts.md deleted file mode 100644 index 6950878ac..000000000 --- a/docs/modules/GroupBy.ts.md +++ /dev/null @@ -1,164 +0,0 @@ ---- -title: GroupBy.ts -nav_order: 39 -parent: Modules ---- - -## GroupBy overview - -Added in v2.0.0 - ---- - -

Table of contents

- -- [constructors](#constructors) - - [make](#make) -- [destructors](#destructors) - - [evaluate](#evaluate) -- [models](#models) - - [GroupBy (interface)](#groupby-interface) -- [symbols](#symbols) - - [GroupByTypeId](#groupbytypeid) - - [GroupByTypeId (type alias)](#groupbytypeid-type-alias) -- [utils](#utils) - - [GroupBy (namespace)](#groupby-namespace) - - [Variance (interface)](#variance-interface) - - [filter](#filter) - - [first](#first) - ---- - -# constructors - -## make - -Constructs a `GroupBy` from a `Stream`. - -**Signature** - -```ts -export declare const make: ( - grouped: Stream.Stream>]> -) => GroupBy -``` - -Added in v2.0.0 - -# destructors - -## evaluate - -Run the function across all groups, collecting the results in an -arbitrary order. - -**Signature** - -```ts -export declare const evaluate: { - ( - f: (key: K, stream: Stream.Stream) => Stream.Stream, - options?: { readonly bufferSize?: number | undefined } - ): (self: GroupBy) => Stream.Stream - ( - self: GroupBy, - f: (key: K, stream: Stream.Stream) => Stream.Stream, - options?: { readonly bufferSize?: number | undefined } - ): Stream.Stream -} -``` - -Added in v2.0.0 - -# models - -## GroupBy (interface) - -Representation of a grouped stream. This allows to filter which groups will -be processed. Once this is applied all groups will be processed in parallel -and the results will be merged in arbitrary order. - -**Signature** - -```ts -export interface GroupBy extends GroupBy.Variance, Pipeable { - readonly grouped: Stream.Stream>]> -} -``` - -Added in v2.0.0 - -# symbols - -## GroupByTypeId - -**Signature** - -```ts -export declare const GroupByTypeId: typeof GroupByTypeId -``` - -Added in v2.0.0 - -## GroupByTypeId (type alias) - -**Signature** - -```ts -export type GroupByTypeId = typeof GroupByTypeId -``` - -Added in v2.0.0 - -# utils - -## GroupBy (namespace) - -Added in v2.0.0 - -### Variance (interface) - -**Signature** - -```ts -export interface Variance { - readonly [GroupByTypeId]: { - readonly _R: (_: never) => R - readonly _E: (_: never) => E - readonly _K: (_: never) => K - readonly _V: (_: never) => V - } -} -``` - -Added in v2.0.0 - -## filter - -Filter the groups to be processed. - -**Signature** - -```ts -export declare const filter: { - (predicate: Predicate): (self: GroupBy) => GroupBy - (self: GroupBy, predicate: Predicate): GroupBy -} -``` - -Added in v2.0.0 - -## first - -Only consider the first `n` groups found in the `Stream`. - -**Signature** - -```ts -export declare const first: { - (n: number): (self: GroupBy) => GroupBy - (self: GroupBy, n: number): GroupBy -} -``` - -Added in v2.0.0 diff --git a/docs/modules/HKT.ts.md b/docs/modules/HKT.ts.md deleted file mode 100644 index ed3ffa2c0..000000000 --- a/docs/modules/HKT.ts.md +++ /dev/null @@ -1,74 +0,0 @@ ---- -title: HKT.ts -nav_order: 43 -parent: Modules ---- - -## HKT overview - -Added in v2.0.0 - ---- - -

Table of contents

- -- [utils](#utils) - - [Kind (type alias)](#kind-type-alias) - - [TypeClass (interface)](#typeclass-interface) - - [TypeLambda (interface)](#typelambda-interface) - ---- - -# utils - -## Kind (type alias) - -**Signature** - -```ts -export type Kind = F extends { - readonly type: unknown -} - ? (F & { - readonly In: In - readonly Out2: Out2 - readonly Out1: Out1 - readonly Target: Target - })["type"] - : { - readonly F: F - readonly In: (_: In) => void - readonly Out2: () => Out2 - readonly Out1: () => Out1 - readonly Target: (_: Target) => Target - } -``` - -Added in v2.0.0 - -## TypeClass (interface) - -**Signature** - -```ts -export interface TypeClass { - readonly [URI]?: F -} -``` - -Added in v2.0.0 - -## TypeLambda (interface) - -**Signature** - -```ts -export interface TypeLambda { - readonly In: unknown - readonly Out2: unknown - readonly Out1: unknown - readonly Target: unknown -} -``` - -Added in v2.0.0 diff --git a/docs/modules/Hash.ts.md b/docs/modules/Hash.ts.md deleted file mode 100644 index fb733e367..000000000 --- a/docs/modules/Hash.ts.md +++ /dev/null @@ -1,162 +0,0 @@ ---- -title: Hash.ts -nav_order: 40 -parent: Modules ---- - -## Hash overview - -Added in v2.0.0 - ---- - -

Table of contents

- -- [guards](#guards) - - [isHash](#ishash) -- [hashing](#hashing) - - [array](#array) - - [combine](#combine) - - [hash](#hash) - - [number](#number) - - [optimize](#optimize) - - [random](#random) - - [string](#string) - - [structure](#structure) - - [structureKeys](#structurekeys) -- [models](#models) - - [Hash (interface)](#hash-interface) -- [symbols](#symbols) - - [symbol](#symbol) - ---- - -# guards - -## isHash - -**Signature** - -```ts -export declare const isHash: (u: unknown) => u is Hash -``` - -Added in v2.0.0 - -# hashing - -## array - -**Signature** - -```ts -export declare const array:
(arr: readonly A[]) => number -``` - -Added in v2.0.0 - -## combine - -**Signature** - -```ts -export declare const combine: (b: number) => (self: number) => number -``` - -Added in v2.0.0 - -## hash - -**Signature** - -```ts -export declare const hash: (self: A) => number -``` - -Added in v2.0.0 - -## number - -**Signature** - -```ts -export declare const number: (n: number) => number -``` - -Added in v2.0.0 - -## optimize - -**Signature** - -```ts -export declare const optimize: (n: number) => number -``` - -Added in v2.0.0 - -## random - -**Signature** - -```ts -export declare const random: (self: A) => number -``` - -Added in v2.0.0 - -## string - -**Signature** - -```ts -export declare const string: (str: string) => number -``` - -Added in v2.0.0 - -## structure - -**Signature** - -```ts -export declare const structure: (o: A) => number -``` - -Added in v2.0.0 - -## structureKeys - -**Signature** - -```ts -export declare const structureKeys: (o: A, keys: readonly (keyof A)[]) => number -``` - -Added in v2.0.0 - -# models - -## Hash (interface) - -**Signature** - -```ts -export interface Hash { - readonly [symbol]: () => number -} -``` - -Added in v2.0.0 - -# symbols - -## symbol - -**Signature** - -```ts -export declare const symbol: typeof symbol -``` - -Added in v2.0.0 diff --git a/docs/modules/HashMap.ts.md b/docs/modules/HashMap.ts.md deleted file mode 100644 index 1cf2a5fc5..000000000 --- a/docs/modules/HashMap.ts.md +++ /dev/null @@ -1,677 +0,0 @@ ---- -title: HashMap.ts -nav_order: 41 -parent: Modules ---- - -## HashMap overview - -Added in v2.0.0 - ---- - -

Table of contents

- -- [constructors](#constructors) - - [empty](#empty) - - [fromIterable](#fromiterable) - - [make](#make) -- [elements](#elements) - - [findFirst](#findfirst) - - [get](#get) - - [getHash](#gethash) - - [has](#has) - - [hasHash](#hashash) - - [isEmpty](#isempty) -- [filtering](#filtering) - - [compact](#compact) - - [filter](#filter) - - [filterMap](#filtermap) -- [folding](#folding) - - [reduce](#reduce) -- [getter](#getter) - - [keySet](#keyset) -- [getters](#getters) - - [entries](#entries) - - [keys](#keys) - - [size](#size) - - [toEntries](#toentries) - - [values](#values) -- [mapping](#mapping) - - [map](#map) -- [models](#models) - - [HashMap (interface)](#hashmap-interface) -- [refinements](#refinements) - - [isHashMap](#ishashmap) -- [sequencing](#sequencing) - - [flatMap](#flatmap) -- [symbol](#symbol) - - [TypeId (type alias)](#typeid-type-alias) -- [traversing](#traversing) - - [forEach](#foreach) -- [unsafe](#unsafe) - - [unsafeGet](#unsafeget) -- [utils](#utils) - - [HashMap (namespace)](#hashmap-namespace) - - [Key (type alias)](#key-type-alias) - - [UpdateFn (type alias)](#updatefn-type-alias) - - [Value (type alias)](#value-type-alias) - - [beginMutation](#beginmutation) - - [endMutation](#endmutation) - - [modify](#modify) - - [modifyAt](#modifyat) - - [modifyHash](#modifyhash) - - [mutate](#mutate) - - [remove](#remove) - - [removeMany](#removemany) - - [set](#set) - - [union](#union) - ---- - -# constructors - -## empty - -Creates a new `HashMap`. - -**Signature** - -```ts -export declare const empty: () => HashMap -``` - -Added in v2.0.0 - -## fromIterable - -Constructs a new `HashMap` from an iterable of key/value pairs. - -**Signature** - -```ts -export declare const fromIterable: (entries: Iterable) => HashMap -``` - -Added in v2.0.0 - -## make - -Constructs a new `HashMap` from an array of key/value pairs. - -**Signature** - -```ts -export declare const make: ( - ...entries: Entries -) => HashMap< - Entries[number] extends readonly [infer K, any] ? K : never, - Entries[number] extends readonly [any, infer V] ? V : never -> -``` - -Added in v2.0.0 - -# elements - -## findFirst - -Returns the first element that satisfies the specified -predicate, or `None` if no such element exists. - -**Signature** - -```ts -export declare const findFirst: { - (predicate: (k: K, a: A) => boolean): (self: HashMap) => Option<[K, A]> - (self: HashMap, predicate: (k: K, a: A) => boolean): Option<[K, A]> -} -``` - -Added in v2.0.0 - -## get - -Safely lookup the value for the specified key in the `HashMap` using the -internal hashing function. - -**Signature** - -```ts -export declare const get: { - (key: K1): (self: HashMap) => Option - (self: HashMap, key: K1): Option -} -``` - -Added in v2.0.0 - -## getHash - -Lookup the value for the specified key in the `HashMap` using a custom hash. - -**Signature** - -```ts -export declare const getHash: { - (key: K1, hash: number): (self: HashMap) => Option - (self: HashMap, key: K1, hash: number): Option -} -``` - -Added in v2.0.0 - -## has - -Checks if the specified key has an entry in the `HashMap`. - -**Signature** - -```ts -export declare const has: { - (key: K1): (self: HashMap) => boolean - (self: HashMap, key: K1): boolean -} -``` - -Added in v2.0.0 - -## hasHash - -Checks if the specified key has an entry in the `HashMap` using a custom -hash. - -**Signature** - -```ts -export declare const hasHash: { - (key: K1, hash: number): (self: HashMap) => boolean - (self: HashMap, key: K1, hash: number): boolean -} -``` - -Added in v2.0.0 - -## isEmpty - -Checks if the `HashMap` contains any entries. - -**Signature** - -```ts -export declare const isEmpty: (self: HashMap) => boolean -``` - -Added in v2.0.0 - -# filtering - -## compact - -Filters out `None` values from a `HashMap` of `Options`s. - -**Signature** - -```ts -export declare const compact: (self: HashMap>) => HashMap -``` - -Added in v2.0.0 - -## filter - -Filters entries out of a `HashMap` using the specified predicate. - -**Signature** - -```ts -export declare const filter: { - (f: (a: A, k: K) => a is B): (self: HashMap) => HashMap - (f: (a: A, k: K) => boolean): (self: HashMap) => HashMap - (self: HashMap, f: (a: A, k: K) => a is B): HashMap - (self: HashMap, f: (a: A, k: K) => boolean): HashMap -} -``` - -Added in v2.0.0 - -## filterMap - -Maps over the entries of the `HashMap` using the specified partial function -and filters out `None` values. - -**Signature** - -```ts -export declare const filterMap: { - (f: (value: A, key: K) => Option): (self: HashMap) => HashMap - (self: HashMap, f: (value: A, key: K) => Option): HashMap -} -``` - -Added in v2.0.0 - -# folding - -## reduce - -Reduces the specified state over the entries of the `HashMap`. - -**Signature** - -```ts -export declare const reduce: { - (zero: Z, f: (accumulator: Z, value: V, key: K) => Z): (self: HashMap) => Z - (self: HashMap, zero: Z, f: (accumulator: Z, value: V, key: K) => Z): Z -} -``` - -Added in v2.0.0 - -# getter - -## keySet - -Returns a `HashSet` of keys within the `HashMap`. - -**Signature** - -```ts -export declare const keySet: (self: HashMap) => HashSet -``` - -Added in v2.0.0 - -# getters - -## entries - -Returns an `IterableIterator` of the entries within the `HashMap`. - -**Signature** - -```ts -export declare const entries: (self: HashMap) => IterableIterator<[K, V]> -``` - -Added in v2.0.0 - -## keys - -Returns an `IterableIterator` of the keys within the `HashMap`. - -**Signature** - -```ts -export declare const keys: (self: HashMap) => IterableIterator -``` - -Added in v2.0.0 - -## size - -Returns the number of entries within the `HashMap`. - -**Signature** - -```ts -export declare const size: (self: HashMap) => number -``` - -Added in v2.0.0 - -## toEntries - -Returns an `Array<[K, V]>` of the entries within the `HashMap`. - -**Signature** - -```ts -export declare const toEntries: (self: HashMap) => [K, V][] -``` - -Added in v2.0.0 - -## values - -Returns an `IterableIterator` of the values within the `HashMap`. - -**Signature** - -```ts -export declare const values: (self: HashMap) => IterableIterator -``` - -Added in v2.0.0 - -# mapping - -## map - -Maps over the entries of the `HashMap` using the specified function. - -**Signature** - -```ts -export declare const map: { - (f: (value: V, key: K) => A): (self: HashMap) => HashMap - (self: HashMap, f: (value: V, key: K) => A): HashMap -} -``` - -Added in v2.0.0 - -# models - -## HashMap (interface) - -**Signature** - -```ts -export interface HashMap extends Iterable<[Key, Value]>, Equal, Pipeable, Inspectable { - readonly [TypeId]: TypeId -} -``` - -Added in v2.0.0 - -# refinements - -## isHashMap - -**Signature** - -```ts -export declare const isHashMap: { - (u: Iterable): u is HashMap - (u: unknown): u is HashMap -} -``` - -Added in v2.0.0 - -# sequencing - -## flatMap - -Chains over the entries of the `HashMap` using the specified function. - -**NOTE**: the hash and equal of both maps have to be the same. - -**Signature** - -```ts -export declare const flatMap: { - (f: (value: A, key: K) => HashMap): (self: HashMap) => HashMap - (self: HashMap, f: (value: A, key: K) => HashMap): HashMap -} -``` - -Added in v2.0.0 - -# symbol - -## TypeId (type alias) - -**Signature** - -```ts -export type TypeId = typeof TypeId -``` - -Added in v2.0.0 - -# traversing - -## forEach - -Applies the specified function to the entries of the `HashMap`. - -**Signature** - -```ts -export declare const forEach: { - (f: (value: V, key: K) => void): (self: HashMap) => void - (self: HashMap, f: (value: V, key: K) => void): void -} -``` - -Added in v2.0.0 - -# unsafe - -## unsafeGet - -Unsafely lookup the value for the specified key in the `HashMap` using the -internal hashing function. - -**Signature** - -```ts -export declare const unsafeGet: { - (key: K1): (self: HashMap) => V - (self: HashMap, key: K1): V -} -``` - -Added in v2.0.0 - -# utils - -## HashMap (namespace) - -Added in v2.0.0 - -### Key (type alias) - -This type-level utility extracts the key type `K` from a `HashMap` type. - -**Signature** - -```ts -export type Key> = [T] extends [HashMap] ? _K : never -``` - -**Example** - -```ts -import * as HashMap from "effect/HashMap" - -declare const hm: HashMap.HashMap - -// $ExpectType string -type K = HashMap.HashMap.Key -``` - -Added in v2.0.0 - -### UpdateFn (type alias) - -**Signature** - -```ts -export type UpdateFn = (option: Option) => Option -``` - -Added in v2.0.0 - -### Value (type alias) - -This type-level utility extracts the value type `V` from a `HashMap` type. - -**Signature** - -```ts -export type Value> = [T] extends [HashMap] ? _V : never -``` - -**Example** - -```ts -import * as HashMap from "effect/HashMap" - -declare const hm: HashMap.HashMap - -// $ExpectType number -type V = HashMap.HashMap.Value -``` - -Added in v2.0.0 - -## beginMutation - -Marks the `HashMap` as mutable. - -**Signature** - -```ts -export declare const beginMutation: (self: HashMap) => HashMap -``` - -Added in v2.0.0 - -## endMutation - -Marks the `HashMap` as immutable. - -**Signature** - -```ts -export declare const endMutation: (self: HashMap) => HashMap -``` - -Added in v2.0.0 - -## modify - -Updates the value of the specified key within the `HashMap` if it exists. - -**Signature** - -```ts -export declare const modify: { - (key: K, f: (v: V) => V): (self: HashMap) => HashMap - (self: HashMap, key: K, f: (v: V) => V): HashMap -} -``` - -Added in v2.0.0 - -## modifyAt - -Set or remove the specified key in the `HashMap` using the specified -update function. The value of the specified key will be computed using the -provided hash. - -The update function will be invoked with the current value of the key if it -exists, or `None` if no such value exists. - -**Signature** - -```ts -export declare const modifyAt: { - (key: K, f: HashMap.UpdateFn): (self: HashMap) => HashMap - (self: HashMap, key: K, f: HashMap.UpdateFn): HashMap -} -``` - -Added in v2.0.0 - -## modifyHash - -Alter the value of the specified key in the `HashMap` using the specified -update function. The value of the specified key will be computed using the -provided hash. - -The update function will be invoked with the current value of the key if it -exists, or `None` if no such value exists. - -This function will always either update or insert a value into the `HashMap`. - -**Signature** - -```ts -export declare const modifyHash: { - (key: K, hash: number, f: HashMap.UpdateFn): (self: HashMap) => HashMap - (self: HashMap, key: K, hash: number, f: HashMap.UpdateFn): HashMap -} -``` - -Added in v2.0.0 - -## mutate - -Mutates the `HashMap` within the context of the provided function. - -**Signature** - -```ts -export declare const mutate: { - (f: (self: HashMap) => void): (self: HashMap) => HashMap - (self: HashMap, f: (self: HashMap) => void): HashMap -} -``` - -Added in v2.0.0 - -## remove - -Remove the entry for the specified key in the `HashMap` using the internal -hashing function. - -**Signature** - -```ts -export declare const remove: { - (key: K): (self: HashMap) => HashMap - (self: HashMap, key: K): HashMap -} -``` - -Added in v2.0.0 - -## removeMany - -Removes all entries in the `HashMap` which have the specified keys. - -**Signature** - -```ts -export declare const removeMany: { - (keys: Iterable): (self: HashMap) => HashMap - (self: HashMap, keys: Iterable): HashMap -} -``` - -Added in v2.0.0 - -## set - -Sets the specified key to the specified value using the internal hashing -function. - -**Signature** - -```ts -export declare const set: { - (key: K, value: V): (self: HashMap) => HashMap - (self: HashMap, key: K, value: V): HashMap -} -``` - -Added in v2.0.0 - -## union - -Performs a union of this `HashMap` and that `HashMap`. - -**Signature** - -```ts -export declare const union: { - (that: HashMap): (self: HashMap) => HashMap - (self: HashMap, that: HashMap): HashMap -} -``` - -Added in v2.0.0 diff --git a/docs/modules/HashSet.ts.md b/docs/modules/HashSet.ts.md deleted file mode 100644 index f17419a4d..000000000 --- a/docs/modules/HashSet.ts.md +++ /dev/null @@ -1,482 +0,0 @@ ---- -title: HashSet.ts -nav_order: 42 -parent: Modules ---- - -## HashSet overview - -Added in v2.0.0 - ---- - -

Table of contents

- -- [constructors](#constructors) - - [empty](#empty) - - [fromIterable](#fromiterable) - - [make](#make) -- [elements](#elements) - - [every](#every) - - [has](#has) - - [isSubset](#issubset) - - [some](#some) -- [filtering](#filtering) - - [filter](#filter) -- [folding](#folding) - - [reduce](#reduce) -- [getters](#getters) - - [size](#size) - - [values](#values) -- [mapping](#mapping) - - [map](#map) -- [models](#models) - - [HashSet (interface)](#hashset-interface) -- [partitioning](#partitioning) - - [partition](#partition) -- [refinements](#refinements) - - [isHashSet](#ishashset) -- [sequencing](#sequencing) - - [flatMap](#flatmap) -- [symbol](#symbol) - - [TypeId (type alias)](#typeid-type-alias) -- [traversing](#traversing) - - [forEach](#foreach) -- [utils](#utils) - - [add](#add) - - [beginMutation](#beginmutation) - - [difference](#difference) - - [endMutation](#endmutation) - - [intersection](#intersection) - - [mutate](#mutate) - - [remove](#remove) - - [toggle](#toggle) - - [union](#union) - ---- - -# constructors - -## empty - -Creates an empty `HashSet`. - -**Signature** - -```ts -export declare const empty:
() => HashSet -``` - -Added in v2.0.0 - -## fromIterable - -Construct a new `HashSet` from a `Collection` of values - -**Signature** - -```ts -export declare const fromIterable: (elements: Iterable) => HashSet -``` - -Added in v2.0.0 - -## make - -Construct a new `HashSet` from a variable number of values. - -**Signature** - -```ts -export declare const make: (...elements: As) => HashSet -``` - -Added in v2.0.0 - -# elements - -## every - -Check if a predicate holds true for every `HashSet` element. - -**Signature** - -```ts -export declare const every: { - (refinement: Refinement): (self: HashSet) => self is HashSet - (predicate: Predicate): (self: HashSet) => boolean - (self: HashSet, refinement: Refinement): self is HashSet - (self: HashSet, predicate: Predicate): boolean -} -``` - -Added in v2.0.0 - -## has - -Checks if the specified value exists in the `HashSet`. - -**Signature** - -```ts -export declare const has: { (value: A): (self: HashSet) => boolean; (self: HashSet, value: A): boolean } -``` - -Added in v2.0.0 - -## isSubset - -Returns `true` if and only if every element in the this `HashSet` is an -element of the second set, - -**NOTE**: the hash and equal of both sets must be the same. - -**Signature** - -```ts -export declare const isSubset: { - (that: HashSet): (self: HashSet) => boolean - (self: HashSet, that: HashSet): boolean -} -``` - -Added in v2.0.0 - -## some - -Check if a predicate holds true for some `HashSet` element. - -**Signature** - -```ts -export declare const some: { - (f: Predicate): (self: HashSet) => boolean - (self: HashSet, f: Predicate): boolean -} -``` - -Added in v2.0.0 - -# filtering - -## filter - -Filters values out of a `HashSet` using the specified predicate. - -**Signature** - -```ts -export declare const filter: { - (f: Refinement): (self: HashSet) => HashSet - (f: Predicate): (self: HashSet) => HashSet - (self: HashSet, f: Refinement): HashSet - (self: HashSet, f: Predicate): HashSet -} -``` - -Added in v2.0.0 - -# folding - -## reduce - -Reduces the specified state over the values of the `HashSet`. - -**Signature** - -```ts -export declare const reduce: { - (zero: Z, f: (accumulator: Z, value: A) => Z): (self: HashSet) => Z - (self: HashSet, zero: Z, f: (accumulator: Z, value: A) => Z): Z -} -``` - -Added in v2.0.0 - -# getters - -## size - -Calculates the number of values in the `HashSet`. - -**Signature** - -```ts -export declare const size: (self: HashSet) => number -``` - -Added in v2.0.0 - -## values - -Returns an `IterableIterator` of the values in the `HashSet`. - -**Signature** - -```ts -export declare const values: (self: HashSet) => IterableIterator -``` - -Added in v2.0.0 - -# mapping - -## map - -Maps over the values of the `HashSet` using the specified function. - -**Signature** - -```ts -export declare const map: { - (f: (a: A) => B): (self: HashSet) => HashSet - (self: HashSet, f: (a: A) => B): HashSet -} -``` - -Added in v2.0.0 - -# models - -## HashSet (interface) - -**Signature** - -```ts -export interface HashSet extends Iterable, Equal, Pipeable, Inspectable { - readonly [TypeId]: TypeId -} -``` - -Added in v2.0.0 - -# partitioning - -## partition - -Partition the values of a `HashSet` using the specified predicate. - -If a value matches the predicate, it will be placed into the `HashSet` on the -right side of the resulting `Tuple`, otherwise the value will be placed into -the left side. - -**Signature** - -```ts -export declare const partition: { - ( - refinement: Refinement - ): (self: HashSet) => [HashSet>, HashSet] - (predicate: (a: A) => boolean): (self: HashSet) => [HashSet, HashSet] - ( - self: HashSet, - refinement: Refinement - ): [HashSet>, HashSet] - (self: HashSet, predicate: (a: A) => boolean): [HashSet, HashSet] -} -``` - -Added in v2.0.0 - -# refinements - -## isHashSet - -**Signature** - -```ts -export declare const isHashSet: { (u: Iterable): u is HashSet; (u: unknown): u is HashSet } -``` - -Added in v2.0.0 - -# sequencing - -## flatMap - -Chains over the values of the `HashSet` using the specified function. - -**Signature** - -```ts -export declare const flatMap: { - (f: (a: A) => Iterable): (self: HashSet) => HashSet - (self: HashSet, f: (a: A) => Iterable): HashSet -} -``` - -Added in v2.0.0 - -# symbol - -## TypeId (type alias) - -**Signature** - -```ts -export type TypeId = typeof TypeId -``` - -Added in v2.0.0 - -# traversing - -## forEach - -Applies the specified function to the values of the `HashSet`. - -**Signature** - -```ts -export declare const forEach: { - (f: (value: A) => void): (self: HashSet) => void - (self: HashSet, f: (value: A) => void): void -} -``` - -Added in v2.0.0 - -# utils - -## add - -Adds a value to the `HashSet`. - -**Signature** - -```ts -export declare const add: { - (value: A): (self: HashSet) => HashSet - (self: HashSet, value: A): HashSet -} -``` - -Added in v2.0.0 - -## beginMutation - -Marks the `HashSet` as mutable. - -**Signature** - -```ts -export declare const beginMutation: (self: HashSet) => HashSet -``` - -Added in v2.0.0 - -## difference - -Computes the set difference between this `HashSet` and the specified -`Iterable`. - -**NOTE**: the hash and equal of the values in both the set and the iterable -must be the same. - -**Signature** - -```ts -export declare const difference: { - (that: Iterable): (self: HashSet) => HashSet - (self: HashSet, that: Iterable): HashSet -} -``` - -Added in v2.0.0 - -## endMutation - -Marks the `HashSet` as immutable. - -**Signature** - -```ts -export declare const endMutation: (self: HashSet) => HashSet -``` - -Added in v2.0.0 - -## intersection - -Returns a `HashSet` of values which are present in both this set and that -`Iterable`. - -**NOTE**: the hash and equal of the values in both the set and the iterable -must be the same. - -**Signature** - -```ts -export declare const intersection: { - (that: Iterable): (self: HashSet) => HashSet - (self: HashSet, that: Iterable): HashSet -} -``` - -Added in v2.0.0 - -## mutate - -Mutates the `HashSet` within the context of the provided function. - -**Signature** - -```ts -export declare const mutate: { - (f: (set: HashSet) => void): (self: HashSet) => HashSet - (self: HashSet, f: (set: HashSet) => void): HashSet -} -``` - -Added in v2.0.0 - -## remove - -Removes a value from the `HashSet`. - -**Signature** - -```ts -export declare const remove: { - (value: A): (self: HashSet) => HashSet - (self: HashSet, value: A): HashSet -} -``` - -Added in v2.0.0 - -## toggle - -Checks if a value is present in the `HashSet`. If it is present, the value -will be removed from the `HashSet`, otherwise the value will be added to the -`HashSet`. - -**Signature** - -```ts -export declare const toggle: { - (value: A): (self: HashSet) => HashSet - (self: HashSet, value: A): HashSet -} -``` - -Added in v2.0.0 - -## union - -Computes the set union `(`self`+`that`)` between this `HashSet` and the -specified `Iterable`. - -**NOTE**: the hash and equal of the values in both the set and the iterable -must be the same. - -**Signature** - -```ts -export declare const union: { - (that: Iterable): (self: HashSet) => HashSet - (self: HashSet, that: Iterable): HashSet -} -``` - -Added in v2.0.0 diff --git a/docs/modules/Inspectable.ts.md b/docs/modules/Inspectable.ts.md deleted file mode 100644 index 8e882d995..000000000 --- a/docs/modules/Inspectable.ts.md +++ /dev/null @@ -1,84 +0,0 @@ ---- -title: Inspectable.ts -nav_order: 45 -parent: Modules ---- - -## Inspectable overview - -Added in v2.0.0 - ---- - -

Table of contents

- -- [models](#models) - - [Inspectable (interface)](#inspectable-interface) -- [symbols](#symbols) - - [NodeInspectSymbol](#nodeinspectsymbol) - - [NodeInspectSymbol (type alias)](#nodeinspectsymbol-type-alias) -- [utils](#utils) - - [toJSON](#tojson) - - [toString](#tostring) - ---- - -# models - -## Inspectable (interface) - -**Signature** - -```ts -export interface Inspectable { - readonly toString: () => string - readonly toJSON: () => unknown - readonly [NodeInspectSymbol]: () => unknown -} -``` - -Added in v2.0.0 - -# symbols - -## NodeInspectSymbol - -**Signature** - -```ts -export declare const NodeInspectSymbol: typeof NodeInspectSymbol -``` - -Added in v2.0.0 - -## NodeInspectSymbol (type alias) - -**Signature** - -```ts -export type NodeInspectSymbol = typeof NodeInspectSymbol -``` - -Added in v2.0.0 - -# utils - -## toJSON - -**Signature** - -```ts -export declare const toJSON: (x: unknown) => unknown -``` - -Added in v2.0.0 - -## toString - -**Signature** - -```ts -export declare const toString: (x: unknown) => string -``` - -Added in v2.0.0 diff --git a/docs/modules/KeyedPool.ts.md b/docs/modules/KeyedPool.ts.md deleted file mode 100644 index f2ba67e1c..000000000 --- a/docs/modules/KeyedPool.ts.md +++ /dev/null @@ -1,231 +0,0 @@ ---- -title: KeyedPool.ts -nav_order: 46 -parent: Modules ---- - -## KeyedPool overview - -Added in v2.0.0 - ---- - -

Table of contents

- -- [combinators](#combinators) - - [get](#get) - - [invalidate](#invalidate) -- [constructors](#constructors) - - [make](#make) - - [makeWith](#makewith) - - [makeWithTTL](#makewithttl) - - [makeWithTTLBy](#makewithttlby) -- [models](#models) - - [KeyedPool (interface)](#keyedpool-interface) -- [symbols](#symbols) - - [KeyedPoolTypeId](#keyedpooltypeid) - - [KeyedPoolTypeId (type alias)](#keyedpooltypeid-type-alias) -- [utils](#utils) - - [KeyedPool (namespace)](#keyedpool-namespace) - - [Variance (interface)](#variance-interface) - ---- - -# combinators - -## get - -Retrieves an item from the pool belonging to the given key in a scoped -effect. Note that if acquisition fails, then the returned effect will fail -for that same reason. Retrying a failed acquisition attempt will repeat the -acquisition attempt. - -**Signature** - -```ts -export declare const get: { - (key: K): (self: KeyedPool) => Effect.Effect - (self: KeyedPool, key: K): Effect.Effect -} -``` - -Added in v2.0.0 - -## invalidate - -Invalidates the specified item. This will cause the pool to eventually -reallocate the item, although this reallocation may occur lazily rather -than eagerly. - -**Signature** - -```ts -export declare const invalidate: { -
(item: A): (self: KeyedPool) => Effect.Effect - (self: KeyedPool, item: A): Effect.Effect -} -``` - -Added in v2.0.0 - -# constructors - -## make - -Makes a new pool of the specified fixed size. The pool is returned in a -`Scope`, which governs the lifetime of the pool. When the pool is shutdown -because the `Scope` is closed, the individual items allocated by the pool -will be released in some unspecified order. - -**Signature** - -```ts -export declare const make: (options: { - readonly acquire: (key: K) => Effect.Effect - readonly size: number -}) => Effect.Effect> -``` - -Added in v2.0.0 - -## makeWith - -Makes a new pool of the specified fixed size. The pool is returned in a -`Scope`, which governs the lifetime of the pool. When the pool is shutdown -because the `Scope` is closed, the individual items allocated by the pool -will be released in some unspecified order. - -The size of the underlying pools can be configured per key. - -**Signature** - -```ts -export declare const makeWith: (options: { - readonly acquire: (key: K) => Effect.Effect - readonly size: (key: K) => number -}) => Effect.Effect> -``` - -Added in v2.0.0 - -## makeWithTTL - -Makes a new pool with the specified minimum and maximum sizes and time to -live before a pool whose excess items are not being used will be shrunk -down to the minimum size. The pool is returned in a `Scope`, which governs -the lifetime of the pool. When the pool is shutdown because the `Scope` is -used, the individual items allocated by the pool will be released in some -unspecified order. - -The size of the underlying pools can be configured per key. - -**Signature** - -```ts -export declare const makeWithTTL: (options: { - readonly acquire: (key: K) => Effect.Effect - readonly min: (key: K) => number - readonly max: (key: K) => number - readonly timeToLive: Duration.DurationInput -}) => Effect.Effect> -``` - -Added in v2.0.0 - -## makeWithTTLBy - -Makes a new pool with the specified minimum and maximum sizes and time to -live before a pool whose excess items are not being used will be shrunk -down to the minimum size. The pool is returned in a `Scope`, which governs -the lifetime of the pool. When the pool is shutdown because the `Scope` is -used, the individual items allocated by the pool will be released in some -unspecified order. - -The size of the underlying pools can be configured per key. - -**Signature** - -```ts -export declare const makeWithTTLBy: (options: { - readonly acquire: (key: K) => Effect.Effect - readonly min: (key: K) => number - readonly max: (key: K) => number - readonly timeToLive: (key: K) => Duration.DurationInput -}) => Effect.Effect> -``` - -Added in v2.0.0 - -# models - -## KeyedPool (interface) - -A `KeyedPool` is a pool of `Pool`s of items of type `A`. Each pool -in the `KeyedPool` is associated with a key of type `K`. - -**Signature** - -```ts -export interface KeyedPool extends KeyedPool.Variance, Pipeable { - /** - * Retrieves an item from the pool belonging to the given key in a scoped - * effect. Note that if acquisition fails, then the returned effect will fail - * for that same reason. Retrying a failed acquisition attempt will repeat the - * acquisition attempt. - */ - readonly get: (key: K) => Effect.Effect - - /** - * Invalidates the specified item. This will cause the pool to eventually - * reallocate the item, although this reallocation may occur lazily rather - * than eagerly. - */ - readonly invalidate: (item: A) => Effect.Effect -} -``` - -Added in v2.0.0 - -# symbols - -## KeyedPoolTypeId - -**Signature** - -```ts -export declare const KeyedPoolTypeId: typeof KeyedPoolTypeId -``` - -Added in v2.0.0 - -## KeyedPoolTypeId (type alias) - -**Signature** - -```ts -export type KeyedPoolTypeId = typeof KeyedPoolTypeId -``` - -Added in v2.0.0 - -# utils - -## KeyedPool (namespace) - -Added in v2.0.0 - -### Variance (interface) - -**Signature** - -```ts -export interface Variance { - readonly [KeyedPoolTypeId]: { - readonly _K: (_: K) => void - readonly _E: (_: never) => E - readonly _A: (_: never) => A - } -} -``` - -Added in v2.0.0 diff --git a/docs/modules/Layer.ts.md b/docs/modules/Layer.ts.md deleted file mode 100644 index 56b800d9b..000000000 --- a/docs/modules/Layer.ts.md +++ /dev/null @@ -1,1424 +0,0 @@ ---- -title: Layer.ts -nav_order: 47 -parent: Modules ---- - -## Layer overview - -A `Layer` describes how to build one or more services in your -application. Services can be injected into effects via -`Effect.provideService`. Effects can require services via `Effect.service`. - -Layer can be thought of as recipes for producing bundles of services, given -their dependencies (other services). - -Construction of services can be effectful and utilize resources that must be -acquired and safely released when the services are done being utilized. - -By default layers are shared, meaning that if the same layer is used twice -the layer will only be allocated a single time. - -Because of their excellent composition properties, layers are the idiomatic -way in Effect-TS to create services that depend on other services. - -Added in v2.0.0 - ---- - -

Table of contents

- -- [clock](#clock) - - [setClock](#setclock) -- [config](#config) - - [setConfigProvider](#setconfigprovider) -- [constructors](#constructors) - - [context](#context) - - [die](#die) - - [dieSync](#diesync) - - [effect](#effect) - - [effectContext](#effectcontext) - - [effectDiscard](#effectdiscard) - - [fail](#fail) - - [failCause](#failcause) - - [failCauseSync](#failcausesync) - - [failSync](#failsync) - - [function](#function) - - [scope](#scope) - - [scoped](#scoped) - - [scopedContext](#scopedcontext) - - [scopedDiscard](#scopeddiscard) - - [service](#service) - - [succeed](#succeed) - - [succeedContext](#succeedcontext) - - [suspend](#suspend) - - [sync](#sync) - - [syncContext](#synccontext) -- [conversions](#conversions) - - [launch](#launch) - - [toRuntime](#toruntime) -- [destructors](#destructors) - - [build](#build) - - [buildWithScope](#buildwithscope) -- [error handling](#error-handling) - - [catchAll](#catchall) - - [catchAllCause](#catchallcause) - - [orDie](#ordie) - - [orElse](#orelse) -- [folding](#folding) - - [match](#match) - - [matchCause](#matchcause) -- [getters](#getters) - - [isFresh](#isfresh) - - [isLayer](#islayer) -- [logging](#logging) - - [setUnhandledErrorLogLevel](#setunhandlederrorloglevel) -- [mapping](#mapping) - - [discard](#discard) - - [map](#map) - - [mapError](#maperror) -- [models](#models) - - [Layer (interface)](#layer-interface) -- [requests & batching](#requests--batching) - - [setRequestBatching](#setrequestbatching) - - [setRequestCache](#setrequestcache) - - [setRequestCaching](#setrequestcaching) -- [retrying](#retrying) - - [retry](#retry) -- [scheduler](#scheduler) - - [setScheduler](#setscheduler) -- [sequencing](#sequencing) - - [flatMap](#flatmap) - - [flatten](#flatten) - - [tap](#tap) - - [tapError](#taperror) - - [tapErrorCause](#taperrorcause) -- [symbols](#symbols) - - [LayerTypeId](#layertypeid) - - [LayerTypeId (type alias)](#layertypeid-type-alias) -- [tracing](#tracing) - - [parentSpan](#parentspan) - - [setTracer](#settracer) - - [setTracerTiming](#settracertiming) - - [span](#span) - - [withParentSpan](#withparentspan) - - [withSpan](#withspan) -- [utils](#utils) - - [Layer (namespace)](#layer-namespace) - - [Variance (interface)](#variance-interface) - - [Context (type alias)](#context-type-alias) - - [Error (type alias)](#error-type-alias) - - [Success (type alias)](#success-type-alias) - - [extendScope](#extendscope) - - [fiberRefLocallyScopedWith](#fiberreflocallyscopedwith) - - [fresh](#fresh) - - [locally](#locally) - - [locallyEffect](#locallyeffect) - - [locallyScoped](#locallyscoped) - - [locallyWith](#locallywith) - - [memoize](#memoize) - - [merge](#merge) - - [passthrough](#passthrough) - - [project](#project) - - [provide](#provide) - - [provideMerge](#providemerge) - - [unwrapEffect](#unwrapeffect) - - [unwrapScoped](#unwrapscoped) - - [use](#use) - - [useMerge](#usemerge) -- [zipping](#zipping) - - [mergeAll](#mergeall) - - [zipWithPar](#zipwithpar) - ---- - -# clock - -## setClock - -**Signature** - -```ts -export declare const setClock:
(clock: A) => Layer -``` - -Added in v2.0.0 - -# config - -## setConfigProvider - -Sets the current `ConfigProvider`. - -**Signature** - -```ts -export declare const setConfigProvider: (configProvider: ConfigProvider) => Layer -``` - -Added in v2.0.0 - -# constructors - -## context - -Constructs a `Layer` that passes along the specified context as an -output. - -**Signature** - -```ts -export declare const context: () => Layer -``` - -Added in v2.0.0 - -## die - -Constructs a layer that dies with the specified defect. - -**Signature** - -```ts -export declare const die: (defect: unknown) => Layer -``` - -Added in v2.0.0 - -## dieSync - -Constructs a layer that dies with the specified defect. - -**Signature** - -```ts -export declare const dieSync: (evaluate: LazyArg) => Layer -``` - -Added in v2.0.0 - -## effect - -Constructs a layer from the specified effect. - -**Signature** - -```ts -export declare const effect: { - >( - tag: T - ): (effect: Effect.Effect>) => Layer> - , R, E>( - tag: T, - effect: Effect.Effect> - ): Layer> -} -``` - -Added in v2.0.0 - -## effectContext - -Constructs a layer from the specified effect, which must return one or more -services. - -**Signature** - -```ts -export declare const effectContext: (effect: Effect.Effect>) => Layer -``` - -Added in v2.0.0 - -## effectDiscard - -Constructs a layer from the specified effect discarding it's output. - -**Signature** - -```ts -export declare const effectDiscard: (effect: Effect.Effect) => Layer -``` - -Added in v2.0.0 - -## fail - -Constructs a layer that fails with the specified error. - -**Signature** - -```ts -export declare const fail: (error: E) => Layer -``` - -Added in v2.0.0 - -## failCause - -Constructs a layer that fails with the specified cause. - -**Signature** - -```ts -export declare const failCause: (cause: Cause.Cause) => Layer -``` - -Added in v2.0.0 - -## failCauseSync - -Constructs a layer that fails with the specified cause. - -**Signature** - -```ts -export declare const failCauseSync: (evaluate: LazyArg>) => Layer -``` - -Added in v2.0.0 - -## failSync - -Constructs a layer that fails with the specified error. - -**Signature** - -```ts -export declare const failSync: (evaluate: LazyArg) => Layer -``` - -Added in v2.0.0 - -## function - -Constructs a layer from the context using the specified function. - -**Signature** - -```ts -export declare const function: , B extends Context.Tag>(tagA: A, tagB: B, f: (a: Context.Tag.Service) => Context.Tag.Service) => Layer, never, Context.Tag.Identifier> -``` - -Added in v2.0.0 - -## scope - -A layer that constructs a scope and closes it when the workflow the layer -is provided to completes execution, whether by success, failure, or -interruption. This can be used to close a scope when providing a layer to a -workflow. - -**Signature** - -```ts -export declare const scope: Layer -``` - -Added in v2.0.0 - -## scoped - -Constructs a layer from the specified scoped effect. - -**Signature** - -```ts -export declare const scoped: { - >( - tag: T - ): ( - effect: Effect.Effect> - ) => Layer, E, Context.Tag.Identifier> - , R, E>( - tag: T, - effect: Effect.Effect> - ): Layer, E, Context.Tag.Identifier> -} -``` - -Added in v2.0.0 - -## scopedContext - -Constructs a layer from the specified scoped effect, which must return one -or more services. - -**Signature** - -```ts -export declare const scopedContext: ( - effect: Effect.Effect> -) => Layer, E, A> -``` - -Added in v2.0.0 - -## scopedDiscard - -Constructs a layer from the specified scoped effect. - -**Signature** - -```ts -export declare const scopedDiscard: ( - effect: Effect.Effect -) => Layer, E, never> -``` - -Added in v2.0.0 - -## service - -Constructs a layer that accesses and returns the specified service from the -context. - -**Signature** - -```ts -export declare const service: >( - tag: T -) => Layer, never, Context.Tag.Identifier> -``` - -Added in v2.0.0 - -## succeed - -Constructs a layer from the specified value. - -**Signature** - -```ts -export declare const succeed: { - >( - tag: T - ): (resource: Context.Tag.Service) => Layer> - >( - tag: T, - resource: Context.Tag.Service - ): Layer> -} -``` - -Added in v2.0.0 - -## succeedContext - -Constructs a layer from the specified value, which must return one or more -services. - -**Signature** - -```ts -export declare const succeedContext: (context: Context.Context) => Layer -``` - -Added in v2.0.0 - -## suspend - -Lazily constructs a layer. This is useful to avoid infinite recursion when -creating layers that refer to themselves. - -**Signature** - -```ts -export declare const suspend: (evaluate: LazyArg>) => Layer -``` - -Added in v2.0.0 - -## sync - -Lazily constructs a layer from the specified value. - -**Signature** - -```ts -export declare const sync: { - >( - tag: T - ): (evaluate: LazyArg>) => Layer> - >( - tag: T, - evaluate: LazyArg> - ): Layer> -} -``` - -Added in v2.0.0 - -## syncContext - -Lazily constructs a layer from the specified value, which must return one or more -services. - -**Signature** - -```ts -export declare const syncContext: (evaluate: LazyArg>) => Layer -``` - -Added in v2.0.0 - -# conversions - -## launch - -Builds this layer and uses it until it is interrupted. This is useful when -your entire application is a layer, such as an HTTP server. - -**Signature** - -```ts -export declare const launch: (self: Layer) => Effect.Effect -``` - -Added in v2.0.0 - -## toRuntime - -Converts a layer that requires no services into a scoped runtime, which can -be used to execute effects. - -**Signature** - -```ts -export declare const toRuntime: ( - self: Layer -) => Effect.Effect> -``` - -Added in v2.0.0 - -# destructors - -## build - -Builds a layer into a scoped value. - -**Signature** - -```ts -export declare const build: ( - self: Layer -) => Effect.Effect> -``` - -Added in v2.0.0 - -## buildWithScope - -Builds a layer into an `Effect` value. Any resources associated with this -layer will be released when the specified scope is closed unless their scope -has been extended. This allows building layers where the lifetime of some of -the services output by the layer exceed the lifetime of the effect the -layer is provided to. - -**Signature** - -```ts -export declare const buildWithScope: { - (scope: Scope.Scope): (self: Layer) => Effect.Effect> - (self: Layer, scope: Scope.Scope): Effect.Effect> -} -``` - -Added in v2.0.0 - -# error handling - -## catchAll - -Recovers from all errors. - -**Signature** - -```ts -export declare const catchAll: { - (onError: (error: E) => Layer): (self: Layer) => Layer - (self: Layer, onError: (error: E) => Layer): Layer -} -``` - -Added in v2.0.0 - -## catchAllCause - -Recovers from all errors. - -**Signature** - -```ts -export declare const catchAllCause: { - ( - onError: (cause: Cause.Cause) => Layer - ): (self: Layer) => Layer - ( - self: Layer, - onError: (cause: Cause.Cause) => Layer - ): Layer -} -``` - -Added in v2.0.0 - -## orDie - -Translates effect failure into death of the fiber, making all failures -unchecked and not a part of the type of the layer. - -**Signature** - -```ts -export declare const orDie: (self: Layer) => Layer -``` - -Added in v2.0.0 - -## orElse - -Executes this layer and returns its output, if it succeeds, but otherwise -executes the specified layer. - -**Signature** - -```ts -export declare const orElse: { - (that: LazyArg>): (self: Layer) => Layer - (self: Layer, that: LazyArg>): Layer -} -``` - -Added in v2.0.0 - -# folding - -## match - -Feeds the error or output services of this layer into the input of either -the specified `failure` or `success` layers, resulting in a new layer with -the inputs of this layer, and the error or outputs of the specified layer. - -**Signature** - -```ts -export declare const match: { - (options: { - readonly onFailure: (error: E) => Layer - readonly onSuccess: (context: Context.Context) => Layer - }): (self: Layer) => Layer - ( - self: Layer, - options: { - readonly onFailure: (error: E) => Layer - readonly onSuccess: (context: Context.Context) => Layer - } - ): Layer -} -``` - -Added in v2.0.0 - -## matchCause - -Feeds the error or output services of this layer into the input of either -the specified `failure` or `success` layers, resulting in a new layer with -the inputs of this layer, and the error or outputs of the specified layer. - -**Signature** - -```ts -export declare const matchCause: { - (options: { - readonly onFailure: (cause: Cause.Cause) => Layer - readonly onSuccess: (context: Context.Context) => Layer - }): (self: Layer) => Layer - ( - self: Layer, - options: { - readonly onFailure: (cause: Cause.Cause) => Layer - readonly onSuccess: (context: Context.Context) => Layer - } - ): Layer -} -``` - -Added in v2.0.0 - -# getters - -## isFresh - -Returns `true` if the specified `Layer` is a fresh version that will not be -shared, `false` otherwise. - -**Signature** - -```ts -export declare const isFresh: (self: Layer) => boolean -``` - -Added in v2.0.0 - -## isLayer - -Returns `true` if the specified value is a `Layer`, `false` otherwise. - -**Signature** - -```ts -export declare const isLayer: (u: unknown) => u is Layer -``` - -Added in v2.0.0 - -# logging - -## setUnhandledErrorLogLevel - -**Signature** - -```ts -export declare const setUnhandledErrorLogLevel: (level: Option.Option) => Layer -``` - -Added in v2.0.0 - -# mapping - -## discard - -Replaces the layer's output with `void` and includes the layer only for its -side-effects. - -**Signature** - -```ts -export declare const discard: (self: Layer) => Layer -``` - -Added in v2.0.0 - -## map - -Returns a new layer whose output is mapped by the specified function. - -**Signature** - -```ts -export declare const map: { - (f: (context: Context.Context) => Context.Context): (self: Layer) => Layer - (self: Layer, f: (context: Context.Context) => Context.Context): Layer -} -``` - -Added in v2.0.0 - -## mapError - -Returns a layer with its error channel mapped using the specified function. - -**Signature** - -```ts -export declare const mapError: { - (f: (error: E) => E2): (self: Layer) => Layer - (self: Layer, f: (error: E) => E2): Layer -} -``` - -Added in v2.0.0 - -# models - -## Layer (interface) - -**Signature** - -```ts -export interface Layer extends Layer.Variance, Pipeable {} -``` - -Added in v2.0.0 - -# requests & batching - -## setRequestBatching - -**Signature** - -```ts -export declare const setRequestBatching: (requestBatching: boolean) => Layer -``` - -Added in v2.0.0 - -## setRequestCache - -**Signature** - -```ts -export declare const setRequestCache: { - (cache: Effect.Effect): Layer, E, never> - (cache: Request.Cache): Layer -} -``` - -Added in v2.0.0 - -## setRequestCaching - -**Signature** - -```ts -export declare const setRequestCaching: (requestCaching: boolean) => Layer -``` - -Added in v2.0.0 - -# retrying - -## retry - -Retries constructing this layer according to the specified schedule. - -**Signature** - -```ts -export declare const retry: { - ( - schedule: Schedule.Schedule - ): (self: Layer) => Layer - ( - self: Layer, - schedule: Schedule.Schedule - ): Layer -} -``` - -Added in v2.0.0 - -# scheduler - -## setScheduler - -**Signature** - -```ts -export declare const setScheduler: (scheduler: Scheduler.Scheduler) => Layer -``` - -Added in v2.0.0 - -# sequencing - -## flatMap - -Constructs a layer dynamically based on the output of this layer. - -**Signature** - -```ts -export declare const flatMap: { - ( - f: (context: Context.Context) => Layer - ): (self: Layer) => Layer - ( - self: Layer, - f: (context: Context.Context) => Layer - ): Layer -} -``` - -Added in v2.0.0 - -## flatten - -Flattens layers nested in the context of an effect. - -**Signature** - -```ts -export declare const flatten: { - (tag: Context.Tag>): (self: Layer) => Layer - (self: Layer, tag: Context.Tag>): Layer -} -``` - -Added in v2.0.0 - -## tap - -Performs the specified effect if this layer succeeds. - -**Signature** - -```ts -export declare const tap: { - ( - f: (context: Context.Context) => Effect.Effect - ): (self: Layer) => Layer - ( - self: Layer, - f: (context: Context.Context) => Effect.Effect - ): Layer -} -``` - -Added in v2.0.0 - -## tapError - -Performs the specified effect if this layer fails. - -**Signature** - -```ts -export declare const tapError: { - ( - f: (e: XE) => Effect.Effect - ): (self: Layer) => Layer - ( - self: Layer, - f: (e: XE) => Effect.Effect - ): Layer -} -``` - -Added in v2.0.0 - -## tapErrorCause - -Performs the specified effect if this layer fails. - -**Signature** - -```ts -export declare const tapErrorCause: { - ( - f: (cause: Cause.Cause) => Effect.Effect - ): (self: Layer) => Layer - ( - self: Layer, - f: (cause: Cause.Cause) => Effect.Effect - ): Layer -} -``` - -Added in v2.0.0 - -# symbols - -## LayerTypeId - -**Signature** - -```ts -export declare const LayerTypeId: typeof LayerTypeId -``` - -Added in v2.0.0 - -## LayerTypeId (type alias) - -**Signature** - -```ts -export type LayerTypeId = typeof LayerTypeId -``` - -Added in v2.0.0 - -# tracing - -## parentSpan - -Adds the provided span to the span stack. - -**Signature** - -```ts -export declare const parentSpan: (span: Tracer.ParentSpan) => Layer -``` - -Added in v2.0.0 - -## setTracer - -Create a Layer that sets the current Tracer - -**Signature** - -```ts -export declare const setTracer: (tracer: Tracer.Tracer) => Layer -``` - -Added in v2.0.0 - -## setTracerTiming - -**Signature** - -```ts -export declare const setTracerTiming: (enabled: boolean) => Layer -``` - -Added in v2.0.0 - -## span - -Create and add a span to the current span stack. - -The span is ended when the Layer is released. - -**Signature** - -```ts -export declare const span: ( - name: string, - options?: - | { - readonly attributes?: Record | undefined - readonly links?: ReadonlyArray | undefined - readonly parent?: Tracer.ParentSpan | undefined - readonly root?: boolean | undefined - readonly context?: Context.Context | undefined - readonly onEnd?: - | ((span: Tracer.Span, exit: Exit.Exit) => Effect.Effect) - | undefined - } - | undefined -) => Layer -``` - -Added in v2.0.0 - -## withParentSpan - -**Signature** - -```ts -export declare const withParentSpan: { - (span: Tracer.ParentSpan): (self: Layer) => Layer, E, A> - (self: Layer, span: Tracer.ParentSpan): Layer, E, A> -} -``` - -Added in v2.0.0 - -## withSpan - -**Signature** - -```ts -export declare const withSpan: { - ( - name: string, - options?: - | { - readonly attributes?: Record | undefined - readonly links?: ReadonlyArray | undefined - readonly parent?: Tracer.ParentSpan | undefined - readonly root?: boolean | undefined - readonly context?: Context.Context | undefined - readonly onEnd?: - | ((span: Tracer.Span, exit: Exit.Exit) => Effect.Effect) - | undefined - } - | undefined - ): (self: Layer) => Layer, E, A> - ( - self: Layer, - name: string, - options?: - | { - readonly attributes?: Record | undefined - readonly links?: ReadonlyArray | undefined - readonly parent?: Tracer.ParentSpan | undefined - readonly root?: boolean | undefined - readonly context?: Context.Context | undefined - readonly onEnd?: - | ((span: Tracer.Span, exit: Exit.Exit) => Effect.Effect) - | undefined - } - | undefined - ): Layer, E, A> -} -``` - -Added in v2.0.0 - -# utils - -## Layer (namespace) - -Added in v2.0.0 - -### Variance (interface) - -**Signature** - -```ts -export interface Variance { - readonly [LayerTypeId]: { - readonly _RIn: (_: never) => RIn - readonly _E: (_: never) => E - readonly _ROut: (_: ROut) => void - } -} -``` - -Added in v2.0.0 - -### Context (type alias) - -**Signature** - -```ts -export type Context> = [T] extends [Layer] ? _R : never -``` - -Added in v2.0.0 - -### Error (type alias) - -**Signature** - -```ts -export type Error> = [T] extends [Layer] ? _E : never -``` - -Added in v2.0.0 - -### Success (type alias) - -**Signature** - -```ts -export type Success> = [T] extends [Layer] ? _A : never -``` - -Added in v2.0.0 - -## extendScope - -Extends the scope of this layer, returning a new layer that when provided -to an effect will not immediately release its associated resources when -that effect completes execution but instead when the scope the resulting -effect depends on is closed. - -**Signature** - -```ts -export declare const extendScope: (self: Layer) => Layer -``` - -Added in v2.0.0 - -## fiberRefLocallyScopedWith - -**Signature** - -```ts -export declare const fiberRefLocallyScopedWith: (self: FiberRef, value: (_: A) => A) => Layer -``` - -Added in v2.0.0 - -## fresh - -Creates a fresh version of this layer that will not be shared. - -**Signature** - -```ts -export declare const fresh: (self: Layer) => Layer -``` - -Added in v2.0.0 - -## locally - -**Signature** - -```ts -export declare const locally: { - (ref: FiberRef, value: X): (self: Layer) => Layer - (self: Layer, ref: FiberRef, value: X): Layer -} -``` - -Added in v2.0.0 - -## locallyEffect - -**Signature** - -```ts -export declare const locallyEffect: { - ( - f: (_: Effect.Effect>) => Effect.Effect> - ): (self: Layer) => Layer - ( - self: Layer, - f: (_: Effect.Effect>) => Effect.Effect> - ): Layer -} -``` - -Added in v2.0.0 - -## locallyScoped - -**Signature** - -```ts -export declare const locallyScoped: (self: FiberRef, value: A) => Layer -``` - -Added in v2.0.0 - -## locallyWith - -**Signature** - -```ts -export declare const locallyWith: { - (ref: FiberRef, value: (_: X) => X): (self: Layer) => Layer - (self: Layer, ref: FiberRef, value: (_: X) => X): Layer -} -``` - -Added in v2.0.0 - -## memoize - -Returns a scoped effect that, if evaluated, will return the lazily computed -result of this layer. - -**Signature** - -```ts -export declare const memoize: ( - self: Layer -) => Effect.Effect> -``` - -Added in v2.0.0 - -## merge - -Combines this layer with the specified layer, producing a new layer that -has the inputs and outputs of both. - -**Signature** - -```ts -export declare const merge: { - ( - that: Layer - ): (self: Layer) => Layer - ( - self: Layer, - that: Layer - ): Layer -} -``` - -Added in v2.0.0 - -## passthrough - -Returns a new layer that produces the outputs of this layer but also -passes through the inputs. - -**Signature** - -```ts -export declare const passthrough: (self: Layer) => Layer -``` - -Added in v2.0.0 - -## project - -Projects out part of one of the services output by this layer using the -specified function. - -**Signature** - -```ts -export declare const project: { - , B extends Context.Tag>( - tagA: A, - tagB: B, - f: (a: Context.Tag.Service) => Context.Tag.Service - ): (self: Layer>) => Layer> - , B extends Context.Tag>( - self: Layer>, - tagA: A, - tagB: B, - f: (a: Context.Tag.Service) => Context.Tag.Service - ): Layer> -} -``` - -Added in v2.0.0 - -## provide - -Feeds the output services of this builder into the input of the specified -builder, resulting in a new builder with the inputs of this builder as -well as any leftover inputs, and the outputs of the specified builder. - -**Signature** - -```ts -export declare const provide: { - ( - that: Layer - ): (self: Layer) => Layer, E2 | E, ROut2> - ( - self: Layer, - that: Layer - ): Layer, E | E2, ROut2> -} -``` - -Added in v2.0.0 - -## provideMerge - -Feeds the output services of this layer into the input of the specified -layer, resulting in a new layer with the inputs of this layer, and the -outputs of both layers. - -**Signature** - -```ts -export declare const provideMerge: { - ( - that: Layer - ): (self: Layer) => Layer, E2 | E, ROut2 | ROut> - ( - self: Layer, - that: Layer - ): Layer, E | E2, ROut | ROut2> -} -``` - -Added in v2.0.0 - -## unwrapEffect - -**Signature** - -```ts -export declare const unwrapEffect: ( - self: Effect.Effect> -) => Layer -``` - -Added in v2.0.0 - -## unwrapScoped - -**Signature** - -```ts -export declare const unwrapScoped: ( - self: Effect.Effect> -) => Layer, E | E1, A> -``` - -Added in v2.0.0 - -## use - -Feeds the output services of this builder into the input of the specified -builder, resulting in a new builder with the inputs of this builder as -well as any leftover inputs, and the outputs of the specified builder. - -**Signature** - -```ts -export declare const use: { - ( - self: Layer - ): (that: Layer) => Layer, E | E2, ROut2> - ( - that: Layer, - self: Layer - ): Layer, E2 | E, ROut2> -} -``` - -Added in v2.0.0 - -## useMerge - -Feeds the output services of this layer into the input of the specified -layer, resulting in a new layer with the inputs of this layer, and the -outputs of both layers. - -**Signature** - -```ts -export declare const useMerge: { - ( - self: Layer - ): (that: Layer) => Layer, E | E2, ROut | ROut2> - ( - that: Layer, - self: Layer - ): Layer, E2 | E, ROut2 | ROut> -} -``` - -Added in v2.0.0 - -# zipping - -## mergeAll - -Merges all the layers together in parallel. - -**Signature** - -```ts -export declare const mergeAll: , ...Layer[]]>( - ...layers: Layers -) => Layer< - { [k in keyof Layers]: Layer.Context }[number], - { [k in keyof Layers]: Layer.Error }[number], - { [k in keyof Layers]: Layer.Success }[number] -> -``` - -Added in v2.0.0 - -## zipWithPar - -Combines this layer the specified layer, producing a new layer that has the -inputs of both, and the outputs of both combined using the specified -function. - -**Signature** - -```ts -export declare const zipWithPar: { - ( - that: Layer, - f: (a: Context.Context, b: Context.Context) => Context.Context - ): (self: Layer) => Layer - ( - self: Layer, - that: Layer, - f: (a: Context.Context, b: Context.Context) => Context.Context - ): Layer -} -``` - -Added in v2.0.0 diff --git a/docs/modules/List.ts.md b/docs/modules/List.ts.md deleted file mode 100644 index bd31ec067..000000000 --- a/docs/modules/List.ts.md +++ /dev/null @@ -1,817 +0,0 @@ ---- -title: List.ts -nav_order: 48 -parent: Modules ---- - -## List overview - -A data type for immutable linked lists representing ordered collections of elements of type `A`. - -This data type is optimal for last-in-first-out (LIFO), stack-like access patterns. If you need another access pattern, for example, random access or FIFO, consider using a collection more suited to this than `List`. - -**Performance** - -- Time: `List` has `O(1)` prepend and head/tail access. Most other operations are `O(n)` on the number of elements in the list. This includes the index-based lookup of elements, `length`, `append` and `reverse`. -- Space: `List` implements structural sharing of the tail list. This means that many operations are either zero- or constant-memory cost. - -Added in v2.0.0 - ---- - -

Table of contents

- -- [combinators](#combinators) - - [compact](#compact) - - [drop](#drop) - - [filter](#filter) - - [filterMap](#filtermap) - - [forEach](#foreach) - - [map](#map) - - [partition](#partition) - - [partitionMap](#partitionmap) - - [splitAt](#splitat) - - [take](#take) -- [concatenating](#concatenating) - - [append](#append) - - [appendAll](#appendall) - - [appendAllNonEmpty](#appendallnonempty) - - [prepend](#prepend) - - [prependAll](#prependall) - - [prependAllNonEmpty](#prependallnonempty) - - [prependAllReversed](#prependallreversed) -- [constructors](#constructors) - - [cons](#cons) - - [empty](#empty) - - [fromIterable](#fromiterable) - - [make](#make) - - [nil](#nil) - - [of](#of) -- [conversions](#conversions) - - [toArray](#toarray) - - [toChunk](#tochunk) -- [elements](#elements) - - [every](#every) - - [findFirst](#findfirst) - - [reverse](#reverse) - - [some](#some) -- [equivalence](#equivalence) - - [getEquivalence](#getequivalence) -- [folding](#folding) - - [reduce](#reduce) - - [reduceRight](#reduceright) -- [getters](#getters) - - [head](#head) - - [last](#last) - - [size](#size) - - [tail](#tail) -- [models](#models) - - [Cons (interface)](#cons-interface) - - [List (type alias)](#list-type-alias) - - [Nil (interface)](#nil-interface) -- [refinements](#refinements) - - [isCons](#iscons) - - [isList](#islist) - - [isNil](#isnil) -- [sequencing](#sequencing) - - [flatMap](#flatmap) - - [flatMapNonEmpty](#flatmapnonempty) -- [symbol](#symbol) - - [TypeId](#typeid) - - [TypeId (type alias)](#typeid-type-alias) -- [unsafe](#unsafe) - - [unsafeHead](#unsafehead) - - [unsafeLast](#unsafelast) - - [unsafeTail](#unsafetail) -- [utils](#utils) - - [List (namespace)](#list-namespace) - - [Infer (type alias)](#infer-type-alias) - - [With (type alias)](#with-type-alias) - ---- - -# combinators - -## compact - -Removes all `None` values from the specified list. - -**Signature** - -```ts -export declare const compact:
(self: List>) => List -``` - -Added in v2.0.0 - -## drop - -Drops the first `n` elements from the specified list. - -**Signature** - -```ts -export declare const drop: { (n: number): (self: List) => List; (self: List, n: number): List } -``` - -Added in v2.0.0 - -## filter - -Filters a list using the specified predicate. - -**Signature** - -```ts -export declare const filter: { - (refinement: Refinement): (self: List) => List - (predicate: Predicate): (self: List) => List - (self: List, refinement: Refinement): List - (self: List, predicate: Predicate): List -} -``` - -Added in v2.0.0 - -## filterMap - -Filters and maps a list using the specified partial function. The resulting -list may be smaller than the input list due to the possibility of the partial -function not being defined for some elements. - -**Signature** - -```ts -export declare const filterMap: { - (f: (a: A) => Option.Option): (self: List) => List - (self: List, f: (a: A) => Option.Option): List -} -``` - -Added in v2.0.0 - -## forEach - -Applies the specified function to each element of the `List`. - -**Signature** - -```ts -export declare const forEach: { - (f: (a: A) => B): (self: List) => void - (self: List, f: (a: A) => B): void -} -``` - -Added in v2.0.0 - -## map - -Applies the specified mapping function to each element of the list. - -**Signature** - -```ts -export declare const map: { - , B>(f: (a: List.Infer, i: number) => B): (self: T) => List.With - , B>(self: T, f: (a: List.Infer, i: number) => B): List.With -} -``` - -Added in v2.0.0 - -## partition - -Partition a list into two lists, where the first list contains all elements -that did not satisfy the specified predicate, and the second list contains -all elements that did satisfy the specified predicate. - -**Signature** - -```ts -export declare const partition: { - (refinement: Refinement): (self: List) => [List>, List] - (predicate: (a: A) => boolean): (self: List) => [List, List] - (self: List, refinement: Refinement): [List>, List] - (self: List, predicate: (a: A) => boolean): [List, List] -} -``` - -Added in v2.0.0 - -## partitionMap - -Partition a list into two lists, where the first list contains all elements -for which the specified function returned a `Left`, and the second list -contains all elements for which the specified function returned a `Right`. - -**Signature** - -```ts -export declare const partitionMap: { - (f: (a: A) => Either.Either): (self: List) => [List, List] - (self: List, f: (a: A) => Either.Either): [List, List] -} -``` - -Added in v2.0.0 - -## splitAt - -Splits the specified list into two lists at the specified index. - -**Signature** - -```ts -export declare const splitAt: { - (n: number): (self: List) => [List, List] - (self: List, n: number): [List, List] -} -``` - -Added in v2.0.0 - -## take - -Takes the specified number of elements from the beginning of the specified -list. - -**Signature** - -```ts -export declare const take: { (n: number): (self: List) => List; (self: List, n: number): List } -``` - -Added in v2.0.0 - -# concatenating - -## append - -Appends the specified element to the end of the `List`, creating a new `Cons`. - -**Signature** - -```ts -export declare const append: { - (element: B): (self: List) => Cons - (self: List, element: B): Cons -} -``` - -Added in v2.0.0 - -## appendAll - -Concatentates the specified lists together. - -**Signature** - -```ts -export declare const appendAll: { - (that: List): (self: List) => List - (self: List, that: List): List -} -``` - -Added in v2.0.0 - -## appendAllNonEmpty - -**Signature** - -```ts -export declare const appendAllNonEmpty: { - (that: Cons): (self: List) => Cons - (that: List): (self: Cons) => Cons - (self: List, that: Cons): Cons - (self: Cons, that: List): Cons -} -``` - -Added in v2.0.0 - -## prepend - -Prepends the specified element to the beginning of the list. - -**Signature** - -```ts -export declare const prepend: { - (element: B): (self: List) => Cons - (self: List, element: B): Cons -} -``` - -Added in v2.0.0 - -## prependAll - -Prepends the specified prefix list to the beginning of the specified list. - -**Signature** - -```ts -export declare const prependAll: { - (prefix: List): (self: List) => List - (self: List, prefix: List): List -} -``` - -Added in v2.0.0 - -## prependAllNonEmpty - -**Signature** - -```ts -export declare const prependAllNonEmpty: { - (that: Cons): (self: List) => Cons - (that: List): (self: Cons) => Cons - (self: List, that: Cons): Cons - (self: Cons, that: List): Cons -} -``` - -Added in v2.0.0 - -## prependAllReversed - -Prepends the specified prefix list (in reverse order) to the beginning of the -specified list. - -**Signature** - -```ts -export declare const prependAllReversed: { - (prefix: List): (self: List) => List - (self: List, prefix: List): List -} -``` - -Added in v2.0.0 - -# constructors - -## cons - -Constructs a new `List.Cons` from the specified `head` and `tail` values. - -**Signature** - -```ts -export declare const cons: (head: A, tail: List) => Cons -``` - -Added in v2.0.0 - -## empty - -Constructs a new empty `List`. - -Alias of {@link nil}. - -**Signature** - -```ts -export declare const empty: () => List -``` - -Added in v2.0.0 - -## fromIterable - -Constructs a new `List` from the specified `Iterable`. - -**Signature** - -```ts -export declare const fromIterable: (prefix: Iterable) => List -``` - -Added in v2.0.0 - -## make - -Constructs a new `List` from the specified values. - -**Signature** - -```ts -export declare const make: (...elements: Elements) => Cons -``` - -Added in v2.0.0 - -## nil - -Constructs a new empty `List`. - -**Signature** - -```ts -export declare const nil: () => List -``` - -Added in v2.0.0 - -## of - -Constructs a new `List` from the specified value. - -**Signature** - -```ts -export declare const of: (value: A) => Cons -``` - -Added in v2.0.0 - -# conversions - -## toArray - -Converts the specified `List` to an `Array`. - -**Signature** - -```ts -export declare const toArray: (self: List) => A[] -``` - -Added in v2.0.0 - -## toChunk - -Converts the specified `List` to a `Chunk`. - -**Signature** - -```ts -export declare const toChunk: (self: List) => Chunk.Chunk -``` - -Added in v2.0.0 - -# elements - -## every - -Check if a predicate holds true for every `List` element. - -**Signature** - -```ts -export declare const every: { - (refinement: Refinement): (self: List) => self is List - (predicate: Predicate): (self: List) => boolean - (self: List, refinement: Refinement): self is List - (self: List, predicate: Predicate): boolean -} -``` - -Added in v2.0.0 - -## findFirst - -Returns the first element that satisfies the specified -predicate, or `None` if no such element exists. - -**Signature** - -```ts -export declare const findFirst: { - (refinement: Refinement): (self: List) => Option.Option - (predicate: Predicate): (self: List) => Option.Option - (self: List, refinement: Refinement): Option.Option - (self: List, predicate: Predicate): Option.Option -} -``` - -Added in v2.0.0 - -## reverse - -Returns a new list with the elements of the specified list in reverse order. - -**Signature** - -```ts -export declare const reverse: (self: List) => List -``` - -Added in v2.0.0 - -## some - -Check if a predicate holds true for some `List` element. - -**Signature** - -```ts -export declare const some: { - (predicate: Predicate): (self: List) => self is Cons - (self: List, predicate: Predicate): self is Cons -} -``` - -Added in v2.0.0 - -# equivalence - -## getEquivalence - -**Signature** - -```ts -export declare const getEquivalence: (isEquivalent: Equivalence.Equivalence) => Equivalence.Equivalence> -``` - -Added in v2.0.0 - -# folding - -## reduce - -Folds over the elements of the list using the specified function, using the -specified initial value. - -**Signature** - -```ts -export declare const reduce: { - (zero: Z, f: (b: Z, a: A) => Z): (self: List) => Z - (self: List, zero: Z, f: (b: Z, a: A) => Z): Z -} -``` - -Added in v2.0.0 - -## reduceRight - -Folds over the elements of the list using the specified function, beginning -with the last element of the list, using the specified initial value. - -**Signature** - -```ts -export declare const reduceRight: { - (zero: Z, f: (accumulator: Z, value: A) => Z): (self: List) => Z - (self: List, zero: Z, f: (accumulator: Z, value: A) => Z): Z -} -``` - -Added in v2.0.0 - -# getters - -## head - -Returns the first element of the specified list, or `None` if the list is -empty. - -**Signature** - -```ts -export declare const head: (self: List) => Option.Option -``` - -Added in v2.0.0 - -## last - -Returns the last element of the specified list, or `None` if the list is -empty. - -**Signature** - -```ts -export declare const last: (self: List) => Option.Option -``` - -Added in v2.0.0 - -## size - -Returns the number of elements contained in the specified `List` - -**Signature** - -```ts -export declare const size: (self: List) => number -``` - -Added in v2.0.0 - -## tail - -Returns the tail of the specified list, or `None` if the list is empty. - -**Signature** - -```ts -export declare const tail: (self: List) => Option.Option> -``` - -Added in v2.0.0 - -# models - -## Cons (interface) - -**Signature** - -```ts -export interface Cons extends Iterable, Equal.Equal, Pipeable, Inspectable { - readonly [TypeId]: TypeId - readonly _tag: "Cons" - readonly head: A - readonly tail: List -} -``` - -Added in v2.0.0 - -## List (type alias) - -Represents an immutable linked list of elements of type `A`. - -A `List` is optimal for last-in-first-out (LIFO), stack-like access patterns. -If you need another access pattern, for example, random access or FIFO, -consider using a collection more suited for that other than `List`. - -**Signature** - -```ts -export type List = Cons | Nil -``` - -Added in v2.0.0 - -## Nil (interface) - -**Signature** - -```ts -export interface Nil extends Iterable, Equal.Equal, Pipeable, Inspectable { - readonly [TypeId]: TypeId - readonly _tag: "Nil" -} -``` - -Added in v2.0.0 - -# refinements - -## isCons - -Returns `true` if the specified value is a `List.Cons`, `false` otherwise. - -**Signature** - -```ts -export declare const isCons: (self: List) => self is Cons -``` - -Added in v2.0.0 - -## isList - -Returns `true` if the specified value is a `List`, `false` otherwise. - -**Signature** - -```ts -export declare const isList: { (u: Iterable): u is List; (u: unknown): u is List } -``` - -Added in v2.0.0 - -## isNil - -Returns `true` if the specified value is a `List.Nil`, `false` otherwise. - -**Signature** - -```ts -export declare const isNil: (self: List) => self is Nil -``` - -Added in v2.0.0 - -# sequencing - -## flatMap - -Flat maps a list using the specified function. - -**Signature** - -```ts -export declare const flatMap: { - (f: (a: A) => List): (self: List) => List - (self: List, f: (a: A) => List): List -} -``` - -Added in v2.0.0 - -## flatMapNonEmpty - -**Signature** - -```ts -export declare const flatMapNonEmpty: { - (f: (a: A) => Cons): (self: Cons) => Cons - (self: Cons, f: (a: A) => Cons): Cons -} -``` - -Added in v2.0.0 - -# symbol - -## TypeId - -**Signature** - -```ts -export declare const TypeId: typeof TypeId -``` - -Added in v2.0.0 - -## TypeId (type alias) - -**Signature** - -```ts -export type TypeId = typeof TypeId -``` - -Added in v2.0.0 - -# unsafe - -## unsafeHead - -Unsafely returns the first element of the specified `List`. - -**Signature** - -```ts -export declare const unsafeHead: (self: List) => A -``` - -Added in v2.0.0 - -## unsafeLast - -Unsafely returns the last element of the specified `List`. - -**Signature** - -```ts -export declare const unsafeLast: (self: List) => A -``` - -Added in v2.0.0 - -## unsafeTail - -Unsafely returns the tail of the specified `List`. - -**Signature** - -```ts -export declare const unsafeTail: (self: List) => List -``` - -Added in v2.0.0 - -# utils - -## List (namespace) - -Added in v2.0.0 - -### Infer (type alias) - -**Signature** - -```ts -export type Infer> = T extends List ? A : never -``` - -Added in v2.0.0 - -### With (type alias) - -**Signature** - -```ts -export type With, A> = T extends Cons ? Cons : List -``` - -Added in v2.0.0 diff --git a/docs/modules/LogLevel.ts.md b/docs/modules/LogLevel.ts.md deleted file mode 100644 index 8e8aef731..000000000 --- a/docs/modules/LogLevel.ts.md +++ /dev/null @@ -1,383 +0,0 @@ ---- -title: LogLevel.ts -nav_order: 50 -parent: Modules ---- - -## LogLevel overview - -Added in v2.0.0 - ---- - -

Table of contents

- -- [constructors](#constructors) - - [All](#all) - - [Debug](#debug) - - [Error](#error) - - [Fatal](#fatal) - - [Info](#info) - - [None](#none) - - [Trace](#trace) - - [Warning](#warning) - - [allLevels](#alllevels) -- [conversions](#conversions) - - [fromLiteral](#fromliteral) -- [instances](#instances) - - [Order](#order) -- [model](#model) - - [All (interface)](#all-interface) - - [Debug (interface)](#debug-interface) - - [Error (interface)](#error-interface) - - [Fatal (interface)](#fatal-interface) - - [Info (interface)](#info-interface) - - [Literal (type alias)](#literal-type-alias) - - [LogLevel (type alias)](#loglevel-type-alias) - - [None (interface)](#none-interface) - - [Trace (interface)](#trace-interface) - - [Warning (interface)](#warning-interface) -- [ordering](#ordering) - - [greaterThan](#greaterthan) - - [greaterThanEqual](#greaterthanequal) - - [lessThan](#lessthan) - - [lessThanEqual](#lessthanequal) -- [utils](#utils) - - [locally](#locally) - ---- - -# constructors - -## All - -**Signature** - -```ts -export declare const All: LogLevel -``` - -Added in v2.0.0 - -## Debug - -**Signature** - -```ts -export declare const Debug: LogLevel -``` - -Added in v2.0.0 - -## Error - -**Signature** - -```ts -export declare const Error: LogLevel -``` - -Added in v2.0.0 - -## Fatal - -**Signature** - -```ts -export declare const Fatal: LogLevel -``` - -Added in v2.0.0 - -## Info - -**Signature** - -```ts -export declare const Info: LogLevel -``` - -Added in v2.0.0 - -## None - -**Signature** - -```ts -export declare const None: LogLevel -``` - -Added in v2.0.0 - -## Trace - -**Signature** - -```ts -export declare const Trace: LogLevel -``` - -Added in v2.0.0 - -## Warning - -**Signature** - -```ts -export declare const Warning: LogLevel -``` - -Added in v2.0.0 - -## allLevels - -**Signature** - -```ts -export declare const allLevels: readonly LogLevel[] -``` - -Added in v2.0.0 - -# conversions - -## fromLiteral - -**Signature** - -```ts -export declare const fromLiteral: (literal: Literal) => LogLevel -``` - -Added in v2.0.0 - -# instances - -## Order - -**Signature** - -```ts -export declare const Order: order.Order -``` - -Added in v2.0.0 - -# model - -## All (interface) - -**Signature** - -```ts -export interface All extends Pipeable { - readonly _tag: "All" - readonly label: "ALL" - readonly syslog: 0 - readonly ordinal: number -} -``` - -Added in v2.0.0 - -## Debug (interface) - -**Signature** - -```ts -export interface Debug extends Pipeable { - readonly _tag: "Debug" - readonly label: "DEBUG" - readonly syslog: 7 - readonly ordinal: number -} -``` - -Added in v2.0.0 - -## Error (interface) - -**Signature** - -```ts -export interface Error extends Pipeable { - readonly _tag: "Error" - readonly label: "ERROR" - readonly syslog: 3 - readonly ordinal: number -} -``` - -Added in v2.0.0 - -## Fatal (interface) - -**Signature** - -```ts -export interface Fatal extends Pipeable { - readonly _tag: "Fatal" - readonly label: "FATAL" - readonly syslog: 2 - readonly ordinal: number -} -``` - -Added in v2.0.0 - -## Info (interface) - -**Signature** - -```ts -export interface Info extends Pipeable { - readonly _tag: "Info" - readonly label: "INFO" - readonly syslog: 6 - readonly ordinal: number -} -``` - -Added in v2.0.0 - -## Literal (type alias) - -**Signature** - -```ts -export type Literal = LogLevel["_tag"] -``` - -Added in v2.0.0 - -## LogLevel (type alias) - -A `LogLevel` represents the log level associated with an individual logging -operation. Log levels are used both to describe the granularity (or -importance) of individual log statements, as well as to enable tuning -verbosity of log output. - -**Signature** - -```ts -export type LogLevel = All | Fatal | Error | Warning | Info | Debug | Trace | None -``` - -Added in v2.0.0 - -## None (interface) - -**Signature** - -```ts -export interface None extends Pipeable { - readonly _tag: "None" - readonly label: "OFF" - readonly syslog: 7 - readonly ordinal: number -} -``` - -Added in v2.0.0 - -## Trace (interface) - -**Signature** - -```ts -export interface Trace extends Pipeable { - readonly _tag: "Trace" - readonly label: "TRACE" - readonly syslog: 7 - readonly ordinal: number -} -``` - -Added in v2.0.0 - -## Warning (interface) - -**Signature** - -```ts -export interface Warning extends Pipeable { - readonly _tag: "Warning" - readonly label: "WARN" - readonly syslog: 4 - readonly ordinal: number -} -``` - -Added in v2.0.0 - -# ordering - -## greaterThan - -**Signature** - -```ts -export declare const greaterThan: { - (that: LogLevel): (self: LogLevel) => boolean - (self: LogLevel, that: LogLevel): boolean -} -``` - -Added in v2.0.0 - -## greaterThanEqual - -**Signature** - -```ts -export declare const greaterThanEqual: { - (that: LogLevel): (self: LogLevel) => boolean - (self: LogLevel, that: LogLevel): boolean -} -``` - -Added in v2.0.0 - -## lessThan - -**Signature** - -```ts -export declare const lessThan: { - (that: LogLevel): (self: LogLevel) => boolean - (self: LogLevel, that: LogLevel): boolean -} -``` - -Added in v2.0.0 - -## lessThanEqual - -**Signature** - -```ts -export declare const lessThanEqual: { - (that: LogLevel): (self: LogLevel) => boolean - (self: LogLevel, that: LogLevel): boolean -} -``` - -Added in v2.0.0 - -# utils - -## locally - -Locally applies the specified `LogLevel` to an `Effect` workflow, reverting -to the previous `LogLevel` after the `Effect` workflow completes. - -**Signature** - -```ts -export declare const locally: { - (self: LogLevel): (use: Effect.Effect) => Effect.Effect - (use: Effect.Effect, self: LogLevel): Effect.Effect -} -``` - -Added in v2.0.0 diff --git a/docs/modules/LogSpan.ts.md b/docs/modules/LogSpan.ts.md deleted file mode 100644 index fd58c7f8f..000000000 --- a/docs/modules/LogSpan.ts.md +++ /dev/null @@ -1,61 +0,0 @@ ---- -title: LogSpan.ts -nav_order: 51 -parent: Modules ---- - -## LogSpan overview - -Added in v2.0.0 - ---- - -

Table of contents

- -- [constructors](#constructors) - - [make](#make) -- [destructors](#destructors) - - [render](#render) -- [models](#models) - - [LogSpan (interface)](#logspan-interface) - ---- - -# constructors - -## make - -**Signature** - -```ts -export declare const make: (label: string, startTime: number) => LogSpan -``` - -Added in v2.0.0 - -# destructors - -## render - -**Signature** - -```ts -export declare const render: (now: number) => (self: LogSpan) => string -``` - -Added in v2.0.0 - -# models - -## LogSpan (interface) - -**Signature** - -```ts -export interface LogSpan { - readonly label: string - readonly startTime: number -} -``` - -Added in v2.0.0 diff --git a/docs/modules/Logger.ts.md b/docs/modules/Logger.ts.md deleted file mode 100644 index 91c2ddf42..000000000 --- a/docs/modules/Logger.ts.md +++ /dev/null @@ -1,512 +0,0 @@ ---- -title: Logger.ts -nav_order: 49 -parent: Modules ---- - -## Logger overview - -Added in v2.0.0 - ---- - -

Table of contents

- -- [constructors](#constructors) - - [defaultLogger](#defaultlogger) - - [logFmt](#logfmt) - - [logfmtLogger](#logfmtlogger) - - [make](#make) - - [none](#none) - - [simple](#simple) - - [stringLogger](#stringlogger) - - [succeed](#succeed) - - [sync](#sync) - - [test](#test) - - [tracerLogger](#tracerlogger) -- [context](#context) - - [add](#add) - - [addEffect](#addeffect) - - [addScoped](#addscoped) - - [minimumLogLevel](#minimumloglevel) - - [remove](#remove) - - [replace](#replace) - - [replaceEffect](#replaceeffect) - - [replaceScoped](#replacescoped) - - [withMinimumLogLevel](#withminimumloglevel) -- [filtering](#filtering) - - [filterLogLevel](#filterloglevel) -- [mapping](#mapping) - - [map](#map) - - [mapInput](#mapinput) - - [mapInputOptions](#mapinputoptions) -- [models](#models) - - [Logger (interface)](#logger-interface) -- [symbols](#symbols) - - [LoggerTypeId](#loggertypeid) - - [LoggerTypeId (type alias)](#loggertypeid-type-alias) -- [tracing](#tracing) - - [withSpanAnnotations](#withspanannotations) -- [utils](#utils) - - [Logger (namespace)](#logger-namespace) - - [Options (interface)](#options-interface) - - [Variance (interface)](#variance-interface) -- [zipping](#zipping) - - [zip](#zip) - - [zipLeft](#zipleft) - - [zipRight](#zipright) - ---- - -# constructors - -## defaultLogger - -**Signature** - -```ts -export declare const defaultLogger: Logger -``` - -Added in v2.0.0 - -## logFmt - -**Signature** - -```ts -export declare const logFmt: Layer.Layer -``` - -Added in v2.0.0 - -## logfmtLogger - -**Signature** - -```ts -export declare const logfmtLogger: Logger -``` - -Added in v2.0.0 - -## make - -**Signature** - -```ts -export declare const make: ( - log: (options: Logger.Options) => Output -) => Logger -``` - -Added in v2.0.0 - -## none - -A logger that does nothing in response to logging events. - -**Signature** - -```ts -export declare const none: Logger -``` - -Added in v2.0.0 - -## simple - -**Signature** - -```ts -export declare const simple: (log: (a: A) => B) => Logger -``` - -Added in v2.0.0 - -## stringLogger - -**Signature** - -```ts -export declare const stringLogger: Logger -``` - -Added in v2.0.0 - -## succeed - -**Signature** - -```ts -export declare const succeed:
(value: A) => Logger -``` - -Added in v2.0.0 - -## sync - -**Signature** - -```ts -export declare const sync: (evaluate: LazyArg) => Logger -``` - -Added in v2.0.0 - -## test - -**Signature** - -```ts -export declare const test: { - (input: Message): (self: Logger) => Output - (self: Logger, input: Message): Output -} -``` - -Added in v2.0.0 - -## tracerLogger - -**Signature** - -```ts -export declare const tracerLogger: Logger -``` - -Added in v2.0.0 - -# context - -## add - -**Signature** - -```ts -export declare const add: (logger: Logger) => Layer.Layer -``` - -Added in v2.0.0 - -## addEffect - -**Signature** - -```ts -export declare const addEffect: (effect: Effect>) => Layer.Layer -``` - -Added in v2.0.0 - -## addScoped - -**Signature** - -```ts -export declare const addScoped: ( - effect: Effect> -) => Layer.Layer, E, never> -``` - -Added in v2.0.0 - -## minimumLogLevel - -**Signature** - -```ts -export declare const minimumLogLevel: (level: LogLevel.LogLevel) => Layer.Layer -``` - -Added in v2.0.0 - -## remove - -**Signature** - -```ts -export declare const remove: (logger: Logger) => Layer.Layer -``` - -Added in v2.0.0 - -## replace - -**Signature** - -```ts -export declare const replace: { - (that: Logger): (self: Logger) => Layer.Layer - (self: Logger, that: Logger): Layer.Layer -} -``` - -Added in v2.0.0 - -## replaceEffect - -**Signature** - -```ts -export declare const replaceEffect: { - (that: Effect>): (self: Logger) => Layer.Layer - (self: Logger, that: Effect>): Layer.Layer -} -``` - -Added in v2.0.0 - -## replaceScoped - -**Signature** - -```ts -export declare const replaceScoped: { - ( - that: Effect> - ): (self: Logger) => Layer.Layer, E, never> - ( - self: Logger, - that: Effect> - ): Layer.Layer, E, never> -} -``` - -Added in v2.0.0 - -## withMinimumLogLevel - -**Signature** - -```ts -export declare const withMinimumLogLevel: { - (level: LogLevel.LogLevel): (self: Effect) => Effect - (self: Effect, level: LogLevel.LogLevel): Effect -} -``` - -Added in v2.0.0 - -# filtering - -## filterLogLevel - -Returns a version of this logger that only logs messages when the log level -satisfies the specified predicate. - -**Signature** - -```ts -export declare const filterLogLevel: { - ( - f: (logLevel: LogLevel.LogLevel) => boolean - ): (self: Logger) => Logger> - ( - self: Logger, - f: (logLevel: LogLevel.LogLevel) => boolean - ): Logger> -} -``` - -Added in v2.0.0 - -# mapping - -## map - -**Signature** - -```ts -export declare const map: { - ( - f: (output: Output) => Output2 - ): (self: Logger) => Logger - (self: Logger, f: (output: Output) => Output2): Logger -} -``` - -Added in v2.0.0 - -## mapInput - -**Signature** - -```ts -export declare const mapInput: { - ( - f: (message: Message2) => Message - ): (self: Logger) => Logger - ( - self: Logger, - f: (message: Message2) => Message - ): Logger -} -``` - -Added in v2.0.0 - -## mapInputOptions - -**Signature** - -```ts -export declare const mapInputOptions: { - ( - f: (options: Logger.Options) => Logger.Options - ): (self: Logger) => Logger - ( - self: Logger, - f: (options: Logger.Options) => Logger.Options - ): Logger -} -``` - -Added in v2.0.0 - -# models - -## Logger (interface) - -**Signature** - -```ts -export interface Logger extends Logger.Variance, Pipeable { - readonly log: (options: Logger.Options) => Output -} -``` - -Added in v2.0.0 - -# symbols - -## LoggerTypeId - -**Signature** - -```ts -export declare const LoggerTypeId: typeof LoggerTypeId -``` - -Added in v2.0.0 - -## LoggerTypeId (type alias) - -**Signature** - -```ts -export type LoggerTypeId = typeof LoggerTypeId -``` - -Added in v2.0.0 - -# tracing - -## withSpanAnnotations - -**Signature** - -```ts -export declare const withSpanAnnotations: (self: Logger) => Logger -``` - -Added in v2.0.0 - -# utils - -## Logger (namespace) - -Added in v2.0.0 - -### Options (interface) - -**Signature** - -```ts -export interface Options { - readonly fiberId: FiberId.FiberId - readonly logLevel: LogLevel.LogLevel - readonly message: Message - readonly cause: Cause.Cause - readonly context: FiberRefs.FiberRefs - readonly spans: List.List - readonly annotations: HashMap.HashMap - readonly date: Date -} -``` - -Added in v2.0.0 - -### Variance (interface) - -**Signature** - -```ts -export interface Variance { - readonly [LoggerTypeId]: { - readonly _Message: (_: Message) => void - readonly _Output: (_: never) => Output - } -} -``` - -Added in v2.0.0 - -# zipping - -## zip - -Combines this logger with the specified logger to produce a new logger that -logs to both this logger and that logger. - -**Signature** - -```ts -export declare const zip: { - ( - that: Logger - ): (self: Logger) => Logger - ( - self: Logger, - that: Logger - ): Logger -} -``` - -Added in v2.0.0 - -## zipLeft - -**Signature** - -```ts -export declare const zipLeft: { - ( - that: Logger - ): (self: Logger) => Logger - ( - self: Logger, - that: Logger - ): Logger -} -``` - -Added in v2.0.0 - -## zipRight - -**Signature** - -```ts -export declare const zipRight: { - ( - that: Logger - ): (self: Logger) => Logger - ( - self: Logger, - that: Logger - ): Logger -} -``` - -Added in v2.0.0 diff --git a/docs/modules/Match.ts.md b/docs/modules/Match.ts.md deleted file mode 100644 index cdd558734..000000000 --- a/docs/modules/Match.ts.md +++ /dev/null @@ -1,955 +0,0 @@ ---- -title: Match.ts -nav_order: 52 -parent: Modules ---- - -## Match overview - -Added in v1.0.0 - ---- - -

Table of contents

- -- [combinators](#combinators) - - [discriminator](#discriminator) - - [discriminatorStartsWith](#discriminatorstartswith) - - [discriminators](#discriminators) - - [discriminatorsExhaustive](#discriminatorsexhaustive) - - [not](#not) - - [tag](#tag) - - [tagStartsWith](#tagstartswith) - - [tags](#tags) - - [tagsExhaustive](#tagsexhaustive) - - [when](#when) - - [whenAnd](#whenand) - - [whenOr](#whenor) -- [constructors](#constructors) - - [type](#type) - - [typeTags](#typetags) - - [value](#value) - - [valueTags](#valuetags) -- [conversions](#conversions) - - [either](#either) - - [exhaustive](#exhaustive) - - [option](#option) - - [orElse](#orelse) - - [orElseAbsurd](#orelseabsurd) -- [model](#model) - - [Case (type alias)](#case-type-alias) - - [Matcher (type alias)](#matcher-type-alias) - - [Not (interface)](#not-interface) - - [SafeRefinement (interface)](#saferefinement-interface) - - [TypeMatcher (interface)](#typematcher-interface) - - [ValueMatcher (interface)](#valuematcher-interface) - - [When (interface)](#when-interface) -- [predicates](#predicates) - - [any](#any) - - [bigint](#bigint) - - [boolean](#boolean) - - [date](#date) - - [defined](#defined) - - [instanceOf](#instanceof) - - [instanceOfUnsafe](#instanceofunsafe) - - [is](#is) - - [nonEmptyString](#nonemptystring) - - [null](#null) - - [number](#number) - - [record](#record) - - [string](#string) - - [symbol](#symbol) - - [undefined](#undefined) -- [type ids](#type-ids) - - [MatcherTypeId](#matchertypeid) - - [MatcherTypeId (type alias)](#matchertypeid-type-alias) - - [SafeRefinementId](#saferefinementid) - - [SafeRefinementId (type alias)](#saferefinementid-type-alias) -- [utils](#utils) - - [Types (namespace)](#types-namespace) - - [Only (interface)](#only-interface) - - [Without (interface)](#without-interface) - - [AddOnly (type alias)](#addonly-type-alias) - - [AddWithout (type alias)](#addwithout-type-alias) - - [ApplyFilters (type alias)](#applyfilters-type-alias) - - [ArrayToIntersection (type alias)](#arraytointersection-type-alias) - - [ExtractMatch (type alias)](#extractmatch-type-alias) - - [NotMatch (type alias)](#notmatch-type-alias) - - [PForExclude (type alias)](#pforexclude-type-alias) - - [PForMatch (type alias)](#pformatch-type-alias) - - [PatternBase (type alias)](#patternbase-type-alias) - - [PatternPrimitive (type alias)](#patternprimitive-type-alias) - - [Tags (type alias)](#tags-type-alias) - - [WhenMatch (type alias)](#whenmatch-type-alias) - ---- - -# combinators - -## discriminator - -**Signature** - -```ts -export declare const discriminator: ( - field: D -) => & string, B>( - ...pattern: [first: P, ...values: P[], f: (_: Extract>) => B] -) => ( - self: Matcher -) => Matcher< - I, - Types.AddWithout>>, - Types.ApplyFilters>>>, - B | A, - Pr -> -``` - -Added in v1.0.0 - -## discriminatorStartsWith - -**Signature** - -```ts -export declare const discriminatorStartsWith: ( - field: D -) => ( - pattern: P, - f: (_: Extract>) => B -) => ( - self: Matcher -) => Matcher< - I, - Types.AddWithout>>, - Types.ApplyFilters>>>, - B | A, - Pr -> -``` - -Added in v1.0.0 - -## discriminators - -**Signature** - -```ts -export declare const discriminators: ( - field: D -) => < - R, - P extends { readonly [Tag in Types.Tags & string]?: ((_: Extract>) => any) | undefined } ->( - fields: P -) => ( - self: Matcher -) => Matcher< - I, - Types.AddWithout>>, - Types.ApplyFilters>>>, - A | ReturnType, - Pr -> -``` - -Added in v1.0.0 - -## discriminatorsExhaustive - -**Signature** - -```ts -export declare const discriminatorsExhaustive: ( - field: D -) => & string]: (_: Extract>) => any }>( - fields: P -) => ( - self: Matcher -) => [Pr] extends [never] ? (u: I) => Unify
> : Unify> -``` - -Added in v1.0.0 - -## not - -**Signature** - -```ts -export declare const not: < - R, - const P extends Types.PatternPrimitive | Types.PatternBase, - Fn extends (_: Exclude>>) => unknown ->( - pattern: P, - f: Fn -) => ( - self: Matcher -) => Matcher< - I, - Types.AddOnly>, - Types.ApplyFilters>>, - A | ReturnType, - Pr -> -``` - -Added in v1.0.0 - -## tag - -**Signature** - -```ts -export declare const tag: & string, B>( - ...pattern: [first: P, ...values: P[], f: (_: Extract>) => B] -) => ( - self: Matcher -) => Matcher< - I, - Types.AddWithout>>, - Types.ApplyFilters>>>, - B | A, - Pr -> -``` - -Added in v1.0.0 - -## tagStartsWith - -**Signature** - -```ts -export declare const tagStartsWith: ( - pattern: P, - f: (_: Extract>) => B -) => ( - self: Matcher -) => Matcher< - I, - Types.AddWithout>>, - Types.ApplyFilters>>>, - B | A, - Pr -> -``` - -Added in v1.0.0 - -## tags - -**Signature** - -```ts -export declare const tags: < - R, - P extends { - readonly [Tag in Types.Tags<"_tag", R> & string]?: ((_: Extract>) => any) | undefined - } ->( - fields: P -) => ( - self: Matcher -) => Matcher< - I, - Types.AddWithout>>, - Types.ApplyFilters>>>, - A | ReturnType, - Pr -> -``` - -Added in v1.0.0 - -## tagsExhaustive - -**Signature** - -```ts -export declare const tagsExhaustive: < - R, - P extends { readonly [Tag in Types.Tags<"_tag", R> & string]: (_: Extract>) => any } ->( - fields: P -) => ( - self: Matcher -) => [Pr] extends [never] ? (u: I) => Unify> : Unify> -``` - -Added in v1.0.0 - -## when - -**Signature** - -```ts -export declare const when: < - R, - const P extends Types.PatternPrimitive | Types.PatternBase, - Fn extends (_: Types.WhenMatch) => unknown ->( - pattern: P, - f: Fn -) => ( - self: Matcher -) => Matcher< - I, - Types.AddWithout>, - Types.ApplyFilters>>, - A | ReturnType, - Pr -> -``` - -Added in v1.0.0 - -## whenAnd - -**Signature** - -```ts -export declare const whenAnd: < - R, - const P extends readonly (Types.PatternPrimitive | Types.PatternBase)[], - Fn extends (_: Types.WhenMatch>) => unknown ->( - ...args: [...patterns: P, f: Fn] -) => ( - self: Matcher -) => Matcher< - I, - Types.AddWithout>>, - Types.ApplyFilters>>>, - A | ReturnType, - Pr -> -``` - -Added in v1.0.0 - -## whenOr - -**Signature** - -```ts -export declare const whenOr: < - R, - const P extends readonly (Types.PatternPrimitive | Types.PatternBase)[], - Fn extends (_: Types.WhenMatch) => unknown ->( - ...args: [...patterns: P, f: Fn] -) => ( - self: Matcher -) => Matcher< - I, - Types.AddWithout>, - Types.ApplyFilters>>, - A | ReturnType, - Pr -> -``` - -Added in v1.0.0 - -# constructors - -## type - -**Signature** - -```ts -export declare const type: () => Matcher, I, never, never> -``` - -Added in v1.0.0 - -## typeTags - -**Signature** - -```ts -export declare const typeTags: () => < - P extends { readonly [Tag in Types.Tags<"_tag", I> & string]: (_: Extract) => any } ->( - fields: P -) => (input: I) => Unify> -``` - -Added in v1.0.0 - -## value - -**Signature** - -```ts -export declare const value: (i: I) => Matcher, I, never, I> -``` - -Added in v1.0.0 - -## valueTags - -**Signature** - -```ts -export declare const valueTags: < - const I, - P extends { readonly [Tag in Types.Tags<"_tag", I> & string]: (_: Extract) => any } ->( - fields: P -) => (input: I) => Unify> -``` - -Added in v1.0.0 - -# conversions - -## either - -**Signature** - -```ts -export declare const either: ( - self: Matcher -) => [Pr] extends [never] ? (input: I) => Either.Either> : Either.Either> -``` - -Added in v1.0.0 - -## exhaustive - -**Signature** - -```ts -export declare const exhaustive: ( - self: Matcher -) => [Pr] extends [never] ? (u: I) => Unify : Unify -``` - -Added in v1.0.0 - -## option - -**Signature** - -```ts -export declare const option: ( - self: Matcher -) => [Pr] extends [never] ? (input: I) => Option.Option> : Option.Option> -``` - -Added in v1.0.0 - -## orElse - -**Signature** - -```ts -export declare const orElse: ( - f: (b: RA) => B -) => (self: Matcher) => [Pr] extends [never] ? (input: I) => Unify : Unify -``` - -Added in v1.0.0 - -## orElseAbsurd - -**Signature** - -```ts -export declare const orElseAbsurd: ( - self: Matcher -) => [Pr] extends [never] ? (input: I) => Unify : Unify -``` - -Added in v1.0.0 - -# model - -## Case (type alias) - -**Signature** - -```ts -export type Case = When | Not -``` - -Added in v1.0.0 - -## Matcher (type alias) - -**Signature** - -```ts -export type Matcher = - | TypeMatcher - | ValueMatcher -``` - -Added in v1.0.0 - -## Not (interface) - -**Signature** - -```ts -export interface Not { - readonly _tag: "Not" - readonly guard: (u: unknown) => boolean - readonly evaluate: (input: unknown) => any -} -``` - -Added in v1.0.0 - -## SafeRefinement (interface) - -**Signature** - -```ts -export interface SafeRefinement { - readonly [SafeRefinementId]: (a: A) => R -} -``` - -Added in v1.0.0 - -## TypeMatcher (interface) - -**Signature** - -```ts -export interface TypeMatcher extends Pipeable { - readonly _tag: "TypeMatcher" - readonly [MatcherTypeId]: { - readonly _input: (_: Input) => unknown - readonly _filters: (_: never) => Filters - readonly _remaining: (_: never) => Remaining - readonly _result: (_: never) => Result - } - readonly cases: ReadonlyArray - readonly add: (_case: Case) => TypeMatcher -} -``` - -Added in v1.0.0 - -## ValueMatcher (interface) - -**Signature** - -```ts -export interface ValueMatcher extends Pipeable { - readonly _tag: "ValueMatcher" - readonly [MatcherTypeId]: { - readonly _input: (_: Input) => unknown - readonly _filters: (_: never) => Filters - readonly _result: (_: never) => Result - } - readonly provided: Provided - readonly value: Either.Either - readonly add: (_case: Case) => ValueMatcher -} -``` - -Added in v1.0.0 - -## When (interface) - -**Signature** - -```ts -export interface When { - readonly _tag: "When" - readonly guard: (u: unknown) => boolean - readonly evaluate: (input: unknown) => any -} -``` - -Added in v1.0.0 - -# predicates - -## any - -**Signature** - -```ts -export declare const any: SafeRefinement -``` - -Added in v1.0.0 - -## bigint - -**Signature** - -```ts -export declare const bigint: Predicate.Refinement -``` - -Added in v1.0.0 - -## boolean - -**Signature** - -```ts -export declare const boolean: Predicate.Refinement -``` - -Added in v1.0.0 - -## date - -**Signature** - -```ts -export declare const date: Predicate.Refinement -``` - -Added in v1.0.0 - -## defined - -**Signature** - -```ts -export declare const defined: (u: A) => u is A & {} -``` - -Added in v1.0.0 - -## instanceOf - -**Signature** - -```ts -export declare const instanceOf: any>( - constructor: A -) => SafeRefinement, never> -``` - -Added in v1.0.0 - -## instanceOfUnsafe - -**Signature** - -```ts -export declare const instanceOfUnsafe: any>( - constructor: A -) => SafeRefinement, InstanceType> -``` - -Added in v1.0.0 - -## is - -**Signature** - -```ts -export declare const is: ( - ...literals: Literals -) => Predicate.Refinement -``` - -Added in v1.0.0 - -## nonEmptyString - -**Signature** - -```ts -export declare const nonEmptyString: SafeRefinement -``` - -Added in v1.0.0 - -## null - -**Signature** - -```ts -export declare const null: Predicate.Refinement -``` - -Added in v1.0.0 - -## number - -**Signature** - -```ts -export declare const number: Predicate.Refinement -``` - -Added in v1.0.0 - -## record - -**Signature** - -```ts -export declare const record: Predicate.Refinement -``` - -Added in v1.0.0 - -## string - -**Signature** - -```ts -export declare const string: Predicate.Refinement -``` - -Added in v1.0.0 - -## symbol - -**Signature** - -```ts -export declare const symbol: Predicate.Refinement -``` - -Added in v1.0.0 - -## undefined - -**Signature** - -```ts -export declare const undefined: Predicate.Refinement -``` - -Added in v1.0.0 - -# type ids - -## MatcherTypeId - -**Signature** - -```ts -export declare const MatcherTypeId: typeof MatcherTypeId -``` - -Added in v1.0.0 - -## MatcherTypeId (type alias) - -**Signature** - -```ts -export type MatcherTypeId = typeof MatcherTypeId -``` - -Added in v1.0.0 - -## SafeRefinementId - -**Signature** - -```ts -export declare const SafeRefinementId: typeof SafeRefinementId -``` - -Added in v1.0.0 - -## SafeRefinementId (type alias) - -**Signature** - -```ts -export type SafeRefinementId = typeof SafeRefinementId -``` - -Added in v1.0.0 - -# utils - -## Types (namespace) - -Added in v1.0.0 - -### Only (interface) - -**Signature** - -```ts -export interface Only { - readonly _tag: "Only" - readonly _X: X -} -``` - -Added in v1.0.0 - -### Without (interface) - -**Signature** - -```ts -export interface Without { - readonly _tag: "Without" - readonly _X: X -} -``` - -Added in v1.0.0 - -### AddOnly (type alias) - -**Signature** - -```ts -export type AddOnly = [A] extends [Without] - ? [X] extends [WX] - ? never - : Only - : [A] extends [Only] - ? [X] extends [OX] - ? Only - : never - : never -``` - -Added in v1.0.0 - -### AddWithout (type alias) - -**Signature** - -```ts -export type AddWithout = [A] extends [Without] - ? Without - : [A] extends [Only] - ? Only> - : never -``` - -Added in v1.0.0 - -### ApplyFilters (type alias) - -**Signature** - -```ts -export type ApplyFilters = A extends Only ? X : A extends Without ? Exclude : never -``` - -Added in v1.0.0 - -### ArrayToIntersection (type alias) - -**Signature** - -```ts -export type ArrayToIntersection> = UnionToIntersection -``` - -Added in v1.0.0 - -### ExtractMatch (type alias) - -**Signature** - -```ts -export type ExtractMatch = [ExtractAndNarrow] extends [infer EI] ? EI : never -``` - -Added in v1.0.0 - -### NotMatch (type alias) - -**Signature** - -```ts -export type NotMatch = Exclude>> -``` - -Added in v1.0.0 - -### PForExclude (type alias) - -**Signature** - -```ts -export type PForExclude

= [SafeRefinementR>] extends [infer X] ? X : never -``` - -Added in v1.0.0 - -### PForMatch (type alias) - -**Signature** - -```ts -export type PForMatch

= [SafeRefinementP>] extends [infer X] ? X : never -``` - -Added in v1.0.0 - -### PatternBase (type alias) - -**Signature** - -```ts -export type PatternBase = A extends ReadonlyArray - ? ReadonlyArray | PatternPrimitive - : A extends Record - ? Partial | PatternBase }>> - : never -``` - -Added in v1.0.0 - -### PatternPrimitive (type alias) - -**Signature** - -```ts -export type PatternPrimitive = PredicateA | A | SafeRefinement -``` - -Added in v1.0.0 - -### Tags (type alias) - -**Signature** - -```ts -export type Tags = P extends Record ? X : never -``` - -Added in v1.0.0 - -### WhenMatch (type alias) - -**Signature** - -```ts -export type WhenMatch = - // check for any - [0] extends [1 & R] - ? PForMatch

- : P extends SafeRefinement - ? SP - : P extends Predicate.Refinement - ? // try to narrow refinement - [Extract] extends [infer X] - ? [X] extends [never] - ? // fallback to original refinement - RP - : X - : never - : P extends PredicateA - ? PP - : ExtractMatch> -``` - -Added in v1.0.0 diff --git a/docs/modules/MergeDecision.ts.md b/docs/modules/MergeDecision.ts.md deleted file mode 100644 index 37dcae91b..000000000 --- a/docs/modules/MergeDecision.ts.md +++ /dev/null @@ -1,163 +0,0 @@ ---- -title: MergeDecision.ts -nav_order: 53 -parent: Modules ---- - -## MergeDecision overview - -Added in v2.0.0 - ---- - -

Table of contents

- -- [constructors](#constructors) - - [Await](#await) - - [AwaitConst](#awaitconst) - - [Done](#done) -- [folding](#folding) - - [match](#match) -- [models](#models) - - [MergeDecision (interface)](#mergedecision-interface) -- [refinements](#refinements) - - [isMergeDecision](#ismergedecision) -- [symbols](#symbols) - - [MergeDecisionTypeId](#mergedecisiontypeid) - - [MergeDecisionTypeId (type alias)](#mergedecisiontypeid-type-alias) -- [utils](#utils) - - [MergeDecision (namespace)](#mergedecision-namespace) - - [Variance (interface)](#variance-interface) - ---- - -# constructors - -## Await - -**Signature** - -```ts -export declare const Await: ( - f: (exit: Exit.Exit) => Effect.Effect -) => MergeDecision -``` - -Added in v2.0.0 - -## AwaitConst - -**Signature** - -```ts -export declare const AwaitConst: (effect: Effect.Effect) => MergeDecision -``` - -Added in v2.0.0 - -## Done - -**Signature** - -```ts -export declare const Done: (effect: Effect.Effect) => MergeDecision -``` - -Added in v2.0.0 - -# folding - -## match - -**Signature** - -```ts -export declare const match: { - (options: { - readonly onDone: (effect: Effect.Effect) => Z2 - readonly onAwait: (f: (exit: Exit.Exit) => Effect.Effect) => Z2 - }): (self: MergeDecision) => Z2 - ( - self: MergeDecision, - options: { - readonly onDone: (effect: Effect.Effect) => Z2 - readonly onAwait: (f: (exit: Exit.Exit) => Effect.Effect) => Z2 - } - ): Z2 -} -``` - -Added in v2.0.0 - -# models - -## MergeDecision (interface) - -**Signature** - -```ts -export interface MergeDecision extends MergeDecision.Variance {} -``` - -Added in v2.0.0 - -# refinements - -## isMergeDecision - -Returns `true` if the specified value is a `MergeDecision`, `false` -otherwise. - -**Signature** - -```ts -export declare const isMergeDecision: (u: unknown) => u is MergeDecision -``` - -Added in v2.0.0 - -# symbols - -## MergeDecisionTypeId - -**Signature** - -```ts -export declare const MergeDecisionTypeId: typeof MergeDecisionTypeId -``` - -Added in v2.0.0 - -## MergeDecisionTypeId (type alias) - -**Signature** - -```ts -export type MergeDecisionTypeId = typeof MergeDecisionTypeId -``` - -Added in v2.0.0 - -# utils - -## MergeDecision (namespace) - -Added in v2.0.0 - -### Variance (interface) - -**Signature** - -```ts -export interface Variance { - readonly [MergeDecisionTypeId]: { - _R: (_: never) => R - _E0: (_: E0) => void - _Z0: (_: Z0) => void - _E: (_: never) => E - _Z: (_: never) => Z - } -} -``` - -Added in v2.0.0 diff --git a/docs/modules/MergeState.ts.md b/docs/modules/MergeState.ts.md deleted file mode 100644 index da401b7f7..000000000 --- a/docs/modules/MergeState.ts.md +++ /dev/null @@ -1,265 +0,0 @@ ---- -title: MergeState.ts -nav_order: 54 -parent: Modules ---- - -## MergeState overview - -Added in v2.0.0 - ---- - -

Table of contents

- -- [constructors](#constructors) - - [BothRunning](#bothrunning) - - [LeftDone](#leftdone) - - [RightDone](#rightdone) -- [folding](#folding) - - [match](#match) -- [models](#models) - - [BothRunning (interface)](#bothrunning-interface) - - [LeftDone (interface)](#leftdone-interface) - - [MergeState (type alias)](#mergestate-type-alias) - - [RightDone (interface)](#rightdone-interface) -- [refinements](#refinements) - - [isBothRunning](#isbothrunning) - - [isLeftDone](#isleftdone) - - [isMergeState](#ismergestate) - - [isRightDone](#isrightdone) -- [symbols](#symbols) - - [MergeStateTypeId](#mergestatetypeid) - - [MergeStateTypeId (type alias)](#mergestatetypeid-type-alias) -- [utils](#utils) - - [MergeState (namespace)](#mergestate-namespace) - - [Proto (interface)](#proto-interface) - ---- - -# constructors - -## BothRunning - -**Signature** - -```ts -export declare const BothRunning: ( - left: Fiber.Fiber>, - right: Fiber.Fiber> -) => MergeState -``` - -Added in v2.0.0 - -## LeftDone - -**Signature** - -```ts -export declare const LeftDone: ( - f: (exit: Exit.Exit) => Effect.Effect -) => MergeState -``` - -Added in v2.0.0 - -## RightDone - -**Signature** - -```ts -export declare const RightDone: ( - f: (exit: Exit.Exit) => Effect.Effect -) => MergeState -``` - -Added in v2.0.0 - -# folding - -## match - -**Signature** - -```ts -export declare const match: { - (options: { - readonly onBothRunning: ( - left: Fiber.Fiber>, - right: Fiber.Fiber> - ) => Z - readonly onLeftDone: (f: (exit: Exit.Exit) => Effect.Effect) => Z - readonly onRightDone: (f: (exit: Exit.Exit) => Effect.Effect) => Z - }): (self: MergeState) => Z - ( - self: MergeState, - options: { - readonly onBothRunning: ( - left: Fiber.Fiber>, - right: Fiber.Fiber> - ) => Z - readonly onLeftDone: (f: (exit: Exit.Exit) => Effect.Effect) => Z - readonly onRightDone: (f: (exit: Exit.Exit) => Effect.Effect) => Z - } - ): Z -} -``` - -Added in v2.0.0 - -# models - -## BothRunning (interface) - -**Signature** - -```ts -export interface BothRunning<_Env, Err, Err1, _Err2, Elem, Done, Done1, _Done2> extends MergeState.Proto { - readonly _tag: "BothRunning" - readonly left: Fiber.Fiber> - readonly right: Fiber.Fiber> -} -``` - -Added in v2.0.0 - -## LeftDone (interface) - -**Signature** - -```ts -export interface LeftDone extends MergeState.Proto { - readonly _tag: "LeftDone" - readonly f: (exit: Exit.Exit) => Effect.Effect -} -``` - -Added in v2.0.0 - -## MergeState (type alias) - -**Signature** - -```ts -export type MergeState = - | BothRunning - | LeftDone - | RightDone -``` - -Added in v2.0.0 - -## RightDone (interface) - -**Signature** - -```ts -export interface RightDone extends MergeState.Proto { - readonly _tag: "RightDone" - readonly f: (exit: Exit.Exit) => Effect.Effect -} -``` - -Added in v2.0.0 - -# refinements - -## isBothRunning - -Returns `true` if the specified `MergeState` is a `BothRunning`, `false` -otherwise. - -**Signature** - -```ts -export declare const isBothRunning: ( - self: MergeState -) => self is BothRunning -``` - -Added in v2.0.0 - -## isLeftDone - -Returns `true` if the specified `MergeState` is a `LeftDone`, `false` -otherwise. - -**Signature** - -```ts -export declare const isLeftDone: ( - self: MergeState -) => self is LeftDone -``` - -Added in v2.0.0 - -## isMergeState - -Returns `true` if the specified value is a `MergeState`, `false` otherwise. - -**Signature** - -```ts -export declare const isMergeState: ( - u: unknown -) => u is MergeState -``` - -Added in v2.0.0 - -## isRightDone - -Returns `true` if the specified `MergeState` is a `RightDone`, `false` -otherwise. - -**Signature** - -```ts -export declare const isRightDone: ( - self: MergeState -) => self is RightDone -``` - -Added in v2.0.0 - -# symbols - -## MergeStateTypeId - -**Signature** - -```ts -export declare const MergeStateTypeId: typeof MergeStateTypeId -``` - -Added in v2.0.0 - -## MergeStateTypeId (type alias) - -**Signature** - -```ts -export type MergeStateTypeId = typeof MergeStateTypeId -``` - -Added in v2.0.0 - -# utils - -## MergeState (namespace) - -Added in v2.0.0 - -### Proto (interface) - -**Signature** - -```ts -export interface Proto { - readonly [MergeStateTypeId]: MergeStateTypeId -} -``` - -Added in v2.0.0 diff --git a/docs/modules/MergeStrategy.ts.md b/docs/modules/MergeStrategy.ts.md deleted file mode 100644 index 59e3882cf..000000000 --- a/docs/modules/MergeStrategy.ts.md +++ /dev/null @@ -1,191 +0,0 @@ ---- -title: MergeStrategy.ts -nav_order: 55 -parent: Modules ---- - -## MergeStrategy overview - -Added in v2.0.0 - ---- - -

Table of contents

- -- [constructors](#constructors) - - [BackPressure](#backpressure) - - [BufferSliding](#buffersliding) -- [folding](#folding) - - [match](#match) -- [models](#models) - - [BackPressure (interface)](#backpressure-interface) - - [BufferSliding (interface)](#buffersliding-interface) - - [MergeStrategy (type alias)](#mergestrategy-type-alias) -- [refinements](#refinements) - - [isBackPressure](#isbackpressure) - - [isBufferSliding](#isbuffersliding) - - [isMergeStrategy](#ismergestrategy) -- [symbols](#symbols) - - [MergeStrategyTypeId](#mergestrategytypeid) - - [MergeStrategyTypeId (type alias)](#mergestrategytypeid-type-alias) -- [utils](#utils) - - [MergeStrategy (namespace)](#mergestrategy-namespace) - - [Proto (interface)](#proto-interface) - ---- - -# constructors - -## BackPressure - -**Signature** - -```ts -export declare const BackPressure: (_: void) => MergeStrategy -``` - -Added in v2.0.0 - -## BufferSliding - -**Signature** - -```ts -export declare const BufferSliding: (_: void) => MergeStrategy -``` - -Added in v2.0.0 - -# folding - -## match - -Folds an `MergeStrategy` into a value of type `A`. - -**Signature** - -```ts -export declare const match: { -
(options: { readonly onBackPressure: () => A; readonly onBufferSliding: () => A }): (self: MergeStrategy) => A - (self: MergeStrategy, options: { readonly onBackPressure: () => A; readonly onBufferSliding: () => A }): A -} -``` - -Added in v2.0.0 - -# models - -## BackPressure (interface) - -**Signature** - -```ts -export interface BackPressure extends MergeStrategy.Proto { - readonly _tag: "BackPressure" -} -``` - -Added in v2.0.0 - -## BufferSliding (interface) - -**Signature** - -```ts -export interface BufferSliding extends MergeStrategy.Proto { - readonly _tag: "BufferSliding" -} -``` - -Added in v2.0.0 - -## MergeStrategy (type alias) - -**Signature** - -```ts -export type MergeStrategy = BackPressure | BufferSliding -``` - -Added in v2.0.0 - -# refinements - -## isBackPressure - -Returns `true` if the specified `MergeStrategy` is a `BackPressure`, `false` -otherwise. - -**Signature** - -```ts -export declare const isBackPressure: (self: MergeStrategy) => self is BackPressure -``` - -Added in v2.0.0 - -## isBufferSliding - -Returns `true` if the specified `MergeStrategy` is a `BufferSliding`, `false` -otherwise. - -**Signature** - -```ts -export declare const isBufferSliding: (self: MergeStrategy) => self is BufferSliding -``` - -Added in v2.0.0 - -## isMergeStrategy - -Returns `true` if the specified value is a `MergeStrategy`, `false` -otherwise. - -**Signature** - -```ts -export declare const isMergeStrategy: (u: unknown) => u is MergeStrategy -``` - -Added in v2.0.0 - -# symbols - -## MergeStrategyTypeId - -**Signature** - -```ts -export declare const MergeStrategyTypeId: typeof MergeStrategyTypeId -``` - -Added in v2.0.0 - -## MergeStrategyTypeId (type alias) - -**Signature** - -```ts -export type MergeStrategyTypeId = typeof MergeStrategyTypeId -``` - -Added in v2.0.0 - -# utils - -## MergeStrategy (namespace) - -Added in v2.0.0 - -### Proto (interface) - -**Signature** - -```ts -export interface Proto { - readonly [MergeStrategyTypeId]: MergeStrategyTypeId -} -``` - -Added in v2.0.0 diff --git a/docs/modules/Metric.ts.md b/docs/modules/Metric.ts.md deleted file mode 100644 index 6ce1a23cb..000000000 --- a/docs/modules/Metric.ts.md +++ /dev/null @@ -1,1016 +0,0 @@ ---- -title: Metric.ts -nav_order: 56 -parent: Modules ---- - -## Metric overview - -Added in v2.0.0 - ---- - -

Table of contents

- -- [aspects](#aspects) - - [increment](#increment) - - [incrementBy](#incrementby) - - [set](#set) - - [trackAll](#trackall) - - [trackDefect](#trackdefect) - - [trackDefectWith](#trackdefectwith) - - [trackDuration](#trackduration) - - [trackDurationWith](#trackdurationwith) - - [trackError](#trackerror) - - [trackErrorWith](#trackerrorwith) - - [trackSuccess](#tracksuccess) - - [trackSuccessWith](#tracksuccesswith) -- [constructors](#constructors) - - [counter](#counter) - - [frequency](#frequency) - - [fromMetricKey](#frommetrickey) - - [gauge](#gauge) - - [histogram](#histogram) - - [make](#make) - - [succeed](#succeed) - - [summary](#summary) - - [summaryTimestamp](#summarytimestamp) - - [sync](#sync) - - [timer](#timer) - - [timerWithBoundaries](#timerwithboundaries) - - [withConstantInput](#withconstantinput) -- [getters](#getters) - - [snapshot](#snapshot) - - [value](#value) -- [globals](#globals) - - [globalMetricRegistry](#globalmetricregistry) -- [mapping](#mapping) - - [map](#map) - - [mapInput](#mapinput) - - [mapType](#maptype) -- [metrics](#metrics) - - [fiberActive](#fiberactive) - - [fiberFailures](#fiberfailures) - - [fiberLifetimes](#fiberlifetimes) - - [fiberStarted](#fiberstarted) - - [fiberSuccesses](#fibersuccesses) -- [models](#models) - - [Metric (interface)](#metric-interface) - - [MetricApply (interface)](#metricapply-interface) -- [symbols](#symbols) - - [MetricTypeId](#metrictypeid) - - [MetricTypeId (type alias)](#metrictypeid-type-alias) -- [unsafe](#unsafe) - - [unsafeSnapshot](#unsafesnapshot) -- [utils](#utils) - - [Metric (namespace)](#metric-namespace) - - [Counter (interface)](#counter-interface) - - [Frequency (interface)](#frequency-interface) - - [Gauge (interface)](#gauge-interface) - - [Histogram (interface)](#histogram-interface) - - [Summary (interface)](#summary-interface) - - [Variance (interface)](#variance-interface) - - [tagged](#tagged) - - [taggedWithLabels](#taggedwithlabels) - - [taggedWithLabelsInput](#taggedwithlabelsinput) - - [update](#update) - - [withNow](#withnow) -- [zipping](#zipping) - - [zip](#zip) - ---- - -# aspects - -## increment - -**Signature** - -```ts -export declare const increment: ( - self: Metric.Counter | Metric.Counter -) => Effect.Effect -``` - -Added in v2.0.0 - -## incrementBy - -**Signature** - -```ts -export declare const incrementBy: { - (amount: number): (self: Metric.Counter) => Effect.Effect - (amount: bigint): (self: Metric.Counter) => Effect.Effect - (self: Metric.Counter, amount: number): Effect.Effect - (self: Metric.Counter, amount: bigint): Effect.Effect -} -``` - -Added in v2.0.0 - -## set - -**Signature** - -```ts -export declare const set: { - (value: number): (self: Metric.Gauge) => Effect.Effect - (value: bigint): (self: Metric.Gauge) => Effect.Effect - (self: Metric.Gauge, value: number): Effect.Effect - (self: Metric.Gauge, value: bigint): Effect.Effect -} -``` - -Added in v2.0.0 - -## trackAll - -Returns an aspect that will update this metric with the specified constant -value every time the aspect is applied to an effect, regardless of whether -that effect fails or succeeds. - -**Signature** - -```ts -export declare const trackAll: { - ( - input: In - ): (self: Metric) => (effect: Effect.Effect) => Effect.Effect - ( - self: Metric, - input: In - ): (effect: Effect.Effect) => Effect.Effect -} -``` - -Added in v2.0.0 - -## trackDefect - -Returns an aspect that will update this metric with the defects of the -effects that it is applied to. - -**Signature** - -```ts -export declare const trackDefect: { - (metric: Metric): (self: Effect.Effect) => Effect.Effect - (self: Effect.Effect, metric: Metric): Effect.Effect -} -``` - -Added in v2.0.0 - -## trackDefectWith - -Returns an aspect that will update this metric with the result of applying -the specified function to the defect throwables of the effects that the -aspect is applied to. - -**Signature** - -```ts -export declare const trackDefectWith: { - ( - metric: Metric, - f: (defect: unknown) => In - ): (self: Effect.Effect) => Effect.Effect - ( - self: Effect.Effect, - metric: Metric, - f: (defect: unknown) => In - ): Effect.Effect -} -``` - -Added in v2.0.0 - -## trackDuration - -Returns an aspect that will update this metric with the duration that the -effect takes to execute. To call this method, the input type of the metric -must be `Duration`. - -**Signature** - -```ts -export declare const trackDuration: { - ( - metric: Metric - ): (self: Effect.Effect) => Effect.Effect - ( - self: Effect.Effect, - metric: Metric - ): Effect.Effect -} -``` - -Added in v2.0.0 - -## trackDurationWith - -Returns an aspect that will update this metric with the duration that the -effect takes to execute. To call this method, you must supply a function -that can convert the `Duration` to the input type of this metric. - -**Signature** - -```ts -export declare const trackDurationWith: { - ( - metric: Metric, - f: (duration: Duration.Duration) => In - ): (effect: Effect.Effect) => Effect.Effect - ( - self: Effect.Effect, - metric: Metric, - f: (duration: Duration.Duration) => In - ): Effect.Effect -} -``` - -Added in v2.0.0 - -## trackError - -Returns an aspect that will update this metric with the failure value of -the effects that it is applied to. - -**Signature** - -```ts -export declare const trackError: { - ( - metric: Metric - ): (self: Effect.Effect) => Effect.Effect - ( - self: Effect.Effect, - metric: Metric - ): Effect.Effect -} -``` - -Added in v2.0.0 - -## trackErrorWith - -Returns an aspect that will update this metric with the result of applying -the specified function to the error value of the effects that the aspect is -applied to. - -**Signature** - -```ts -export declare const trackErrorWith: { - ( - metric: Metric, - f: (error: In2) => In - ): (effect: Effect.Effect) => Effect.Effect - ( - self: Effect.Effect, - metric: Metric, - f: (error: In2) => In - ): Effect.Effect -} -``` - -Added in v2.0.0 - -## trackSuccess - -Returns an aspect that will update this metric with the success value of -the effects that it is applied to. - -**Signature** - -```ts -export declare const trackSuccess: { - ( - metric: Metric - ): (self: Effect.Effect) => Effect.Effect - ( - self: Effect.Effect, - metric: Metric - ): Effect.Effect -} -``` - -Added in v2.0.0 - -## trackSuccessWith - -Returns an aspect that will update this metric with the result of applying -the specified function to the success value of the effects that the aspect is -applied to. - -**Signature** - -```ts -export declare const trackSuccessWith: { - ( - metric: Metric, - f: (value: In2) => In - ): (self: Effect.Effect) => Effect.Effect - ( - self: Effect.Effect, - metric: Metric, - f: (value: In2) => In - ): Effect.Effect -} -``` - -Added in v2.0.0 - -# constructors - -## counter - -Represents a Counter metric that tracks cumulative numerical values over time. -Counters can be incremented and decremented and provide a running total of changes. - -**Signature** - -```ts -export declare const counter: { - ( - name: string, - options?: { - readonly description?: string | undefined - readonly bigint?: false | undefined - readonly incremental?: boolean | undefined - } - ): Metric.Counter - ( - name: string, - options: { - readonly description?: string | undefined - readonly bigint: true - readonly incremental?: boolean | undefined - } - ): Metric.Counter -} -``` - -**Example** - -```ts -import * as Metric from "effect/Metric" - -const numberCounter = Metric.counter("count", { - description: "A number counter" -}) - -const bigintCounter = Metric.counter("count", { - description: "A bigint counter", - bigint: true -}) -``` - -Added in v2.0.0 - -## frequency - -Creates a Frequency metric to count occurrences of events. -Frequency metrics are used to count the number of times specific events or incidents occur. - -**Signature** - -```ts -export declare const frequency: (name: string, description?: string) => Metric.Frequency -``` - -**Example** - -```ts -import * as Metric from "effect/Metric" - -const errorFrequency = Metric.frequency("error_frequency", "Counts the occurrences of errors.") -``` - -Added in v2.0.0 - -## fromMetricKey - -**Signature** - -```ts -export declare const fromMetricKey: >( - key: MetricKey.MetricKey -) => Metric, MetricKeyType.MetricKeyType.OutType> -``` - -Added in v2.0.0 - -## gauge - -Represents a Gauge metric that tracks and reports a single numerical value at a specific moment. -Gauges are suitable for metrics that represent instantaneous values, such as memory usage or CPU load. - -**Signature** - -```ts -export declare const gauge: { - ( - name: string, - options?: { readonly description?: string | undefined; readonly bigint?: false | undefined } - ): Metric.Gauge - (name: string, options: { readonly description?: string | undefined; readonly bigint: true }): Metric.Gauge -} -``` - -**Example** - -```ts -import * as Metric from "effect/Metric" - -const numberGauge = Metric.gauge("memory_usage", { - description: "A gauge for memory usage" -}) - -const bigintGauge = Metric.gauge("cpu_load", { - description: "A gauge for CPU load", - bigint: true -}) -``` - -Added in v2.0.0 - -## histogram - -Represents a Histogram metric that records observations in specified value boundaries. -Histogram metrics are useful for measuring the distribution of values within a range. - -**Signature** - -```ts -export declare const histogram: ( - name: string, - boundaries: MetricBoundaries.MetricBoundaries, - description?: string -) => Metric -``` - -**Example** - -```ts -import * as Metric from "effect/Metric" -import * as MetricBoundaries from "effect/MetricBoundaries" - -const latencyHistogram = Metric.histogram( - "latency_histogram", - MetricBoundaries.linear({ start: 0, width: 10, count: 11 }), - "Measures the distribution of request latency." -) -``` - -Added in v2.0.0 - -## make - -**Signature** - -```ts -export declare const make: MetricApply -``` - -Added in v2.0.0 - -## succeed - -Creates a metric that ignores input and produces constant output. - -**Signature** - -```ts -export declare const succeed: (out: Out) => Metric -``` - -Added in v2.0.0 - -## summary - -Creates a Summary metric that records observations and calculates quantiles. -Summary metrics provide statistical information about a set of values, including quantiles. - -**Signature** - -```ts -export declare const summary: (options: { - readonly name: string - readonly maxAge: Duration.DurationInput - readonly maxSize: number - readonly error: number - readonly quantiles: Chunk.Chunk - readonly description?: string | undefined -}) => Metric.Summary -``` - -**Example** - -```ts -import * as Metric from "effect/Metric" -import * as Chunk from "effect/Chunk" - -const responseTimesSummary = Metric.summary({ - name: "response_times_summary", - maxAge: "60 seconds", // Retain observations for 60 seconds. - maxSize: 1000, // Keep a maximum of 1000 observations. - error: 0.01, // Allow a 1% error when calculating quantiles. - quantiles: Chunk.make(0.5, 0.9, 0.99), // Calculate 50th, 90th, and 99th percentiles. - description: "Measures the distribution of response times." -}) -``` - -Added in v2.0.0 - -## summaryTimestamp - -**Signature** - -```ts -export declare const summaryTimestamp: (options: { - readonly name: string - readonly maxAge: Duration.DurationInput - readonly maxSize: number - readonly error: number - readonly quantiles: Chunk.Chunk - readonly description?: string | undefined -}) => Metric.Summary -``` - -Added in v2.0.0 - -## sync - -Creates a metric that ignores input and produces constant output. - -**Signature** - -```ts -export declare const sync: (evaluate: LazyArg) => Metric -``` - -Added in v2.0.0 - -## timer - -Creates a timer metric, based on a histogram, which keeps track of -durations in milliseconds. The unit of time will automatically be added to -the metric as a tag (i.e. `"time_unit: milliseconds"`). - -**Signature** - -```ts -export declare const timer: ( - name: string -) => Metric -``` - -Added in v2.0.0 - -## timerWithBoundaries - -Creates a timer metric, based on a histogram created from the provided -boundaries, which keeps track of durations in milliseconds. The unit of time -will automatically be added to the metric as a tag (i.e. -`"time_unit: milliseconds"`). - -**Signature** - -```ts -export declare const timerWithBoundaries: ( - name: string, - boundaries: Chunk.Chunk -) => Metric -``` - -Added in v2.0.0 - -## withConstantInput - -Returns a new metric that is powered by this one, but which accepts updates -of any type, and translates them to updates with the specified constant -update value. - -**Signature** - -```ts -export declare const withConstantInput: { - (input: In): (self: Metric) => Metric - (self: Metric, input: In): Metric -} -``` - -Added in v2.0.0 - -# getters - -## snapshot - -Captures a snapshot of all metrics recorded by the application. - -**Signature** - -```ts -export declare const snapshot: Effect.Effect> -``` - -Added in v2.0.0 - -## value - -Retrieves a snapshot of the value of the metric at this moment in time. - -**Signature** - -```ts -export declare const value: (self: Metric) => Effect.Effect -``` - -Added in v2.0.0 - -# globals - -## globalMetricRegistry - -**Signature** - -```ts -export declare const globalMetricRegistry: MetricRegistry.MetricRegistry -``` - -Added in v2.0.0 - -# mapping - -## map - -Returns a new metric that is powered by this one, but which outputs a new -state type, determined by transforming the state type of this metric by the -specified function. - -**Signature** - -```ts -export declare const map: { - (f: (out: Out) => Out2): (self: Metric) => Metric - (self: Metric, f: (out: Out) => Out2): Metric -} -``` - -Added in v2.0.0 - -## mapInput - -Returns a new metric that is powered by this one, but which accepts updates -of the specified new type, which must be transformable to the input type of -this metric. - -**Signature** - -```ts -export declare const mapInput: { - (f: (input: In2) => In): (self: Metric) => Metric - (self: Metric, f: (input: In2) => In): Metric -} -``` - -Added in v2.0.0 - -## mapType - -**Signature** - -```ts -export declare const mapType: { - (f: (type: Type) => Type2): (self: Metric) => Metric - (self: Metric, f: (type: Type) => Type2): Metric -} -``` - -Added in v2.0.0 - -# metrics - -## fiberActive - -**Signature** - -```ts -export declare const fiberActive: Metric.Counter -``` - -Added in v2.0.0 - -## fiberFailures - -**Signature** - -```ts -export declare const fiberFailures: Metric.Counter -``` - -Added in v2.0.0 - -## fiberLifetimes - -**Signature** - -```ts -export declare const fiberLifetimes: Metric< - MetricKeyType.MetricKeyType.Histogram, - number, - MetricState.MetricState.Histogram -> -``` - -Added in v2.0.0 - -## fiberStarted - -**Signature** - -```ts -export declare const fiberStarted: Metric.Counter -``` - -Added in v2.0.0 - -## fiberSuccesses - -**Signature** - -```ts -export declare const fiberSuccesses: Metric.Counter -``` - -Added in v2.0.0 - -# models - -## Metric (interface) - -A `Metric` represents a concurrent metric which accepts -updates of type `In` and are aggregated to a stateful value of type `Out`. - -For example, a counter metric would have type `Metric`, -representing the fact that the metric can be updated with numbers (the amount -to increment or decrement the counter by), and the state of the counter is a -number. - -There are five primitive metric types supported by Effect: - -- Counters -- Frequencies -- Gauges -- Histograms -- Summaries - -**Signature** - -```ts -export interface Metric extends Metric.Variance, Pipeable { - /** - * The type of the underlying primitive metric. For example, this could be - * `MetricKeyType.Counter` or `MetricKeyType.Gauge`. - */ - readonly keyType: Type - readonly unsafeUpdate: (input: In, extraTags: HashSet.HashSet) => void - readonly unsafeValue: (extraTags: HashSet.HashSet) => Out - /** */ - (effect: Effect.Effect): Effect.Effect -} -``` - -Added in v2.0.0 - -## MetricApply (interface) - -**Signature** - -```ts -export interface MetricApply { - ( - keyType: Type, - unsafeUpdate: (input: In, extraTags: HashSet.HashSet) => void, - unsafeValue: (extraTags: HashSet.HashSet) => Out - ): Metric -} -``` - -Added in v2.0.0 - -# symbols - -## MetricTypeId - -**Signature** - -```ts -export declare const MetricTypeId: typeof MetricTypeId -``` - -Added in v2.0.0 - -## MetricTypeId (type alias) - -**Signature** - -```ts -export type MetricTypeId = typeof MetricTypeId -``` - -Added in v2.0.0 - -# unsafe - -## unsafeSnapshot - -Unsafely captures a snapshot of all metrics recorded by the application. - -**Signature** - -```ts -export declare const unsafeSnapshot: (_: void) => HashSet.HashSet -``` - -Added in v2.0.0 - -# utils - -## Metric (namespace) - -Added in v2.0.0 - -### Counter (interface) - -**Signature** - -```ts -export interface Counter - extends Metric, In, MetricState.MetricState.Counter> {} -``` - -Added in v2.0.0 - -### Frequency (interface) - -**Signature** - -```ts -export interface Frequency - extends Metric {} -``` - -Added in v2.0.0 - -### Gauge (interface) - -**Signature** - -```ts -export interface Gauge - extends Metric, In, MetricState.MetricState.Gauge> {} -``` - -Added in v2.0.0 - -### Histogram (interface) - -**Signature** - -```ts -export interface Histogram - extends Metric {} -``` - -Added in v2.0.0 - -### Summary (interface) - -**Signature** - -```ts -export interface Summary extends Metric {} -``` - -Added in v2.0.0 - -### Variance (interface) - -**Signature** - -```ts -export interface Variance { - readonly [MetricTypeId]: { - readonly _Type: (_: Type) => Type - readonly _In: (_: In) => void - readonly _Out: (_: never) => Out - } -} -``` - -Added in v2.0.0 - -## tagged - -Returns a new metric, which is identical in every way to this one, except -the specified tags have been added to the tags of this metric. - -**Signature** - -```ts -export declare const tagged: { - (key: string, value: string): (self: Metric) => Metric - (self: Metric, key: string, value: string): Metric -} -``` - -Added in v2.0.0 - -## taggedWithLabels - -Returns a new metric, which is identical in every way to this one, except -the specified tags have been added to the tags of this metric. - -**Signature** - -```ts -export declare const taggedWithLabels: { - (extraTags: Iterable): (self: Metric) => Metric - (self: Metric, extraTags: Iterable): Metric -} -``` - -Added in v2.0.0 - -## taggedWithLabelsInput - -Returns a new metric, which is identical in every way to this one, except -dynamic tags are added based on the update values. Note that the metric -returned by this method does not return any useful information, due to the -dynamic nature of the added tags. - -**Signature** - -```ts -export declare const taggedWithLabelsInput: { - ( - f: (input: In) => Iterable - ): (self: Metric) => Metric - ( - self: Metric, - f: (input: In) => Iterable - ): Metric -} -``` - -Added in v2.0.0 - -## update - -Updates the metric with the specified update message. For example, if the -metric were a counter, the update would increment the method by the -provided amount. - -**Signature** - -```ts -export declare const update: { - (input: In): (self: Metric) => Effect.Effect - (self: Metric, input: In): Effect.Effect -} -``` - -Added in v2.0.0 - -## withNow - -**Signature** - -```ts -export declare const withNow: (self: Metric) => Metric -``` - -Added in v2.0.0 - -# zipping - -## zip - -**Signature** - -```ts -export declare const zip: { - ( - that: Metric - ): (self: Metric) => Metric - ( - self: Metric, - that: Metric - ): Metric -} -``` - -Added in v2.0.0 diff --git a/docs/modules/MetricBoundaries.ts.md b/docs/modules/MetricBoundaries.ts.md deleted file mode 100644 index 94b7d2180..000000000 --- a/docs/modules/MetricBoundaries.ts.md +++ /dev/null @@ -1,122 +0,0 @@ ---- -title: MetricBoundaries.ts -nav_order: 57 -parent: Modules ---- - -## MetricBoundaries overview - -Added in v2.0.0 - ---- - -

Table of contents

- -- [constructors](#constructors) - - [exponential](#exponential) - - [fromChunk](#fromchunk) - - [linear](#linear) -- [models](#models) - - [MetricBoundaries (interface)](#metricboundaries-interface) -- [refinements](#refinements) - - [isMetricBoundaries](#ismetricboundaries) -- [symbols](#symbols) - - [MetricBoundariesTypeId](#metricboundariestypeid) - - [MetricBoundariesTypeId (type alias)](#metricboundariestypeid-type-alias) - ---- - -# constructors - -## exponential - -A helper method to create histogram bucket boundaries for a histogram -with exponentially increasing values. - -**Signature** - -```ts -export declare const exponential: (options: { - readonly start: number - readonly factor: number - readonly count: number -}) => MetricBoundaries -``` - -Added in v2.0.0 - -## fromChunk - -**Signature** - -```ts -export declare const fromChunk: (chunk: Chunk.Chunk) => MetricBoundaries -``` - -Added in v2.0.0 - -## linear - -A helper method to create histogram bucket boundaries for a histogram -with linear increasing values. - -**Signature** - -```ts -export declare const linear: (options: { - readonly start: number - readonly width: number - readonly count: number -}) => MetricBoundaries -``` - -Added in v2.0.0 - -# models - -## MetricBoundaries (interface) - -**Signature** - -```ts -export interface MetricBoundaries extends Equal.Equal, Pipeable { - readonly [MetricBoundariesTypeId]: MetricBoundariesTypeId - readonly values: Chunk.Chunk -} -``` - -Added in v2.0.0 - -# refinements - -## isMetricBoundaries - -**Signature** - -```ts -export declare const isMetricBoundaries: (u: unknown) => u is MetricBoundaries -``` - -Added in v2.0.0 - -# symbols - -## MetricBoundariesTypeId - -**Signature** - -```ts -export declare const MetricBoundariesTypeId: typeof MetricBoundariesTypeId -``` - -Added in v2.0.0 - -## MetricBoundariesTypeId (type alias) - -**Signature** - -```ts -export type MetricBoundariesTypeId = typeof MetricBoundariesTypeId -``` - -Added in v2.0.0 diff --git a/docs/modules/MetricHook.ts.md b/docs/modules/MetricHook.ts.md deleted file mode 100644 index cd2cd1c12..000000000 --- a/docs/modules/MetricHook.ts.md +++ /dev/null @@ -1,248 +0,0 @@ ---- -title: MetricHook.ts -nav_order: 58 -parent: Modules ---- - -## MetricHook overview - -Added in v2.0.0 - ---- - -

Table of contents

- -- [constructors](#constructors) - - [counter](#counter) - - [frequency](#frequency) - - [gauge](#gauge) - - [histogram](#histogram) - - [make](#make) - - [summary](#summary) -- [models](#models) - - [MetricHook (interface)](#metrichook-interface) -- [symbols](#symbols) - - [MetricHookTypeId](#metrichooktypeid) - - [MetricHookTypeId (type alias)](#metrichooktypeid-type-alias) -- [utils](#utils) - - [MetricHook (namespace)](#metrichook-namespace) - - [Variance (interface)](#variance-interface) - - [Counter (type alias)](#counter-type-alias) - - [Frequency (type alias)](#frequency-type-alias) - - [Gauge (type alias)](#gauge-type-alias) - - [Histogram (type alias)](#histogram-type-alias) - - [Root (type alias)](#root-type-alias) - - [Summary (type alias)](#summary-type-alias) - - [Untyped (type alias)](#untyped-type-alias) - - [onUpdate](#onupdate) - ---- - -# constructors - -## counter - -**Signature** - -```ts -export declare const counter:
(key: MetricKey.MetricKey.Counter) => MetricHook.Counter -``` - -Added in v2.0.0 - -## frequency - -**Signature** - -```ts -export declare const frequency: (_key: MetricKey.MetricKey.Frequency) => MetricHook.Frequency -``` - -Added in v2.0.0 - -## gauge - -**Signature** - -```ts -export declare const gauge: { - (key: MetricKey.MetricKey.Gauge, startAt: number): MetricHook.Gauge - (key: MetricKey.MetricKey.Gauge, startAt: bigint): MetricHook.Gauge -} -``` - -Added in v2.0.0 - -## histogram - -**Signature** - -```ts -export declare const histogram: (key: MetricKey.MetricKey.Histogram) => MetricHook.Histogram -``` - -Added in v2.0.0 - -## make - -**Signature** - -```ts -export declare const make: (options: { - readonly get: LazyArg - readonly update: (input: In) => void -}) => MetricHook -``` - -Added in v2.0.0 - -## summary - -**Signature** - -```ts -export declare const summary: (key: MetricKey.MetricKey.Summary) => MetricHook.Summary -``` - -Added in v2.0.0 - -# models - -## MetricHook (interface) - -**Signature** - -```ts -export interface MetricHook extends MetricHook.Variance, Pipeable { - readonly get: () => Out - readonly update: (input: In) => void -} -``` - -Added in v2.0.0 - -# symbols - -## MetricHookTypeId - -**Signature** - -```ts -export declare const MetricHookTypeId: typeof MetricHookTypeId -``` - -Added in v2.0.0 - -## MetricHookTypeId (type alias) - -**Signature** - -```ts -export type MetricHookTypeId = typeof MetricHookTypeId -``` - -Added in v2.0.0 - -# utils - -## MetricHook (namespace) - -Added in v2.0.0 - -### Variance (interface) - -**Signature** - -```ts -export interface Variance { - readonly [MetricHookTypeId]: { - readonly _In: (_: In) => void - readonly _Out: (_: never) => Out - } -} -``` - -Added in v2.0.0 - -### Counter (type alias) - -**Signature** - -```ts -export type Counter = MetricHook> -``` - -Added in v2.0.0 - -### Frequency (type alias) - -**Signature** - -```ts -export type Frequency = MetricHook -``` - -Added in v2.0.0 - -### Gauge (type alias) - -**Signature** - -```ts -export type Gauge = MetricHook> -``` - -Added in v2.0.0 - -### Histogram (type alias) - -**Signature** - -```ts -export type Histogram = MetricHook -``` - -Added in v2.0.0 - -### Root (type alias) - -**Signature** - -```ts -export type Root = MetricHook -``` - -Added in v2.0.0 - -### Summary (type alias) - -**Signature** - -```ts -export type Summary = MetricHook -``` - -Added in v2.0.0 - -### Untyped (type alias) - -**Signature** - -```ts -export type Untyped = MetricHook -``` - -Added in v2.0.0 - -## onUpdate - -**Signature** - -```ts -export declare const onUpdate: { - (f: (input: In) => void): (self: MetricHook) => MetricHook - (self: MetricHook, f: (input: In) => void): MetricHook -} -``` - -Added in v2.0.0 diff --git a/docs/modules/MetricKey.ts.md b/docs/modules/MetricKey.ts.md deleted file mode 100644 index 03171bf59..000000000 --- a/docs/modules/MetricKey.ts.md +++ /dev/null @@ -1,341 +0,0 @@ ---- -title: MetricKey.ts -nav_order: 59 -parent: Modules ---- - -## MetricKey overview - -Added in v2.0.0 - ---- - -

Table of contents

- -- [constructors](#constructors) - - [counter](#counter) - - [frequency](#frequency) - - [gauge](#gauge) - - [histogram](#histogram) - - [summary](#summary) - - [tagged](#tagged) - - [taggedWithLabelSet](#taggedwithlabelset) - - [taggedWithLabels](#taggedwithlabels) -- [models](#models) - - [MetricKey (interface)](#metrickey-interface) -- [refinements](#refinements) - - [isMetricKey](#ismetrickey) -- [symbols](#symbols) - - [MetricKeyTypeId](#metrickeytypeid) - - [MetricKeyTypeId (type alias)](#metrickeytypeid-type-alias) -- [utils](#utils) - - [MetricKey (namespace)](#metrickey-namespace) - - [Variance (interface)](#variance-interface) - - [Counter (type alias)](#counter-type-alias) - - [Frequency (type alias)](#frequency-type-alias) - - [Gauge (type alias)](#gauge-type-alias) - - [Histogram (type alias)](#histogram-type-alias) - - [Summary (type alias)](#summary-type-alias) - - [Untyped (type alias)](#untyped-type-alias) - ---- - -# constructors - -## counter - -Creates a metric key for a counter, with the specified name. - -**Signature** - -```ts -export declare const counter: { - ( - name: string, - options?: { - readonly description?: string | undefined - readonly bigint?: false | undefined - readonly incremental?: boolean | undefined - } - ): MetricKey.Counter - ( - name: string, - options: { - readonly description?: string | undefined - readonly bigint: true - readonly incremental?: boolean | undefined - } - ): MetricKey.Counter -} -``` - -Added in v2.0.0 - -## frequency - -Creates a metric key for a categorical frequency table, with the specified -name. - -**Signature** - -```ts -export declare const frequency: (name: string, description?: string) => MetricKey.Frequency -``` - -Added in v2.0.0 - -## gauge - -Creates a metric key for a gauge, with the specified name. - -**Signature** - -```ts -export declare const gauge: { - ( - name: string, - options?: { readonly description?: string | undefined; readonly bigint?: false | undefined } - ): MetricKey.Gauge - (name: string, options: { readonly description?: string | undefined; readonly bigint: true }): MetricKey.Gauge -} -``` - -Added in v2.0.0 - -## histogram - -Creates a metric key for a histogram, with the specified name and boundaries. - -**Signature** - -```ts -export declare const histogram: ( - name: string, - boundaries: MetricBoundaries.MetricBoundaries, - description?: string -) => MetricKey.Histogram -``` - -Added in v2.0.0 - -## summary - -Creates a metric key for a summary, with the specified name, maxAge, -maxSize, error, and quantiles. - -**Signature** - -```ts -export declare const summary: (options: { - readonly name: string - readonly maxAge: Duration.DurationInput - readonly maxSize: number - readonly error: number - readonly quantiles: Chunk.Chunk - readonly description?: string | undefined -}) => MetricKey.Summary -``` - -Added in v2.0.0 - -## tagged - -Returns a new `MetricKey` with the specified tag appended. - -**Signature** - -```ts -export declare const tagged: { - ( - key: string, - value: string - ): >(self: MetricKey) => MetricKey - >( - self: MetricKey, - key: string, - value: string - ): MetricKey -} -``` - -Added in v2.0.0 - -## taggedWithLabelSet - -Returns a new `MetricKey` with the specified tags appended. - -**Signature** - -```ts -export declare const taggedWithLabelSet: { - ( - extraTags: HashSet.HashSet - ): >(self: MetricKey) => MetricKey - >( - self: MetricKey, - extraTags: HashSet.HashSet - ): MetricKey -} -``` - -Added in v2.0.0 - -## taggedWithLabels - -Returns a new `MetricKey` with the specified tags appended. - -**Signature** - -```ts -export declare const taggedWithLabels: { - ( - extraTags: Iterable - ): >(self: MetricKey) => MetricKey - >( - self: MetricKey, - extraTags: Iterable - ): MetricKey -} -``` - -Added in v2.0.0 - -# models - -## MetricKey (interface) - -A `MetricKey` is a unique key associated with each metric. The key is based -on a combination of the metric type, the name and tags associated with the -metric, an optional description of the key, and any other information to -describe a metric, such as the boundaries of a histogram. In this way, it is -impossible to ever create different metrics with conflicting keys. - -**Signature** - -```ts -export interface MetricKey> - extends MetricKey.Variance, - Equal.Equal, - Pipeable { - readonly name: string - readonly keyType: Type - readonly description: Option.Option - readonly tags: HashSet.HashSet -} -``` - -Added in v2.0.0 - -# refinements - -## isMetricKey - -**Signature** - -```ts -export declare const isMetricKey: (u: unknown) => u is MetricKey> -``` - -Added in v2.0.0 - -# symbols - -## MetricKeyTypeId - -**Signature** - -```ts -export declare const MetricKeyTypeId: typeof MetricKeyTypeId -``` - -Added in v2.0.0 - -## MetricKeyTypeId (type alias) - -**Signature** - -```ts -export type MetricKeyTypeId = typeof MetricKeyTypeId -``` - -Added in v2.0.0 - -# utils - -## MetricKey (namespace) - -Added in v2.0.0 - -### Variance (interface) - -**Signature** - -```ts -export interface Variance { - readonly [MetricKeyTypeId]: { - _Type: (_: never) => Type - } -} -``` - -Added in v2.0.0 - -### Counter (type alias) - -**Signature** - -```ts -export type Counter
= MetricKey> -``` - -Added in v2.0.0 - -### Frequency (type alias) - -**Signature** - -```ts -export type Frequency = MetricKey -``` - -Added in v2.0.0 - -### Gauge (type alias) - -**Signature** - -```ts -export type Gauge = MetricKey> -``` - -Added in v2.0.0 - -### Histogram (type alias) - -**Signature** - -```ts -export type Histogram = MetricKey -``` - -Added in v2.0.0 - -### Summary (type alias) - -**Signature** - -```ts -export type Summary = MetricKey -``` - -Added in v2.0.0 - -### Untyped (type alias) - -**Signature** - -```ts -export type Untyped = MetricKey -``` - -Added in v2.0.0 diff --git a/docs/modules/MetricKeyType.ts.md b/docs/modules/MetricKeyType.ts.md deleted file mode 100644 index 7adf34dbb..000000000 --- a/docs/modules/MetricKeyType.ts.md +++ /dev/null @@ -1,443 +0,0 @@ ---- -title: MetricKeyType.ts -nav_order: 60 -parent: Modules ---- - -## MetricKeyType overview - -Added in v2.0.0 - ---- - -

Table of contents

- -- [constructors](#constructors) - - [counter](#counter) - - [frequency](#frequency) - - [gauge](#gauge) - - [histogram](#histogram) - - [summary](#summary) -- [modelz](#modelz) - - [MetricKeyType (interface)](#metrickeytype-interface) -- [refinements](#refinements) - - [isCounterKey](#iscounterkey) - - [isFrequencyKey](#isfrequencykey) - - [isGaugeKey](#isgaugekey) - - [isHistogramKey](#ishistogramkey) - - [isMetricKeyType](#ismetrickeytype) - - [isSummaryKey](#issummarykey) -- [symbols](#symbols) - - [CounterKeyTypeTypeId](#counterkeytypetypeid) - - [CounterKeyTypeTypeId (type alias)](#counterkeytypetypeid-type-alias) - - [FrequencyKeyTypeTypeId](#frequencykeytypetypeid) - - [FrequencyKeyTypeTypeId (type alias)](#frequencykeytypetypeid-type-alias) - - [GaugeKeyTypeTypeId](#gaugekeytypetypeid) - - [GaugeKeyTypeTypeId (type alias)](#gaugekeytypetypeid-type-alias) - - [HistogramKeyTypeTypeId](#histogramkeytypetypeid) - - [HistogramKeyTypeTypeId (type alias)](#histogramkeytypetypeid-type-alias) - - [MetricKeyTypeTypeId](#metrickeytypetypeid) - - [MetricKeyTypeTypeId (type alias)](#metrickeytypetypeid-type-alias) - - [SummaryKeyTypeTypeId](#summarykeytypetypeid) - - [SummaryKeyTypeTypeId (type alias)](#summarykeytypetypeid-type-alias) -- [utils](#utils) - - [MetricKeyType (namespace)](#metrickeytype-namespace) - - [Variance (interface)](#variance-interface) - - [Counter (type alias)](#counter-type-alias) - - [Frequency (type alias)](#frequency-type-alias) - - [Gauge (type alias)](#gauge-type-alias) - - [Histogram (type alias)](#histogram-type-alias) - - [InType (type alias)](#intype-type-alias) - - [OutType (type alias)](#outtype-type-alias) - - [Summary (type alias)](#summary-type-alias) - - [Untyped (type alias)](#untyped-type-alias) - ---- - -# constructors - -## counter - -**Signature** - -```ts -export declare const counter:
() => MetricKeyType.Counter -``` - -Added in v2.0.0 - -## frequency - -**Signature** - -```ts -export declare const frequency: MetricKeyType.Frequency -``` - -Added in v2.0.0 - -## gauge - -**Signature** - -```ts -export declare const gauge: () => MetricKeyType.Gauge -``` - -Added in v2.0.0 - -## histogram - -**Signature** - -```ts -export declare const histogram: (boundaries: MetricBoundaries.MetricBoundaries) => MetricKeyType.Histogram -``` - -Added in v2.0.0 - -## summary - -**Signature** - -```ts -export declare const summary: (options: { - readonly maxAge: Duration.DurationInput - readonly maxSize: number - readonly error: number - readonly quantiles: Chunk.Chunk -}) => MetricKeyType.Summary -``` - -Added in v2.0.0 - -# modelz - -## MetricKeyType (interface) - -**Signature** - -```ts -export interface MetricKeyType extends MetricKeyType.Variance, Equal.Equal, Pipeable {} -``` - -Added in v2.0.0 - -# refinements - -## isCounterKey - -**Signature** - -```ts -export declare const isCounterKey: (u: unknown) => u is MetricKeyType.Counter -``` - -Added in v2.0.0 - -## isFrequencyKey - -**Signature** - -```ts -export declare const isFrequencyKey: (u: unknown) => u is MetricKeyType.Frequency -``` - -Added in v2.0.0 - -## isGaugeKey - -**Signature** - -```ts -export declare const isGaugeKey: (u: unknown) => u is MetricKeyType.Gauge -``` - -Added in v2.0.0 - -## isHistogramKey - -**Signature** - -```ts -export declare const isHistogramKey: (u: unknown) => u is MetricKeyType.Histogram -``` - -Added in v2.0.0 - -## isMetricKeyType - -**Signature** - -```ts -export declare const isMetricKeyType: (u: unknown) => u is MetricKeyType -``` - -Added in v2.0.0 - -## isSummaryKey - -**Signature** - -```ts -export declare const isSummaryKey: (u: unknown) => u is MetricKeyType.Summary -``` - -Added in v2.0.0 - -# symbols - -## CounterKeyTypeTypeId - -**Signature** - -```ts -export declare const CounterKeyTypeTypeId: typeof CounterKeyTypeTypeId -``` - -Added in v2.0.0 - -## CounterKeyTypeTypeId (type alias) - -**Signature** - -```ts -export type CounterKeyTypeTypeId = typeof CounterKeyTypeTypeId -``` - -Added in v2.0.0 - -## FrequencyKeyTypeTypeId - -**Signature** - -```ts -export declare const FrequencyKeyTypeTypeId: typeof FrequencyKeyTypeTypeId -``` - -Added in v2.0.0 - -## FrequencyKeyTypeTypeId (type alias) - -**Signature** - -```ts -export type FrequencyKeyTypeTypeId = typeof FrequencyKeyTypeTypeId -``` - -Added in v2.0.0 - -## GaugeKeyTypeTypeId - -**Signature** - -```ts -export declare const GaugeKeyTypeTypeId: typeof GaugeKeyTypeTypeId -``` - -Added in v2.0.0 - -## GaugeKeyTypeTypeId (type alias) - -**Signature** - -```ts -export type GaugeKeyTypeTypeId = typeof GaugeKeyTypeTypeId -``` - -Added in v2.0.0 - -## HistogramKeyTypeTypeId - -**Signature** - -```ts -export declare const HistogramKeyTypeTypeId: typeof HistogramKeyTypeTypeId -``` - -Added in v2.0.0 - -## HistogramKeyTypeTypeId (type alias) - -**Signature** - -```ts -export type HistogramKeyTypeTypeId = typeof HistogramKeyTypeTypeId -``` - -Added in v2.0.0 - -## MetricKeyTypeTypeId - -**Signature** - -```ts -export declare const MetricKeyTypeTypeId: typeof MetricKeyTypeTypeId -``` - -Added in v2.0.0 - -## MetricKeyTypeTypeId (type alias) - -**Signature** - -```ts -export type MetricKeyTypeTypeId = typeof MetricKeyTypeTypeId -``` - -Added in v2.0.0 - -## SummaryKeyTypeTypeId - -**Signature** - -```ts -export declare const SummaryKeyTypeTypeId: typeof SummaryKeyTypeTypeId -``` - -Added in v2.0.0 - -## SummaryKeyTypeTypeId (type alias) - -**Signature** - -```ts -export type SummaryKeyTypeTypeId = typeof SummaryKeyTypeTypeId -``` - -Added in v2.0.0 - -# utils - -## MetricKeyType (namespace) - -Added in v2.0.0 - -### Variance (interface) - -**Signature** - -```ts -export interface Variance { - readonly [MetricKeyTypeTypeId]: { - readonly _In: (_: In) => void - readonly _Out: (_: never) => Out - } -} -``` - -Added in v2.0.0 - -### Counter (type alias) - -**Signature** - -```ts -export type Counter = MetricKeyType> & { - readonly [CounterKeyTypeTypeId]: CounterKeyTypeTypeId - readonly incremental: boolean - readonly bigint: boolean -} -``` - -Added in v2.0.0 - -### Frequency (type alias) - -**Signature** - -```ts -export type Frequency = MetricKeyType & { - readonly [FrequencyKeyTypeTypeId]: FrequencyKeyTypeTypeId -} -``` - -Added in v2.0.0 - -### Gauge (type alias) - -**Signature** - -```ts -export type Gauge = MetricKeyType> & { - readonly [GaugeKeyTypeTypeId]: GaugeKeyTypeTypeId - readonly bigint: boolean -} -``` - -Added in v2.0.0 - -### Histogram (type alias) - -**Signature** - -```ts -export type Histogram = MetricKeyType & { - readonly [HistogramKeyTypeTypeId]: HistogramKeyTypeTypeId - readonly boundaries: MetricBoundaries.MetricBoundaries -} -``` - -Added in v2.0.0 - -### InType (type alias) - -**Signature** - -```ts -export type InType> = [Type] extends [ - { - readonly [MetricKeyTypeTypeId]: { - readonly _In: (_: infer In) => void - } - } -] - ? In - : never -``` - -Added in v2.0.0 - -### OutType (type alias) - -**Signature** - -```ts -export type OutType> = [Type] extends [ - { - readonly [MetricKeyTypeTypeId]: { - readonly _Out: (_: never) => infer Out - } - } -] - ? Out - : never -``` - -Added in v2.0.0 - -### Summary (type alias) - -**Signature** - -```ts -export type Summary = MetricKeyType & { - readonly [SummaryKeyTypeTypeId]: SummaryKeyTypeTypeId - readonly maxAge: Duration.Duration - readonly maxSize: number - readonly error: number - readonly quantiles: Chunk.Chunk -} -``` - -Added in v2.0.0 - -### Untyped (type alias) - -**Signature** - -```ts -export type Untyped = MetricKeyType -``` - -Added in v2.0.0 diff --git a/docs/modules/MetricLabel.ts.md b/docs/modules/MetricLabel.ts.md deleted file mode 100644 index 5a00a3001..000000000 --- a/docs/modules/MetricLabel.ts.md +++ /dev/null @@ -1,94 +0,0 @@ ---- -title: MetricLabel.ts -nav_order: 61 -parent: Modules ---- - -## MetricLabel overview - -Added in v2.0.0 - ---- - -

Table of contents

- -- [constructors](#constructors) - - [make](#make) -- [models](#models) - - [MetricLabel (interface)](#metriclabel-interface) -- [refinements](#refinements) - - [isMetricLabel](#ismetriclabel) -- [symbols](#symbols) - - [MetricLabelTypeId](#metriclabeltypeid) - - [MetricLabelTypeId (type alias)](#metriclabeltypeid-type-alias) - ---- - -# constructors - -## make - -**Signature** - -```ts -export declare const make: (key: string, value: string) => MetricLabel -``` - -Added in v2.0.0 - -# models - -## MetricLabel (interface) - -A `MetricLabel` represents a key value pair that allows analyzing metrics at -an additional level of granularity. - -For example if a metric tracks the response time of a service labels could -be used to create separate versions that track response times for different -clients. - -**Signature** - -```ts -export interface MetricLabel extends Equal.Equal, Pipeable { - readonly [MetricLabelTypeId]: MetricLabelTypeId - readonly key: string - readonly value: string -} -``` - -Added in v2.0.0 - -# refinements - -## isMetricLabel - -**Signature** - -```ts -export declare const isMetricLabel: (u: unknown) => u is MetricLabel -``` - -Added in v2.0.0 - -# symbols - -## MetricLabelTypeId - -**Signature** - -```ts -export declare const MetricLabelTypeId: typeof MetricLabelTypeId -``` - -Added in v2.0.0 - -## MetricLabelTypeId (type alias) - -**Signature** - -```ts -export type MetricLabelTypeId = typeof MetricLabelTypeId -``` - -Added in v2.0.0 diff --git a/docs/modules/MetricPair.ts.md b/docs/modules/MetricPair.ts.md deleted file mode 100644 index 801ae28ce..000000000 --- a/docs/modules/MetricPair.ts.md +++ /dev/null @@ -1,128 +0,0 @@ ---- -title: MetricPair.ts -nav_order: 62 -parent: Modules ---- - -## MetricPair overview - -Added in v2.0.0 - ---- - -

Table of contents

- -- [constructors](#constructors) - - [make](#make) -- [model](#model) - - [MetricPair (interface)](#metricpair-interface) -- [symbols](#symbols) - - [MetricPairTypeId](#metricpairtypeid) - - [MetricPairTypeId (type alias)](#metricpairtypeid-type-alias) -- [unsafe](#unsafe) - - [unsafeMake](#unsafemake) -- [utils](#utils) - - [MetricPair (namespace)](#metricpair-namespace) - - [Untyped (interface)](#untyped-interface) - - [Variance (interface)](#variance-interface) - ---- - -# constructors - -## make - -**Signature** - -```ts -export declare const make: >( - metricKey: MetricKey.MetricKey, - metricState: MetricState.MetricState> -) => MetricPair.Untyped -``` - -Added in v2.0.0 - -# model - -## MetricPair (interface) - -**Signature** - -```ts -export interface MetricPair> - extends MetricPair.Variance, - Pipeable { - readonly metricKey: MetricKey.MetricKey - readonly metricState: MetricState.MetricState> -} -``` - -Added in v2.0.0 - -# symbols - -## MetricPairTypeId - -**Signature** - -```ts -export declare const MetricPairTypeId: typeof MetricPairTypeId -``` - -Added in v2.0.0 - -## MetricPairTypeId (type alias) - -**Signature** - -```ts -export type MetricPairTypeId = typeof MetricPairTypeId -``` - -Added in v2.0.0 - -# unsafe - -## unsafeMake - -**Signature** - -```ts -export declare const unsafeMake: >( - metricKey: MetricKey.MetricKey, - metricState: MetricState.MetricState.Untyped -) => MetricPair.Untyped -``` - -Added in v2.0.0 - -# utils - -## MetricPair (namespace) - -Added in v2.0.0 - -### Untyped (interface) - -**Signature** - -```ts -export interface Untyped extends MetricPair> {} -``` - -Added in v2.0.0 - -### Variance (interface) - -**Signature** - -```ts -export interface Variance> { - readonly [MetricPairTypeId]: { - readonly _Type: (_: never) => Type - } -} -``` - -Added in v2.0.0 diff --git a/docs/modules/MetricPolling.ts.md b/docs/modules/MetricPolling.ts.md deleted file mode 100644 index 5ec079ff8..000000000 --- a/docs/modules/MetricPolling.ts.md +++ /dev/null @@ -1,203 +0,0 @@ ---- -title: MetricPolling.ts -nav_order: 63 -parent: Modules ---- - -## MetricPolling overview - -Added in v2.0.0 - ---- - -

Table of contents

- -- [constructors](#constructors) - - [collectAll](#collectall) - - [make](#make) - - [retry](#retry) -- [models](#models) - - [PollingMetric (interface)](#pollingmetric-interface) -- [symbols](#symbols) - - [PollingMetricTypeId](#pollingmetrictypeid) - - [PollingMetricTypeId (type alias)](#pollingmetrictypeid-type-alias) -- [utils](#utils) - - [launch](#launch) - - [poll](#poll) - - [pollAndUpdate](#pollandupdate) - - [zip](#zip) - ---- - -# constructors - -## collectAll - -Collects all of the polling metrics into a single polling metric, which -polls for, updates, and produces the outputs of all individual metrics. - -**Signature** - -```ts -export declare const collectAll: ( - iterable: Iterable> -) => PollingMetric -``` - -Added in v2.0.0 - -## make - -Constructs a new polling metric from a metric and poll effect. - -**Signature** - -```ts -export declare const make: ( - metric: Metric.Metric, - poll: Effect.Effect -) => PollingMetric -``` - -Added in v2.0.0 - -## retry - -Returns a new polling metric whose poll function will be retried with the -specified retry policy. - -**Signature** - -```ts -export declare const retry: { - ( - policy: Schedule.Schedule - ): (self: PollingMetric) => PollingMetric - ( - self: PollingMetric, - policy: Schedule.Schedule - ): PollingMetric -} -``` - -Added in v2.0.0 - -# models - -## PollingMetric (interface) - -A `PollingMetric` is a combination of a metric and an effect that polls for -updates to the metric. - -**Signature** - -```ts -export interface PollingMetric extends Pipeable { - readonly [PollingMetricTypeId]: PollingMetricTypeId - /** - * The metric that this `PollingMetric` polls to update. - */ - readonly metric: Metric.Metric - /** - * An effect that polls a value that may be fed to the metric. - */ - readonly poll: Effect.Effect -} -``` - -Added in v2.0.0 - -# symbols - -## PollingMetricTypeId - -**Signature** - -```ts -export declare const PollingMetricTypeId: typeof PollingMetricTypeId -``` - -Added in v2.0.0 - -## PollingMetricTypeId (type alias) - -**Signature** - -```ts -export type PollingMetricTypeId = typeof PollingMetricTypeId -``` - -Added in v2.0.0 - -# utils - -## launch - -Returns an effect that will launch the polling metric in a background -fiber, using the specified schedule. - -**Signature** - -```ts -export declare const launch: { - ( - schedule: Schedule.Schedule - ): ( - self: PollingMetric - ) => Effect.Effect> - ( - self: PollingMetric, - schedule: Schedule.Schedule - ): Effect.Effect> -} -``` - -Added in v2.0.0 - -## poll - -An effect that polls a value that may be fed to the metric. - -**Signature** - -```ts -export declare const poll: (self: PollingMetric) => Effect.Effect -``` - -Added in v2.0.0 - -## pollAndUpdate - -An effect that polls for a value and uses the value to update the metric. - -**Signature** - -```ts -export declare const pollAndUpdate: ( - self: PollingMetric -) => Effect.Effect -``` - -Added in v2.0.0 - -## zip - -Zips this polling metric with the specified polling metric. - -**Signature** - -```ts -export declare const zip: { - ( - that: PollingMetric - ): ( - self: PollingMetric - ) => PollingMetric - ( - self: PollingMetric, - that: PollingMetric - ): PollingMetric -} -``` - -Added in v2.0.0 diff --git a/docs/modules/MetricRegistry.ts.md b/docs/modules/MetricRegistry.ts.md deleted file mode 100644 index 60a0833a2..000000000 --- a/docs/modules/MetricRegistry.ts.md +++ /dev/null @@ -1,85 +0,0 @@ ---- -title: MetricRegistry.ts -nav_order: 64 -parent: Modules ---- - -## MetricRegistry overview - -Added in v2.0.0 - ---- - -

Table of contents

- -- [constructors](#constructors) - - [make](#make) -- [models](#models) - - [MetricRegistry (interface)](#metricregistry-interface) -- [symbols](#symbols) - - [MetricRegistryTypeId](#metricregistrytypeid) - - [MetricRegistryTypeId (type alias)](#metricregistrytypeid-type-alias) - ---- - -# constructors - -## make - -**Signature** - -```ts -export declare const make: (_: void) => MetricRegistry -``` - -Added in v2.0.0 - -# models - -## MetricRegistry (interface) - -**Signature** - -```ts -export interface MetricRegistry { - readonly [MetricRegistryTypeId]: MetricRegistryTypeId - readonly snapshot: () => HashSet.HashSet - readonly get: >( - key: MetricKey.MetricKey - ) => MetricHook.MetricHook< - MetricKeyType.MetricKeyType.InType<(typeof key)["keyType"]>, - MetricKeyType.MetricKeyType.OutType<(typeof key)["keyType"]> - > - readonly getCounter:
( - key: MetricKey.MetricKey.Counter - ) => MetricHook.MetricHook.Counter - readonly getFrequency: (key: MetricKey.MetricKey.Frequency) => MetricHook.MetricHook.Frequency - readonly getGauge: (key: MetricKey.MetricKey.Gauge) => MetricHook.MetricHook.Gauge - readonly getHistogram: (key: MetricKey.MetricKey.Histogram) => MetricHook.MetricHook.Histogram - readonly getSummary: (key: MetricKey.MetricKey.Summary) => MetricHook.MetricHook.Summary -} -``` - -Added in v2.0.0 - -# symbols - -## MetricRegistryTypeId - -**Signature** - -```ts -export declare const MetricRegistryTypeId: typeof MetricRegistryTypeId -``` - -Added in v2.0.0 - -## MetricRegistryTypeId (type alias) - -**Signature** - -```ts -export type MetricRegistryTypeId = typeof MetricRegistryTypeId -``` - -Added in v2.0.0 diff --git a/docs/modules/MetricState.ts.md b/docs/modules/MetricState.ts.md deleted file mode 100644 index c27d63ce4..000000000 --- a/docs/modules/MetricState.ts.md +++ /dev/null @@ -1,425 +0,0 @@ ---- -title: MetricState.ts -nav_order: 65 -parent: Modules ---- - -## MetricState overview - -Added in v2.0.0 - ---- - -

Table of contents

- -- [constructors](#constructors) - - [counter](#counter) - - [frequency](#frequency) - - [gauge](#gauge) - - [histogram](#histogram) - - [summary](#summary) -- [models](#models) - - [MetricState (interface)](#metricstate-interface) -- [refinements](#refinements) - - [isCounterState](#iscounterstate) - - [isFrequencyState](#isfrequencystate) - - [isGaugeState](#isgaugestate) - - [isHistogramState](#ishistogramstate) - - [isMetricState](#ismetricstate) - - [isSummaryState](#issummarystate) -- [symbols](#symbols) - - [CounterStateTypeId](#counterstatetypeid) - - [CounterStateTypeId (type alias)](#counterstatetypeid-type-alias) - - [FrequencyStateTypeId](#frequencystatetypeid) - - [FrequencyStateTypeId (type alias)](#frequencystatetypeid-type-alias) - - [GaugeStateTypeId](#gaugestatetypeid) - - [GaugeStateTypeId (type alias)](#gaugestatetypeid-type-alias) - - [HistogramStateTypeId](#histogramstatetypeid) - - [HistogramStateTypeId (type alias)](#histogramstatetypeid-type-alias) - - [MetricStateTypeId](#metricstatetypeid) - - [MetricStateTypeId (type alias)](#metricstatetypeid-type-alias) - - [SummaryStateTypeId](#summarystatetypeid) - - [SummaryStateTypeId (type alias)](#summarystatetypeid-type-alias) -- [utils](#utils) - - [MetricState (namespace)](#metricstate-namespace) - - [Counter (interface)](#counter-interface) - - [Frequency (interface)](#frequency-interface) - - [Gauge (interface)](#gauge-interface) - - [Histogram (interface)](#histogram-interface) - - [Summary (interface)](#summary-interface) - - [Untyped (interface)](#untyped-interface) - - [Variance (interface)](#variance-interface) - ---- - -# constructors - -## counter - -**Signature** - -```ts -export declare const counter: { - (count: number): MetricState.Counter - (count: bigint): MetricState.Counter -} -``` - -Added in v2.0.0 - -## frequency - -**Signature** - -```ts -export declare const frequency: (occurrences: HashMap.HashMap) => MetricState.Frequency -``` - -Added in v2.0.0 - -## gauge - -**Signature** - -```ts -export declare const gauge: { (count: number): MetricState.Gauge; (count: bigint): MetricState.Gauge } -``` - -Added in v2.0.0 - -## histogram - -**Signature** - -```ts -export declare const histogram: (options: { - readonly buckets: Chunk.Chunk - readonly count: number - readonly min: number - readonly max: number - readonly sum: number -}) => MetricState.Histogram -``` - -Added in v2.0.0 - -## summary - -**Signature** - -```ts -export declare const summary: (options: { - readonly error: number - readonly quantiles: Chunk.Chunk]> - readonly count: number - readonly min: number - readonly max: number - readonly sum: number -}) => MetricState.Summary -``` - -Added in v2.0.0 - -# models - -## MetricState (interface) - -A `MetricState` describes the state of a metric. The type parameter of a -metric state corresponds to the type of the metric key (`MetricStateType`). -This phantom type parameter is used to tie keys to their expected states. - -**Signature** - -```ts -export interface MetricState
extends MetricState.Variance, Equal.Equal, Pipeable {} -``` - -Added in v2.0.0 - -# refinements - -## isCounterState - -**Signature** - -```ts -export declare const isCounterState: (u: unknown) => u is MetricState.Counter -``` - -Added in v2.0.0 - -## isFrequencyState - -**Signature** - -```ts -export declare const isFrequencyState: (u: unknown) => u is MetricState.Frequency -``` - -Added in v2.0.0 - -## isGaugeState - -**Signature** - -```ts -export declare const isGaugeState: (u: unknown) => u is MetricState.Gauge -``` - -Added in v2.0.0 - -## isHistogramState - -**Signature** - -```ts -export declare const isHistogramState: (u: unknown) => u is MetricState.Histogram -``` - -Added in v2.0.0 - -## isMetricState - -**Signature** - -```ts -export declare const isMetricState: (u: unknown) => u is MetricState.Counter -``` - -Added in v2.0.0 - -## isSummaryState - -**Signature** - -```ts -export declare const isSummaryState: (u: unknown) => u is MetricState.Summary -``` - -Added in v2.0.0 - -# symbols - -## CounterStateTypeId - -**Signature** - -```ts -export declare const CounterStateTypeId: typeof CounterStateTypeId -``` - -Added in v2.0.0 - -## CounterStateTypeId (type alias) - -**Signature** - -```ts -export type CounterStateTypeId = typeof CounterStateTypeId -``` - -Added in v2.0.0 - -## FrequencyStateTypeId - -**Signature** - -```ts -export declare const FrequencyStateTypeId: typeof FrequencyStateTypeId -``` - -Added in v2.0.0 - -## FrequencyStateTypeId (type alias) - -**Signature** - -```ts -export type FrequencyStateTypeId = typeof FrequencyStateTypeId -``` - -Added in v2.0.0 - -## GaugeStateTypeId - -**Signature** - -```ts -export declare const GaugeStateTypeId: typeof GaugeStateTypeId -``` - -Added in v2.0.0 - -## GaugeStateTypeId (type alias) - -**Signature** - -```ts -export type GaugeStateTypeId = typeof GaugeStateTypeId -``` - -Added in v2.0.0 - -## HistogramStateTypeId - -**Signature** - -```ts -export declare const HistogramStateTypeId: typeof HistogramStateTypeId -``` - -Added in v2.0.0 - -## HistogramStateTypeId (type alias) - -**Signature** - -```ts -export type HistogramStateTypeId = typeof HistogramStateTypeId -``` - -Added in v2.0.0 - -## MetricStateTypeId - -**Signature** - -```ts -export declare const MetricStateTypeId: typeof MetricStateTypeId -``` - -Added in v2.0.0 - -## MetricStateTypeId (type alias) - -**Signature** - -```ts -export type MetricStateTypeId = typeof MetricStateTypeId -``` - -Added in v2.0.0 - -## SummaryStateTypeId - -**Signature** - -```ts -export declare const SummaryStateTypeId: typeof SummaryStateTypeId -``` - -Added in v2.0.0 - -## SummaryStateTypeId (type alias) - -**Signature** - -```ts -export type SummaryStateTypeId = typeof SummaryStateTypeId -``` - -Added in v2.0.0 - -# utils - -## MetricState (namespace) - -Added in v2.0.0 - -### Counter (interface) - -**Signature** - -```ts -export interface Counter extends MetricState> { - readonly [CounterStateTypeId]: CounterStateTypeId - readonly count: A -} -``` - -Added in v2.0.0 - -### Frequency (interface) - -**Signature** - -```ts -export interface Frequency extends MetricState { - readonly [FrequencyStateTypeId]: FrequencyStateTypeId - readonly occurrences: HashMap.HashMap -} -``` - -Added in v2.0.0 - -### Gauge (interface) - -**Signature** - -```ts -export interface Gauge extends MetricState> { - readonly [GaugeStateTypeId]: GaugeStateTypeId - readonly value: A -} -``` - -Added in v2.0.0 - -### Histogram (interface) - -**Signature** - -```ts -export interface Histogram extends MetricState { - readonly [HistogramStateTypeId]: HistogramStateTypeId - readonly buckets: Chunk.Chunk - readonly count: number - readonly min: number - readonly max: number - readonly sum: number -} -``` - -Added in v2.0.0 - -### Summary (interface) - -**Signature** - -```ts -export interface Summary extends MetricState { - readonly [SummaryStateTypeId]: SummaryStateTypeId - readonly error: number - readonly quantiles: Chunk.Chunk]> - readonly count: number - readonly min: number - readonly max: number - readonly sum: number -} -``` - -Added in v2.0.0 - -### Untyped (interface) - -**Signature** - -```ts -export interface Untyped extends MetricState {} -``` - -Added in v2.0.0 - -### Variance (interface) - -**Signature** - -```ts -export interface Variance { - readonly [MetricStateTypeId]: { - readonly _A: (_: A) => void - } -} -``` - -Added in v2.0.0 diff --git a/docs/modules/MutableHashMap.ts.md b/docs/modules/MutableHashMap.ts.md deleted file mode 100644 index d5f47a5e1..000000000 --- a/docs/modules/MutableHashMap.ts.md +++ /dev/null @@ -1,199 +0,0 @@ ---- -title: MutableHashMap.ts -nav_order: 66 -parent: Modules ---- - -## MutableHashMap overview - -Added in v2.0.0 - ---- - -

Table of contents

- -- [constructors](#constructors) - - [empty](#empty) - - [make](#make) -- [conversions](#conversions) - - [fromIterable](#fromiterable) -- [elements](#elements) - - [get](#get) - - [has](#has) - - [size](#size) -- [models](#models) - - [MutableHashMap (interface)](#mutablehashmap-interface) -- [symbol](#symbol) - - [TypeId (type alias)](#typeid-type-alias) -- [utils](#utils) - - [modify](#modify) - - [modifyAt](#modifyat) - - [remove](#remove) - - [set](#set) - ---- - -# constructors - -## empty - -**Signature** - -```ts -export declare const empty: () => MutableHashMap -``` - -Added in v2.0.0 - -## make - -**Signature** - -```ts -export declare const make: ( - ...entries: Entries -) => MutableHashMap< - Entries[number] extends readonly [infer K, any] ? K : never, - Entries[number] extends readonly [any, infer V] ? V : never -> -``` - -Added in v2.0.0 - -# conversions - -## fromIterable - -**Signature** - -```ts -export declare const fromIterable: (entries: Iterable) => MutableHashMap -``` - -Added in v2.0.0 - -# elements - -## get - -**Signature** - -```ts -export declare const get: { - (key: K): (self: MutableHashMap) => Option.Option - (self: MutableHashMap, key: K): Option.Option -} -``` - -Added in v2.0.0 - -## has - -**Signature** - -```ts -export declare const has: { - (key: K): (self: MutableHashMap) => boolean - (self: MutableHashMap, key: K): boolean -} -``` - -Added in v2.0.0 - -## size - -**Signature** - -```ts -export declare const size: (self: MutableHashMap) => number -``` - -Added in v2.0.0 - -# models - -## MutableHashMap (interface) - -**Signature** - -```ts -export interface MutableHashMap extends Iterable<[K, V]>, Pipeable, Inspectable { - readonly [TypeId]: TypeId - - /** @internal */ - readonly backingMap: MutableRef.MutableRef> -} -``` - -Added in v2.0.0 - -# symbol - -## TypeId (type alias) - -**Signature** - -```ts -export type TypeId = typeof TypeId -``` - -Added in v2.0.0 - -# utils - -## modify - -Updates the value of the specified key within the `MutableHashMap` if it exists. - -**Signature** - -```ts -export declare const modify: { - (key: K, f: (v: V) => V): (self: MutableHashMap) => MutableHashMap - (self: MutableHashMap, key: K, f: (v: V) => V): MutableHashMap -} -``` - -Added in v2.0.0 - -## modifyAt - -Set or remove the specified key in the `MutableHashMap` using the specified -update function. - -**Signature** - -```ts -export declare const modifyAt: { - (key: K, f: (value: Option.Option) => Option.Option): (self: MutableHashMap) => MutableHashMap - (self: MutableHashMap, key: K, f: (value: Option.Option) => Option.Option): MutableHashMap -} -``` - -Added in v2.0.0 - -## remove - -**Signature** - -```ts -export declare const remove: { - (key: K): (self: MutableHashMap) => MutableHashMap - (self: MutableHashMap, key: K): MutableHashMap -} -``` - -Added in v2.0.0 - -## set - -**Signature** - -```ts -export declare const set: { - (key: K, value: V): (self: MutableHashMap) => MutableHashMap - (self: MutableHashMap, key: K, value: V): MutableHashMap -} -``` - -Added in v2.0.0 diff --git a/docs/modules/MutableHashSet.ts.md b/docs/modules/MutableHashSet.ts.md deleted file mode 100644 index a8c0bf8af..000000000 --- a/docs/modules/MutableHashSet.ts.md +++ /dev/null @@ -1,141 +0,0 @@ ---- -title: MutableHashSet.ts -nav_order: 67 -parent: Modules ---- - -## MutableHashSet overview - -Added in v2.0.0 - ---- - -

Table of contents

- -- [constructors](#constructors) - - [empty](#empty) - - [fromIterable](#fromiterable) - - [make](#make) -- [elements](#elements) - - [add](#add) - - [has](#has) - - [remove](#remove) - - [size](#size) -- [models](#models) - - [MutableHashSet (interface)](#mutablehashset-interface) -- [symbol](#symbol) - - [TypeId (type alias)](#typeid-type-alias) - ---- - -# constructors - -## empty - -**Signature** - -```ts -export declare const empty: () => MutableHashSet -``` - -Added in v2.0.0 - -## fromIterable - -**Signature** - -```ts -export declare const fromIterable: (keys: Iterable) => MutableHashSet -``` - -Added in v2.0.0 - -## make - -**Signature** - -```ts -export declare const make: (...keys: Keys) => MutableHashSet -``` - -Added in v2.0.0 - -# elements - -## add - -**Signature** - -```ts -export declare const add: { - (key: V): (self: MutableHashSet) => MutableHashSet - (self: MutableHashSet, key: V): MutableHashSet -} -``` - -Added in v2.0.0 - -## has - -**Signature** - -```ts -export declare const has: { - (key: V): (self: MutableHashSet) => boolean - (self: MutableHashSet, key: V): boolean -} -``` - -Added in v2.0.0 - -## remove - -**Signature** - -```ts -export declare const remove: { - (key: V): (self: MutableHashSet) => MutableHashSet - (self: MutableHashSet, key: V): MutableHashSet -} -``` - -Added in v2.0.0 - -## size - -**Signature** - -```ts -export declare const size: (self: MutableHashSet) => number -``` - -Added in v2.0.0 - -# models - -## MutableHashSet (interface) - -**Signature** - -```ts -export interface MutableHashSet extends Iterable, Pipeable, Inspectable { - readonly [TypeId]: TypeId - - /** @internal */ - readonly keyMap: MutableHashMap.MutableHashMap -} -``` - -Added in v2.0.0 - -# symbol - -## TypeId (type alias) - -**Signature** - -```ts -export type TypeId = typeof TypeId -``` - -Added in v2.0.0 diff --git a/docs/modules/MutableList.ts.md b/docs/modules/MutableList.ts.md deleted file mode 100644 index b179d725d..000000000 --- a/docs/modules/MutableList.ts.md +++ /dev/null @@ -1,244 +0,0 @@ ---- -title: MutableList.ts -nav_order: 68 -parent: Modules ---- - -## MutableList overview - -Added in v2.0.0 - ---- - -

Table of contents

- -- [concatenating](#concatenating) - - [append](#append) - - [prepend](#prepend) -- [constructors](#constructors) - - [empty](#empty) - - [fromIterable](#fromiterable) - - [make](#make) -- [getters](#getters) - - [head](#head) - - [isEmpty](#isempty) - - [length](#length) - - [tail](#tail) -- [model](#model) - - [MutableList (interface)](#mutablelist-interface) -- [symbol](#symbol) - - [TypeId (type alias)](#typeid-type-alias) -- [traversing](#traversing) - - [forEach](#foreach) -- [utils](#utils) - - [pop](#pop) - - [reset](#reset) - - [shift](#shift) - ---- - -# concatenating - -## append - -Appends the specified element to the end of the `MutableList`. - -**Signature** - -```ts -export declare const append: { -
(value: A): (self: MutableList) => MutableList - (self: MutableList, value: A): MutableList -} -``` - -Added in v2.0.0 - -## prepend - -Prepends the specified value to the beginning of the list. - -**Signature** - -```ts -export declare const prepend: { - (value: A): (self: MutableList) => MutableList - (self: MutableList, value: A): MutableList -} -``` - -Added in v2.0.0 - -# constructors - -## empty - -Creates an empty `MutableList`. - -**Signature** - -```ts -export declare const empty: () => MutableList -``` - -Added in v2.0.0 - -## fromIterable - -Creates a new `MutableList` from an `Iterable`. - -**Signature** - -```ts -export declare const fromIterable: (iterable: Iterable) => MutableList -``` - -Added in v2.0.0 - -## make - -Creates a new `MutableList` from the specified elements. - -**Signature** - -```ts -export declare const make: (...elements: readonly A[]) => MutableList -``` - -Added in v2.0.0 - -# getters - -## head - -Returns the first element of the list, if it exists. - -**Signature** - -```ts -export declare const head: (self: MutableList) => A | undefined -``` - -Added in v2.0.0 - -## isEmpty - -Returns `true` if the list contains zero elements, `false`, otherwise. - -**Signature** - -```ts -export declare const isEmpty: (self: MutableList) => boolean -``` - -Added in v2.0.0 - -## length - -Returns the length of the list. - -**Signature** - -```ts -export declare const length: (self: MutableList) => number -``` - -Added in v2.0.0 - -## tail - -Returns the last element of the list, if it exists. - -**Signature** - -```ts -export declare const tail: (self: MutableList) => A | undefined -``` - -Added in v2.0.0 - -# model - -## MutableList (interface) - -**Signature** - -```ts -export interface MutableList extends Iterable, Pipeable, Inspectable { - readonly [TypeId]: TypeId - - /** @internal */ - head: LinkedListNode | undefined - /** @internal */ - tail: LinkedListNode | undefined -} -``` - -Added in v2.0.0 - -# symbol - -## TypeId (type alias) - -**Signature** - -```ts -export type TypeId = typeof TypeId -``` - -Added in v2.0.0 - -# traversing - -## forEach - -Executes the specified function `f` for each element in the list. - -**Signature** - -```ts -export declare const forEach: { - (f: (element: A) => void): (self: MutableList) => void - (self: MutableList, f: (element: A) => void): void -} -``` - -Added in v2.0.0 - -# utils - -## pop - -Removes the last value from the list and returns it, if it exists. - -**Signature** - -```ts -export declare const pop: (self: MutableList) => A | undefined -``` - -Added in v0.0.1 - -## reset - -Removes all elements from the doubly-linked list. - -**Signature** - -```ts -export declare const reset: (self: MutableList) => MutableList -``` - -Added in v2.0.0 - -## shift - -Removes the first value from the list and returns it, if it exists. - -**Signature** - -```ts -export declare const shift: (self: MutableList) => A | undefined -``` - -Added in v0.0.1 diff --git a/docs/modules/MutableQueue.ts.md b/docs/modules/MutableQueue.ts.md deleted file mode 100644 index 88158aadb..000000000 --- a/docs/modules/MutableQueue.ts.md +++ /dev/null @@ -1,243 +0,0 @@ ---- -title: MutableQueue.ts -nav_order: 69 -parent: Modules ---- - -## MutableQueue overview - -Added in v2.0.0 - ---- - -

Table of contents

- -- [constructors](#constructors) - - [bounded](#bounded) - - [unbounded](#unbounded) -- [getters](#getters) - - [capacity](#capacity) - - [isEmpty](#isempty) - - [isFull](#isfull) - - [length](#length) -- [model](#model) - - [MutableQueue (interface)](#mutablequeue-interface) -- [symbol](#symbol) - - [EmptyMutableQueue](#emptymutablequeue) - - [TypeId (type alias)](#typeid-type-alias) -- [utils](#utils) - - [MutableQueue (namespace)](#mutablequeue-namespace) - - [Empty (type alias)](#empty-type-alias) - - [offer](#offer) - - [offerAll](#offerall) - - [poll](#poll) - - [pollUpTo](#pollupto) - ---- - -# constructors - -## bounded - -Creates a new bounded `MutableQueue`. - -**Signature** - -```ts -export declare const bounded:
(capacity: number) => MutableQueue -``` - -Added in v2.0.0 - -## unbounded - -Creates a new unbounded `MutableQueue`. - -**Signature** - -```ts -export declare const unbounded: () => MutableQueue -``` - -Added in v2.0.0 - -# getters - -## capacity - -The **maximum** number of elements that a queue can hold. - -**Note**: unbounded queues can still implement this interface with -`capacity = Infinity`. - -**Signature** - -```ts -export declare const capacity: (self: MutableQueue) => number -``` - -Added in v2.0.0 - -## isEmpty - -Returns `true` if the queue is empty, `false` otherwise. - -**Signature** - -```ts -export declare const isEmpty: (self: MutableQueue) => boolean -``` - -Added in v2.0.0 - -## isFull - -Returns `true` if the queue is full, `false` otherwise. - -**Signature** - -```ts -export declare const isFull: (self: MutableQueue) => boolean -``` - -Added in v2.0.0 - -## length - -Returns the current number of elements in the queue. - -**Signature** - -```ts -export declare const length: (self: MutableQueue) => number -``` - -Added in v2.0.0 - -# model - -## MutableQueue (interface) - -**Signature** - -```ts -export interface MutableQueue extends Iterable, Pipeable, Inspectable { - readonly [TypeId]: TypeId - - /** @internal */ - queue: MutableList.MutableList - /** @internal */ - capacity: number | undefined -} -``` - -Added in v2.0.0 - -# symbol - -## EmptyMutableQueue - -**Signature** - -```ts -export declare const EmptyMutableQueue: typeof EmptyMutableQueue -``` - -Added in v2.0.0 - -## TypeId (type alias) - -**Signature** - -```ts -export type TypeId = typeof TypeId -``` - -Added in v2.0.0 - -# utils - -## MutableQueue (namespace) - -Added in v2.0.0 - -### Empty (type alias) - -**Signature** - -```ts -export type Empty = typeof EmptyMutableQueue -``` - -Added in v2.0.0 - -## offer - -Offers an element to the queue. - -Returns whether the enqueue was successful or not. - -**Signature** - -```ts -export declare const offer: { - (self: MutableQueue, value: A): boolean - (value: A): (self: MutableQueue) => boolean -} -``` - -Added in v2.0.0 - -## offerAll - -Enqueues a collection of values into the queue. - -Returns a `Chunk` of the values that were **not** able to be enqueued. - -**Signature** - -```ts -export declare const offerAll: { - (values: Iterable): (self: MutableQueue) => Chunk.Chunk - (self: MutableQueue, values: Iterable): Chunk.Chunk -} -``` - -Added in v2.0.0 - -## poll - -Dequeues an element from the queue. - -Returns either an element from the queue, or the `def` param. - -**Note**: if there is no meaningful default for your type, you can always -use `poll(MutableQueue.EmptyMutableQueue)`. - -**Signature** - -```ts -export declare const poll: { - (def: D): (self: MutableQueue) => D | A - (self: MutableQueue, def: D): A | D -} -``` - -Added in v2.0.0 - -## pollUpTo - -Dequeues up to `n` elements from the queue. - -Returns a `List` of up to `n` elements. - -**Signature** - -```ts -export declare const pollUpTo: { - (n: number): (self: MutableQueue) => Chunk.Chunk - (self: MutableQueue, n: number): Chunk.Chunk -} -``` - -Added in v2.0.0 diff --git a/docs/modules/MutableRef.ts.md b/docs/modules/MutableRef.ts.md deleted file mode 100644 index 47745595a..000000000 --- a/docs/modules/MutableRef.ts.md +++ /dev/null @@ -1,252 +0,0 @@ ---- -title: MutableRef.ts -nav_order: 70 -parent: Modules ---- - -## MutableRef overview - -Added in v2.0.0 - ---- - -

Table of contents

- -- [boolean](#boolean) - - [toggle](#toggle) -- [constructors](#constructors) - - [make](#make) -- [general](#general) - - [compareAndSet](#compareandset) - - [get](#get) - - [getAndSet](#getandset) - - [getAndUpdate](#getandupdate) - - [set](#set) - - [setAndGet](#setandget) - - [update](#update) - - [updateAndGet](#updateandget) -- [models](#models) - - [MutableRef (interface)](#mutableref-interface) -- [numeric](#numeric) - - [decrement](#decrement) - - [decrementAndGet](#decrementandget) - - [getAndDecrement](#getanddecrement) - - [getAndIncrement](#getandincrement) - - [increment](#increment) - - [incrementAndGet](#incrementandget) -- [symbol](#symbol) - - [TypeId (type alias)](#typeid-type-alias) - ---- - -# boolean - -## toggle - -**Signature** - -```ts -export declare const toggle: (self: MutableRef) => MutableRef -``` - -Added in v2.0.0 - -# constructors - -## make - -**Signature** - -```ts -export declare const make: (value: T) => MutableRef -``` - -Added in v2.0.0 - -# general - -## compareAndSet - -**Signature** - -```ts -export declare const compareAndSet: { - (oldValue: T, newValue: T): (self: MutableRef) => boolean - (self: MutableRef, oldValue: T, newValue: T): boolean -} -``` - -Added in v2.0.0 - -## get - -**Signature** - -```ts -export declare const get: (self: MutableRef) => T -``` - -Added in v2.0.0 - -## getAndSet - -**Signature** - -```ts -export declare const getAndSet: { (value: T): (self: MutableRef) => T; (self: MutableRef, value: T): T } -``` - -Added in v2.0.0 - -## getAndUpdate - -**Signature** - -```ts -export declare const getAndUpdate: { - (f: (value: T) => T): (self: MutableRef) => T - (self: MutableRef, f: (value: T) => T): T -} -``` - -Added in v2.0.0 - -## set - -**Signature** - -```ts -export declare const set: { - (value: T): (self: MutableRef) => MutableRef - (self: MutableRef, value: T): MutableRef -} -``` - -Added in v2.0.0 - -## setAndGet - -**Signature** - -```ts -export declare const setAndGet: { (value: T): (self: MutableRef) => T; (self: MutableRef, value: T): T } -``` - -Added in v2.0.0 - -## update - -**Signature** - -```ts -export declare const update: { - (f: (value: T) => T): (self: MutableRef) => MutableRef - (self: MutableRef, f: (value: T) => T): MutableRef -} -``` - -Added in v2.0.0 - -## updateAndGet - -**Signature** - -```ts -export declare const updateAndGet: { - (f: (value: T) => T): (self: MutableRef) => T - (self: MutableRef, f: (value: T) => T): T -} -``` - -Added in v2.0.0 - -# models - -## MutableRef (interface) - -**Signature** - -```ts -export interface MutableRef extends Pipeable, Inspectable { - readonly [TypeId]: TypeId - - /** @internal */ - current: T -} -``` - -Added in v2.0.0 - -# numeric - -## decrement - -**Signature** - -```ts -export declare const decrement: (self: MutableRef) => MutableRef -``` - -Added in v2.0.0 - -## decrementAndGet - -**Signature** - -```ts -export declare const decrementAndGet: (self: MutableRef) => number -``` - -Added in v2.0.0 - -## getAndDecrement - -**Signature** - -```ts -export declare const getAndDecrement: (self: MutableRef) => number -``` - -Added in v2.0.0 - -## getAndIncrement - -**Signature** - -```ts -export declare const getAndIncrement: (self: MutableRef) => number -``` - -Added in v2.0.0 - -## increment - -**Signature** - -```ts -export declare const increment: (self: MutableRef) => MutableRef -``` - -Added in v2.0.0 - -## incrementAndGet - -**Signature** - -```ts -export declare const incrementAndGet: (self: MutableRef) => number -``` - -Added in v2.0.0 - -# symbol - -## TypeId (type alias) - -**Signature** - -```ts -export type TypeId = typeof TypeId -``` - -Added in v2.0.0 diff --git a/docs/modules/NonEmptyIterable.ts.md b/docs/modules/NonEmptyIterable.ts.md deleted file mode 100644 index 873049a21..000000000 --- a/docs/modules/NonEmptyIterable.ts.md +++ /dev/null @@ -1,46 +0,0 @@ ---- -title: NonEmptyIterable.ts -nav_order: 71 -parent: Modules ---- - -## NonEmptyIterable overview - -Added in v2.0.0 - ---- - -

Table of contents

- -- [getters](#getters) - - [unprepend](#unprepend) -- [model](#model) - - [NonEmptyIterable (interface)](#nonemptyiterable-interface) - ---- - -# getters - -## unprepend - -**Signature** - -```ts -export declare const unprepend:
(self: NonEmptyIterable) => [A, Iterator] -``` - -Added in v2.0.0 - -# model - -## NonEmptyIterable (interface) - -**Signature** - -```ts -export interface NonEmptyIterable extends Iterable { - readonly [nonEmpty]: A -} -``` - -Added in v2.0.0 diff --git a/docs/modules/Number.ts.md b/docs/modules/Number.ts.md deleted file mode 100644 index 788babc62..000000000 --- a/docs/modules/Number.ts.md +++ /dev/null @@ -1,523 +0,0 @@ ---- -title: Number.ts -nav_order: 72 -parent: Modules ---- - -## Number overview - -This module provides utility functions and type class instances for working with the `number` type in TypeScript. -It includes functions for basic arithmetic operations, as well as type class instances for -`Equivalence` and `Order`. - -Added in v2.0.0 - ---- - -

Table of contents

- -- [guards](#guards) - - [isNumber](#isnumber) -- [instances](#instances) - - [Equivalence](#equivalence) - - [Order](#order) -- [math](#math) - - [decrement](#decrement) - - [divide](#divide) - - [increment](#increment) - - [multiply](#multiply) - - [multiplyAll](#multiplyall) - - [remainder](#remainder) - - [sign](#sign) - - [subtract](#subtract) - - [sum](#sum) - - [sumAll](#sumall) - - [unsafeDivide](#unsafedivide) -- [predicates](#predicates) - - [between](#between) - - [greaterThan](#greaterthan) - - [greaterThanOrEqualTo](#greaterthanorequalto) - - [lessThan](#lessthan) - - [lessThanOrEqualTo](#lessthanorequalto) -- [utils](#utils) - - [clamp](#clamp) - - [max](#max) - - [min](#min) - ---- - -# guards - -## isNumber - -Tests if a value is a `number`. - -**Signature** - -```ts -export declare const isNumber: (input: unknown) => input is number -``` - -**Example** - -```ts -import { isNumber } from "effect/Number" - -assert.deepStrictEqual(isNumber(2), true) -assert.deepStrictEqual(isNumber("2"), false) -``` - -Added in v2.0.0 - -# instances - -## Equivalence - -**Signature** - -```ts -export declare const Equivalence: equivalence.Equivalence -``` - -Added in v2.0.0 - -## Order - -**Signature** - -```ts -export declare const Order: order.Order -``` - -Added in v2.0.0 - -# math - -## decrement - -Decrements a number by `1`. - -**Signature** - -```ts -export declare const decrement: (n: number) => number -``` - -**Example** - -```ts -import { decrement } from "effect/Number" - -assert.deepStrictEqual(decrement(3), 2) -``` - -Added in v2.0.0 - -## divide - -Provides a division operation on `number`s. - -**Signature** - -```ts -export declare const divide: { - (that: number): (self: number) => Option - (self: number, that: number): Option -} -``` - -**Example** - -```ts -import { divide } from "effect/Number" -import { some, none } from "effect/Option" - -assert.deepStrictEqual(divide(6, 3), some(2)) -assert.deepStrictEqual(divide(6, 0), none()) -``` - -Added in v2.0.0 - -## increment - -Returns the result of adding `1` to a given number. - -**Signature** - -```ts -export declare const increment: (n: number) => number -``` - -**Example** - -```ts -import { increment } from "effect/Number" - -assert.deepStrictEqual(increment(2), 3) -``` - -Added in v2.0.0 - -## multiply - -Provides a multiplication operation on `number`s. - -**Signature** - -```ts -export declare const multiply: { (that: number): (self: number) => number; (self: number, that: number): number } -``` - -**Example** - -```ts -import { multiply } from "effect/Number" - -assert.deepStrictEqual(multiply(2, 3), 6) -``` - -Added in v2.0.0 - -## multiplyAll - -Takes an `Iterable` of `number`s and returns their multiplication as a single `number`. - -**Signature** - -```ts -export declare const multiplyAll: (collection: Iterable) => number -``` - -**Example** - -```ts -import { multiplyAll } from "effect/Number" - -assert.deepStrictEqual(multiplyAll([2, 3, 4]), 24) -``` - -Added in v2.0.0 - -## remainder - -Returns the remainder left over when one operand is divided by a second operand. - -It always takes the sign of the dividend. - -**Signature** - -```ts -export declare const remainder: { (divisor: number): (self: number) => number; (self: number, divisor: number): number } -``` - -**Example** - -```ts -import { remainder } from "effect/Number" - -assert.deepStrictEqual(remainder(2, 2), 0) -assert.deepStrictEqual(remainder(3, 2), 1) -assert.deepStrictEqual(remainder(-4, 2), -0) -``` - -Added in v2.0.0 - -## sign - -Determines the sign of a given `number`. - -**Signature** - -```ts -export declare const sign: (n: number) => Ordering -``` - -**Example** - -```ts -import { sign } from "effect/Number" - -assert.deepStrictEqual(sign(-5), -1) -assert.deepStrictEqual(sign(0), 0) -assert.deepStrictEqual(sign(5), 1) -``` - -Added in v2.0.0 - -## subtract - -Provides a subtraction operation on `number`s. - -**Signature** - -```ts -export declare const subtract: { (that: number): (self: number) => number; (self: number, that: number): number } -``` - -**Example** - -```ts -import { subtract } from "effect/Number" - -assert.deepStrictEqual(subtract(2, 3), -1) -``` - -Added in v2.0.0 - -## sum - -Provides an addition operation on `number`s. - -**Signature** - -```ts -export declare const sum: { (that: number): (self: number) => number; (self: number, that: number): number } -``` - -**Example** - -```ts -import { sum } from "effect/Number" - -assert.deepStrictEqual(sum(2, 3), 5) -``` - -Added in v2.0.0 - -## sumAll - -Takes an `Iterable` of `number`s and returns their sum as a single `number`. - -**Signature** - -```ts -export declare const sumAll: (collection: Iterable) => number -``` - -**Example** - -```ts -import { sumAll } from "effect/Number" - -assert.deepStrictEqual(sumAll([2, 3, 4]), 9) -``` - -Added in v2.0.0 - -## unsafeDivide - -Provides a division operation on `number`s. - -Throws a `RangeError` if the divisor is `0`. - -**Signature** - -```ts -export declare const unsafeDivide: { (that: number): (self: number) => number; (self: number, that: number): number } -``` - -**Example** - -```ts -import { unsafeDivide } from "effect/Number" - -assert.deepStrictEqual(unsafeDivide(6, 3), 2) -``` - -Added in v2.0.0 - -# predicates - -## between - -Checks if a `number` is between a `minimum` and `maximum` value (inclusive). - -**Signature** - -```ts -export declare const between: { - (options: { minimum: number; maximum: number }): (self: number) => boolean - (self: number, options: { minimum: number; maximum: number }): boolean -} -``` - -**Example** - -```ts -import * as Number from "effect/Number" - -const between = Number.between({ minimum: 0, maximum: 5 }) - -assert.deepStrictEqual(between(3), true) -assert.deepStrictEqual(between(-1), false) -assert.deepStrictEqual(between(6), false) -``` - -Added in v2.0.0 - -## greaterThan - -Returns `true` if the first argument is greater than the second, otherwise `false`. - -**Signature** - -```ts -export declare const greaterThan: { (that: number): (self: number) => boolean; (self: number, that: number): boolean } -``` - -**Example** - -```ts -import { greaterThan } from "effect/Number" - -assert.deepStrictEqual(greaterThan(2, 3), false) -assert.deepStrictEqual(greaterThan(3, 3), false) -assert.deepStrictEqual(greaterThan(4, 3), true) -``` - -Added in v2.0.0 - -## greaterThanOrEqualTo - -Returns a function that checks if a given `number` is greater than or equal to the provided one. - -**Signature** - -```ts -export declare const greaterThanOrEqualTo: { - (that: number): (self: number) => boolean - (self: number, that: number): boolean -} -``` - -**Example** - -```ts -import { greaterThanOrEqualTo } from "effect/Number" - -assert.deepStrictEqual(greaterThanOrEqualTo(2, 3), false) -assert.deepStrictEqual(greaterThanOrEqualTo(3, 3), true) -assert.deepStrictEqual(greaterThanOrEqualTo(4, 3), true) -``` - -Added in v2.0.0 - -## lessThan - -Returns `true` if the first argument is less than the second, otherwise `false`. - -**Signature** - -```ts -export declare const lessThan: { (that: number): (self: number) => boolean; (self: number, that: number): boolean } -``` - -**Example** - -```ts -import { lessThan } from "effect/Number" - -assert.deepStrictEqual(lessThan(2, 3), true) -assert.deepStrictEqual(lessThan(3, 3), false) -assert.deepStrictEqual(lessThan(4, 3), false) -``` - -Added in v2.0.0 - -## lessThanOrEqualTo - -Returns a function that checks if a given `number` is less than or equal to the provided one. - -**Signature** - -```ts -export declare const lessThanOrEqualTo: { - (that: number): (self: number) => boolean - (self: number, that: number): boolean -} -``` - -**Example** - -```ts -import { lessThanOrEqualTo } from "effect/Number" - -assert.deepStrictEqual(lessThanOrEqualTo(2, 3), true) -assert.deepStrictEqual(lessThanOrEqualTo(3, 3), true) -assert.deepStrictEqual(lessThanOrEqualTo(4, 3), false) -``` - -Added in v2.0.0 - -# utils - -## clamp - -Restricts the given `number` to be within the range specified by the `minimum` and `maximum` values. - -- If the `number` is less than the `minimum` value, the function returns the `minimum` value. -- If the `number` is greater than the `maximum` value, the function returns the `maximum` value. -- Otherwise, it returns the original `number`. - -**Signature** - -```ts -export declare const clamp: { - (options: { minimum: number; maximum: number }): (self: number) => number - (self: number, options: { minimum: number; maximum: number }): number -} -``` - -**Example** - -```ts -import * as Number from "effect/Number" - -const clamp = Number.clamp({ minimum: 1, maximum: 5 }) - -assert.equal(clamp(3), 3) -assert.equal(clamp(0), 1) -assert.equal(clamp(6), 5) -``` - -Added in v2.0.0 - -## max - -Returns the maximum between two `number`s. - -**Signature** - -```ts -export declare const max: { (that: number): (self: number) => number; (self: number, that: number): number } -``` - -**Example** - -```ts -import { max } from "effect/Number" - -assert.deepStrictEqual(max(2, 3), 3) -``` - -Added in v2.0.0 - -## min - -Returns the minimum between two `number`s. - -**Signature** - -```ts -export declare const min: { (that: number): (self: number) => number; (self: number, that: number): number } -``` - -**Example** - -```ts -import { min } from "effect/Number" - -assert.deepStrictEqual(min(2, 3), 2) -``` - -Added in v2.0.0 diff --git a/docs/modules/Option.ts.md b/docs/modules/Option.ts.md deleted file mode 100644 index 5b8b70ea7..000000000 --- a/docs/modules/Option.ts.md +++ /dev/null @@ -1,1424 +0,0 @@ ---- -title: Option.ts -nav_order: 73 -parent: Modules ---- - -## Option overview - -Added in v2.0.0 - ---- - -

Table of contents

- -- [combining](#combining) - - [all](#all) - - [ap](#ap) - - [product](#product) - - [productMany](#productmany) - - [zipWith](#zipwith) -- [constructors](#constructors) - - [none](#none) - - [some](#some) -- [conversions](#conversions) - - [fromIterable](#fromiterable) - - [fromNullable](#fromnullable) - - [getLeft](#getleft) - - [getOrThrow](#getorthrow) - - [getOrThrowWith](#getorthrowwith) - - [getRight](#getright) - - [liftNullable](#liftnullable) - - [liftThrowable](#liftthrowable) - - [toArray](#toarray) - - [toRefinement](#torefinement) -- [do notation](#do-notation) - - [Do](#do) - - [bind](#bind) - - [bindTo](#bindto) - - [let](#let) -- [elements](#elements) - - [contains](#contains) - - [containsWith](#containswith) -- [equivalence](#equivalence) - - [getEquivalence](#getequivalence) -- [error handling](#error-handling) - - [firstSomeOf](#firstsomeof) - - [orElse](#orelse) - - [orElseEither](#orelseeither) -- [filtering](#filtering) - - [filter](#filter) - - [filterMap](#filtermap) - - [partitionMap](#partitionmap) -- [folding](#folding) - - [reduceCompact](#reducecompact) -- [generators](#generators) - - [gen](#gen) -- [getters](#getters) - - [getOrElse](#getorelse) - - [getOrNull](#getornull) - - [getOrUndefined](#getorundefined) -- [guards](#guards) - - [isNone](#isnone) - - [isOption](#isoption) - - [isSome](#issome) -- [lifting](#lifting) - - [lift2](#lift2) - - [liftPredicate](#liftpredicate) -- [models](#models) - - [None (interface)](#none-interface) - - [Option (type alias)](#option-type-alias) - - [OptionUnify (interface)](#optionunify-interface) - - [OptionUnifyIgnore (interface)](#optionunifyignore-interface) - - [Some (interface)](#some-interface) -- [pattern matching](#pattern-matching) - - [match](#match) -- [sorting](#sorting) - - [getOrder](#getorder) -- [symbols](#symbols) - - [TypeId](#typeid) - - [TypeId (type alias)](#typeid-type-alias) -- [transforming](#transforming) - - [as](#as) - - [asUnit](#asunit) - - [composeK](#composek) - - [flatMap](#flatmap) - - [flatMapNullable](#flatmapnullable) - - [flatten](#flatten) - - [map](#map) - - [tap](#tap) - - [zipLeft](#zipleft) - - [zipRight](#zipright) -- [type lambdas](#type-lambdas) - - [OptionTypeLambda (interface)](#optiontypelambda-interface) -- [utils](#utils) - - [exists](#exists) - - [unit](#unit) - ---- - -# combining - -## all - -Takes a structure of `Option`s and returns an `Option` of values with the same structure. - -- If a tuple is supplied, then the returned `Option` will contain a tuple with the same length. -- If a struct is supplied, then the returned `Option` will contain a struct with the same keys. -- If an iterable is supplied, then the returned `Option` will contain an array. - -**Signature** - -```ts -export declare const all: > | Record>>( - input: I -) => [I] extends [readonly Option[]] - ? Option<{ -readonly [K in keyof I]: [I[K]] extends [Option] ? A : never }> - : [I] extends [Iterable>] - ? Option - : Option<{ -readonly [K in keyof I]: [I[K]] extends [Option] ? A : never }> -``` - -**Example** - -```ts -import * as O from "effect/Option" - -assert.deepStrictEqual(O.all([O.some(1), O.some(2)]), O.some([1, 2])) -assert.deepStrictEqual(O.all({ a: O.some(1), b: O.some("hello") }), O.some({ a: 1, b: "hello" })) -assert.deepStrictEqual(O.all({ a: O.some(1), b: O.none() }), O.none()) -``` - -Added in v2.0.0 - -## ap - -**Signature** - -```ts -export declare const ap: { -
(that: Option): (self: Option<(a: A) => B>) => Option - (self: Option<(a: A) => B>, that: Option): Option -} -``` - -Added in v2.0.0 - -## product - -**Signature** - -```ts -export declare const product: (self: Option, that: Option) => Option<[A, B]> -``` - -Added in v2.0.0 - -## productMany - -**Signature** - -```ts -export declare const productMany: (self: Option, collection: Iterable>) => Option<[A, ...A[]]> -``` - -Added in v2.0.0 - -## zipWith - -Zips two `Option` values together using a provided function, returning a new `Option` of the result. - -**Signature** - -```ts -export declare const zipWith: { - (that: Option, f: (a: A, b: B) => C): (self: Option) => Option - (self: Option, that: Option, f: (a: A, b: B) => C): Option -} -``` - -**Example** - -```ts -import * as O from "effect/Option" - -type Complex = [number, number] - -const complex = (real: number, imaginary: number): Complex => [real, imaginary] - -assert.deepStrictEqual(O.zipWith(O.none(), O.none(), complex), O.none()) -assert.deepStrictEqual(O.zipWith(O.some(1), O.none(), complex), O.none()) -assert.deepStrictEqual(O.zipWith(O.none(), O.some(1), complex), O.none()) -assert.deepStrictEqual(O.zipWith(O.some(1), O.some(2), complex), O.some([1, 2])) - -assert.deepStrictEqual(O.zipWith(O.some(1), complex)(O.some(2)), O.some([2, 1])) -``` - -Added in v2.0.0 - -# constructors - -## none - -Creates a new `Option` that represents the absence of a value. - -**Signature** - -```ts -export declare const none: () => Option -``` - -Added in v2.0.0 - -## some - -Creates a new `Option` that wraps the given value. - -**Signature** - -```ts -export declare const some: (value: A) => Option -``` - -Added in v2.0.0 - -# conversions - -## fromIterable - -Converts an `Iterable` of values into an `Option`. Returns the first value of the `Iterable` wrapped in a `Some` -if the `Iterable` is not empty, otherwise returns `None`. - -**Signature** - -```ts -export declare const fromIterable: (collection: Iterable) => Option -``` - -**Example** - -```ts -import { fromIterable, some, none } from "effect/Option" - -assert.deepStrictEqual(fromIterable([1, 2, 3]), some(1)) -assert.deepStrictEqual(fromIterable([]), none()) -``` - -Added in v2.0.0 - -## fromNullable - -Constructs a new `Option` from a nullable type. If the value is `null` or `undefined`, returns `None`, otherwise -returns the value wrapped in a `Some`. - -**Signature** - -```ts -export declare const fromNullable: (nullableValue: A) => Option> -``` - -**Example** - -```ts -import * as O from "effect/Option" - -assert.deepStrictEqual(O.fromNullable(undefined), O.none()) -assert.deepStrictEqual(O.fromNullable(null), O.none()) -assert.deepStrictEqual(O.fromNullable(1), O.some(1)) -``` - -Added in v2.0.0 - -## getLeft - -Converts a `Either` to an `Option` discarding the value. - -**Signature** - -```ts -export declare const getLeft: (self: Either) => Option -``` - -**Example** - -```ts -import * as O from "effect/Option" -import * as E from "effect/Either" - -assert.deepStrictEqual(O.getLeft(E.right("ok")), O.none()) -assert.deepStrictEqual(O.getLeft(E.left("a")), O.some("a")) -``` - -Added in v2.0.0 - -## getOrThrow - -Extracts the value of an `Option` or throws if the `Option` is `None`. - -The thrown error is a default error. To configure the error thrown, see {@link getOrThrowWith}. - -**Signature** - -```ts -export declare const getOrThrow: (self: Option) => A -``` - -**Example** - -```ts -import * as O from "effect/Option" - -assert.deepStrictEqual(O.getOrThrow(O.some(1)), 1) -assert.throws(() => O.getOrThrow(O.none())) -``` - -Added in v2.0.0 - -## getOrThrowWith - -Extracts the value of an `Option` or throws if the `Option` is `None`. - -If a default error is sufficient for your use case and you don't need to configure the thrown error, see {@link getOrThrow}. - -**Signature** - -```ts -export declare const getOrThrowWith: { - (onNone: () => unknown): (self: Option) => A - (self: Option, onNone: () => unknown): A -} -``` - -**Example** - -```ts -import * as O from "effect/Option" - -assert.deepStrictEqual( - O.getOrThrowWith(O.some(1), () => new Error("Unexpected None")), - 1 -) -assert.throws(() => O.getOrThrowWith(O.none(), () => new Error("Unexpected None"))) -``` - -Added in v2.0.0 - -## getRight - -Converts a `Either` to an `Option` discarding the error. - -Alias of {@link fromEither}. - -**Signature** - -```ts -export declare const getRight: (self: Either) => Option -``` - -**Example** - -```ts -import * as O from "effect/Option" -import * as E from "effect/Either" - -assert.deepStrictEqual(O.getRight(E.right("ok")), O.some("ok")) -assert.deepStrictEqual(O.getRight(E.left("err")), O.none()) -``` - -Added in v2.0.0 - -## liftNullable - -This API is useful for lifting a function that returns `null` or `undefined` into the `Option` context. - -**Signature** - -```ts -export declare const liftNullable: ( - f: (...a: A) => B | null | undefined -) => (...a: A) => Option> -``` - -**Example** - -```ts -import * as O from "effect/Option" - -const parse = (s: string): number | undefined => { - const n = parseFloat(s) - return isNaN(n) ? undefined : n -} - -const parseOption = O.liftNullable(parse) - -assert.deepStrictEqual(parseOption("1"), O.some(1)) -assert.deepStrictEqual(parseOption("not a number"), O.none()) -``` - -Added in v2.0.0 - -## liftThrowable - -A utility function that lifts a function that throws exceptions into a function that returns an `Option`. - -This function is useful for any function that might throw an exception, allowing the developer to handle -the exception in a more functional way. - -**Signature** - -```ts -export declare const liftThrowable: (f: (...a: A) => B) => (...a: A) => Option -``` - -**Example** - -```ts -import * as O from "effect/Option" - -const parse = O.liftThrowable(JSON.parse) - -assert.deepStrictEqual(parse("1"), O.some(1)) -assert.deepStrictEqual(parse(""), O.none()) -``` - -Added in v2.0.0 - -## toArray - -Transforms an `Option` into an `Array`. -If the input is `None`, an empty array is returned. -If the input is `Some`, the value is wrapped in an array. - -**Signature** - -```ts -export declare const toArray: (self: Option) => A[] -``` - -**Example** - -```ts -import * as O from "effect/Option" - -assert.deepStrictEqual(O.toArray(O.some(1)), [1]) -assert.deepStrictEqual(O.toArray(O.none()), []) -``` - -Added in v2.0.0 - -## toRefinement - -Returns a type guard from a `Option` returning function. -This function ensures that a type guard definition is type-safe. - -**Signature** - -```ts -export declare const toRefinement: (f: (a: A) => Option) => (a: A) => a is B -``` - -**Example** - -```ts -import * as O from "effect/Option" - -const parsePositive = (n: number): O.Option => (n > 0 ? O.some(n) : O.none()) - -const isPositive = O.toRefinement(parsePositive) - -assert.deepStrictEqual(isPositive(1), true) -assert.deepStrictEqual(isPositive(-1), false) -``` - -Added in v2.0.0 - -# do notation - -## Do - -**Signature** - -```ts -export declare const Do: Option<{}> -``` - -Added in v2.0.0 - -## bind - -**Signature** - -```ts -export declare const bind: { - ( - name: Exclude, - f: (a: A) => Option - ): (self: Option) => Option<{ [K in N | keyof A]: K extends keyof A ? A[K] : B }> - ( - self: Option, - name: Exclude, - f: (a: A) => Option - ): Option<{ [K in N | keyof A]: K extends keyof A ? A[K] : B }> -} -``` - -Added in v2.0.0 - -## bindTo - -**Signature** - -```ts -export declare const bindTo: { - (name: N): (self: Option) => Option<{ [K in N]: A }> - (self: Option, name: N): Option<{ [K in N]: A }> -} -``` - -Added in v2.0.0 - -## let - -**Signature** - -```ts -export declare const let: { - ( - name: Exclude, - f: (a: A) => B - ): (self: Option) => Option<{ [K in N | keyof A]: K extends keyof A ? A[K] : B }> - ( - self: Option, - name: Exclude, - f: (a: A) => B - ): Option<{ [K in N | keyof A]: K extends keyof A ? A[K] : B }> -} -``` - -Added in v2.0.0 - -# elements - -## contains - -Returns a function that checks if an `Option` contains a given value using the default `Equivalence`. - -**Signature** - -```ts -export declare const contains: { (a: A): (self: Option) => boolean; (self: Option, a: A): boolean } -``` - -Added in v2.0.0 - -## containsWith - -Returns a function that checks if a `Option` contains a given value using a provided `isEquivalent` function. - -**Signature** - -```ts -export declare const containsWith: (isEquivalent: (self: A, that: A) => boolean) => { - (a: A): (self: Option) => boolean - (self: Option, a: A): boolean -} -``` - -**Example** - -```ts -import { some, none, containsWith } from "effect/Option" -import { Equivalence } from "effect/Number" -import { pipe } from "effect/Function" - -assert.deepStrictEqual(pipe(some(2), containsWith(Equivalence)(2)), true) -assert.deepStrictEqual(pipe(some(1), containsWith(Equivalence)(2)), false) -assert.deepStrictEqual(pipe(none(), containsWith(Equivalence)(2)), false) -``` - -Added in v2.0.0 - -# equivalence - -## getEquivalence - -**Signature** - -```ts -export declare const getEquivalence: (isEquivalent: Equivalence.Equivalence) => Equivalence.Equivalence> -``` - -**Example** - -```ts -import { none, some, getEquivalence } from "effect/Option" -import * as N from "effect/Number" - -const isEquivalent = getEquivalence(N.Equivalence) -assert.deepStrictEqual(isEquivalent(none(), none()), true) -assert.deepStrictEqual(isEquivalent(none(), some(1)), false) -assert.deepStrictEqual(isEquivalent(some(1), none()), false) -assert.deepStrictEqual(isEquivalent(some(1), some(2)), false) -assert.deepStrictEqual(isEquivalent(some(1), some(1)), true) -``` - -Added in v2.0.0 - -# error handling - -## firstSomeOf - -Given an `Iterable` collection of `Option`s, returns the first `Some` found in the collection. - -**Signature** - -```ts -export declare const firstSomeOf: (collection: Iterable>) => Option -``` - -**Example** - -```ts -import * as O from "effect/Option" - -assert.deepStrictEqual(O.firstSomeOf([O.none(), O.some(1), O.some(2)]), O.some(1)) -``` - -Added in v2.0.0 - -## orElse - -Returns the provided `Option` `that` if `self` is `None`, otherwise returns `self`. - -**Signature** - -```ts -export declare const orElse: { - (that: LazyArg>): (self: Option) => Option - (self: Option, that: LazyArg>): Option -} -``` - -**Example** - -```ts -import * as O from "effect/Option" -import { pipe } from "effect/Function" - -assert.deepStrictEqual( - pipe( - O.none(), - O.orElse(() => O.none()) - ), - O.none() -) -assert.deepStrictEqual( - pipe( - O.some("a"), - O.orElse(() => O.none()) - ), - O.some("a") -) -assert.deepStrictEqual( - pipe( - O.none(), - O.orElse(() => O.some("b")) - ), - O.some("b") -) -assert.deepStrictEqual( - pipe( - O.some("a"), - O.orElse(() => O.some("b")) - ), - O.some("a") -) -``` - -Added in v2.0.0 - -## orElseEither - -Similar to `orElse`, but instead of returning a simple union, it returns an `Either` object, -which contains information about which of the two `Option`s has been chosen. - -This is useful when it's important to know whether the value was retrieved from the first `Option` or the second option. - -**Signature** - -```ts -export declare const orElseEither: { - (that: LazyArg>): (self: Option) => Option> - (self: Option, that: LazyArg>): Option> -} -``` - -Added in v2.0.0 - -# filtering - -## filter - -Filters an `Option` using a predicate. If the predicate is not satisfied or the `Option` is `None` returns `None`. - -If you need to change the type of the `Option` in addition to filtering, see `filterMap`. - -**Signature** - -```ts -export declare const filter: { - (refinement: (a: A) => a is B): (self: Option) => Option - (predicate: (a: A) => boolean): (self: Option) => Option - (self: Option, refinement: (a: A) => a is B): Option - (self: Option, predicate: (a: A) => boolean): Option -} -``` - -**Example** - -```ts -import * as O from "effect/Option" - -// predicate -const isEven = (n: number) => n % 2 === 0 - -assert.deepStrictEqual(O.filter(O.none(), isEven), O.none()) -assert.deepStrictEqual(O.filter(O.some(3), isEven), O.none()) -assert.deepStrictEqual(O.filter(O.some(2), isEven), O.some(2)) - -// refinement -const isNumber = (v: unknown): v is number => typeof v === "number" - -assert.deepStrictEqual(O.filter(O.none(), isNumber), O.none()) -assert.deepStrictEqual(O.filter(O.some("hello"), isNumber), O.none()) -assert.deepStrictEqual(O.filter(O.some(2), isNumber), O.some(2)) -``` - -Added in v2.0.0 - -## filterMap - -Maps over the value of an `Option` and filters out `None`s. - -Useful when in addition to filtering you also want to change the type of the `Option`. - -**Signature** - -```ts -export declare const filterMap: { - (f: (a: A) => Option): (self: Option) => Option - (self: Option, f: (a: A) => Option): Option -} -``` - -**Example** - -```ts -import * as O from "effect/Option" - -const evenNumber = (n: number) => (n % 2 === 0 ? O.some(n) : O.none()) - -assert.deepStrictEqual(O.filterMap(O.none(), evenNumber), O.none()) -assert.deepStrictEqual(O.filterMap(O.some(3), evenNumber), O.none()) -assert.deepStrictEqual(O.filterMap(O.some(2), evenNumber), O.some(2)) -``` - -Added in v2.0.0 - -## partitionMap - -**Signature** - -```ts -export declare const partitionMap: { - (f: (a: A) => Either): (self: Option) => [Option, Option] - (self: Option, f: (a: A) => Either): [Option, Option] -} -``` - -Added in v2.0.0 - -# folding - -## reduceCompact - -Reduces an `Iterable` of `Option` to a single value of type `B`, elements that are `None` are ignored. - -**Signature** - -```ts -export declare const reduceCompact: { - (b: B, f: (b: B, a: A) => B): (self: Iterable>) => B - (self: Iterable>, b: B, f: (b: B, a: A) => B): B -} -``` - -**Example** - -```ts -import { some, none, reduceCompact } from "effect/Option" -import { pipe } from "effect/Function" - -const iterable = [some(1), none(), some(2), none()] -assert.deepStrictEqual( - pipe( - iterable, - reduceCompact(0, (b, a) => b + a) - ), - 3 -) -``` - -Added in v2.0.0 - -# generators - -## gen - -**Signature** - -```ts -export declare const gen: Gen.Gen> -``` - -Added in v2.0.0 - -# getters - -## getOrElse - -Returns the value of the `Option` if it is `Some`, otherwise returns `onNone` - -**Signature** - -```ts -export declare const getOrElse: { - (onNone: LazyArg): (self: Option) => B | A - (self: Option, onNone: LazyArg): A | B -} -``` - -**Example** - -```ts -import { some, none, getOrElse } from "effect/Option" -import { pipe } from "effect/Function" - -assert.deepStrictEqual( - pipe( - some(1), - getOrElse(() => 0) - ), - 1 -) -assert.deepStrictEqual( - pipe( - none(), - getOrElse(() => 0) - ), - 0 -) -``` - -Added in v2.0.0 - -## getOrNull - -Returns the value of the `Option` if it is a `Some`, otherwise returns `null`. - -**Signature** - -```ts -export declare const getOrNull: (self: Option) => A | null -``` - -**Example** - -```ts -import * as O from "effect/Option" - -assert.deepStrictEqual(O.getOrNull(O.some(1)), 1) -assert.deepStrictEqual(O.getOrNull(O.none()), null) -``` - -Added in v2.0.0 - -## getOrUndefined - -Returns the value of the `Option` if it is a `Some`, otherwise returns `undefined`. - -**Signature** - -```ts -export declare const getOrUndefined: (self: Option) => A | undefined -``` - -**Example** - -```ts -import * as O from "effect/Option" - -assert.deepStrictEqual(O.getOrUndefined(O.some(1)), 1) -assert.deepStrictEqual(O.getOrUndefined(O.none()), undefined) -``` - -Added in v2.0.0 - -# guards - -## isNone - -Determine if a `Option` is a `None`. - -**Signature** - -```ts -export declare const isNone: (self: Option) => self is None -``` - -**Example** - -```ts -import { some, none, isNone } from "effect/Option" - -assert.deepStrictEqual(isNone(some(1)), false) -assert.deepStrictEqual(isNone(none()), true) -``` - -Added in v2.0.0 - -## isOption - -Tests if a value is a `Option`. - -**Signature** - -```ts -export declare const isOption: (input: unknown) => input is Option -``` - -**Example** - -```ts -import { some, none, isOption } from "effect/Option" - -assert.deepStrictEqual(isOption(some(1)), true) -assert.deepStrictEqual(isOption(none()), true) -assert.deepStrictEqual(isOption({}), false) -``` - -Added in v2.0.0 - -## isSome - -Determine if a `Option` is a `Some`. - -**Signature** - -```ts -export declare const isSome: (self: Option) => self is Some -``` - -**Example** - -```ts -import { some, none, isSome } from "effect/Option" - -assert.deepStrictEqual(isSome(some(1)), true) -assert.deepStrictEqual(isSome(none()), false) -``` - -Added in v2.0.0 - -# lifting - -## lift2 - -Lifts a binary function into `Option`. - -**Signature** - -```ts -export declare const lift2: ( - f: (a: A, b: B) => C -) => { (that: Option): (self: Option) => Option; (self: Option, that: Option): Option } -``` - -Added in v2.0.0 - -## liftPredicate - -Transforms a `Predicate` function into a `Some` of the input value if the predicate returns `true` or `None` -if the predicate returns `false`. - -**Signature** - -```ts -export declare const liftPredicate: { - (refinement: Refinement): (c: C) => Option - (predicate: Predicate): (b: B) => Option -} -``` - -**Example** - -```ts -import * as O from "effect/Option" - -const getOption = O.liftPredicate((n: number) => n >= 0) - -assert.deepStrictEqual(getOption(-1), O.none()) -assert.deepStrictEqual(getOption(1), O.some(1)) -``` - -Added in v2.0.0 - -# models - -## None (interface) - -**Signature** - -```ts -export interface None extends Data.Case, Pipeable, Inspectable { - readonly _tag: "None" - readonly _op: "None" - readonly [TypeId]: { - readonly _A: (_: never) => A - } - [Unify.typeSymbol]?: unknown - [Unify.unifySymbol]?: OptionUnify - [Unify.ignoreSymbol]?: OptionUnifyIgnore -} -``` - -Added in v2.0.0 - -## Option (type alias) - -**Signature** - -```ts -export type Option = None | Some -``` - -Added in v2.0.0 - -## OptionUnify (interface) - -**Signature** - -```ts -export interface OptionUnify { - Option?: () => A[Unify.typeSymbol] extends Option | infer _ ? Option : never -} -``` - -Added in v2.0.0 - -## OptionUnifyIgnore (interface) - -**Signature** - -```ts -export interface OptionUnifyIgnore {} -``` - -Added in v2.0.0 - -## Some (interface) - -**Signature** - -```ts -export interface Some extends Data.Case, Pipeable, Inspectable { - readonly _tag: "Some" - readonly _op: "Some" - readonly value: A - readonly [TypeId]: { - readonly _A: (_: never) => A - } - [Unify.typeSymbol]?: unknown - [Unify.unifySymbol]?: OptionUnify - [Unify.ignoreSymbol]?: OptionUnifyIgnore -} -``` - -Added in v2.0.0 - -# pattern matching - -## match - -Matches the given `Option` and returns either the provided `onNone` value or the result of the provided `onSome` -function when passed the `Option`'s value. - -**Signature** - -```ts -export declare const match: { - (options: { readonly onNone: LazyArg; readonly onSome: (a: A) => C }): (self: Option) => B | C - (self: Option, options: { readonly onNone: LazyArg; readonly onSome: (a: A) => C }): B | C -} -``` - -**Example** - -```ts -import { some, none, match } from "effect/Option" -import { pipe } from "effect/Function" - -assert.deepStrictEqual( - pipe(some(1), match({ onNone: () => "a none", onSome: (a) => `a some containing ${a}` })), - "a some containing 1" -) - -assert.deepStrictEqual( - pipe(none(), match({ onNone: () => "a none", onSome: (a) => `a some containing ${a}` })), - "a none" -) -``` - -Added in v2.0.0 - -# sorting - -## getOrder - -The `Order` instance allows `Option` values to be compared with -`compare`, whenever there is an `Order` instance for -the type the `Option` contains. - -`None` is considered to be less than any `Some` value. - -**Signature** - -```ts -export declare const getOrder: (O: Order) => Order> -``` - -**Example** - -```ts -import { none, some, getOrder } from "effect/Option" -import * as N from "effect/Number" -import { pipe } from "effect/Function" - -const O = getOrder(N.Order) -assert.deepStrictEqual(O(none(), none()), 0) -assert.deepStrictEqual(O(none(), some(1)), -1) -assert.deepStrictEqual(O(some(1), none()), 1) -assert.deepStrictEqual(O(some(1), some(2)), -1) -assert.deepStrictEqual(O(some(1), some(1)), 0) -``` - -Added in v2.0.0 - -# symbols - -## TypeId - -**Signature** - -```ts -export declare const TypeId: typeof TypeId -``` - -Added in v2.0.0 - -## TypeId (type alias) - -**Signature** - -```ts -export type TypeId = typeof TypeId -``` - -Added in v2.0.0 - -# transforming - -## as - -Maps the `Some` value of this `Option` to the specified constant value. - -**Signature** - -```ts -export declare const as: (b: B) => <_>(self: Option<_>) => Option -``` - -Added in v2.0.0 - -## asUnit - -Maps the `Some` value of this `Option` to the `void` constant value. - -This is useful when the value of the `Option` is not needed, but the presence or absence of the value is important. - -**Signature** - -```ts -export declare const asUnit: <_>(self: Option<_>) => Option -``` - -Added in v2.0.0 - -## composeK - -**Signature** - -```ts -export declare const composeK: { - (bfc: (b: B) => Option): (afb: (a: A) => Option) => (a: A) => Option - (afb: (a: A) => Option, bfc: (b: B) => Option): (a: A) => Option -} -``` - -Added in v2.0.0 - -## flatMap - -Applies a function to the value of an `Option` and flattens the result, if the input is `Some`. - -**Signature** - -```ts -export declare const flatMap: { - (f: (a: A) => Option): (self: Option) => Option - (self: Option, f: (a: A) => Option): Option -} -``` - -Added in v2.0.0 - -## flatMapNullable - -This is `flatMap` + `fromNullable`, useful when working with optional values. - -**Signature** - -```ts -export declare const flatMapNullable: { - (f: (a: A) => B | null | undefined): (self: Option) => Option> - (self: Option, f: (a: A) => B | null | undefined): Option> -} -``` - -**Example** - -```ts -import { some, none, flatMapNullable } from "effect/Option" -import { pipe } from "effect/Function" - -interface Employee { - company?: { - address?: { - street?: { - name?: string - } - } - } -} - -const employee1: Employee = { company: { address: { street: { name: "high street" } } } } - -assert.deepStrictEqual( - pipe( - some(employee1), - flatMapNullable((employee) => employee.company?.address?.street?.name) - ), - some("high street") -) - -const employee2: Employee = { company: { address: { street: {} } } } - -assert.deepStrictEqual( - pipe( - some(employee2), - flatMapNullable((employee) => employee.company?.address?.street?.name) - ), - none() -) -``` - -Added in v2.0.0 - -## flatten - -**Signature** - -```ts -export declare const flatten: (self: Option>) => Option -``` - -Added in v2.0.0 - -## map - -Maps the `Some` side of an `Option` value to a new `Option` value. - -**Signature** - -```ts -export declare const map: { - (f: (a: A) => B): (self: Option) => Option - (self: Option, f: (a: A) => B): Option -} -``` - -Added in v2.0.0 - -## tap - -Applies the provided function `f` to the value of the `Option` if it is `Some` and returns the original `Option` -unless `f` returns `None`, in which case it returns `None`. - -This function is useful for performing additional computations on the value of the input `Option` without affecting its value. - -**Signature** - -```ts -export declare const tap: { - (f: (a: A) => Option<_>): (self: Option) => Option - (self: Option, f: (a: A) => Option<_>): Option -} -``` - -**Example** - -```ts -import * as O from "effect/Option" - -const getInteger = (n: number) => (Number.isInteger(n) ? O.some(n) : O.none()) - -assert.deepStrictEqual(O.tap(O.none(), getInteger), O.none()) -assert.deepStrictEqual(O.tap(O.some(1), getInteger), O.some(1)) -assert.deepStrictEqual(O.tap(O.some(1.14), getInteger), O.none()) -``` - -Added in v2.0.0 - -## zipLeft - -Sequences the specified `that` `Option` but ignores its value. - -It is useful when we want to chain multiple operations, but only care about the result of `self`. - -**Signature** - -```ts -export declare const zipLeft: { - <_>(that: Option<_>): (self: Option) => Option - (self: Option, that: Option<_>): Option -} -``` - -Added in v2.0.0 - -## zipRight - -**Signature** - -```ts -export declare const zipRight: { - (that: Option): <_>(self: Option<_>) => Option - <_, B>(self: Option<_>, that: Option): Option -} -``` - -Added in v2.0.0 - -# type lambdas - -## OptionTypeLambda (interface) - -**Signature** - -```ts -export interface OptionTypeLambda extends TypeLambda { - readonly type: Option -} -``` - -Added in v2.0.0 - -# utils - -## exists - -Check if a value in an `Option` type meets a certain predicate. - -**Signature** - -```ts -export declare const exists: { - (predicate: Predicate): (self: Option) => boolean - (self: Option, predicate: Predicate): boolean -} -``` - -**Example** - -```ts -import { some, none, exists } from "effect/Option" -import { pipe } from "effect/Function" - -const isEven = (n: number) => n % 2 === 0 - -assert.deepStrictEqual(pipe(some(2), exists(isEven)), true) -assert.deepStrictEqual(pipe(some(1), exists(isEven)), false) -assert.deepStrictEqual(pipe(none(), exists(isEven)), false) -``` - -Added in v2.0.0 - -## unit - -**Signature** - -```ts -export declare const unit: Option -``` - -Added in v2.0.0 diff --git a/docs/modules/Order.ts.md b/docs/modules/Order.ts.md deleted file mode 100644 index ed34131b7..000000000 --- a/docs/modules/Order.ts.md +++ /dev/null @@ -1,428 +0,0 @@ ---- -title: Order.ts -nav_order: 74 -parent: Modules ---- - -## Order overview - -Added in v2.0.0 - ---- - -

Table of contents

- -- [combinators](#combinators) - - [array](#array) - - [mapInput](#mapinput) - - [struct](#struct) - - [tuple](#tuple) -- [combining](#combining) - - [all](#all) - - [combine](#combine) - - [combineAll](#combineall) - - [combineMany](#combinemany) - - [product](#product) - - [productMany](#productmany) -- [constructors](#constructors) - - [make](#make) -- [instances](#instances) - - [Date](#date) - - [bigint](#bigint) - - [boolean](#boolean) - - [number](#number) - - [string](#string) -- [type class](#type-class) - - [Order (interface)](#order-interface) -- [type lambdas](#type-lambdas) - - [OrderTypeLambda (interface)](#ordertypelambda-interface) -- [utils](#utils) - - [between](#between) - - [clamp](#clamp) - - [empty](#empty) - - [greaterThan](#greaterthan) - - [greaterThanOrEqualTo](#greaterthanorequalto) - - [lessThan](#lessthan) - - [lessThanOrEqualTo](#lessthanorequalto) - - [max](#max) - - [min](#min) - - [reverse](#reverse) - ---- - -# combinators - -## array - -This function creates and returns a new `Order` for an array of values based on a given `Order` for the elements of the array. -The returned `Order` compares two arrays by applying the given `Order` to each element in the arrays. -If all elements are equal, the arrays are then compared based on their length. -It is useful when you need to compare two arrays of the same type and you have a specific way of comparing each element of the array. - -**Signature** - -```ts -export declare const array:
(O: Order) => Order -``` - -Added in v2.0.0 - -## mapInput - -**Signature** - -```ts -export declare const mapInput: { - (f: (b: B) => A): (self: Order) => Order - (self: Order, f: (b: B) => A): Order -} -``` - -Added in v2.0.0 - -## struct - -This function creates and returns a new `Order` for a struct of values based on the given `Order`s -for each property in the struct. - -**Signature** - -```ts -export declare const struct: }>( - fields: R -) => Order<{ [K in keyof R]: [R[K]] extends [Order] ? A : never }> -``` - -Added in v2.0.0 - -## tuple - -Similar to `Promise.all` but operates on `Order`s. - -``` -[Order, Order, ...] -> Order<[A, B, ...]> -``` - -This function creates and returns a new `Order` for a tuple of values based on the given `Order`s for each element in the tuple. -The returned `Order` compares two tuples of the same type by applying the corresponding `Order` to each element in the tuple. -It is useful when you need to compare two tuples of the same type and you have a specific way of comparing each element -of the tuple. - -**Signature** - -```ts -export declare const tuple: []>( - ...elements: T -) => Order] ? A : never }>> -``` - -Added in v2.0.0 - -# combining - -## all - -**Signature** - -```ts -export declare const all: (collection: Iterable>) => Order -``` - -Added in v2.0.0 - -## combine - -**Signature** - -```ts -export declare const combine: { - (that: Order): (self: Order) => Order - (self: Order, that: Order): Order -} -``` - -Added in v2.0.0 - -## combineAll - -**Signature** - -```ts -export declare const combineAll: (collection: Iterable>) => Order -``` - -Added in v2.0.0 - -## combineMany - -**Signature** - -```ts -export declare const combineMany: { - (collection: Iterable>): (self: Order) => Order - (self: Order, collection: Iterable>): Order -} -``` - -Added in v2.0.0 - -## product - -**Signature** - -```ts -export declare const product: { - (that: Order): (self: Order) => Order - (self: Order, that: Order): Order -} -``` - -Added in v2.0.0 - -## productMany - -**Signature** - -```ts -export declare const productMany: { - (collection: Iterable>): (self: Order) => Order - (self: Order, collection: Iterable>): Order -} -``` - -Added in v2.0.0 - -# constructors - -## make - -**Signature** - -```ts -export declare const make: (compare: (self: A, that: A) => -1 | 0 | 1) => Order -``` - -Added in v2.0.0 - -# instances - -## Date - -**Signature** - -```ts -export declare const Date: Order -``` - -Added in v2.0.0 - -## bigint - -**Signature** - -```ts -export declare const bigint: Order -``` - -Added in v2.0.0 - -## boolean - -**Signature** - -```ts -export declare const boolean: Order -``` - -Added in v2.0.0 - -## number - -**Signature** - -```ts -export declare const number: Order -``` - -Added in v2.0.0 - -## string - -**Signature** - -```ts -export declare const string: Order -``` - -Added in v2.0.0 - -# type class - -## Order (interface) - -**Signature** - -```ts -export interface Order { - (self: A, that: A): -1 | 0 | 1 -} -``` - -Added in v2.0.0 - -# type lambdas - -## OrderTypeLambda (interface) - -**Signature** - -```ts -export interface OrderTypeLambda extends TypeLambda { - readonly type: Order -} -``` - -Added in v2.0.0 - -# utils - -## between - -Test whether a value is between a minimum and a maximum (inclusive). - -**Signature** - -```ts -export declare const between: (O: Order) => { - (options: { minimum: A; maximum: A }): (self: A) => boolean - (self: A, options: { minimum: A; maximum: A }): boolean -} -``` - -Added in v2.0.0 - -## clamp - -Clamp a value between a minimum and a maximum. - -**Signature** - -```ts -export declare const clamp: (O: Order) => { - (options: { minimum: A; maximum: A }): (self: A) => A - (self: A, options: { minimum: A; maximum: A }): A -} -``` - -**Example** - -```ts -import * as Order from "effect/Order" -import * as Number from "effect/Number" - -const clamp = Order.clamp(Number.Order)({ minimum: 1, maximum: 5 }) - -assert.equal(clamp(3), 3) -assert.equal(clamp(0), 1) -assert.equal(clamp(6), 5) -``` - -Added in v2.0.0 - -## empty - -**Signature** - -```ts -export declare const empty: () => Order -``` - -Added in v2.0.0 - -## greaterThan - -Test whether one value is _strictly greater than_ another. - -**Signature** - -```ts -export declare const greaterThan: (O: Order) => { (that: A): (self: A) => boolean; (self: A, that: A): boolean } -``` - -Added in v2.0.0 - -## greaterThanOrEqualTo - -Test whether one value is _non-strictly greater than_ another. - -**Signature** - -```ts -export declare const greaterThanOrEqualTo: (O: Order) => { - (that: A): (self: A) => boolean - (self: A, that: A): boolean -} -``` - -Added in v2.0.0 - -## lessThan - -Test whether one value is _strictly less than_ another. - -**Signature** - -```ts -export declare const lessThan: (O: Order) => { (that: A): (self: A) => boolean; (self: A, that: A): boolean } -``` - -Added in v2.0.0 - -## lessThanOrEqualTo - -Test whether one value is _non-strictly less than_ another. - -**Signature** - -```ts -export declare const lessThanOrEqualTo: (O: Order) => { - (that: A): (self: A) => boolean - (self: A, that: A): boolean -} -``` - -Added in v2.0.0 - -## max - -Take the maximum of two values. If they are considered equal, the first argument is chosen. - -**Signature** - -```ts -export declare const max: (O: Order) => { (that: A): (self: A) => A; (self: A, that: A): A } -``` - -Added in v2.0.0 - -## min - -Take the minimum of two values. If they are considered equal, the first argument is chosen. - -**Signature** - -```ts -export declare const min: (O: Order) => { (that: A): (self: A) => A; (self: A, that: A): A } -``` - -Added in v2.0.0 - -## reverse - -**Signature** - -```ts -export declare const reverse: (O: Order) => Order -``` - -Added in v2.0.0 diff --git a/docs/modules/Ordering.ts.md b/docs/modules/Ordering.ts.md deleted file mode 100644 index c6e32998d..000000000 --- a/docs/modules/Ordering.ts.md +++ /dev/null @@ -1,141 +0,0 @@ ---- -title: Ordering.ts -nav_order: 75 -parent: Modules ---- - -## Ordering overview - -Added in v2.0.0 - ---- - -

Table of contents

- -- [combining](#combining) - - [combine](#combine) - - [combineAll](#combineall) - - [combineMany](#combinemany) -- [model](#model) - - [Ordering (type alias)](#ordering-type-alias) -- [pattern matching](#pattern-matching) - - [match](#match) -- [utils](#utils) - - [reverse](#reverse) - ---- - -# combining - -## combine - -**Signature** - -```ts -export declare const combine: { - (that: Ordering): (self: Ordering) => Ordering - (self: Ordering, that: Ordering): Ordering -} -``` - -Added in v2.0.0 - -## combineAll - -**Signature** - -```ts -export declare const combineAll: (collection: Iterable) => Ordering -``` - -Added in v2.0.0 - -## combineMany - -**Signature** - -```ts -export declare const combineMany: { - (collection: Iterable): (self: Ordering) => Ordering - (self: Ordering, collection: Iterable): Ordering -} -``` - -Added in v2.0.0 - -# model - -## Ordering (type alias) - -**Signature** - -```ts -export type Ordering = -1 | 0 | 1 -``` - -Added in v2.0.0 - -# pattern matching - -## match - -Depending on the `Ordering` parameter given to it, returns a value produced by one of the 3 functions provided as parameters. - -**Signature** - -```ts -export declare const match: { - (options: { - readonly onLessThan: LazyArg
- readonly onEqual: LazyArg - readonly onGreaterThan: LazyArg - }): (self: Ordering) => A | B | C - ( - o: Ordering, - options: { readonly onLessThan: LazyArg; readonly onEqual: LazyArg; readonly onGreaterThan: LazyArg } - ): A | B | C -} -``` - -**Example** - -```ts -import { match } from "effect/Ordering" -import { constant } from "effect/Function" - -const toMessage = match({ - onLessThan: constant("less than"), - onEqual: constant("equal"), - onGreaterThan: constant("greater than") -}) - -assert.deepStrictEqual(toMessage(-1), "less than") -assert.deepStrictEqual(toMessage(0), "equal") -assert.deepStrictEqual(toMessage(1), "greater than") -``` - -Added in v2.0.0 - -# utils - -## reverse - -Inverts the ordering of the input `Ordering`. - -**Signature** - -```ts -export declare const reverse: (o: Ordering) => Ordering -``` - -**Example** - -```ts -import { reverse } from "effect/Ordering" - -assert.deepStrictEqual(reverse(1), -1) -assert.deepStrictEqual(reverse(-1), 1) -assert.deepStrictEqual(reverse(0), 0) -``` - -Added in v2.0.0 diff --git a/docs/modules/Pipeable.ts.md b/docs/modules/Pipeable.ts.md deleted file mode 100644 index ee174e7c3..000000000 --- a/docs/modules/Pipeable.ts.md +++ /dev/null @@ -1,315 +0,0 @@ ---- -title: Pipeable.ts -nav_order: 76 -parent: Modules ---- - -## Pipeable overview - -Added in v2.0.0 - ---- - -

Table of contents

- -- [models](#models) - - [Pipeable (interface)](#pipeable-interface) -- [utils](#utils) - - [pipeArguments](#pipearguments) - ---- - -# models - -## Pipeable (interface) - -**Signature** - -```ts -export interface Pipeable { - readonly pipe: { - (this: A, ab: (_: A) => B): B - (this: A, ab: (_: A) => B, bc: (_: B) => C): C - (this: A, ab: (_: A) => B, bc: (_: B) => C, cd: (_: C) => D): D - (this: A, ab: (_: A) => B, bc: (_: B) => C, cd: (_: C) => D, de: (_: D) => E): E - (this: A, ab: (_: A) => B, bc: (_: B) => C, cd: (_: C) => D, de: (_: D) => E, ef: (_: E) => F): F - ( - this: A, - ab: (_: A) => B, - bc: (_: B) => C, - cd: (_: C) => D, - de: (_: D) => E, - ef: (_: E) => F, - fg: (_: F) => G - ): G - ( - this: A, - ab: (_: A) => B, - bc: (_: B) => C, - cd: (_: C) => D, - de: (_: D) => E, - ef: (_: E) => F, - fg: (_: F) => G, - gh: (_: G) => H - ): H - ( - this: A, - ab: (_: A) => B, - bc: (_: B) => C, - cd: (_: C) => D, - de: (_: D) => E, - ef: (_: E) => F, - fg: (_: F) => G, - gh: (_: G) => H, - hi: (_: H) => I - ): I - ( - this: A, - ab: (_: A) => B, - bc: (_: B) => C, - cd: (_: C) => D, - de: (_: D) => E, - ef: (_: E) => F, - fg: (_: F) => G, - gh: (_: G) => H, - hi: (_: H) => I, - ij: (_: I) => J - ): J - ( - this: A, - ab: (_: A) => B, - bc: (_: B) => C, - cd: (_: C) => D, - de: (_: D) => E, - ef: (_: E) => F, - fg: (_: F) => G, - gh: (_: G) => H, - hi: (_: H) => I, - ij: (_: I) => J, - jk: (_: J) => K - ): K - ( - this: A, - ab: (_: A) => B, - bc: (_: B) => C, - cd: (_: C) => D, - de: (_: D) => E, - ef: (_: E) => F, - fg: (_: F) => G, - gh: (_: G) => H, - hi: (_: H) => I, - ij: (_: I) => J, - jk: (_: J) => K, - kl: (_: K) => L - ): L - ( - this: A, - ab: (_: A) => B, - bc: (_: B) => C, - cd: (_: C) => D, - de: (_: D) => E, - ef: (_: E) => F, - fg: (_: F) => G, - gh: (_: G) => H, - hi: (_: H) => I, - ij: (_: I) => J, - jk: (_: J) => K, - kl: (_: K) => L, - lm: (_: L) => M - ): M - ( - this: A, - ab: (_: A) => B, - bc: (_: B) => C, - cd: (_: C) => D, - de: (_: D) => E, - ef: (_: E) => F, - fg: (_: F) => G, - gh: (_: G) => H, - hi: (_: H) => I, - ij: (_: I) => J, - jk: (_: J) => K, - kl: (_: K) => L, - lm: (_: L) => M, - mn: (_: M) => N - ): N - ( - this: A, - ab: (_: A) => B, - bc: (_: B) => C, - cd: (_: C) => D, - de: (_: D) => E, - ef: (_: E) => F, - fg: (_: F) => G, - gh: (_: G) => H, - hi: (_: H) => I, - ij: (_: I) => J, - jk: (_: J) => K, - kl: (_: K) => L, - lm: (_: L) => M, - mn: (_: M) => N, - no: (_: N) => O - ): O - ( - this: A, - ab: (_: A) => B, - bc: (_: B) => C, - cd: (_: C) => D, - de: (_: D) => E, - ef: (_: E) => F, - fg: (_: F) => G, - gh: (_: G) => H, - hi: (_: H) => I, - ij: (_: I) => J, - jk: (_: J) => K, - kl: (_: K) => L, - lm: (_: L) => M, - mn: (_: M) => N, - no: (_: N) => O, - op: (_: O) => P - ): P - ( - this: A, - ab: (_: A) => B, - bc: (_: B) => C, - cd: (_: C) => D, - de: (_: D) => E, - ef: (_: E) => F, - fg: (_: F) => G, - gh: (_: G) => H, - hi: (_: H) => I, - ij: (_: I) => J, - jk: (_: J) => K, - kl: (_: K) => L, - lm: (_: L) => M, - mn: (_: M) => N, - no: (_: N) => O, - op: (_: O) => P, - pq: (_: P) => Q - ): Q - ( - this: A, - ab: (_: A) => B, - bc: (_: B) => C, - cd: (_: C) => D, - de: (_: D) => E, - ef: (_: E) => F, - fg: (_: F) => G, - gh: (_: G) => H, - hi: (_: H) => I, - ij: (_: I) => J, - jk: (_: J) => K, - kl: (_: K) => L, - lm: (_: L) => M, - mn: (_: M) => N, - no: (_: N) => O, - op: (_: O) => P, - pq: (_: P) => Q, - qr: (_: Q) => R - ): R - ( - this: A, - ab: (_: A) => B, - bc: (_: B) => C, - cd: (_: C) => D, - de: (_: D) => E, - ef: (_: E) => F, - fg: (_: F) => G, - gh: (_: G) => H, - hi: (_: H) => I, - ij: (_: I) => J, - jk: (_: J) => K, - kl: (_: K) => L, - lm: (_: L) => M, - mn: (_: M) => N, - no: (_: N) => O, - op: (_: O) => P, - pq: (_: P) => Q, - qr: (_: Q) => R, - rs: (_: R) => S - ): S - ( - this: A, - ab: (_: A) => B, - bc: (_: B) => C, - cd: (_: C) => D, - de: (_: D) => E, - ef: (_: E) => F, - fg: (_: F) => G, - gh: (_: G) => H, - hi: (_: H) => I, - ij: (_: I) => J, - jk: (_: J) => K, - kl: (_: K) => L, - lm: (_: L) => M, - mn: (_: M) => N, - no: (_: N) => O, - op: (_: O) => P, - pq: (_: P) => Q, - qr: (_: Q) => R, - rs: (_: R) => S, - st: (_: S) => T - ): T - ( - this: A, - ab: (_: A) => B, - bc: (_: B) => C, - cd: (_: C) => D, - de: (_: D) => E, - ef: (_: E) => F, - fg: (_: F) => G, - gh: (_: G) => H, - hi: (_: H) => I, - ij: (_: I) => J, - jk: (_: J) => K, - kl: (_: K) => L, - lm: (_: L) => M, - mn: (_: M) => N, - no: (_: N) => O, - op: (_: O) => P, - pq: (_: P) => Q, - qr: (_: Q) => R, - rs: (_: R) => S, - st: (_: S) => T, - tu: (_: T) => U - ): U - ( - this: A, - ab: (_: A) => B, - bc: (_: B) => C, - cd: (_: C) => D, - de: (_: D) => E, - ef: (_: E) => F, - fg: (_: F) => G, - gh: (_: G) => H, - hi: (_: H) => I, - ij: (_: I) => J, - jk: (_: J) => K, - kl: (_: K) => L, - lm: (_: L) => M, - mn: (_: M) => N, - no: (_: N) => O, - op: (_: O) => P, - pq: (_: P) => Q, - qr: (_: Q) => R, - rs: (_: R) => S, - st: (_: S) => T, - tu: (_: T) => U - ): U - } -} -``` - -Added in v2.0.0 - -# utils - -## pipeArguments - -**Signature** - -```ts -export declare const pipeArguments:
(self: A, args: IArguments) => unknown -``` - -Added in v2.0.0 diff --git a/docs/modules/Pool.ts.md b/docs/modules/Pool.ts.md deleted file mode 100644 index 80007ac4a..000000000 --- a/docs/modules/Pool.ts.md +++ /dev/null @@ -1,219 +0,0 @@ ---- -title: Pool.ts -nav_order: 77 -parent: Modules ---- - -## Pool overview - -Added in v2.0.0 - ---- - -

Table of contents

- -- [combinators](#combinators) - - [invalidate](#invalidate) -- [constructors](#constructors) - - [make](#make) - - [makeWithTTL](#makewithttl) -- [getters](#getters) - - [get](#get) -- [models](#models) - - [Pool (interface)](#pool-interface) -- [refinements](#refinements) - - [isPool](#ispool) -- [symbols](#symbols) - - [PoolTypeId](#pooltypeid) - - [PoolTypeId (type alias)](#pooltypeid-type-alias) -- [utils](#utils) - - [Pool (namespace)](#pool-namespace) - - [Variance (interface)](#variance-interface) - ---- - -# combinators - -## invalidate - -Invalidates the specified item. This will cause the pool to eventually -reallocate the item, although this reallocation may occur lazily rather -than eagerly. - -**Signature** - -```ts -export declare const invalidate: { -
(value: A): (self: Pool) => Effect.Effect - (self: Pool, value: A): Effect.Effect -} -``` - -Added in v2.0.0 - -# constructors - -## make - -Makes a new pool of the specified fixed size. The pool is returned in a -`Scope`, which governs the lifetime of the pool. When the pool is shutdown -because the `Scope` is closed, the individual items allocated by the pool -will be released in some unspecified order. - -**Signature** - -```ts -export declare const make: (options: { - readonly acquire: Effect.Effect - readonly size: number -}) => Effect.Effect> -``` - -Added in v2.0.0 - -## makeWithTTL - -Makes a new pool with the specified minimum and maximum sizes and time to -live before a pool whose excess items are not being used will be shrunk -down to the minimum size. The pool is returned in a `Scope`, which governs -the lifetime of the pool. When the pool is shutdown because the `Scope` is -used, the individual items allocated by the pool will be released in some -unspecified order. - -```ts -import * as Duration from "./Duration" -import * as Effect from "effect/Effect" -import * as Pool from "effect/Pool" -import * as Scope from "effect/Scope" -import { pipe } from "./Function" - -Effect.scoped( - pipe( - Pool.make(acquireDbConnection, 10, 20, Duration.seconds(60)), - Effect.flatMap((pool) => - Effect.scoped( - pipe( - pool.get(), - Effect.flatMap((connection) => useConnection(connection)) - ) - ) - ) - ) -) -``` - -**Signature** - -```ts -export declare const makeWithTTL: (options: { - readonly acquire: Effect.Effect - readonly min: number - readonly max: number - readonly timeToLive: Duration.DurationInput -}) => Effect.Effect> -``` - -Added in v2.0.0 - -# getters - -## get - -Retrieves an item from the pool in a scoped effect. Note that if -acquisition fails, then the returned effect will fail for that same reason. -Retrying a failed acquisition attempt will repeat the acquisition attempt. - -**Signature** - -```ts -export declare const get: (self: Pool) => Effect.Effect -``` - -Added in v2.0.0 - -# models - -## Pool (interface) - -A `Pool` is a pool of items of type `A`, each of which may be -associated with the acquisition and release of resources. An attempt to get -an item `A` from a pool may fail with an error of type `E`. - -**Signature** - -```ts -export interface Pool extends Data.Case, Pool.Variance, Pipeable { - /** - * Retrieves an item from the pool in a scoped effect. Note that if - * acquisition fails, then the returned effect will fail for that same reason. - * Retrying a failed acquisition attempt will repeat the acquisition attempt. - */ - readonly get: Effect.Effect - - /** - * Invalidates the specified item. This will cause the pool to eventually - * reallocate the item, although this reallocation may occur lazily rather - * than eagerly. - */ - readonly invalidate: (item: A) => Effect.Effect -} -``` - -Added in v2.0.0 - -# refinements - -## isPool - -Returns `true` if the specified value is a `Pool`, `false` otherwise. - -**Signature** - -```ts -export declare const isPool: (u: unknown) => u is Pool -``` - -Added in v2.0.0 - -# symbols - -## PoolTypeId - -**Signature** - -```ts -export declare const PoolTypeId: typeof PoolTypeId -``` - -Added in v2.0.0 - -## PoolTypeId (type alias) - -**Signature** - -```ts -export type PoolTypeId = typeof PoolTypeId -``` - -Added in v2.0.0 - -# utils - -## Pool (namespace) - -Added in v2.0.0 - -### Variance (interface) - -**Signature** - -```ts -export interface Variance { - readonly [PoolTypeId]: { - readonly _E: (_: never) => E - readonly _A: (_: never) => A - } -} -``` - -Added in v2.0.0 diff --git a/docs/modules/Predicate.ts.md b/docs/modules/Predicate.ts.md deleted file mode 100644 index a0178a7f9..000000000 --- a/docs/modules/Predicate.ts.md +++ /dev/null @@ -1,928 +0,0 @@ ---- -title: Predicate.ts -nav_order: 78 -parent: Modules ---- - -## Predicate overview - -Added in v2.0.0 - ---- - -

Table of contents

- -- [combinators](#combinators) - - [and](#and) - - [eqv](#eqv) - - [implies](#implies) - - [mapInput](#mapinput) - - [nand](#nand) - - [nor](#nor) - - [not](#not) - - [or](#or) - - [xor](#xor) -- [combining](#combining) - - [all](#all) - - [product](#product) - - [productMany](#productmany) -- [elements](#elements) - - [every](#every) - - [some](#some) -- [guards](#guards) - - [hasProperty](#hasproperty) - - [isBigInt](#isbigint) - - [isBoolean](#isboolean) - - [isDate](#isdate) - - [isError](#iserror) - - [isFunction](#isfunction) - - [isIterable](#isiterable) - - [isNever](#isnever) - - [isNotNull](#isnotnull) - - [isNotNullable](#isnotnullable) - - [isNotUndefined](#isnotundefined) - - [isNull](#isnull) - - [isNullable](#isnullable) - - [isNumber](#isnumber) - - [isObject](#isobject) - - [isReadonlyRecord](#isreadonlyrecord) - - [isRecord](#isrecord) - - [isString](#isstring) - - [isSymbol](#issymbol) - - [isTagged](#istagged) - - [isUint8Array](#isuint8array) - - [isUndefined](#isundefined) - - [isUnknown](#isunknown) -- [models](#models) - - [Predicate (interface)](#predicate-interface) - - [Refinement (interface)](#refinement-interface) -- [type lambdas](#type-lambdas) - - [PredicateTypeLambda (interface)](#predicatetypelambda-interface) -- [utils](#utils) - - [compose](#compose) - - [struct](#struct) - - [tuple](#tuple) - ---- - -# combinators - -## and - -Combines two predicates into a new predicate that returns `true` if both of the predicates returns `true`. - -**Signature** - -```ts -export declare const and: { - (that: Refinement): (self: Refinement) => Refinement - (self: Refinement, that: Refinement): Refinement -
(that: Predicate): (self: Predicate) => Predicate - (self: Predicate, that: Predicate): Predicate -} -``` - -**Example** - -```ts -import * as P from "effect/Predicate" - -const minLength = (n: number) => (s: string) => s.length >= n -const maxLength = (n: number) => (s: string) => s.length <= n - -const length = (n: number) => P.and(minLength(n), maxLength(n)) - -assert.deepStrictEqual(length(2)("aa"), true) -assert.deepStrictEqual(length(2)("a"), false) -assert.deepStrictEqual(length(2)("aaa"), false) -``` - -Added in v2.0.0 - -## eqv - -**Signature** - -```ts -export declare const eqv: { - (that: Predicate): (self: Predicate) => Predicate - (self: Predicate, that: Predicate): Predicate -} -``` - -Added in v2.0.0 - -## implies - -**Signature** - -```ts -export declare const implies: { - (that: Predicate): (self: Predicate) => Predicate - (self: Predicate, that: Predicate): Predicate -} -``` - -Added in v2.0.0 - -## mapInput - -Given a `Predicate` returns a `Predicate` - -**Signature** - -```ts -export declare const mapInput: { - (f: (b: B) => A): (self: Predicate) => Predicate - (self: Predicate, f: (b: B) => A): Predicate -} -``` - -**Example** - -```ts -import * as P from "effect/Predicate" -import * as N from "effect/Number" - -const minLength3 = P.mapInput(N.greaterThan(2), (s: string) => s.length) - -assert.deepStrictEqual(minLength3("a"), false) -assert.deepStrictEqual(minLength3("aa"), false) -assert.deepStrictEqual(minLength3("aaa"), true) -assert.deepStrictEqual(minLength3("aaaa"), true) -``` - -Added in v2.0.0 - -## nand - -**Signature** - -```ts -export declare const nand: { - (that: Predicate): (self: Predicate) => Predicate - (self: Predicate, that: Predicate): Predicate -} -``` - -Added in v2.0.0 - -## nor - -**Signature** - -```ts -export declare const nor: { - (that: Predicate): (self: Predicate) => Predicate - (self: Predicate, that: Predicate): Predicate -} -``` - -Added in v2.0.0 - -## not - -Negates the result of a given predicate. - -**Signature** - -```ts -export declare const not: (self: Predicate) => Predicate -``` - -**Example** - -```ts -import * as P from "effect/Predicate" -import * as N from "effect/Number" - -const isPositive = P.not(N.lessThan(0)) - -assert.deepStrictEqual(isPositive(-1), false) -assert.deepStrictEqual(isPositive(0), true) -assert.deepStrictEqual(isPositive(1), true) -``` - -Added in v2.0.0 - -## or - -Combines two predicates into a new predicate that returns `true` if at least one of the predicates returns `true`. - -**Signature** - -```ts -export declare const or: { - (that: Predicate): (self: Predicate) => Predicate - (self: Predicate, that: Predicate): Predicate -} -``` - -**Example** - -```ts -import * as P from "effect/Predicate" -import * as N from "effect/Number" - -const nonZero = P.or(N.lessThan(0), N.greaterThan(0)) - -assert.deepStrictEqual(nonZero(-1), true) -assert.deepStrictEqual(nonZero(0), false) -assert.deepStrictEqual(nonZero(1), true) -``` - -Added in v2.0.0 - -## xor - -**Signature** - -```ts -export declare const xor: { - (that: Predicate): (self: Predicate) => Predicate - (self: Predicate, that: Predicate): Predicate -} -``` - -Added in v2.0.0 - -# combining - -## all - -**Signature** - -```ts -export declare const all: (collection: Iterable>) => Predicate -``` - -Added in v2.0.0 - -## product - -**Signature** - -```ts -export declare const product: (self: Predicate, that: Predicate) => Predicate -``` - -Added in v2.0.0 - -## productMany - -**Signature** - -```ts -export declare const productMany: ( - self: Predicate, - collection: Iterable> -) => Predicate -``` - -Added in v2.0.0 - -# elements - -## every - -**Signature** - -```ts -export declare const every: (collection: Iterable>) => Predicate -``` - -Added in v2.0.0 - -## some - -**Signature** - -```ts -export declare const some: (collection: Iterable>) => Predicate -``` - -Added in v2.0.0 - -# guards - -## hasProperty - -Checks whether a value is an `object` containing a specified property key. - -**Signature** - -```ts -export declare const hasProperty: { -

(property: P): (self: unknown) => self is { [K in P]: unknown } -

(self: unknown, property: P): self is { [K in P]: unknown } -} -``` - -Added in v2.0.0 - -## isBigInt - -Tests if a value is a `bigint`. - -**Signature** - -```ts -export declare const isBigInt: (input: unknown) => input is bigint -``` - -**Example** - -```ts -import { isBigInt } from "effect/Predicate" - -assert.deepStrictEqual(isBigInt(1n), true) - -assert.deepStrictEqual(isBigInt(1), false) -``` - -Added in v2.0.0 - -## isBoolean - -Tests if a value is a `boolean`. - -**Signature** - -```ts -export declare const isBoolean: (input: unknown) => input is boolean -``` - -**Example** - -```ts -import { isBoolean } from "effect/Predicate" - -assert.deepStrictEqual(isBoolean(true), true) - -assert.deepStrictEqual(isBoolean("true"), false) -``` - -Added in v2.0.0 - -## isDate - -A guard that succeeds when the input is a `Date`. - -**Signature** - -```ts -export declare const isDate: (input: unknown) => input is Date -``` - -**Example** - -```ts -import { isDate } from "effect/Predicate" - -assert.deepStrictEqual(isDate(new Date()), true) - -assert.deepStrictEqual(isDate(null), false) -assert.deepStrictEqual(isDate({}), false) -``` - -Added in v2.0.0 - -## isError - -A guard that succeeds when the input is an `Error`. - -**Signature** - -```ts -export declare const isError: (input: unknown) => input is Error -``` - -**Example** - -```ts -import { isError } from "effect/Predicate" - -assert.deepStrictEqual(isError(new Error()), true) - -assert.deepStrictEqual(isError(null), false) -assert.deepStrictEqual(isError({}), false) -``` - -Added in v2.0.0 - -## isFunction - -Tests if a value is a `function`. - -**Signature** - -```ts -export declare const isFunction: (input: unknown) => input is Function -``` - -**Example** - -```ts -import { isFunction } from "effect/Predicate" - -assert.deepStrictEqual(isFunction(isFunction), true) - -assert.deepStrictEqual(isFunction("function"), false) -``` - -Added in v2.0.0 - -## isIterable - -A guard that succeeds when the input is an `Iterable`. - -**Signature** - -```ts -export declare const isIterable: (input: unknown) => input is Iterable -``` - -**Example** - -```ts -import { isIterable } from "effect/Predicate" - -assert.deepStrictEqual(isIterable([]), true) -assert.deepStrictEqual(isIterable(new Set()), true) - -assert.deepStrictEqual(isIterable(null), false) -assert.deepStrictEqual(isIterable({}), false) -``` - -Added in v2.0.0 - -## isNever - -A guard that always fails. - -**Signature** - -```ts -export declare const isNever: (input: unknown) => input is never -``` - -**Example** - -```ts -import { isNever } from "effect/Predicate" - -assert.deepStrictEqual(isNever(null), false) -assert.deepStrictEqual(isNever(undefined), false) -assert.deepStrictEqual(isNever({}), false) -assert.deepStrictEqual(isNever([]), false) -``` - -Added in v2.0.0 - -## isNotNull - -Tests if a value is not `undefined`. - -**Signature** - -```ts -export declare const isNotNull: (input: A) => input is Exclude -``` - -**Example** - -```ts -import { isNotNull } from "effect/Predicate" - -assert.deepStrictEqual(isNotNull(undefined), true) -assert.deepStrictEqual(isNotNull("null"), true) - -assert.deepStrictEqual(isNotNull(null), false) -``` - -Added in v2.0.0 - -## isNotNullable - -A guard that succeeds when the input is not `null` or `undefined`. - -**Signature** - -```ts -export declare const isNotNullable: (input: A) => input is NonNullable -``` - -**Example** - -```ts -import { isNotNullable } from "effect/Predicate" - -assert.deepStrictEqual(isNotNullable({}), true) -assert.deepStrictEqual(isNotNullable([]), true) - -assert.deepStrictEqual(isNotNullable(null), false) -assert.deepStrictEqual(isNotNullable(undefined), false) -``` - -Added in v2.0.0 - -## isNotUndefined - -Tests if a value is not `undefined`. - -**Signature** - -```ts -export declare const isNotUndefined: (input: A) => input is Exclude -``` - -**Example** - -```ts -import { isNotUndefined } from "effect/Predicate" - -assert.deepStrictEqual(isNotUndefined(null), true) -assert.deepStrictEqual(isNotUndefined("undefined"), true) - -assert.deepStrictEqual(isNotUndefined(undefined), false) -``` - -Added in v2.0.0 - -## isNull - -Tests if a value is `undefined`. - -**Signature** - -```ts -export declare const isNull: (input: unknown) => input is null -``` - -**Example** - -```ts -import { isNull } from "effect/Predicate" - -assert.deepStrictEqual(isNull(null), true) - -assert.deepStrictEqual(isNull(undefined), false) -assert.deepStrictEqual(isNull("null"), false) -``` - -Added in v2.0.0 - -## isNullable - -A guard that succeeds when the input is `null` or `undefined`. - -**Signature** - -```ts -export declare const isNullable: (input: A) => input is Extract -``` - -**Example** - -```ts -import { isNullable } from "effect/Predicate" - -assert.deepStrictEqual(isNullable(null), true) -assert.deepStrictEqual(isNullable(undefined), true) - -assert.deepStrictEqual(isNullable({}), false) -assert.deepStrictEqual(isNullable([]), false) -``` - -Added in v2.0.0 - -## isNumber - -Tests if a value is a `number`. - -**Signature** - -```ts -export declare const isNumber: (input: unknown) => input is number -``` - -**Example** - -```ts -import { isNumber } from "effect/Predicate" - -assert.deepStrictEqual(isNumber(2), true) - -assert.deepStrictEqual(isNumber("2"), false) -``` - -Added in v2.0.0 - -## isObject - -Tests if a value is an `object`. - -**Signature** - -```ts -export declare const isObject: (input: unknown) => input is object -``` - -**Example** - -```ts -import { isObject } from "effect/Predicate" - -assert.deepStrictEqual(isObject({}), true) -assert.deepStrictEqual(isObject([]), true) - -assert.deepStrictEqual(isObject(null), false) -assert.deepStrictEqual(isObject(undefined), false) -``` - -Added in v2.0.0 - -## isReadonlyRecord - -A guard that succeeds when the input is a readonly record. - -**Signature** - -```ts -export declare const isReadonlyRecord: ( - input: unknown -) => input is { readonly [x: string]: unknown; readonly [x: symbol]: unknown } -``` - -**Example** - -```ts -import { isReadonlyRecord } from "effect/Predicate" - -assert.deepStrictEqual(isReadonlyRecord({}), true) -assert.deepStrictEqual(isReadonlyRecord({ a: 1 }), true) - -assert.deepStrictEqual(isReadonlyRecord([]), false) -assert.deepStrictEqual(isReadonlyRecord([1, 2, 3]), false) -assert.deepStrictEqual(isReadonlyRecord(null), false) -assert.deepStrictEqual(isReadonlyRecord(undefined), false) -``` - -Added in v2.0.0 - -## isRecord - -A guard that succeeds when the input is a record. - -**Signature** - -```ts -export declare const isRecord: (input: unknown) => input is { [x: string]: unknown; [x: symbol]: unknown } -``` - -**Example** - -```ts -import { isRecord } from "effect/Predicate" - -assert.deepStrictEqual(isRecord({}), true) -assert.deepStrictEqual(isRecord({ a: 1 }), true) - -assert.deepStrictEqual(isRecord([]), false) -assert.deepStrictEqual(isRecord([1, 2, 3]), false) -assert.deepStrictEqual(isRecord(null), false) -assert.deepStrictEqual(isRecord(undefined), false) -assert.deepStrictEqual( - isRecord(() => null), - false -) -``` - -Added in v2.0.0 - -## isString - -Tests if a value is a `string`. - -**Signature** - -```ts -export declare const isString: (input: unknown) => input is string -``` - -**Example** - -```ts -import { isString } from "effect/Predicate" - -assert.deepStrictEqual(isString("a"), true) - -assert.deepStrictEqual(isString(1), false) -``` - -Added in v2.0.0 - -## isSymbol - -Tests if a value is a `symbol`. - -**Signature** - -```ts -export declare const isSymbol: (input: unknown) => input is symbol -``` - -**Example** - -```ts -import { isSymbol } from "effect/Predicate" - -assert.deepStrictEqual(isSymbol(Symbol.for("a")), true) - -assert.deepStrictEqual(isSymbol("a"), false) -``` - -Added in v2.0.0 - -## isTagged - -Tests if a value is an `object` with a property `_tag` that matches the given tag. - -**Signature** - -```ts -export declare const isTagged: { - (tag: K): (self: unknown) => self is { _tag: K } - (self: unknown, tag: K): self is { _tag: K } -} -``` - -**Example** - -```ts -import { isTagged } from "effect/Predicate" - -assert.deepStrictEqual(isTagged(1, "a"), false) -assert.deepStrictEqual(isTagged(null, "a"), false) -assert.deepStrictEqual(isTagged({}, "a"), false) -assert.deepStrictEqual(isTagged({ a: "a" }, "a"), false) -assert.deepStrictEqual(isTagged({ _tag: "a" }, "a"), true) -assert.deepStrictEqual(isTagged("a")({ _tag: "a" }), true) -``` - -Added in v2.0.0 - -## isUint8Array - -A guard that succeeds when the input is a `Uint8Array`. - -**Signature** - -```ts -export declare const isUint8Array: (input: unknown) => input is Uint8Array -``` - -**Example** - -```ts -import { isUint8Array } from "effect/Predicate" - -assert.deepStrictEqual(isUint8Array(new Uint8Array()), true) - -assert.deepStrictEqual(isUint8Array(null), false) -assert.deepStrictEqual(isUint8Array({}), false) -``` - -Added in v2.0.0 - -## isUndefined - -Tests if a value is `undefined`. - -**Signature** - -```ts -export declare const isUndefined: (input: unknown) => input is undefined -``` - -**Example** - -```ts -import { isUndefined } from "effect/Predicate" - -assert.deepStrictEqual(isUndefined(undefined), true) - -assert.deepStrictEqual(isUndefined(null), false) -assert.deepStrictEqual(isUndefined("undefined"), false) -``` - -Added in v2.0.0 - -## isUnknown - -A guard that always succeeds. - -**Signature** - -```ts -export declare const isUnknown: (input: unknown) => input is unknown -``` - -**Example** - -```ts -import { isUnknown } from "effect/Predicate" - -assert.deepStrictEqual(isUnknown(null), true) -assert.deepStrictEqual(isUnknown(undefined), true) - -assert.deepStrictEqual(isUnknown({}), true) -assert.deepStrictEqual(isUnknown([]), true) -``` - -Added in v2.0.0 - -# models - -## Predicate (interface) - -**Signature** - -```ts -export interface Predicate { - (a: A): boolean -} -``` - -Added in v2.0.0 - -## Refinement (interface) - -**Signature** - -```ts -export interface Refinement { - (a: A): a is B -} -``` - -Added in v2.0.0 - -# type lambdas - -## PredicateTypeLambda (interface) - -**Signature** - -```ts -export interface PredicateTypeLambda extends TypeLambda { - readonly type: Predicate -} -``` - -Added in v2.0.0 - -# utils - -## compose - -**Signature** - -```ts -export declare const compose: { - (bc: Refinement): (ab: Refinement) => Refinement - (ab: Refinement, bc: Refinement): Refinement -} -``` - -Added in v2.0.0 - -## struct - -**Signature** - -```ts -export declare const struct: >>( - fields: R -) => Predicate<{ readonly [K in keyof R]: [R[K]] extends [Predicate] ? A : never }> -``` - -Added in v2.0.0 - -## tuple - -Similar to `Promise.all` but operates on `Predicate`s. - -``` -[Predicate, Predicate, ...] -> Predicate<[A, B, ...]> -``` - -**Signature** - -```ts -export declare const tuple: []>( - ...elements: T -) => Predicate] ? A : never }>> -``` - -Added in v2.0.0 diff --git a/docs/modules/PubSub.ts.md b/docs/modules/PubSub.ts.md deleted file mode 100644 index 5a3853c40..000000000 --- a/docs/modules/PubSub.ts.md +++ /dev/null @@ -1,270 +0,0 @@ ---- -title: PubSub.ts -nav_order: 79 -parent: Modules ---- - -## PubSub overview - -Added in v2.0.0 - ---- - -

Table of contents

- -- [constructors](#constructors) - - [bounded](#bounded) - - [dropping](#dropping) - - [sliding](#sliding) - - [unbounded](#unbounded) -- [getters](#getters) - - [capacity](#capacity) - - [isEmpty](#isempty) - - [isFull](#isfull) - - [isShutdown](#isshutdown) - - [size](#size) -- [models](#models) - - [PubSub (interface)](#pubsub-interface) -- [utils](#utils) - - [awaitShutdown](#awaitshutdown) - - [publish](#publish) - - [publishAll](#publishall) - - [shutdown](#shutdown) - - [subscribe](#subscribe) - ---- - -# constructors - -## bounded - -Creates a bounded `PubSub` with the back pressure strategy. The `PubSub` will retain -messages until they have been taken by all subscribers, applying back -pressure to publishers if the `PubSub` is at capacity. - -For best performance use capacities that are powers of two. - -**Signature** - -```ts -export declare const bounded: (requestedCapacity: number) => Effect.Effect> -``` - -Added in v2.0.0 - -## dropping - -Creates a bounded `PubSub` with the dropping strategy. The `PubSub` will drop new -messages if the `PubSub` is at capacity. - -For best performance use capacities that are powers of two. - -**Signature** - -```ts -export declare const dropping: (requestedCapacity: number) => Effect.Effect> -``` - -Added in v2.0.0 - -## sliding - -Creates a bounded `PubSub` with the sliding strategy. The `PubSub` will add new -messages and drop old messages if the `PubSub` is at capacity. - -For best performance use capacities that are powers of two. - -**Signature** - -```ts -export declare const sliding: (requestedCapacity: number) => Effect.Effect> -``` - -Added in v2.0.0 - -## unbounded - -Creates an unbounded `PubSub`. - -**Signature** - -```ts -export declare const unbounded: () => Effect.Effect> -``` - -Added in v2.0.0 - -# getters - -## capacity - -Returns the number of elements the queue can hold. - -**Signature** - -```ts -export declare const capacity: (self: PubSub) => number -``` - -Added in v2.0.0 - -## isEmpty - -Returns `true` if the `Queue` contains zero elements, `false` otherwise. - -**Signature** - -```ts -export declare const isEmpty: (self: PubSub) => Effect.Effect -``` - -Added in v2.0.0 - -## isFull - -Returns `true` if the `Queue` contains at least one element, `false` -otherwise. - -**Signature** - -```ts -export declare const isFull: (self: PubSub) => Effect.Effect -``` - -Added in v2.0.0 - -## isShutdown - -Returns `true` if `shutdown` has been called, otherwise returns `false`. - -**Signature** - -```ts -export declare const isShutdown: (self: PubSub) => Effect.Effect -``` - -Added in v2.0.0 - -## size - -Retrieves the size of the queue, which is equal to the number of elements -in the queue. This may be negative if fibers are suspended waiting for -elements to be added to the queue. - -**Signature** - -```ts -export declare const size: (self: PubSub) => Effect.Effect -``` - -Added in v2.0.0 - -# models - -## PubSub (interface) - -A `PubSub` is an asynchronous message hub into which publishers can publish -messages of type `A` and subscribers can subscribe to take messages of type -`A`. - -**Signature** - -```ts -export interface PubSub extends Queue.Enqueue, Pipeable { - /** - * Publishes a message to the `PubSub`, returning whether the message was published - * to the `PubSub`. - */ - readonly publish: (value: A) => Effect.Effect - - /** - * Publishes all of the specified messages to the `PubSub`, returning whether they - * were published to the `PubSub`. - */ - readonly publishAll: (elements: Iterable) => Effect.Effect - - /** - * Subscribes to receive messages from the `PubSub`. The resulting subscription can - * be evaluated multiple times within the scope to take a message from the `PubSub` - * each time. - */ - readonly subscribe: Effect.Effect> -} -``` - -Added in v2.0.0 - -# utils - -## awaitShutdown - -Waits until the queue is shutdown. The `Effect` returned by this method will -not resume until the queue has been shutdown. If the queue is already -shutdown, the `Effect` will resume right away. - -**Signature** - -```ts -export declare const awaitShutdown: (self: PubSub) => Effect.Effect -``` - -Added in v2.0.0 - -## publish - -Publishes a message to the `PubSub`, returning whether the message was published -to the `PubSub`. - -**Signature** - -```ts -export declare const publish: { - (value: A): (self: PubSub) => Effect.Effect - (self: PubSub, value: A): Effect.Effect -} -``` - -Added in v2.0.0 - -## publishAll - -Publishes all of the specified messages to the `PubSub`, returning whether they -were published to the `PubSub`. - -**Signature** - -```ts -export declare const publishAll: { - (elements: Iterable): (self: PubSub) => Effect.Effect - (self: PubSub, elements: Iterable): Effect.Effect -} -``` - -Added in v2.0.0 - -## shutdown - -Interrupts any fibers that are suspended on `offer` or `take`. Future calls -to `offer*` and `take*` will be interrupted immediately. - -**Signature** - -```ts -export declare const shutdown: (self: PubSub) => Effect.Effect -``` - -Added in v2.0.0 - -## subscribe - -Subscribes to receive messages from the `PubSub`. The resulting subscription can -be evaluated multiple times within the scope to take a message from the `PubSub` -each time. - -**Signature** - -```ts -export declare const subscribe: (self: PubSub) => Effect.Effect> -``` - -Added in v2.0.0 diff --git a/docs/modules/Queue.ts.md b/docs/modules/Queue.ts.md deleted file mode 100644 index 190cb6b22..000000000 --- a/docs/modules/Queue.ts.md +++ /dev/null @@ -1,814 +0,0 @@ ---- -title: Queue.ts -nav_order: 80 -parent: Modules ---- - -## Queue overview - -Added in v2.0.0 - ---- - -

Table of contents

- -- [constructors](#constructors) - - [bounded](#bounded) - - [dropping](#dropping) - - [make](#make) - - [sliding](#sliding) - - [unbounded](#unbounded) -- [getters](#getters) - - [capacity](#capacity) - - [isEmpty](#isempty) - - [isFull](#isfull) - - [isShutdown](#isshutdown) - - [size](#size) -- [models](#models) - - [BackingQueue (interface)](#backingqueue-interface) - - [BaseQueue (interface)](#basequeue-interface) - - [Dequeue (interface)](#dequeue-interface) - - [Enqueue (interface)](#enqueue-interface) - - [Queue (interface)](#queue-interface) - - [Strategy (interface)](#strategy-interface) -- [refinements](#refinements) - - [isDequeue](#isdequeue) - - [isEnqueue](#isenqueue) - - [isQueue](#isqueue) -- [strategies](#strategies) - - [backPressureStrategy](#backpressurestrategy) - - [droppingStrategy](#droppingstrategy) - - [slidingStrategy](#slidingstrategy) -- [symbols](#symbols) - - [DequeueTypeId](#dequeuetypeid) - - [DequeueTypeId (type alias)](#dequeuetypeid-type-alias) - - [EnqueueTypeId](#enqueuetypeid) - - [EnqueueTypeId (type alias)](#enqueuetypeid-type-alias) - - [QueueStrategyTypeId](#queuestrategytypeid) - - [QueueStrategyTypeId (type alias)](#queuestrategytypeid-type-alias) -- [utils](#utils) - - [Queue (namespace)](#queue-namespace) - - [DequeueVariance (interface)](#dequeuevariance-interface) - - [EnqueueVariance (interface)](#enqueuevariance-interface) - - [StrategyVariance (interface)](#strategyvariance-interface) - - [awaitShutdown](#awaitshutdown) - - [offer](#offer) - - [offerAll](#offerall) - - [poll](#poll) - - [shutdown](#shutdown) - - [take](#take) - - [takeAll](#takeall) - - [takeBetween](#takebetween) - - [takeN](#taken) - - [takeUpTo](#takeupto) - - [unsafeOffer](#unsafeoffer) - ---- - -# constructors - -## bounded - -Makes a new bounded `Queue`. When the capacity of the queue is reached, any -additional calls to `offer` will be suspended until there is more room in -the queue. - -**Note**: When possible use only power of 2 capacities; this will provide -better performance by utilising an optimised version of the underlying -`RingBuffer`. - -**Signature** - -```ts -export declare const bounded:
(requestedCapacity: number) => Effect.Effect> -``` - -Added in v2.0.0 - -## dropping - -Makes a new bounded `Queue` with the dropping strategy. - -When the capacity of the queue is reached, new elements will be dropped and the -old elements will remain. - -**Note**: When possible use only power of 2 capacities; this will provide -better performance by utilising an optimised version of the underlying -`RingBuffer`. - -**Signature** - -```ts -export declare const dropping: (requestedCapacity: number) => Effect.Effect> -``` - -Added in v2.0.0 - -## make - -**Signature** - -```ts -export declare const make: (queue: BackingQueue, strategy: Strategy) => Effect.Effect> -``` - -Added in v2.0.0 - -## sliding - -Makes a new bounded `Queue` with the sliding strategy. - -When the capacity of the queue is reached, new elements will be added and the -old elements will be dropped. - -**Note**: When possible use only power of 2 capacities; this will provide -better performance by utilising an optimised version of the underlying -`RingBuffer`. - -**Signature** - -```ts -export declare const sliding: (requestedCapacity: number) => Effect.Effect> -``` - -Added in v2.0.0 - -## unbounded - -Creates a new unbounded `Queue`. - -**Signature** - -```ts -export declare const unbounded: () => Effect.Effect> -``` - -Added in v2.0.0 - -# getters - -## capacity - -Returns the number of elements the queue can hold. - -**Signature** - -```ts -export declare const capacity: (self: Dequeue | Enqueue) => number -``` - -Added in v2.0.0 - -## isEmpty - -Returns `true` if the `Queue` contains zero elements, `false` otherwise. - -**Signature** - -```ts -export declare const isEmpty: (self: Dequeue | Enqueue) => Effect.Effect -``` - -Added in v2.0.0 - -## isFull - -Returns `true` if the `Queue` contains at least one element, `false` -otherwise. - -**Signature** - -```ts -export declare const isFull: (self: Dequeue | Enqueue) => Effect.Effect -``` - -Added in v2.0.0 - -## isShutdown - -Returns `true` if `shutdown` has been called, otherwise returns `false`. - -**Signature** - -```ts -export declare const isShutdown: (self: Dequeue | Enqueue) => Effect.Effect -``` - -Added in v2.0.0 - -## size - -Retrieves the size of the queue, which is equal to the number of elements -in the queue. This may be negative if fibers are suspended waiting for -elements to be added to the queue. - -**Signature** - -```ts -export declare const size: (self: Dequeue | Enqueue) => Effect.Effect -``` - -Added in v2.0.0 - -# models - -## BackingQueue (interface) - -**Signature** - -```ts -export interface BackingQueue { - /** - * Dequeues an element from the queue. - * Returns either an element from the queue, or the `def` param. - */ - readonly poll: (def: Def) => A | Def - /** - * Dequeues up to `limit` elements from the queue. - */ - readonly pollUpTo: (limit: number) => Chunk.Chunk - /** - * Enqueues a collection of values into the queue. - * - * Returns a `Chunk` of the values that were **not** able to be enqueued. - */ - readonly offerAll: (elements: Iterable) => Chunk.Chunk - /** - * Offers an element to the queue. - * - * Returns whether the enqueue was successful or not. - */ - readonly offer: (element: A) => boolean - /** - * The **maximum** number of elements that a queue can hold. - * - * **Note**: unbounded queues can still implement this interface with - * `capacity = Infinity`. - */ - readonly capacity: () => number - /** - * Returns the number of elements currently in the queue - */ - readonly length: () => number -} -``` - -Added in v2.0.0 - -## BaseQueue (interface) - -The base interface that all `Queue`s must implement. - -**Signature** - -```ts -export interface BaseQueue { - /** - * Returns the number of elements the queue can hold. - */ - readonly capacity: () => number - - /** - * Returns false if shutdown has been called. - */ - readonly isActive: () => boolean - - /** - * Retrieves the size of the queue, which is equal to the number of elements - * in the queue. This may be negative if fibers are suspended waiting for - * elements to be added to the queue. - */ - readonly size: Effect.Effect - - /** - * Retrieves the size of the queue, which is equal to the number of elements - * in the queue. This may be negative if fibers are suspended waiting for - * elements to be added to the queue. Returns None if shutdown has been called - */ - readonly unsafeSize: () => Option.Option - - /** - * Returns `true` if the `Queue` contains at least one element, `false` - * otherwise. - */ - readonly isFull: Effect.Effect - - /** - * Returns `true` if the `Queue` contains zero elements, `false` otherwise. - */ - readonly isEmpty: Effect.Effect - - /** - * Interrupts any fibers that are suspended on `offer` or `take`. Future calls - * to `offer*` and `take*` will be interrupted immediately. - */ - readonly shutdown: Effect.Effect - - /** - * Returns `true` if `shutdown` has been called, otherwise returns `false`. - */ - readonly isShutdown: Effect.Effect - - /** - * Waits until the queue is shutdown. The `Effect` returned by this method will - * not resume until the queue has been shutdown. If the queue is already - * shutdown, the `Effect` will resume right away. - */ - readonly awaitShutdown: Effect.Effect -} -``` - -Added in v2.0.0 - -## Dequeue (interface) - -**Signature** - -```ts -export interface Dequeue extends Queue.DequeueVariance, BaseQueue, Pipeable { - /** - * Takes the oldest value in the queue. If the queue is empty, this will return - * a computation that resumes when an item has been added to the queue. - */ - readonly take: Effect.Effect - - /** - * Takes all the values in the queue and returns the values. If the queue is - * empty returns an empty collection. - */ - readonly takeAll: Effect.Effect> - - /** - * Takes up to max number of values from the queue. - */ - readonly takeUpTo: (max: number) => Effect.Effect> - - /** - * Takes a number of elements from the queue between the specified minimum and - * maximum. If there are fewer than the minimum number of elements available, - * suspends until at least the minimum number of elements have been collected. - */ - readonly takeBetween: (min: number, max: number) => Effect.Effect> -} -``` - -Added in v2.0.0 - -## Enqueue (interface) - -**Signature** - -```ts -export interface Enqueue extends Queue.EnqueueVariance, BaseQueue, Pipeable { - /** - * Places one value in the queue. - */ - readonly offer: (value: A) => Effect.Effect - - /** - * Places one value in the queue when possible without needing the fiber runtime. - */ - readonly unsafeOffer: (value: A) => boolean - - /** - * For Bounded Queue: uses the `BackPressure` Strategy, places the values in - * the queue and always returns true. If the queue has reached capacity, then - * the fiber performing the `offerAll` will be suspended until there is room - * in the queue. - * - * For Unbounded Queue: Places all values in the queue and returns true. - * - * For Sliding Queue: uses `Sliding` Strategy If there is room in the queue, - * it places the values otherwise it removes the old elements and enqueues the - * new ones. Always returns true. - * - * For Dropping Queue: uses `Dropping` Strategy, It places the values in the - * queue but if there is no room it will not enqueue them and return false. - */ - readonly offerAll: (iterable: Iterable) => Effect.Effect -} -``` - -Added in v2.0.0 - -## Queue (interface) - -**Signature** - -```ts -export interface Queue extends Enqueue, Dequeue, Pipeable { - /** @internal */ - readonly queue: BackingQueue - /** @internal */ - readonly takers: MutableQueue.MutableQueue> - /** @internal */ - readonly shutdownHook: Deferred.Deferred - /** @internal */ - readonly shutdownFlag: MutableRef.MutableRef - /** @internal */ - readonly strategy: Strategy -} -``` - -Added in v2.0.0 - -## Strategy (interface) - -**Signature** - -```ts -export interface Strategy extends Queue.StrategyVariance { - /** - * Returns the number of surplus values that were unable to be added to the - * `Queue` - */ - readonly surplusSize: () => number - - /** - * Determines how the `Queue.Strategy` should shut down when the `Queue` is - * shut down. - */ - readonly shutdown: Effect.Effect - - /** - * Determines the behavior of the `Queue.Strategy` when there are surplus - * values that could not be added to the `Queue` following an `offer` - * operation. - */ - readonly handleSurplus: ( - iterable: Iterable, - queue: BackingQueue, - takers: MutableQueue.MutableQueue>, - isShutdown: MutableRef.MutableRef - ) => Effect.Effect - - /** - * It is called when the backing queue is empty but there are some - * takers that can be completed - */ - readonly onCompleteTakersWithEmptyQueue: (takers: MutableQueue.MutableQueue>) => void - - /** - * Determines the behavior of the `Queue.Strategy` when the `Queue` has empty - * slots following a `take` operation. - */ - readonly unsafeOnQueueEmptySpace: ( - queue: BackingQueue, - takers: MutableQueue.MutableQueue> - ) => void -} -``` - -Added in v2.0.0 - -# refinements - -## isDequeue - -Returns `true` if the specified value is a `Dequeue`, `false` otherwise. - -**Signature** - -```ts -export declare const isDequeue: (u: unknown) => u is Dequeue -``` - -Added in v2.0.0 - -## isEnqueue - -Returns `true` if the specified value is a `Enqueue`, `false` otherwise. - -**Signature** - -```ts -export declare const isEnqueue: (u: unknown) => u is Enqueue -``` - -Added in v2.0.0 - -## isQueue - -Returns `true` if the specified value is a `Queue`, `false` otherwise. - -**Signature** - -```ts -export declare const isQueue: (u: unknown) => u is Queue -``` - -Added in v2.0.0 - -# strategies - -## backPressureStrategy - -**Signature** - -```ts -export declare const backPressureStrategy: () => Strategy -``` - -Added in v2.0.0 - -## droppingStrategy - -**Signature** - -```ts -export declare const droppingStrategy: () => Strategy -``` - -Added in v2.0.0 - -## slidingStrategy - -**Signature** - -```ts -export declare const slidingStrategy: () => Strategy -``` - -Added in v2.0.0 - -# symbols - -## DequeueTypeId - -**Signature** - -```ts -export declare const DequeueTypeId: typeof DequeueTypeId -``` - -Added in v2.0.0 - -## DequeueTypeId (type alias) - -**Signature** - -```ts -export type DequeueTypeId = typeof DequeueTypeId -``` - -Added in v2.0.0 - -## EnqueueTypeId - -**Signature** - -```ts -export declare const EnqueueTypeId: typeof EnqueueTypeId -``` - -Added in v2.0.0 - -## EnqueueTypeId (type alias) - -**Signature** - -```ts -export type EnqueueTypeId = typeof EnqueueTypeId -``` - -Added in v2.0.0 - -## QueueStrategyTypeId - -**Signature** - -```ts -export declare const QueueStrategyTypeId: typeof QueueStrategyTypeId -``` - -Added in v2.0.0 - -## QueueStrategyTypeId (type alias) - -**Signature** - -```ts -export type QueueStrategyTypeId = typeof QueueStrategyTypeId -``` - -Added in v2.0.0 - -# utils - -## Queue (namespace) - -Added in v2.0.0 - -### DequeueVariance (interface) - -**Signature** - -```ts -export interface DequeueVariance { - readonly [DequeueTypeId]: { - readonly _Out: (_: never) => A - } -} -``` - -Added in v2.0.0 - -### EnqueueVariance (interface) - -**Signature** - -```ts -export interface EnqueueVariance { - readonly [EnqueueTypeId]: { - readonly _In: (_: A) => void - } -} -``` - -Added in v2.0.0 - -### StrategyVariance (interface) - -**Signature** - -```ts -export interface StrategyVariance { - readonly [QueueStrategyTypeId]: { - readonly _A: (_: never) => A - } -} -``` - -Added in v2.0.0 - -## awaitShutdown - -Waits until the queue is shutdown. The `Effect` returned by this method will -not resume until the queue has been shutdown. If the queue is already -shutdown, the `Effect` will resume right away. - -**Signature** - -```ts -export declare const awaitShutdown: (self: Dequeue | Enqueue) => Effect.Effect -``` - -Added in v2.0.0 - -## offer - -Places one value in the queue. - -**Signature** - -```ts -export declare const offer: { - (value: A): (self: Enqueue) => Effect.Effect - (self: Enqueue, value: A): Effect.Effect -} -``` - -Added in v2.0.0 - -## offerAll - -For Bounded Queue: uses the `BackPressure` Strategy, places the values in -the queue and always returns true. If the queue has reached capacity, then -the fiber performing the `offerAll` will be suspended until there is room -in the queue. - -For Unbounded Queue: Places all values in the queue and returns true. - -For Sliding Queue: uses `Sliding` Strategy If there is room in the queue, -it places the values otherwise it removes the old elements and enqueues the -new ones. Always returns true. - -For Dropping Queue: uses `Dropping` Strategy, It places the values in the -queue but if there is no room it will not enqueue them and return false. - -**Signature** - -```ts -export declare const offerAll: { - (iterable: Iterable): (self: Enqueue) => Effect.Effect - (self: Enqueue, iterable: Iterable): Effect.Effect -} -``` - -Added in v2.0.0 - -## poll - -Returns the first value in the `Queue` as a `Some`, or `None` if the queue -is empty. - -**Signature** - -```ts -export declare const poll: (self: Dequeue) => Effect.Effect> -``` - -Added in v2.0.0 - -## shutdown - -Interrupts any fibers that are suspended on `offer` or `take`. Future calls -to `offer*` and `take*` will be interrupted immediately. - -**Signature** - -```ts -export declare const shutdown: (self: Dequeue | Enqueue) => Effect.Effect -``` - -Added in v2.0.0 - -## take - -Takes the oldest value in the queue. If the queue is empty, this will return -a computation that resumes when an item has been added to the queue. - -**Signature** - -```ts -export declare const take: (self: Dequeue) => Effect.Effect -``` - -Added in v2.0.0 - -## takeAll - -Takes all the values in the queue and returns the values. If the queue is -empty returns an empty collection. - -**Signature** - -```ts -export declare const takeAll: (self: Dequeue) => Effect.Effect> -``` - -Added in v2.0.0 - -## takeBetween - -Takes a number of elements from the queue between the specified minimum and -maximum. If there are fewer than the minimum number of elements available, -suspends until at least the minimum number of elements have been collected. - -**Signature** - -```ts -export declare const takeBetween: { - (min: number, max: number): (self: Dequeue) => Effect.Effect> - (self: Dequeue, min: number, max: number): Effect.Effect> -} -``` - -Added in v2.0.0 - -## takeN - -Takes the specified number of elements from the queue. If there are fewer -than the specified number of elements available, it suspends until they -become available. - -**Signature** - -```ts -export declare const takeN: { - (n: number): (self: Dequeue) => Effect.Effect> - (self: Dequeue, n: number): Effect.Effect> -} -``` - -Added in v2.0.0 - -## takeUpTo - -Takes up to max number of values from the queue. - -**Signature** - -```ts -export declare const takeUpTo: { - (max: number): (self: Dequeue) => Effect.Effect> - (self: Dequeue, max: number): Effect.Effect> -} -``` - -Added in v2.0.0 - -## unsafeOffer - -Places one value in the queue. - -**Signature** - -```ts -export declare const unsafeOffer: { - (value: A): (self: Enqueue) => boolean - (self: Enqueue, value: A): boolean -} -``` - -Added in v2.0.0 diff --git a/docs/modules/Random.ts.md b/docs/modules/Random.ts.md deleted file mode 100644 index 17c6065f4..000000000 --- a/docs/modules/Random.ts.md +++ /dev/null @@ -1,180 +0,0 @@ ---- -title: Random.ts -nav_order: 81 -parent: Modules ---- - -## Random overview - -Added in v2.0.0 - ---- - -

Table of contents

- -- [constructors](#constructors) - - [next](#next) - - [nextBoolean](#nextboolean) - - [nextInt](#nextint) - - [nextIntBetween](#nextintbetween) - - [nextRange](#nextrange) - - [randomWith](#randomwith) - - [shuffle](#shuffle) -- [models](#models) - - [Random (interface)](#random-interface) -- [symbols](#symbols) - - [RandomTypeId](#randomtypeid) - - [RandomTypeId (type alias)](#randomtypeid-type-alias) - ---- - -# constructors - -## next - -Returns the next numeric value from the pseudo-random number generator. - -**Signature** - -```ts -export declare const next: Effect.Effect -``` - -Added in v2.0.0 - -## nextBoolean - -Returns the next boolean value from the pseudo-random number generator. - -**Signature** - -```ts -export declare const nextBoolean: Effect.Effect -``` - -Added in v2.0.0 - -## nextInt - -Returns the next integer value from the pseudo-random number generator. - -**Signature** - -```ts -export declare const nextInt: Effect.Effect -``` - -Added in v2.0.0 - -## nextIntBetween - -Returns the next integer value in the specified range from the -pseudo-random number generator. - -**Signature** - -```ts -export declare const nextIntBetween: (min: number, max: number) => Effect.Effect -``` - -Added in v2.0.0 - -## nextRange - -Returns the next numeric value in the specified range from the -pseudo-random number generator. - -**Signature** - -```ts -export declare const nextRange: (min: number, max: number) => Effect.Effect -``` - -Added in v2.0.0 - -## randomWith - -Retreives the `Random` service from the context and uses it to run the -specified workflow. - -**Signature** - -```ts -export declare const randomWith: (f: (random: Random) => Effect.Effect) => Effect.Effect -``` - -Added in v2.0.0 - -## shuffle - -Uses the pseudo-random number generator to shuffle the specified iterable. - -**Signature** - -```ts -export declare const shuffle:
(elements: Iterable) => Effect.Effect> -``` - -Added in v2.0.0 - -# models - -## Random (interface) - -**Signature** - -```ts -export interface Random { - readonly [RandomTypeId]: RandomTypeId - /** - * Returns the next numeric value from the pseudo-random number generator. - */ - readonly next: Effect.Effect - /** - * Returns the next boolean value from the pseudo-random number generator. - */ - readonly nextBoolean: Effect.Effect - /** - * Returns the next integer value from the pseudo-random number generator. - */ - readonly nextInt: Effect.Effect - /** - * Returns the next numeric value in the specified range from the - * pseudo-random number generator. - */ - readonly nextRange: (min: number, max: number) => Effect.Effect - /** - * Returns the next integer value in the specified range from the - * pseudo-random number generator. - */ - readonly nextIntBetween: (min: number, max: number) => Effect.Effect - /** - * Uses the pseudo-random number generator to shuffle the specified iterable. - */ - readonly shuffle: (elements: Iterable) => Effect.Effect> -} -``` - -Added in v2.0.0 - -# symbols - -## RandomTypeId - -**Signature** - -```ts -export declare const RandomTypeId: typeof RandomTypeId -``` - -Added in v2.0.0 - -## RandomTypeId (type alias) - -**Signature** - -```ts -export type RandomTypeId = typeof RandomTypeId -``` - -Added in v2.0.0 diff --git a/docs/modules/ReadonlyArray.ts.md b/docs/modules/ReadonlyArray.ts.md deleted file mode 100644 index 3f11279cf..000000000 --- a/docs/modules/ReadonlyArray.ts.md +++ /dev/null @@ -1,2207 +0,0 @@ ---- -title: ReadonlyArray.ts -nav_order: 82 -parent: Modules ---- - -## ReadonlyArray overview - -This module provides utility functions for working with arrays in TypeScript. - -Added in v2.0.0 - ---- - -

Table of contents

- -- [combining](#combining) - - [flatMapNullable](#flatmapnullable) -- [concatenating](#concatenating) - - [append](#append) - - [appendAll](#appendall) - - [appendAllNonEmpty](#appendallnonempty) - - [prepend](#prepend) - - [prependAll](#prependall) - - [prependAllNonEmpty](#prependallnonempty) -- [constructors](#constructors) - - [empty](#empty) - - [make](#make) - - [makeBy](#makeby) - - [of](#of) - - [range](#range) - - [replicate](#replicate) - - [unfold](#unfold) -- [conversions](#conversions) - - [fromIterable](#fromiterable) - - [fromNullable](#fromnullable) - - [fromOption](#fromoption) - - [fromRecord](#fromrecord) -- [elements](#elements) - - [cartesian](#cartesian) - - [cartesianWith](#cartesianwith) - - [contains](#contains) - - [containsWith](#containswith) - - [every](#every) - - [findFirst](#findfirst) - - [findFirstIndex](#findfirstindex) - - [findLast](#findlast) - - [findLastIndex](#findlastindex) - - [reverse](#reverse) - - [reverseNonEmpty](#reversenonempty) - - [some](#some) - - [sortWith](#sortwith) -- [filtering](#filtering) - - [compact](#compact) - - [filter](#filter) - - [filterMap](#filtermap) - - [filterMapWhile](#filtermapwhile) - - [partition](#partition) - - [partitionMap](#partitionmap) - - [separate](#separate) - - [span](#span) -- [folding](#folding) - - [join](#join) - - [mapAccum](#mapaccum) - - [reduce](#reduce) - - [reduceRight](#reduceright) - - [scan](#scan) - - [scanRight](#scanright) -- [getters](#getters) - - [chunksOf](#chunksof) - - [chunksOfNonEmpty](#chunksofnonempty) - - [drop](#drop) - - [dropRight](#dropright) - - [dropWhile](#dropwhile) - - [get](#get) - - [head](#head) - - [headNonEmpty](#headnonempty) - - [init](#init) - - [initNonEmpty](#initnonempty) - - [last](#last) - - [lastNonEmpty](#lastnonempty) - - [length](#length) - - [splitAt](#splitat) - - [splitNonEmptyAt](#splitnonemptyat) - - [tail](#tail) - - [tailNonEmpty](#tailnonempty) - - [take](#take) - - [takeRight](#takeright) - - [takeWhile](#takewhile) - - [unappend](#unappend) - - [unprepend](#unprepend) -- [grouping](#grouping) - - [group](#group) - - [groupBy](#groupby) - - [groupWith](#groupwith) -- [guards](#guards) - - [isEmptyArray](#isemptyarray) - - [isEmptyReadonlyArray](#isemptyreadonlyarray) - - [isNonEmptyArray](#isnonemptyarray) - - [isNonEmptyReadonlyArray](#isnonemptyreadonlyarray) -- [instances](#instances) - - [getEquivalence](#getequivalence) - - [getOrder](#getorder) -- [lifting](#lifting) - - [liftEither](#lifteither) - - [liftNullable](#liftnullable) - - [liftOption](#liftoption) - - [liftPredicate](#liftpredicate) -- [mapping](#mapping) - - [map](#map) -- [models](#models) - - [NonEmptyArray (type alias)](#nonemptyarray-type-alias) - - [NonEmptyReadonlyArray (type alias)](#nonemptyreadonlyarray-type-alias) -- [pattern matching](#pattern-matching) - - [match](#match) - - [matchLeft](#matchleft) - - [matchRight](#matchright) -- [sequencing](#sequencing) - - [flatMap](#flatmap) - - [flatMapNonEmpty](#flatmapnonempty) - - [flatten](#flatten) - - [flattenNonEmpty](#flattennonempty) -- [sorting](#sorting) - - [sort](#sort) - - [sortBy](#sortby) - - [sortByNonEmpty](#sortbynonempty) - - [sortNonEmpty](#sortnonempty) -- [type lambdas](#type-lambdas) - - [ReadonlyArrayTypeLambda (interface)](#readonlyarraytypelambda-interface) -- [unsafe](#unsafe) - - [unsafeGet](#unsafeget) -- [utils](#utils) - - [ReadonlyArray (namespace)](#readonlyarray-namespace) - - [Infer (type alias)](#infer-type-alias) - - [With (type alias)](#with-type-alias) - - [chop](#chop) - - [chopNonEmpty](#chopnonempty) - - [copy](#copy) - - [dedupe](#dedupe) - - [dedupeAdjacent](#dedupeadjacent) - - [dedupeAdjacentWith](#dedupeadjacentwith) - - [dedupeNonEmpty](#dedupenonempty) - - [dedupeNonEmptyWith](#dedupenonemptywith) - - [dedupeWith](#dedupewith) - - [difference](#difference) - - [differenceWith](#differencewith) - - [extend](#extend) - - [forEach](#foreach) - - [insertAt](#insertat) - - [intersection](#intersection) - - [intersectionWith](#intersectionwith) - - [intersperse](#intersperse) - - [intersperseNonEmpty](#interspersenonempty) - - [max](#max) - - [min](#min) - - [modify](#modify) - - [modifyNonEmptyHead](#modifynonemptyhead) - - [modifyNonEmptyLast](#modifynonemptylast) - - [modifyOption](#modifyoption) - - [remove](#remove) - - [replace](#replace) - - [replaceOption](#replaceoption) - - [rotate](#rotate) - - [rotateNonEmpty](#rotatenonempty) - - [setNonEmptyHead](#setnonemptyhead) - - [setNonEmptyLast](#setnonemptylast) - - [union](#union) - - [unionNonEmpty](#unionnonempty) - - [unionNonEmptyWith](#unionnonemptywith) - - [unionWith](#unionwith) - - [unzip](#unzip) - - [unzipNonEmpty](#unzipnonempty) - - [zip](#zip) - - [zipNonEmpty](#zipnonempty) - - [zipNonEmptyWith](#zipnonemptywith) - - [zipWith](#zipwith) - ---- - -# combining - -## flatMapNullable - -**Signature** - -```ts -export declare const flatMapNullable: { - (f: (a: A) => B | null | undefined): (self: readonly A[]) => NonNullable[] - (self: readonly A[], f: (a: A) => B | null | undefined): NonNullable[] -} -``` - -Added in v2.0.0 - -# concatenating - -## append - -Append an element to the end of an `Iterable`, creating a new `NonEmptyArray`. - -**Signature** - -```ts -export declare const append: { - (last: B):
(self: Iterable) => [B | A, ...(B | A)[]] - (self: Iterable, last: B): [A | B, ...(A | B)[]] -} -``` - -Added in v2.0.0 - -## appendAll - -**Signature** - -```ts -export declare const appendAll: { - (that: Iterable): (self: Iterable) => (B | A)[] - (self: Iterable, that: Iterable): (A | B)[] -} -``` - -Added in v2.0.0 - -## appendAllNonEmpty - -**Signature** - -```ts -export declare const appendAllNonEmpty: { - (that: readonly [B, ...B[]]): (self: Iterable) => [B | A, ...(B | A)[]] - (that: Iterable): (self: readonly [A, ...A[]]) => [B | A, ...(B | A)[]] - (self: Iterable, that: readonly [B, ...B[]]): [A | B, ...(A | B)[]] - (self: readonly [A, ...A[]], that: Iterable): [A | B, ...(A | B)[]] -} -``` - -Added in v2.0.0 - -## prepend - -Prepend an element to the front of an `Iterable`, creating a new `NonEmptyArray`. - -**Signature** - -```ts -export declare const prepend: { - (head: B): (self: Iterable) => [B | A, ...(B | A)[]] - (self: Iterable, head: B): [A | B, ...(A | B)[]] -} -``` - -Added in v2.0.0 - -## prependAll - -**Signature** - -```ts -export declare const prependAll: { - (that: Iterable): (self: Iterable) => (B | A)[] - (self: Iterable, that: Iterable): (A | B)[] -} -``` - -Added in v2.0.0 - -## prependAllNonEmpty - -**Signature** - -```ts -export declare const prependAllNonEmpty: { - (that: readonly [B, ...B[]]): (self: Iterable) => [B | A, ...(B | A)[]] - (that: Iterable): (self: readonly [A, ...A[]]) => [B | A, ...(B | A)[]] - (self: Iterable, that: readonly [B, ...B[]]): [A | B, ...(A | B)[]] - (self: readonly [A, ...A[]], that: Iterable): [A | B, ...(A | B)[]] -} -``` - -Added in v2.0.0 - -# constructors - -## empty - -**Signature** - -```ts -export declare const empty: () => A[] -``` - -Added in v2.0.0 - -## make - -Builds a `NonEmptyArray` from an non-empty collection of elements. - -**Signature** - -```ts -export declare const make: ( - ...elements: Elements -) => [Elements[number], ...Elements[number][]] -``` - -Added in v2.0.0 - -## makeBy - -Return a `NonEmptyArray` of length `n` with element `i` initialized with `f(i)`. - -**Note**. `n` is normalized to an integer >= 1. - -**Signature** - -```ts -export declare const makeBy: (n: number, f: (i: number) => A) => [A, ...A[]] -``` - -**Example** - -```ts -import { makeBy } from "effect/ReadonlyArray" - -assert.deepStrictEqual( - makeBy(5, (n) => n * 2), - [0, 2, 4, 6, 8] -) -``` - -Added in v2.0.0 - -## of - -Constructs a new `NonEmptyArray` from the specified value. - -**Signature** - -```ts -export declare const of: (a: A) => [A, ...A[]] -``` - -Added in v2.0.0 - -## range - -Return a `NonEmptyArray` containing a range of integers, including both endpoints. - -**Signature** - -```ts -export declare const range: (start: number, end: number) => [number, ...number[]] -``` - -**Example** - -```ts -import { range } from "effect/ReadonlyArray" - -assert.deepStrictEqual(range(1, 3), [1, 2, 3]) -``` - -Added in v2.0.0 - -## replicate - -Return a `NonEmptyArray` containing a value repeated the specified number of times. - -**Note**. `n` is normalized to an integer >= 1. - -**Signature** - -```ts -export declare const replicate: { (n: number): (a: A) => [A, ...A[]]; (a: A, n: number): [A, ...A[]] } -``` - -**Example** - -```ts -import { replicate } from "effect/ReadonlyArray" - -assert.deepStrictEqual(replicate("a", 3), ["a", "a", "a"]) -``` - -Added in v2.0.0 - -## unfold - -**Signature** - -```ts -export declare const unfold: (b: B, f: (b: B) => Option) => A[] -``` - -Added in v2.0.0 - -# conversions - -## fromIterable - -**Signature** - -```ts -export declare const fromIterable: (collection: Iterable) => A[] -``` - -Added in v2.0.0 - -## fromNullable - -**Signature** - -```ts -export declare const fromNullable: (a: A) => NonNullable[] -``` - -Added in v2.0.0 - -## fromOption - -**Signature** - -```ts -export declare const fromOption: (self: Option) => A[] -``` - -Added in v2.0.0 - -## fromRecord - -Takes a record and returns an array of tuples containing its keys and values. - -**Signature** - -```ts -export declare const fromRecord: (self: Readonly>) => [K, A][] -``` - -**Example** - -```ts -import { fromRecord } from "effect/ReadonlyArray" - -const x = { a: 1, b: 2, c: 3 } -assert.deepStrictEqual(fromRecord(x), [ - ["a", 1], - ["b", 2], - ["c", 3] -]) -``` - -Added in v2.0.0 - -# elements - -## cartesian - -Zips this chunk crosswise with the specified chunk. - -**Signature** - -```ts -export declare const cartesian: { - (that: readonly B[]): (self: readonly A[]) => [A, B][] - (self: readonly A[], that: readonly B[]): [A, B][] -} -``` - -Added in v2.0.0 - -## cartesianWith - -Zips this chunk crosswise with the specified chunk using the specified combiner. - -**Signature** - -```ts -export declare const cartesianWith: { - (that: readonly B[], f: (a: A, b: B) => C): (self: readonly A[]) => C[] - (self: readonly A[], that: readonly B[], f: (a: A, b: B) => C): C[] -} -``` - -Added in v2.0.0 - -## contains - -Returns a function that checks if a `ReadonlyArray` contains a given value using the default `Equivalence`. - -**Signature** - -```ts -export declare const contains: { (a: A): (self: Iterable) => boolean; (self: Iterable, a: A): boolean } -``` - -Added in v2.0.0 - -## containsWith - -Returns a function that checks if a `ReadonlyArray` contains a given value using a provided `isEquivalent` function. - -**Signature** - -```ts -export declare const containsWith: (isEquivalent: (self: A, that: A) => boolean) => { - (a: A): (self: Iterable) => boolean - (self: Iterable, a: A): boolean -} -``` - -Added in v2.0.0 - -## every - -Check if a predicate holds true for every `ReadonlyArray` element. - -**Signature** - -```ts -export declare const every: { - (refinement: Refinement): (self: readonly A[]) => self is readonly B[] - (predicate: Predicate): (self: readonly A[]) => boolean - (self: readonly A[], refinement: Refinement): self is readonly B[] - (self: readonly A[], predicate: Predicate): boolean -} -``` - -Added in v2.0.0 - -## findFirst - -Returns the first element that satisfies the specified -predicate, or `None` if no such element exists. - -**Signature** - -```ts -export declare const findFirst: { - (refinement: Refinement): (self: Iterable) => Option - (predicate: Predicate): (self: Iterable) => Option - (self: Iterable, refinement: Refinement): Option - (self: Iterable, predicate: Predicate): Option -} -``` - -Added in v2.0.0 - -## findFirstIndex - -Return the first index for which a predicate holds. - -**Signature** - -```ts -export declare const findFirstIndex: { - (predicate: Predicate): (self: Iterable) => Option - (self: Iterable, predicate: Predicate): Option -} -``` - -Added in v2.0.0 - -## findLast - -Find the last element for which a predicate holds. - -**Signature** - -```ts -export declare const findLast: { - (refinement: Refinement): (self: Iterable) => Option - (predicate: Predicate): (self: Iterable) => Option - (self: Iterable, refinement: Refinement): Option - (self: Iterable, predicate: Predicate): Option -} -``` - -Added in v2.0.0 - -## findLastIndex - -Return the last index for which a predicate holds. - -**Signature** - -```ts -export declare const findLastIndex: { - (predicate: Predicate): (self: Iterable) => Option - (self: Iterable, predicate: Predicate): Option -} -``` - -Added in v2.0.0 - -## reverse - -Reverse an `Iterable`, creating a new `Array`. - -**Signature** - -```ts -export declare const reverse: (self: Iterable) => A[] -``` - -Added in v2.0.0 - -## reverseNonEmpty - -**Signature** - -```ts -export declare const reverseNonEmpty: (self: readonly [A, ...A[]]) => [A, ...A[]] -``` - -Added in v2.0.0 - -## some - -Check if a predicate holds true for some `ReadonlyArray` element. - -**Signature** - -```ts -export declare const some: { - (predicate: Predicate): (self: readonly B[]) => self is readonly [B, ...B[]] - (self: readonly B[], predicate: Predicate): self is readonly [B, ...B[]] -} -``` - -Added in v2.0.0 - -## sortWith - -**Signature** - -```ts -export declare const sortWith: { - (f: (a: A) => B, order: Order.Order): (self: readonly A[]) => A[] - (self: readonly A[], f: (a: A) => B, order: Order.Order): A[] -} -``` - -Added in v2.0.0 - -# filtering - -## compact - -**Signature** - -```ts -export declare const compact: (self: Iterable>) => A[] -``` - -Added in v2.0.0 - -## filter - -**Signature** - -```ts -export declare const filter: { - (refinement: (a: A, i: number) => a is B): (self: Iterable) => B[] - (predicate: (a: A, i: number) => boolean): (self: Iterable) => B[] - (self: Iterable, refinement: (a: A, i: number) => a is B): B[] - (self: Iterable, predicate: (a: A, i: number) => boolean): B[] -} -``` - -Added in v2.0.0 - -## filterMap - -**Signature** - -```ts -export declare const filterMap: { - (f: (a: A, i: number) => Option): (self: Iterable) => B[] - (self: Iterable, f: (a: A, i: number) => Option): B[] -} -``` - -Added in v2.0.0 - -## filterMapWhile - -Transforms all elements of the `readonlyArray` for as long as the specified function returns some value - -**Signature** - -```ts -export declare const filterMapWhile: { - (f: (a: A) => Option): (self: Iterable) => B[] - (self: Iterable, f: (a: A) => Option): B[] -} -``` - -Added in v2.0.0 - -## partition - -**Signature** - -```ts -export declare const partition: { - (refinement: (a: A, i: number) => a is B): (self: Iterable) => [C[], B[]] - (predicate: (a: A, i: number) => boolean): (self: Iterable) => [B[], B[]] - (self: Iterable, refinement: (a: A, i: number) => a is B): [C[], B[]] - (self: Iterable, predicate: (a: A, i: number) => boolean): [B[], B[]] -} -``` - -Added in v2.0.0 - -## partitionMap - -**Signature** - -```ts -export declare const partitionMap: { - (f: (a: A, i: number) => Either): (self: Iterable) => [B[], C[]] - (self: Iterable, f: (a: A, i: number) => Either): [B[], C[]] -} -``` - -Added in v2.0.0 - -## separate - -**Signature** - -```ts -export declare const separate: (self: Iterable>) => [E[], A[]] -``` - -Added in v2.0.0 - -## span - -Split an `Iterable` into two parts: - -1. the longest initial subarray for which all elements satisfy the specified predicate -2. the remaining elements - -**Signature** - -```ts -export declare const span: { - (refinement: Refinement): (self: Iterable) => [init: B[], rest: A[]] - (predicate: Predicate): (self: Iterable) => [init: B[], rest: B[]] - (self: Iterable, refinement: Refinement): [init: B[], rest: A[]] - (self: Iterable, predicate: Predicate): [init: B[], rest: B[]] -} -``` - -Added in v2.0.0 - -# folding - -## join - -Joins the elements together with "sep" in the middle. - -**Signature** - -```ts -export declare const join: { - (sep: string): (self: Iterable) => string - (self: Iterable, sep: string): string -} -``` - -Added in v2.0.0 - -## mapAccum - -Statefully maps over the chunk, producing new elements of type `B`. - -**Signature** - -```ts -export declare const mapAccum: { - (s: S, f: (s: S, a: A) => readonly [S, B]): (self: Iterable) => [S, B[]] - (self: Iterable, s: S, f: (s: S, a: A) => readonly [S, B]): [S, B[]] -} -``` - -Added in v2.0.0 - -## reduce - -**Signature** - -```ts -export declare const reduce: { - (b: B, f: (b: B, a: A, i: number) => B): (self: Iterable) => B - (self: Iterable, b: B, f: (b: B, a: A, i: number) => B): B -} -``` - -Added in v2.0.0 - -## reduceRight - -**Signature** - -```ts -export declare const reduceRight: { - (b: B, f: (b: B, a: A, i: number) => B): (self: Iterable) => B - (self: Iterable, b: B, f: (b: B, a: A, i: number) => B): B -} -``` - -Added in v2.0.0 - -## scan - -Reduce an `Iterable` from the left, keeping all intermediate results instead of only the final result. - -**Signature** - -```ts -export declare const scan: { - (b: B, f: (b: B, a: A) => B): (self: Iterable) => [B, ...B[]] - (self: Iterable, b: B, f: (b: B, a: A) => B): [B, ...B[]] -} -``` - -Added in v2.0.0 - -## scanRight - -Reduce an `Iterable` from the right, keeping all intermediate results instead of only the final result. - -**Signature** - -```ts -export declare const scanRight: { - (b: B, f: (b: B, a: A) => B): (self: Iterable) => [B, ...B[]] - (self: Iterable, b: B, f: (b: B, a: A) => B): [B, ...B[]] -} -``` - -Added in v2.0.0 - -# getters - -## chunksOf - -Splits an `Iterable` into length-`n` pieces. The last piece will be shorter if `n` does not evenly divide the length of -the `Iterable`. Note that `chunksOf(n)([])` is `[]`, not `[[]]`. This is intentional, and is consistent with a recursive -definition of `chunksOf`; it satisfies the property that - -```ts -chunksOf(n)(xs).concat(chunksOf(n)(ys)) == chunksOf(n)(xs.concat(ys))) -``` - -whenever `n` evenly divides the length of `self`. - -**Signature** - -```ts -export declare const chunksOf: { - (n: number): (self: Iterable) => [A, ...A[]][] - (self: Iterable, n: number): [A, ...A[]][] -} -``` - -Added in v2.0.0 - -## chunksOfNonEmpty - -Splits a `NonEmptyReadonlyArray` into length-`n` pieces. The last piece will be shorter if `n` does not evenly divide the length of -the `NonEmptyReadonlyArray`. - -**Signature** - -```ts -export declare const chunksOfNonEmpty: { - (n: number): (self: readonly [A, ...A[]]) => [[A, ...A[]], ...[A, ...A[]][]] - (self: readonly [A, ...A[]], n: number): [[A, ...A[]], ...[A, ...A[]][]] -} -``` - -Added in v2.0.0 - -## drop - -Drop a max number of elements from the start of an `Iterable`, creating a new `Array`. - -**Note**. `n` is normalized to a non negative integer. - -**Signature** - -```ts -export declare const drop: { (n: number): (self: Iterable) => A[]; (self: Iterable, n: number): A[] } -``` - -Added in v2.0.0 - -## dropRight - -Drop a max number of elements from the end of an `Iterable`, creating a new `Array`. - -**Note**. `n` is normalized to a non negative integer. - -**Signature** - -```ts -export declare const dropRight: { (n: number): (self: Iterable) => A[]; (self: Iterable, n: number): A[] } -``` - -Added in v2.0.0 - -## dropWhile - -Remove the longest initial subarray for which all element satisfy the specified predicate, creating a new `Array`. - -**Signature** - -```ts -export declare const dropWhile: { - (refinement: Refinement): (self: Iterable) => B[] - (predicate: Predicate): (self: Iterable) => B[] - (self: Iterable, refinement: Refinement): B[] - (self: Iterable, predicate: Predicate): B[] -} -``` - -Added in v2.0.0 - -## get - -This function provides a safe way to read a value at a particular index from a `ReadonlyArray`. - -**Signature** - -```ts -export declare const get: { - (index: number): (self: readonly A[]) => Option - (self: readonly A[], index: number): Option -} -``` - -Added in v2.0.0 - -## head - -Get the first element of a `ReadonlyArray`, or `None` if the `ReadonlyArray` is empty. - -**Signature** - -```ts -export declare const head: (self: readonly A[]) => Option -``` - -Added in v2.0.0 - -## headNonEmpty - -**Signature** - -```ts -export declare const headNonEmpty: (self: readonly [A, ...A[]]) => A -``` - -Added in v2.0.0 - -## init - -Get all but the last element of an `Iterable`, creating a new `Array`, or `None` if the `Iterable` is empty. - -**Signature** - -```ts -export declare const init: (self: Iterable) => Option -``` - -Added in v2.0.0 - -## initNonEmpty - -Get all but the last element of a non empty array, creating a new array. - -**Signature** - -```ts -export declare const initNonEmpty: (self: readonly [A, ...A[]]) => A[] -``` - -Added in v2.0.0 - -## last - -Get the last element in a `ReadonlyArray`, or `None` if the `ReadonlyArray` is empty. - -**Signature** - -```ts -export declare const last: (self: readonly A[]) => Option -``` - -Added in v2.0.0 - -## lastNonEmpty - -**Signature** - -```ts -export declare const lastNonEmpty: (self: readonly [A, ...A[]]) => A -``` - -Added in v2.0.0 - -## length - -Return the number of elements in a `ReadonlyArray`. - -**Signature** - -```ts -export declare const length: (self: readonly A[]) => number -``` - -Added in v2.0.0 - -## splitAt - -Splits an `Iterable` into two pieces, the first piece has max `n` elements. - -**Signature** - -```ts -export declare const splitAt: { - (n: number): (self: Iterable) => [A[], A[]] - (self: Iterable, n: number): [A[], A[]] -} -``` - -Added in v2.0.0 - -## splitNonEmptyAt - -Splits a `NonEmptyReadonlyArray` into two pieces, the first piece has max `n` elements. - -**Signature** - -```ts -export declare const splitNonEmptyAt: { - (n: number): (self: readonly [A, ...A[]]) => [[A, ...A[]], A[]] - (self: readonly [A, ...A[]], n: number): [[A, ...A[]], A[]] -} -``` - -Added in v2.0.0 - -## tail - -Get all but the first element of an `Iterable`, creating a new `Array`, or `None` if the `Iterable` is empty. - -**Signature** - -```ts -export declare const tail: (self: Iterable) => Option -``` - -Added in v2.0.0 - -## tailNonEmpty - -**Signature** - -```ts -export declare const tailNonEmpty: (self: readonly [A, ...A[]]) => A[] -``` - -Added in v2.0.0 - -## take - -Keep only a max number of elements from the start of an `Iterable`, creating a new `Array`. - -**Note**. `n` is normalized to a non negative integer. - -**Signature** - -```ts -export declare const take: { (n: number): (self: Iterable) => A[]; (self: Iterable, n: number): A[] } -``` - -Added in v2.0.0 - -## takeRight - -Keep only a max number of elements from the end of an `Iterable`, creating a new `Array`. - -**Note**. `n` is normalized to a non negative integer. - -**Signature** - -```ts -export declare const takeRight: { (n: number): (self: Iterable) => A[]; (self: Iterable, n: number): A[] } -``` - -Added in v2.0.0 - -## takeWhile - -Calculate the longest initial subarray for which all element satisfy the specified predicate, creating a new `Array`. - -**Signature** - -```ts -export declare const takeWhile: { - (refinement: Refinement): (self: Iterable) => B[] - (predicate: Predicate): (self: Iterable) => B[] - (self: Iterable, refinement: Refinement): B[] - (self: Iterable, predicate: Predicate): B[] -} -``` - -Added in v2.0.0 - -## unappend - -Return a tuple containing a copy of the `NonEmptyReadonlyArray` without its last element, and that last element. - -**Signature** - -```ts -export declare const unappend: (self: readonly [A, ...A[]]) => [A[], A] -``` - -Added in v2.0.0 - -## unprepend - -Return a tuple containing the first element, and a new `Array` of the remaining elements, if any. - -**Signature** - -```ts -export declare const unprepend: (self: readonly [A, ...A[]]) => [A, A[]] -``` - -Added in v2.0.0 - -# grouping - -## group - -Group equal, consecutive elements of a `NonEmptyReadonlyArray` into `NonEmptyArray`s. - -**Signature** - -```ts -export declare const group: (self: readonly [A, ...A[]]) => [[A, ...A[]], ...[A, ...A[]][]] -``` - -Added in v2.0.0 - -## groupBy - -Splits an `Iterable` into sub-non-empty-arrays stored in an object, based on the result of calling a `string`-returning -function on each element, and grouping the results according to values returned - -**Signature** - -```ts -export declare const groupBy: { - (f: (a: A) => string): (self: Iterable) => Record - (self: Iterable, f: (a: A) => string): Record -} -``` - -Added in v2.0.0 - -## groupWith - -Group equal, consecutive elements of a `NonEmptyReadonlyArray` into `NonEmptyArray`s using the provided `isEquivalent` function. - -**Signature** - -```ts -export declare const groupWith: { - (isEquivalent: (self: A, that: A) => boolean): (self: readonly [A, ...A[]]) => [[A, ...A[]], ...[A, ...A[]][]] - (self: readonly [A, ...A[]], isEquivalent: (self: A, that: A) => boolean): [[A, ...A[]], ...[A, ...A[]][]] -} -``` - -Added in v2.0.0 - -# guards - -## isEmptyArray - -Determine if an `Array` is empty narrowing down the type to `[]`. - -**Signature** - -```ts -export declare const isEmptyArray: (self: A[]) => self is [] -``` - -**Example** - -```ts -import { isEmptyArray } from "effect/ReadonlyArray" - -assert.deepStrictEqual(isEmptyArray([]), true) -assert.deepStrictEqual(isEmptyArray([1, 2, 3]), false) -``` - -Added in v2.0.0 - -## isEmptyReadonlyArray - -Determine if a `ReadonlyArray` is empty narrowing down the type to `readonly []`. - -**Signature** - -```ts -export declare const isEmptyReadonlyArray: (self: readonly A[]) => self is readonly [] -``` - -**Example** - -```ts -import { isEmptyReadonlyArray } from "effect/ReadonlyArray" - -assert.deepStrictEqual(isEmptyReadonlyArray([]), true) -assert.deepStrictEqual(isEmptyReadonlyArray([1, 2, 3]), false) -``` - -Added in v2.0.0 - -## isNonEmptyArray - -Determine if an `Array` is non empty narrowing down the type to `NonEmptyArray`. - -An `Array` is considered to be a `NonEmptyArray` if it contains at least one element. - -**Signature** - -```ts -export declare const isNonEmptyArray: (self: A[]) => self is [A, ...A[]] -``` - -**Example** - -```ts -import { isNonEmptyArray } from "effect/ReadonlyArray" - -assert.deepStrictEqual(isNonEmptyArray([]), false) -assert.deepStrictEqual(isNonEmptyArray([1, 2, 3]), true) -``` - -Added in v2.0.0 - -## isNonEmptyReadonlyArray - -Determine if a `ReadonlyArray` is non empty narrowing down the type to `NonEmptyReadonlyArray`. - -A `ReadonlyArray` is considered to be a `NonEmptyReadonlyArray` if it contains at least one element. - -**Signature** - -```ts -export declare const isNonEmptyReadonlyArray: (self: readonly A[]) => self is readonly [A, ...A[]] -``` - -**Example** - -```ts -import { isNonEmptyReadonlyArray } from "effect/ReadonlyArray" - -assert.deepStrictEqual(isNonEmptyReadonlyArray([]), false) -assert.deepStrictEqual(isNonEmptyReadonlyArray([1, 2, 3]), true) -``` - -Added in v2.0.0 - -# instances - -## getEquivalence - -**Signature** - -```ts -export declare const getEquivalence: ( - isEquivalent: Equivalence.Equivalence -) => Equivalence.Equivalence -``` - -Added in v2.0.0 - -## getOrder - -This function creates and returns a new `Order` for an array of values based on a given `Order` for the elements of the array. -The returned `Order` compares two arrays by applying the given `Order` to each element in the arrays. -If all elements are equal, the arrays are then compared based on their length. -It is useful when you need to compare two arrays of the same type and you have a specific way of comparing each element of the array. - -**Signature** - -```ts -export declare const getOrder: (O: Order.Order) => Order.Order -``` - -Added in v2.0.0 - -# lifting - -## liftEither - -**Signature** - -```ts -export declare const liftEither: (f: (...a: A) => Either) => (...a: A) => B[] -``` - -Added in v2.0.0 - -## liftNullable - -**Signature** - -```ts -export declare const liftNullable: ( - f: (...a: A) => B | null | undefined -) => (...a: A) => NonNullable[] -``` - -Added in v2.0.0 - -## liftOption - -**Signature** - -```ts -export declare const liftOption: (f: (...a: A) => Option) => (...a: A) => B[] -``` - -Added in v2.0.0 - -## liftPredicate - -**Signature** - -```ts -export declare const liftPredicate: { - (refinement: Refinement): (c: C) => B[] - (predicate: Predicate): (b: B) => B[] -} -``` - -Added in v2.0.0 - -# mapping - -## map - -**Signature** - -```ts -export declare const map: { - (f: (a: ReadonlyArray.Infer, i: number) => B): (self: T) => ReadonlyArray.With - (self: T, f: (a: ReadonlyArray.Infer, i: number) => B): ReadonlyArray.With -} -``` - -Added in v2.0.0 - -# models - -## NonEmptyArray (type alias) - -**Signature** - -```ts -export type NonEmptyArray = [A, ...Array] -``` - -Added in v2.0.0 - -## NonEmptyReadonlyArray (type alias) - -**Signature** - -```ts -export type NonEmptyReadonlyArray = readonly [A, ...Array] -``` - -Added in v2.0.0 - -# pattern matching - -## match - -**Signature** - -```ts -export declare const match: { - (options: { - readonly onEmpty: LazyArg - readonly onNonEmpty: (self: readonly [A, ...A[]]) => C - }): (self: readonly A[]) => B | C - ( - self: readonly A[], - options: { readonly onEmpty: LazyArg; readonly onNonEmpty: (self: readonly [A, ...A[]]) => C } - ): B | C -} -``` - -Added in v2.0.0 - -## matchLeft - -**Signature** - -```ts -export declare const matchLeft: { - (options: { - readonly onEmpty: LazyArg - readonly onNonEmpty: (head: A, tail: A[]) => C - }): (self: readonly A[]) => B | C - ( - self: readonly A[], - options: { readonly onEmpty: LazyArg; readonly onNonEmpty: (head: A, tail: A[]) => C } - ): B | C -} -``` - -Added in v2.0.0 - -## matchRight - -**Signature** - -```ts -export declare const matchRight: { - (options: { - readonly onEmpty: LazyArg - readonly onNonEmpty: (init: A[], last: A) => C - }): (self: readonly A[]) => B | C - ( - self: readonly A[], - options: { readonly onEmpty: LazyArg; readonly onNonEmpty: (init: A[], last: A) => C } - ): B | C -} -``` - -Added in v2.0.0 - -# sequencing - -## flatMap - -**Signature** - -```ts -export declare const flatMap: { - (f: (a: A, i: number) => readonly B[]): (self: readonly A[]) => B[] - (self: readonly A[], f: (a: A, i: number) => readonly B[]): B[] -} -``` - -Added in v2.0.0 - -## flatMapNonEmpty - -**Signature** - -```ts -export declare const flatMapNonEmpty: { - (f: (a: A, i: number) => readonly [B, ...B[]]): (self: readonly [A, ...A[]]) => [B, ...B[]] - (self: readonly [A, ...A[]], f: (a: A, i: number) => readonly [B, ...B[]]): [B, ...B[]] -} -``` - -Added in v2.0.0 - -## flatten - -**Signature** - -```ts -export declare const flatten: (self: readonly (readonly A[])[]) => A[] -``` - -Added in v2.0.0 - -## flattenNonEmpty - -**Signature** - -```ts -export declare const flattenNonEmpty: ( - self: readonly [readonly [A, ...A[]], ...(readonly [A, ...A[]])[]] -) => [A, ...A[]] -``` - -Added in v2.0.0 - -# sorting - -## sort - -Sort the elements of an `Iterable` in increasing order, creating a new `Array`. - -**Signature** - -```ts -export declare const sort: { - (O: Order.Order): (self: Iterable) => A[] - (self: Iterable, O: Order.Order): A[] -} -``` - -Added in v2.0.0 - -## sortBy - -Sort the elements of an `Iterable` in increasing order, where elements are compared -using first `orders[0]`, then `orders[1]`, etc... - -**Signature** - -```ts -export declare const sortBy: (...orders: readonly Order.Order[]) => (self: Iterable) => A[] -``` - -Added in v2.0.0 - -## sortByNonEmpty - -**Signature** - -```ts -export declare const sortByNonEmpty: ( - ...orders: readonly Order.Order[] -) => (as: readonly [A, ...A[]]) => [A, ...A[]] -``` - -Added in v2.0.0 - -## sortNonEmpty - -Sort the elements of a `NonEmptyReadonlyArray` in increasing order, creating a new `NonEmptyArray`. - -**Signature** - -```ts -export declare const sortNonEmpty: { - (O: Order.Order): (self: readonly [A, ...A[]]) => [A, ...A[]] - (self: readonly [A, ...A[]], O: Order.Order): [A, ...A[]] -} -``` - -Added in v2.0.0 - -# type lambdas - -## ReadonlyArrayTypeLambda (interface) - -**Signature** - -```ts -export interface ReadonlyArrayTypeLambda extends TypeLambda { - readonly type: ReadonlyArray -} -``` - -Added in v2.0.0 - -# unsafe - -## unsafeGet - -Gets an element unsafely, will throw on out of bounds. - -**Signature** - -```ts -export declare const unsafeGet: { - (index: number): (self: readonly A[]) => A - (self: readonly A[], index: number): A -} -``` - -Added in v2.0.0 - -# utils - -## ReadonlyArray (namespace) - -Added in v2.0.0 - -### Infer (type alias) - -**Signature** - -```ts -export type Infer> = T[number] -``` - -Added in v2.0.0 - -### With (type alias) - -**Signature** - -```ts -export type With, A> = T extends NonEmptyReadonlyArray ? NonEmptyArray : Array -``` - -Added in v2.0.0 - -## chop - -A useful recursion pattern for processing an `Iterable` to produce a new `Array`, often used for "chopping" up the input -`Iterable`. Typically chop is called with some function that will consume an initial prefix of the `Iterable` and produce a -value and the rest of the `Array`. - -**Signature** - -```ts -export declare const chop: { - (f: (as: readonly [A, ...A[]]) => readonly [B, readonly A[]]): (self: Iterable) => B[] - (self: Iterable, f: (as: readonly [A, ...A[]]) => readonly [B, readonly A[]]): B[] -} -``` - -Added in v2.0.0 - -## chopNonEmpty - -A useful recursion pattern for processing a `NonEmptyReadonlyArray` to produce a new `NonEmptyReadonlyArray`, often used for "chopping" up the input -`NonEmptyReadonlyArray`. Typically `chop` is called with some function that will consume an initial prefix of the `NonEmptyReadonlyArray` and produce a -value and the tail of the `NonEmptyReadonlyArray`. - -**Signature** - -```ts -export declare const chopNonEmpty: { - (f: (as: readonly [A, ...A[]]) => readonly [B, readonly A[]]): (self: readonly [A, ...A[]]) => [B, ...B[]] - (self: readonly [A, ...A[]], f: (as: readonly [A, ...A[]]) => readonly [B, readonly A[]]): [B, ...B[]] -} -``` - -Added in v2.0.0 - -## copy - -**Signature** - -```ts -export declare const copy: { (self: readonly [A, ...A[]]): [A, ...A[]]; (self: readonly A[]): A[] } -``` - -Added in v2.0.0 - -## dedupe - -Remove duplicates from am `Iterable`, keeping the first occurrence of an element. - -**Signature** - -```ts -export declare const dedupe: (self: Iterable) => A[] -``` - -Added in v2.0.0 - -## dedupeAdjacent - -Deduplicates adjacent elements that are identical. - -**Signature** - -```ts -export declare const dedupeAdjacent: (self: Iterable) => A[] -``` - -Added in v2.0.0 - -## dedupeAdjacentWith - -Deduplicates adjacent elements that are identical using the provided `isEquivalent` function. - -**Signature** - -```ts -export declare const dedupeAdjacentWith: { - (isEquivalent: (self: A, that: A) => boolean): (self: Iterable) => A[] - (self: Iterable, isEquivalent: (self: A, that: A) => boolean): A[] -} -``` - -Added in v2.0.0 - -## dedupeNonEmpty - -Remove duplicates from a `NonEmptyReadonlyArray`, keeping the first occurrence of an element. - -**Signature** - -```ts -export declare const dedupeNonEmpty: (self: readonly [A, ...A[]]) => [A, ...A[]] -``` - -Added in v2.0.0 - -## dedupeNonEmptyWith - -Remove duplicates from a `NonEmptyReadonlyArray`, keeping the first occurrence of an element using the provided `isEquivalent` function. - -**Signature** - -```ts -export declare const dedupeNonEmptyWith: { - (isEquivalent: (self: A, that: A) => boolean): (self: readonly [A, ...A[]]) => [A, ...A[]] - (self: readonly [A, ...A[]], isEquivalent: (self: A, that: A) => boolean): [A, ...A[]] -} -``` - -Added in v2.0.0 - -## dedupeWith - -Remove duplicates from am `Iterable` using the provided `isEquivalent` function, keeping the first occurrence of an element. - -**Signature** - -```ts -export declare const dedupeWith: { - (isEquivalent: (self: A, that: A) => boolean): (self: Iterable) => A[] - (self: Iterable, isEquivalent: (self: A, that: A) => boolean): A[] -} -``` - -Added in v2.0.0 - -## difference - -Creates a `Array` of values not included in the other given `Iterable` using the provided `isEquivalent` function. -The order and references of result values are determined by the first `Iterable`. - -**Signature** - -```ts -export declare const difference: { - (that: Iterable): (self: Iterable) => A[] - (self: Iterable, that: Iterable): A[] -} -``` - -Added in v2.0.0 - -## differenceWith - -Creates a `Array` of values not included in the other given `Iterable` using the provided `isEquivalent` function. -The order and references of result values are determined by the first `Iterable`. - -**Signature** - -```ts -export declare const differenceWith: (isEquivalent: (self: A, that: A) => boolean) => { - (that: Iterable): (self: Iterable) => A[] - (self: Iterable, that: Iterable): A[] -} -``` - -Added in v2.0.0 - -## extend - -**Signature** - -```ts -export declare const extend: { - (f: (as: readonly A[]) => B): (self: readonly A[]) => B[] - (self: readonly A[], f: (as: readonly A[]) => B): B[] -} -``` - -Added in v2.0.0 - -## forEach - -Iterate over the `Iterable` applying `f`. - -**Signature** - -```ts -export declare const forEach: { - (f: (a: A, i: number) => void): (self: Iterable) => void - (self: Iterable, f: (a: A, i: number) => void): void -} -``` - -Added in v2.0.0 - -## insertAt - -Insert an element at the specified index, creating a new `NonEmptyArray`, -or return `None` if the index is out of bounds. - -**Signature** - -```ts -export declare const insertAt: { - (i: number, b: B): (self: Iterable) => Option<[B | A, ...(B | A)[]]> - (self: Iterable, i: number, b: B): Option<[A | B, ...(A | B)[]]> -} -``` - -Added in v2.0.0 - -## intersection - -Creates an `Array` of unique values that are included in all given `Iterable`s. -The order and references of result values are determined by the first `Iterable`. - -**Signature** - -```ts -export declare const intersection: { - (that: Iterable): (self: Iterable) => (A & B)[] - (self: Iterable, that: Iterable): (A & B)[] -} -``` - -Added in v2.0.0 - -## intersectionWith - -Creates an `Array` of unique values that are included in all given `Iterable`s using the provided `isEquivalent` function. -The order and references of result values are determined by the first `Iterable`. - -**Signature** - -```ts -export declare const intersectionWith: (isEquivalent: (self: A, that: A) => boolean) => { - (that: Iterable): (self: Iterable) => A[] - (self: Iterable, that: Iterable): A[] -} -``` - -Added in v2.0.0 - -## intersperse - -Places an element in between members of an `Iterable` - -**Signature** - -```ts -export declare const intersperse: { - (middle: B): (self: Iterable) => (B | A)[] - (self: Iterable, middle: B): (A | B)[] -} -``` - -Added in v2.0.0 - -## intersperseNonEmpty - -Places an element in between members of a `NonEmptyReadonlyArray` - -**Signature** - -```ts -export declare const intersperseNonEmpty: { - (middle: B): (self: readonly [A, ...A[]]) => [B | A, ...(B | A)[]] - (self: readonly [A, ...A[]], middle: B): [A | B, ...(A | B)[]] -} -``` - -Added in v2.0.0 - -## max - -**Signature** - -```ts -export declare const max: { - (O: Order.Order): (self: readonly [A, ...A[]]) => A - (self: readonly [A, ...A[]], O: Order.Order): A -} -``` - -Added in v2.0.0 - -## min - -**Signature** - -```ts -export declare const min: { - (O: Order.Order): (self: readonly [A, ...A[]]) => A - (self: readonly [A, ...A[]], O: Order.Order): A -} -``` - -Added in v2.0.0 - -## modify - -Apply a function to the element at the specified index, creating a new `Array`, -or return a copy of the input if the index is out of bounds. - -**Signature** - -```ts -export declare const modify: { - (i: number, f: (a: A) => B): (self: Iterable) => (A | B)[] - (self: Iterable, i: number, f: (a: A) => B): (A | B)[] -} -``` - -Added in v2.0.0 - -## modifyNonEmptyHead - -Apply a function to the head, creating a new `NonEmptyReadonlyArray`. - -**Signature** - -```ts -export declare const modifyNonEmptyHead: { - (f: (a: A) => B): (self: readonly [A, ...A[]]) => [A | B, ...(A | B)[]] - (self: readonly [A, ...A[]], f: (a: A) => B): [A | B, ...(A | B)[]] -} -``` - -Added in v2.0.0 - -## modifyNonEmptyLast - -Apply a function to the last element, creating a new `NonEmptyReadonlyArray`. - -**Signature** - -```ts -export declare const modifyNonEmptyLast: { - (f: (a: A) => B): (self: readonly [A, ...A[]]) => [A | B, ...(A | B)[]] - (self: readonly [A, ...A[]], f: (a: A) => B): [A | B, ...(A | B)[]] -} -``` - -Added in v2.0.0 - -## modifyOption - -Apply a function to the element at the specified index, creating a new `Array`, -or return `None` if the index is out of bounds. - -**Signature** - -```ts -export declare const modifyOption: { - (i: number, f: (a: A) => B): (self: Iterable) => Option<(A | B)[]> - (self: Iterable, i: number, f: (a: A) => B): Option<(A | B)[]> -} -``` - -Added in v2.0.0 - -## remove - -Delete the element at the specified index, creating a new `Array`, -or return a copy of the input if the index is out of bounds. - -**Signature** - -```ts -export declare const remove: { (i: number): (self: Iterable) => A[]; (self: Iterable, i: number): A[] } -``` - -Added in v2.0.0 - -## replace - -Change the element at the specified index, creating a new `Array`, -or return a copy of the input if the index is out of bounds. - -**Signature** - -```ts -export declare const replace: { - (i: number, b: B): (self: Iterable) => (B | A)[] - (self: Iterable, i: number, b: B): (A | B)[] -} -``` - -Added in v2.0.0 - -## replaceOption - -**Signature** - -```ts -export declare const replaceOption: { - (i: number, b: B): (self: Iterable) => Option<(B | A)[]> - (self: Iterable, i: number, b: B): Option<(A | B)[]> -} -``` - -Added in v2.0.0 - -## rotate - -Rotate an `Iterable` by `n` steps. - -**Signature** - -```ts -export declare const rotate: { (n: number): (self: Iterable) => A[]; (self: Iterable, n: number): A[] } -``` - -Added in v2.0.0 - -## rotateNonEmpty - -Rotate a `NonEmptyReadonlyArray` by `n` steps. - -**Signature** - -```ts -export declare const rotateNonEmpty: { - (n: number): (self: readonly [A, ...A[]]) => [A, ...A[]] - (self: readonly [A, ...A[]], n: number): [A, ...A[]] -} -``` - -Added in v2.0.0 - -## setNonEmptyHead - -Change the head, creating a new `NonEmptyReadonlyArray`. - -**Signature** - -```ts -export declare const setNonEmptyHead: { - (b: B): (self: readonly [A, ...A[]]) => [B | A, ...(B | A)[]] - (self: readonly [A, ...A[]], b: B): [A | B, ...(A | B)[]] -} -``` - -Added in v2.0.0 - -## setNonEmptyLast - -Change the last element, creating a new `NonEmptyReadonlyArray`. - -**Signature** - -```ts -export declare const setNonEmptyLast: { - (b: B): (self: readonly [A, ...A[]]) => [B | A, ...(B | A)[]] - (self: readonly [A, ...A[]], b: B): [A | B, ...(A | B)[]] -} -``` - -Added in v2.0.0 - -## union - -**Signature** - -```ts -export declare const union: { - (that: Iterable): (self: Iterable) => (B | A)[] - (self: Iterable, that: Iterable): (A | B)[] -} -``` - -Added in v2.0.0 - -## unionNonEmpty - -**Signature** - -```ts -export declare const unionNonEmpty: { - (that: readonly [A, ...A[]]): (self: readonly A[]) => [A, ...A[]] - (that: readonly A[]): (self: readonly [A, ...A[]]) => [A, ...A[]] - (self: readonly A[], that: readonly [A, ...A[]]): [A, ...A[]] - (self: readonly [A, ...A[]], that: readonly A[]): [A, ...A[]] -} -``` - -Added in v2.0.0 - -## unionNonEmptyWith - -**Signature** - -```ts -export declare const unionNonEmptyWith: (isEquivalent: (self: A, that: A) => boolean) => { - (that: readonly [A, ...A[]]): (self: readonly A[]) => [A, ...A[]] - (that: readonly A[]): (self: readonly [A, ...A[]]) => [A, ...A[]] - (self: readonly A[], that: readonly [A, ...A[]]): [A, ...A[]] - (self: readonly [A, ...A[]], that: readonly A[]): [A, ...A[]] -} -``` - -Added in v2.0.0 - -## unionWith - -**Signature** - -```ts -export declare const unionWith: (isEquivalent: (self: A, that: A) => boolean) => { - (that: Iterable): (self: Iterable) => A[] - (self: Iterable, that: Iterable): A[] -} -``` - -Added in v2.0.0 - -## unzip - -This function is the inverse of `zip`. Takes an `Iterable` of pairs and return two corresponding `Array`s. - -**Signature** - -```ts -export declare const unzip: (self: Iterable) => [A[], B[]] -``` - -Added in v2.0.0 - -## unzipNonEmpty - -**Signature** - -```ts -export declare const unzipNonEmpty: ( - self: readonly [readonly [A, B], ...(readonly [A, B])[]] -) => [[A, ...A[]], [B, ...B[]]] -``` - -Added in v2.0.0 - -## zip - -Takes two `Iterable`s and returns an `Array` of corresponding pairs. -If one input `Iterable` is short, excess elements of the -longer `Iterable` are discarded. - -**Signature** - -```ts -export declare const zip: { - (that: Iterable): (self: Iterable) => [A, B][] - (self: Iterable, that: Iterable): [A, B][] -} -``` - -Added in v2.0.0 - -## zipNonEmpty - -**Signature** - -```ts -export declare const zipNonEmpty: { - (that: readonly [B, ...B[]]): (self: readonly [A, ...A[]]) => [[A, B], ...[A, B][]] - (self: readonly [A, ...A[]], that: readonly [B, ...B[]]): [[A, B], ...[A, B][]] -} -``` - -Added in v2.0.0 - -## zipNonEmptyWith - -**Signature** - -```ts -export declare const zipNonEmptyWith: { - (that: readonly [B, ...B[]], f: (a: A, b: B) => C): (self: readonly [A, ...A[]]) => [C, ...C[]] - (self: readonly [A, ...A[]], that: readonly [B, ...B[]], f: (a: A, b: B) => C): [C, ...C[]] -} -``` - -Added in v2.0.0 - -## zipWith - -Apply a function to pairs of elements at the same index in two `Iterable`s, collecting the results in a new `Array`. If one -input `Iterable` is short, excess elements of the longer `Iterable` are discarded. - -**Signature** - -```ts -export declare const zipWith: { - (that: Iterable, f: (a: A, b: B) => C): (self: Iterable) => C[] - (self: Iterable, that: Iterable, f: (a: A, b: B) => C): C[] -} -``` - -Added in v2.0.0 diff --git a/docs/modules/ReadonlyRecord.ts.md b/docs/modules/ReadonlyRecord.ts.md deleted file mode 100644 index 04981447f..000000000 --- a/docs/modules/ReadonlyRecord.ts.md +++ /dev/null @@ -1,882 +0,0 @@ ---- -title: ReadonlyRecord.ts -nav_order: 83 -parent: Modules ---- - -## ReadonlyRecord overview - -This module provides utility functions for working with records in TypeScript. - -Added in v2.0.0 - ---- - -

Table of contents

- -- [constructors](#constructors) - - [empty](#empty) - - [singleton](#singleton) -- [conversions](#conversions) - - [collect](#collect) - - [fromEntries](#fromentries) - - [fromIterable](#fromiterable) - - [toEntries](#toentries) -- [filtering](#filtering) - - [compact](#compact) - - [filter](#filter) - - [partition](#partition) - - [partitionMap](#partitionmap) - - [separate](#separate) -- [folding](#folding) - - [reduce](#reduce) -- [guards](#guards) - - [isEmptyReadonlyRecord](#isemptyreadonlyrecord) - - [isEmptyRecord](#isemptyrecord) -- [instances](#instances) - - [getEquivalence](#getequivalence) -- [models](#models) - - [ReadonlyRecord (interface)](#readonlyrecord-interface) -- [record](#record) - - [pop](#pop) -- [type lambdas](#type-lambdas) - - [ReadonlyRecordTypeLambda (interface)](#readonlyrecordtypelambda-interface) -- [utils](#utils) - - [difference](#difference) - - [every](#every) - - [filterMap](#filtermap) - - [get](#get) - - [has](#has) - - [intersection](#intersection) - - [isSubrecord](#issubrecord) - - [isSubrecordBy](#issubrecordby) - - [keys](#keys) - - [map](#map) - - [modifyOption](#modifyoption) - - [remove](#remove) - - [replaceOption](#replaceoption) - - [size](#size) - - [some](#some) - - [union](#union) - - [update](#update) - - [upsert](#upsert) - - [values](#values) - ---- - -# constructors - -## empty - -Creates a new, empty record. - -**Signature** - -```ts -export declare const empty:
() => Record -``` - -Added in v2.0.0 - -## singleton - -Create a non-empty record from a single element. - -**Signature** - -```ts -export declare const singleton: (key: K, value: A) => Record -``` - -Added in v2.0.0 - -# conversions - -## collect - -Transforms the values of a record into an `Array` with a custom mapping function. - -**Signature** - -```ts -export declare const collect: { - (f: (key: K, a: A) => B): (self: Record) => B[] - (self: Record, f: (key: K, a: A) => B): B[] -} -``` - -**Example** - -```ts -import { collect } from "effect/ReadonlyRecord" - -const x = { a: 1, b: 2, c: 3 } -assert.deepStrictEqual( - collect(x, (key, n) => [key, n]), - [ - ["a", 1], - ["b", 2], - ["c", 3] - ] -) -``` - -Added in v2.0.0 - -## fromEntries - -Builds a record from an iterable of key-value pairs. - -If there are conflicting keys when using `fromEntries`, the last occurrence of the key/value pair will overwrite the -previous ones. So the resulting record will only have the value of the last occurrence of each key. - -**Signature** - -```ts -export declare const fromEntries: (self: Iterable) => Record -``` - -**Example** - -```ts -import { fromEntries } from "effect/ReadonlyRecord" - -const input: Array<[string, number]> = [ - ["a", 1], - ["b", 2] -] - -assert.deepStrictEqual(fromEntries(input), { a: 1, b: 2 }) -``` - -Added in v2.0.0 - -## fromIterable - -Takes an iterable and a projection function and returns a record. -The projection function maps each value of the iterable to a tuple of a key and a value, which is then added to the resulting record. - -**Signature** - -```ts -export declare const fromIterable: { - (f: (a: A) => readonly [string, B]): (self: Iterable) => Record - (self: Iterable, f: (a: A) => readonly [string, B]): Record -} -``` - -**Example** - -```ts -import { fromIterable } from "effect/ReadonlyRecord" - -const input = [1, 2, 3, 4] - -assert.deepStrictEqual( - fromIterable(input, (a) => [String(a), a * 2]), - { "1": 2, "2": 4, "3": 6, "4": 8 } -) -``` - -Added in v2.0.0 - -## toEntries - -Takes a record and returns an array of tuples containing its keys and values. - -**Signature** - -```ts -export declare const toEntries: (self: Record) => [K, A][] -``` - -**Example** - -```ts -import { toEntries } from "effect/ReadonlyRecord" - -const x = { a: 1, b: 2, c: 3 } -assert.deepStrictEqual(toEntries(x), [ - ["a", 1], - ["b", 2], - ["c", 3] -]) -``` - -Added in v2.0.0 - -# filtering - -## compact - -Given a record with `Option` values, returns a record with only the `Some` values, with the same keys. - -**Signature** - -```ts -export declare const compact: (self: ReadonlyRecord>) => Record -``` - -**Example** - -```ts -import { compact } from "effect/ReadonlyRecord" -import { some, none } from "effect/Option" - -assert.deepStrictEqual(compact({ a: some(1), b: none(), c: some(2) }), { a: 1, c: 2 }) -``` - -Added in v2.0.0 - -## filter - -Selects properties from a record whose values match the given predicate. - -**Signature** - -```ts -export declare const filter: { - ( - refinement: (a: A, key: K) => a is B - ): (self: Record) => Record - ( - predicate: (a: A, key: K) => boolean - ): (self: Record) => Record - ( - self: Record, - refinement: (a: A, key: K) => a is B - ): Record - (self: Record, predicate: (a: A, key: K) => boolean): Record -} -``` - -**Example** - -```ts -import { filter } from "effect/ReadonlyRecord" - -const x = { a: 1, b: 2, c: 3, d: 4 } -assert.deepStrictEqual( - filter(x, (n) => n > 2), - { c: 3, d: 4 } -) -``` - -Added in v2.0.0 - -## partition - -Partitions a record into two separate records based on the result of a predicate function. - -**Signature** - -```ts -export declare const partition: { - ( - refinement: (a: A, key: K) => a is B - ): (self: Record) => [Record, Record] - ( - predicate: (a: A, key: K) => boolean - ): (self: Record) => [Record, Record] - ( - self: Record, - refinement: (a: A, key: K) => a is B - ): [Record, Record] - ( - self: Record, - predicate: (a: A, key: K) => boolean - ): [Record, Record] -} -``` - -**Example** - -```ts -import { partition } from "effect/ReadonlyRecord" - -assert.deepStrictEqual( - partition({ a: 1, b: 3 }, (n) => n > 2), - [{ a: 1 }, { b: 3 }] -) -``` - -Added in v2.0.0 - -## partitionMap - -Partitions the elements of a record into two groups: those that match a predicate, and those that don't. - -**Signature** - -```ts -export declare const partitionMap: { - ( - f: (a: A, key: K) => Either - ): (self: Record) => [Record, Record] - ( - self: Record, - f: (a: A, key: K) => Either - ): [Record, Record] -} -``` - -**Example** - -```ts -import { partitionMap } from "effect/ReadonlyRecord" -import { left, right } from "effect/Either" - -const x = { a: 1, b: 2, c: 3 } -const f = (n: number) => (n % 2 === 0 ? right(n) : left(n)) -assert.deepStrictEqual(partitionMap(x, f), [{ a: 1, c: 3 }, { b: 2 }]) -``` - -Added in v2.0.0 - -## separate - -Partitions a record of `Either` values into two separate records, -one with the `Left` values and one with the `Right` values. - -**Signature** - -```ts -export declare const separate: (self: ReadonlyRecord>) => [Record, Record] -``` - -**Example** - -```ts -import { separate } from "effect/ReadonlyRecord" -import { left, right } from "effect/Either" - -assert.deepStrictEqual(separate({ a: left("e"), b: right(1) }), [{ a: "e" }, { b: 1 }]) -``` - -Added in v2.0.0 - -# folding - -## reduce - -Reduce a record to a single value by combining its entries with a specified function. - -**Signature** - -```ts -export declare const reduce: { - (zero: Z, f: (accumulator: Z, value: V, key: K) => Z): (self: Record) => Z - (self: Record, zero: Z, f: (accumulator: Z, value: V, key: K) => Z): Z -} -``` - -Added in v2.0.0 - -# guards - -## isEmptyReadonlyRecord - -Determine if a record is empty. - -**Signature** - -```ts -export declare const isEmptyReadonlyRecord: (self: ReadonlyRecord) => self is ReadonlyRecord -``` - -**Example** - -```ts -import { isEmptyReadonlyRecord } from "effect/ReadonlyRecord" - -assert.deepStrictEqual(isEmptyReadonlyRecord({}), true) -assert.deepStrictEqual(isEmptyReadonlyRecord({ a: 3 }), false) -``` - -Added in v2.0.0 - -## isEmptyRecord - -Determine if a record is empty. - -**Signature** - -```ts -export declare const isEmptyRecord: (self: Record) => self is Record -``` - -**Example** - -```ts -import { isEmptyRecord } from "effect/ReadonlyRecord" - -assert.deepStrictEqual(isEmptyRecord({}), true) -assert.deepStrictEqual(isEmptyRecord({ a: 3 }), false) -``` - -Added in v2.0.0 - -# instances - -## getEquivalence - -Create an `Equivalence` for records using the provided `Equivalence` for values. - -**Signature** - -```ts -export declare const getEquivalence: (equivalence: Equivalence) => Equivalence> -``` - -Added in v2.0.0 - -# models - -## ReadonlyRecord (interface) - -**Signature** - -```ts -export interface ReadonlyRecord { - readonly [x: string]: A -} -``` - -Added in v2.0.0 - -# record - -## pop - -Retrieves the value of the property with the given `key` from a record and returns an `Option` -of a tuple with the value and the record with the removed property. -If the key is not present, returns `O.none`. - -**Signature** - -```ts -export declare const pop: { - (key: string): (self: ReadonlyRecord) => Option.Option<[A, Record]> - (self: ReadonlyRecord, key: string): Option.Option<[A, Record]> -} -``` - -**Example** - -```ts -import { pop } from "effect/ReadonlyRecord" -import { some, none } from "effect/Option" - -assert.deepStrictEqual(pop({ a: 1, b: 2 }, "a"), some([1, { b: 2 }])) -assert.deepStrictEqual(pop({ a: 1, b: 2 }, "c"), none()) -``` - -Added in v2.0.0 - -# type lambdas - -## ReadonlyRecordTypeLambda (interface) - -**Signature** - -```ts -export interface ReadonlyRecordTypeLambda extends TypeLambda { - readonly type: ReadonlyRecord -} -``` - -Added in v2.0.0 - -# utils - -## difference - -Merge two records, preserving only the entries that are unique to each record. - -**Signature** - -```ts -export declare const difference: { - (that: ReadonlyRecord): (self: ReadonlyRecord) => Record - (self: ReadonlyRecord, that: ReadonlyRecord): Record -} -``` - -Added in v2.0.0 - -## every - -Check if all entries in a record meet a specific condition. - -**Signature** - -```ts -export declare const every: { - (predicate: (value: A, key: K) => boolean): (self: Record) => boolean - (self: Record, predicate: (value: A, key: K) => boolean): boolean -} -``` - -Added in v2.0.0 - -## filterMap - -Transforms a record into a record by applying the function `f` to each key and value in the original record. -If the function returns `Some`, the key-value pair is included in the output record. - -**Signature** - -```ts -export declare const filterMap: { - (f: (a: A, key: K) => Option.Option): (self: Record) => Record - (self: Record, f: (a: A, key: K) => Option.Option): Record -} -``` - -**Example** - -```ts -import { filterMap } from "effect/ReadonlyRecord" -import { some, none } from "effect/Option" - -const x = { a: 1, b: 2, c: 3 } -const f = (a: number, key: string) => (a > 2 ? some(a * 2) : none()) -assert.deepStrictEqual(filterMap(x, f), { c: 6 }) -``` - -Added in v2.0.0 - -## get - -Retrieve a value at a particular key from a record, returning it wrapped in an `Option`. - -**Signature** - -```ts -export declare const get: { - (key: string): (self: ReadonlyRecord) => Option.Option - (self: ReadonlyRecord, key: string): Option.Option -} -``` - -**Example** - -```ts -import { get } from "effect/ReadonlyRecord" -import { some, none } from "effect/Option" - -const person = { name: "John Doe", age: 35 } - -assert.deepStrictEqual(get(person, "name"), some("John Doe")) -assert.deepStrictEqual(get(person, "email"), none()) -``` - -Added in v2.0.0 - -## has - -Check if a given `key` exists in a record. - -**Signature** - -```ts -export declare const has: { - (key: string): (self: ReadonlyRecord) => boolean - (self: ReadonlyRecord, key: string): boolean -} -``` - -**Example** - -```ts -import { has } from "effect/ReadonlyRecord" - -assert.deepStrictEqual(has({ a: 1, b: 2 }, "a"), true) -assert.deepStrictEqual(has({ a: 1, b: 2 }, "c"), false) -``` - -Added in v2.0.0 - -## intersection - -Merge two records, retaining only the entries that exist in both records. - -**Signature** - -```ts -export declare const intersection: { - ( - that: ReadonlyRecord, - combine: (selfValue: A, thatValue: A) => A - ): (self: ReadonlyRecord) => Record - (self: ReadonlyRecord, that: ReadonlyRecord, combine: (selfValue: A, thatValue: A) => A): Record -} -``` - -Added in v2.0.0 - -## isSubrecord - -Check if one record is a subrecord of another, meaning it contains all the keys and values found in the second record. -This comparison uses default equality checks (`Equal.equivalence()`). - -**Signature** - -```ts -export declare const isSubrecord: { - (that: ReadonlyRecord): (self: ReadonlyRecord) => boolean - (self: ReadonlyRecord, that: ReadonlyRecord): boolean -} -``` - -Added in v2.0.0 - -## isSubrecordBy - -Check if all the keys and values in one record are also found in another record. - -**Signature** - -```ts -export declare const isSubrecordBy: (equivalence: Equivalence) => { - (that: ReadonlyRecord): (self: ReadonlyRecord) => boolean - (self: ReadonlyRecord, that: ReadonlyRecord): boolean -} -``` - -Added in v2.0.0 - -## keys - -Retrieve the keys of a given record as an array. - -**Signature** - -```ts -export declare const keys: (self: ReadonlyRecord) => Array -``` - -Added in v2.0.0 - -## map - -Maps a record into another record by applying a transformation function to each of its values. - -**Signature** - -```ts -export declare const map: { - (f: (a: A, key: K) => B): (self: Record) => Record - (self: Record, f: (a: A, key: K) => B): Record -} -``` - -**Example** - -```ts -import { map } from "effect/ReadonlyRecord" - -const f = (n: number) => `-${n}` - -assert.deepStrictEqual(map({ a: 3, b: 5 }, f), { a: "-3", b: "-5" }) - -const g = (n: number, key: string) => `${key.toUpperCase()}-${n}` - -assert.deepStrictEqual(map({ a: 3, b: 5 }, g), { a: "A-3", b: "B-5" }) -``` - -Added in v2.0.0 - -## modifyOption - -Apply a function to the element at the specified key, creating a new record, -or return `None` if the key doesn't exist. - -**Signature** - -```ts -export declare const modifyOption: { - (key: string, f: (a: A) => B): (self: ReadonlyRecord) => Option.Option> - (self: ReadonlyRecord, key: string, f: (a: A) => B): Option.Option> -} -``` - -**Example** - -```ts -import { modifyOption } from "effect/ReadonlyRecord" -import { some, none } from "effect/Option" - -const f = (x: number) => x * 2 - -assert.deepStrictEqual(modifyOption({ a: 3 }, "a", f), some({ a: 6 })) -assert.deepStrictEqual(modifyOption({ a: 3 }, "b", f), none()) -``` - -Added in v2.0.0 - -## remove - -Removes a key from a record and returns a new record - -**Signature** - -```ts -export declare const remove: { - (key: string): (self: ReadonlyRecord) => Record - (self: ReadonlyRecord, key: string): Record -} -``` - -**Example** - -```ts -import { remove } from "effect/ReadonlyRecord" - -assert.deepStrictEqual(remove({ a: 1, b: 2 }, "a"), { b: 2 }) -``` - -Added in v2.0.0 - -## replaceOption - -Replaces a value in the record with the new value passed as parameter. - -**Signature** - -```ts -export declare const replaceOption: { - (key: string, b: B): (self: ReadonlyRecord) => Option.Option> - (self: ReadonlyRecord, key: string, b: B): Option.Option> -} -``` - -**Example** - -```ts -import { replaceOption } from "effect/ReadonlyRecord" -import { some, none } from "effect/Option" - -assert.deepStrictEqual(replaceOption({ a: 1, b: 2, c: 3 }, "a", 10), some({ a: 10, b: 2, c: 3 })) -assert.deepStrictEqual(replaceOption({}, "a", 10), none()) -``` - -Added in v2.0.0 - -## size - -Returns the number of key/value pairs in a record. - -**Signature** - -```ts -export declare const size: (self: ReadonlyRecord) => number -``` - -**Example** - -```ts -import { size } from "effect/ReadonlyRecord" - -assert.deepStrictEqual(size({ a: "a", b: 1, c: true }), 3) -``` - -Added in v2.0.0 - -## some - -Check if any entry in a record meets a specific condition. - -**Signature** - -```ts -export declare const some: { - (predicate: (value: A, key: K) => boolean): (self: Record) => boolean - (self: Record, predicate: (value: A, key: K) => boolean): boolean -} -``` - -Added in v2.0.0 - -## union - -Merge two records, preserving entries that exist in either of the records. - -**Signature** - -```ts -export declare const union: { - ( - that: Record, - combine: (selfValue: V0, thatValue: V1) => V0 | V1 - ): (self: Record) => Record - ( - self: Record, - that: Record, - combine: (selfValue: V0, thatValue: V1) => V0 | V1 - ): Record -} -``` - -Added in v2.0.0 - -## update - -Replace a key's value in a record and return the updated record. - -**Signature** - -```ts -export declare const update: { - (key: string, value: B): (self: ReadonlyRecord) => Record - (self: ReadonlyRecord, key: string, value: B): Record -} -``` - -**Example** - -```ts -import { update } from "effect/ReadonlyRecord" -import { some, none } from "effect/Option" - -assert.deepStrictEqual(update("a", 3)({ a: 1, b: 2 }), { a: 3, b: 2 }) -assert.deepStrictEqual(update("c", 3)({ a: 1, b: 2 }), { a: 1, b: 2 }) -``` - -Added in v2.0.0 - -## upsert - -Add a new key-value pair or update an existing key's value in a record. - -**Signature** - -```ts -export declare const upsert: { - (key: string, value: B): (self: ReadonlyRecord) => Record - (self: ReadonlyRecord, key: string, value: B): Record -} -``` - -**Example** - -```ts -import { upsert } from "effect/ReadonlyRecord" - -assert.deepStrictEqual(upsert("a", 5)({ a: 1, b: 2 }), { a: 5, b: 2 }) -assert.deepStrictEqual(upsert("c", 5)({ a: 1, b: 2 }), { a: 1, b: 2, c: 5 }) -``` - -Added in v2.0.0 - -## values - -Retrieve the values of a given record as an array. - -**Signature** - -```ts -export declare const values: (self: ReadonlyRecord) => A[] -``` - -Added in v2.0.0 diff --git a/docs/modules/RedBlackTree.ts.md b/docs/modules/RedBlackTree.ts.md deleted file mode 100644 index 5442663a5..000000000 --- a/docs/modules/RedBlackTree.ts.md +++ /dev/null @@ -1,637 +0,0 @@ ---- -title: RedBlackTree.ts -nav_order: 84 -parent: Modules ---- - -## RedBlackTree overview - -Added in v2.0.0 - ---- - -

Table of contents

- -- [constants](#constants) - - [Direction](#direction) -- [constructors](#constructors) - - [empty](#empty) - - [fromIterable](#fromiterable) - - [make](#make) -- [elements](#elements) - - [findAll](#findall) - - [findFirst](#findfirst) - - [getAt](#getat) - - [has](#has) -- [folding](#folding) - - [reduce](#reduce) -- [getters](#getters) - - [first](#first) - - [getOrder](#getorder) - - [keys](#keys) - - [keysReversed](#keysreversed) - - [last](#last) - - [size](#size) - - [values](#values) - - [valuesReversed](#valuesreversed) -- [models](#models) - - [RedBlackTree (interface)](#redblacktree-interface) -- [refinements](#refinements) - - [isRedBlackTree](#isredblacktree) -- [symbol](#symbol) - - [TypeId (type alias)](#typeid-type-alias) -- [traversing](#traversing) - - [at](#at) - - [atReversed](#atreversed) - - [forEach](#foreach) - - [forEachBetween](#foreachbetween) - - [forEachGreaterThanEqual](#foreachgreaterthanequal) - - [forEachLessThan](#foreachlessthan) - - [greaterThan](#greaterthan) - - [greaterThanEqual](#greaterthanequal) - - [greaterThanEqualReversed](#greaterthanequalreversed) - - [greaterThanReversed](#greaterthanreversed) - - [lessThan](#lessthan) - - [lessThanEqual](#lessthanequal) - - [lessThanEqualReversed](#lessthanequalreversed) - - [lessThanReversed](#lessthanreversed) - - [reversed](#reversed) -- [utils](#utils) - - [RedBlackTree (namespace)](#redblacktree-namespace) - - [Direction (type alias)](#direction-type-alias) - - [insert](#insert) - - [removeFirst](#removefirst) - ---- - -# constants - -## Direction - -**Signature** - -```ts -export declare const Direction: { readonly Forward: RedBlackTree.Direction; readonly Backward: RedBlackTree.Direction } -``` - -Added in v2.0.0 - -# constructors - -## empty - -Creates an empty `RedBlackTree`. - -**Signature** - -```ts -export declare const empty: (ord: Order) => RedBlackTree -``` - -Added in v2.0.0 - -## fromIterable - -Constructs a new tree from an iterable of key-value pairs. - -**Signature** - -```ts -export declare const fromIterable: { - (ord: Order): (entries: Iterable) => RedBlackTree - (entries: Iterable, ord: Order): RedBlackTree -} -``` - -Added in v2.0.0 - -## make - -Constructs a new `RedBlackTree` from the specified entries. - -**Signature** - -```ts -export declare const make: ( - ord: Order -) => ( - ...entries: Entries -) => RedBlackTree -``` - -Added in v2.0.0 - -# elements - -## findAll - -Finds all values in the tree associated with the specified key. - -**Signature** - -```ts -export declare const findAll: { - (key: K): (self: RedBlackTree) => Chunk - (self: RedBlackTree, key: K): Chunk -} -``` - -Added in v2.0.0 - -## findFirst - -Finds the first value in the tree associated with the specified key, if it exists. - -**Signature** - -```ts -export declare const findFirst: { - (key: K): (self: RedBlackTree) => Option - (self: RedBlackTree, key: K): Option -} -``` - -Added in v2.0.0 - -## getAt - -Returns the element at the specified index within the tree or `None` if the -specified index does not exist. - -**Signature** - -```ts -export declare const getAt: { - (index: number): (self: RedBlackTree) => Option<[K, V]> - (self: RedBlackTree, index: number): Option<[K, V]> -} -``` - -Added in v2.0.0 - -## has - -Finds the item with key, if it exists. - -**Signature** - -```ts -export declare const has: { - (key: K): (self: RedBlackTree) => boolean - (self: RedBlackTree, key: K): boolean -} -``` - -Added in v2.0.0 - -# folding - -## reduce - -Reduce a state over the entries of the tree. - -**Signature** - -```ts -export declare const reduce: { - (zero: Z, f: (accumulator: Z, value: V, key: K) => Z): (self: RedBlackTree) => Z - (self: RedBlackTree, zero: Z, f: (accumulator: Z, value: V, key: K) => Z): Z -} -``` - -Added in v2.0.0 - -# getters - -## first - -Returns the first entry in the tree, if it exists. - -**Signature** - -```ts -export declare const first: (self: RedBlackTree) => Option<[K, V]> -``` - -Added in v2.0.0 - -## getOrder - -Gets the `Order` that the `RedBlackTree` is using. - -**Signature** - -```ts -export declare const getOrder: (self: RedBlackTree) => Order -``` - -Added in v2.0.0 - -## keys - -Get all the keys present in the tree in order. - -**Signature** - -```ts -export declare const keys: (self: RedBlackTree) => IterableIterator -``` - -Added in v2.0.0 - -## keysReversed - -Get all the keys present in the tree in reverse order. - -**Signature** - -```ts -export declare const keysReversed: (self: RedBlackTree) => IterableIterator -``` - -Added in v2.0.0 - -## last - -Returns the last entry in the tree, if it exists. - -**Signature** - -```ts -export declare const last: (self: RedBlackTree) => Option<[K, V]> -``` - -Added in v2.0.0 - -## size - -Returns the size of the tree. - -**Signature** - -```ts -export declare const size: (self: RedBlackTree) => number -``` - -Added in v2.0.0 - -## values - -Get all values present in the tree in order. - -**Signature** - -```ts -export declare const values: (self: RedBlackTree) => IterableIterator -``` - -Added in v2.0.0 - -## valuesReversed - -Get all values present in the tree in reverse order. - -**Signature** - -```ts -export declare const valuesReversed: (self: RedBlackTree) => IterableIterator -``` - -Added in v2.0.0 - -# models - -## RedBlackTree (interface) - -A Red-Black Tree. - -**Signature** - -```ts -export interface RedBlackTree extends Iterable<[Key, Value]>, Equal, Pipeable, Inspectable { - readonly [TypeId]: TypeId -} -``` - -Added in v2.0.0 - -# refinements - -## isRedBlackTree - -**Signature** - -```ts -export declare const isRedBlackTree: { - (u: Iterable): u is RedBlackTree - (u: unknown): u is RedBlackTree -} -``` - -Added in v2.0.0 - -# symbol - -## TypeId (type alias) - -**Signature** - -```ts -export type TypeId = typeof TypeId -``` - -Added in v2.0.0 - -# traversing - -## at - -Returns an iterator that points to the element at the specified index of the -tree. - -**Note**: The iterator will run through elements in order. - -**Signature** - -```ts -export declare const at: { - (index: number): (self: RedBlackTree) => Iterable<[K, V]> - (self: RedBlackTree, index: number): Iterable<[K, V]> -} -``` - -Added in v2.0.0 - -## atReversed - -Returns an iterator that points to the element at the specified index of the -tree. - -**Note**: The iterator will run through elements in reverse order. - -**Signature** - -```ts -export declare const atReversed: { - (index: number): (self: RedBlackTree) => Iterable<[K, V]> - (self: RedBlackTree, index: number): Iterable<[K, V]> -} -``` - -Added in v2.0.0 - -## forEach - -Execute the specified function for each node of the tree, in order. - -**Signature** - -```ts -export declare const forEach: { - (f: (key: K, value: V) => void): (self: RedBlackTree) => void - (self: RedBlackTree, f: (key: K, value: V) => void): void -} -``` - -Added in v2.0.0 - -## forEachBetween - -Visit each node of the tree in order with key lower than max and greater -than or equal to min. - -**Signature** - -```ts -export declare const forEachBetween: { - (options: { - readonly min: K - readonly max: K - readonly body: (key: K, value: V) => void - }): (self: RedBlackTree) => void - ( - self: RedBlackTree, - options: { readonly min: K; readonly max: K; readonly body: (key: K, value: V) => void } - ): void -} -``` - -Added in v2.0.0 - -## forEachGreaterThanEqual - -Visit each node of the tree in order with key greater then or equal to max. - -**Signature** - -```ts -export declare const forEachGreaterThanEqual: { - (min: K, f: (key: K, value: V) => void): (self: RedBlackTree) => void - (self: RedBlackTree, min: K, f: (key: K, value: V) => void): void -} -``` - -Added in v2.0.0 - -## forEachLessThan - -Visit each node of the tree in order with key lower then max. - -**Signature** - -```ts -export declare const forEachLessThan: { - (max: K, f: (key: K, value: V) => void): (self: RedBlackTree) => void - (self: RedBlackTree, max: K, f: (key: K, value: V) => void): void -} -``` - -Added in v2.0.0 - -## greaterThan - -Returns an iterator that traverse entries in order with keys greater than the -specified key. - -**Signature** - -```ts -export declare const greaterThan: { - (key: K): (self: RedBlackTree) => Iterable<[K, V]> - (self: RedBlackTree, key: K): Iterable<[K, V]> -} -``` - -Added in v2.0.0 - -## greaterThanEqual - -Returns an iterator that traverse entries in order with keys greater than or -equal to the specified key. - -**Signature** - -```ts -export declare const greaterThanEqual: { - (key: K): (self: RedBlackTree) => Iterable<[K, V]> - (self: RedBlackTree, key: K): Iterable<[K, V]> -} -``` - -Added in v2.0.0 - -## greaterThanEqualReversed - -Returns an iterator that traverse entries in reverse order with keys greater -than or equal to the specified key. - -**Signature** - -```ts -export declare const greaterThanEqualReversed: { - (key: K): (self: RedBlackTree) => Iterable<[K, V]> - (self: RedBlackTree, key: K): Iterable<[K, V]> -} -``` - -Added in v2.0.0 - -## greaterThanReversed - -Returns an iterator that traverse entries in reverse order with keys greater -than the specified key. - -**Signature** - -```ts -export declare const greaterThanReversed: { - (key: K): (self: RedBlackTree) => Iterable<[K, V]> - (self: RedBlackTree, key: K): Iterable<[K, V]> -} -``` - -Added in v2.0.0 - -## lessThan - -Returns an iterator that traverse entries in order with keys less than the -specified key. - -**Signature** - -```ts -export declare const lessThan: { - (key: K): (self: RedBlackTree) => Iterable<[K, V]> - (self: RedBlackTree, key: K): Iterable<[K, V]> -} -``` - -Added in v2.0.0 - -## lessThanEqual - -Returns an iterator that traverse entries in order with keys less than or -equal to the specified key. - -**Signature** - -```ts -export declare const lessThanEqual: { - (key: K): (self: RedBlackTree) => Iterable<[K, V]> - (self: RedBlackTree, key: K): Iterable<[K, V]> -} -``` - -Added in v2.0.0 - -## lessThanEqualReversed - -Returns an iterator that traverse entries in reverse order with keys less -than or equal to the specified key. - -**Signature** - -```ts -export declare const lessThanEqualReversed: { - (key: K): (self: RedBlackTree) => Iterable<[K, V]> - (self: RedBlackTree, key: K): Iterable<[K, V]> -} -``` - -Added in v2.0.0 - -## lessThanReversed - -Returns an iterator that traverse entries in reverse order with keys less -than the specified key. - -**Signature** - -```ts -export declare const lessThanReversed: { - (key: K): (self: RedBlackTree) => Iterable<[K, V]> - (self: RedBlackTree, key: K): Iterable<[K, V]> -} -``` - -Added in v2.0.0 - -## reversed - -Traverse the tree in reverse order. - -**Signature** - -```ts -export declare const reversed: (self: RedBlackTree) => Iterable<[K, V]> -``` - -Added in v2.0.0 - -# utils - -## RedBlackTree (namespace) - -Added in v2.0.0 - -### Direction (type alias) - -**Signature** - -```ts -export type Direction = number & { - readonly Direction: unique symbol -} -``` - -Added in v2.0.0 - -## insert - -Insert a new item into the tree. - -**Signature** - -```ts -export declare const insert: { - (key: K, value: V): (self: RedBlackTree) => RedBlackTree - (self: RedBlackTree, key: K, value: V): RedBlackTree -} -``` - -Added in v2.0.0 - -## removeFirst - -Removes the entry with the specified key, if it exists. - -**Signature** - -```ts -export declare const removeFirst: { - (key: K): (self: RedBlackTree) => RedBlackTree - (self: RedBlackTree, key: K): RedBlackTree -} -``` - -Added in v2.0.0 diff --git a/docs/modules/Ref.ts.md b/docs/modules/Ref.ts.md deleted file mode 100644 index d7a4ce7b7..000000000 --- a/docs/modules/Ref.ts.md +++ /dev/null @@ -1,276 +0,0 @@ ---- -title: Ref.ts -nav_order: 85 -parent: Modules ---- - -## Ref overview - -Added in v2.0.0 - ---- - -

Table of contents

- -- [constructors](#constructors) - - [make](#make) -- [getters](#getters) - - [get](#get) -- [models](#models) - - [Ref (interface)](#ref-interface) - - [Ref (namespace)](#ref-namespace) - - [Variance (interface)](#variance-interface) -- [symbols](#symbols) - - [RefTypeId](#reftypeid) - - [RefTypeId (type alias)](#reftypeid-type-alias) -- [unsafe](#unsafe) - - [unsafeMake](#unsafemake) -- [utils](#utils) - - [getAndSet](#getandset) - - [getAndUpdate](#getandupdate) - - [getAndUpdateSome](#getandupdatesome) - - [modify](#modify) - - [modifySome](#modifysome) - - [set](#set) - - [setAndGet](#setandget) - - [update](#update) - - [updateAndGet](#updateandget) - - [updateSome](#updatesome) - - [updateSomeAndGet](#updatesomeandget) - ---- - -# constructors - -## make - -**Signature** - -```ts -export declare const make:
(value: A) => Effect.Effect> -``` - -Added in v2.0.0 - -# getters - -## get - -**Signature** - -```ts -export declare const get: (self: Ref) => Effect.Effect -``` - -Added in v2.0.0 - -# models - -## Ref (interface) - -**Signature** - -```ts -export interface Ref extends Ref.Variance, Pipeable { - readonly modify: (f: (a: A) => readonly [B, A]) => Effect.Effect -} -``` - -Added in v2.0.0 - -## Ref (namespace) - -Added in v2.0.0 - -### Variance (interface) - -**Signature** - -```ts -export interface Variance { - readonly [RefTypeId]: { - readonly _A: (_: A) => A - } -} -``` - -Added in v2.0.0 - -# symbols - -## RefTypeId - -**Signature** - -```ts -export declare const RefTypeId: typeof RefTypeId -``` - -Added in v2.0.0 - -## RefTypeId (type alias) - -**Signature** - -```ts -export type RefTypeId = typeof RefTypeId -``` - -Added in v2.0.0 - -# unsafe - -## unsafeMake - -**Signature** - -```ts -export declare const unsafeMake: (value: A) => Ref -``` - -Added in v2.0.0 - -# utils - -## getAndSet - -**Signature** - -```ts -export declare const getAndSet: { - (value: A): (self: Ref) => Effect.Effect - (self: Ref, value: A): Effect.Effect -} -``` - -Added in v2.0.0 - -## getAndUpdate - -**Signature** - -```ts -export declare const getAndUpdate: { - (f: (a: A) => A): (self: Ref) => Effect.Effect - (self: Ref, f: (a: A) => A): Effect.Effect -} -``` - -Added in v2.0.0 - -## getAndUpdateSome - -**Signature** - -```ts -export declare const getAndUpdateSome: { - (pf: (a: A) => Option.Option): (self: Ref) => Effect.Effect - (self: Ref, pf: (a: A) => Option.Option): Effect.Effect -} -``` - -Added in v2.0.0 - -## modify - -**Signature** - -```ts -export declare const modify: { - (f: (a: A) => readonly [B, A]): (self: Ref) => Effect.Effect - (self: Ref, f: (a: A) => readonly [B, A]): Effect.Effect -} -``` - -Added in v2.0.0 - -## modifySome - -**Signature** - -```ts -export declare const modifySome: { - (fallback: B, pf: (a: A) => Option.Option): (self: Ref) => Effect.Effect - (self: Ref, fallback: B, pf: (a: A) => Option.Option): Effect.Effect -} -``` - -Added in v2.0.0 - -## set - -**Signature** - -```ts -export declare const set: { - (value: A): (self: Ref) => Effect.Effect - (self: Ref, value: A): Effect.Effect -} -``` - -Added in v2.0.0 - -## setAndGet - -**Signature** - -```ts -export declare const setAndGet: { - (value: A): (self: Ref) => Effect.Effect - (self: Ref, value: A): Effect.Effect -} -``` - -Added in v2.0.0 - -## update - -**Signature** - -```ts -export declare const update: { - (f: (a: A) => A): (self: Ref) => Effect.Effect - (self: Ref, f: (a: A) => A): Effect.Effect -} -``` - -Added in v2.0.0 - -## updateAndGet - -**Signature** - -```ts -export declare const updateAndGet: { - (f: (a: A) => A): (self: Ref) => Effect.Effect - (self: Ref, f: (a: A) => A): Effect.Effect -} -``` - -Added in v2.0.0 - -## updateSome - -**Signature** - -```ts -export declare const updateSome: { - (f: (a: A) => Option.Option): (self: Ref) => Effect.Effect - (self: Ref, f: (a: A) => Option.Option): Effect.Effect -} -``` - -Added in v2.0.0 - -## updateSomeAndGet - -**Signature** - -```ts -export declare const updateSomeAndGet: { - (pf: (a: A) => Option.Option): (self: Ref) => Effect.Effect - (self: Ref, pf: (a: A) => Option.Option): Effect.Effect -} -``` - -Added in v2.0.0 diff --git a/docs/modules/Reloadable.ts.md b/docs/modules/Reloadable.ts.md deleted file mode 100644 index 33117850c..000000000 --- a/docs/modules/Reloadable.ts.md +++ /dev/null @@ -1,216 +0,0 @@ ---- -title: Reloadable.ts -nav_order: 86 -parent: Modules ---- - -## Reloadable overview - -Added in v2.0.0 - ---- - -

Table of contents

- -- [constructors](#constructors) - - [auto](#auto) - - [autoFromConfig](#autofromconfig) - - [manual](#manual) - - [reload](#reload) - - [reloadFork](#reloadfork) -- [context](#context) - - [tag](#tag) -- [getters](#getters) - - [get](#get) -- [models](#models) - - [Reloadable (interface)](#reloadable-interface) -- [symbols](#symbols) - - [ReloadableTypeId](#reloadabletypeid) - - [ReloadableTypeId (type alias)](#reloadabletypeid-type-alias) -- [utils](#utils) - - [Reloadable (namespace)](#reloadable-namespace) - - [Variance (interface)](#variance-interface) - ---- - -# constructors - -## auto - -Makes a new reloadable service from a layer that describes the construction -of a static service. The service is automatically reloaded according to the -provided schedule. - -**Signature** - -```ts -export declare const auto: , In, E, R>( - tag: Out, - options: { - readonly layer: Layer.Layer> - readonly schedule: Schedule.Schedule - } -) => Layer.Layer>> -``` - -Added in v2.0.0 - -## autoFromConfig - -Makes a new reloadable service from a layer that describes the construction -of a static service. The service is automatically reloaded according to a -schedule, which is extracted from the input to the layer. - -**Signature** - -```ts -export declare const autoFromConfig: , In, E, R>( - tag: Out, - options: { - readonly layer: Layer.Layer> - readonly scheduleFromConfig: (context: Context.Context) => Schedule.Schedule - } -) => Layer.Layer>> -``` - -Added in v2.0.0 - -## manual - -Makes a new reloadable service from a layer that describes the construction -of a static service. - -**Signature** - -```ts -export declare const manual: , In, E>( - tag: Out, - options: { readonly layer: Layer.Layer> } -) => Layer.Layer>> -``` - -Added in v2.0.0 - -## reload - -Reloads the specified service. - -**Signature** - -```ts -export declare const reload: >( - tag: T -) => Effect.Effect>, unknown, void> -``` - -Added in v2.0.0 - -## reloadFork - -Forks the reload of the service in the background, ignoring any errors. - -**Signature** - -```ts -export declare const reloadFork: >( - tag: T -) => Effect.Effect>, unknown, void> -``` - -Added in v2.0.0 - -# context - -## tag - -**Signature** - -```ts -export declare const tag: >( - tag: T -) => Context.Tag>, Reloadable>> -``` - -Added in v2.0.0 - -# getters - -## get - -Retrieves the current version of the reloadable service. - -**Signature** - -```ts -export declare const get: >( - tag: T -) => Effect.Effect>, never, Context.Tag.Service> -``` - -Added in v2.0.0 - -# models - -## Reloadable (interface) - -A `Reloadable` is an implementation of some service that can be dynamically -reloaded, or swapped out for another implementation on-the-fly. - -**Signature** - -```ts -export interface Reloadable
extends Reloadable.Variance { - /** - * @internal - */ - readonly scopedRef: ScopedRef.ScopedRef - /** - * @internal - */ - readonly reload: Effect.Effect -} -``` - -Added in v2.0.0 - -# symbols - -## ReloadableTypeId - -**Signature** - -```ts -export declare const ReloadableTypeId: typeof ReloadableTypeId -``` - -Added in v2.0.0 - -## ReloadableTypeId (type alias) - -**Signature** - -```ts -export type ReloadableTypeId = typeof ReloadableTypeId -``` - -Added in v2.0.0 - -# utils - -## Reloadable (namespace) - -Added in v2.0.0 - -### Variance (interface) - -**Signature** - -```ts -export interface Variance { - readonly [ReloadableTypeId]: { - readonly _A: (_: never) => A - } -} -``` - -Added in v2.0.0 diff --git a/docs/modules/Request.ts.md b/docs/modules/Request.ts.md deleted file mode 100644 index 8fe3037b7..000000000 --- a/docs/modules/Request.ts.md +++ /dev/null @@ -1,438 +0,0 @@ ---- -title: Request.ts -nav_order: 87 -parent: Modules ---- - -## Request overview - -Added in v2.0.0 - ---- - -

Table of contents

- -- [constructors](#constructors) - - [makeEntry](#makeentry) - - [of](#of) - - [tagged](#tagged) -- [guards](#guards) - - [isEntry](#isentry) -- [models](#models) - - [Cache (interface)](#cache-interface) - - [Entry (interface)](#entry-interface) - - [Entry (namespace)](#entry-namespace) - - [Variance (interface)](#variance-interface) - - [Listeners (interface)](#listeners-interface) - - [Request (interface)](#request-interface) - - [makeCache](#makecache) -- [refinements](#refinements) - - [isRequest](#isrequest) -- [request completion](#request-completion) - - [complete](#complete) - - [completeEffect](#completeeffect) - - [fail](#fail) - - [interruptWhenPossible](#interruptwhenpossible) - - [succeed](#succeed) -- [symbols](#symbols) - - [EntryTypeId](#entrytypeid) - - [EntryTypeId (type alias)](#entrytypeid-type-alias) - - [RequestTypeId](#requesttypeid) - - [RequestTypeId (type alias)](#requesttypeid-type-alias) -- [utils](#utils) - - [Request (namespace)](#request-namespace) - - [Constructor (interface)](#constructor-interface) - - [Variance (interface)](#variance-interface-1) - - [Error (type alias)](#error-type-alias) - - [OptionalResult (type alias)](#optionalresult-type-alias) - - [Result (type alias)](#result-type-alias) - - [Success (type alias)](#success-type-alias) - ---- - -# constructors - -## makeEntry - -**Signature** - -```ts -export declare const makeEntry:
>(options: { - readonly request: A - readonly result: Deferred, Request.Success> - readonly listeners: Listeners - readonly ownerId: FiberId - readonly state: { completed: boolean } -}) => Entry -``` - -Added in v2.0.0 - -## of - -Constructs a new `Request`. - -**Signature** - -```ts -export declare const of: >() => Request.Constructor -``` - -Added in v2.0.0 - -## tagged - -Constructs a new `Request`. - -**Signature** - -```ts -export declare const tagged: & { _tag: string }>( - tag: R["_tag"] -) => Request.Constructor -``` - -Added in v2.0.0 - -# guards - -## isEntry - -**Signature** - -```ts -export declare const isEntry: (u: unknown) => u is Entry -``` - -Added in v2.0.0 - -# models - -## Cache (interface) - -**Signature** - -```ts -export interface Cache - extends _Cache.ConsumerCache< - Request, - never, - { - listeners: Listeners - handle: Deferred - } - > {} -``` - -Added in v2.0.0 - -## Entry (interface) - -A `Entry` keeps track of a request of type `A` along with a -`Ref` containing the result of the request, existentially hiding the result -type. This is used internally by the library to support data sources that -return different result types for different requests while guaranteeing that -results will be of the type requested. - -**Signature** - -```ts -export interface Entry extends Entry.Variance { - readonly request: R - readonly result: Deferred< - [R] extends [Request] ? _E : never, - [R] extends [Request] ? _A : never - > - readonly listeners: Listeners - readonly ownerId: FiberId - readonly state: { - completed: boolean // TODO: mutable by design? - } -} -``` - -Added in v2.0.0 - -## Entry (namespace) - -Added in v2.0.0 - -### Variance (interface) - -**Signature** - -```ts -export interface Variance { - readonly [EntryTypeId]: { - readonly _R: (_: never) => R - } -} -``` - -Added in v2.0.0 - -## Listeners (interface) - -**Signature** - -```ts -export interface Listeners { - readonly count: number - readonly observers: Set<(count: number) => void> - readonly addObserver: (f: (count: number) => void) => void - readonly removeObserver: (f: (count: number) => void) => void - readonly increment: () => void - readonly decrement: () => void -} -``` - -Added in v2.0.0 - -## Request (interface) - -A `Request` is a request from a data source for a value of type `A` -that may fail with an `E`. - -**Signature** - -```ts -export interface Request extends Request.Variance, Data.Case {} -``` - -Added in v2.0.0 - -## makeCache - -**Signature** - -```ts -export declare const makeCache: (options: { - readonly capacity: number - readonly timeToLive: DurationInput -}) => Effect.Effect -``` - -Added in v2.0.0 - -# refinements - -## isRequest - -Returns `true` if the specified value is a `Request`, `false` otherwise. - -**Signature** - -```ts -export declare const isRequest: (u: unknown) => u is Request -``` - -Added in v2.0.0 - -# request completion - -## complete - -Complete a `Request` with the specified result. - -**Signature** - -```ts -export declare const complete: { - >(result: Request.Result): (self: A) => Effect.Effect - >(self: A, result: Request.Result): Effect.Effect -} -``` - -Added in v2.0.0 - -## completeEffect - -Complete a `Request` with the specified effectful computation, failing the -request with the error from the effect workflow if it fails, and completing -the request with the value of the effect workflow if it succeeds. - -**Signature** - -```ts -export declare const completeEffect: { - , R>( - effect: Effect.Effect, Request.Success> - ): (self: A) => Effect.Effect - , R>( - self: A, - effect: Effect.Effect, Request.Success> - ): Effect.Effect -} -``` - -Added in v2.0.0 - -## fail - -Complete a `Request` with the specified error. - -**Signature** - -```ts -export declare const fail: { - >(error: Request.Error): (self: A) => Effect.Effect - >(self: A, error: Request.Error): Effect.Effect -} -``` - -Added in v2.0.0 - -## interruptWhenPossible - -Interrupts the child effect when requests are no longer needed - -**Signature** - -```ts -export declare const interruptWhenPossible: { - (all: Iterable>): (self: Effect.Effect) => Effect.Effect - (self: Effect.Effect, all: Iterable>): Effect.Effect -} -``` - -Added in v2.0.0 - -## succeed - -Complete a `Request` with the specified value. - -**Signature** - -```ts -export declare const succeed: { - >(value: Request.Success): (self: A) => Effect.Effect - >(self: A, value: Request.Success): Effect.Effect -} -``` - -Added in v2.0.0 - -# symbols - -## EntryTypeId - -**Signature** - -```ts -export declare const EntryTypeId: typeof EntryTypeId -``` - -Added in v2.0.0 - -## EntryTypeId (type alias) - -**Signature** - -```ts -export type EntryTypeId = typeof EntryTypeId -``` - -Added in v2.0.0 - -## RequestTypeId - -**Signature** - -```ts -export declare const RequestTypeId: typeof RequestTypeId -``` - -Added in v2.0.0 - -## RequestTypeId (type alias) - -**Signature** - -```ts -export type RequestTypeId = typeof RequestTypeId -``` - -Added in v2.0.0 - -# utils - -## Request (namespace) - -Added in v2.0.0 - -### Constructor (interface) - -**Signature** - -```ts -export interface Constructor, T extends keyof R = never> { - (args: Omit, Request.Success>)>): R -} -``` - -Added in v2.0.0 - -### Variance (interface) - -**Signature** - -```ts -export interface Variance { - readonly [RequestTypeId]: { - readonly _E: (_: never) => E - readonly _A: (_: never) => A - } -} -``` - -Added in v2.0.0 - -### Error (type alias) - -A utility type to extract the error type from a `Request`. - -**Signature** - -```ts -export type Error> = [T] extends [Request] ? _E : never -``` - -Added in v2.0.0 - -### OptionalResult (type alias) - -A utility type to extract the optional result type from a `Request`. - -**Signature** - -```ts -export type OptionalResult> = T extends Request - ? Exit.Exit> - : never -``` - -Added in v2.0.0 - -### Result (type alias) - -A utility type to extract the result type from a `Request`. - -**Signature** - -```ts -export type Result> = T extends Request ? Exit.Exit : never -``` - -Added in v2.0.0 - -### Success (type alias) - -A utility type to extract the value type from a `Request`. - -**Signature** - -```ts -export type Success> = [T] extends [Request] ? _A : never -``` - -Added in v2.0.0 diff --git a/docs/modules/RequestBlock.ts.md b/docs/modules/RequestBlock.ts.md deleted file mode 100644 index ac615f1f5..000000000 --- a/docs/modules/RequestBlock.ts.md +++ /dev/null @@ -1,225 +0,0 @@ ---- -title: RequestBlock.ts -nav_order: 88 -parent: Modules ---- - -## RequestBlock overview - -Added in v2.0.0 - ---- - -

Table of contents

- -- [constructors](#constructors) - - [empty](#empty) - - [mapRequestResolvers](#maprequestresolvers) - - [parallel](#parallel) - - [reduce](#reduce) - - [sequential](#sequential) - - [single](#single) -- [models](#models) - - [Empty (interface)](#empty-interface) - - [Par (interface)](#par-interface) - - [RequestBlock (type alias)](#requestblock-type-alias) - - [RequestBlock (namespace)](#requestblock-namespace) - - [Reducer (interface)](#reducer-interface) - - [Seq (interface)](#seq-interface) - - [Single (interface)](#single-interface) -- [utils](#utils) - - [locally](#locally) - - [mapInputContext](#mapinputcontext) - ---- - -# constructors - -## empty - -**Signature** - -```ts -export declare const empty: RequestBlock -``` - -Added in v2.0.0 - -## mapRequestResolvers - -**Signature** - -```ts -export declare const mapRequestResolvers: ( - self: RequestBlock, - f: (dataSource: RequestResolver.RequestResolver) => RequestResolver.RequestResolver -) => RequestBlock -``` - -Added in v2.0.0 - -## parallel - -**Signature** - -```ts -export declare const parallel: (self: RequestBlock, that: RequestBlock) => RequestBlock -``` - -Added in v2.0.0 - -## reduce - -**Signature** - -```ts -export declare const reduce: (self: RequestBlock, reducer: RequestBlock.Reducer) => Z -``` - -Added in v2.0.0 - -## sequential - -**Signature** - -```ts -export declare const sequential: (self: RequestBlock, that: RequestBlock) => RequestBlock -``` - -Added in v2.0.0 - -## single - -**Signature** - -```ts -export declare const single: ( - dataSource: RequestResolver.RequestResolver, - blockedRequest: Request.Entry
-) => RequestBlock -``` - -Added in v2.0.0 - -# models - -## Empty (interface) - -**Signature** - -```ts -export interface Empty { - readonly _tag: "Empty" -} -``` - -Added in v2.0.0 - -## Par (interface) - -**Signature** - -```ts -export interface Par { - readonly _tag: "Par" - readonly left: RequestBlock - readonly right: RequestBlock -} -``` - -Added in v2.0.0 - -## RequestBlock (type alias) - -`RequestBlock` captures a collection of blocked requests as a data -structure. By doing this the library is able to preserve information about -which requests must be performed sequentially and which can be performed in -parallel, allowing for maximum possible batching and pipelining while -preserving ordering guarantees. - -**Signature** - -```ts -export type RequestBlock = Empty | Par | Seq | Single -``` - -Added in v2.0.0 - -## RequestBlock (namespace) - -Added in v2.0.0 - -### Reducer (interface) - -**Signature** - -```ts -export interface Reducer { - readonly emptyCase: () => Z - readonly parCase: (left: Z, right: Z) => Z - readonly singleCase: ( - dataSource: RequestResolver.RequestResolver, - blockedRequest: Request.Entry - ) => Z - readonly seqCase: (left: Z, right: Z) => Z -} -``` - -Added in v2.0.0 - -## Seq (interface) - -**Signature** - -```ts -export interface Seq { - readonly _tag: "Seq" - readonly left: RequestBlock - readonly right: RequestBlock -} -``` - -Added in v2.0.0 - -## Single (interface) - -**Signature** - -```ts -export interface Single { - readonly _tag: "Single" - readonly dataSource: RequestResolver.RequestResolver - readonly blockedRequest: Request.Entry -} -``` - -Added in v2.0.0 - -# utils - -## locally - -Provides each data source with a fiber ref value. - -**Signature** - -```ts -export declare const locally: (self: RequestBlock, ref: FiberRef, value: A) => RequestBlock -``` - -Added in v2.0.0 - -## mapInputContext - -Provides each data source with part of its required environment. - -**Signature** - -```ts -export declare const mapInputContext: ( - self: RequestBlock, - f: (context: Context.Context) => Context.Context -) => RequestBlock -``` - -Added in v2.0.0 diff --git a/docs/modules/RequestResolver.ts.md b/docs/modules/RequestResolver.ts.md deleted file mode 100644 index 8d801a0e4..000000000 --- a/docs/modules/RequestResolver.ts.md +++ /dev/null @@ -1,459 +0,0 @@ ---- -title: RequestResolver.ts -nav_order: 89 -parent: Modules ---- - -## RequestResolver overview - -Added in v2.0.0 - ---- - -

Table of contents

- -- [combinators](#combinators) - - [around](#around) - - [batchN](#batchn) - - [eitherWith](#eitherwith) - - [locally](#locally) - - [race](#race) -- [constructors](#constructors) - - [fromEffect](#fromeffect) - - [fromEffectTagged](#fromeffecttagged) - - [fromFunction](#fromfunction) - - [fromFunctionBatched](#fromfunctionbatched) - - [make](#make) - - [makeBatched](#makebatched) - - [makeWithEntry](#makewithentry) - - [never](#never) -- [context](#context) - - [mapInputContext](#mapinputcontext) - - [provideContext](#providecontext) -- [models](#models) - - [RequestResolver (interface)](#requestresolver-interface) -- [refinements](#refinements) - - [isRequestResolver](#isrequestresolver) -- [symbols](#symbols) - - [RequestResolverTypeId](#requestresolvertypeid) - - [RequestResolverTypeId (type alias)](#requestresolvertypeid-type-alias) -- [utils](#utils) - - [RequestResolver (namespace)](#requestresolver-namespace) - - [Variance (interface)](#variance-interface) - - [contextFromEffect](#contextfromeffect) - - [contextFromServices](#contextfromservices) - ---- - -# combinators - -## around - -A data source aspect that executes requests between two effects, `before` -and `after`, where the result of `before` can be used by `after`. - -**Signature** - -```ts -export declare const around: { - ( - before: Effect.Effect, - after: (a: A2) => Effect.Effect - ): (self: RequestResolver) => RequestResolver - ( - self: RequestResolver, - before: Effect.Effect, - after: (a: A2) => Effect.Effect - ): RequestResolver -} -``` - -Added in v2.0.0 - -## batchN - -Returns a data source that executes at most `n` requests in parallel. - -**Signature** - -```ts -export declare const batchN: { - (n: number): (self: RequestResolver) => RequestResolver - (self: RequestResolver, n: number): RequestResolver -} -``` - -Added in v2.0.0 - -## eitherWith - -Returns a new data source that executes requests of type `C` using the -specified function to transform `C` requests into requests that either this -data source or that data source can execute. - -**Signature** - -```ts -export declare const eitherWith: { -
, R2, B extends Request.Request, C extends Request.Request>( - that: RequestResolver, - f: (_: Request.Entry) => Either.Either, Request.Entry> - ): (self: RequestResolver) => RequestResolver - < - R, - A extends Request.Request, - R2, - B extends Request.Request, - C extends Request.Request - >( - self: RequestResolver, - that: RequestResolver, - f: (_: Request.Entry) => Either.Either, Request.Entry> - ): RequestResolver -} -``` - -Added in v2.0.0 - -## locally - -Returns a new data source with a localized FiberRef - -**Signature** - -```ts -export declare const locally: { - ( - self: FiberRef, - value: A - ): >(use: RequestResolver) => RequestResolver - , A>( - use: RequestResolver, - self: FiberRef, - value: A - ): RequestResolver -} -``` - -Added in v2.0.0 - -## race - -Returns a new data source that executes requests by sending them to this -data source and that data source, returning the results from the first data -source to complete and safely interrupting the loser. - -**Signature** - -```ts -export declare const race: { - >( - that: RequestResolver - ): >(self: RequestResolver) => RequestResolver - , R2, A2 extends Request.Request>( - self: RequestResolver, - that: RequestResolver - ): RequestResolver -} -``` - -Added in v2.0.0 - -# constructors - -## fromEffect - -Constructs a data source from an effectual function. - -**Signature** - -```ts -export declare const fromEffect: >( - f: (a: A) => Effect.Effect, Request.Request.Success> -) => RequestResolver -``` - -Added in v2.0.0 - -## fromEffectTagged - -Constructs a data source from a list of tags paired to functions, that takes -a list of requests and returns a list of results of the same size. Each item -in the result list must correspond to the item at the same index in the -request list. - -**Signature** - -```ts -export declare const fromEffectTagged: & { readonly _tag: string }>() => < - Fns extends { - readonly [Tag in A["_tag"]]: [Extract] extends [infer Req] - ? Req extends Request.Request - ? (requests: Req[]) => Effect.Effect> - : never - : never - } ->( - fns: Fns -) => RequestResolver extends Effect.Effect ? R : never> -``` - -Added in v2.0.0 - -## fromFunction - -Constructs a data source from a pure function. - -**Signature** - -```ts -export declare const fromFunction: >( - f: (request: A) => Request.Request.Success -) => RequestResolver -``` - -Added in v2.0.0 - -## fromFunctionBatched - -Constructs a data source from a pure function that takes a list of requests -and returns a list of results of the same size. Each item in the result -list must correspond to the item at the same index in the request list. - -**Signature** - -```ts -export declare const fromFunctionBatched: >( - f: (chunk: A[]) => Iterable> -) => RequestResolver -``` - -Added in v2.0.0 - -## make - -Constructs a data source with the specified identifier and method to run -requests. - -**Signature** - -```ts -export declare const make: (runAll: (requests: A[][]) => Effect.Effect) => RequestResolver -``` - -Added in v2.0.0 - -## makeBatched - -Constructs a data source from a function taking a collection of requests -and returning a `RequestCompletionMap`. - -**Signature** - -```ts -export declare const makeBatched: >( - run: (requests: A[]) => Effect.Effect -) => RequestResolver -``` - -Added in v2.0.0 - -## makeWithEntry - -Constructs a data source with the specified identifier and method to run -requests. - -**Signature** - -```ts -export declare const makeWithEntry: ( - runAll: (requests: Request.Entry[][]) => Effect.Effect -) => RequestResolver -``` - -Added in v2.0.0 - -## never - -A data source that never executes requests. - -**Signature** - -```ts -export declare const never: RequestResolver -``` - -Added in v2.0.0 - -# context - -## mapInputContext - -Provides this data source with part of its required context. - -**Signature** - -```ts -export declare const mapInputContext: { - ( - f: (context: Context.Context) => Context.Context - ): >(self: RequestResolver) => RequestResolver - , R0>( - self: RequestResolver, - f: (context: Context.Context) => Context.Context - ): RequestResolver -} -``` - -Added in v2.0.0 - -## provideContext - -Provides this data source with its required context. - -**Signature** - -```ts -export declare const provideContext: { - ( - context: Context.Context - ): >(self: RequestResolver) => RequestResolver - >( - self: RequestResolver, - context: Context.Context - ): RequestResolver -} -``` - -Added in v2.0.0 - -# models - -## RequestResolver (interface) - -A `RequestResolver` requires an environment `R` and is capable of executing -requests of type `A`. - -Data sources must implement the method `runAll` which takes a collection of -requests and returns an effect with a `RequestCompletionMap` containing a -mapping from requests to results. The type of the collection of requests is -a `Chunk>`. The outer `Chunk` represents batches of requests that -must be performed sequentially. The inner `Chunk` represents a batch of -requests that can be performed in parallel. This allows data sources to -introspect on all the requests being executed and optimize the query. - -Data sources will typically be parameterized on a subtype of `Request`, -though that is not strictly necessarily as long as the data source can map -the request type to a `Request`. Data sources can then pattern match on -the collection of requests to determine the information requested, execute -the query, and place the results into the `RequestCompletionMap` using -`RequestCompletionMap.empty` and `RequestCompletionMap.insert`. Data -sources must provide results for all requests received. Failure to do so -will cause a query to die with a `QueryFailure` when run. - -**Signature** - -```ts -export interface RequestResolver extends Equal.Equal, Pipeable { - /** - * Execute a collection of requests. The outer `Chunk` represents batches - * of requests that must be performed sequentially. The inner `Chunk` - * represents a batch of requests that can be performed in parallel. - */ - readonly runAll: (requests: Array>>) => Effect.Effect - - /** - * Identify the data source using the specific identifier - */ - readonly identified: (...identifiers: Array) => RequestResolver -} -``` - -Added in v2.0.0 - -# refinements - -## isRequestResolver - -Returns `true` if the specified value is a `RequestResolver`, `false` otherwise. - -**Signature** - -```ts -export declare const isRequestResolver: (u: unknown) => u is RequestResolver -``` - -Added in v2.0.0 - -# symbols - -## RequestResolverTypeId - -**Signature** - -```ts -export declare const RequestResolverTypeId: typeof RequestResolverTypeId -``` - -Added in v2.0.0 - -## RequestResolverTypeId (type alias) - -**Signature** - -```ts -export type RequestResolverTypeId = typeof RequestResolverTypeId -``` - -Added in v2.0.0 - -# utils - -## RequestResolver (namespace) - -Added in v2.0.0 - -### Variance (interface) - -**Signature** - -```ts -export interface Variance { - readonly [RequestResolverTypeId]: { - readonly _R: (_: never) => R - readonly _A: (_: never) => A - } -} -``` - -Added in v2.0.0 - -## contextFromEffect - -**Signature** - -```ts -export declare const contextFromEffect: >( - self: RequestResolver -) => Effect.Effect> -``` - -Added in v2.0.0 - -## contextFromServices - -**Signature** - -```ts -export declare const contextFromServices: []>( - ...services: Services -) => >( - self: RequestResolver -) => Effect.Effect< - { [k in keyof Services]: Effect.Effect.Context }[number], - never, - RequestResolver }[number]>> -> -``` - -Added in v2.0.0 diff --git a/docs/modules/Resource.ts.md b/docs/modules/Resource.ts.md deleted file mode 100644 index bb661fad7..000000000 --- a/docs/modules/Resource.ts.md +++ /dev/null @@ -1,159 +0,0 @@ ---- -title: Resource.ts -nav_order: 90 -parent: Modules ---- - -## Resource overview - -Added in v2.0.0 - ---- - -

Table of contents

- -- [constructors](#constructors) - - [auto](#auto) - - [manual](#manual) -- [getters](#getters) - - [get](#get) -- [models](#models) - - [Resource (interface)](#resource-interface) -- [symbols](#symbols) - - [ResourceTypeId](#resourcetypeid) - - [ResourceTypeId (type alias)](#resourcetypeid-type-alias) -- [utils](#utils) - - [Resource (namespace)](#resource-namespace) - - [Variance (interface)](#variance-interface) - - [refresh](#refresh) - ---- - -# constructors - -## auto - -Creates a new `Resource` value that is automatically refreshed according to -the specified policy. Note that error retrying is not performed -automatically, so if you want to retry on errors, you should first apply -retry policies to the acquisition effect before passing it to this -constructor. - -**Signature** - -```ts -export declare const auto: ( - acquire: Effect.Effect, - policy: Schedule.Schedule -) => Effect.Effect> -``` - -Added in v2.0.0 - -## manual - -Creates a new `Resource` value that must be manually refreshed by calling -the refresh method. Note that error retrying is not performed -automatically, so if you want to retry on errors, you should first apply -retry policies to the acquisition effect before passing it to this -constructor. - -**Signature** - -```ts -export declare const manual: ( - acquire: Effect.Effect -) => Effect.Effect> -``` - -Added in v2.0.0 - -# getters - -## get - -Retrieves the current value stored in the cache. - -**Signature** - -```ts -export declare const get: (self: Resource) => Effect.Effect -``` - -Added in v2.0.0 - -# models - -## Resource (interface) - -A `Resource` is a possibly resourceful value that is loaded into memory, and -which can be refreshed either manually or automatically. - -**Signature** - -```ts -export interface Resource extends Resource.Variance { - /** @internal */ - readonly scopedRef: ScopedRef.ScopedRef> - /** @internal */ - readonly acquire: Effect.Effect -} -``` - -Added in v2.0.0 - -# symbols - -## ResourceTypeId - -**Signature** - -```ts -export declare const ResourceTypeId: typeof ResourceTypeId -``` - -Added in v2.0.0 - -## ResourceTypeId (type alias) - -**Signature** - -```ts -export type ResourceTypeId = typeof ResourceTypeId -``` - -Added in v2.0.0 - -# utils - -## Resource (namespace) - -Added in v2.0.0 - -### Variance (interface) - -**Signature** - -```ts -export interface Variance { - readonly [ResourceTypeId]: { - _E: (_: never) => E - _A: (_: never) => A - } -} -``` - -Added in v2.0.0 - -## refresh - -Refreshes the cache. This method will not return until either the refresh -is successful, or the refresh operation fails. - -**Signature** - -```ts -export declare const refresh: (self: Resource) => Effect.Effect -``` - -Added in v2.0.0 diff --git a/docs/modules/Runtime.ts.md b/docs/modules/Runtime.ts.md deleted file mode 100644 index 6f6b2f310..000000000 --- a/docs/modules/Runtime.ts.md +++ /dev/null @@ -1,334 +0,0 @@ ---- -title: Runtime.ts -nav_order: 91 -parent: Modules ---- - -## Runtime overview - -Added in v2.0.0 - ---- - -

Table of contents

- -- [constructors](#constructors) - - [defaultRuntime](#defaultruntime) - - [defaultRuntimeFlags](#defaultruntimeflags) - - [make](#make) - - [makeFiberFailure](#makefiberfailure) -- [execution](#execution) - - [runCallback](#runcallback) - - [runFork](#runfork) - - [runPromise](#runpromise) - - [runPromiseExit](#runpromiseexit) - - [runSync](#runsync) - - [runSyncExit](#runsyncexit) -- [exports](#exports) - - [FiberFailureCauseId (type alias)](#fiberfailurecauseid-type-alias) -- [guards](#guards) - - [isAsyncFiberException](#isasyncfiberexception) - - [isFiberFailure](#isfiberfailure) -- [models](#models) - - [AsyncFiberException (interface)](#asyncfiberexception-interface) - - [Cancel (interface)](#cancel-interface) - - [FiberFailure (interface)](#fiberfailure-interface) - - [RunForkOptions (interface)](#runforkoptions-interface) - - [Runtime (interface)](#runtime-interface) -- [symbols](#symbols) - - [FiberFailureCauseId](#fiberfailurecauseid) - - [FiberFailureId](#fiberfailureid) - - [FiberFailureId (type alias)](#fiberfailureid-type-alias) - ---- - -# constructors - -## defaultRuntime - -**Signature** - -```ts -export declare const defaultRuntime: Runtime -``` - -Added in v2.0.0 - -## defaultRuntimeFlags - -**Signature** - -```ts -export declare const defaultRuntimeFlags: RuntimeFlags.RuntimeFlags -``` - -Added in v2.0.0 - -## make - -**Signature** - -```ts -export declare const make: (options: { - readonly context: Context.Context - readonly runtimeFlags: RuntimeFlags.RuntimeFlags - readonly fiberRefs: FiberRefs.FiberRefs -}) => Runtime -``` - -Added in v2.0.0 - -## makeFiberFailure - -**Signature** - -```ts -export declare const makeFiberFailure: (cause: Cause) => FiberFailure -``` - -Added in v2.0.0 - -# execution - -## runCallback - -Executes the effect asynchronously, eventually passing the exit value to -the specified callback. - -This method is effectful and should only be invoked at the edges of your -program. - -**Signature** - -```ts -export declare const runCallback: ( - runtime: Runtime -) => ( - effect: Effect.Effect, - onExit?: ((exit: Exit.Exit) => void) | undefined -) => (fiberId?: FiberId.FiberId | undefined, onExit?: ((exit: Exit.Exit) => void) | undefined) => void -``` - -Added in v2.0.0 - -## runFork - -Executes the effect using the provided Scheduler or using the global -Scheduler if not provided - -**Signature** - -```ts -export declare const runFork: ( - runtime: Runtime -) => (self: Effect.Effect, options?: RunForkOptions) => Fiber.RuntimeFiber -``` - -Added in v2.0.0 - -## runPromise - -Runs the `Effect`, returning a JavaScript `Promise` that will be resolved -with the value of the effect once the effect has been executed, or will be -rejected with the first error or exception throw by the effect. - -This method is effectful and should only be used at the edges of your -program. - -**Signature** - -```ts -export declare const runPromise: (runtime: Runtime) => (effect: Effect.Effect) => Promise
-``` - -Added in v2.0.0 - -## runPromiseExit - -Runs the `Effect`, returning a JavaScript `Promise` that will be resolved -with the `Exit` state of the effect once the effect has been executed. - -This method is effectful and should only be used at the edges of your -program. - -**Signature** - -```ts -export declare const runPromiseExit: ( - runtime: Runtime -) => (effect: Effect.Effect) => Promise> -``` - -Added in v2.0.0 - -## runSync - -Executes the effect synchronously throwing in case of errors or async boundaries. - -This method is effectful and should only be invoked at the edges of your -program. - -**Signature** - -```ts -export declare const runSync: (runtime: Runtime) => (effect: Effect.Effect) => A -``` - -Added in v2.0.0 - -## runSyncExit - -Executes the effect synchronously returning the exit. - -This method is effectful and should only be invoked at the edges of your -program. - -**Signature** - -```ts -export declare const runSyncExit: (runtime: Runtime) => (effect: Effect.Effect) => Exit.Exit -``` - -Added in v2.0.0 - -# exports - -## FiberFailureCauseId (type alias) - -**Signature** - -```ts -export type FiberFailureCauseId = typeof FiberFailureCauseId -``` - -Added in v2.0.0 - -# guards - -## isAsyncFiberException - -**Signature** - -```ts -export declare const isAsyncFiberException: (u: unknown) => u is AsyncFiberException -``` - -Added in v2.0.0 - -## isFiberFailure - -**Signature** - -```ts -export declare const isFiberFailure: (u: unknown) => u is FiberFailure -``` - -Added in v2.0.0 - -# models - -## AsyncFiberException (interface) - -**Signature** - -```ts -export interface AsyncFiberException { - readonly _tag: "AsyncFiberException" - readonly fiber: Fiber.RuntimeFiber -} -``` - -Added in v2.0.0 - -## Cancel (interface) - -**Signature** - -```ts -export interface Cancel { - (fiberId?: FiberId.FiberId, onExit?: (exit: Exit.Exit) => void): void -} -``` - -Added in v2.0.0 - -## FiberFailure (interface) - -**Signature** - -```ts -export interface FiberFailure extends Error, Inspectable { - readonly [FiberFailureId]: FiberFailureId - readonly [FiberFailureCauseId]: Cause -} -``` - -Added in v2.0.0 - -## RunForkOptions (interface) - -**Signature** - -```ts -export interface RunForkOptions { - readonly scheduler?: Scheduler | undefined - readonly updateRefs?: ((refs: FiberRefs.FiberRefs, fiberId: FiberId.Runtime) => FiberRefs.FiberRefs) | undefined -} -``` - -Added in v2.0.0 - -## Runtime (interface) - -**Signature** - -```ts -export interface Runtime extends Pipeable { - /** - * The context used as initial for forks - */ - readonly context: Context.Context - /** - * The runtime flags used as initial for forks - */ - readonly runtimeFlags: RuntimeFlags.RuntimeFlags - /** - * The fiber references used as initial for forks - */ - readonly fiberRefs: FiberRefs.FiberRefs -} -``` - -Added in v2.0.0 - -# symbols - -## FiberFailureCauseId - -**Signature** - -```ts -export declare const FiberFailureCauseId: typeof FiberFailureCauseId -``` - -Added in v2.0.0 - -## FiberFailureId - -**Signature** - -```ts -export declare const FiberFailureId: typeof FiberFailureId -``` - -Added in v2.0.0 - -## FiberFailureId (type alias) - -**Signature** - -```ts -export type FiberFailureId = typeof FiberFailureId -``` - -Added in v2.0.0 diff --git a/docs/modules/RuntimeFlags.ts.md b/docs/modules/RuntimeFlags.ts.md deleted file mode 100644 index 07c2aa826..000000000 --- a/docs/modules/RuntimeFlags.ts.md +++ /dev/null @@ -1,552 +0,0 @@ ---- -title: RuntimeFlags.ts -nav_order: 92 -parent: Modules ---- - -## RuntimeFlags overview - -Added in v2.0.0 - ---- - -

Table of contents

- -- [constructors](#constructors) - - [CooperativeYielding](#cooperativeyielding) - - [Interruption](#interruption) - - [None](#none) - - [OpSupervision](#opsupervision) - - [RuntimeMetrics](#runtimemetrics) - - [WindDown](#winddown) - - [make](#make) - - [none](#none-1) -- [context](#context) - - [disableCooperativeYielding](#disablecooperativeyielding) - - [disableInterruption](#disableinterruption) - - [disableOpSupervision](#disableopsupervision) - - [disableRuntimeMetrics](#disableruntimemetrics) - - [disableWindDown](#disablewinddown) - - [enableCooperativeYielding](#enablecooperativeyielding) - - [enableInterruption](#enableinterruption) - - [enableOpSupervision](#enableopsupervision) - - [enableRuntimeMetrics](#enableruntimemetrics) - - [enableWindDown](#enablewinddown) -- [conversions](#conversions) - - [render](#render) - - [toSet](#toset) -- [diffing](#diffing) - - [diff](#diff) -- [elements](#elements) - - [isDisabled](#isdisabled) - - [isEnabled](#isenabled) -- [getters](#getters) - - [cooperativeYielding](#cooperativeyielding-1) - - [interruptible](#interruptible) - - [interruption](#interruption-1) - - [opSupervision](#opsupervision-1) - - [runtimeMetrics](#runtimemetrics-1) - - [windDown](#winddown-1) -- [models](#models) - - [RuntimeFlag (type alias)](#runtimeflag-type-alias) - - [RuntimeFlags (type alias)](#runtimeflags-type-alias) -- [utils](#utils) - - [differ](#differ) - - [disable](#disable) - - [disableAll](#disableall) - - [enable](#enable) - - [enableAll](#enableall) - - [patch](#patch) - ---- - -# constructors - -## CooperativeYielding - -The cooperative yielding flag determines whether the Effect runtime will -yield to another fiber. - -**Signature** - -```ts -export declare const CooperativeYielding: RuntimeFlag -``` - -Added in v2.0.0 - -## Interruption - -The interruption flag determines whether or not the Effect runtime system will -interrupt a fiber. - -**Signature** - -```ts -export declare const Interruption: RuntimeFlag -``` - -Added in v2.0.0 - -## None - -No runtime flags. - -**Signature** - -```ts -export declare const None: RuntimeFlag -``` - -Added in v2.0.0 - -## OpSupervision - -The op supervision flag determines whether or not the Effect runtime system -will supervise all operations of the Effect runtime. Use of this flag will -negatively impact performance, but is required for some operations, such as -profiling. - -**Signature** - -```ts -export declare const OpSupervision: RuntimeFlag -``` - -Added in v2.0.0 - -## RuntimeMetrics - -The runtime metrics flag determines whether or not the Effect runtime system -will collect metrics about the Effect runtime. Use of this flag will have a -very small negative impact on performance, but generates very helpful -operational insight into running Effect applications that can be exported to -Prometheus or other tools via Effect Metrics. - -**Signature** - -```ts -export declare const RuntimeMetrics: RuntimeFlag -``` - -Added in v2.0.0 - -## WindDown - -The wind down flag determines whether the Effect runtime system will execute -effects in wind-down mode. In wind-down mode, even if interruption is -enabled and a fiber has been interrupted, the fiber will continue its -execution uninterrupted. - -**Signature** - -```ts -export declare const WindDown: RuntimeFlag -``` - -Added in v2.0.0 - -## make - -**Signature** - -```ts -export declare const make: (...flags: ReadonlyArray) => RuntimeFlags -``` - -Added in v2.0.0 - -## none - -**Signature** - -```ts -export declare const none: RuntimeFlags -``` - -Added in v2.0.0 - -# context - -## disableCooperativeYielding - -**Signature** - -```ts -export declare const disableCooperativeYielding: Layer.Layer -``` - -Added in v2.0.0 - -## disableInterruption - -**Signature** - -```ts -export declare const disableInterruption: Layer.Layer -``` - -Added in v2.0.0 - -## disableOpSupervision - -**Signature** - -```ts -export declare const disableOpSupervision: Layer.Layer -``` - -Added in v2.0.0 - -## disableRuntimeMetrics - -**Signature** - -```ts -export declare const disableRuntimeMetrics: Layer.Layer -``` - -Added in v2.0.0 - -## disableWindDown - -**Signature** - -```ts -export declare const disableWindDown: Layer.Layer -``` - -Added in v2.0.0 - -## enableCooperativeYielding - -**Signature** - -```ts -export declare const enableCooperativeYielding: Layer.Layer -``` - -Added in v2.0.0 - -## enableInterruption - -**Signature** - -```ts -export declare const enableInterruption: Layer.Layer -``` - -Added in v2.0.0 - -## enableOpSupervision - -**Signature** - -```ts -export declare const enableOpSupervision: Layer.Layer -``` - -Added in v2.0.0 - -## enableRuntimeMetrics - -**Signature** - -```ts -export declare const enableRuntimeMetrics: Layer.Layer -``` - -Added in v2.0.0 - -## enableWindDown - -**Signature** - -```ts -export declare const enableWindDown: Layer.Layer -``` - -Added in v2.0.0 - -# conversions - -## render - -Converts the provided `RuntimeFlags` into a `string`. - -**Signature** - -```ts -export declare const render: (self: RuntimeFlags) => string -``` - -Added in v2.0.0 - -## toSet - -Converts the provided `RuntimeFlags` into a `ReadonlySet`. - -**Signature** - -```ts -export declare const toSet: (self: RuntimeFlags) => ReadonlySet -``` - -Added in v2.0.0 - -# diffing - -## diff - -Creates a `RuntimeFlagsPatch` which describes the difference between `self` -and `that`. - -**Signature** - -```ts -export declare const diff: { - (that: RuntimeFlags): (self: RuntimeFlags) => RuntimeFlagsPatch.RuntimeFlagsPatch - (self: RuntimeFlags, that: RuntimeFlags): RuntimeFlagsPatch.RuntimeFlagsPatch -} -``` - -Added in v2.0.0 - -# elements - -## isDisabled - -Returns `true` if the specified `RuntimeFlag` is disabled, `false` otherwise. - -**Signature** - -```ts -export declare const isDisabled: { - (flag: RuntimeFlag): (self: RuntimeFlags) => boolean - (self: RuntimeFlags, flag: RuntimeFlag): boolean -} -``` - -Added in v2.0.0 - -## isEnabled - -Returns `true` if the specified `RuntimeFlag` is enabled, `false` otherwise. - -**Signature** - -```ts -export declare const isEnabled: { - (flag: RuntimeFlag): (self: RuntimeFlags) => boolean - (self: RuntimeFlags, flag: RuntimeFlag): boolean -} -``` - -Added in v2.0.0 - -# getters - -## cooperativeYielding - -Returns `true` if the `CooperativeYielding` `RuntimeFlag` is enabled, `false` -otherwise. - -**Signature** - -```ts -export declare const cooperativeYielding: (self: RuntimeFlags) => boolean -``` - -Added in v2.0.0 - -## interruptible - -Returns true only if the `Interruption` flag is **enabled** and the -`WindDown` flag is **disabled**. - -A fiber is said to be interruptible if interruption is enabled and the fiber -is not in its wind-down phase, in which it takes care of cleanup activities -related to fiber shutdown. - -**Signature** - -```ts -export declare const interruptible: (self: RuntimeFlags) => boolean -``` - -Added in v2.0.0 - -## interruption - -Returns `true` if the `Interruption` `RuntimeFlag` is enabled, `false` -otherwise. - -**Signature** - -```ts -export declare const interruption: (self: RuntimeFlags) => boolean -``` - -Added in v2.0.0 - -## opSupervision - -Returns `true` if the `OpSupervision` `RuntimeFlag` is enabled, `false` -otherwise. - -**Signature** - -```ts -export declare const opSupervision: (self: RuntimeFlags) => boolean -``` - -Added in v2.0.0 - -## runtimeMetrics - -Returns `true` if the `RuntimeMetrics` `RuntimeFlag` is enabled, `false` -otherwise. - -**Signature** - -```ts -export declare const runtimeMetrics: (self: RuntimeFlags) => boolean -``` - -Added in v2.0.0 - -## windDown - -Returns `true` if the `WindDown` `RuntimeFlag` is enabled, `false` -otherwise. - -**Signature** - -```ts -export declare const windDown: (self: RuntimeFlags) => boolean -``` - -Added in v2.0.0 - -# models - -## RuntimeFlag (type alias) - -Represents a flag that can be set to enable or disable a particular feature -of the Effect runtime. - -**Signature** - -```ts -export type RuntimeFlag = number & { - readonly RuntimeFlag: unique symbol -} -``` - -Added in v2.0.0 - -## RuntimeFlags (type alias) - -Represents a set of `RuntimeFlag`s. `RuntimeFlag`s affect the operation of -the Effect runtime system. They are exposed to application-level code because -they affect the behavior and performance of application code. - -**Signature** - -```ts -export type RuntimeFlags = number & { - readonly RuntimeFlags: unique symbol -} -``` - -Added in v2.0.0 - -# utils - -## differ - -Constructs a differ that knows how to diff `RuntimeFlags` values. - -**Signature** - -```ts -export declare const differ: Differ.Differ -``` - -Added in v2.0.0 - -## disable - -Disables the specified `RuntimeFlag`. - -**Signature** - -```ts -export declare const disable: { - (flag: RuntimeFlag): (self: RuntimeFlags) => RuntimeFlags - (self: RuntimeFlags, flag: RuntimeFlag): RuntimeFlags -} -``` - -Added in v2.0.0 - -## disableAll - -Disables all of the `RuntimeFlag`s in the specified set of `RuntimeFlags`. - -**Signature** - -```ts -export declare const disableAll: { - (flags: RuntimeFlags): (self: RuntimeFlags) => RuntimeFlags - (self: RuntimeFlags, flags: RuntimeFlags): RuntimeFlags -} -``` - -Added in v2.0.0 - -## enable - -Enables the specified `RuntimeFlag`. - -**Signature** - -```ts -export declare const enable: { - (flag: RuntimeFlag): (self: RuntimeFlags) => RuntimeFlags - (self: RuntimeFlags, flag: RuntimeFlag): RuntimeFlags -} -``` - -Added in v2.0.0 - -## enableAll - -Enables all of the `RuntimeFlag`s in the specified set of `RuntimeFlags`. - -**Signature** - -```ts -export declare const enableAll: { - (flags: RuntimeFlags): (self: RuntimeFlags) => RuntimeFlags - (self: RuntimeFlags, flags: RuntimeFlags): RuntimeFlags -} -``` - -Added in v2.0.0 - -## patch - -Patches a set of `RuntimeFlag`s with a `RuntimeFlagsPatch`, returning the -patched set of `RuntimeFlag`s. - -**Signature** - -```ts -export declare const patch: { - (patch: RuntimeFlagsPatch.RuntimeFlagsPatch): (self: RuntimeFlags) => RuntimeFlags - (self: RuntimeFlags, patch: RuntimeFlagsPatch.RuntimeFlagsPatch): RuntimeFlags -} -``` - -Added in v2.0.0 diff --git a/docs/modules/RuntimeFlagsPatch.ts.md b/docs/modules/RuntimeFlagsPatch.ts.md deleted file mode 100644 index 47377a81d..000000000 --- a/docs/modules/RuntimeFlagsPatch.ts.md +++ /dev/null @@ -1,301 +0,0 @@ ---- -title: RuntimeFlagsPatch.ts -nav_order: 93 -parent: Modules ---- - -## RuntimeFlagsPatch overview - -Added in v2.0.0 - ---- - -

Table of contents

- -- [constructors](#constructors) - - [disable](#disable) - - [empty](#empty) - - [enable](#enable) - - [make](#make) -- [destructors](#destructors) - - [disabledSet](#disabledset) - - [enabledSet](#enabledset) - - [render](#render) -- [elements](#elements) - - [includes](#includes) - - [isActive](#isactive) - - [isDisabled](#isdisabled) - - [isEnabled](#isenabled) -- [getters](#getters) - - [isEmpty](#isempty) -- [models](#models) - - [RuntimeFlagsPatch (type alias)](#runtimeflagspatch-type-alias) -- [utils](#utils) - - [andThen](#andthen) - - [both](#both) - - [either](#either) - - [exclude](#exclude) - - [inverse](#inverse) - ---- - -# constructors - -## disable - -Creates a `RuntimeFlagsPatch` describing disabling the provided `RuntimeFlag`. - -**Signature** - -```ts -export declare const disable: (flag: RuntimeFlags.RuntimeFlag) => RuntimeFlagsPatch -``` - -Added in v2.0.0 - -## empty - -The empty `RuntimeFlagsPatch`. - -**Signature** - -```ts -export declare const empty: RuntimeFlagsPatch -``` - -Added in v2.0.0 - -## enable - -Creates a `RuntimeFlagsPatch` describing enabling the provided `RuntimeFlag`. - -**Signature** - -```ts -export declare const enable: (flag: RuntimeFlags.RuntimeFlag) => RuntimeFlagsPatch -``` - -Added in v2.0.0 - -## make - -**Signature** - -```ts -export declare const make: (active: number, enabled: number) => RuntimeFlagsPatch -``` - -Added in v2.0.0 - -# destructors - -## disabledSet - -Returns a `ReadonlySet` containing the `RuntimeFlags` described as -disabled by the specified `RuntimeFlagsPatch`. - -**Signature** - -```ts -export declare const disabledSet: (self: RuntimeFlagsPatch) => ReadonlySet -``` - -Added in v2.0.0 - -## enabledSet - -Returns a `ReadonlySet` containing the `RuntimeFlags` described as -enabled by the specified `RuntimeFlagsPatch`. - -**Signature** - -```ts -export declare const enabledSet: (self: RuntimeFlagsPatch) => ReadonlySet -``` - -Added in v2.0.0 - -## render - -Renders the provided `RuntimeFlagsPatch` to a string. - -**Signature** - -```ts -export declare const render: (self: RuntimeFlagsPatch) => string -``` - -Added in v2.0.0 - -# elements - -## includes - -Returns `true` if the `RuntimeFlagsPatch` includes the specified -`RuntimeFlag`, `false` otherwise. - -**Signature** - -```ts -export declare const includes: { - (flag: RuntimeFlagsPatch): (self: RuntimeFlagsPatch) => boolean - (self: RuntimeFlagsPatch, flag: RuntimeFlagsPatch): boolean -} -``` - -Added in v2.0.0 - -## isActive - -Returns `true` if the `RuntimeFlagsPatch` describes the specified -`RuntimeFlag` as active. - -**Signature** - -```ts -export declare const isActive: { - (flag: RuntimeFlagsPatch): (self: RuntimeFlagsPatch) => boolean - (self: RuntimeFlagsPatch, flag: RuntimeFlagsPatch): boolean -} -``` - -Added in v2.0.0 - -## isDisabled - -Returns `true` if the `RuntimeFlagsPatch` describes the specified -`RuntimeFlag` as disabled. - -**Signature** - -```ts -export declare const isDisabled: { - (flag: RuntimeFlags.RuntimeFlag): (self: RuntimeFlagsPatch) => boolean - (self: RuntimeFlagsPatch, flag: RuntimeFlags.RuntimeFlag): boolean -} -``` - -Added in v2.0.0 - -## isEnabled - -Returns `true` if the `RuntimeFlagsPatch` describes the specified -`RuntimeFlag` as enabled. - -**Signature** - -```ts -export declare const isEnabled: { - (flag: RuntimeFlags.RuntimeFlag): (self: RuntimeFlagsPatch) => boolean - (self: RuntimeFlagsPatch, flag: RuntimeFlags.RuntimeFlag): boolean -} -``` - -Added in v2.0.0 - -# getters - -## isEmpty - -Returns `true` if the specified `RuntimeFlagsPatch` is empty. - -**Signature** - -```ts -export declare const isEmpty: (patch: RuntimeFlagsPatch) => boolean -``` - -Added in v2.0.0 - -# models - -## RuntimeFlagsPatch (type alias) - -**Signature** - -```ts -export type RuntimeFlagsPatch = number & { - readonly RuntimeFlagsPatch: unique symbol -} -``` - -Added in v2.0.0 - -# utils - -## andThen - -Creates a `RuntimeFlagsPatch` describing the application of the `self` patch, -followed by `that` patch. - -**Signature** - -```ts -export declare const andThen: { - (that: RuntimeFlagsPatch): (self: RuntimeFlagsPatch) => RuntimeFlagsPatch - (self: RuntimeFlagsPatch, that: RuntimeFlagsPatch): RuntimeFlagsPatch -} -``` - -Added in v2.0.0 - -## both - -Creates a `RuntimeFlagsPatch` describing application of both the `self` patch -and `that` patch. - -**Signature** - -```ts -export declare const both: { - (that: RuntimeFlagsPatch): (self: RuntimeFlagsPatch) => RuntimeFlagsPatch - (self: RuntimeFlagsPatch, that: RuntimeFlagsPatch): RuntimeFlagsPatch -} -``` - -Added in v2.0.0 - -## either - -Creates a `RuntimeFlagsPatch` describing application of either the `self` -patch or `that` patch. - -**Signature** - -```ts -export declare const either: { - (that: RuntimeFlagsPatch): (self: RuntimeFlagsPatch) => RuntimeFlagsPatch - (self: RuntimeFlagsPatch, that: RuntimeFlagsPatch): RuntimeFlagsPatch -} -``` - -Added in v2.0.0 - -## exclude - -Creates a `RuntimeFlagsPatch` which describes exclusion of the specified -`RuntimeFlag` from the set of `RuntimeFlags`. - -**Signature** - -```ts -export declare const exclude: { - (flag: RuntimeFlags.RuntimeFlag): (self: RuntimeFlagsPatch) => RuntimeFlagsPatch - (self: RuntimeFlagsPatch, flag: RuntimeFlags.RuntimeFlag): RuntimeFlagsPatch -} -``` - -Added in v2.0.0 - -## inverse - -Creates a `RuntimeFlagsPatch` which describes the inverse of the patch -specified by the provided `RuntimeFlagsPatch`. - -**Signature** - -```ts -export declare const inverse: (patch: RuntimeFlagsPatch) => RuntimeFlagsPatch -``` - -Added in v2.0.0 diff --git a/docs/modules/STM.ts.md b/docs/modules/STM.ts.md deleted file mode 100644 index 875d47b5a..000000000 --- a/docs/modules/STM.ts.md +++ /dev/null @@ -1,2663 +0,0 @@ ---- -title: STM.ts -nav_order: 106 -parent: Modules ---- - -## STM overview - -Added in v2.0.0 - ---- - -

Table of contents

- -- [constructors](#constructors) - - [acquireUseRelease](#acquireuserelease) - - [all](#all) - - [attempt](#attempt) - - [check](#check) - - [cond](#cond) - - [context](#context) - - [contextWith](#contextwith) - - [contextWithSTM](#contextwithstm) - - [die](#die) - - [dieMessage](#diemessage) - - [dieSync](#diesync) - - [every](#every) - - [exists](#exists) - - [fail](#fail) - - [failSync](#failsync) - - [fiberId](#fiberid) - - [filter](#filter) - - [filterNot](#filternot) - - [fromEither](#fromeither) - - [fromOption](#fromoption) - - [gen](#gen) - - [interrupt](#interrupt) - - [interruptAs](#interruptas) - - [iterate](#iterate) - - [loop](#loop) - - [mergeAll](#mergeall) - - [reduce](#reduce) - - [reduceAll](#reduceall) - - [reduceRight](#reduceright) - - [replicate](#replicate) - - [replicateSTM](#replicatestm) - - [replicateSTMDiscard](#replicatestmdiscard) - - [succeed](#succeed) - - [succeedNone](#succeednone) - - [succeedSome](#succeedsome) - - [suspend](#suspend) - - [sync](#sync) - - [try](#try) - - [unit](#unit) -- [context](#context-1) - - [mapInputContext](#mapinputcontext) - - [provideContext](#providecontext) - - [provideService](#provideservice) - - [provideServiceSTM](#provideservicestm) - - [provideSomeContext](#providesomecontext) -- [destructors](#destructors) - - [commit](#commit) - - [commitEither](#commiteither) -- [do notation](#do-notation) - - [Do](#do) - - [bind](#bind) - - [bindTo](#bindto) - - [let](#let) -- [elements](#elements) - - [firstSuccessOf](#firstsuccessof) -- [error handling](#error-handling) - - [catchAll](#catchall) - - [catchSome](#catchsome) - - [catchTag](#catchtag) - - [catchTags](#catchtags) - - [orDie](#ordie) - - [orDieWith](#ordiewith) - - [orElse](#orelse) - - [orElseEither](#orelseeither) - - [orElseFail](#orelsefail) - - [orElseOptional](#orelseoptional) - - [orElseSucceed](#orelsesucceed) - - [orTry](#ortry) - - [retry](#retry) -- [filtering](#filtering) - - [filterOrDie](#filterordie) - - [filterOrDieMessage](#filterordiemessage) - - [filterOrElse](#filterorelse) - - [filterOrFail](#filterorfail) -- [finalization](#finalization) - - [ensuring](#ensuring) -- [folding](#folding) - - [match](#match) - - [matchSTM](#matchstm) -- [getters](#getters) - - [head](#head) - - [isFailure](#isfailure) - - [isSuccess](#issuccess) - - [some](#some) - - [unsome](#unsome) -- [mapping](#mapping) - - [as](#as) - - [asSome](#assome) - - [asSomeError](#assomeerror) - - [asUnit](#asunit) - - [map](#map) - - [mapAttempt](#mapattempt) - - [mapBoth](#mapboth) - - [mapError](#maperror) -- [models](#models) - - [Adapter (interface)](#adapter-interface) - - [STM (interface)](#stm-interface) - - [STMGen (interface)](#stmgen-interface) - - [STMUnify (interface)](#stmunify-interface) - - [STMUnifyIgnore (interface)](#stmunifyignore-interface) -- [mutations](#mutations) - - [collect](#collect) - - [collectSTM](#collectstm) - - [either](#either) - - [eventually](#eventually) - - [flip](#flip) - - [flipWith](#flipwith) - - [if](#if) - - [ignore](#ignore) - - [merge](#merge) - - [negate](#negate) - - [none](#none) - - [option](#option) - - [refineOrDie](#refineordie) - - [refineOrDieWith](#refineordiewith) - - [reject](#reject) - - [rejectSTM](#rejectstm) - - [repeatUntil](#repeatuntil) - - [repeatWhile](#repeatwhile) - - [retryUntil](#retryuntil) - - [retryWhile](#retrywhile) - - [summarized](#summarized) - - [unless](#unless) - - [unlessSTM](#unlessstm) - - [validateAll](#validateall) - - [validateFirst](#validatefirst) - - [when](#when) - - [whenSTM](#whenstm) -- [refinements](#refinements) - - [isSTM](#isstm) -- [sequencing](#sequencing) - - [flatMap](#flatmap) - - [flatten](#flatten) - - [tap](#tap) - - [tapBoth](#tapboth) - - [tapError](#taperror) -- [symbols](#symbols) - - [STMTypeId](#stmtypeid) - - [STMTypeId (type alias)](#stmtypeid-type-alias) -- [traversing](#traversing) - - [forEach](#foreach) - - [partition](#partition) -- [type lambdas](#type-lambdas) - - [STMTypeLambda (interface)](#stmtypelambda-interface) -- [utils](#utils) - - [All (namespace)](#all-namespace) - - [Signature (interface)](#signature-interface) - - [Options (type alias)](#options-type-alias) - - [STM (namespace)](#stm-namespace) - - [Variance (interface)](#variance-interface) -- [zipping](#zipping) - - [zip](#zip) - - [zipLeft](#zipleft) - - [zipRight](#zipright) - - [zipWith](#zipwith) - ---- - -# constructors - -## acquireUseRelease - -Treats the specified `acquire` transaction as the acquisition of a -resource. The `acquire` transaction will be executed interruptibly. If it -is a success and is committed the specified `release` workflow will be -executed uninterruptibly as soon as the `use` workflow completes execution. - -**Signature** - -```ts -export declare const acquireUseRelease: { - ( - use: (resource: A) => STM, - release: (resource: A) => STM - ): (acquire: STM) => Effect.Effect - ( - acquire: STM, - use: (resource: A) => STM, - release: (resource: A) => STM - ): Effect.Effect -} -``` - -Added in v2.0.0 - -## all - -Runs all the provided transactional effects in sequence respecting the -structure provided in input. - -Supports multiple arguments, a single argument tuple / array or record / -struct. - -**Signature** - -```ts -export declare const all: All.Signature -``` - -Added in v2.0.0 - -## attempt - -Creates an `STM` value from a partial (but pure) function. - -**Signature** - -```ts -export declare const attempt:
(evaluate: LazyArg) => STM -``` - -Added in v2.0.0 - -## check - -Checks the condition, and if it's true, returns unit, otherwise, retries. - -**Signature** - -```ts -export declare const check: (predicate: LazyArg) => STM -``` - -Added in v2.0.0 - -## cond - -Similar to Either.cond, evaluate the predicate, return the given A as -success if predicate returns true, and the given E as error otherwise - -**Signature** - -```ts -export declare const cond: ( - predicate: LazyArg, - error: LazyArg, - result: LazyArg -) => STM -``` - -Added in v2.0.0 - -## context - -Retrieves the environment inside an stm. - -**Signature** - -```ts -export declare const context: () => STM> -``` - -Added in v2.0.0 - -## contextWith - -Accesses the environment of the transaction to perform a transaction. - -**Signature** - -```ts -export declare const contextWith: (f: (environment: Context.Context) => R) => STM -``` - -Added in v2.0.0 - -## contextWithSTM - -Accesses the environment of the transaction to perform a transaction. - -**Signature** - -```ts -export declare const contextWithSTM: ( - f: (environment: Context.Context) => STM -) => STM -``` - -Added in v2.0.0 - -## die - -Fails the transactional effect with the specified defect. - -**Signature** - -```ts -export declare const die: (defect: unknown) => STM -``` - -Added in v2.0.0 - -## dieMessage - -Kills the fiber running the effect with a `Cause.RuntimeException` that -contains the specified message. - -**Signature** - -```ts -export declare const dieMessage: (message: string) => STM -``` - -Added in v2.0.0 - -## dieSync - -Fails the transactional effect with the specified lazily evaluated defect. - -**Signature** - -```ts -export declare const dieSync: (evaluate: LazyArg) => STM -``` - -Added in v2.0.0 - -## every - -Determines whether all elements of the `Iterable` satisfy the effectual -predicate. - -**Signature** - -```ts -export declare const every: { - (predicate: (a: A) => STM): (iterable: Iterable) => STM - (iterable: Iterable, predicate: (a: A) => STM): STM -} -``` - -Added in v2.0.0 - -## exists - -Determines whether any element of the `Iterable[A]` satisfies the effectual -predicate `f`. - -**Signature** - -```ts -export declare const exists: { - (predicate: (a: A) => STM): (iterable: Iterable) => STM - (iterable: Iterable, predicate: (a: A) => STM): STM -} -``` - -Added in v2.0.0 - -## fail - -Fails the transactional effect with the specified error. - -**Signature** - -```ts -export declare const fail: (error: E) => STM -``` - -Added in v2.0.0 - -## failSync - -Fails the transactional effect with the specified lazily evaluated error. - -**Signature** - -```ts -export declare const failSync: (evaluate: LazyArg) => STM -``` - -Added in v2.0.0 - -## fiberId - -Returns the fiber id of the fiber committing the transaction. - -**Signature** - -```ts -export declare const fiberId: STM -``` - -Added in v2.0.0 - -## filter - -Filters the collection using the specified effectual predicate. - -**Signature** - -```ts -export declare const filter: { - (predicate: (a: A) => STM): (iterable: Iterable) => STM - (iterable: Iterable, predicate: (a: A) => STM): STM -} -``` - -Added in v2.0.0 - -## filterNot - -Filters the collection using the specified effectual predicate, removing -all elements that satisfy the predicate. - -**Signature** - -```ts -export declare const filterNot: { - (predicate: (a: A) => STM): (iterable: Iterable) => STM - (iterable: Iterable, predicate: (a: A) => STM): STM -} -``` - -Added in v2.0.0 - -## fromEither - -Lifts an `Either` into a `STM`. - -**Signature** - -```ts -export declare const fromEither: (either: Either.Either) => STM -``` - -Added in v2.0.0 - -## fromOption - -Lifts an `Option` into a `STM`. - -**Signature** - -```ts -export declare const fromOption: (option: Option.Option) => STM, A> -``` - -Added in v2.0.0 - -## gen - -**Signature** - -```ts -export declare const gen: , AEff>( - f: (resume: Adapter) => Generator -) => STM< - [Eff] extends [never] ? never : [Eff] extends [STMGen] ? R : never, - [Eff] extends [never] ? never : [Eff] extends [STMGen] ? E : never, - AEff -> -``` - -Added in v2.0.0 - -## interrupt - -Interrupts the fiber running the effect. - -**Signature** - -```ts -export declare const interrupt: STM -``` - -Added in v2.0.0 - -## interruptAs - -Interrupts the fiber running the effect with the specified `FiberId`. - -**Signature** - -```ts -export declare const interruptAs: (fiberId: FiberId.FiberId) => STM -``` - -Added in v2.0.0 - -## iterate - -Iterates with the specified transactional function. The moral equivalent -of: - -```ts -const s = initial - -while (cont(s)) { - s = body(s) -} - -return s -``` - -**Signature** - -```ts -export declare const iterate: ( - initial: Z, - options: { readonly while: (z: Z) => boolean; readonly body: (z: Z) => STM } -) => STM -``` - -Added in v2.0.0 - -## loop - -Loops with the specified transactional function, collecting the results -into a list. The moral equivalent of: - -```ts -const as = [] -let s = initial - -while (cont(s)) { - as.push(body(s)) - s = inc(s) -} - -return as -``` - -**Signature** - -```ts -export declare const loop: { - ( - initial: Z, - options: { - readonly while: (z: Z) => boolean - readonly step: (z: Z) => Z - readonly body: (z: Z) => STM - readonly discard?: false | undefined - } - ): STM - ( - initial: Z, - options: { - readonly while: (z: Z) => boolean - readonly step: (z: Z) => Z - readonly body: (z: Z) => STM - readonly discard: true - } - ): STM -} -``` - -Added in v2.0.0 - -## mergeAll - -Merges an `Iterable` to a single `STM`, working sequentially. - -**Signature** - -```ts -export declare const mergeAll: { - (zero: A2, f: (a2: A2, a: A) => A2): (iterable: Iterable>) => STM - (iterable: Iterable>, zero: A2, f: (a2: A2, a: A) => A2): STM -} -``` - -Added in v2.0.0 - -## reduce - -Folds an `Iterable` using an effectual function f, working sequentially -from left to right. - -**Signature** - -```ts -export declare const reduce: { - (zero: S, f: (s: S, a: A) => STM): (iterable: Iterable) => STM - (iterable: Iterable, zero: S, f: (s: S, a: A) => STM): STM -} -``` - -Added in v2.0.0 - -## reduceAll - -Reduces an `Iterable` to a single `STM`, working sequentially. - -**Signature** - -```ts -export declare const reduceAll: { - ( - initial: STM, - f: (x: A, y: A) => A - ): (iterable: Iterable>) => STM - ( - iterable: Iterable>, - initial: STM, - f: (x: A, y: A) => A - ): STM -} -``` - -Added in v2.0.0 - -## reduceRight - -Folds an `Iterable` using an effectual function f, working sequentially -from right to left. - -**Signature** - -```ts -export declare const reduceRight: { - (zero: S, f: (s: S, a: A) => STM): (iterable: Iterable) => STM - (iterable: Iterable, zero: S, f: (s: S, a: A) => STM): STM -} -``` - -Added in v2.0.0 - -## replicate - -Replicates the given effect n times. If 0 or negative numbers are given, an -empty `Chunk` will be returned. - -**Signature** - -```ts -export declare const replicate: { - (n: number): (self: STM) => STM[] - (self: STM, n: number): STM[] -} -``` - -Added in v2.0.0 - -## replicateSTM - -Performs this transaction the specified number of times and collects the -results. - -**Signature** - -```ts -export declare const replicateSTM: { - (n: number): (self: STM) => STM - (self: STM, n: number): STM -} -``` - -Added in v2.0.0 - -## replicateSTMDiscard - -Performs this transaction the specified number of times, discarding the -results. - -**Signature** - -```ts -export declare const replicateSTMDiscard: { - (n: number): (self: STM) => STM - (self: STM, n: number): STM -} -``` - -Added in v2.0.0 - -## succeed - -Returns an `STM` effect that succeeds with the specified value. - -**Signature** - -```ts -export declare const succeed: (value: A) => STM -``` - -Added in v2.0.0 - -## succeedNone - -Returns an effect with the empty value. - -**Signature** - -```ts -export declare const succeedNone: STM> -``` - -Added in v2.0.0 - -## succeedSome - -Returns an effect with the optional value. - -**Signature** - -```ts -export declare const succeedSome: (value: A) => STM> -``` - -Added in v2.0.0 - -## suspend - -Suspends creation of the specified transaction lazily. - -**Signature** - -```ts -export declare const suspend: (evaluate: LazyArg>) => STM -``` - -Added in v2.0.0 - -## sync - -Returns an `STM` effect that succeeds with the specified lazily evaluated -value. - -**Signature** - -```ts -export declare const sync: (evaluate: () => A) => STM -``` - -Added in v2.0.0 - -## try - -Imports a synchronous side-effect into a pure value, translating any thrown -exceptions into typed failed effects. - -**Signature** - -```ts -export declare const try: { (options: { readonly try: LazyArg; readonly catch: (u: unknown) => E; }): STM; (try_: LazyArg): STM; } -``` - -Added in v2.0.0 - -## unit - -Returns an `STM` effect that succeeds with `Unit`. - -**Signature** - -```ts -export declare const unit: STM -``` - -Added in v2.0.0 - -# context - -## mapInputContext - -Transforms the environment being provided to this effect with the specified -function. - -**Signature** - -```ts -export declare const mapInputContext: { - (f: (context: Context.Context) => Context.Context): (self: STM) => STM - (self: STM, f: (context: Context.Context) => Context.Context): STM -} -``` - -Added in v2.0.0 - -## provideContext - -Provides the transaction its required environment, which eliminates its -dependency on `R`. - -**Signature** - -```ts -export declare const provideContext: { - (env: Context.Context): (self: STM) => STM - (self: STM, env: Context.Context): STM -} -``` - -Added in v2.0.0 - -## provideService - -Provides the effect with the single service it requires. If the transactional -effect requires more than one service use `provideEnvironment` instead. - -**Signature** - -```ts -export declare const provideService: { - >( - tag: T, - resource: Context.Tag.Service - ): (self: STM) => STM>, E, A> - >( - self: STM, - tag: T, - resource: Context.Tag.Service - ): STM>, E, A> -} -``` - -Added in v2.0.0 - -## provideServiceSTM - -Provides the effect with the single service it requires. If the transactional -effect requires more than one service use `provideEnvironment` instead. - -**Signature** - -```ts -export declare const provideServiceSTM: { - , R1, E1>( - tag: T, - stm: STM> - ): (self: STM) => STM>, E1 | E, A> - , R1, E1>( - self: STM, - tag: T, - stm: STM> - ): STM>, E | E1, A> -} -``` - -Added in v2.0.0 - -## provideSomeContext - -Splits the context into two parts, providing one part using the -specified layer and leaving the remainder `R0`. - -**Signature** - -```ts -export declare const provideSomeContext: { - (context: Context.Context): (self: STM) => STM, E, A> - (self: STM, context: Context.Context): STM, E, A> -} -``` - -Added in v2.0.0 - -# destructors - -## commit - -Commits this transaction atomically. - -**Signature** - -```ts -export declare const commit: (self: STM) => Effect.Effect -``` - -Added in v2.0.0 - -## commitEither - -Commits this transaction atomically, regardless of whether the transaction -is a success or a failure. - -**Signature** - -```ts -export declare const commitEither: (self: STM) => Effect.Effect -``` - -Added in v2.0.0 - -# do notation - -## Do - -**Signature** - -```ts -export declare const Do: STM -``` - -Added in v2.0.0 - -## bind - -**Signature** - -```ts -export declare const bind: { - ( - tag: Exclude, - f: (_: K) => STM - ): (self: STM) => STM> - ( - self: STM, - tag: Exclude, - f: (_: K) => STM - ): STM> -} -``` - -Added in v2.0.0 - -## bindTo - -**Signature** - -```ts -export declare const bindTo: { - (tag: N): (self: STM) => STM> - (self: STM, tag: N): STM> -} -``` - -Added in v2.0.0 - -## let - -**Signature** - -```ts -export declare const let: { - ( - tag: Exclude, - f: (_: K) => A - ): (self: STM) => STM> - ( - self: STM, - tag: Exclude, - f: (_: K) => A - ): STM> -} -``` - -Added in v2.0.0 - -# elements - -## firstSuccessOf - -This function takes an iterable of `STM` values and returns a new -`STM` value that represents the first `STM` value in the iterable -that succeeds. If all of the `Effect` values in the iterable fail, then -the resulting `STM` value will fail as well. - -This function is sequential, meaning that the `STM` values in the -iterable will be executed in sequence, and the first one that succeeds -will determine the outcome of the resulting `STM` value. - -**Signature** - -```ts -export declare const firstSuccessOf: (effects: Iterable>) => STM -``` - -Added in v2.0.0 - -# error handling - -## catchAll - -Recovers from all errors. - -**Signature** - -```ts -export declare const catchAll: { - (f: (e: E) => STM): (self: STM) => STM - (self: STM, f: (e: E) => STM): STM -} -``` - -Added in v2.0.0 - -## catchSome - -Recovers from some or all of the error cases. - -**Signature** - -```ts -export declare const catchSome: { - ( - pf: (error: E) => Option.Option> - ): (self: STM) => STM - ( - self: STM, - pf: (error: E) => Option.Option> - ): STM -} -``` - -Added in v2.0.0 - -## catchTag - -Recovers from the specified tagged error. - -**Signature** - -```ts -export declare const catchTag: { - ( - k: K, - f: (e: Extract) => STM - ): (self: STM) => STM, A1 | A> - ( - self: STM, - k: K, - f: (e: Extract) => STM - ): STM, A | A1> -} -``` - -Added in v2.0.0 - -## catchTags - -Recovers from multiple tagged errors. - -**Signature** - -```ts -export declare const catchTags: { - < - E extends { _tag: string }, - Cases extends { [K in E["_tag"]]+?: ((error: Extract) => STM) | undefined } - >( - cases: Cases - ): ( - self: STM - ) => STM< - | R - | { [K in keyof Cases]: Cases[K] extends (...args: Array) => STM ? R : never }[keyof Cases], - | Exclude - | { [K in keyof Cases]: Cases[K] extends (...args: Array) => STM ? E : never }[keyof Cases], - | A - | { [K in keyof Cases]: Cases[K] extends (...args: Array) => STM ? A : never }[keyof Cases] - > - < - R, - E extends { _tag: string }, - A, - Cases extends { [K in E["_tag"]]+?: ((error: Extract) => STM) | undefined } - >( - self: STM, - cases: Cases - ): STM< - | R - | { [K in keyof Cases]: Cases[K] extends (...args: Array) => STM ? R : never }[keyof Cases], - | Exclude - | { [K in keyof Cases]: Cases[K] extends (...args: Array) => STM ? E : never }[keyof Cases], - | A - | { [K in keyof Cases]: Cases[K] extends (...args: Array) => STM ? A : never }[keyof Cases] - > -} -``` - -Added in v2.0.0 - -## orDie - -Translates `STM` effect failure into death of the fiber, making all -failures unchecked and not a part of the type of the effect. - -**Signature** - -```ts -export declare const orDie: (self: STM) => STM -``` - -Added in v2.0.0 - -## orDieWith - -Keeps none of the errors, and terminates the fiber running the `STM` effect -with them, using the specified function to convert the `E` into a defect. - -**Signature** - -```ts -export declare const orDieWith: { - (f: (error: E) => unknown): (self: STM) => STM - (self: STM, f: (error: E) => unknown): STM -} -``` - -Added in v2.0.0 - -## orElse - -Tries this effect first, and if it fails or retries, tries the other -effect. - -**Signature** - -```ts -export declare const orElse: { - (that: LazyArg>): (self: STM) => STM - (self: STM, that: LazyArg>): STM -} -``` - -Added in v2.0.0 - -## orElseEither - -Returns a transactional effect that will produce the value of this effect -in left side, unless it fails or retries, in which case, it will produce -the value of the specified effect in right side. - -**Signature** - -```ts -export declare const orElseEither: { - (that: LazyArg>): (self: STM) => STM> - (self: STM, that: LazyArg>): STM> -} -``` - -Added in v2.0.0 - -## orElseFail - -Tries this effect first, and if it fails or retries, fails with the -specified error. - -**Signature** - -```ts -export declare const orElseFail: { - (error: LazyArg): (self: STM) => STM - (self: STM, error: LazyArg): STM -} -``` - -Added in v2.0.0 - -## orElseOptional - -Returns an effect that will produce the value of this effect, unless it -fails with the `None` value, in which case it will produce the value of the -specified effect. - -**Signature** - -```ts -export declare const orElseOptional: { - ( - that: LazyArg, A2>> - ): (self: STM, A>) => STM, A2 | A> - ( - self: STM, A>, - that: LazyArg, A2>> - ): STM, A | A2> -} -``` - -Added in v2.0.0 - -## orElseSucceed - -Tries this effect first, and if it fails or retries, succeeds with the -specified value. - -**Signature** - -```ts -export declare const orElseSucceed: { - (value: LazyArg): (self: STM) => STM - (self: STM, value: LazyArg): STM -} -``` - -Added in v2.0.0 - -## orTry - -Tries this effect first, and if it enters retry, then it tries the other -effect. This is an equivalent of Haskell's orElse. - -**Signature** - -```ts -export declare const orTry: { - (that: LazyArg>): (self: STM) => STM - (self: STM, that: LazyArg>): STM -} -``` - -Added in v2.0.0 - -## retry - -Abort and retry the whole transaction when any of the underlying -transactional variables have changed. - -**Signature** - -```ts -export declare const retry: STM -``` - -Added in v2.0.0 - -# filtering - -## filterOrDie - -Dies with specified defect if the predicate fails. - -**Signature** - -```ts -export declare const filterOrDie: { - (refinement: Refinement, defect: LazyArg): (self: STM) => STM - (predicate: Predicate, defect: LazyArg): (self: STM) => STM - (self: STM, refinement: Refinement, defect: LazyArg): STM - (self: STM, predicate: Predicate, defect: LazyArg): STM -} -``` - -Added in v2.0.0 - -## filterOrDieMessage - -Dies with a `Cause.RuntimeException` having the specified message if the -predicate fails. - -**Signature** - -```ts -export declare const filterOrDieMessage: { - (refinement: Refinement, message: string): (self: STM) => STM - (predicate: Predicate, message: string): (self: STM) => STM - (self: STM, refinement: Refinement, message: string): STM - (self: STM, predicate: Predicate, message: string): STM -} -``` - -Added in v2.0.0 - -## filterOrElse - -Supplies `orElse` if the predicate fails. - -**Signature** - -```ts -export declare const filterOrElse: { - ( - refinement: Refinement, - orElse: (a: X) => STM - ): (self: STM) => STM - ( - predicate: Predicate, - orElse: (a: Y) => STM - ): (self: STM) => STM - ( - self: STM, - refinement: Refinement, - orElse: (a: X) => STM - ): STM - ( - self: STM, - predicate: Predicate, - orElse: (a: Y) => STM - ): STM -} -``` - -Added in v2.0.0 - -## filterOrFail - -Fails with the specified error if the predicate fails. - -**Signature** - -```ts -export declare const filterOrFail: { - ( - refinement: Refinement, - orFailWith: (a: X) => E2 - ): (self: STM) => STM - ( - predicate: Predicate, - orFailWith: (a: Y) => E2 - ): (self: STM) => STM - ( - self: STM, - refinement: Refinement, - orFailWith: (a: X) => E2 - ): STM - ( - self: STM, - predicate: Predicate, - orFailWith: (a: Y) => E2 - ): STM -} -``` - -Added in v2.0.0 - -# finalization - -## ensuring - -Executes the specified finalization transaction whether or not this effect -succeeds. Note that as with all STM transactions, if the full transaction -fails, everything will be rolled back. - -**Signature** - -```ts -export declare const ensuring: { - (finalizer: STM): (self: STM) => STM - (self: STM, finalizer: STM): STM -} -``` - -Added in v2.0.0 - -# folding - -## match - -Folds over the `STM` effect, handling both failure and success, but not -retry. - -**Signature** - -```ts -export declare const match: { - (options: { - readonly onFailure: (error: E) => A2 - readonly onSuccess: (value: A) => A3 - }): (self: STM) => STM - ( - self: STM, - options: { readonly onFailure: (error: E) => A2; readonly onSuccess: (value: A) => A3 } - ): STM -} -``` - -Added in v2.0.0 - -## matchSTM - -Effectfully folds over the `STM` effect, handling both failure and success. - -**Signature** - -```ts -export declare const matchSTM: { - (options: { - readonly onFailure: (e: E) => STM - readonly onSuccess: (a: A) => STM - }): (self: STM) => STM - ( - self: STM, - options: { readonly onFailure: (e: E) => STM; readonly onSuccess: (a: A) => STM } - ): STM -} -``` - -Added in v2.0.0 - -# getters - -## head - -Returns a successful effect with the head of the list if the list is -non-empty or fails with the error `None` if the list is empty. - -**Signature** - -```ts -export declare const head: (self: STM>) => STM, A> -``` - -Added in v2.0.0 - -## isFailure - -Returns whether this transactional effect is a failure. - -**Signature** - -```ts -export declare const isFailure: (self: STM) => STM -``` - -Added in v2.0.0 - -## isSuccess - -Returns whether this transactional effect is a success. - -**Signature** - -```ts -export declare const isSuccess: (self: STM) => STM -``` - -Added in v2.0.0 - -## some - -Converts an option on values into an option on errors. - -**Signature** - -```ts -export declare const some: (self: STM>) => STM, A> -``` - -Added in v2.0.0 - -## unsome - -Converts an option on errors into an option on values. - -**Signature** - -```ts -export declare const unsome: (self: STM, A>) => STM> -``` - -Added in v2.0.0 - -# mapping - -## as - -Maps the success value of this effect to the specified constant value. - -**Signature** - -```ts -export declare const as: { - (value: A2): (self: STM) => STM - (self: STM, value: A2): STM -} -``` - -Added in v2.0.0 - -## asSome - -Maps the success value of this effect to an optional value. - -**Signature** - -```ts -export declare const asSome: (self: STM) => STM> -``` - -Added in v2.0.0 - -## asSomeError - -Maps the error value of this effect to an optional value. - -**Signature** - -```ts -export declare const asSomeError: (self: STM) => STM, A> -``` - -Added in v2.0.0 - -## asUnit - -This function maps the success value of an `STM` to `void`. If the original -`STM` succeeds, the returned `STM` will also succeed. If the original `STM` -fails, the returned `STM` will fail with the same error. - -**Signature** - -```ts -export declare const asUnit: (self: STM) => STM -``` - -Added in v2.0.0 - -## map - -Maps the value produced by the effect. - -**Signature** - -```ts -export declare const map: { - (f: (a: A) => B): (self: STM) => STM - (self: STM, f: (a: A) => B): STM -} -``` - -Added in v2.0.0 - -## mapAttempt - -Maps the value produced by the effect with the specified function that may -throw exceptions but is otherwise pure, translating any thrown exceptions -into typed failed effects. - -**Signature** - -```ts -export declare const mapAttempt: { - (f: (a: A) => B): (self: STM) => STM - (self: STM, f: (a: A) => B): STM -} -``` - -Added in v2.0.0 - -## mapBoth - -Returns an `STM` effect whose failure and success channels have been mapped -by the specified pair of functions, `f` and `g`. - -**Signature** - -```ts -export declare const mapBoth: { - (options: { - readonly onFailure: (error: E) => E2 - readonly onSuccess: (value: A) => A2 - }): (self: STM) => STM - ( - self: STM, - options: { readonly onFailure: (error: E) => E2; readonly onSuccess: (value: A) => A2 } - ): STM -} -``` - -Added in v2.0.0 - -## mapError - -Maps from one error type to another. - -**Signature** - -```ts -export declare const mapError: { - (f: (error: E) => E2): (self: STM) => STM - (self: STM, f: (error: E) => E2): STM -} -``` - -Added in v2.0.0 - -# models - -## Adapter (interface) - -**Signature** - -```ts -export interface Adapter { - (self: STM): STMGen - (a: A, ab: (a: A) => STM<_R, _E, _A>): STMGen<_R, _E, _A> - (a: A, ab: (a: A) => B, bc: (b: B) => STM<_R, _E, _A>): STMGen<_R, _E, _A> - (a: A, ab: (a: A) => B, bc: (b: B) => C, cd: (c: C) => STM<_R, _E, _A>): STMGen<_R, _E, _A> - ( - a: A, - ab: (a: A) => B, - bc: (b: B) => C, - cd: (c: C) => D, - de: (d: D) => STM<_R, _E, _A> - ): STMGen<_R, _E, _A> - ( - a: A, - ab: (a: A) => B, - bc: (b: B) => C, - cd: (c: C) => D, - de: (d: D) => E, - ef: (e: E) => STM<_R, _E, _A> - ): STMGen<_R, _E, _A> - ( - a: A, - ab: (a: A) => B, - bc: (b: B) => C, - cd: (c: C) => D, - de: (d: D) => E, - ef: (e: E) => F, - fg: (f: F) => STM<_R, _E, _A> - ): STMGen<_R, _E, _A> - ( - a: A, - ab: (a: A) => B, - bc: (b: B) => C, - cd: (c: C) => D, - de: (d: D) => E, - ef: (e: E) => F, - fg: (f: F) => G, - gh: (g: F) => STM<_R, _E, _A> - ): STMGen<_R, _E, _A> - ( - a: A, - ab: (a: A) => B, - bc: (b: B) => C, - cd: (c: C) => D, - de: (d: D) => E, - ef: (e: E) => F, - fg: (f: F) => G, - gh: (g: G) => H, - hi: (g: H) => STM<_R, _E, _A> - ): STMGen<_R, _E, _A> - ( - a: A, - ab: (a: A) => B, - bc: (b: B) => C, - cd: (c: C) => D, - de: (d: D) => E, - ef: (e: E) => F, - fg: (f: F) => G, - gh: (g: G) => H, - hi: (h: H) => I, - ij: (i: I) => STM<_R, _E, _A> - ): STMGen<_R, _E, _A> - ( - a: A, - ab: (a: A) => B, - bc: (b: B) => C, - cd: (c: C) => D, - de: (d: D) => E, - ef: (e: E) => F, - fg: (f: F) => G, - gh: (g: G) => H, - hi: (h: H) => I, - ij: (i: I) => J, - jk: (j: J) => STM<_R, _E, _A> - ): STMGen<_R, _E, _A> - ( - a: A, - ab: (a: A) => B, - bc: (b: B) => C, - cd: (c: C) => D, - de: (d: D) => E, - ef: (e: E) => F, - fg: (f: F) => G, - gh: (g: G) => H, - hi: (h: H) => I, - ij: (i: I) => J, - jk: (j: J) => K, - kl: (k: K) => STM<_R, _E, _A> - ): STMGen<_R, _E, _A> - ( - a: A, - ab: (a: A) => B, - bc: (b: B) => C, - cd: (c: C) => D, - de: (d: D) => E, - ef: (e: E) => F, - fg: (f: F) => G, - gh: (g: G) => H, - hi: (h: H) => I, - ij: (i: I) => J, - jk: (j: J) => K, - kl: (k: K) => L, - lm: (l: L) => STM<_R, _E, _A> - ): STMGen<_R, _E, _A> - ( - a: A, - ab: (a: A) => B, - bc: (b: B) => C, - cd: (c: C) => D, - de: (d: D) => E, - ef: (e: E) => F, - fg: (f: F) => G, - gh: (g: G) => H, - hi: (h: H) => I, - ij: (i: I) => J, - jk: (j: J) => K, - kl: (k: K) => L, - lm: (l: L) => M, - mn: (m: M) => STM<_R, _E, _A> - ): STMGen<_R, _E, _A> - ( - a: A, - ab: (a: A) => B, - bc: (b: B) => C, - cd: (c: C) => D, - de: (d: D) => E, - ef: (e: E) => F, - fg: (f: F) => G, - gh: (g: G) => H, - hi: (h: H) => I, - ij: (i: I) => J, - jk: (j: J) => K, - kl: (k: K) => L, - lm: (l: L) => M, - mn: (m: M) => N, - no: (n: N) => STM<_R, _E, _A> - ): STMGen<_R, _E, _A> - ( - a: A, - ab: (a: A) => B, - bc: (b: B) => C, - cd: (c: C) => D, - de: (d: D) => E, - ef: (e: E) => F, - fg: (f: F) => G, - gh: (g: G) => H, - hi: (h: H) => I, - ij: (i: I) => J, - jk: (j: J) => K, - kl: (k: K) => L, - lm: (l: L) => M, - mn: (m: M) => N, - no: (n: N) => O, - op: (o: O) => STM<_R, _E, _A> - ): STMGen<_R, _E, _A> - ( - a: A, - ab: (a: A) => B, - bc: (b: B) => C, - cd: (c: C) => D, - de: (d: D) => E, - ef: (e: E) => F, - fg: (f: F) => G, - gh: (g: G) => H, - hi: (h: H) => I, - ij: (i: I) => J, - jk: (j: J) => K, - kl: (k: K) => L, - lm: (l: L) => M, - mn: (m: M) => N, - no: (n: N) => O, - op: (o: O) => P, - pq: (p: P) => STM<_R, _E, _A> - ): STMGen<_R, _E, _A> - ( - a: A, - ab: (a: A) => B, - bc: (b: B) => C, - cd: (c: C) => D, - de: (d: D) => E, - ef: (e: E) => F, - fg: (f: F) => G, - gh: (g: G) => H, - hi: (h: H) => I, - ij: (i: I) => J, - jk: (j: J) => K, - kl: (k: K) => L, - lm: (l: L) => M, - mn: (m: M) => N, - no: (n: N) => O, - op: (o: O) => P, - pq: (p: P) => Q, - qr: (q: Q) => STM<_R, _E, _A> - ): STMGen<_R, _E, _A> - ( - a: A, - ab: (a: A) => B, - bc: (b: B) => C, - cd: (c: C) => D, - de: (d: D) => E, - ef: (e: E) => F, - fg: (f: F) => G, - gh: (g: G) => H, - hi: (h: H) => I, - ij: (i: I) => J, - jk: (j: J) => K, - kl: (k: K) => L, - lm: (l: L) => M, - mn: (m: M) => N, - no: (n: N) => O, - op: (o: O) => P, - pq: (p: P) => Q, - qr: (q: Q) => R, - rs: (r: R) => STM<_R, _E, _A> - ): STMGen<_R, _E, _A> - ( - a: A, - ab: (a: A) => B, - bc: (b: B) => C, - cd: (c: C) => D, - de: (d: D) => E, - ef: (e: E) => F, - fg: (f: F) => G, - gh: (g: G) => H, - hi: (h: H) => I, - ij: (i: I) => J, - jk: (j: J) => K, - kl: (k: K) => L, - lm: (l: L) => M, - mn: (m: M) => N, - no: (n: N) => O, - op: (o: O) => P, - pq: (p: P) => Q, - qr: (q: Q) => R, - rs: (r: R) => S, - st: (s: S) => STM<_R, _E, _A> - ): STMGen<_R, _E, _A> - ( - a: A, - ab: (a: A) => B, - bc: (b: B) => C, - cd: (c: C) => D, - de: (d: D) => E, - ef: (e: E) => F, - fg: (f: F) => G, - gh: (g: G) => H, - hi: (h: H) => I, - ij: (i: I) => J, - jk: (j: J) => K, - kl: (k: K) => L, - lm: (l: L) => M, - mn: (m: M) => N, - no: (n: N) => O, - op: (o: O) => P, - pq: (p: P) => Q, - qr: (q: Q) => R, - rs: (r: R) => S, - st: (s: S) => T, - tu: (s: T) => STM<_R, _E, _A> - ): STMGen<_R, _E, _A> -} -``` - -Added in v2.0.0 - -## STM (interface) - -`STM` represents an effect that can be performed transactionally, -resulting in a failure `E` or a value `A` that may require an environment -`R` to execute. - -Software Transactional Memory is a technique which allows composition of -arbitrary atomic operations. It is the software analog of transactions in -database systems. - -The API is lifted directly from the Haskell package Control.Concurrent.STM -although the implementation does not resemble the Haskell one at all. - -See http://hackage.haskell.org/package/stm-2.5.0.0/docs/Control-Concurrent-STM.html - -STM in Haskell was introduced in: - -Composable memory transactions, by Tim Harris, Simon Marlow, Simon Peyton -Jones, and Maurice Herlihy, in ACM Conference on Principles and Practice of -Parallel Programming 2005. - -See https://www.microsoft.com/en-us/research/publication/composable-memory-transactions/ - -See also: -Lock Free Data Structures using STMs in Haskell, by Anthony Discolo, Tim -Harris, Simon Marlow, Simon Peyton Jones, Satnam Singh) FLOPS 2006: Eighth -International Symposium on Functional and Logic Programming, Fuji Susono, -JAPAN, April 2006 - -https://www.microsoft.com/en-us/research/publication/lock-free-data-structures-using-stms-in-haskell/ - -The implemtation is based on the ZIO STM module, while JS environments have -no race conditions from multiple threads STM provides greater benefits for -synchronization of Fibers and transactional data-types can be quite useful. - -**Signature** - -```ts -export interface STM extends Effect.Effect, STM.Variance, Pipeable { - [Unify.typeSymbol]?: unknown - [Unify.unifySymbol]?: STMUnify - [Unify.ignoreSymbol]?: STMUnifyIgnore -} -``` - -Added in v2.0.0 - -## STMGen (interface) - -**Signature** - -```ts -export interface STMGen { - readonly _R: () => R - readonly _E: () => E - readonly _A: () => A - readonly value: STM - readonly [Symbol.iterator]: () => Generator, A> -} -``` - -Added in v2.0.0 - -## STMUnify (interface) - -**Signature** - -```ts -export interface STMUnify extends Effect.EffectUnify { - STM?: () => A[Unify.typeSymbol] extends STM | infer _ ? STM : never -} -``` - -Added in v2.0.0 - -## STMUnifyIgnore (interface) - -**Signature** - -```ts -export interface STMUnifyIgnore extends Effect.EffectUnifyIgnore { - Effect?: true -} -``` - -Added in v2.0.0 - -# mutations - -## collect - -Simultaneously filters and maps the value produced by this effect. - -**Signature** - -```ts -export declare const collect: { - (pf: (a: A) => Option.Option): (self: STM) => STM - (self: STM, pf: (a: A) => Option.Option): STM -} -``` - -Added in v2.0.0 - -## collectSTM - -Simultaneously filters and maps the value produced by this effect. - -**Signature** - -```ts -export declare const collectSTM: { - (pf: (a: A) => Option.Option>): (self: STM) => STM - (self: STM, pf: (a: A) => Option.Option>): STM -} -``` - -Added in v2.0.0 - -## either - -Converts the failure channel into an `Either`. - -**Signature** - -```ts -export declare const either: (self: STM) => STM> -``` - -Added in v2.0.0 - -## eventually - -Returns an effect that ignores errors and runs repeatedly until it -eventually succeeds. - -**Signature** - -```ts -export declare const eventually: (self: STM) => STM -``` - -Added in v2.0.0 - -## flip - -Flips the success and failure channels of this transactional effect. This -allows you to use all methods on the error channel, possibly before -flipping back. - -**Signature** - -```ts -export declare const flip: (self: STM) => STM -``` - -Added in v2.0.0 - -## flipWith - -Swaps the error/value parameters, applies the function `f` and flips the -parameters back - -**Signature** - -```ts -export declare const flipWith: { - (f: (stm: STM) => STM): (self: STM) => STM - (self: STM, f: (stm: STM) => STM): STM -} -``` - -Added in v2.0.0 - -## if - -Runs `onTrue` if the result of `b` is `true` and `onFalse` otherwise. - -**Signature** - -```ts -export declare const if: { (options: { readonly onTrue: STM; readonly onFalse: STM; }): (self: boolean | STM) => STM; (self: boolean, options: { readonly onTrue: STM; readonly onFalse: STM; }): STM; (self: STM, options: { readonly onTrue: STM; readonly onFalse: STM; }): STM; } -``` - -Added in v2.0.0 - -## ignore - -Returns a new effect that ignores the success or failure of this effect. - -**Signature** - -```ts -export declare const ignore: (self: STM) => STM -``` - -Added in v2.0.0 - -## merge - -Returns a new effect where the error channel has been merged into the -success channel to their common combined type. - -**Signature** - -```ts -export declare const merge: (self: STM) => STM -``` - -Added in v2.0.0 - -## negate - -Returns a new effect where boolean value of this effect is negated. - -**Signature** - -```ts -export declare const negate: (self: STM) => STM -``` - -Added in v2.0.0 - -## none - -Requires the option produced by this value to be `None`. - -**Signature** - -```ts -export declare const none: (self: STM>) => STM, void> -``` - -Added in v2.0.0 - -## option - -Converts the failure channel into an `Option`. - -**Signature** - -```ts -export declare const option: (self: STM) => STM> -``` - -Added in v2.0.0 - -## refineOrDie - -Keeps some of the errors, and terminates the fiber with the rest. - -**Signature** - -```ts -export declare const refineOrDie: { - (pf: (error: E) => Option.Option): (self: STM) => STM - (self: STM, pf: (error: E) => Option.Option): STM -} -``` - -Added in v2.0.0 - -## refineOrDieWith - -Keeps some of the errors, and terminates the fiber with the rest, using the -specified function to convert the `E` into a `Throwable`. - -**Signature** - -```ts -export declare const refineOrDieWith: { - (pf: (error: E) => Option.Option, f: (error: E) => unknown): (self: STM) => STM - (self: STM, pf: (error: E) => Option.Option, f: (error: E) => unknown): STM -} -``` - -Added in v2.0.0 - -## reject - -Fail with the returned value if the `PartialFunction` matches, otherwise -continue with our held value. - -**Signature** - -```ts -export declare const reject: { - (pf: (a: A) => Option.Option): (self: STM) => STM - (self: STM, pf: (a: A) => Option.Option): STM -} -``` - -Added in v2.0.0 - -## rejectSTM - -Continue with the returned computation if the specified partial function -matches, translating the successful match into a failure, otherwise continue -with our held value. - -**Signature** - -```ts -export declare const rejectSTM: { - (pf: (a: A) => Option.Option>): (self: STM) => STM - (self: STM, pf: (a: A) => Option.Option>): STM -} -``` - -Added in v2.0.0 - -## repeatUntil - -Repeats this `STM` effect until its result satisfies the specified -predicate. - -**WARNING**: `repeatUntil` uses a busy loop to repeat the effect and will -consume a thread until it completes (it cannot yield). This is because STM -describes a single atomic transaction which must either complete, retry or -fail a transaction before yielding back to the Effect runtime. - -- Use `retryUntil` instead if you don't need to maintain transaction - state for repeats. -- Ensure repeating the STM effect will eventually satisfy the predicate. - -**Signature** - -```ts -export declare const repeatUntil: { - (predicate: Predicate): (self: STM) => STM - (self: STM, predicate: Predicate): STM -} -``` - -Added in v2.0.0 - -## repeatWhile - -Repeats this `STM` effect while its result satisfies the specified -predicate. - -**WARNING**: `repeatWhile` uses a busy loop to repeat the effect and will -consume a thread until it completes (it cannot yield). This is because STM -describes a single atomic transaction which must either complete, retry or -fail a transaction before yielding back to the Effect runtime. - -- Use `retryWhile` instead if you don't need to maintain transaction - state for repeats. -- Ensure repeating the STM effect will eventually not satisfy the - predicate. - -**Signature** - -```ts -export declare const repeatWhile: { - (predicate: Predicate): (self: STM) => STM - (self: STM, predicate: Predicate): STM -} -``` - -Added in v2.0.0 - -## retryUntil - -Filters the value produced by this effect, retrying the transaction until -the predicate returns `true` for the value. - -**Signature** - -```ts -export declare const retryUntil: { - (predicate: Predicate): (self: STM) => STM - (self: STM, predicate: Predicate): STM -} -``` - -Added in v2.0.0 - -## retryWhile - -Filters the value produced by this effect, retrying the transaction while -the predicate returns `true` for the value. - -**Signature** - -```ts -export declare const retryWhile: { - (predicate: Predicate): (self: STM) => STM - (self: STM, predicate: Predicate): STM -} -``` - -Added in v2.0.0 - -## summarized - -Summarizes a `STM` effect by computing a provided value before and after -execution, and then combining the values to produce a summary, together -with the result of execution. - -**Signature** - -```ts -export declare const summarized: { - ( - summary: STM, - f: (before: A2, after: A2) => A3 - ): (self: STM) => STM - ( - self: STM, - summary: STM, - f: (before: A2, after: A2) => A3 - ): STM -} -``` - -Added in v2.0.0 - -## unless - -The moral equivalent of `if (!p) exp` - -**Signature** - -```ts -export declare const unless: { - (predicate: LazyArg): (self: STM) => STM> - (self: STM, predicate: LazyArg): STM> -} -``` - -Added in v2.0.0 - -## unlessSTM - -The moral equivalent of `if (!p) exp` when `p` has side-effects - -**Signature** - -```ts -export declare const unlessSTM: { - (predicate: STM): (self: STM) => STM> - (self: STM, predicate: STM): STM> -} -``` - -Added in v2.0.0 - -## validateAll - -Feeds elements of type `A` to `f` and accumulates all errors in error -channel or successes in success channel. - -This combinator is lossy meaning that if there are errors all successes -will be lost. To retain all information please use `STM.partition`. - -**Signature** - -```ts -export declare const validateAll: { - (f: (a: A) => STM): (elements: Iterable) => STM - (elements: Iterable, f: (a: A) => STM): STM -} -``` - -Added in v2.0.0 - -## validateFirst - -Feeds elements of type `A` to `f` until it succeeds. Returns first success -or the accumulation of all errors. - -**Signature** - -```ts -export declare const validateFirst: { - (f: (a: A) => STM): (elements: Iterable) => STM - (elements: Iterable, f: (a: A) => STM): STM -} -``` - -Added in v2.0.0 - -## when - -The moral equivalent of `if (p) exp`. - -**Signature** - -```ts -export declare const when: { - (predicate: LazyArg): (self: STM) => STM> - (self: STM, predicate: LazyArg): STM> -} -``` - -Added in v2.0.0 - -## whenSTM - -The moral equivalent of `if (p) exp` when `p` has side-effects. - -**Signature** - -```ts -export declare const whenSTM: { - (predicate: STM): (self: STM) => STM> - (self: STM, predicate: STM): STM> -} -``` - -Added in v2.0.0 - -# refinements - -## isSTM - -Returns `true` if the provided value is an `STM`, `false` otherwise. - -**Signature** - -```ts -export declare const isSTM: (u: unknown) => u is STM -``` - -Added in v2.0.0 - -# sequencing - -## flatMap - -Feeds the value produced by this effect to the specified function, and then -runs the returned effect as well to produce its results. - -**Signature** - -```ts -export declare const flatMap: { - (f: (a: A) => STM): (self: STM) => STM - (self: STM, f: (a: A) => STM): STM -} -``` - -Added in v2.0.0 - -## flatten - -Flattens out a nested `STM` effect. - -**Signature** - -```ts -export declare const flatten: (self: STM>) => STM -``` - -Added in v2.0.0 - -## tap - -"Peeks" at the success of transactional effect. - -**Signature** - -```ts -export declare const tap: { - (f: (a: X) => STM): (self: STM) => STM - (self: STM, f: (a: X) => STM): STM -} -``` - -Added in v2.0.0 - -## tapBoth - -"Peeks" at both sides of an transactional effect. - -**Signature** - -```ts -export declare const tapBoth: { - (options: { - readonly onFailure: (error: XE) => STM - readonly onSuccess: (value: XA) => STM - }): (self: STM) => STM - ( - self: STM, - options: { readonly onFailure: (error: XE) => STM; readonly onSuccess: (value: XA) => STM } - ): STM -} -``` - -Added in v2.0.0 - -## tapError - -"Peeks" at the error of the transactional effect. - -**Signature** - -```ts -export declare const tapError: { - (f: (error: X) => STM): (self: STM) => STM - (self: STM, f: (error: X) => STM): STM -} -``` - -Added in v2.0.0 - -# symbols - -## STMTypeId - -**Signature** - -```ts -export declare const STMTypeId: typeof STMTypeId -``` - -Added in v2.0.0 - -## STMTypeId (type alias) - -**Signature** - -```ts -export type STMTypeId = typeof STMTypeId -``` - -Added in v2.0.0 - -# traversing - -## forEach - -Applies the function `f` to each element of the `Iterable` and returns -a transactional effect that produces a new `Chunk`. - -**Signature** - -```ts -export declare const forEach: { - ( - f: (a: A) => STM, - options?: { readonly discard?: false | undefined } - ): (elements: Iterable) => STM - ( - f: (a: A) => STM, - options: { readonly discard: true } - ): (elements: Iterable) => STM - ( - elements: Iterable, - f: (a: A) => STM, - options?: { readonly discard?: false | undefined } - ): STM - (elements: Iterable, f: (a: A) => STM, options: { readonly discard: true }): STM -} -``` - -Added in v2.0.0 - -## partition - -Feeds elements of type `A` to a function `f` that returns an effect. -Collects all successes and failures in a tupled fashion. - -**Signature** - -```ts -export declare const partition: { - (f: (a: A) => STM): (elements: Iterable) => STM - (elements: Iterable, f: (a: A) => STM): STM -} -``` - -Added in v2.0.0 - -# type lambdas - -## STMTypeLambda (interface) - -**Signature** - -```ts -export interface STMTypeLambda extends TypeLambda { - readonly type: STM -} -``` - -Added in v2.0.0 - -# utils - -## All (namespace) - -Added in v2.0.0 - -### Signature (interface) - -**Signature** - -```ts -export interface Signature { - | Iterable | Record, O extends Options>( - arg: Narrow, - options?: O - ): [Arg] extends [ReadonlyArray] - ? ReturnTuple> - : [Arg] extends [Iterable] - ? ReturnIterable> - : [Arg] extends [Record] - ? ReturnObject> - : never -} -``` - -Added in v2.0.0 - -### Options (type alias) - -**Signature** - -```ts -export type Options = { - readonly discard?: boolean | undefined -} -``` - -Added in v2.0.0 - -## STM (namespace) - -Added in v2.0.0 - -### Variance (interface) - -**Signature** - -```ts -export interface Variance { - readonly [STMTypeId]: { - readonly _R: (_: never) => R - readonly _E: (_: never) => E - readonly _A: (_: never) => A - } -} -``` - -Added in v2.0.0 - -# zipping - -## zip - -Sequentially zips this value with the specified one. - -**Signature** - -```ts -export declare const zip: { - (that: STM): (self: STM) => STM - (self: STM, that: STM): STM -} -``` - -Added in v2.0.0 - -## zipLeft - -Sequentially zips this value with the specified one, discarding the second -element of the tuple. - -**Signature** - -```ts -export declare const zipLeft: { - (that: STM): (self: STM) => STM - (self: STM, that: STM): STM -} -``` - -Added in v2.0.0 - -## zipRight - -Sequentially zips this value with the specified one, discarding the first -element of the tuple. - -**Signature** - -```ts -export declare const zipRight: { - (that: STM): (self: STM) => STM - (self: STM, that: STM): STM -} -``` - -Added in v2.0.0 - -## zipWith - -Sequentially zips this value with the specified one, combining the values -using the specified combiner function. - -**Signature** - -```ts -export declare const zipWith: { - ( - that: STM, - f: (a: A, b: A1) => A2 - ): (self: STM) => STM - (self: STM, that: STM, f: (a: A, b: A1) => A2): STM -} -``` - -Added in v2.0.0 diff --git a/docs/modules/Schedule.ts.md b/docs/modules/Schedule.ts.md deleted file mode 100644 index 6d3a6e590..000000000 --- a/docs/modules/Schedule.ts.md +++ /dev/null @@ -1,1939 +0,0 @@ ---- -title: Schedule.ts -nav_order: 94 -parent: Modules ---- - -## Schedule overview - -Added in v2.0.0 - ---- - -

Table of contents

- -- [alternatives](#alternatives) - - [either](#either) - - [eitherWith](#eitherwith) -- [constructors](#constructors) - - [asUnit](#asunit) - - [collectAllInputs](#collectallinputs) - - [count](#count) - - [dayOfMonth](#dayofmonth) - - [dayOfWeek](#dayofweek) - - [delayedEffect](#delayedeffect) - - [delayedSchedule](#delayedschedule) - - [delays](#delays) - - [duration](#duration) - - [elapsed](#elapsed) - - [exponential](#exponential) - - [fibonacci](#fibonacci) - - [fixed](#fixed) - - [forever](#forever) - - [fromDelay](#fromdelay) - - [fromDelays](#fromdelays) - - [fromFunction](#fromfunction) - - [hourOfDay](#hourofday) - - [identity](#identity) - - [jittered](#jittered) - - [jitteredWith](#jitteredwith) - - [linear](#linear) - - [makeWithState](#makewithstate) - - [minuteOfHour](#minuteofhour) - - [once](#once) - - [recurs](#recurs) - - [repeatForever](#repeatforever) - - [secondOfMinute](#secondofminute) - - [spaced](#spaced) - - [stop](#stop) - - [succeed](#succeed) - - [sync](#sync) - - [unfold](#unfold) - - [windowed](#windowed) -- [context](#context) - - [mapInputContext](#mapinputcontext) - - [provideContext](#providecontext) - - [provideService](#provideservice) -- [destructors](#destructors) - - [run](#run) -- [finalization](#finalization) - - [ensuring](#ensuring) -- [folding](#folding) - - [reduce](#reduce) - - [reduceEffect](#reduceeffect) -- [getter](#getter) - - [driver](#driver) -- [mapping](#mapping) - - [as](#as) - - [map](#map) - - [mapBoth](#mapboth) - - [mapBothEffect](#mapbotheffect) - - [mapEffect](#mapeffect) - - [mapInput](#mapinput) - - [mapInputEffect](#mapinputeffect) -- [model](#model) - - [Schedule (interface)](#schedule-interface) -- [models](#models) - - [ScheduleDriver (interface)](#scheduledriver-interface) -- [sequencing](#sequencing) - - [andThen](#andthen) - - [andThenEither](#andtheneither) - - [tapInput](#tapinput) - - [tapOutput](#tapoutput) -- [symbols](#symbols) - - [ScheduleDriverTypeId](#scheduledrivertypeid) - - [ScheduleDriverTypeId (type alias)](#scheduledrivertypeid-type-alias) - - [ScheduleTypeId](#scheduletypeid) - - [ScheduleTypeId (type alias)](#scheduletypeid-type-alias) -- [utils](#utils) - - [Schedule (namespace)](#schedule-namespace) - - [DriverVariance (interface)](#drivervariance-interface) - - [Variance (interface)](#variance-interface) - - [addDelay](#adddelay) - - [addDelayEffect](#adddelayeffect) - - [bothInOut](#bothinout) - - [check](#check) - - [checkEffect](#checkeffect) - - [collectAllOutputs](#collectalloutputs) - - [collectUntil](#collectuntil) - - [collectUntilEffect](#collectuntileffect) - - [collectWhile](#collectwhile) - - [collectWhileEffect](#collectwhileeffect) - - [compose](#compose) - - [delayed](#delayed) - - [intersect](#intersect) - - [intersectWith](#intersectwith) - - [modifyDelay](#modifydelay) - - [modifyDelayEffect](#modifydelayeffect) - - [onDecision](#ondecision) - - [passthrough](#passthrough) - - [recurUntil](#recuruntil) - - [recurUntilEffect](#recuruntileffect) - - [recurUntilOption](#recuruntiloption) - - [recurUpTo](#recurupto) - - [recurWhile](#recurwhile) - - [recurWhileEffect](#recurwhileeffect) - - [repetitions](#repetitions) - - [resetAfter](#resetafter) - - [resetWhen](#resetwhen) - - [union](#union) - - [unionWith](#unionwith) - - [untilInput](#untilinput) - - [untilInputEffect](#untilinputeffect) - - [untilOutput](#untiloutput) - - [untilOutputEffect](#untiloutputeffect) - - [upTo](#upto) - - [whileInput](#whileinput) - - [whileInputEffect](#whileinputeffect) - - [whileOutput](#whileoutput) - - [whileOutputEffect](#whileoutputeffect) -- [zipping](#zipping) - - [zipLeft](#zipleft) - - [zipRight](#zipright) - - [zipWith](#zipwith) - ---- - -# alternatives - -## either - -Returns a new schedule that performs a geometric union on the intervals -defined by both schedules. - -**Signature** - -```ts -export declare const either: { - ( - that: Schedule - ): (self: Schedule) => Schedule - ( - self: Schedule, - that: Schedule - ): Schedule -} -``` - -Added in v2.0.0 - -## eitherWith - -The same as `either` followed by `map`. - -**Signature** - -```ts -export declare const eitherWith: { - ( - that: Schedule, - f: (x: Intervals.Intervals, y: Intervals.Intervals) => Intervals.Intervals - ): (self: Schedule) => Schedule - ( - self: Schedule, - that: Schedule, - f: (x: Intervals.Intervals, y: Intervals.Intervals) => Intervals.Intervals - ): Schedule -} -``` - -Added in v2.0.0 - -# constructors - -## asUnit - -Returns a new schedule that maps the output of this schedule to unit. - -**Signature** - -```ts -export declare const asUnit: (self: Schedule) => Schedule -``` - -Added in v2.0.0 - -## collectAllInputs - -A schedule that recurs anywhere, collecting all inputs into a `Chunk`. - -**Signature** - -```ts -export declare const collectAllInputs:
() => Schedule> -``` - -Added in v2.0.0 - -## count - -A schedule that always recurs, which counts the number of recurrences. - -**Signature** - -```ts -export declare const count: Schedule -``` - -Added in v2.0.0 - -## dayOfMonth - -Cron-like schedule that recurs every specified `day` of month. Won't recur -on months containing less days than specified in `day` param. - -It triggers at zero hour of the day. Producing a count of repeats: 0, 1, 2. - -NOTE: `day` parameter is validated lazily. Must be in range 1...31. - -**Signature** - -```ts -export declare const dayOfMonth: (day: number) => Schedule -``` - -Added in v2.0.0 - -## dayOfWeek - -Cron-like schedule that recurs every specified `day` of each week. It -triggers at zero hour of the week. Producing a count of repeats: 0, 1, 2. - -NOTE: `day` parameter is validated lazily. Must be in range 1 (Monday)...7 -(Sunday). - -**Signature** - -```ts -export declare const dayOfWeek: (day: number) => Schedule -``` - -Added in v2.0.0 - -## delayedEffect - -Returns a new schedule with the specified effectfully computed delay added -before the start of each interval produced by this schedule. - -**Signature** - -```ts -export declare const delayedEffect: { - ( - f: (duration: Duration.Duration) => Effect.Effect - ): (self: Schedule) => Schedule - ( - self: Schedule, - f: (duration: Duration.Duration) => Effect.Effect - ): Schedule -} -``` - -Added in v2.0.0 - -## delayedSchedule - -Takes a schedule that produces a delay, and returns a new schedule that -uses this delay to further delay intervals in the resulting schedule. - -**Signature** - -```ts -export declare const delayedSchedule: ( - schedule: Schedule -) => Schedule -``` - -Added in v2.0.0 - -## delays - -Returns a new schedule that outputs the delay between each occurence. - -**Signature** - -```ts -export declare const delays: (self: Schedule) => Schedule -``` - -Added in v2.0.0 - -## duration - -A schedule that can recur one time, the specified amount of time into the -future. - -**Signature** - -```ts -export declare const duration: (duration: Duration.DurationInput) => Schedule -``` - -Added in v2.0.0 - -## elapsed - -A schedule that occurs everywhere, which returns the total elapsed duration -since the first step. - -**Signature** - -```ts -export declare const elapsed: Schedule -``` - -Added in v2.0.0 - -## exponential - -A schedule that always recurs, but will wait a certain amount between -repetitions, given by `base * factor.pow(n)`, where `n` is the number of -repetitions so far. Returns the current duration between recurrences. - -**Signature** - -```ts -export declare const exponential: ( - base: Duration.DurationInput, - factor?: number -) => Schedule -``` - -Added in v2.0.0 - -## fibonacci - -A schedule that always recurs, increasing delays by summing the preceding -two delays (similar to the fibonacci sequence). Returns the current -duration between recurrences. - -**Signature** - -```ts -export declare const fibonacci: (one: Duration.DurationInput) => Schedule -``` - -Added in v2.0.0 - -## fixed - -A schedule that recurs on a fixed interval. Returns the number of -repetitions of the schedule so far. - -If the action run between updates takes longer than the interval, then the -action will be run immediately, but re-runs will not "pile up". - -``` -|-----interval-----|-----interval-----|-----interval-----| -|---------action--------||action|-----|action|-----------| -``` - -**Signature** - -```ts -export declare const fixed: (interval: Duration.DurationInput) => Schedule -``` - -Added in v2.0.0 - -## forever - -A schedule that always recurs, producing a count of repeats: 0, 1, 2. - -**Signature** - -```ts -export declare const forever: Schedule -``` - -Added in v2.0.0 - -## fromDelay - -A schedule that recurs once with the specified delay. - -**Signature** - -```ts -export declare const fromDelay: (delay: Duration.DurationInput) => Schedule -``` - -Added in v2.0.0 - -## fromDelays - -A schedule that recurs once for each of the specified durations, delaying -each time for the length of the specified duration. Returns the length of -the current duration between recurrences. - -**Signature** - -```ts -export declare const fromDelays: ( - delay: Duration.DurationInput, - ...delays: Array -) => Schedule -``` - -Added in v2.0.0 - -## fromFunction - -A schedule that always recurs, mapping input values through the specified -function. - -**Signature** - -```ts -export declare const fromFunction: (f: (a: A) => B) => Schedule -``` - -Added in v2.0.0 - -## hourOfDay - -Cron-like schedule that recurs every specified `hour` of each day. It -triggers at zero minute of the hour. Producing a count of repeats: 0, 1, 2. - -NOTE: `hour` parameter is validated lazily. Must be in range 0...23. - -**Signature** - -```ts -export declare const hourOfDay: (hour: number) => Schedule -``` - -Added in v2.0.0 - -## identity - -A schedule that always recurs, which returns inputs as outputs. - -**Signature** - -```ts -export declare const identity: () => Schedule -``` - -Added in v2.0.0 - -## jittered - -Returns a new schedule that randomly modifies the size of the intervals of -this schedule. - -Defaults `min` to `0.8` and `max` to `1.2`. - -The new interval size is between `min * old interval size` and `max * old -interval size`. - -**Signature** - -```ts -export declare const jittered: (self: Schedule) => Schedule -``` - -Added in v2.0.0 - -## jitteredWith - -Returns a new schedule that randomly modifies the size of the intervals of -this schedule. - -The new interval size is between `min * old interval size` and `max * old -interval size`. - -**Signature** - -```ts -export declare const jitteredWith: { - (options: { min?: number; max?: number }): (self: Schedule) => Schedule - (self: Schedule, options: { min?: number; max?: number }): Schedule -} -``` - -Added in v2.0.0 - -## linear - -A schedule that always recurs, but will repeat on a linear time interval, -given by `base * n` where `n` is the number of repetitions so far. Returns -the current duration between recurrences. - -**Signature** - -```ts -export declare const linear: (base: Duration.DurationInput) => Schedule -``` - -Added in v2.0.0 - -## makeWithState - -Constructs a new `Schedule` with the specified `initial` state and the -specified `step` function. - -**Signature** - -```ts -export declare const makeWithState: ( - initial: S, - step: ( - now: number, - input: In, - state: S - ) => Effect.Effect -) => Schedule -``` - -Added in v2.0.0 - -## minuteOfHour - -Cron-like schedule that recurs every specified `minute` of each hour. It -triggers at zero second of the minute. Producing a count of repeats: 0, 1, 2. - -NOTE: `minute` parameter is validated lazily. Must be in range 0...59. - -**Signature** - -```ts -export declare const minuteOfHour: (minute: number) => Schedule -``` - -Added in v2.0.0 - -## once - -A schedule that recurs one time. - -**Signature** - -```ts -export declare const once: Schedule -``` - -Added in v2.0.0 - -## recurs - -A schedule spanning all time, which can be stepped only the specified -number of times before it terminates. - -**Signature** - -```ts -export declare const recurs: (n: number) => Schedule -``` - -Added in v2.0.0 - -## repeatForever - -Returns a new schedule that loops this one continuously, resetting the -state when this schedule is done. - -**Signature** - -```ts -export declare const repeatForever: Schedule -``` - -Added in v2.0.0 - -## secondOfMinute - -Cron-like schedule that recurs every specified `second` of each minute. It -triggers at zero nanosecond of the second. Producing a count of repeats: 0, -1, 2. - -NOTE: `second` parameter is validated lazily. Must be in range 0...59. - -**Signature** - -```ts -export declare const secondOfMinute: (second: number) => Schedule -``` - -Added in v2.0.0 - -## spaced - -Returns a schedule that recurs continuously, each repetition spaced the -specified duration from the last run. - -**Signature** - -```ts -export declare const spaced: (duration: Duration.DurationInput) => Schedule -``` - -Added in v2.0.0 - -## stop - -A schedule that does not recur, it just stops. - -**Signature** - -```ts -export declare const stop: Schedule -``` - -Added in v2.0.0 - -## succeed - -Returns a schedule that repeats one time, producing the specified constant -value. - -**Signature** - -```ts -export declare const succeed: (value: A) => Schedule -``` - -Added in v2.0.0 - -## sync - -Returns a schedule that repeats one time, producing the specified constant -value. - -**Signature** - -```ts -export declare const sync: (evaluate: LazyArg) => Schedule -``` - -Added in v2.0.0 - -## unfold - -Unfolds a schedule that repeats one time from the specified state and -iterator. - -**Signature** - -```ts -export declare const unfold: (initial: A, f: (a: A) => A) => Schedule -``` - -Added in v2.0.0 - -## windowed - -A schedule that divides the timeline to `interval`-long windows, and sleeps -until the nearest window boundary every time it recurs. - -For example, `windowed(Duration.seconds(10))` would produce a schedule as -follows: - -``` - 10s 10s 10s 10s -|----------|----------|----------|----------| -|action------|sleep---|act|-sleep|action----| -``` - -**Signature** - -```ts -export declare const windowed: (interval: Duration.DurationInput) => Schedule -``` - -Added in v2.0.0 - -# context - -## mapInputContext - -Transforms the context being provided to this schedule with the -specified function. - -**Signature** - -```ts -export declare const mapInputContext: { - ( - f: (env0: Context.Context) => Context.Context - ): (self: Schedule) => Schedule - ( - self: Schedule, - f: (env0: Context.Context) => Context.Context - ): Schedule -} -``` - -Added in v2.0.0 - -## provideContext - -Returns a new schedule with its context provided to it, so the -resulting schedule does not require any context. - -**Signature** - -```ts -export declare const provideContext: { - (context: Context.Context): (self: Schedule) => Schedule - (self: Schedule, context: Context.Context): Schedule -} -``` - -Added in v2.0.0 - -## provideService - -Returns a new schedule with the single service it requires provided to it. -If the schedule requires multiple services use `provideContext` -instead. - -**Signature** - -```ts -export declare const provideService: { - ( - tag: any, - service: T1 - ): (self: Schedule) => Schedule, In, Out> - ( - self: Schedule, - tag: any, - service: T1 - ): Schedule, In, Out> -} -``` - -Added in v2.0.0 - -# destructors - -## run - -Runs a schedule using the provided inputs, and collects all outputs. - -**Signature** - -```ts -export declare const run: { - ( - now: number, - input: Iterable - ): (self: Schedule) => Effect.Effect> - ( - self: Schedule, - now: number, - input: Iterable - ): Effect.Effect> -} -``` - -Added in v2.0.0 - -# finalization - -## ensuring - -Returns a new schedule that will run the specified finalizer as soon as the -schedule is complete. Note that unlike `Effect.ensuring`, this method does not -guarantee the finalizer will be run. The `Schedule` may not initialize or -the driver of the schedule may not run to completion. However, if the -`Schedule` ever decides not to continue, then the finalizer will be run. - -**Signature** - -```ts -export declare const ensuring: { - (finalizer: Effect.Effect): (self: Schedule) => Schedule - (self: Schedule, finalizer: Effect.Effect): Schedule -} -``` - -Added in v2.0.0 - -# folding - -## reduce - -Returns a new schedule that folds over the outputs of this one. - -**Signature** - -```ts -export declare const reduce: { - (zero: Z, f: (z: Z, out: Out) => Z): (self: Schedule) => Schedule - (self: Schedule, zero: Z, f: (z: Z, out: Out) => Z): Schedule -} -``` - -Added in v2.0.0 - -## reduceEffect - -Returns a new schedule that effectfully folds over the outputs of this one. - -**Signature** - -```ts -export declare const reduceEffect: { - ( - zero: Z, - f: (z: Z, out: Out) => Effect.Effect - ): (self: Schedule) => Schedule - ( - self: Schedule, - zero: Z, - f: (z: Z, out: Out) => Effect.Effect - ): Schedule -} -``` - -Added in v2.0.0 - -# getter - -## driver - -Returns a driver that can be used to step the schedule, appropriately -handling sleeping. - -**Signature** - -```ts -export declare const driver: ( - self: Schedule -) => Effect.Effect> -``` - -Added in v2.0.0 - -# mapping - -## as - -Returns a new schedule that maps this schedule to a constant output. - -**Signature** - -```ts -export declare const as: { - (out: Out2): (self: Schedule) => Schedule - (self: Schedule, out: Out2): Schedule -} -``` - -Added in v2.0.0 - -## map - -Returns a new schedule that maps the output of this schedule through the -specified function. - -**Signature** - -```ts -export declare const map: { - (f: (out: Out) => Out2): (self: Schedule) => Schedule - (self: Schedule, f: (out: Out) => Out2): Schedule -} -``` - -Added in v2.0.0 - -## mapBoth - -Returns a new schedule that maps both the input and output. - -**Signature** - -```ts -export declare const mapBoth: { - (options: { - readonly onInput: (in2: In2) => In - readonly onOutput: (out: Out) => Out2 - }): (self: Schedule) => Schedule - ( - self: Schedule, - options: { readonly onInput: (in2: In2) => In; readonly onOutput: (out: Out) => Out2 } - ): Schedule -} -``` - -Added in v2.0.0 - -## mapBothEffect - -Returns a new schedule that maps both the input and output. - -**Signature** - -```ts -export declare const mapBothEffect: { - (options: { - readonly onInput: (input: In2) => Effect.Effect - readonly onOutput: (out: Out) => Effect.Effect - }): (self: Schedule) => Schedule - ( - self: Schedule, - options: { - readonly onInput: (input: In2) => Effect.Effect - readonly onOutput: (out: Out) => Effect.Effect - } - ): Schedule -} -``` - -Added in v2.0.0 - -## mapEffect - -Returns a new schedule that maps the output of this schedule through the -specified effectful function. - -**Signature** - -```ts -export declare const mapEffect: { - ( - f: (out: Out) => Effect.Effect - ): (self: Schedule) => Schedule - ( - self: Schedule, - f: (out: Out) => Effect.Effect - ): Schedule -} -``` - -Added in v2.0.0 - -## mapInput - -Returns a new schedule that deals with a narrower class of inputs than this -schedule. - -**Signature** - -```ts -export declare const mapInput: { - (f: (in2: In2) => In): (self: Schedule) => Schedule - (self: Schedule, f: (in2: In2) => In): Schedule -} -``` - -Added in v2.0.0 - -## mapInputEffect - -Returns a new schedule that deals with a narrower class of inputs than this -schedule. - -**Signature** - -```ts -export declare const mapInputEffect: { - ( - f: (in2: In2) => Effect.Effect - ): (self: Schedule) => Schedule - ( - self: Schedule, - f: (in2: In2) => Effect.Effect - ): Schedule -} -``` - -Added in v2.0.0 - -# model - -## Schedule (interface) - -A `Schedule` defines a recurring schedule, which consumes -values of type `In`, and which returns values of type `Out`. - -Schedules are defined as a possibly infinite set of intervals spread out over -time. Each interval defines a window in which recurrence is possible. - -When schedules are used to repeat or retry effects, the starting boundary of -each interval produced by a schedule is used as the moment when the effect -will be executed again. - -Schedules compose in the following primary ways: - -- Union: performs the union of the intervals of two schedules -- Intersection: performs the intersection of the intervals of two schedules -- Sequence: concatenates the intervals of one schedule onto another - -In addition, schedule inputs and outputs can be transformed, filtered (to -terminate a schedule early in response to some input or output), and so -forth. - -A variety of other operators exist for transforming and combining schedules, -and the companion object for `Schedule` contains all common types of -schedules, both for performing retrying, as well as performing repetition. - -**Signature** - -```ts -export interface Schedule extends Schedule.Variance, Pipeable { - /** - * Initial State - */ - readonly initial: any - /** - * Schedule Step - */ - readonly step: ( - now: number, - input: In, - state: any - ) => Effect.Effect -} -``` - -Added in v2.0.0 - -# models - -## ScheduleDriver (interface) - -**Signature** - -```ts -export interface ScheduleDriver extends Schedule.DriverVariance { - readonly state: Effect.Effect - readonly last: Effect.Effect - readonly reset: Effect.Effect - readonly next: (input: In) => Effect.Effect, Out> -} -``` - -Added in v2.0.0 - -# sequencing - -## andThen - -The same as `andThenEither`, but merges the output. - -**Signature** - -```ts -export declare const andThen: { - ( - that: Schedule - ): (self: Schedule) => Schedule - ( - self: Schedule, - that: Schedule - ): Schedule -} -``` - -Added in v2.0.0 - -## andThenEither - -Returns a new schedule that first executes this schedule to completion, and -then executes the specified schedule to completion. - -**Signature** - -```ts -export declare const andThenEither: { - ( - that: Schedule - ): (self: Schedule) => Schedule> - ( - self: Schedule, - that: Schedule - ): Schedule> -} -``` - -Added in v2.0.0 - -## tapInput - -Returns a new schedule that effectfully processes every input to this -schedule. - -**Signature** - -```ts -export declare const tapInput: { - ( - f: (input: In2) => Effect.Effect - ): (self: Schedule) => Schedule - ( - self: Schedule, - f: (input: In2) => Effect.Effect - ): Schedule -} -``` - -Added in v2.0.0 - -## tapOutput - -Returns a new schedule that effectfully processes every output from this -schedule. - -**Signature** - -```ts -export declare const tapOutput: { - ( - f: (out: XO) => Effect.Effect - ): (self: Schedule) => Schedule - ( - self: Schedule, - f: (out: XO) => Effect.Effect - ): Schedule -} -``` - -Added in v2.0.0 - -# symbols - -## ScheduleDriverTypeId - -**Signature** - -```ts -export declare const ScheduleDriverTypeId: typeof ScheduleDriverTypeId -``` - -Added in v2.0.0 - -## ScheduleDriverTypeId (type alias) - -**Signature** - -```ts -export type ScheduleDriverTypeId = typeof ScheduleDriverTypeId -``` - -Added in v2.0.0 - -## ScheduleTypeId - -**Signature** - -```ts -export declare const ScheduleTypeId: typeof ScheduleTypeId -``` - -Added in v2.0.0 - -## ScheduleTypeId (type alias) - -**Signature** - -```ts -export type ScheduleTypeId = typeof ScheduleTypeId -``` - -Added in v2.0.0 - -# utils - -## Schedule (namespace) - -Added in v2.0.0 - -### DriverVariance (interface) - -**Signature** - -```ts -export interface DriverVariance { - readonly [ScheduleDriverTypeId]: { - readonly _Env: (_: never) => Env - readonly _In: (_: In) => void - readonly _Out: (_: never) => Out - } -} -``` - -Added in v2.0.0 - -### Variance (interface) - -**Signature** - -```ts -export interface Variance { - readonly [ScheduleTypeId]: { - readonly _Env: (_: never) => Env - readonly _In: (_: In) => void - readonly _Out: (_: never) => Out - } -} -``` - -Added in v2.0.0 - -## addDelay - -Returns a new schedule with the given delay added to every interval defined -by this schedule. - -**Signature** - -```ts -export declare const addDelay: { - (f: (out: Out) => Duration.DurationInput): (self: Schedule) => Schedule - (self: Schedule, f: (out: Out) => Duration.DurationInput): Schedule -} -``` - -Added in v2.0.0 - -## addDelayEffect - -Returns a new schedule with the given effectfully computed delay added to -every interval defined by this schedule. - -**Signature** - -```ts -export declare const addDelayEffect: { - ( - f: (out: Out) => Effect.Effect - ): (self: Schedule) => Schedule - ( - self: Schedule, - f: (out: Out) => Effect.Effect - ): Schedule -} -``` - -Added in v2.0.0 - -## bothInOut - -Returns a new schedule that has both the inputs and outputs of this and the -specified schedule. - -**Signature** - -```ts -export declare const bothInOut: { - ( - that: Schedule - ): (self: Schedule) => Schedule - ( - self: Schedule, - that: Schedule - ): Schedule -} -``` - -Added in v2.0.0 - -## check - -Returns a new schedule that passes each input and output of this schedule -to the specified function, and then determines whether or not to continue -based on the return value of the function. - -**Signature** - -```ts -export declare const check: { - (test: (input: In, output: Out) => boolean): (self: Schedule) => Schedule - (self: Schedule, test: (input: In, output: Out) => boolean): Schedule -} -``` - -Added in v2.0.0 - -## checkEffect - -Returns a new schedule that passes each input and output of this schedule -to the specified function, and then determines whether or not to continue -based on the return value of the function. - -**Signature** - -```ts -export declare const checkEffect: { - ( - test: (input: In, output: Out) => Effect.Effect - ): (self: Schedule) => Schedule - ( - self: Schedule, - test: (input: In, output: Out) => Effect.Effect - ): Schedule -} -``` - -Added in v2.0.0 - -## collectAllOutputs - -Returns a new schedule that collects the outputs of this one into a chunk. - -**Signature** - -```ts -export declare const collectAllOutputs: ( - self: Schedule -) => Schedule> -``` - -Added in v2.0.0 - -## collectUntil - -A schedule that recurs until the condition f fails, collecting all inputs -into a list. - -**Signature** - -```ts -export declare const collectUntil: (f: Predicate) => Schedule> -``` - -Added in v2.0.0 - -## collectUntilEffect - -A schedule that recurs until the effectful condition f fails, collecting -all inputs into a list. - -**Signature** - -```ts -export declare const collectUntilEffect: ( - f: (a: A) => Effect.Effect -) => Schedule> -``` - -Added in v2.0.0 - -## collectWhile - -A schedule that recurs as long as the condition f holds, collecting all -inputs into a list. - -**Signature** - -```ts -export declare const collectWhile: (f: Predicate) => Schedule> -``` - -Added in v2.0.0 - -## collectWhileEffect - -A schedule that recurs as long as the effectful condition holds, collecting -all inputs into a list. - -**Signature** - -```ts -export declare const collectWhileEffect: ( - f: (a: A) => Effect.Effect -) => Schedule> -``` - -Added in v2.0.0 - -## compose - -Returns the composition of this schedule and the specified schedule, by -piping the output of this one into the input of the other. Effects -described by this schedule will always be executed before the effects -described by the second schedule. - -**Signature** - -```ts -export declare const compose: { - ( - that: Schedule - ): (self: Schedule) => Schedule - ( - self: Schedule, - that: Schedule - ): Schedule -} -``` - -Added in v2.0.0 - -## delayed - -Returns a new schedule with the specified effectfully computed delay added -before the start of each interval produced by this schedule. - -**Signature** - -```ts -export declare const delayed: { - ( - f: (duration: Duration.Duration) => Duration.DurationInput - ): (self: Schedule) => Schedule - ( - self: Schedule, - f: (duration: Duration.Duration) => Duration.DurationInput - ): Schedule -} -``` - -Added in v2.0.0 - -## intersect - -Returns a new schedule that performs a geometric intersection on the -intervals defined by both schedules. - -**Signature** - -```ts -export declare const intersect: { - ( - that: Schedule - ): (self: Schedule) => Schedule - ( - self: Schedule, - that: Schedule - ): Schedule -} -``` - -Added in v2.0.0 - -## intersectWith - -Returns a new schedule that combines this schedule with the specified -schedule, continuing as long as both schedules want to continue and merging -the next intervals according to the specified merge function. - -**Signature** - -```ts -export declare const intersectWith: { - ( - that: Schedule, - f: (x: Intervals.Intervals, y: Intervals.Intervals) => Intervals.Intervals - ): (self: Schedule) => Schedule - ( - self: Schedule, - that: Schedule, - f: (x: Intervals.Intervals, y: Intervals.Intervals) => Intervals.Intervals - ): Schedule -} -``` - -Added in v2.0.0 - -## modifyDelay - -Returns a new schedule that modifies the delay using the specified -function. - -**Signature** - -```ts -export declare const modifyDelay: { - ( - f: (out: Out, duration: Duration.Duration) => Duration.DurationInput - ): (self: Schedule) => Schedule - ( - self: Schedule, - f: (out: Out, duration: Duration.Duration) => Duration.DurationInput - ): Schedule -} -``` - -Added in v2.0.0 - -## modifyDelayEffect - -Returns a new schedule that modifies the delay using the specified -effectual function. - -**Signature** - -```ts -export declare const modifyDelayEffect: { - ( - f: (out: Out, duration: Duration.Duration) => Effect.Effect - ): (self: Schedule) => Schedule - ( - self: Schedule, - f: (out: Out, duration: Duration.Duration) => Effect.Effect - ): Schedule -} -``` - -Added in v2.0.0 - -## onDecision - -Returns a new schedule that applies the current one but runs the specified -effect for every decision of this schedule. This can be used to create -schedules that log failures, decisions, or computed values. - -**Signature** - -```ts -export declare const onDecision: { - ( - f: (out: Out, decision: ScheduleDecision.ScheduleDecision) => Effect.Effect - ): (self: Schedule) => Schedule - ( - self: Schedule, - f: (out: Out, decision: ScheduleDecision.ScheduleDecision) => Effect.Effect - ): Schedule -} -``` - -Added in v2.0.0 - -## passthrough - -Returns a new schedule that passes through the inputs of this schedule. - -**Signature** - -```ts -export declare const passthrough: ( - self: Schedule -) => Schedule -``` - -Added in v2.0.0 - -## recurUntil - -A schedule that recurs for until the predicate evaluates to true. - -**Signature** - -```ts -export declare const recurUntil: (f: Predicate) => Schedule -``` - -Added in v2.0.0 - -## recurUntilEffect - -A schedule that recurs for until the predicate evaluates to true. - -**Signature** - -```ts -export declare const recurUntilEffect: (f: (a: A) => Effect.Effect) => Schedule -``` - -Added in v2.0.0 - -## recurUntilOption - -A schedule that recurs for until the input value becomes applicable to -partial function and then map that value with given function. - -**Signature** - -```ts -export declare const recurUntilOption: (pf: (a: A) => Option.Option) => Schedule> -``` - -Added in v2.0.0 - -## recurUpTo - -A schedule that recurs during the given duration. - -**Signature** - -```ts -export declare const recurUpTo: (duration: Duration.DurationInput) => Schedule -``` - -Added in v2.0.0 - -## recurWhile - -A schedule that recurs for as long as the predicate evaluates to true. - -**Signature** - -```ts -export declare const recurWhile: (f: Predicate) => Schedule -``` - -Added in v2.0.0 - -## recurWhileEffect - -A schedule that recurs for as long as the effectful predicate evaluates to -true. - -**Signature** - -```ts -export declare const recurWhileEffect: (f: (a: A) => Effect.Effect) => Schedule -``` - -Added in v2.0.0 - -## repetitions - -Returns a new schedule that outputs the number of repetitions of this one. - -**Signature** - -```ts -export declare const repetitions: (self: Schedule) => Schedule -``` - -Added in v2.0.0 - -## resetAfter - -Return a new schedule that automatically resets the schedule to its initial -state after some time of inactivity defined by `duration`. - -**Signature** - -```ts -export declare const resetAfter: { - (duration: Duration.DurationInput): (self: Schedule) => Schedule - (self: Schedule, duration: Duration.DurationInput): Schedule -} -``` - -Added in v2.0.0 - -## resetWhen - -Resets the schedule when the specified predicate on the schedule output -evaluates to true. - -**Signature** - -```ts -export declare const resetWhen: { - (f: Predicate): (self: Schedule) => Schedule - (self: Schedule, f: Predicate): Schedule -} -``` - -Added in v2.0.0 - -## union - -Returns a new schedule that performs a geometric union on the intervals -defined by both schedules. - -**Signature** - -```ts -export declare const union: { - ( - that: Schedule - ): (self: Schedule) => Schedule - ( - self: Schedule, - that: Schedule - ): Schedule -} -``` - -Added in v2.0.0 - -## unionWith - -Returns a new schedule that combines this schedule with the specified -schedule, continuing as long as either schedule wants to continue and -merging the next intervals according to the specified merge function. - -**Signature** - -```ts -export declare const unionWith: { - ( - that: Schedule, - f: (x: Intervals.Intervals, y: Intervals.Intervals) => Intervals.Intervals - ): (self: Schedule) => Schedule - ( - self: Schedule, - that: Schedule, - f: (x: Intervals.Intervals, y: Intervals.Intervals) => Intervals.Intervals - ): Schedule -} -``` - -Added in v2.0.0 - -## untilInput - -Returns a new schedule that continues until the specified predicate on the -input evaluates to true. - -**Signature** - -```ts -export declare const untilInput: { - (f: Predicate): (self: Schedule) => Schedule - (self: Schedule, f: Predicate): Schedule -} -``` - -Added in v2.0.0 - -## untilInputEffect - -Returns a new schedule that continues until the specified effectful -predicate on the input evaluates to true. - -**Signature** - -```ts -export declare const untilInputEffect: { - ( - f: (input: In) => Effect.Effect - ): (self: Schedule) => Schedule - ( - self: Schedule, - f: (input: In) => Effect.Effect - ): Schedule -} -``` - -Added in v2.0.0 - -## untilOutput - -Returns a new schedule that continues until the specified predicate on the -output evaluates to true. - -**Signature** - -```ts -export declare const untilOutput: { - (f: Predicate): (self: Schedule) => Schedule - (self: Schedule, f: Predicate): Schedule -} -``` - -Added in v2.0.0 - -## untilOutputEffect - -Returns a new schedule that continues until the specified effectful -predicate on the output evaluates to true. - -**Signature** - -```ts -export declare const untilOutputEffect: { - ( - f: (out: Out) => Effect.Effect - ): (self: Schedule) => Schedule - ( - self: Schedule, - f: (out: Out) => Effect.Effect - ): Schedule -} -``` - -Added in v2.0.0 - -## upTo - -A schedule that recurs during the given duration. - -**Signature** - -```ts -export declare const upTo: { - (duration: Duration.DurationInput): (self: Schedule) => Schedule - (self: Schedule, duration: Duration.DurationInput): Schedule -} -``` - -Added in v2.0.0 - -## whileInput - -Returns a new schedule that continues for as long the specified predicate -on the input evaluates to true. - -**Signature** - -```ts -export declare const whileInput: { - (f: Predicate): (self: Schedule) => Schedule - (self: Schedule, f: Predicate): Schedule -} -``` - -Added in v2.0.0 - -## whileInputEffect - -Returns a new schedule that continues for as long the specified effectful -predicate on the input evaluates to true. - -**Signature** - -```ts -export declare const whileInputEffect: { - ( - f: (input: In) => Effect.Effect - ): (self: Schedule) => Schedule - ( - self: Schedule, - f: (input: In) => Effect.Effect - ): Schedule -} -``` - -Added in v2.0.0 - -## whileOutput - -Returns a new schedule that continues for as long the specified predicate -on the output evaluates to true. - -**Signature** - -```ts -export declare const whileOutput: { - (f: Predicate): (self: Schedule) => Schedule - (self: Schedule, f: Predicate): Schedule -} -``` - -Added in v2.0.0 - -## whileOutputEffect - -Returns a new schedule that continues for as long the specified effectful -predicate on the output evaluates to true. - -**Signature** - -```ts -export declare const whileOutputEffect: { - ( - f: (out: Out) => Effect.Effect - ): (self: Schedule) => Schedule - ( - self: Schedule, - f: (out: Out) => Effect.Effect - ): Schedule -} -``` - -Added in v2.0.0 - -# zipping - -## zipLeft - -The same as `intersect` but ignores the right output. - -**Signature** - -```ts -export declare const zipLeft: { - ( - that: Schedule - ): (self: Schedule) => Schedule - ( - self: Schedule, - that: Schedule - ): Schedule -} -``` - -Added in v2.0.0 - -## zipRight - -The same as `intersect` but ignores the left output. - -**Signature** - -```ts -export declare const zipRight: { - ( - that: Schedule - ): (self: Schedule) => Schedule - ( - self: Schedule, - that: Schedule - ): Schedule -} -``` - -Added in v2.0.0 - -## zipWith - -Equivalent to `intersect` followed by `map`. - -**Signature** - -```ts -export declare const zipWith: { - ( - that: Schedule, - f: (out: Out, out2: Out2) => Out3 - ): (self: Schedule) => Schedule - ( - self: Schedule, - that: Schedule, - f: (out: Out, out2: Out2) => Out3 - ): Schedule -} -``` - -Added in v2.0.0 diff --git a/docs/modules/ScheduleDecision.ts.md b/docs/modules/ScheduleDecision.ts.md deleted file mode 100644 index f30944f77..000000000 --- a/docs/modules/ScheduleDecision.ts.md +++ /dev/null @@ -1,118 +0,0 @@ ---- -title: ScheduleDecision.ts -nav_order: 95 -parent: Modules ---- - -## ScheduleDecision overview - -Added in v2.0.0 - ---- - -

Table of contents

- -- [constructors](#constructors) - - [continue](#continue) - - [continueWith](#continuewith) - - [done](#done) -- [models](#models) - - [Continue (interface)](#continue-interface) - - [Done (interface)](#done-interface) - - [ScheduleDecision (type alias)](#scheduledecision-type-alias) -- [refinements](#refinements) - - [isContinue](#iscontinue) - - [isDone](#isdone) - ---- - -# constructors - -## continue - -**Signature** - -```ts -export declare const continue: (intervals: Intervals.Intervals) => ScheduleDecision -``` - -Added in v2.0.0 - -## continueWith - -**Signature** - -```ts -export declare const continueWith: (interval: Interval.Interval) => ScheduleDecision -``` - -Added in v2.0.0 - -## done - -**Signature** - -```ts -export declare const done: ScheduleDecision -``` - -Added in v2.0.0 - -# models - -## Continue (interface) - -**Signature** - -```ts -export interface Continue { - readonly _tag: "Continue" - readonly intervals: Intervals.Intervals -} -``` - -Added in v2.0.0 - -## Done (interface) - -**Signature** - -```ts -export interface Done { - readonly _tag: "Done" -} -``` - -Added in v2.0.0 - -## ScheduleDecision (type alias) - -**Signature** - -```ts -export type ScheduleDecision = Continue | Done -``` - -Added in v2.0.0 - -# refinements - -## isContinue - -**Signature** - -```ts -export declare const isContinue: (self: ScheduleDecision) => self is Continue -``` - -Added in v2.0.0 - -## isDone - -**Signature** - -```ts -export declare const isDone: (self: ScheduleDecision) => self is Done -``` - -Added in v2.0.0 diff --git a/docs/modules/ScheduleInterval.ts.md b/docs/modules/ScheduleInterval.ts.md deleted file mode 100644 index f77897868..000000000 --- a/docs/modules/ScheduleInterval.ts.md +++ /dev/null @@ -1,248 +0,0 @@ ---- -title: ScheduleInterval.ts -nav_order: 96 -parent: Modules ---- - -## ScheduleInterval overview - -Added in v2.0.0 - ---- - -

Table of contents

- -- [constructors](#constructors) - - [after](#after) - - [before](#before) - - [empty](#empty) - - [make](#make) -- [getters](#getters) - - [size](#size) -- [models](#models) - - [Interval (interface)](#interval-interface) -- [ordering](#ordering) - - [intersect](#intersect) - - [isEmpty](#isempty) - - [isNonEmpty](#isnonempty) - - [lessThan](#lessthan) - - [max](#max) - - [min](#min) -- [symbols](#symbols) - - [IntervalTypeId](#intervaltypeid) - - [IntervalTypeId (type alias)](#intervaltypeid-type-alias) -- [utils](#utils) - - [union](#union) - ---- - -# constructors - -## after - -Construct an `Interval` that includes all time equal to and after the -specified start time. - -**Signature** - -```ts -export declare const after: (startMilliseconds: number) => Interval -``` - -Added in v2.0.0 - -## before - -Construct an `Interval` that includes all time equal to and before the -specified end time. - -**Signature** - -```ts -export declare const before: (endMilliseconds: number) => Interval -``` - -Added in v2.0.0 - -## empty - -An `Interval` of zero-width. - -**Signature** - -```ts -export declare const empty: Interval -``` - -Added in v2.0.0 - -## make - -Constructs a new interval from the two specified endpoints. If the start -endpoint greater than the end endpoint, then a zero size interval will be -returned. - -**Signature** - -```ts -export declare const make: (startMillis: number, endMillis: number) => Interval -``` - -Added in v2.0.0 - -# getters - -## size - -Calculates the size of the `Interval` as the `Duration` from the start of the -interval to the end of the interval. - -**Signature** - -```ts -export declare const size: (self: Interval) => Duration.Duration -``` - -Added in v2.0.0 - -# models - -## Interval (interface) - -An `Interval` represents an interval of time. Intervals can encompass all -time, or no time at all. - -**Signature** - -```ts -export interface Interval { - readonly [IntervalTypeId]: IntervalTypeId - readonly startMillis: number - readonly endMillis: number -} -``` - -Added in v2.0.0 - -# ordering - -## intersect - -Computes a new `Interval` which is the intersection of this `Interval` and -that `Interval`. - -**Signature** - -```ts -export declare const intersect: { - (that: Interval): (self: Interval) => Interval - (self: Interval, that: Interval): Interval -} -``` - -Added in v2.0.0 - -## isEmpty - -Returns `true` if the specified `Interval` is empty, `false` otherwise. - -**Signature** - -```ts -export declare const isEmpty: (self: Interval) => boolean -``` - -Added in v2.0.0 - -## isNonEmpty - -Returns `true` if the specified `Interval` is non-empty, `false` otherwise. - -**Signature** - -```ts -export declare const isNonEmpty: (self: Interval) => boolean -``` - -Added in v2.0.0 - -## lessThan - -Returns `true` if this `Interval` is less than `that` interval, `false` -otherwise. - -**Signature** - -```ts -export declare const lessThan: { - (that: Interval): (self: Interval) => boolean - (self: Interval, that: Interval): boolean -} -``` - -Added in v2.0.0 - -## max - -Returns the maximum of two `Interval`s. - -**Signature** - -```ts -export declare const max: { (that: Interval): (self: Interval) => Interval; (self: Interval, that: Interval): Interval } -``` - -Added in v2.0.0 - -## min - -Returns the minimum of two `Interval`s. - -**Signature** - -```ts -export declare const min: { (that: Interval): (self: Interval) => Interval; (self: Interval, that: Interval): Interval } -``` - -Added in v2.0.0 - -# symbols - -## IntervalTypeId - -**Signature** - -```ts -export declare const IntervalTypeId: typeof IntervalTypeId -``` - -Added in v2.0.0 - -## IntervalTypeId (type alias) - -**Signature** - -```ts -export type IntervalTypeId = typeof IntervalTypeId -``` - -Added in v2.0.0 - -# utils - -## union - -Computes a new `Interval` which is the union of this `Interval` and that -`Interval` as a `Some`, otherwise returns `None` if the two intervals cannot -form a union. - -**Signature** - -```ts -export declare const union: { - (that: Interval): (self: Interval) => Option.Option - (self: Interval, that: Interval): Option.Option -} -``` - -Added in v2.0.0 diff --git a/docs/modules/ScheduleIntervals.ts.md b/docs/modules/ScheduleIntervals.ts.md deleted file mode 100644 index 45eda724a..000000000 --- a/docs/modules/ScheduleIntervals.ts.md +++ /dev/null @@ -1,215 +0,0 @@ ---- -title: ScheduleIntervals.ts -nav_order: 97 -parent: Modules ---- - -## ScheduleIntervals overview - -Added in v2.0.0 - ---- - -

Table of contents

- -- [constructors](#constructors) - - [empty](#empty) - - [fromIterable](#fromiterable) - - [make](#make) -- [getters](#getters) - - [end](#end) - - [isNonEmpty](#isnonempty) - - [start](#start) -- [models](#models) - - [Intervals (interface)](#intervals-interface) -- [ordering](#ordering) - - [lessThan](#lessthan) - - [max](#max) -- [symbols](#symbols) - - [IntervalsTypeId](#intervalstypeid) - - [IntervalsTypeId (type alias)](#intervalstypeid-type-alias) -- [utils](#utils) - - [intersect](#intersect) - - [union](#union) - ---- - -# constructors - -## empty - -Constructs an empty list of `Interval`s. - -**Signature** - -```ts -export declare const empty: Intervals -``` - -Added in v2.0.0 - -## fromIterable - -Constructs `Intervals` from the specified `Iterable`. - -**Signature** - -```ts -export declare const fromIterable: (intervals: Iterable) => Intervals -``` - -Added in v2.0.0 - -## make - -Creates a new `Intervals` from a `List` of `Interval`s. - -**Signature** - -```ts -export declare const make: (intervals: Check.Chunk) => Intervals -``` - -Added in v2.0.0 - -# getters - -## end - -The end of the latest interval in the specified `Intervals`. - -**Signature** - -```ts -export declare const end: (self: Intervals) => number -``` - -Added in v2.0.0 - -## isNonEmpty - -Returns `true` if this `Intervals` is non-empty, `false` otherwise. - -**Signature** - -```ts -export declare const isNonEmpty: (self: Intervals) => boolean -``` - -Added in v2.0.0 - -## start - -The start of the earliest interval in the specified `Intervals`. - -**Signature** - -```ts -export declare const start: (self: Intervals) => number -``` - -Added in v2.0.0 - -# models - -## Intervals (interface) - -An `Intervals` represents a list of several `Interval`s. - -**Signature** - -```ts -export interface Intervals { - readonly [IntervalsTypeId]: IntervalsTypeId - readonly intervals: Check.Chunk -} -``` - -Added in v2.0.0 - -# ordering - -## lessThan - -Returns `true` if the start of this `Intervals` is before the start of that -`Intervals`, `false` otherwise. - -**Signature** - -```ts -export declare const lessThan: { - (that: Intervals): (self: Intervals) => boolean - (self: Intervals, that: Intervals): boolean -} -``` - -Added in v2.0.0 - -## max - -Returns the maximum of the two `Intervals` (i.e. which has the latest start). - -**Signature** - -```ts -export declare const max: { - (that: Intervals): (self: Intervals) => Intervals - (self: Intervals, that: Intervals): Intervals -} -``` - -Added in v2.0.0 - -# symbols - -## IntervalsTypeId - -**Signature** - -```ts -export declare const IntervalsTypeId: typeof IntervalsTypeId -``` - -Added in v2.0.0 - -## IntervalsTypeId (type alias) - -**Signature** - -```ts -export type IntervalsTypeId = typeof IntervalsTypeId -``` - -Added in v2.0.0 - -# utils - -## intersect - -Produces the intersection of this `Intervals` and that `Intervals`. - -**Signature** - -```ts -export declare const intersect: { - (that: Intervals): (self: Intervals) => Intervals - (self: Intervals, that: Intervals): Intervals -} -``` - -Added in v2.0.0 - -## union - -Computes the union of this `Intervals` and that `Intervals` - -**Signature** - -```ts -export declare const union: { - (that: Intervals): (self: Intervals) => Intervals - (self: Intervals, that: Intervals): Intervals -} -``` - -Added in v2.0.0 diff --git a/docs/modules/Scheduler.ts.md b/docs/modules/Scheduler.ts.md deleted file mode 100644 index 7ac99223e..000000000 --- a/docs/modules/Scheduler.ts.md +++ /dev/null @@ -1,386 +0,0 @@ ---- -title: Scheduler.ts -nav_order: 98 -parent: Modules ---- - -## Scheduler overview - -Added in v2.0.0 - ---- - -

Table of contents

- -- [constructors](#constructors) - - [ControlledScheduler (class)](#controlledscheduler-class) - - [scheduleTask (method)](#scheduletask-method) - - [shouldYield (method)](#shouldyield-method) - - [step (method)](#step-method) - - [tasks (property)](#tasks-property) - - [deferred (property)](#deferred-property) - - [MixedScheduler (class)](#mixedscheduler-class) - - [starveInternal (method)](#starveinternal-method) - - [starve (method)](#starve-method) - - [shouldYield (method)](#shouldyield-method-1) - - [scheduleTask (method)](#scheduletask-method-1) - - [running (property)](#running-property) - - [tasks (property)](#tasks-property-1) - - [SyncScheduler (class)](#syncscheduler-class) - - [scheduleTask (method)](#scheduletask-method-2) - - [shouldYield (method)](#shouldyield-method-2) - - [flush (method)](#flush-method) - - [tasks (property)](#tasks-property-2) - - [deferred (property)](#deferred-property-1) - - [make](#make) - - [makeBatched](#makebatched) - - [makeMatrix](#makematrix) - - [timer](#timer) - - [timerBatched](#timerbatched) -- [models](#models) - - [Scheduler (interface)](#scheduler-interface) - - [Task (type alias)](#task-type-alias) -- [schedulers](#schedulers) - - [defaultScheduler](#defaultscheduler) -- [utilities](#utilities) - - [defaultShouldYield](#defaultshouldyield) -- [utils](#utils) - - [PriorityBuckets (class)](#prioritybuckets-class) - - [scheduleTask (method)](#scheduletask-method-3) - - [buckets (property)](#buckets-property) - ---- - -# constructors - -## ControlledScheduler (class) - -**Signature** - -```ts -export declare class ControlledScheduler -``` - -Added in v2.0.0 - -### scheduleTask (method) - -**Signature** - -```ts -scheduleTask(task: Task, priority: number) -``` - -Added in v2.0.0 - -### shouldYield (method) - -**Signature** - -```ts -shouldYield(fiber: RuntimeFiber): number | false -``` - -Added in v2.0.0 - -### step (method) - -**Signature** - -```ts -step() -``` - -Added in v2.0.0 - -### tasks (property) - -**Signature** - -```ts -tasks: PriorityBuckets -``` - -Added in v2.0.0 - -### deferred (property) - -**Signature** - -```ts -deferred: boolean -``` - -Added in v2.0.0 - -## MixedScheduler (class) - -**Signature** - -```ts -export declare class MixedScheduler { constructor( - /** - * @since 2.0.0 - */ - readonly maxNextTickBeforeTimer: number - ) } -``` - -Added in v2.0.0 - -### starveInternal (method) - -**Signature** - -```ts -private starveInternal(depth: number) -``` - -Added in v2.0.0 - -### starve (method) - -**Signature** - -```ts -private starve(depth = 0) -``` - -Added in v2.0.0 - -### shouldYield (method) - -**Signature** - -```ts -shouldYield(fiber: RuntimeFiber): number | false -``` - -Added in v2.0.0 - -### scheduleTask (method) - -**Signature** - -```ts -scheduleTask(task: Task, priority: number) -``` - -Added in v2.0.0 - -### running (property) - -**Signature** - -```ts -running: boolean -``` - -Added in v2.0.0 - -### tasks (property) - -**Signature** - -```ts -tasks: PriorityBuckets -``` - -Added in v2.0.0 - -## SyncScheduler (class) - -**Signature** - -```ts -export declare class SyncScheduler -``` - -Added in v2.0.0 - -### scheduleTask (method) - -**Signature** - -```ts -scheduleTask(task: Task, priority: number) -``` - -Added in v2.0.0 - -### shouldYield (method) - -**Signature** - -```ts -shouldYield(fiber: RuntimeFiber): number | false -``` - -Added in v2.0.0 - -### flush (method) - -**Signature** - -```ts -flush() -``` - -Added in v2.0.0 - -### tasks (property) - -**Signature** - -```ts -tasks: PriorityBuckets -``` - -Added in v2.0.0 - -### deferred (property) - -**Signature** - -```ts -deferred: boolean -``` - -Added in v2.0.0 - -## make - -**Signature** - -```ts -export declare const make: ( - scheduleTask: Scheduler["scheduleTask"], - shouldYield?: Scheduler["shouldYield"] -) => Scheduler -``` - -Added in v2.0.0 - -## makeBatched - -**Signature** - -```ts -export declare const makeBatched: ( - callback: (runBatch: () => void) => void, - shouldYield?: Scheduler["shouldYield"] -) => Scheduler -``` - -Added in v2.0.0 - -## makeMatrix - -**Signature** - -```ts -export declare const makeMatrix: (...record: Array<[number, Scheduler]>) => Scheduler -``` - -Added in v2.0.0 - -## timer - -**Signature** - -```ts -export declare const timer: (ms: number, shouldYield?: Scheduler["shouldYield"]) => Scheduler -``` - -Added in v2.0.0 - -## timerBatched - -**Signature** - -```ts -export declare const timerBatched: (ms: number, shouldYield?: Scheduler["shouldYield"]) => Scheduler -``` - -Added in v2.0.0 - -# models - -## Scheduler (interface) - -**Signature** - -```ts -export interface Scheduler { - readonly shouldYield: (fiber: RuntimeFiber) => number | false - readonly scheduleTask: (task: Task, priority: number) => void -} -``` - -Added in v2.0.0 - -## Task (type alias) - -**Signature** - -```ts -export type Task = () => void -``` - -Added in v2.0.0 - -# schedulers - -## defaultScheduler - -**Signature** - -```ts -export declare const defaultScheduler: Scheduler -``` - -Added in v2.0.0 - -# utilities - -## defaultShouldYield - -**Signature** - -```ts -export declare const defaultShouldYield: (fiber: RuntimeFiber) => number | false -``` - -Added in v2.0.0 - -# utils - -## PriorityBuckets (class) - -**Signature** - -```ts -export declare class PriorityBuckets -``` - -Added in v2.0.0 - -### scheduleTask (method) - -**Signature** - -```ts -scheduleTask(task: T, priority: number) -``` - -Added in v2.0.0 - -### buckets (property) - -**Signature** - -```ts -buckets: [number, T[]][] -``` - -Added in v2.0.0 diff --git a/docs/modules/Scope.ts.md b/docs/modules/Scope.ts.md deleted file mode 100644 index 1d4f3eb2f..000000000 --- a/docs/modules/Scope.ts.md +++ /dev/null @@ -1,276 +0,0 @@ ---- -title: Scope.ts -nav_order: 99 -parent: Modules ---- - -## Scope overview - -Added in v2.0.0 - ---- - -

Table of contents

- -- [constructors](#constructors) - - [make](#make) -- [context](#context) - - [Scope](#scope) -- [destructors](#destructors) - - [close](#close) - - [use](#use) -- [models](#models) - - [CloseableScope (interface)](#closeablescope-interface) - - [Scope (interface)](#scope-interface) -- [symbols](#symbols) - - [CloseableScopeTypeId](#closeablescopetypeid) - - [CloseableScopeTypeId (type alias)](#closeablescopetypeid-type-alias) - - [ScopeTypeId](#scopetypeid) - - [ScopeTypeId (type alias)](#scopetypeid-type-alias) -- [utils](#utils) - - [Scope (namespace)](#scope-namespace) - - [Closeable (type alias)](#closeable-type-alias) - - [Finalizer (type alias)](#finalizer-type-alias) - - [addFinalizer](#addfinalizer) - - [addFinalizerExit](#addfinalizerexit) - - [extend](#extend) - - [fork](#fork) - ---- - -# constructors - -## make - -Creates a Scope where Finalizers will run according to the `ExecutionStrategy`. - -If an ExecutionStrategy is not provided `sequential` will be used. - -**Signature** - -```ts -export declare const make: ( - executionStrategy?: ExecutionStrategy.ExecutionStrategy -) => Effect.Effect -``` - -Added in v2.0.0 - -# context - -## Scope - -**Signature** - -```ts -export declare const Scope: Context.Tag -``` - -Added in v2.0.0 - -# destructors - -## close - -Closes a scope with the specified exit value, running all finalizers that -have been added to the scope. - -**Signature** - -```ts -export declare const close: ( - self: CloseableScope, - exit: Exit.Exit -) => Effect.Effect -``` - -Added in v2.0.0 - -## use - -Uses the scope by providing it to an `Effect` workflow that needs a scope, -guaranteeing that the scope is closed with the result of that workflow as -soon as the workflow completes execution, whether by success, failure, or -interruption. - -**Signature** - -```ts -export declare const use: { - (scope: CloseableScope): (effect: Effect.Effect) => Effect.Effect, E, A> - (effect: Effect.Effect, scope: CloseableScope): Effect.Effect, E, A> -} -``` - -Added in v2.0.0 - -# models - -## CloseableScope (interface) - -**Signature** - -```ts -export interface CloseableScope extends Scope, Pipeable { - readonly [CloseableScopeTypeId]: CloseableScopeTypeId - - /** - * @internal - */ - readonly close: (exit: Exit.Exit) => Effect.Effect -} -``` - -Added in v2.0.0 - -## Scope (interface) - -**Signature** - -```ts -export interface Scope extends Pipeable { - readonly [ScopeTypeId]: ScopeTypeId - readonly strategy: ExecutionStrategy.ExecutionStrategy - /** - * @internal - */ - readonly fork: (strategy: ExecutionStrategy.ExecutionStrategy) => Effect.Effect - /** - * @internal - */ - readonly addFinalizer: (finalizer: Scope.Finalizer) => Effect.Effect -} -``` - -Added in v2.0.0 - -# symbols - -## CloseableScopeTypeId - -**Signature** - -```ts -export declare const CloseableScopeTypeId: typeof CloseableScopeTypeId -``` - -Added in v2.0.0 - -## CloseableScopeTypeId (type alias) - -**Signature** - -```ts -export type CloseableScopeTypeId = typeof CloseableScopeTypeId -``` - -Added in v2.0.0 - -## ScopeTypeId - -**Signature** - -```ts -export declare const ScopeTypeId: typeof ScopeTypeId -``` - -Added in v2.0.0 - -## ScopeTypeId (type alias) - -**Signature** - -```ts -export type ScopeTypeId = typeof ScopeTypeId -``` - -Added in v2.0.0 - -# utils - -## Scope (namespace) - -Added in v2.0.0 - -### Closeable (type alias) - -**Signature** - -```ts -export type Closeable = CloseableScope -``` - -Added in v2.0.0 - -### Finalizer (type alias) - -**Signature** - -```ts -export type Finalizer = (exit: Exit.Exit) => Effect.Effect -``` - -Added in v2.0.0 - -## addFinalizer - -Adds a finalizer to this scope. The finalizer is guaranteed to be run when -the scope is closed. - -**Signature** - -```ts -export declare const addFinalizer: ( - self: Scope, - finalizer: Effect.Effect -) => Effect.Effect -``` - -Added in v2.0.0 - -## addFinalizerExit - -A simplified version of `addFinalizerWith` when the `finalizer` does not -depend on the `Exit` value that the scope is closed with. - -**Signature** - -```ts -export declare const addFinalizerExit: (self: Scope, finalizer: Scope.Finalizer) => Effect.Effect -``` - -Added in v2.0.0 - -## extend - -Extends the scope of an `Effect` workflow that needs a scope into this -scope by providing it to the workflow but not closing the scope when the -workflow completes execution. This allows extending a scoped value into a -larger scope. - -**Signature** - -```ts -export declare const extend: { - (scope: Scope): (effect: Effect.Effect) => Effect.Effect, E, A> - (effect: Effect.Effect, scope: Scope): Effect.Effect, E, A> -} -``` - -Added in v2.0.0 - -## fork - -Forks a new scope that is a child of this scope. The child scope will -automatically be closed when this scope is closed. - -**Signature** - -```ts -export declare const fork: ( - self: Scope, - strategy: ExecutionStrategy.ExecutionStrategy -) => Effect.Effect -``` - -Added in v2.0.0 diff --git a/docs/modules/ScopedCache.ts.md b/docs/modules/ScopedCache.ts.md deleted file mode 100644 index 8d59f37ad..000000000 --- a/docs/modules/ScopedCache.ts.md +++ /dev/null @@ -1,196 +0,0 @@ ---- -title: ScopedCache.ts -nav_order: 100 -parent: Modules ---- - -## ScopedCache overview - -Added in v2.0.0 - ---- - -

Table of contents

- -- [constructors](#constructors) - - [make](#make) - - [makeWith](#makewith) -- [models](#models) - - [Lookup (type alias)](#lookup-type-alias) - - [ScopedCache (interface)](#scopedcache-interface) -- [symbols](#symbols) - - [ScopedCacheTypeId](#scopedcachetypeid) - - [ScopedCacheTypeId (type alias)](#scopedcachetypeid-type-alias) -- [utils](#utils) - - [ScopedCache (namespace)](#scopedcache-namespace) - - [Variance (interface)](#variance-interface) - ---- - -# constructors - -## make - -Constructs a new cache with the specified capacity, time to live, and -lookup function. - -**Signature** - -```ts -export declare const make: (options: { - readonly lookup: Lookup - readonly capacity: number - readonly timeToLive: Duration.DurationInput -}) => Effect.Effect> -``` - -Added in v2.0.0 - -## makeWith - -Constructs a new cache with the specified capacity, time to live, and -lookup function, where the time to live can depend on the `Exit` value -returned by the lookup function. - -**Signature** - -```ts -export declare const makeWith: (options: { - readonly capacity: number - readonly lookup: Lookup - readonly timeToLive: (exit: Exit.Exit) => Duration.DurationInput -}) => Effect.Effect> -``` - -Added in v2.0.0 - -# models - -## Lookup (type alias) - -Similar to `Cache.Lookup`, but executes the lookup function within a `Scope`. - -**Signature** - -```ts -export type Lookup = ( - key: Key -) => Effect.Effect -``` - -Added in v2.0.0 - -## ScopedCache (interface) - -**Signature** - -```ts -export interface ScopedCache extends ScopedCache.Variance, Pipeable { - /** - * Retrieves the value associated with the specified key if it exists. - * Otherwise returns `Option.none`. - */ - readonly getOption: (key: Key) => Effect.Effect> - - /** - * Retrieves the value associated with the specified key if it exists and the - * lookup function has completed. Otherwise returns `Option.none`. - */ - readonly getOptionComplete: (key: Key) => Effect.Effect> - - /** - * Returns statistics for this cache. - */ - readonly cacheStats: Effect.Effect - - /** - * Return whether a resource associated with the specified key exists in the - * cache. Sometime `contains` can return true if the resource is currently - * being created but not yet totally created. - */ - readonly contains: (key: Key) => Effect.Effect - - /** - * Return statistics for the specified entry. - */ - readonly entryStats: (key: Key) => Effect.Effect> - - /** - * Gets the value from the cache if it exists or otherwise computes it, the - * release action signals to the cache that the value is no longer being used - * and can potentially be finalized subject to the policies of the cache. - */ - readonly get: (key: Key) => Effect.Effect - - /** - * Invalidates the resource associated with the specified key. - */ - readonly invalidate: (key: Key) => Effect.Effect - - /** - * Invalidates all values in the cache. - */ - readonly invalidateAll: Effect.Effect - - /** - * Force the reuse of the lookup function to compute the returned scoped - * effect associated with the specified key immediately. Once the new resource - * is recomputed, the old resource associated to the key is cleaned (once all - * fiber using it are done with it). During the time the new resource is - * computed, concurrent call the .get will use the old resource if this one is - * not expired. - */ - readonly refresh: (key: Key) => Effect.Effect - - /** - * Returns the approximate number of values in the cache. - */ - readonly size: Effect.Effect -} -``` - -Added in v2.0.0 - -# symbols - -## ScopedCacheTypeId - -**Signature** - -```ts -export declare const ScopedCacheTypeId: typeof ScopedCacheTypeId -``` - -Added in v2.0.0 - -## ScopedCacheTypeId (type alias) - -**Signature** - -```ts -export type ScopedCacheTypeId = typeof ScopedCacheTypeId -``` - -Added in v2.0.0 - -# utils - -## ScopedCache (namespace) - -Added in v2.0.0 - -### Variance (interface) - -**Signature** - -```ts -export interface Variance { - readonly [ScopedCacheTypeId]: { - _Key: (_: Key) => void - _Error: (_: never) => Error - _Value: (_: never) => Value - } -} -``` - -Added in v2.0.0 diff --git a/docs/modules/ScopedRef.ts.md b/docs/modules/ScopedRef.ts.md deleted file mode 100644 index bbc74c24d..000000000 --- a/docs/modules/ScopedRef.ts.md +++ /dev/null @@ -1,157 +0,0 @@ ---- -title: ScopedRef.ts -nav_order: 101 -parent: Modules ---- - -## ScopedRef overview - -Added in v2.0.0 - ---- - -

Table of contents

- -- [constructors](#constructors) - - [fromAcquire](#fromacquire) - - [make](#make) -- [getters](#getters) - - [get](#get) - - [set](#set) -- [models](#models) - - [ScopedRef (interface)](#scopedref-interface) -- [symbols](#symbols) - - [ScopedRefTypeId](#scopedreftypeid) - - [ScopedRefTypeId (type alias)](#scopedreftypeid-type-alias) -- [utils](#utils) - - [ScopedRef (namespace)](#scopedref-namespace) - - [Variance (interface)](#variance-interface) - ---- - -# constructors - -## fromAcquire - -Creates a new `ScopedRef` from an effect that resourcefully produces a -value. - -**Signature** - -```ts -export declare const fromAcquire: ( - acquire: Effect.Effect -) => Effect.Effect> -``` - -Added in v2.0.0 - -## make - -Creates a new `ScopedRef` from the specified value. This method should -not be used for values whose creation require the acquisition of resources. - -**Signature** - -```ts -export declare const make:
(evaluate: LazyArg) => Effect.Effect> -``` - -Added in v2.0.0 - -# getters - -## get - -Retrieves the current value of the scoped reference. - -**Signature** - -```ts -export declare const get: (self: ScopedRef) => Effect.Effect -``` - -Added in v2.0.0 - -## set - -Sets the value of this reference to the specified resourcefully-created -value. Any resources associated with the old value will be released. - -This method will not return until either the reference is successfully -changed to the new value, with old resources released, or until the attempt -to acquire a new value fails. - -**Signature** - -```ts -export declare const set: { - (acquire: Effect.Effect): (self: ScopedRef) => Effect.Effect, E, void> - (self: ScopedRef, acquire: Effect.Effect): Effect.Effect, E, void> -} -``` - -Added in v2.0.0 - -# models - -## ScopedRef (interface) - -A `ScopedRef` is a reference whose value is associated with resources, -which must be released properly. You can both get the current value of any -`ScopedRef`, as well as set it to a new value (which may require new -resources). The reference itself takes care of properly releasing resources -for the old value whenever a new value is obtained. - -**Signature** - -```ts -export interface ScopedRef extends ScopedRef.Variance, Pipeable { - /** @internal */ - readonly ref: Synchronized.SynchronizedRef -} -``` - -Added in v2.0.0 - -# symbols - -## ScopedRefTypeId - -**Signature** - -```ts -export declare const ScopedRefTypeId: typeof ScopedRefTypeId -``` - -Added in v2.0.0 - -## ScopedRefTypeId (type alias) - -**Signature** - -```ts -export type ScopedRefTypeId = typeof ScopedRefTypeId -``` - -Added in v2.0.0 - -# utils - -## ScopedRef (namespace) - -Added in v2.0.0 - -### Variance (interface) - -**Signature** - -```ts -export interface Variance { - readonly [ScopedRefTypeId]: { - readonly _A: (_: never) => A - } -} -``` - -Added in v2.0.0 diff --git a/docs/modules/SingleProducerAsyncInput.ts.md b/docs/modules/SingleProducerAsyncInput.ts.md deleted file mode 100644 index 74b4eb517..000000000 --- a/docs/modules/SingleProducerAsyncInput.ts.md +++ /dev/null @@ -1,102 +0,0 @@ ---- -title: SingleProducerAsyncInput.ts -nav_order: 102 -parent: Modules ---- - -## SingleProducerAsyncInput overview - -Added in v2.0.0 - ---- - -

Table of contents

- -- [constructors](#constructors) - - [make](#make) -- [models](#models) - - [AsyncInputConsumer (interface)](#asyncinputconsumer-interface) - - [AsyncInputProducer (interface)](#asyncinputproducer-interface) - - [SingleProducerAsyncInput (interface)](#singleproducerasyncinput-interface) - ---- - -# constructors - -## make - -**Signature** - -```ts -export declare const make: () => Effect.Effect> -``` - -Added in v2.0.0 - -# models - -## AsyncInputConsumer (interface) - -Consumer-side view of `SingleProducerAsyncInput` for variance purposes. - -**Signature** - -```ts -export interface AsyncInputConsumer { - takeWith
( - onError: (cause: Cause.Cause) => A, - onElement: (element: Elem) => A, - onDone: (value: Done) => A - ): Effect.Effect -} -``` - -Added in v2.0.0 - -## AsyncInputProducer (interface) - -Producer-side view of `SingleProducerAsyncInput` for variance purposes. - -**Signature** - -```ts -export interface AsyncInputProducer { - readonly awaitRead: () => Effect.Effect - readonly done: (value: Done) => Effect.Effect - readonly emit: (element: Elem) => Effect.Effect - readonly error: (cause: Cause.Cause) => Effect.Effect -} -``` - -Added in v2.0.0 - -## SingleProducerAsyncInput (interface) - -An MVar-like abstraction for sending data to channels asynchronously which is -designed for one producer and multiple consumers. - -Features the following semantics: - -- Buffer of size 1. -- When emitting, the producer waits for a consumer to pick up the value to - prevent "reading ahead" too much. -- Once an emitted element is read by a consumer, it is cleared from the - buffer, so that at most one consumer sees every emitted element. -- When sending a done or error signal, the producer does not wait for a - consumer to pick up the signal. The signal stays in the buffer after - being read by a consumer, so it can be propagated to multiple consumers. -- Trying to publish another emit/error/done after an error/done have - already been published results in an interruption. - -**Signature** - -```ts -export interface SingleProducerAsyncInput - extends AsyncInputProducer, - AsyncInputConsumer { - readonly close: Effect.Effect - readonly take: Effect.Effect, Elem>> -} -``` - -Added in v2.0.0 diff --git a/docs/modules/Sink.ts.md b/docs/modules/Sink.ts.md deleted file mode 100644 index 5ad5fcc74..000000000 --- a/docs/modules/Sink.ts.md +++ /dev/null @@ -1,1979 +0,0 @@ ---- -title: Sink.ts -nav_order: 103 -parent: Modules ---- - -## Sink overview - -Added in v2.0.0 - ---- - -

Table of contents

- -- [constructors](#constructors) - - [collectAll](#collectall) - - [collectAllN](#collectalln) - - [collectAllToMap](#collectalltomap) - - [collectAllToMapN](#collectalltomapn) - - [collectAllToSet](#collectalltoset) - - [collectAllToSetN](#collectalltosetn) - - [collectAllUntil](#collectalluntil) - - [collectAllUntilEffect](#collectalluntileffect) - - [collectAllWhile](#collectallwhile) - - [collectAllWhileEffect](#collectallwhileeffect) - - [context](#context) - - [contextWith](#contextwith) - - [contextWithEffect](#contextwitheffect) - - [contextWithSink](#contextwithsink) - - [count](#count) - - [die](#die) - - [dieMessage](#diemessage) - - [dieSync](#diesync) - - [drain](#drain) - - [drop](#drop) - - [dropUntil](#dropuntil) - - [dropUntilEffect](#dropuntileffect) - - [dropWhile](#dropwhile) - - [dropWhileEffect](#dropwhileeffect) - - [every](#every) - - [fail](#fail) - - [failCause](#failcause) - - [failCauseSync](#failcausesync) - - [failSync](#failsync) - - [foldChunks](#foldchunks) - - [foldChunksEffect](#foldchunkseffect) - - [foldEffect](#foldeffect) - - [foldLeft](#foldleft) - - [foldLeftChunks](#foldleftchunks) - - [foldLeftChunksEffect](#foldleftchunkseffect) - - [foldLeftEffect](#foldlefteffect) - - [foldUntil](#folduntil) - - [foldUntilEffect](#folduntileffect) - - [foldWeighted](#foldweighted) - - [foldWeightedDecompose](#foldweighteddecompose) - - [foldWeightedDecomposeEffect](#foldweighteddecomposeeffect) - - [foldWeightedEffect](#foldweightedeffect) - - [forEach](#foreach) - - [forEachChunk](#foreachchunk) - - [forEachChunkWhile](#foreachchunkwhile) - - [forEachWhile](#foreachwhile) - - [fromChannel](#fromchannel) - - [fromEffect](#fromeffect) - - [fromPubSub](#frompubsub) - - [fromPush](#frompush) - - [fromQueue](#fromqueue) - - [head](#head) - - [last](#last) - - [leftover](#leftover) - - [mkString](#mkstring) - - [never](#never) - - [some](#some) - - [succeed](#succeed) - - [sum](#sum) - - [suspend](#suspend) - - [sync](#sync) - - [take](#take) - - [timed](#timed) - - [toChannel](#tochannel) - - [unwrap](#unwrap) - - [unwrapScoped](#unwrapscoped) -- [context](#context-1) - - [provideContext](#providecontext) -- [elements](#elements) - - [findEffect](#findeffect) -- [error handling](#error-handling) - - [orElse](#orelse) - - [refineOrDie](#refineordie) - - [refineOrDieWith](#refineordiewith) -- [filtering](#filtering) - - [filterInput](#filterinput) - - [filterInputEffect](#filterinputeffect) -- [finalization](#finalization) - - [ensuring](#ensuring) - - [ensuringWith](#ensuringwith) -- [folding](#folding) - - [fold](#fold) - - [foldSink](#foldsink) -- [mapping](#mapping) - - [as](#as) - - [dimap](#dimap) - - [dimapChunks](#dimapchunks) - - [dimapChunksEffect](#dimapchunkseffect) - - [dimapEffect](#dimapeffect) - - [map](#map) - - [mapEffect](#mapeffect) - - [mapError](#maperror) - - [mapInput](#mapinput) - - [mapInputChunks](#mapinputchunks) - - [mapInputChunksEffect](#mapinputchunkseffect) - - [mapInputEffect](#mapinputeffect) - - [mapLeftover](#mapleftover) -- [models](#models) - - [Sink (interface)](#sink-interface) - - [SinkUnify (interface)](#sinkunify-interface) - - [SinkUnifyIgnore (interface)](#sinkunifyignore-interface) -- [sequencing](#sequencing) - - [flatMap](#flatmap) -- [symbols](#symbols) - - [SinkTypeId](#sinktypeid) - - [SinkTypeId (type alias)](#sinktypeid-type-alias) -- [utils](#utils) - - [Sink (namespace)](#sink-namespace) - - [Variance (interface)](#variance-interface) - - [VarianceStruct (interface)](#variancestruct-interface) - - [collectAllFrom](#collectallfrom) - - [collectAllWhileWith](#collectallwhilewith) - - [collectLeftover](#collectleftover) - - [ignoreLeftover](#ignoreleftover) - - [race](#race) - - [raceBoth](#raceboth) - - [raceWith](#racewith) - - [splitWhere](#splitwhere) - - [summarized](#summarized) - - [withDuration](#withduration) -- [zipping](#zipping) - - [zip](#zip) - - [zipLeft](#zipleft) - - [zipRight](#zipright) - - [zipWith](#zipwith) - ---- - -# constructors - -## collectAll - -A sink that collects all elements into a `Chunk`. - -**Signature** - -```ts -export declare const collectAll: () => Sink> -``` - -Added in v2.0.0 - -## collectAllN - -A sink that collects first `n` elements into a chunk. - -**Signature** - -```ts -export declare const collectAllN: (n: number) => Sink> -``` - -Added in v2.0.0 - -## collectAllToMap - -A sink that collects all of its inputs into a map. The keys are extracted -from inputs using the keying function `key`; if multiple inputs use the -same key, they are merged using the `merge` function. - -**Signature** - -```ts -export declare const collectAllToMap: ( - key: (input: In) => K, - merge: (x: In, y: In) => In -) => Sink> -``` - -Added in v2.0.0 - -## collectAllToMapN - -A sink that collects first `n` keys into a map. The keys are calculated -from inputs using the keying function `key`; if multiple inputs use the the -same key, they are merged using the `merge` function. - -**Signature** - -```ts -export declare const collectAllToMapN: ( - n: number, - key: (input: In) => K, - merge: (x: In, y: In) => In -) => Sink> -``` - -Added in v2.0.0 - -## collectAllToSet - -A sink that collects all of its inputs into a set. - -**Signature** - -```ts -export declare const collectAllToSet: () => Sink> -``` - -Added in v2.0.0 - -## collectAllToSetN - -A sink that collects first `n` distinct inputs into a set. - -**Signature** - -```ts -export declare const collectAllToSetN: (n: number) => Sink> -``` - -Added in v2.0.0 - -## collectAllUntil - -Accumulates incoming elements into a chunk until predicate `p` is -satisfied. - -**Signature** - -```ts -export declare const collectAllUntil: (p: Predicate) => Sink> -``` - -Added in v2.0.0 - -## collectAllUntilEffect - -Accumulates incoming elements into a chunk until effectful predicate `p` is -satisfied. - -**Signature** - -```ts -export declare const collectAllUntilEffect: ( - p: (input: In) => Effect.Effect -) => Sink> -``` - -Added in v2.0.0 - -## collectAllWhile - -Accumulates incoming elements into a chunk as long as they verify predicate -`p`. - -**Signature** - -```ts -export declare const collectAllWhile: (predicate: Predicate) => Sink> -``` - -Added in v2.0.0 - -## collectAllWhileEffect - -Accumulates incoming elements into a chunk as long as they verify effectful -predicate `p`. - -**Signature** - -```ts -export declare const collectAllWhileEffect: ( - predicate: (input: In) => Effect.Effect -) => Sink> -``` - -Added in v2.0.0 - -## context - -Accesses the whole context of the sink. - -**Signature** - -```ts -export declare const context: () => Sink> -``` - -Added in v2.0.0 - -## contextWith - -Accesses the context of the sink. - -**Signature** - -```ts -export declare const contextWith: (f: (context: Context.Context) => Z) => Sink -``` - -Added in v2.0.0 - -## contextWithEffect - -Accesses the context of the sink in the context of an effect. - -**Signature** - -```ts -export declare const contextWithEffect: ( - f: (context: Context.Context) => Effect.Effect -) => Sink -``` - -Added in v2.0.0 - -## contextWithSink - -Accesses the context of the sink in the context of a sink. - -**Signature** - -```ts -export declare const contextWithSink: ( - f: (context: Context.Context) => Sink -) => Sink -``` - -Added in v2.0.0 - -## count - -A sink that counts the number of elements fed to it. - -**Signature** - -```ts -export declare const count: Sink -``` - -Added in v2.0.0 - -## die - -Creates a sink halting with the specified defect. - -**Signature** - -```ts -export declare const die: (defect: unknown) => Sink -``` - -Added in v2.0.0 - -## dieMessage - -Creates a sink halting with the specified message, wrapped in a -`RuntimeException`. - -**Signature** - -```ts -export declare const dieMessage: (message: string) => Sink -``` - -Added in v2.0.0 - -## dieSync - -Creates a sink halting with the specified defect. - -**Signature** - -```ts -export declare const dieSync: (evaluate: LazyArg) => Sink -``` - -Added in v2.0.0 - -## drain - -A sink that ignores its inputs. - -**Signature** - -```ts -export declare const drain: Sink -``` - -Added in v2.0.0 - -## drop - -Creates a sink that drops `n` elements. - -**Signature** - -```ts -export declare const drop: (n: number) => Sink -``` - -Added in v2.0.0 - -## dropUntil - -Drops incoming elements until the predicate is satisfied. - -**Signature** - -```ts -export declare const dropUntil: (predicate: Predicate) => Sink -``` - -Added in v2.0.0 - -## dropUntilEffect - -Drops incoming elements until the effectful predicate is satisfied. - -**Signature** - -```ts -export declare const dropUntilEffect: ( - predicate: (input: In) => Effect.Effect -) => Sink -``` - -Added in v2.0.0 - -## dropWhile - -Drops incoming elements as long as the predicate is satisfied. - -**Signature** - -```ts -export declare const dropWhile: (predicate: Predicate) => Sink -``` - -Added in v2.0.0 - -## dropWhileEffect - -Drops incoming elements as long as the effectful predicate is satisfied. - -**Signature** - -```ts -export declare const dropWhileEffect: ( - predicate: (input: In) => Effect.Effect -) => Sink -``` - -Added in v2.0.0 - -## every - -A sink that returns whether all elements satisfy the specified predicate. - -**Signature** - -```ts -export declare const every: (predicate: Predicate) => Sink -``` - -Added in v2.0.0 - -## fail - -A sink that always fails with the specified error. - -**Signature** - -```ts -export declare const fail: (e: E) => Sink -``` - -Added in v2.0.0 - -## failCause - -Creates a sink halting with a specified `Cause`. - -**Signature** - -```ts -export declare const failCause: (cause: Cause.Cause) => Sink -``` - -Added in v2.0.0 - -## failCauseSync - -Creates a sink halting with a specified lazily evaluated `Cause`. - -**Signature** - -```ts -export declare const failCauseSync: (evaluate: LazyArg>) => Sink -``` - -Added in v2.0.0 - -## failSync - -A sink that always fails with the specified lazily evaluated error. - -**Signature** - -```ts -export declare const failSync: (evaluate: LazyArg) => Sink -``` - -Added in v2.0.0 - -## foldChunks - -A sink that folds its input chunks with the provided function, termination -predicate and initial state. `contFn` condition is checked only for the -initial value and at the end of processing of each chunk. `f` and `contFn` -must preserve chunking-invariance. - -**Signature** - -```ts -export declare const foldChunks: ( - s: S, - contFn: Predicate, - f: (s: S, chunk: Chunk.Chunk) => S -) => Sink -``` - -Added in v2.0.0 - -## foldChunksEffect - -A sink that effectfully folds its input chunks with the provided function, -termination predicate and initial state. `contFn` condition is checked only -for the initial value and at the end of processing of each chunk. `f` and -`contFn` must preserve chunking-invariance. - -**Signature** - -```ts -export declare const foldChunksEffect: ( - s: S, - contFn: Predicate, - f: (s: S, chunk: Chunk.Chunk) => Effect.Effect -) => Sink -``` - -Added in v2.0.0 - -## foldEffect - -A sink that effectfully folds its inputs with the provided function, -termination predicate and initial state. - -**Signature** - -```ts -export declare const foldEffect: ( - s: S, - contFn: Predicate, - f: (s: S, input: In) => Effect.Effect -) => Sink -``` - -Added in v2.0.0 - -## foldLeft - -A sink that folds its inputs with the provided function and initial state. - -**Signature** - -```ts -export declare const foldLeft: (s: S, f: (s: S, input: In) => S) => Sink -``` - -Added in v2.0.0 - -## foldLeftChunks - -A sink that folds its input chunks with the provided function and initial -state. `f` must preserve chunking-invariance. - -**Signature** - -```ts -export declare const foldLeftChunks: ( - s: S, - f: (s: S, chunk: Chunk.Chunk) => S -) => Sink -``` - -Added in v2.0.0 - -## foldLeftChunksEffect - -A sink that effectfully folds its input chunks with the provided function -and initial state. `f` must preserve chunking-invariance. - -**Signature** - -```ts -export declare const foldLeftChunksEffect: ( - s: S, - f: (s: S, chunk: Chunk.Chunk) => Effect.Effect -) => Sink -``` - -Added in v2.0.0 - -## foldLeftEffect - -A sink that effectfully folds its inputs with the provided function and -initial state. - -**Signature** - -```ts -export declare const foldLeftEffect: ( - s: S, - f: (s: S, input: In) => Effect.Effect -) => Sink -``` - -Added in v2.0.0 - -## foldUntil - -Creates a sink that folds elements of type `In` into a structure of type -`S` until `max` elements have been folded. - -Like `Sink.foldWeighted`, but with a constant cost function of `1`. - -**Signature** - -```ts -export declare const foldUntil: (s: S, max: number, f: (z: S, input: In) => S) => Sink -``` - -Added in v2.0.0 - -## foldUntilEffect - -Creates a sink that effectfully folds elements of type `In` into a -structure of type `S` until `max` elements have been folded. - -Like `Sink.foldWeightedEffect` but with a constant cost function of `1`. - -**Signature** - -```ts -export declare const foldUntilEffect: ( - s: S, - max: number, - f: (s: S, input: In) => Effect.Effect -) => Sink -``` - -Added in v2.0.0 - -## foldWeighted - -Creates a sink that folds elements of type `In` into a structure of type -`S`, until `max` worth of elements (determined by the `costFn`) have been -folded. - -**Signature** - -```ts -export declare const foldWeighted: (options: { - readonly initial: S - readonly maxCost: number - readonly cost: (s: S, input: In) => number - readonly body: (s: S, input: In) => S -}) => Sink -``` - -Added in v2.0.0 - -## foldWeightedDecompose - -Creates a sink that folds elements of type `In` into a structure of type -`S`, until `max` worth of elements (determined by the `costFn`) have been -folded. - -The `decompose` function will be used for decomposing elements that cause -an `S` aggregate to cross `max` into smaller elements. For example: - -```ts -pipe( - Stream.make(1, 5, 1), - Stream.transduce( - Sink.foldWeightedDecompose( - Chunk.empty(), - 4, - (n: number) => n, - (n: number) => Chunk.make(n - 1, 1), - (acc, el) => pipe(acc, Chunk.append(el)) - ) - ), - Stream.runCollect -) -``` - -The stream would emit the elements `Chunk(1), Chunk(4), Chunk(1, 1)`. - -Be vigilant with this function, it has to generate "simpler" values or the -fold may never end. A value is considered indivisible if `decompose` yields -the empty chunk or a single-valued chunk. In these cases, there is no other -choice than to yield a value that will cross the threshold. - -`Sink.foldWeightedDecomposeEffect` allows the decompose function to return an -effect value, and consequently it allows the sink to fail. - -**Signature** - -```ts -export declare const foldWeightedDecompose: (options: { - readonly initial: S - readonly maxCost: number - readonly cost: (s: S, input: In) => number - readonly decompose: (input: In) => Chunk.Chunk - readonly body: (s: S, input: In) => S -}) => Sink -``` - -Added in v2.0.0 - -## foldWeightedDecomposeEffect - -Creates a sink that effectfully folds elements of type `In` into a -structure of type `S`, until `max` worth of elements (determined by the -`costFn`) have been folded. - -The `decompose` function will be used for decomposing elements that cause -an `S` aggregate to cross `max` into smaller elements. Be vigilant with -this function, it has to generate "simpler" values or the fold may never -end. A value is considered indivisible if `decompose` yields the empty -chunk or a single-valued chunk. In these cases, there is no other choice -than to yield a value that will cross the threshold. - -See `Sink.foldWeightedDecompose` for an example. - -**Signature** - -```ts -export declare const foldWeightedDecomposeEffect: (options: { - readonly initial: S - readonly maxCost: number - readonly cost: (s: S, input: In) => Effect.Effect - readonly decompose: (input: In) => Effect.Effect> - readonly body: (s: S, input: In) => Effect.Effect -}) => Sink -``` - -Added in v2.0.0 - -## foldWeightedEffect - -Creates a sink that effectfully folds elements of type `In` into a -structure of type `S`, until `max` worth of elements (determined by the -`costFn`) have been folded. - -**Signature** - -```ts -export declare const foldWeightedEffect: (options: { - readonly initial: S - readonly maxCost: number - readonly cost: (s: S, input: In) => Effect.Effect - readonly body: (s: S, input: In) => Effect.Effect -}) => Sink -``` - -Added in v2.0.0 - -## forEach - -A sink that executes the provided effectful function for every element fed -to it. - -**Signature** - -```ts -export declare const forEach: (f: (input: In) => Effect.Effect) => Sink -``` - -Added in v2.0.0 - -## forEachChunk - -A sink that executes the provided effectful function for every chunk fed to -it. - -**Signature** - -```ts -export declare const forEachChunk: ( - f: (input: Chunk.Chunk) => Effect.Effect -) => Sink -``` - -Added in v2.0.0 - -## forEachChunkWhile - -A sink that executes the provided effectful function for every chunk fed to -it until `f` evaluates to `false`. - -**Signature** - -```ts -export declare const forEachChunkWhile: ( - f: (input: Chunk.Chunk) => Effect.Effect -) => Sink -``` - -Added in v2.0.0 - -## forEachWhile - -A sink that executes the provided effectful function for every element fed -to it until `f` evaluates to `false`. - -**Signature** - -```ts -export declare const forEachWhile: ( - f: (input: In) => Effect.Effect -) => Sink -``` - -Added in v2.0.0 - -## fromChannel - -Creates a sink from a `Channel`. - -**Signature** - -```ts -export declare const fromChannel: ( - channel: Channel.Channel, unknown, E, Chunk.Chunk, Z> -) => Sink -``` - -Added in v2.0.0 - -## fromEffect - -Creates a single-value sink produced from an effect. - -**Signature** - -```ts -export declare const fromEffect: (effect: Effect.Effect) => Sink -``` - -Added in v2.0.0 - -## fromPubSub - -Create a sink which publishes each element to the specified `PubSub`. - -**Signature** - -```ts -export declare const fromPubSub: ( - pubsub: PubSub.PubSub, - options?: { readonly shutdown?: boolean | undefined } -) => Sink -``` - -Added in v2.0.0 - -## fromPush - -Creates a sink from a chunk processing function. - -**Signature** - -```ts -export declare const fromPush: ( - push: Effect.Effect< - R, - never, - (_: Option.Option>) => Effect.Effect, Chunk.Chunk], void> - > -) => Sink, E, In, L, Z> -``` - -Added in v2.0.0 - -## fromQueue - -Create a sink which enqueues each element into the specified queue. - -**Signature** - -```ts -export declare const fromQueue: ( - queue: Queue.Enqueue, - options?: { readonly shutdown?: boolean | undefined } -) => Sink -``` - -Added in v2.0.0 - -## head - -Creates a sink containing the first value. - -**Signature** - -```ts -export declare const head: () => Sink> -``` - -Added in v2.0.0 - -## last - -Creates a sink containing the last value. - -**Signature** - -```ts -export declare const last: () => Sink> -``` - -Added in v2.0.0 - -## leftover - -Creates a sink that does not consume any input but provides the given chunk -as its leftovers - -**Signature** - -```ts -export declare const leftover: (chunk: Chunk.Chunk) => Sink -``` - -Added in v2.0.0 - -## mkString - -Creates a sink which transforms it's inputs into a string. - -**Signature** - -```ts -export declare const mkString: Sink -``` - -Added in v2.0.0 - -## never - -Creates a sink which never terminates. - -**Signature** - -```ts -export declare const never: Sink -``` - -Added in v2.0.0 - -## some - -A sink that returns whether an element satisfies the specified predicate. - -**Signature** - -```ts -export declare const some: (predicate: Predicate) => Sink -``` - -Added in v2.0.0 - -## succeed - -A sink that immediately ends with the specified value. - -**Signature** - -```ts -export declare const succeed: (z: Z) => Sink -``` - -Added in v2.0.0 - -## sum - -A sink that sums incoming numeric values. - -**Signature** - -```ts -export declare const sum: Sink -``` - -Added in v2.0.0 - -## suspend - -Returns a lazily constructed sink that may require effects for its -creation. - -**Signature** - -```ts -export declare const suspend: (evaluate: LazyArg>) => Sink -``` - -Added in v2.0.0 - -## sync - -A sink that immediately ends with the specified lazy value. - -**Signature** - -```ts -export declare const sync: (evaluate: LazyArg) => Sink -``` - -Added in v2.0.0 - -## take - -A sink that takes the specified number of values. - -**Signature** - -```ts -export declare const take: (n: number) => Sink> -``` - -Added in v2.0.0 - -## timed - -**Signature** - -```ts -export declare const timed: Sink -``` - -Added in v2.0.0 - -## toChannel - -Creates a `Channel` from a Sink. - -**Signature** - -```ts -export declare const toChannel: ( - self: Sink -) => Channel.Channel, unknown, E, Chunk.Chunk, Z> -``` - -Added in v2.0.0 - -## unwrap - -Creates a sink produced from an effect. - -**Signature** - -```ts -export declare const unwrap: ( - effect: Effect.Effect> -) => Sink -``` - -Added in v2.0.0 - -## unwrapScoped - -Creates a sink produced from a scoped effect. - -**Signature** - -```ts -export declare const unwrapScoped: ( - effect: Effect.Effect> -) => Sink, E, In, L, Z> -``` - -Added in v2.0.0 - -# context - -## provideContext - -Provides the sink with its required context, which eliminates its -dependency on `R`. - -**Signature** - -```ts -export declare const provideContext: { - (context: Context.Context): (self: Sink) => Sink - (self: Sink, context: Context.Context): Sink -} -``` - -Added in v2.0.0 - -# elements - -## findEffect - -Creates a sink that produces values until one verifies the predicate `f`. - -**Signature** - -```ts -export declare const findEffect: { - ( - f: (z: Z) => Effect.Effect - ): (self: Sink) => Sink> - ( - self: Sink, - f: (z: Z) => Effect.Effect - ): Sink> -} -``` - -Added in v2.0.0 - -# error handling - -## orElse - -Switch to another sink in case of failure - -**Signature** - -```ts -export declare const orElse: { - ( - that: LazyArg> - ): (self: Sink) => Sink - ( - self: Sink, - that: LazyArg> - ): Sink -} -``` - -Added in v2.0.0 - -## refineOrDie - -**Signature** - -```ts -export declare const refineOrDie: { - (pf: (error: E) => Option.Option): (self: Sink) => Sink - (self: Sink, pf: (error: E) => Option.Option): Sink -} -``` - -Added in v2.0.0 - -## refineOrDieWith - -**Signature** - -```ts -export declare const refineOrDieWith: ( - pf: (error: E) => Option.Option, - f: (error: E) => unknown -) => (self: Sink) => Sink -``` - -Added in v2.0.0 - -# filtering - -## filterInput - -Filters the sink's input with the given predicate. - -**Signature** - -```ts -export declare const filterInput: { - ( - f: Refinement - ): (self: Sink) => Sink - (f: Predicate): (self: Sink) => Sink -} -``` - -Added in v2.0.0 - -## filterInputEffect - -Effectfully filter the input of this sink using the specified predicate. - -**Signature** - -```ts -export declare const filterInputEffect: { - ( - f: (input: In1) => Effect.Effect - ): (self: Sink) => Sink - ( - self: Sink, - f: (input: In1) => Effect.Effect - ): Sink -} -``` - -Added in v2.0.0 - -# finalization - -## ensuring - -Returns a new sink with an attached finalizer. The finalizer is guaranteed -to be executed so long as the sink begins execution (and regardless of -whether or not it completes). - -**Signature** - -```ts -export declare const ensuring: { - ( - finalizer: Effect.Effect - ): (self: Sink) => Sink - (self: Sink, finalizer: Effect.Effect): Sink -} -``` - -Added in v2.0.0 - -## ensuringWith - -Returns a new sink with an attached finalizer. The finalizer is guaranteed -to be executed so long as the sink begins execution (and regardless of -whether or not it completes). - -**Signature** - -```ts -export declare const ensuringWith: { - ( - finalizer: (exit: Exit.Exit) => Effect.Effect - ): (self: Sink) => Sink - ( - self: Sink, - finalizer: (exit: Exit.Exit) => Effect.Effect - ): Sink -} -``` - -Added in v2.0.0 - -# folding - -## fold - -A sink that folds its inputs with the provided function, termination -predicate and initial state. - -**Signature** - -```ts -export declare const fold: ( - s: S, - contFn: Predicate, - f: (z: S, input: In) => S -) => Sink -``` - -Added in v2.0.0 - -## foldSink - -Folds over the result of the sink - -**Signature** - -```ts -export declare const foldSink: { - (options: { - readonly onFailure: (err: E) => Sink - readonly onSuccess: (z: Z) => Sink - }): (self: Sink) => Sink - ( - self: Sink, - options: { - readonly onFailure: (err: E) => Sink - readonly onSuccess: (z: Z) => Sink - } - ): Sink -} -``` - -Added in v2.0.0 - -# mapping - -## as - -Replaces this sink's result with the provided value. - -**Signature** - -```ts -export declare const as: { - (z: Z2): (self: Sink) => Sink - (self: Sink, z: Z2): Sink -} -``` - -Added in v2.0.0 - -## dimap - -Transforms both inputs and result of this sink using the provided -functions. - -**Signature** - -```ts -export declare const dimap: { - (options: { - readonly onInput: (input: In0) => In - readonly onDone: (z: Z) => Z2 - }): (self: Sink) => Sink - ( - self: Sink, - options: { readonly onInput: (input: In0) => In; readonly onDone: (z: Z) => Z2 } - ): Sink -} -``` - -Added in v2.0.0 - -## dimapChunks - -Transforms both input chunks and result of this sink using the provided -functions. - -**Signature** - -```ts -export declare const dimapChunks: { - (options: { - readonly onInput: (chunk: Chunk.Chunk) => Chunk.Chunk - readonly onDone: (z: Z) => Z2 - }): (self: Sink) => Sink - ( - self: Sink, - options: { readonly onInput: (chunk: Chunk.Chunk) => Chunk.Chunk; readonly onDone: (z: Z) => Z2 } - ): Sink -} -``` - -Added in v2.0.0 - -## dimapChunksEffect - -Effectfully transforms both input chunks and result of this sink using the -provided functions. `f` and `g` must preserve chunking-invariance. - -**Signature** - -```ts -export declare const dimapChunksEffect: { - (options: { - readonly onInput: (chunk: Chunk.Chunk) => Effect.Effect> - readonly onDone: (z: Z) => Effect.Effect - }): (self: Sink) => Sink - ( - self: Sink, - options: { - readonly onInput: (chunk: Chunk.Chunk) => Effect.Effect> - readonly onDone: (z: Z) => Effect.Effect - } - ): Sink -} -``` - -Added in v2.0.0 - -## dimapEffect - -Effectfully transforms both inputs and result of this sink using the -provided functions. - -**Signature** - -```ts -export declare const dimapEffect: { - (options: { - readonly onInput: (input: In0) => Effect.Effect - readonly onDone: (z: Z) => Effect.Effect - }): (self: Sink) => Sink - ( - self: Sink, - options: { - readonly onInput: (input: In0) => Effect.Effect - readonly onDone: (z: Z) => Effect.Effect - } - ): Sink -} -``` - -Added in v2.0.0 - -## map - -Transforms this sink's result. - -**Signature** - -```ts -export declare const map: { - (f: (z: Z) => Z2): (self: Sink) => Sink - (self: Sink, f: (z: Z) => Z2): Sink -} -``` - -Added in v2.0.0 - -## mapEffect - -Effectfully transforms this sink's result. - -**Signature** - -```ts -export declare const mapEffect: { - ( - f: (z: Z) => Effect.Effect - ): (self: Sink) => Sink - ( - self: Sink, - f: (z: Z) => Effect.Effect - ): Sink -} -``` - -Added in v2.0.0 - -## mapError - -Transforms the errors emitted by this sink using `f`. - -**Signature** - -```ts -export declare const mapError: { - (f: (error: E) => E2): (self: Sink) => Sink - (self: Sink, f: (error: E) => E2): Sink -} -``` - -Added in v2.0.0 - -## mapInput - -Transforms this sink's input elements. - -**Signature** - -```ts -export declare const mapInput: (( - f: (input: In0) => In -) => (self: Sink) => Sink) & - ((self: Sink, f: (input: In0) => In) => Sink) -``` - -Added in v2.0.0 - -## mapInputChunks - -Transforms this sink's input chunks. `f` must preserve chunking-invariance. - -**Signature** - -```ts -export declare const mapInputChunks: { - ( - f: (chunk: Chunk.Chunk) => Chunk.Chunk - ): (self: Sink) => Sink - ( - self: Sink, - f: (chunk: Chunk.Chunk) => Chunk.Chunk - ): Sink -} -``` - -Added in v2.0.0 - -## mapInputChunksEffect - -Effectfully transforms this sink's input chunks. `f` must preserve -chunking-invariance. - -**Signature** - -```ts -export declare const mapInputChunksEffect: { - ( - f: (chunk: Chunk.Chunk) => Effect.Effect> - ): (self: Sink) => Sink - ( - self: Sink, - f: (chunk: Chunk.Chunk) => Effect.Effect> - ): Sink -} -``` - -Added in v2.0.0 - -## mapInputEffect - -Effectfully transforms this sink's input elements. - -**Signature** - -```ts -export declare const mapInputEffect: (( - f: (input: In0) => Effect.Effect -) => (self: Sink) => Sink) & - (( - self: Sink, - f: (input: In0) => Effect.Effect - ) => Sink) -``` - -Added in v2.0.0 - -## mapLeftover - -Transforms the leftovers emitted by this sink using `f`. - -**Signature** - -```ts -export declare const mapLeftover: { - (f: (leftover: L) => L2): (self: Sink) => Sink - (self: Sink, f: (leftover: L) => L2): Sink -} -``` - -Added in v2.0.0 - -# models - -## Sink (interface) - -A `Sink` is used to consume elements produced by a `Stream`. -You can think of a sink as a function that will consume a variable amount of -`In` elements (could be 0, 1, or many), might fail with an error of type `E`, -and will eventually yield a value of type `Z` together with a remainder of -type `L` (i.e. any leftovers). - -**Signature** - -```ts -export interface Sink extends Sink.Variance, Pipeable {} -``` - -Added in v2.0.0 - -## SinkUnify (interface) - -**Signature** - -```ts -export interface SinkUnify
extends Effect.EffectUnify { - Sink?: () => A[Unify.typeSymbol] extends Sink | infer _ - ? Sink - : never -} -``` - -Added in v2.0.0 - -## SinkUnifyIgnore (interface) - -**Signature** - -```ts -export interface SinkUnifyIgnore extends Effect.EffectUnifyIgnore { - Sink?: true -} -``` - -Added in v2.0.0 - -# sequencing - -## flatMap - -Runs this sink until it yields a result, then uses that result to create -another sink from the provided function which will continue to run until it -yields a result. - -This function essentially runs sinks in sequence. - -**Signature** - -```ts -export declare const flatMap: { - ( - f: (z: Z) => Sink - ): (self: Sink) => Sink - ( - self: Sink, - f: (z: Z) => Sink - ): Sink -} -``` - -Added in v2.0.0 - -# symbols - -## SinkTypeId - -**Signature** - -```ts -export declare const SinkTypeId: typeof SinkTypeId -``` - -Added in v2.0.0 - -## SinkTypeId (type alias) - -**Signature** - -```ts -export type SinkTypeId = typeof SinkTypeId -``` - -Added in v2.0.0 - -# utils - -## Sink (namespace) - -Added in v2.0.0 - -### Variance (interface) - -**Signature** - -```ts -export interface Variance { - readonly [SinkTypeId]: VarianceStruct -} -``` - -Added in v2.0.0 - -### VarianceStruct (interface) - -**Signature** - -```ts -export interface VarianceStruct { - _R: (_: never) => R - _E: (_: never) => E - _In: (_: In) => void - _L: (_: never) => L - _Z: (_: never) => Z -} -``` - -Added in v2.0.0 - -## collectAllFrom - -Repeatedly runs the sink and accumulates its results into a `Chunk`. - -**Signature** - -```ts -export declare const collectAllFrom: ( - self: Sink -) => Sink> -``` - -Added in v2.0.0 - -## collectAllWhileWith - -Repeatedly runs the sink for as long as its results satisfy the predicate -`p`. The sink's results will be accumulated using the stepping function `f`. - -**Signature** - -```ts -export declare const collectAllWhileWith: { - (options: { - readonly initial: S - readonly while: Predicate - readonly body: (s: S, z: Z) => S - }): (self: Sink) => Sink - ( - self: Sink, - options: { readonly initial: S; readonly while: Predicate; readonly body: (s: S, z: Z) => S } - ): Sink -} -``` - -Added in v2.0.0 - -## collectLeftover - -Collects the leftovers from the stream when the sink succeeds and returns -them as part of the sink's result. - -**Signature** - -```ts -export declare const collectLeftover: ( - self: Sink -) => Sink]> -``` - -Added in v2.0.0 - -## ignoreLeftover - -Drains the remaining elements from the stream after the sink finishes - -**Signature** - -```ts -export declare const ignoreLeftover: (self: Sink) => Sink -``` - -Added in v2.0.0 - -## race - -Runs both sinks in parallel on the input, , returning the result or the -error from the one that finishes first. - -**Signature** - -```ts -export declare const race: { - ( - that: Sink - ): (self: Sink) => Sink - ( - self: Sink, - that: Sink - ): Sink -} -``` - -Added in v2.0.0 - -## raceBoth - -Runs both sinks in parallel on the input, returning the result or the error -from the one that finishes first. - -**Signature** - -```ts -export declare const raceBoth: { - ( - that: Sink, - options?: { readonly capacity?: number | undefined } - ): (self: Sink) => Sink> - ( - self: Sink, - that: Sink, - options?: { readonly capacity?: number | undefined } - ): Sink> -} -``` - -Added in v2.0.0 - -## raceWith - -Runs both sinks in parallel on the input, using the specified merge -function as soon as one result or the other has been computed. - -**Signature** - -```ts -export declare const raceWith: { - (options: { - readonly other: Sink - readonly onSelfDone: (exit: Exit.Exit) => MergeDecision.MergeDecision - readonly onOtherDone: (exit: Exit.Exit) => MergeDecision.MergeDecision - readonly capacity?: number | undefined - }): (self: Sink) => Sink - ( - self: Sink, - options: { - readonly other: Sink - readonly onSelfDone: (exit: Exit.Exit) => MergeDecision.MergeDecision - readonly onOtherDone: (exit: Exit.Exit) => MergeDecision.MergeDecision - readonly capacity?: number | undefined - } - ): Sink -} -``` - -Added in v2.0.0 - -## splitWhere - -Splits the sink on the specified predicate, returning a new sink that -consumes elements until an element after the first satisfies the specified -predicate. - -**Signature** - -```ts -export declare const splitWhere: { - (f: Predicate): (self: Sink) => Sink - (self: Sink, f: Predicate): Sink -} -``` - -Added in v2.0.0 - -## summarized - -Summarize a sink by running an effect when the sink starts and again when -it completes. - -**Signature** - -```ts -export declare const summarized: { - ( - summary: Effect.Effect, - f: (start: Z2, end: Z2) => Z3 - ): (self: Sink) => Sink - ( - self: Sink, - summary: Effect.Effect, - f: (start: Z2, end: Z2) => Z3 - ): Sink -} -``` - -Added in v2.0.0 - -## withDuration - -Returns the sink that executes this one and times its execution. - -**Signature** - -```ts -export declare const withDuration: ( - self: Sink -) => Sink -``` - -Added in v2.0.0 - -# zipping - -## zip - -Feeds inputs to this sink until it yields a result, then switches over to -the provided sink until it yields a result, finally combining the two -results into a tuple. - -**Signature** - -```ts -export declare const zip: { - ( - that: Sink, - options?: { readonly concurrent?: boolean | undefined } - ): (self: Sink) => Sink - ( - self: Sink, - that: Sink, - options?: { readonly concurrent?: boolean | undefined } - ): Sink -} -``` - -Added in v2.0.0 - -## zipLeft - -Like `Sink.zip` but keeps only the result from this sink. - -**Signature** - -```ts -export declare const zipLeft: { - ( - that: Sink, - options?: { readonly concurrent?: boolean | undefined } - ): (self: Sink) => Sink - ( - self: Sink, - that: Sink, - options?: { readonly concurrent?: boolean | undefined } - ): Sink -} -``` - -Added in v2.0.0 - -## zipRight - -Like `Sink.zip` but keeps only the result from `that` sink. - -**Signature** - -```ts -export declare const zipRight: { - ( - that: Sink, - options?: { readonly concurrent?: boolean | undefined } - ): (self: Sink) => Sink - ( - self: Sink, - that: Sink, - options?: { readonly concurrent?: boolean | undefined } - ): Sink -} -``` - -Added in v2.0.0 - -## zipWith - -Feeds inputs to this sink until it yields a result, then switches over to -the provided sink until it yields a result, finally combining the two -results with `f`. - -**Signature** - -```ts -export declare const zipWith: { - ( - that: Sink, - f: (z: Z, z1: Z2) => Z3, - options?: { readonly concurrent?: boolean | undefined } - ): (self: Sink) => Sink - ( - self: Sink, - that: Sink, - f: (z: Z, z1: Z2) => Z3, - options?: { readonly concurrent?: boolean | undefined } - ): Sink -} -``` - -Added in v2.0.0 diff --git a/docs/modules/SortedMap.ts.md b/docs/modules/SortedMap.ts.md deleted file mode 100644 index b6a755670..000000000 --- a/docs/modules/SortedMap.ts.md +++ /dev/null @@ -1,297 +0,0 @@ ---- -title: SortedMap.ts -nav_order: 104 -parent: Modules ---- - -## SortedMap overview - -Added in v2.0.0 - ---- - -

Table of contents

- -- [constructors](#constructors) - - [empty](#empty) - - [fromIterable](#fromiterable) - - [make](#make) -- [elements](#elements) - - [get](#get) - - [has](#has) - - [headOption](#headoption) - - [remove](#remove) - - [set](#set) -- [folding](#folding) - - [reduce](#reduce) -- [getters](#getters) - - [entries](#entries) - - [getOrder](#getorder) - - [keys](#keys) - - [size](#size) - - [values](#values) -- [mapping](#mapping) - - [map](#map) -- [models](#models) - - [SortedMap (interface)](#sortedmap-interface) -- [predicates](#predicates) - - [isEmpty](#isempty) - - [isNonEmpty](#isnonempty) -- [refinements](#refinements) - - [isSortedMap](#issortedmap) -- [symbol](#symbol) - - [TypeId (type alias)](#typeid-type-alias) - ---- - -# constructors - -## empty - -**Signature** - -```ts -export declare const empty: (ord: Order) => SortedMap -``` - -Added in v2.0.0 - -## fromIterable - -**Signature** - -```ts -export declare const fromIterable: { - (ord: Order): (iterable: Iterable) => SortedMap - (iterable: Iterable, ord: Order): SortedMap -} -``` - -Added in v2.0.0 - -## make - -**Signature** - -```ts -export declare const make: ( - ord: Order -) => ( - ...entries: Entries -) => SortedMap -``` - -Added in v2.0.0 - -# elements - -## get - -**Signature** - -```ts -export declare const get: { - (key: K): (self: SortedMap) => Option.Option - (self: SortedMap, key: K): Option.Option -} -``` - -Added in v2.0.0 - -## has - -**Signature** - -```ts -export declare const has: { - (key: K): (self: SortedMap) => boolean - (self: SortedMap, key: K): boolean -} -``` - -Added in v2.0.0 - -## headOption - -**Signature** - -```ts -export declare const headOption: (self: SortedMap) => Option.Option<[K, V]> -``` - -Added in v2.0.0 - -## remove - -**Signature** - -```ts -export declare const remove: { - (key: K): (self: SortedMap) => SortedMap - (self: SortedMap, key: K): SortedMap -} -``` - -Added in v2.0.0 - -## set - -**Signature** - -```ts -export declare const set: { - (key: K, value: V): (self: SortedMap) => SortedMap - (self: SortedMap, key: K, value: V): SortedMap -} -``` - -Added in v2.0.0 - -# folding - -## reduce - -**Signature** - -```ts -export declare const reduce: { - (zero: B, f: (acc: B, value: A, key: K) => B): (self: SortedMap) => B - (self: SortedMap, zero: B, f: (acc: B, value: A, key: K) => B): B -} -``` - -Added in v2.0.0 - -# getters - -## entries - -**Signature** - -```ts -export declare const entries: (self: SortedMap) => IterableIterator<[K, V]> -``` - -Added in v2.0.0 - -## getOrder - -Gets the `Order` that the `SortedMap` is using. - -**Signature** - -```ts -export declare const getOrder: (self: SortedMap) => Order -``` - -Added in v2.0.0 - -## keys - -**Signature** - -```ts -export declare const keys: (self: SortedMap) => IterableIterator -``` - -Added in v2.0.0 - -## size - -**Signature** - -```ts -export declare const size: (self: SortedMap) => number -``` - -Added in v2.0.0 - -## values - -**Signature** - -```ts -export declare const values: (self: SortedMap) => IterableIterator -``` - -Added in v2.0.0 - -# mapping - -## map - -**Signature** - -```ts -export declare const map: { - (f: (a: A, k: K) => B): (self: SortedMap) => SortedMap - (self: SortedMap, f: (a: A, k: K) => B): SortedMap -} -``` - -Added in v2.0.0 - -# models - -## SortedMap (interface) - -**Signature** - -```ts -export interface SortedMap extends Iterable<[K, V]>, Equal.Equal, Pipeable, Inspectable { - readonly [TypeId]: TypeId - /** @internal */ - readonly tree: RBT.RedBlackTree -} -``` - -Added in v2.0.0 - -# predicates - -## isEmpty - -**Signature** - -```ts -export declare const isEmpty: (self: SortedMap) => boolean -``` - -Added in v2.0.0 - -## isNonEmpty - -**Signature** - -```ts -export declare const isNonEmpty: (self: SortedMap) => boolean -``` - -Added in v2.0.0 - -# refinements - -## isSortedMap - -**Signature** - -```ts -export declare const isSortedMap: { - (u: Iterable): u is SortedMap - (u: unknown): u is SortedMap -} -``` - -Added in v2.0.0 - -# symbol - -## TypeId (type alias) - -**Signature** - -```ts -export type TypeId = typeof TypeId -``` - -Added in v2.0.0 diff --git a/docs/modules/SortedSet.ts.md b/docs/modules/SortedSet.ts.md deleted file mode 100644 index e07770fa1..000000000 --- a/docs/modules/SortedSet.ts.md +++ /dev/null @@ -1,370 +0,0 @@ ---- -title: SortedSet.ts -nav_order: 105 -parent: Modules ---- - -## SortedSet overview - -Added in v2.0.0 - ---- - -

Table of contents

- -- [constructors](#constructors) - - [empty](#empty) - - [fromIterable](#fromiterable) - - [make](#make) -- [elements](#elements) - - [add](#add) - - [every](#every) - - [has](#has) - - [isSubset](#issubset) - - [remove](#remove) - - [some](#some) - - [toggle](#toggle) -- [filtering](#filtering) - - [filter](#filter) - - [partition](#partition) -- [getters](#getters) - - [size](#size) - - [values](#values) -- [mapping](#mapping) - - [map](#map) -- [models](#models) - - [SortedSet (interface)](#sortedset-interface) -- [refinements](#refinements) - - [isSortedSet](#issortedset) -- [sequencing](#sequencing) - - [flatMap](#flatmap) -- [symbol](#symbol) - - [TypeId (type alias)](#typeid-type-alias) -- [traversing](#traversing) - - [forEach](#foreach) -- [utils](#utils) - - [difference](#difference) - - [intersection](#intersection) - - [union](#union) - ---- - -# constructors - -## empty - -**Signature** - -```ts -export declare const empty:
(O: Order) => SortedSet -``` - -Added in v2.0.0 - -## fromIterable - -**Signature** - -```ts -export declare const fromIterable: { - (ord: Order): (iterable: Iterable) => SortedSet - (iterable: Iterable, ord: Order): SortedSet -} -``` - -Added in v2.0.0 - -## make - -**Signature** - -```ts -export declare const make: ( - ord: Order -) => (...entries: Entries) => SortedSet -``` - -Added in v2.0.0 - -# elements - -## add - -**Signature** - -```ts -export declare const add: { - (value: A): (self: SortedSet) => SortedSet - (self: SortedSet, value: A): SortedSet -} -``` - -Added in v2.0.0 - -## every - -Check if a predicate holds true for every `SortedSet` element. - -**Signature** - -```ts -export declare const every: { - (refinement: Refinement): (self: SortedSet) => self is SortedSet - (predicate: Predicate): (self: SortedSet) => boolean - (self: SortedSet, refinement: Refinement): self is SortedSet - (self: SortedSet, predicate: Predicate): boolean -} -``` - -Added in v2.0.0 - -## has - -**Signature** - -```ts -export declare const has: { (value: A): (self: SortedSet) => boolean; (self: SortedSet, value: A): boolean } -``` - -Added in v2.0.0 - -## isSubset - -**Signature** - -```ts -export declare const isSubset: { - (that: SortedSet): (self: SortedSet) => boolean - (self: SortedSet, that: SortedSet): boolean -} -``` - -Added in v2.0.0 - -## remove - -**Signature** - -```ts -export declare const remove: { - (value: A): (self: SortedSet) => SortedSet - (self: SortedSet, value: A): SortedSet -} -``` - -Added in v2.0.0 - -## some - -Check if a predicate holds true for some `SortedSet` element. - -**Signature** - -```ts -export declare const some: { - (predicate: Predicate): (self: SortedSet) => boolean - (self: SortedSet, predicate: Predicate): boolean -} -``` - -Added in v2.0.0 - -## toggle - -**Signature** - -```ts -export declare const toggle: { - (value: A): (self: SortedSet) => SortedSet - (self: SortedSet, value: A): SortedSet -} -``` - -Added in v2.0.0 - -# filtering - -## filter - -**Signature** - -```ts -export declare const filter: { - (refinement: Refinement): (self: SortedSet) => SortedSet - (predicate: Predicate): (self: SortedSet) => SortedSet - (self: SortedSet, refinement: Refinement): SortedSet - (self: SortedSet, predicate: Predicate): SortedSet -} -``` - -Added in v2.0.0 - -## partition - -**Signature** - -```ts -export declare const partition: { - ( - refinement: Refinement - ): (self: SortedSet) => [SortedSet>, SortedSet] - (predicate: (a: A) => boolean): (self: SortedSet) => [SortedSet, SortedSet] - ( - self: SortedSet, - refinement: Refinement - ): [SortedSet>, SortedSet] - (self: SortedSet, predicate: (a: A) => boolean): [SortedSet, SortedSet] -} -``` - -Added in v2.0.0 - -# getters - -## size - -**Signature** - -```ts -export declare const size: (self: SortedSet) => number -``` - -Added in v2.0.0 - -## values - -**Signature** - -```ts -export declare const values: (self: SortedSet) => IterableIterator -``` - -Added in v2.0.0 - -# mapping - -## map - -**Signature** - -```ts -export declare const map: { - (O: Order, f: (a: A) => B): (self: SortedSet) => SortedSet - (self: SortedSet, O: Order, f: (a: A) => B): SortedSet -} -``` - -Added in v2.0.0 - -# models - -## SortedSet (interface) - -**Signature** - -```ts -export interface SortedSet extends Iterable, Equal.Equal, Pipeable, Inspectable { - readonly [TypeId]: { - readonly _A: (_: never) => A - } - /** @internal */ - readonly keyTree: RBT.RedBlackTree -} -``` - -Added in v2.0.0 - -# refinements - -## isSortedSet - -**Signature** - -```ts -export declare const isSortedSet: { (u: Iterable): u is SortedSet; (u: unknown): u is SortedSet } -``` - -Added in v2.0.0 - -# sequencing - -## flatMap - -**Signature** - -```ts -export declare const flatMap: { - (O: Order, f: (a: A) => Iterable): (self: SortedSet) => SortedSet - (self: SortedSet, O: Order, f: (a: A) => Iterable): SortedSet -} -``` - -Added in v2.0.0 - -# symbol - -## TypeId (type alias) - -**Signature** - -```ts -export type TypeId = typeof TypeId -``` - -Added in v2.0.0 - -# traversing - -## forEach - -**Signature** - -```ts -export declare const forEach: { - (f: (a: A) => void): (self: SortedSet) => void - (self: SortedSet, f: (a: A) => void): void -} -``` - -Added in v2.0.0 - -# utils - -## difference - -**Signature** - -```ts -export declare const difference: { - (that: Iterable): (self: SortedSet) => SortedSet - (self: SortedSet, that: Iterable): SortedSet -} -``` - -Added in v2.0.0 - -## intersection - -**Signature** - -```ts -export declare const intersection: { - (that: Iterable): (self: SortedSet) => SortedSet - (self: SortedSet, that: Iterable): SortedSet -} -``` - -Added in v2.0.0 - -## union - -**Signature** - -```ts -export declare const union: { - (that: Iterable): (self: SortedSet) => SortedSet - (self: SortedSet, that: Iterable): SortedSet -} -``` - -Added in v2.0.0 diff --git a/docs/modules/Stream.ts.md b/docs/modules/Stream.ts.md deleted file mode 100644 index 21638e1b4..000000000 --- a/docs/modules/Stream.ts.md +++ /dev/null @@ -1,6019 +0,0 @@ ---- -title: Stream.ts -nav_order: 107 -parent: Modules ---- - -## Stream overview - -Added in v2.0.0 - ---- - -

Table of contents

- -- [combinators](#combinators) - - [splitLines](#splitlines) -- [constants](#constants) - - [DefaultChunkSize](#defaultchunksize) -- [constructors](#constructors) - - [acquireRelease](#acquirerelease) - - [async](#async) - - [asyncEffect](#asynceffect) - - [asyncInterrupt](#asyncinterrupt) - - [asyncOption](#asyncoption) - - [asyncScoped](#asyncscoped) - - [concatAll](#concatall) - - [die](#die) - - [dieMessage](#diemessage) - - [dieSync](#diesync) - - [empty](#empty) - - [execute](#execute) - - [fail](#fail) - - [failCause](#failcause) - - [failCauseSync](#failcausesync) - - [failSync](#failsync) - - [finalizer](#finalizer) - - [fromAsyncIterable](#fromasynciterable) - - [fromChannel](#fromchannel) - - [fromChunk](#fromchunk) - - [fromChunkPubSub](#fromchunkpubsub) - - [fromChunkQueue](#fromchunkqueue) - - [fromChunks](#fromchunks) - - [fromEffect](#fromeffect) - - [fromEffectOption](#fromeffectoption) - - [fromIterable](#fromiterable) - - [fromIterableEffect](#fromiterableeffect) - - [fromIteratorSucceed](#fromiteratorsucceed) - - [fromPubSub](#frompubsub) - - [fromPull](#frompull) - - [fromQueue](#fromqueue) - - [fromReadableStream](#fromreadablestream) - - [fromReadableStreamByob](#fromreadablestreambyob) - - [fromSchedule](#fromschedule) - - [iterate](#iterate) - - [make](#make) - - [never](#never) - - [paginate](#paginate) - - [paginateChunk](#paginatechunk) - - [paginateChunkEffect](#paginatechunkeffect) - - [paginateEffect](#paginateeffect) - - [range](#range) - - [repeatEffect](#repeateffect) - - [repeatEffectChunk](#repeateffectchunk) - - [repeatEffectChunkOption](#repeateffectchunkoption) - - [repeatEffectOption](#repeateffectoption) - - [repeatEffectWithSchedule](#repeateffectwithschedule) - - [repeatValue](#repeatvalue) - - [scoped](#scoped) - - [succeed](#succeed) - - [suspend](#suspend) - - [sync](#sync) - - [tick](#tick) - - [toChannel](#tochannel) - - [unfold](#unfold) - - [unfoldChunk](#unfoldchunk) - - [unfoldChunkEffect](#unfoldchunkeffect) - - [unfoldEffect](#unfoldeffect) - - [unit](#unit) - - [unwrap](#unwrap) - - [unwrapScoped](#unwrapscoped) - - [whenCase](#whencase) -- [context](#context) - - [context](#context-1) - - [contextWith](#contextwith) - - [contextWithEffect](#contextwitheffect) - - [contextWithStream](#contextwithstream) - - [mapInputContext](#mapinputcontext) - - [provideContext](#providecontext) - - [provideLayer](#providelayer) - - [provideService](#provideservice) - - [provideServiceEffect](#provideserviceeffect) - - [provideServiceStream](#provideservicestream) - - [provideSomeLayer](#providesomelayer) - - [updateService](#updateservice) -- [destructors](#destructors) - - [run](#run) - - [runCollect](#runcollect) - - [runCount](#runcount) - - [runDrain](#rundrain) - - [runFold](#runfold) - - [runFoldEffect](#runfoldeffect) - - [runFoldScoped](#runfoldscoped) - - [runFoldScopedEffect](#runfoldscopedeffect) - - [runFoldWhile](#runfoldwhile) - - [runFoldWhileEffect](#runfoldwhileeffect) - - [runFoldWhileScoped](#runfoldwhilescoped) - - [runFoldWhileScopedEffect](#runfoldwhilescopedeffect) - - [runForEach](#runforeach) - - [runForEachChunk](#runforeachchunk) - - [runForEachChunkScoped](#runforeachchunkscoped) - - [runForEachScoped](#runforeachscoped) - - [runForEachWhile](#runforeachwhile) - - [runForEachWhileScoped](#runforeachwhilescoped) - - [runHead](#runhead) - - [runIntoPubSub](#runintopubsub) - - [runIntoPubSubScoped](#runintopubsubscoped) - - [runIntoQueue](#runintoqueue) - - [runIntoQueueElementsScoped](#runintoqueueelementsscoped) - - [runIntoQueueScoped](#runintoqueuescoped) - - [runLast](#runlast) - - [runScoped](#runscoped) - - [runSum](#runsum) - - [toPubSub](#topubsub) - - [toPull](#topull) - - [toQueue](#toqueue) - - [toQueueOfElements](#toqueueofelements) - - [toReadableStream](#toreadablestream) -- [do notation](#do-notation) - - [Do](#do) - - [bind](#bind) - - [bindEffect](#bindeffect) - - [bindTo](#bindto) - - [let](#let) -- [elements](#elements) - - [find](#find) - - [findEffect](#findeffect) -- [encoding](#encoding) - - [decodeText](#decodetext) - - [encodeText](#encodetext) -- [error handling](#error-handling) - - [catchAll](#catchall) - - [catchAllCause](#catchallcause) - - [catchSome](#catchsome) - - [catchSomeCause](#catchsomecause) - - [catchTag](#catchtag) - - [catchTags](#catchtags) - - [orDie](#ordie) - - [orDieWith](#ordiewith) - - [orElse](#orelse) - - [orElseEither](#orelseeither) - - [orElseFail](#orelsefail) - - [orElseIfEmpty](#orelseifempty) - - [orElseIfEmptyChunk](#orelseifemptychunk) - - [orElseIfEmptyStream](#orelseifemptystream) - - [orElseSucceed](#orelsesucceed) - - [refineOrDie](#refineordie) - - [refineOrDieWith](#refineordiewith) -- [filtering](#filtering) - - [filter](#filter) - - [filterEffect](#filtereffect) -- [grouping](#grouping) - - [groupAdjacentBy](#groupadjacentby) - - [groupBy](#groupby) -- [mapping](#mapping) - - [as](#as) - - [map](#map) - - [mapAccum](#mapaccum) - - [mapAccumEffect](#mapaccumeffect) - - [mapChunks](#mapchunks) - - [mapChunksEffect](#mapchunkseffect) - - [mapConcat](#mapconcat) - - [mapConcatChunk](#mapconcatchunk) - - [mapConcatChunkEffect](#mapconcatchunkeffect) - - [mapConcatEffect](#mapconcateffect) - - [mapEffect](#mapeffect) - - [mapError](#maperror) - - [mapErrorCause](#maperrorcause) -- [models](#models) - - [Stream (interface)](#stream-interface) - - [StreamUnify (interface)](#streamunify-interface) - - [StreamUnifyIgnore (interface)](#streamunifyignore-interface) -- [sequencing](#sequencing) - - [branchAfter](#branchafter) - - [flatMap](#flatmap) - - [flatten](#flatten) - - [flattenChunks](#flattenchunks) - - [flattenEffect](#flatteneffect) - - [flattenExitOption](#flattenexitoption) - - [flattenIterables](#flatteniterables) - - [flattenTake](#flattentake) - - [tap](#tap) - - [tapBoth](#tapboth) - - [tapError](#taperror) - - [tapSink](#tapsink) -- [symbols](#symbols) - - [StreamTypeId](#streamtypeid) - - [StreamTypeId (type alias)](#streamtypeid-type-alias) -- [tracing](#tracing) - - [withSpan](#withspan) -- [type lambdas](#type-lambdas) - - [StreamTypeLambda (interface)](#streamtypelambda-interface) -- [utils](#utils) - - [Stream (namespace)](#stream-namespace) - - [Variance (interface)](#variance-interface) - - [DynamicTuple (type alias)](#dynamictuple-type-alias) - - [DynamicTupleOf (type alias)](#dynamictupleof-type-alias) - - [accumulate](#accumulate) - - [accumulateChunks](#accumulatechunks) - - [aggregate](#aggregate) - - [aggregateWithin](#aggregatewithin) - - [aggregateWithinEither](#aggregatewithineither) - - [broadcast](#broadcast) - - [broadcastDynamic](#broadcastdynamic) - - [broadcastedQueues](#broadcastedqueues) - - [broadcastedQueuesDynamic](#broadcastedqueuesdynamic) - - [buffer](#buffer) - - [bufferChunks](#bufferchunks) - - [changes](#changes) - - [changesWith](#changeswith) - - [changesWithEffect](#changeswitheffect) - - [chunks](#chunks) - - [chunksWith](#chunkswith) - - [combine](#combine) - - [combineChunks](#combinechunks) - - [concat](#concat) - - [cross](#cross) - - [crossLeft](#crossleft) - - [crossRight](#crossright) - - [crossWith](#crosswith) - - [debounce](#debounce) - - [distributedWith](#distributedwith) - - [distributedWithDynamic](#distributedwithdynamic) - - [drain](#drain) - - [drainFork](#drainfork) - - [drop](#drop) - - [dropRight](#dropright) - - [dropUntil](#dropuntil) - - [dropUntilEffect](#dropuntileffect) - - [dropWhile](#dropwhile) - - [dropWhileEffect](#dropwhileeffect) - - [either](#either) - - [ensuring](#ensuring) - - [ensuringWith](#ensuringwith) - - [filterMap](#filtermap) - - [filterMapEffect](#filtermapeffect) - - [filterMapWhile](#filtermapwhile) - - [filterMapWhileEffect](#filtermapwhileeffect) - - [forever](#forever) - - [groupByKey](#groupbykey) - - [grouped](#grouped) - - [groupedWithin](#groupedwithin) - - [haltAfter](#haltafter) - - [haltWhen](#haltwhen) - - [haltWhenDeferred](#haltwhendeferred) - - [identity](#identity) - - [interleave](#interleave) - - [interleaveWith](#interleavewith) - - [interruptAfter](#interruptafter) - - [interruptWhen](#interruptwhen) - - [interruptWhenDeferred](#interruptwhendeferred) - - [intersperse](#intersperse) - - [intersperseAffixes](#intersperseaffixes) - - [mapBoth](#mapboth) - - [merge](#merge) - - [mergeAll](#mergeall) - - [mergeEither](#mergeeither) - - [mergeLeft](#mergeleft) - - [mergeRight](#mergeright) - - [mergeWith](#mergewith) - - [mkString](#mkstring) - - [onDone](#ondone) - - [onError](#onerror) - - [partition](#partition) - - [partitionEither](#partitioneither) - - [peel](#peel) - - [pipeThrough](#pipethrough) - - [pipeThroughChannel](#pipethroughchannel) - - [pipeThroughChannelOrFail](#pipethroughchannelorfail) - - [prepend](#prepend) - - [rechunk](#rechunk) - - [repeat](#repeat) - - [repeatEither](#repeateither) - - [repeatElements](#repeatelements) - - [repeatElementsWith](#repeatelementswith) - - [repeatWith](#repeatwith) - - [retry](#retry) - - [scan](#scan) - - [scanEffect](#scaneffect) - - [scanReduce](#scanreduce) - - [scanReduceEffect](#scanreduceeffect) - - [schedule](#schedule) - - [scheduleWith](#schedulewith) - - [sliding](#sliding) - - [slidingSize](#slidingsize) - - [some](#some) - - [someOrElse](#someorelse) - - [someOrFail](#someorfail) - - [split](#split) - - [splitOnChunk](#splitonchunk) - - [take](#take) - - [takeRight](#takeright) - - [takeUntil](#takeuntil) - - [takeUntilEffect](#takeuntileffect) - - [takeWhile](#takewhile) - - [tapErrorCause](#taperrorcause) - - [throttle](#throttle) - - [throttleEffect](#throttleeffect) - - [timeout](#timeout) - - [timeoutFail](#timeoutfail) - - [timeoutFailCause](#timeoutfailcause) - - [timeoutTo](#timeoutto) - - [transduce](#transduce) - - [when](#when) - - [whenCaseEffect](#whencaseeffect) - - [whenEffect](#wheneffect) -- [zipping](#zipping) - - [zip](#zip) - - [zipAll](#zipall) - - [zipAllLeft](#zipallleft) - - [zipAllRight](#zipallright) - - [zipAllSortedByKey](#zipallsortedbykey) - - [zipAllSortedByKeyLeft](#zipallsortedbykeyleft) - - [zipAllSortedByKeyRight](#zipallsortedbykeyright) - - [zipAllSortedByKeyWith](#zipallsortedbykeywith) - - [zipAllWith](#zipallwith) - - [zipFlatten](#zipflatten) - - [zipLatest](#ziplatest) - - [zipLatestWith](#ziplatestwith) - - [zipLeft](#zipleft) - - [zipRight](#zipright) - - [zipWith](#zipwith) - - [zipWithChunks](#zipwithchunks) - - [zipWithIndex](#zipwithindex) - - [zipWithNext](#zipwithnext) - - [zipWithPrevious](#zipwithprevious) - - [zipWithPreviousAndNext](#zipwithpreviousandnext) - ---- - -# combinators - -## splitLines - -Splits strings on newlines. Handles both Windows newlines (`\r\n`) and UNIX -newlines (`\n`). - -**Signature** - -```ts -export declare const splitLines: (self: Stream) => Stream -``` - -Added in v2.0.0 - -# constants - -## DefaultChunkSize - -The default chunk size used by the various combinators and constructors of -`Stream`. - -**Signature** - -```ts -export declare const DefaultChunkSize: number -``` - -Added in v2.0.0 - -# constructors - -## acquireRelease - -Creates a stream from a single value that will get cleaned up after the -stream is consumed. - -**Signature** - -```ts -export declare const acquireRelease: ( - acquire: Effect.Effect, - release: (resource: A, exit: Exit.Exit) => Effect.Effect -) => Stream -``` - -Added in v2.0.0 - -## async - -Creates a stream from an asynchronous callback that can be called multiple -times. The optionality of the error type `E` can be used to signal the end -of the stream, by setting it to `None`. - -**Signature** - -```ts -export declare const async: ( - register: (emit: Emit.Emit) => void, - outputBuffer?: number | undefined -) => Stream -``` - -Added in v2.0.0 - -## asyncEffect - -Creates a stream from an asynchronous callback that can be called multiple -times The registration of the callback itself returns an effect. The -optionality of the error type `E` can be used to signal the end of the -stream, by setting it to `None`. - -**Signature** - -```ts -export declare const asyncEffect: ( - register: (emit: Emit.Emit) => Effect.Effect, - outputBuffer?: number -) => Stream -``` - -Added in v2.0.0 - -## asyncInterrupt - -Creates a stream from an asynchronous callback that can be called multiple -times. The registration of the callback returns either a canceler or -synchronously returns a stream. The optionality of the error type `E` can -be used to signal the end of the stream, by setting it to `None`. - -**Signature** - -```ts -export declare const asyncInterrupt: ( - register: (emit: Emit.Emit) => Either.Either, Stream>, - outputBuffer?: number -) => Stream -``` - -Added in v2.0.0 - -## asyncOption - -Creates a stream from an asynchronous callback that can be called multiple -times. The registration of the callback can possibly return the stream -synchronously. The optionality of the error type `E` can be used to signal -the end of the stream, by setting it to `None`. - -**Signature** - -```ts -export declare const asyncOption: ( - register: (emit: Emit.Emit) => Option.Option>, - outputBuffer?: number -) => Stream -``` - -Added in v2.0.0 - -## asyncScoped - -Creates a stream from an asynchronous callback that can be called multiple -times. The registration of the callback itself returns an a scoped -resource. The optionality of the error type `E` can be used to signal the -end of the stream, by setting it to `None`. - -**Signature** - -```ts -export declare const asyncScoped: ( - register: (emit: Emit.Emit) => Effect.Effect, - outputBuffer?: number -) => Stream, E, A> -``` - -Added in v2.0.0 - -## concatAll - -Concatenates all of the streams in the chunk to one stream. - -**Signature** - -```ts -export declare const concatAll: (streams: Chunk.Chunk>) => Stream -``` - -Added in v2.0.0 - -## die - -The stream that dies with the specified defect. - -**Signature** - -```ts -export declare const die: (defect: unknown) => Stream -``` - -Added in v2.0.0 - -## dieMessage - -The stream that dies with an exception described by `message`. - -**Signature** - -```ts -export declare const dieMessage: (message: string) => Stream -``` - -Added in v2.0.0 - -## dieSync - -The stream that dies with the specified lazily evaluated defect. - -**Signature** - -```ts -export declare const dieSync: (evaluate: LazyArg) => Stream -``` - -Added in v2.0.0 - -## empty - -The empty stream. - -**Signature** - -```ts -export declare const empty: Stream -``` - -Added in v2.0.0 - -## execute - -Creates a stream that executes the specified effect but emits no elements. - -**Signature** - -```ts -export declare const execute: (effect: Effect.Effect) => Stream -``` - -Added in v2.0.0 - -## fail - -Terminates with the specified error. - -**Signature** - -```ts -export declare const fail: (error: E) => Stream -``` - -Added in v2.0.0 - -## failCause - -The stream that always fails with the specified `Cause`. - -**Signature** - -```ts -export declare const failCause: (cause: Cause.Cause) => Stream -``` - -Added in v2.0.0 - -## failCauseSync - -The stream that always fails with the specified lazily evaluated `Cause`. - -**Signature** - -```ts -export declare const failCauseSync: (evaluate: LazyArg>) => Stream -``` - -Added in v2.0.0 - -## failSync - -Terminates with the specified lazily evaluated error. - -**Signature** - -```ts -export declare const failSync: (evaluate: LazyArg) => Stream -``` - -Added in v2.0.0 - -## finalizer - -Creates a one-element stream that never fails and executes the finalizer -when it ends. - -**Signature** - -```ts -export declare const finalizer: (finalizer: Effect.Effect) => Stream -``` - -Added in v2.0.0 - -## fromAsyncIterable - -Creates a stream from an `AsyncIterable`. - -**Signature** - -```ts -export declare const fromAsyncIterable: ( - iterable: AsyncIterable
, - onError: (e: unknown) => E -) => Stream -``` - -Added in v2.0.0 - -## fromChannel - -Creates a stream from a `Channel`. - -**Signature** - -```ts -export declare const fromChannel: ( - channel: Channel.Channel, unknown> -) => Stream -``` - -Added in v2.0.0 - -## fromChunk - -Creates a stream from a `Chunk` of values. - -**Signature** - -```ts -export declare const fromChunk: (chunk: Chunk.Chunk) => Stream -``` - -Added in v2.0.0 - -## fromChunkPubSub - -Creates a stream from a subscription to a `PubSub`. - -**Signature** - -```ts -export declare const fromChunkPubSub: { - ( - pubsub: PubSub.PubSub>, - options: { readonly scoped: true; readonly shutdown?: boolean | undefined } - ): Effect.Effect> - ( - pubsub: PubSub.PubSub>, - options?: { readonly scoped?: false | undefined; readonly shutdown?: boolean | undefined } - ): Stream -} -``` - -Added in v2.0.0 - -## fromChunkQueue - -Creates a stream from a `Queue` of values. - -**Signature** - -```ts -export declare const fromChunkQueue: ( - queue: Queue.Dequeue>, - options?: { readonly shutdown?: boolean | undefined } -) => Stream -``` - -Added in v2.0.0 - -## fromChunks - -Creates a stream from an arbitrary number of chunks. - -**Signature** - -```ts -export declare const fromChunks: (...chunks: Chunk.Chunk[]) => Stream -``` - -Added in v2.0.0 - -## fromEffect - -Either emits the success value of this effect or terminates the stream -with the failure value of this effect. - -**Signature** - -```ts -export declare const fromEffect: (effect: Effect.Effect) => Stream -``` - -Added in v2.0.0 - -## fromEffectOption - -Creates a stream from an effect producing a value of type `A` or an empty -`Stream`. - -**Signature** - -```ts -export declare const fromEffectOption: (effect: Effect.Effect, A>) => Stream -``` - -Added in v2.0.0 - -## fromIterable - -Creates a stream from an `Iterable` collection of values. - -**Signature** - -```ts -export declare const fromIterable: (iterable: Iterable) => Stream -``` - -Added in v2.0.0 - -## fromIterableEffect - -Creates a stream from an effect producing a value of type `Iterable`. - -**Signature** - -```ts -export declare const fromIterableEffect: (effect: Effect.Effect>) => Stream -``` - -Added in v2.0.0 - -## fromIteratorSucceed - -Creates a stream from an iterator - -**Signature** - -```ts -export declare const fromIteratorSucceed: ( - iterator: IterableIterator, - maxChunkSize?: number -) => Stream -``` - -Added in v2.0.0 - -## fromPubSub - -Creates a stream from a subscription to a `PubSub`. - -**Signature** - -```ts -export declare const fromPubSub: { - ( - pubsub: PubSub.PubSub, - options: { - readonly scoped: true - readonly maxChunkSize?: number | undefined - readonly shutdown?: boolean | undefined - } - ): Effect.Effect> - ( - pubsub: PubSub.PubSub, - options?: { - readonly scoped?: false | undefined - readonly maxChunkSize?: number | undefined - readonly shutdown?: boolean | undefined - } - ): Stream -} -``` - -Added in v2.0.0 - -## fromPull - -Creates a stream from an effect that pulls elements from another stream. - -See `Stream.toPull` for reference. - -**Signature** - -```ts -export declare const fromPull: ( - effect: Effect.Effect, Chunk.Chunk>> -) => Stream, E, A> -``` - -Added in v2.0.0 - -## fromQueue - -Creates a stream from a queue of values - -**Signature** - -```ts -export declare const fromQueue: ( - queue: Queue.Dequeue, - options?: { readonly maxChunkSize?: number | undefined; readonly shutdown?: boolean | undefined } -) => Stream -``` - -Added in v2.0.0 - -## fromReadableStream - -Creates a stream from a `ReadableStream`. - -See https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream. - -**Signature** - -```ts -export declare const fromReadableStream: ( - evaluate: LazyArg>, - onError: (error: unknown) => E -) => Stream -``` - -Added in v2.0.0 - -## fromReadableStreamByob - -Creates a stream from a `ReadableStreamBYOBReader`. - -See https://developer.mozilla.org/en-US/docs/Web/API/ReadableStreamBYOBReader. - -**Signature** - -```ts -export declare const fromReadableStreamByob: ( - evaluate: LazyArg>, - onError: (error: unknown) => E, - allocSize?: number -) => Stream -``` - -Added in v2.0.0 - -## fromSchedule - -Creates a stream from a `Schedule` that does not require any further -input. The stream will emit an element for each value output from the -schedule, continuing for as long as the schedule continues. - -**Signature** - -```ts -export declare const fromSchedule: (schedule: Schedule.Schedule) => Stream -``` - -Added in v2.0.0 - -## iterate - -The infinite stream of iterative function application: a, f(a), f(f(a)), -f(f(f(a))), ... - -**Signature** - -```ts -export declare const iterate: (value: A, next: (value: A) => A) => Stream -``` - -Added in v2.0.0 - -## make - -Creates a stream from an sequence of values. - -**Signature** - -```ts -export declare const make: (...as: As) => Stream -``` - -Added in v2.0.0 - -## never - -The stream that never produces any value or fails with any error. - -**Signature** - -```ts -export declare const never: Stream -``` - -Added in v2.0.0 - -## paginate - -Like `Stream.unfold`, but allows the emission of values to end one step further -than the unfolding of the state. This is useful for embedding paginated -APIs, hence the name. - -**Signature** - -```ts -export declare const paginate: (s: S, f: (s: S) => readonly [A, Option.Option]) => Stream -``` - -Added in v2.0.0 - -## paginateChunk - -Like `Stream.unfoldChunk`, but allows the emission of values to end one step -further than the unfolding of the state. This is useful for embedding -paginated APIs, hence the name. - -**Signature** - -```ts -export declare const paginateChunk: ( - s: S, - f: (s: S) => readonly [Chunk.Chunk, Option.Option] -) => Stream -``` - -Added in v2.0.0 - -## paginateChunkEffect - -Like `Stream.unfoldChunkEffect`, but allows the emission of values to end one step -further than the unfolding of the state. This is useful for embedding -paginated APIs, hence the name. - -**Signature** - -```ts -export declare const paginateChunkEffect: ( - s: S, - f: (s: S) => Effect.Effect, Option.Option]> -) => Stream -``` - -Added in v2.0.0 - -## paginateEffect - -Like `Stream.unfoldEffect` but allows the emission of values to end one step -further than the unfolding of the state. This is useful for embedding -paginated APIs, hence the name. - -**Signature** - -```ts -export declare const paginateEffect: ( - s: S, - f: (s: S) => Effect.Effect]> -) => Stream -``` - -Added in v2.0.0 - -## range - -Constructs a stream from a range of integers, including both endpoints. - -**Signature** - -```ts -export declare const range: (min: number, max: number, chunkSize?: number) => Stream -``` - -Added in v2.0.0 - -## repeatEffect - -Creates a stream from an effect producing a value of type `A` which repeats -forever. - -**Signature** - -```ts -export declare const repeatEffect: (effect: Effect.Effect) => Stream -``` - -Added in v2.0.0 - -## repeatEffectChunk - -Creates a stream from an effect producing chunks of `A` values which -repeats forever. - -**Signature** - -```ts -export declare const repeatEffectChunk: (effect: Effect.Effect>) => Stream -``` - -Added in v2.0.0 - -## repeatEffectChunkOption - -Creates a stream from an effect producing chunks of `A` values until it -fails with `None`. - -**Signature** - -```ts -export declare const repeatEffectChunkOption: ( - effect: Effect.Effect, Chunk.Chunk> -) => Stream -``` - -Added in v2.0.0 - -## repeatEffectOption - -Creates a stream from an effect producing values of type `A` until it fails -with `None`. - -**Signature** - -```ts -export declare const repeatEffectOption: (effect: Effect.Effect, A>) => Stream -``` - -Added in v2.0.0 - -## repeatEffectWithSchedule - -Creates a stream from an effect producing a value of type `A`, which is -repeated using the specified schedule. - -**Signature** - -```ts -export declare const repeatEffectWithSchedule: ( - effect: Effect.Effect, - schedule: Schedule.Schedule -) => Stream -``` - -Added in v2.0.0 - -## repeatValue - -Repeats the provided value infinitely. - -**Signature** - -```ts -export declare const repeatValue: (value: A) => Stream -``` - -Added in v2.0.0 - -## scoped - -Creates a single-valued stream from a scoped resource. - -**Signature** - -```ts -export declare const scoped: (effect: Effect.Effect) => Stream, E, A> -``` - -Added in v2.0.0 - -## succeed - -Creates a single-valued pure stream. - -**Signature** - -```ts -export declare const succeed: (value: A) => Stream -``` - -Added in v2.0.0 - -## suspend - -Returns a lazily constructed stream. - -**Signature** - -```ts -export declare const suspend: (stream: LazyArg>) => Stream -``` - -Added in v2.0.0 - -## sync - -Creates a single-valued pure stream. - -**Signature** - -```ts -export declare const sync: (evaluate: LazyArg) => Stream -``` - -Added in v2.0.0 - -## tick - -A stream that emits Unit values spaced by the specified duration. - -**Signature** - -```ts -export declare const tick: (interval: Duration.DurationInput) => Stream -``` - -Added in v2.0.0 - -## toChannel - -Creates a channel from a `Stream`. - -**Signature** - -```ts -export declare const toChannel: ( - stream: Stream -) => Channel.Channel, unknown> -``` - -Added in v2.0.0 - -## unfold - -Creates a stream by peeling off the "layers" of a value of type `S`. - -**Signature** - -```ts -export declare const unfold: (s: S, f: (s: S) => Option.Option) => Stream -``` - -Added in v2.0.0 - -## unfoldChunk - -Creates a stream by peeling off the "layers" of a value of type `S`. - -**Signature** - -```ts -export declare const unfoldChunk: ( - s: S, - f: (s: S) => Option.Option, S]> -) => Stream -``` - -Added in v2.0.0 - -## unfoldChunkEffect - -Creates a stream by effectfully peeling off the "layers" of a value of type -`S`. - -**Signature** - -```ts -export declare const unfoldChunkEffect: ( - s: S, - f: (s: S) => Effect.Effect, S]>> -) => Stream -``` - -Added in v2.0.0 - -## unfoldEffect - -Creates a stream by effectfully peeling off the "layers" of a value of type -`S`. - -**Signature** - -```ts -export declare const unfoldEffect: ( - s: S, - f: (s: S) => Effect.Effect> -) => Stream -``` - -Added in v2.0.0 - -## unit - -A stream that contains a single `Unit` value. - -**Signature** - -```ts -export declare const unit: Stream -``` - -Added in v2.0.0 - -## unwrap - -Creates a stream produced from an `Effect`. - -**Signature** - -```ts -export declare const unwrap: ( - effect: Effect.Effect> -) => Stream -``` - -Added in v2.0.0 - -## unwrapScoped - -Creates a stream produced from a scoped `Effect`. - -**Signature** - -```ts -export declare const unwrapScoped: ( - effect: Effect.Effect> -) => Stream, E | E2, A> -``` - -Added in v2.0.0 - -## whenCase - -Returns the resulting stream when the given `PartialFunction` is defined -for the given value, otherwise returns an empty stream. - -**Signature** - -```ts -export declare const whenCase: ( - evaluate: LazyArg, - pf: (a: A) => Option.Option> -) => Stream -``` - -Added in v2.0.0 - -# context - -## context - -Accesses the whole context of the stream. - -**Signature** - -```ts -export declare const context: () => Stream> -``` - -Added in v2.0.0 - -## contextWith - -Accesses the context of the stream. - -**Signature** - -```ts -export declare const contextWith: (f: (env: Context.Context) => A) => Stream -``` - -Added in v2.0.0 - -## contextWithEffect - -Accesses the context of the stream in the context of an effect. - -**Signature** - -```ts -export declare const contextWithEffect: ( - f: (env: Context.Context) => Effect.Effect -) => Stream -``` - -Added in v2.0.0 - -## contextWithStream - -Accesses the context of the stream in the context of a stream. - -**Signature** - -```ts -export declare const contextWithStream: ( - f: (env: Context.Context) => Stream -) => Stream -``` - -Added in v2.0.0 - -## mapInputContext - -Transforms the context being provided to the stream with the specified -function. - -**Signature** - -```ts -export declare const mapInputContext: { - (f: (env: Context.Context) => Context.Context): (self: Stream) => Stream - (self: Stream, f: (env: Context.Context) => Context.Context): Stream -} -``` - -Added in v2.0.0 - -## provideContext - -Provides the stream with its required context, which eliminates its -dependency on `R`. - -**Signature** - -```ts -export declare const provideContext: { - (context: Context.Context): (self: Stream) => Stream - (self: Stream, context: Context.Context): Stream -} -``` - -Added in v2.0.0 - -## provideLayer - -Provides a `Layer` to the stream, which translates it to another level. - -**Signature** - -```ts -export declare const provideLayer: { - (layer: Layer.Layer): (self: Stream) => Stream - (self: Stream, layer: Layer.Layer): Stream -} -``` - -Added in v2.0.0 - -## provideService - -Provides the stream with the single service it requires. If the stream -requires more than one service use `Stream.provideContext` instead. - -**Signature** - -```ts -export declare const provideService: { - >( - tag: T, - resource: Context.Tag.Service - ): (self: Stream) => Stream>, E, A> - >( - self: Stream, - tag: T, - resource: Context.Tag.Service - ): Stream>, E, A> -} -``` - -Added in v2.0.0 - -## provideServiceEffect - -Provides the stream with the single service it requires. If the stream -requires more than one service use `Stream.provideContext` instead. - -**Signature** - -```ts -export declare const provideServiceEffect: { - , R2, E2>( - tag: T, - effect: Effect.Effect> - ): (self: Stream) => Stream>, E2 | E, A> - , R2, E2>( - self: Stream, - tag: T, - effect: Effect.Effect> - ): Stream>, E | E2, A> -} -``` - -Added in v2.0.0 - -## provideServiceStream - -Provides the stream with the single service it requires. If the stream -requires more than one service use `Stream.provideContext` instead. - -**Signature** - -```ts -export declare const provideServiceStream: { - , R2, E2>( - tag: T, - stream: Stream> - ): (self: Stream) => Stream>, E2 | E, A> - , R2, E2>( - self: Stream, - tag: T, - stream: Stream> - ): Stream>, E | E2, A> -} -``` - -Added in v2.0.0 - -## provideSomeLayer - -Splits the context into two parts, providing one part using the -specified layer and leaving the remainder `R0`. - -**Signature** - -```ts -export declare const provideSomeLayer: { - ( - layer: Layer.Layer - ): (self: Stream) => Stream, E2 | E, A> - ( - self: Stream, - layer: Layer.Layer - ): Stream, E | E2, A> -} -``` - -Added in v2.0.0 - -## updateService - -Updates the specified service within the context of the `Stream`. - -**Signature** - -```ts -export declare const updateService: (>( - tag: T, - f: (service: Context.Tag.Service) => Context.Tag.Service -) => (self: Stream) => Stream) & - (>( - self: Stream, - tag: T, - f: (service: Context.Tag.Service) => Context.Tag.Service - ) => Stream) -``` - -Added in v2.0.0 - -# destructors - -## run - -Runs the sink on the stream to produce either the sink's result or an error. - -**Signature** - -```ts -export declare const run: { - ( - sink: Sink.Sink - ): (self: Stream) => Effect.Effect - (self: Stream, sink: Sink.Sink): Effect.Effect -} -``` - -Added in v2.0.0 - -## runCollect - -Runs the stream and collects all of its elements to a chunk. - -**Signature** - -```ts -export declare const runCollect: (self: Stream) => Effect.Effect> -``` - -Added in v2.0.0 - -## runCount - -Runs the stream and emits the number of elements processed - -**Signature** - -```ts -export declare const runCount: (self: Stream) => Effect.Effect -``` - -Added in v2.0.0 - -## runDrain - -Runs the stream only for its effects. The emitted elements are discarded. - -**Signature** - -```ts -export declare const runDrain: (self: Stream) => Effect.Effect -``` - -Added in v2.0.0 - -## runFold - -Executes a pure fold over the stream of values - reduces all elements in -the stream to a value of type `S`. - -**Signature** - -```ts -export declare const runFold: { - (s: S, f: (s: S, a: A) => S): (self: Stream) => Effect.Effect - (self: Stream, s: S, f: (s: S, a: A) => S): Effect.Effect -} -``` - -Added in v2.0.0 - -## runFoldEffect - -Executes an effectful fold over the stream of values. - -**Signature** - -```ts -export declare const runFoldEffect: { - ( - s: S, - f: (s: S, a: A) => Effect.Effect - ): (self: Stream) => Effect.Effect - ( - self: Stream, - s: S, - f: (s: S, a: A) => Effect.Effect - ): Effect.Effect -} -``` - -Added in v2.0.0 - -## runFoldScoped - -Executes a pure fold over the stream of values. Returns a scoped value that -represents the scope of the stream. - -**Signature** - -```ts -export declare const runFoldScoped: { - (s: S, f: (s: S, a: A) => S): (self: Stream) => Effect.Effect - (self: Stream, s: S, f: (s: S, a: A) => S): Effect.Effect -} -``` - -Added in v2.0.0 - -## runFoldScopedEffect - -Executes an effectful fold over the stream of values. Returns a scoped -value that represents the scope of the stream. - -**Signature** - -```ts -export declare const runFoldScopedEffect: { - ( - s: S, - f: (s: S, a: A) => Effect.Effect - ): (self: Stream) => Effect.Effect - ( - self: Stream, - s: S, - f: (s: S, a: A) => Effect.Effect - ): Effect.Effect -} -``` - -Added in v2.0.0 - -## runFoldWhile - -Reduces the elements in the stream to a value of type `S`. Stops the fold -early when the condition is not fulfilled. Example: - -**Signature** - -```ts -export declare const runFoldWhile: { - (s: S, cont: Predicate, f: (s: S, a: A) => S): (self: Stream) => Effect.Effect - (self: Stream, s: S, cont: Predicate, f: (s: S, a: A) => S): Effect.Effect -} -``` - -Added in v2.0.0 - -## runFoldWhileEffect - -Executes an effectful fold over the stream of values. Stops the fold early -when the condition is not fulfilled. - -**Signature** - -```ts -export declare const runFoldWhileEffect: { - ( - s: S, - cont: Predicate, - f: (s: S, a: A) => Effect.Effect - ): (self: Stream) => Effect.Effect - ( - self: Stream, - s: S, - cont: Predicate, - f: (s: S, a: A) => Effect.Effect - ): Effect.Effect -} -``` - -Added in v2.0.0 - -## runFoldWhileScoped - -Executes a pure fold over the stream of values. Returns a scoped value that -represents the scope of the stream. Stops the fold early when the condition -is not fulfilled. - -**Signature** - -```ts -export declare const runFoldWhileScoped: { - ( - s: S, - cont: Predicate, - f: (s: S, a: A) => S - ): (self: Stream) => Effect.Effect - ( - self: Stream, - s: S, - cont: Predicate, - f: (s: S, a: A) => S - ): Effect.Effect -} -``` - -Added in v2.0.0 - -## runFoldWhileScopedEffect - -Executes an effectful fold over the stream of values. Returns a scoped -value that represents the scope of the stream. Stops the fold early when -the condition is not fulfilled. - -**Signature** - -```ts -export declare const runFoldWhileScopedEffect: { - ( - s: S, - cont: Predicate, - f: (s: S, a: A) => Effect.Effect - ): (self: Stream) => Effect.Effect - ( - self: Stream, - s: S, - cont: Predicate, - f: (s: S, a: A) => Effect.Effect - ): Effect.Effect -} -``` - -Added in v2.0.0 - -## runForEach - -Consumes all elements of the stream, passing them to the specified -callback. - -**Signature** - -```ts -export declare const runForEach: { - ( - f: (a: A) => Effect.Effect - ): (self: Stream) => Effect.Effect - ( - self: Stream, - f: (a: A) => Effect.Effect - ): Effect.Effect -} -``` - -Added in v2.0.0 - -## runForEachChunk - -Consumes all elements of the stream, passing them to the specified -callback. - -**Signature** - -```ts -export declare const runForEachChunk: { - ( - f: (a: Chunk.Chunk) => Effect.Effect - ): (self: Stream) => Effect.Effect - ( - self: Stream, - f: (a: Chunk.Chunk) => Effect.Effect - ): Effect.Effect -} -``` - -Added in v2.0.0 - -## runForEachChunkScoped - -Like `Stream.runForEachChunk`, but returns a scoped effect so the -finalization order can be controlled. - -**Signature** - -```ts -export declare const runForEachChunkScoped: { - ( - f: (a: Chunk.Chunk) => Effect.Effect - ): (self: Stream) => Effect.Effect - ( - self: Stream, - f: (a: Chunk.Chunk) => Effect.Effect - ): Effect.Effect -} -``` - -Added in v2.0.0 - -## runForEachScoped - -Like `Stream.forEach`, but returns a scoped effect so the finalization -order can be controlled. - -**Signature** - -```ts -export declare const runForEachScoped: { - ( - f: (a: A) => Effect.Effect - ): (self: Stream) => Effect.Effect - ( - self: Stream, - f: (a: A) => Effect.Effect - ): Effect.Effect -} -``` - -Added in v2.0.0 - -## runForEachWhile - -Consumes elements of the stream, passing them to the specified callback, -and terminating consumption when the callback returns `false`. - -**Signature** - -```ts -export declare const runForEachWhile: { - ( - f: (a: A) => Effect.Effect - ): (self: Stream) => Effect.Effect - ( - self: Stream, - f: (a: A) => Effect.Effect - ): Effect.Effect -} -``` - -Added in v2.0.0 - -## runForEachWhileScoped - -Like `Stream.runForEachWhile`, but returns a scoped effect so the -finalization order can be controlled. - -**Signature** - -```ts -export declare const runForEachWhileScoped: { - ( - f: (a: A) => Effect.Effect - ): (self: Stream) => Effect.Effect - ( - self: Stream, - f: (a: A) => Effect.Effect - ): Effect.Effect -} -``` - -Added in v2.0.0 - -## runHead - -Runs the stream to completion and yields the first value emitted by it, -discarding the rest of the elements. - -**Signature** - -```ts -export declare const runHead: (self: Stream) => Effect.Effect> -``` - -Added in v2.0.0 - -## runIntoPubSub - -Publishes elements of this stream to a `PubSub`. Stream failure and ending will -also be signalled. - -**Signature** - -```ts -export declare const runIntoPubSub: { - (pubsub: PubSub.PubSub>): (self: Stream) => Effect.Effect - (self: Stream, pubsub: PubSub.PubSub>): Effect.Effect -} -``` - -Added in v2.0.0 - -## runIntoPubSubScoped - -Like `Stream.runIntoPubSub`, but provides the result as a scoped effect to -allow for scope composition. - -**Signature** - -```ts -export declare const runIntoPubSubScoped: { - ( - pubsub: PubSub.PubSub> - ): (self: Stream) => Effect.Effect - (self: Stream, pubsub: PubSub.PubSub>): Effect.Effect -} -``` - -Added in v2.0.0 - -## runIntoQueue - -Enqueues elements of this stream into a queue. Stream failure and ending -will also be signalled. - -**Signature** - -```ts -export declare const runIntoQueue: { - (queue: Queue.Enqueue>): (self: Stream) => Effect.Effect - (self: Stream, queue: Queue.Enqueue>): Effect.Effect -} -``` - -Added in v2.0.0 - -## runIntoQueueElementsScoped - -Like `Stream.runIntoQueue`, but provides the result as a scoped [[ZIO]] -to allow for scope composition. - -**Signature** - -```ts -export declare const runIntoQueueElementsScoped: { - ( - queue: Queue.Enqueue, A>> - ): (self: Stream) => Effect.Effect - ( - self: Stream, - queue: Queue.Enqueue, A>> - ): Effect.Effect -} -``` - -Added in v2.0.0 - -## runIntoQueueScoped - -Like `Stream.runIntoQueue`, but provides the result as a scoped effect -to allow for scope composition. - -**Signature** - -```ts -export declare const runIntoQueueScoped: { - ( - queue: Queue.Enqueue> - ): (self: Stream) => Effect.Effect - (self: Stream, queue: Queue.Enqueue>): Effect.Effect -} -``` - -Added in v2.0.0 - -## runLast - -Runs the stream to completion and yields the last value emitted by it, -discarding the rest of the elements. - -**Signature** - -```ts -export declare const runLast: (self: Stream) => Effect.Effect> -``` - -Added in v2.0.0 - -## runScoped - -**Signature** - -```ts -export declare const runScoped: { - ( - sink: Sink.Sink - ): (self: Stream) => Effect.Effect - ( - self: Stream, - sink: Sink.Sink - ): Effect.Effect -} -``` - -Added in v2.0.0 - -## runSum - -Runs the stream to a sink which sums elements, provided they are Numeric. - -**Signature** - -```ts -export declare const runSum: (self: Stream) => Effect.Effect -``` - -Added in v2.0.0 - -## toPubSub - -Converts the stream to a scoped `PubSub` of chunks. After the scope is closed, -the `PubSub` will never again produce values and should be discarded. - -**Signature** - -```ts -export declare const toPubSub: { - ( - capacity: number - ): (self: Stream) => Effect.Effect>> - ( - self: Stream, - capacity: number - ): Effect.Effect>> -} -``` - -Added in v2.0.0 - -## toPull - -Returns in a scope a ZIO effect that can be used to repeatedly pull chunks -from the stream. The pull effect fails with None when the stream is -finished, or with Some error if it fails, otherwise it returns a chunk of -the stream's output. - -**Signature** - -```ts -export declare const toPull: ( - self: Stream -) => Effect.Effect, Chunk.Chunk>> -``` - -Added in v2.0.0 - -## toQueue - -Converts the stream to a scoped queue of chunks. After the scope is closed, -the queue will never again produce values and should be discarded. - -Defaults to the "suspend" back pressure strategy with a capacity of 2. - -**Signature** - -```ts -export declare const toQueue: { - ( - options?: - | { readonly strategy?: "dropping" | "sliding" | "suspend" | undefined; readonly capacity?: number | undefined } - | { readonly strategy: "unbounded" } - ): (self: Stream) => Effect.Effect>> - ( - self: Stream, - options?: - | { readonly strategy?: "dropping" | "sliding" | "suspend" | undefined; readonly capacity?: number | undefined } - | { readonly strategy: "unbounded" } - ): Effect.Effect>> -} -``` - -Added in v2.0.0 - -## toQueueOfElements - -Converts the stream to a scoped queue of elements. After the scope is -closed, the queue will never again produce values and should be discarded. - -Defaults to a capacity of 2. - -**Signature** - -```ts -export declare const toQueueOfElements: { - (options?: { - readonly capacity?: number | undefined - }): ( - self: Stream - ) => Effect.Effect, A>>> - ( - self: Stream, - options?: { readonly capacity?: number | undefined } - ): Effect.Effect, A>>> -} -``` - -Added in v2.0.0 - -## toReadableStream - -Converts the stream to a `ReadableStream`. - -See https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream. - -**Signature** - -```ts -export declare const toReadableStream: (source: Stream) => ReadableStream -``` - -Added in v2.0.0 - -# do notation - -## Do - -**Signature** - -```ts -export declare const Do: Stream -``` - -Added in v2.0.0 - -## bind - -Binds a value from a stream in a `do` scope - -**Signature** - -```ts -export declare const bind: { - ( - tag: Exclude, - f: (_: K) => Stream, - options?: { readonly concurrency?: number | "unbounded" | undefined; readonly bufferSize?: number | undefined } - ): (self: Stream) => Stream> - ( - self: Stream, - tag: Exclude, - f: (_: K) => Stream, - options?: { readonly concurrency?: number | "unbounded" | undefined; readonly bufferSize?: number | undefined } - ): Stream> -} -``` - -Added in v2.0.0 - -## bindEffect - -Binds an effectful value in a `do` scope - -**Signature** - -```ts -export declare const bindEffect: { - ( - tag: Exclude, - f: (_: K) => Effect.Effect, - options?: { readonly concurrency?: number | "unbounded" | undefined; readonly bufferSize?: number | undefined } - ): (self: Stream) => Stream> - ( - self: Stream, - tag: Exclude, - f: (_: K) => Effect.Effect, - options?: { readonly concurrency?: number | "unbounded" | undefined; readonly bufferSize?: number | undefined } - ): Stream> -} -``` - -Added in v2.0.0 - -## bindTo - -**Signature** - -```ts -export declare const bindTo: { - (tag: N): (self: Stream) => Stream> - (self: Stream, tag: N): Stream> -} -``` - -Added in v2.0.0 - -## let - -Bind a value in a `do` scope - -**Signature** - -```ts -export declare const let: { - ( - tag: Exclude, - f: (_: K) => A - ): (self: Stream) => Stream> - ( - self: Stream, - tag: Exclude, - f: (_: K) => A - ): Stream> -} -``` - -Added in v2.0.0 - -# elements - -## find - -Finds the first element emitted by this stream that satisfies the provided -predicate. - -**Signature** - -```ts -export declare const find: { - (refinement: Refinement): (self: Stream) => Stream - (predicate: Predicate): (self: Stream) => Stream - (self: Stream, refinement: Refinement): Stream - (self: Stream, predicate: Predicate): Stream -} -``` - -Added in v2.0.0 - -## findEffect - -Finds the first element emitted by this stream that satisfies the provided -effectful predicate. - -**Signature** - -```ts -export declare const findEffect: { - ( - predicate: (a: X) => Effect.Effect - ): (self: Stream) => Stream - ( - self: Stream, - predicate: (a: X) => Effect.Effect - ): Stream -} -``` - -Added in v2.0.0 - -# encoding - -## decodeText - -Decode Uint8Array chunks into a stream of strings using the specified encoding. - -**Signature** - -```ts -export declare const decodeText: { - (encoding?: string): (self: Stream) => Stream - (self: Stream, encoding?: string): Stream -} -``` - -Added in v2.0.0 - -## encodeText - -Encode a stream of strings into a stream of Uint8Array chunks using the specified encoding. - -**Signature** - -```ts -export declare const encodeText: (self: Stream) => Stream -``` - -Added in v2.0.0 - -# error handling - -## catchAll - -Switches over to the stream produced by the provided function in case this -one fails with a typed error. - -**Signature** - -```ts -export declare const catchAll: { - (f: (error: E) => Stream): (self: Stream) => Stream - (self: Stream, f: (error: E) => Stream): Stream -} -``` - -Added in v2.0.0 - -## catchAllCause - -Switches over to the stream produced by the provided function in case this -one fails. Allows recovery from all causes of failure, including -interruption if the stream is uninterruptible. - -**Signature** - -```ts -export declare const catchAllCause: { - ( - f: (cause: Cause.Cause) => Stream - ): (self: Stream) => Stream - ( - self: Stream, - f: (cause: Cause.Cause) => Stream - ): Stream -} -``` - -Added in v2.0.0 - -## catchSome - -Switches over to the stream produced by the provided function in case this -one fails with some typed error. - -**Signature** - -```ts -export declare const catchSome: { - ( - pf: (error: E) => Option.Option> - ): (self: Stream) => Stream - ( - self: Stream, - pf: (error: E) => Option.Option> - ): Stream -} -``` - -Added in v2.0.0 - -## catchSomeCause - -Switches over to the stream produced by the provided function in case this -one fails with some errors. Allows recovery from all causes of failure, -including interruption if the stream is uninterruptible. - -**Signature** - -```ts -export declare const catchSomeCause: { - ( - pf: (cause: Cause.Cause) => Option.Option> - ): (self: Stream) => Stream - ( - self: Stream, - pf: (cause: Cause.Cause) => Option.Option> - ): Stream -} -``` - -Added in v2.0.0 - -## catchTag - -Switches over to the stream produced by the provided function in case this -one fails with an error matching the given `_tag`. - -**Signature** - -```ts -export declare const catchTag: { - ( - k: K, - f: (e: Extract) => Stream - ): (self: Stream) => Stream, A1 | A> - ( - self: Stream, - k: K, - f: (e: Extract) => Stream - ): Stream, A | A1> -} -``` - -Added in v2.0.0 - -## catchTags - -Switches over to the stream produced by one of the provided functions, in -case this one fails with an error matching one of the given `_tag`'s. - -**Signature** - -```ts -export declare const catchTags: { - < - E extends { _tag: string }, - Cases extends { [K in E["_tag"]]+?: ((error: Extract) => Stream) | undefined } - >( - cases: Cases - ): ( - self: Stream - ) => Stream< - | R - | { - [K in keyof Cases]: Cases[K] extends (...args: Array) => Stream.Variance - ? R - : never - }[keyof Cases], - | Exclude - | { - [K in keyof Cases]: Cases[K] extends (...args: Array) => Stream.Variance - ? E - : never - }[keyof Cases], - | A - | { - [K in keyof Cases]: Cases[K] extends (...args: Array) => Stream.Variance - ? A - : never - }[keyof Cases] - > - < - R, - E extends { _tag: string }, - A, - Cases extends { [K in E["_tag"]]+?: ((error: Extract) => Stream) | undefined } - >( - self: Stream, - cases: Cases - ): Stream< - | R - | { - [K in keyof Cases]: Cases[K] extends (...args: Array) => Stream.Variance - ? R - : never - }[keyof Cases], - | Exclude - | { - [K in keyof Cases]: Cases[K] extends (...args: Array) => Stream.Variance - ? E - : never - }[keyof Cases], - | A - | { - [K in keyof Cases]: Cases[K] extends (...args: Array) => Stream.Variance - ? A - : never - }[keyof Cases] - > -} -``` - -Added in v2.0.0 - -## orDie - -Translates any failure into a stream termination, making the stream -infallible and all failures unchecked. - -**Signature** - -```ts -export declare const orDie: (self: Stream) => Stream -``` - -Added in v2.0.0 - -## orDieWith - -Keeps none of the errors, and terminates the stream with them, using the -specified function to convert the `E` into a defect. - -**Signature** - -```ts -export declare const orDieWith: { - (f: (e: E) => unknown): (self: Stream) => Stream - (self: Stream, f: (e: E) => unknown): Stream -} -``` - -Added in v2.0.0 - -## orElse - -Switches to the provided stream in case this one fails with a typed error. - -See also `Stream.catchAll`. - -**Signature** - -```ts -export declare const orElse: { - (that: LazyArg>): (self: Stream) => Stream - (self: Stream, that: LazyArg>): Stream -} -``` - -Added in v2.0.0 - -## orElseEither - -Switches to the provided stream in case this one fails with a typed error. - -See also `Stream.catchAll`. - -**Signature** - -```ts -export declare const orElseEither: { - ( - that: LazyArg> - ): (self: Stream) => Stream> - ( - self: Stream, - that: LazyArg> - ): Stream> -} -``` - -Added in v2.0.0 - -## orElseFail - -Fails with given error in case this one fails with a typed error. - -See also `Stream.catchAll`. - -**Signature** - -```ts -export declare const orElseFail: { - (error: LazyArg): (self: Stream) => Stream - (self: Stream, error: LazyArg): Stream -} -``` - -Added in v2.0.0 - -## orElseIfEmpty - -Produces the specified element if this stream is empty. - -**Signature** - -```ts -export declare const orElseIfEmpty: { - (element: LazyArg): (self: Stream) => Stream - (self: Stream, element: LazyArg): Stream -} -``` - -Added in v2.0.0 - -## orElseIfEmptyChunk - -Produces the specified chunk if this stream is empty. - -**Signature** - -```ts -export declare const orElseIfEmptyChunk: { - (chunk: LazyArg>): (self: Stream) => Stream - (self: Stream, chunk: LazyArg>): Stream -} -``` - -Added in v2.0.0 - -## orElseIfEmptyStream - -Switches to the provided stream in case this one is empty. - -**Signature** - -```ts -export declare const orElseIfEmptyStream: { - (stream: LazyArg>): (self: Stream) => Stream - (self: Stream, stream: LazyArg>): Stream -} -``` - -Added in v2.0.0 - -## orElseSucceed - -Succeeds with the specified value if this one fails with a typed error. - -**Signature** - -```ts -export declare const orElseSucceed: { - (value: LazyArg): (self: Stream) => Stream - (self: Stream, value: LazyArg): Stream -} -``` - -Added in v2.0.0 - -## refineOrDie - -Keeps some of the errors, and terminates the fiber with the rest - -**Signature** - -```ts -export declare const refineOrDie: { - (pf: (error: E) => Option.Option): (self: Stream) => Stream - (self: Stream, pf: (error: E) => Option.Option): Stream -} -``` - -Added in v2.0.0 - -## refineOrDieWith - -Keeps some of the errors, and terminates the fiber with the rest, using the -specified function to convert the `E` into a defect. - -**Signature** - -```ts -export declare const refineOrDieWith: { - ( - pf: (error: E) => Option.Option, - f: (error: E) => unknown - ): (self: Stream) => Stream - (self: Stream, pf: (error: E) => Option.Option, f: (error: E) => unknown): Stream -} -``` - -Added in v2.0.0 - -# filtering - -## filter - -Filters the elements emitted by this stream using the provided function. - -**Signature** - -```ts -export declare const filter: { - (refinement: Refinement): (self: Stream) => Stream - (predicate: Predicate): (self: Stream) => Stream - (self: Stream, refinement: Refinement): Stream - (self: Stream, predicate: Predicate): Stream -} -``` - -Added in v2.0.0 - -## filterEffect - -Effectfully filters the elements emitted by this stream. - -**Signature** - -```ts -export declare const filterEffect: { - ( - f: (a: X) => Effect.Effect - ): (self: Stream) => Stream - ( - self: Stream, - f: (a: X) => Effect.Effect - ): Stream -} -``` - -Added in v2.0.0 - -# grouping - -## groupAdjacentBy - -Creates a pipeline that groups on adjacent keys, calculated by the -specified function. - -**Signature** - -```ts -export declare const groupAdjacentBy: { - (f: (a: A) => K): (self: Stream) => Stream]> - (self: Stream, f: (a: A) => K): Stream]> -} -``` - -Added in v2.0.0 - -## groupBy - -More powerful version of `Stream.groupByKey`. - -**Signature** - -```ts -export declare const groupBy: { - ( - f: (a: A) => Effect.Effect, - options?: { readonly bufferSize?: number | undefined } - ): (self: Stream) => GroupBy.GroupBy - ( - self: Stream, - f: (a: A) => Effect.Effect, - options?: { readonly bufferSize?: number | undefined } - ): GroupBy.GroupBy -} -``` - -Added in v2.0.0 - -# mapping - -## as - -Maps the success values of this stream to the specified constant value. - -**Signature** - -```ts -export declare const as: { - (value: B): (self: Stream) => Stream - (self: Stream, value: B): Stream -} -``` - -Added in v2.0.0 - -## map - -Transforms the elements of this stream using the supplied function. - -**Signature** - -```ts -export declare const map: { - (f: (a: A) => B): (self: Stream) => Stream - (self: Stream, f: (a: A) => B): Stream -} -``` - -Added in v2.0.0 - -## mapAccum - -Statefully maps over the elements of this stream to produce new elements. - -**Signature** - -```ts -export declare const mapAccum: { - (s: S, f: (s: S, a: A) => readonly [S, A2]): (self: Stream) => Stream - (self: Stream, s: S, f: (s: S, a: A) => readonly [S, A2]): Stream -} -``` - -Added in v2.0.0 - -## mapAccumEffect - -Statefully and effectfully maps over the elements of this stream to produce -new elements. - -**Signature** - -```ts -export declare const mapAccumEffect: { - ( - s: S, - f: (s: S, a: A) => Effect.Effect - ): (self: Stream) => Stream - ( - self: Stream, - s: S, - f: (s: S, a: A) => Effect.Effect - ): Stream -} -``` - -Added in v2.0.0 - -## mapChunks - -Transforms the chunks emitted by this stream. - -**Signature** - -```ts -export declare const mapChunks: { - (f: (chunk: Chunk.Chunk) => Chunk.Chunk): (self: Stream) => Stream - (self: Stream, f: (chunk: Chunk.Chunk) => Chunk.Chunk): Stream -} -``` - -Added in v2.0.0 - -## mapChunksEffect - -Effectfully transforms the chunks emitted by this stream. - -**Signature** - -```ts -export declare const mapChunksEffect: { - ( - f: (chunk: Chunk.Chunk) => Effect.Effect> - ): (self: Stream) => Stream - ( - self: Stream, - f: (chunk: Chunk.Chunk) => Effect.Effect> - ): Stream -} -``` - -Added in v2.0.0 - -## mapConcat - -Maps each element to an iterable, and flattens the iterables into the -output of this stream. - -**Signature** - -```ts -export declare const mapConcat: { - (f: (a: A) => Iterable): (self: Stream) => Stream - (self: Stream, f: (a: A) => Iterable): Stream -} -``` - -Added in v2.0.0 - -## mapConcatChunk - -Maps each element to a chunk, and flattens the chunks into the output of -this stream. - -**Signature** - -```ts -export declare const mapConcatChunk: { - (f: (a: A) => Chunk.Chunk): (self: Stream) => Stream - (self: Stream, f: (a: A) => Chunk.Chunk): Stream -} -``` - -Added in v2.0.0 - -## mapConcatChunkEffect - -Effectfully maps each element to a chunk, and flattens the chunks into the -output of this stream. - -**Signature** - -```ts -export declare const mapConcatChunkEffect: { - ( - f: (a: A) => Effect.Effect> - ): (self: Stream) => Stream - ( - self: Stream, - f: (a: A) => Effect.Effect> - ): Stream -} -``` - -Added in v2.0.0 - -## mapConcatEffect - -Effectfully maps each element to an iterable, and flattens the iterables -into the output of this stream. - -**Signature** - -```ts -export declare const mapConcatEffect: { - ( - f: (a: A) => Effect.Effect> - ): (self: Stream) => Stream - ( - self: Stream, - f: (a: A) => Effect.Effect> - ): Stream -} -``` - -Added in v2.0.0 - -## mapEffect - -Maps over elements of the stream with the specified effectful function. - -**Signature** - -```ts -export declare const mapEffect: { - ( - f: (a: A) => Effect.Effect, - options?: { readonly concurrency?: number | "unbounded" | undefined; readonly unordered?: boolean | undefined } - ): (self: Stream) => Stream - ( - f: (a: A) => Effect.Effect, - options: { readonly key: (a: A) => K; readonly bufferSize?: number | undefined } - ): (self: Stream) => Stream - ( - self: Stream, - f: (a: A) => Effect.Effect, - options?: { readonly concurrency?: number | "unbounded" | undefined; readonly unordered?: boolean | undefined } - ): Stream - ( - self: Stream, - f: (a: A) => Effect.Effect, - options: { readonly key: (a: A) => K; readonly bufferSize?: number | undefined } - ): Stream -} -``` - -Added in v2.0.0 - -## mapError - -Transforms the errors emitted by this stream using `f`. - -**Signature** - -```ts -export declare const mapError: { - (f: (error: E) => E2): (self: Stream) => Stream - (self: Stream, f: (error: E) => E2): Stream -} -``` - -Added in v2.0.0 - -## mapErrorCause - -Transforms the full causes of failures emitted by this stream. - -**Signature** - -```ts -export declare const mapErrorCause: { - (f: (cause: Cause.Cause) => Cause.Cause): (self: Stream) => Stream - (self: Stream, f: (cause: Cause.Cause) => Cause.Cause): Stream -} -``` - -Added in v2.0.0 - -# models - -## Stream (interface) - -A `Stream` is a description of a program that, when evaluated, may -emit zero or more values of type `A`, may fail with errors of type `E`, and -uses an context of type `R`. One way to think of `Stream` is as a -`Effect` program that could emit multiple values. - -`Stream` is a purely functional _pull_ based stream. Pull based streams offer -inherent laziness and backpressure, relieving users of the need to manage -buffers between operators. As an optimization, `Stream` does not emit -single values, but rather an array of values. This allows the cost of effect -evaluation to be amortized. - -`Stream` forms a monad on its `A` type parameter, and has error management -facilities for its `E` type parameter, modeled similarly to `Effect` (with -some adjustments for the multiple-valued nature of `Stream`). These aspects -allow for rich and expressive composition of streams. - -**Signature** - -```ts -export interface Stream extends Stream.Variance, Pipeable { - [Unify.typeSymbol]?: unknown - [Unify.unifySymbol]?: StreamUnify - [Unify.ignoreSymbol]?: StreamUnifyIgnore -} -``` - -Added in v2.0.0 - -## StreamUnify (interface) - -**Signature** - -```ts -export interface StreamUnify extends Effect.EffectUnify { - Stream?: () => A[Unify.typeSymbol] extends Stream | infer _ ? Stream : never -} -``` - -Added in v2.0.0 - -## StreamUnifyIgnore (interface) - -**Signature** - -```ts -export interface StreamUnifyIgnore extends Effect.EffectUnifyIgnore { - Effect?: true -} -``` - -Added in v2.0.0 - -# sequencing - -## branchAfter - -Returns a `Stream` that first collects `n` elements from the input `Stream`, -and then creates a new `Stream` using the specified function, and sends all -the following elements through that. - -**Signature** - -```ts -export declare const branchAfter: { - ( - n: number, - f: (input: Chunk.Chunk) => Stream - ): (self: Stream) => Stream - ( - self: Stream, - n: number, - f: (input: Chunk.Chunk) => Stream - ): Stream -} -``` - -Added in v2.0.0 - -## flatMap - -Returns a stream made of the concatenation in strict order of all the -streams produced by passing each element of this stream to `f0` - -**Signature** - -```ts -export declare const flatMap: { - ( - f: (a: A) => Stream, - options?: { - readonly concurrency?: number | "unbounded" | undefined - readonly bufferSize?: number | undefined - readonly switch?: boolean | undefined - } - ): (self: Stream) => Stream - ( - self: Stream, - f: (a: A) => Stream, - options?: { - readonly concurrency?: number | "unbounded" | undefined - readonly bufferSize?: number | undefined - readonly switch?: boolean | undefined - } - ): Stream -} -``` - -Added in v2.0.0 - -## flatten - -Flattens this stream-of-streams into a stream made of the concatenation in -strict order of all the streams. - -**Signature** - -```ts -export declare const flatten: { - (options?: { - readonly concurrency?: number | "unbounded" | undefined - readonly bufferSize?: number | undefined - }): (self: Stream>) => Stream - ( - self: Stream>, - options?: { readonly concurrency?: number | "unbounded" | undefined; readonly bufferSize?: number | undefined } - ): Stream -} -``` - -Added in v2.0.0 - -## flattenChunks - -Submerges the chunks carried by this stream into the stream's structure, -while still preserving them. - -**Signature** - -```ts -export declare const flattenChunks: (self: Stream>) => Stream -``` - -Added in v2.0.0 - -## flattenEffect - -Flattens `Effect` values into the stream's structure, preserving all -information about the effect. - -**Signature** - -```ts -export declare const flattenEffect: { - (options?: { - readonly concurrency?: number | "unbounded" | undefined - readonly unordered?: boolean | undefined - }): (self: Stream>) => Stream - ( - self: Stream>, - options?: { readonly concurrency?: number | "unbounded" | undefined; readonly unordered?: boolean | undefined } - ): Stream -} -``` - -Added in v2.0.0 - -## flattenExitOption - -Unwraps `Exit` values that also signify end-of-stream by failing with `None`. - -For `Exit` values that do not signal end-of-stream, prefer: - -```ts -stream.mapZIO(ZIO.done(_)) -``` - -**Signature** - -```ts -export declare const flattenExitOption: ( - self: Stream, A>> -) => Stream -``` - -Added in v2.0.0 - -## flattenIterables - -Submerges the iterables carried by this stream into the stream's structure, -while still preserving them. - -**Signature** - -```ts -export declare const flattenIterables: (self: Stream>) => Stream -``` - -Added in v2.0.0 - -## flattenTake - -Unwraps `Exit` values and flatten chunks that also signify end-of-stream -by failing with `None`. - -**Signature** - -```ts -export declare const flattenTake: (self: Stream>) => Stream -``` - -Added in v2.0.0 - -## tap - -Adds an effect to consumption of every element of the stream. - -**Signature** - -```ts -export declare const tap: { - ( - f: (a: X) => Effect.Effect - ): (self: Stream) => Stream - ( - self: Stream, - f: (a: X) => Effect.Effect - ): Stream -} -``` - -Added in v2.0.0 - -## tapBoth - -Returns a stream that effectfully "peeks" at the failure or success of -the stream. - -**Signature** - -```ts -export declare const tapBoth: { - (options: { - readonly onFailure: (e: XE) => Effect.Effect - readonly onSuccess: (a: XA) => Effect.Effect - }): (self: Stream) => Stream - ( - self: Stream, - options: { - readonly onFailure: (e: XE) => Effect.Effect - readonly onSuccess: (a: XA) => Effect.Effect - } - ): Stream -} -``` - -Added in v2.0.0 - -## tapError - -Returns a stream that effectfully "peeks" at the failure of the stream. - -**Signature** - -```ts -export declare const tapError: { - ( - f: (error: X) => Effect.Effect - ): (self: Stream) => Stream - ( - self: Stream, - f: (error: X) => Effect.Effect - ): Stream -} -``` - -Added in v2.0.0 - -## tapSink - -Sends all elements emitted by this stream to the specified sink in addition -to emitting them. - -**Signature** - -```ts -export declare const tapSink: { - (sink: Sink.Sink): (self: Stream) => Stream - (self: Stream, sink: Sink.Sink): Stream -} -``` - -Added in v2.0.0 - -# symbols - -## StreamTypeId - -**Signature** - -```ts -export declare const StreamTypeId: typeof StreamTypeId -``` - -Added in v2.0.0 - -## StreamTypeId (type alias) - -**Signature** - -```ts -export type StreamTypeId = typeof StreamTypeId -``` - -Added in v2.0.0 - -# tracing - -## withSpan - -Wraps the stream with a new span for tracing. - -**Signature** - -```ts -export declare const withSpan: { - ( - name: string, - options?: { - readonly attributes?: Record | undefined - readonly links?: ReadonlyArray | undefined - readonly parent?: Tracer.ParentSpan | undefined - readonly root?: boolean | undefined - readonly context?: Context.Context | undefined - } - ): (self: Stream) => Stream - ( - self: Stream, - name: string, - options?: { - readonly attributes?: Record | undefined - readonly links?: ReadonlyArray | undefined - readonly parent?: Tracer.ParentSpan | undefined - readonly root?: boolean | undefined - readonly context?: Context.Context | undefined - } - ): Stream -} -``` - -Added in v2.0.0 - -# type lambdas - -## StreamTypeLambda (interface) - -**Signature** - -```ts -export interface StreamTypeLambda extends TypeLambda { - readonly type: Stream -} -``` - -Added in v2.0.0 - -# utils - -## Stream (namespace) - -Added in v2.0.0 - -### Variance (interface) - -**Signature** - -```ts -export interface Variance { - readonly [StreamTypeId]: { - _R: (_: never) => R - _E: (_: never) => E - _A: (_: never) => A - } -} -``` - -Added in v2.0.0 - -### DynamicTuple (type alias) - -**Signature** - -```ts -export type DynamicTuple = N extends N - ? number extends N - ? Array - : DynamicTupleOf - : never -``` - -Added in v2.0.0 - -### DynamicTupleOf (type alias) - -**Signature** - -```ts -export type DynamicTupleOf> = R["length"] extends N - ? R - : DynamicTupleOf -``` - -Added in v2.0.0 - -## accumulate - -Collects each underlying Chunk of the stream into a new chunk, and emits it -on each pull. - -**Signature** - -```ts -export declare const accumulate: (self: Stream) => Stream> -``` - -Added in v2.0.0 - -## accumulateChunks - -Re-chunks the elements of the stream by accumulating each underlying chunk. - -**Signature** - -```ts -export declare const accumulateChunks: (self: Stream) => Stream -``` - -Added in v2.0.0 - -## aggregate - -Aggregates elements of this stream using the provided sink for as long as -the downstream operators on the stream are busy. - -This operator divides the stream into two asynchronous "islands". Operators -upstream of this operator run on one fiber, while downstream operators run -on another. Whenever the downstream fiber is busy processing elements, the -upstream fiber will feed elements into the sink until it signals -completion. - -Any sink can be used here, but see `Sink.foldWeightedEffect` and -`Sink.foldUntilEffect` for sinks that cover the common usecases. - -**Signature** - -```ts -export declare const aggregate: { - (sink: Sink.Sink): (self: Stream) => Stream - (self: Stream, sink: Sink.Sink): Stream -} -``` - -Added in v2.0.0 - -## aggregateWithin - -Like `aggregateWithinEither`, but only returns the `Right` results. - -**Signature** - -```ts -export declare const aggregateWithin: { - ( - sink: Sink.Sink, - schedule: Schedule.Schedule, C> - ): (self: Stream) => Stream - ( - self: Stream, - sink: Sink.Sink, - schedule: Schedule.Schedule, C> - ): Stream -} -``` - -Added in v2.0.0 - -## aggregateWithinEither - -Aggregates elements using the provided sink until it completes, or until -the delay signalled by the schedule has passed. - -This operator divides the stream into two asynchronous islands. Operators -upstream of this operator run on one fiber, while downstream operators run -on another. Elements will be aggregated by the sink until the downstream -fiber pulls the aggregated value, or until the schedule's delay has passed. - -Aggregated elements will be fed into the schedule to determine the delays -between pulls. - -**Signature** - -```ts -export declare const aggregateWithinEither: { - ( - sink: Sink.Sink, - schedule: Schedule.Schedule, C> - ): (self: Stream) => Stream> - ( - self: Stream, - sink: Sink.Sink, - schedule: Schedule.Schedule, C> - ): Stream> -} -``` - -Added in v2.0.0 - -## broadcast - -Fan out the stream, producing a list of streams that have the same elements -as this stream. The driver stream will only ever advance the `maximumLag` -chunks before the slowest downstream stream. - -**Signature** - -```ts -export declare const broadcast: { - ( - n: N, - maximumLag: number - ): ( - self: Stream - ) => Effect.Effect, N>> - ( - self: Stream, - n: N, - maximumLag: number - ): Effect.Effect, N>> -} -``` - -Added in v2.0.0 - -## broadcastDynamic - -Fan out the stream, producing a dynamic number of streams that have the -same elements as this stream. The driver stream will only ever advance the -`maximumLag` chunks before the slowest downstream stream. - -**Signature** - -```ts -export declare const broadcastDynamic: { - (maximumLag: number): (self: Stream) => Effect.Effect> - (self: Stream, maximumLag: number): Effect.Effect> -} -``` - -Added in v2.0.0 - -## broadcastedQueues - -Converts the stream to a scoped list of queues. Every value will be -replicated to every queue with the slowest queue being allowed to buffer -`maximumLag` chunks before the driver is back pressured. - -Queues can unsubscribe from upstream by shutting down. - -**Signature** - -```ts -export declare const broadcastedQueues: { - ( - n: N, - maximumLag: number - ): ( - self: Stream - ) => Effect.Effect>, N>> - ( - self: Stream, - n: N, - maximumLag: number - ): Effect.Effect>, N>> -} -``` - -Added in v2.0.0 - -## broadcastedQueuesDynamic - -Converts the stream to a scoped dynamic amount of queues. Every chunk will -be replicated to every queue with the slowest queue being allowed to buffer -`maximumLag` chunks before the driver is back pressured. - -Queues can unsubscribe from upstream by shutting down. - -**Signature** - -```ts -export declare const broadcastedQueuesDynamic: { - ( - maximumLag: number - ): ( - self: Stream - ) => Effect.Effect>>> - ( - self: Stream, - maximumLag: number - ): Effect.Effect>>> -} -``` - -Added in v2.0.0 - -## buffer - -Allows a faster producer to progress independently of a slower consumer by -buffering up to `capacity` elements in a queue. - -**Signature** - -```ts -export declare const buffer: { - ( - options: - | { readonly capacity: "unbounded" } - | { readonly capacity: number; readonly strategy?: "dropping" | "sliding" | "suspend" | undefined } - ): (self: Stream) => Stream - ( - self: Stream, - options: - | { readonly capacity: "unbounded" } - | { readonly capacity: number; readonly strategy?: "dropping" | "sliding" | "suspend" | undefined } - ): Stream -} -``` - -Added in v2.0.0 - -## bufferChunks - -Allows a faster producer to progress independently of a slower consumer by -buffering up to `capacity` chunks in a queue. - -**Signature** - -```ts -export declare const bufferChunks: { - (options: { - readonly capacity: number - readonly strategy?: "dropping" | "sliding" | "suspend" | undefined - }): (self: Stream) => Stream - ( - self: Stream, - options: { readonly capacity: number; readonly strategy?: "dropping" | "sliding" | "suspend" | undefined } - ): Stream -} -``` - -Added in v2.0.0 - -## changes - -Returns a new stream that only emits elements that are not equal to the -previous element emitted, using natural equality to determine whether two -elements are equal. - -**Signature** - -```ts -export declare const changes: (self: Stream) => Stream -``` - -Added in v2.0.0 - -## changesWith - -Returns a new stream that only emits elements that are not equal to the -previous element emitted, using the specified function to determine whether -two elements are equal. - -**Signature** - -```ts -export declare const changesWith: { - (f: (x: A, y: A) => boolean): (self: Stream) => Stream - (self: Stream, f: (x: A, y: A) => boolean): Stream -} -``` - -Added in v2.0.0 - -## changesWithEffect - -Returns a new stream that only emits elements that are not equal to the -previous element emitted, using the specified effectual function to -determine whether two elements are equal. - -**Signature** - -```ts -export declare const changesWithEffect: { - ( - f: (x: A, y: A) => Effect.Effect - ): (self: Stream) => Stream - (self: Stream, f: (x: A, y: A) => Effect.Effect): Stream -} -``` - -Added in v2.0.0 - -## chunks - -Exposes the underlying chunks of the stream as a stream of chunks of -elements. - -**Signature** - -```ts -export declare const chunks: (self: Stream) => Stream> -``` - -Added in v2.0.0 - -## chunksWith - -Performs the specified stream transformation with the chunk structure of -the stream exposed. - -**Signature** - -```ts -export declare const chunksWith: ( - f: (stream: Stream>) => Stream> -) => (self: Stream) => Stream -``` - -Added in v2.0.0 - -## combine - -Combines the elements from this stream and the specified stream by -repeatedly applying the function `f` to extract an element using both sides -and conceptually "offer" it to the destination stream. `f` can maintain -some internal state to control the combining process, with the initial -state being specified by `s`. - -Where possible, prefer `Stream.combineChunks` for a more efficient -implementation. - -**Signature** - -```ts -export declare const combine: { - ( - that: Stream, - s: S, - f: ( - s: S, - pullLeft: Effect.Effect, A>, - pullRight: Effect.Effect, A2> - ) => Effect.Effect, readonly [A3, S]>> - ): (self: Stream) => Stream - ( - self: Stream, - that: Stream, - s: S, - f: ( - s: S, - pullLeft: Effect.Effect, A>, - pullRight: Effect.Effect, A2> - ) => Effect.Effect, readonly [A3, S]>> - ): Stream -} -``` - -Added in v2.0.0 - -## combineChunks - -Combines the chunks from this stream and the specified stream by repeatedly -applying the function `f` to extract a chunk using both sides and -conceptually "offer" it to the destination stream. `f` can maintain some -internal state to control the combining process, with the initial state -being specified by `s`. - -**Signature** - -```ts -export declare const combineChunks: { - ( - that: Stream, - s: S, - f: ( - s: S, - pullLeft: Effect.Effect, Chunk.Chunk>, - pullRight: Effect.Effect, Chunk.Chunk> - ) => Effect.Effect, readonly [Chunk.Chunk, S]>> - ): (self: Stream) => Stream - ( - self: Stream, - that: Stream, - s: S, - f: ( - s: S, - pullLeft: Effect.Effect, Chunk.Chunk>, - pullRight: Effect.Effect, Chunk.Chunk> - ) => Effect.Effect, readonly [Chunk.Chunk, S]>> - ): Stream -} -``` - -Added in v2.0.0 - -## concat - -Concatenates the specified stream with this stream, resulting in a stream -that emits the elements from this stream and then the elements from the -specified stream. - -**Signature** - -```ts -export declare const concat: { - (that: Stream): (self: Stream) => Stream - (self: Stream, that: Stream): Stream -} -``` - -Added in v2.0.0 - -## cross - -Composes this stream with the specified stream to create a cartesian -product of elements. The `that` stream would be run multiple times, for -every element in the `this` stream. - -See also `Stream.zip` for the more common point-wise variant. - -**Signature** - -```ts -export declare const cross: { - (that: Stream): (self: Stream) => Stream - (self: Stream, that: Stream): Stream -} -``` - -Added in v2.0.0 - -## crossLeft - -Composes this stream with the specified stream to create a cartesian -product of elements, but keeps only elements from this stream. The `that` -stream would be run multiple times, for every element in the `this` stream. - -See also `Stream.zipLeft` for the more common point-wise variant. - -**Signature** - -```ts -export declare const crossLeft: { - (that: Stream): (self: Stream) => Stream - (self: Stream, that: Stream): Stream -} -``` - -Added in v2.0.0 - -## crossRight - -Composes this stream with the specified stream to create a cartesian -product of elements, but keeps only elements from the other stream. The -`that` stream would be run multiple times, for every element in the `this` -stream. - -See also `Stream.zipRight` for the more common point-wise variant. - -**Signature** - -```ts -export declare const crossRight: { - (that: Stream): (self: Stream) => Stream - (self: Stream, that: Stream): Stream -} -``` - -Added in v2.0.0 - -## crossWith - -Composes this stream with the specified stream to create a cartesian -product of elements with a specified function. The `that` stream would be -run multiple times, for every element in the `this` stream. - -See also `Stream.zipWith` for the more common point-wise variant. - -**Signature** - -```ts -export declare const crossWith: { - ( - that: Stream, - f: (a: A, b: B) => C - ): (self: Stream) => Stream - ( - self: Stream, - that: Stream, - f: (a: A, b: B) => C - ): Stream -} -``` - -Added in v2.0.0 - -## debounce - -Delays the emission of values by holding new values for a set duration. If -no new values arrive during that time the value is emitted, however if a -new value is received during the holding period the previous value is -discarded and the process is repeated with the new value. - -This operator is useful if you have a stream of "bursty" events which -eventually settle down and you only need the final event of the burst. For -example, a search engine may only want to initiate a search after a user -has paused typing so as to not prematurely recommend results. - -**Signature** - -```ts -export declare const debounce: { - (duration: Duration.DurationInput): (self: Stream) => Stream - (self: Stream, duration: Duration.DurationInput): Stream -} -``` - -Added in v2.0.0 - -## distributedWith - -More powerful version of `Stream.broadcast`. Allows to provide a function -that determines what queues should receive which elements. The decide -function will receive the indices of the queues in the resulting list. - -**Signature** - -```ts -export declare const distributedWith: { - (options: { - readonly size: N - readonly maximumLag: number - readonly decide: (a: A) => Effect.Effect> - }): ( - self: Stream - ) => Effect.Effect, A>>, N>> - ( - self: Stream, - options: { - readonly size: N - readonly maximumLag: number - readonly decide: (a: A) => Effect.Effect> - } - ): Effect.Effect, A>>, N>> -} -``` - -Added in v2.0.0 - -## distributedWithDynamic - -More powerful version of `Stream.distributedWith`. This returns a function -that will produce new queues and corresponding indices. You can also -provide a function that will be executed after the final events are -enqueued in all queues. Shutdown of the queues is handled by the driver. -Downstream users can also shutdown queues manually. In this case the driver -will continue but no longer backpressure on them. - -**Signature** - -```ts -export declare const distributedWithDynamic: { - (options: { - readonly maximumLag: number - readonly decide: (a: A) => Effect.Effect> - }): ( - self: Stream - ) => Effect.Effect< - Scope.Scope | R, - never, - Effect.Effect, A>>]> - > - ( - self: Stream, - options: { readonly maximumLag: number; readonly decide: (a: A) => Effect.Effect> } - ): Effect.Effect< - Scope.Scope | R, - never, - Effect.Effect, A>>]> - > -} -``` - -Added in v2.0.0 - -## drain - -Converts this stream to a stream that executes its effects but emits no -elements. Useful for sequencing effects using streams: - -**Signature** - -```ts -export declare const drain: (self: Stream) => Stream -``` - -Added in v2.0.0 - -## drainFork - -Drains the provided stream in the background for as long as this stream is -running. If this stream ends before `other`, `other` will be interrupted. -If `other` fails, this stream will fail with that error. - -**Signature** - -```ts -export declare const drainFork: { - (that: Stream): (self: Stream) => Stream - (self: Stream, that: Stream): Stream -} -``` - -Added in v2.0.0 - -## drop - -Drops the specified number of elements from this stream. - -**Signature** - -```ts -export declare const drop: { - (n: number): (self: Stream) => Stream - (self: Stream, n: number): Stream -} -``` - -Added in v2.0.0 - -## dropRight - -Drops the last specified number of elements from this stream. - -**Signature** - -```ts -export declare const dropRight: { - (n: number): (self: Stream) => Stream - (self: Stream, n: number): Stream -} -``` - -Added in v2.0.0 - -## dropUntil - -Drops all elements of the stream until the specified predicate evaluates to -`true`. - -**Signature** - -```ts -export declare const dropUntil: { - (predicate: Predicate): (self: Stream) => Stream - (self: Stream, predicate: Predicate): Stream -} -``` - -Added in v2.0.0 - -## dropUntilEffect - -Drops all elements of the stream until the specified effectful predicate -evaluates to `true`. - -**Signature** - -```ts -export declare const dropUntilEffect: { - ( - predicate: (a: X) => Effect.Effect - ): (self: Stream) => Stream - ( - self: Stream, - predicate: (a: X) => Effect.Effect - ): Stream -} -``` - -Added in v2.0.0 - -## dropWhile - -Drops all elements of the stream for as long as the specified predicate -evaluates to `true`. - -**Signature** - -```ts -export declare const dropWhile: { - (predicate: Predicate): (self: Stream) => Stream - (self: Stream, predicate: Predicate): Stream -} -``` - -Added in v2.0.0 - -## dropWhileEffect - -Drops all elements of the stream for as long as the specified predicate -produces an effect that evalutates to `true` - -**Signature** - -```ts -export declare const dropWhileEffect: { - ( - predicate: (a: X) => Effect.Effect - ): (self: Stream) => Stream - ( - self: Stream, - predicate: (a: X) => Effect.Effect - ): Stream -} -``` - -Added in v2.0.0 - -## either - -Returns a stream whose failures and successes have been lifted into an -`Either`. The resulting stream cannot fail, because the failures have been -exposed as part of the `Either` success case. - -**Signature** - -```ts -export declare const either: (self: Stream) => Stream> -``` - -Added in v2.0.0 - -## ensuring - -Executes the provided finalizer after this stream's finalizers run. - -**Signature** - -```ts -export declare const ensuring: { - (finalizer: Effect.Effect): (self: Stream) => Stream - (self: Stream, finalizer: Effect.Effect): Stream -} -``` - -Added in v2.0.0 - -## ensuringWith - -Executes the provided finalizer after this stream's finalizers run. - -**Signature** - -```ts -export declare const ensuringWith: { - ( - finalizer: (exit: Exit.Exit) => Effect.Effect - ): (self: Stream) => Stream - ( - self: Stream, - finalizer: (exit: Exit.Exit) => Effect.Effect - ): Stream -} -``` - -Added in v2.0.0 - -## filterMap - -Performs a filter and map in a single step. - -**Signature** - -```ts -export declare const filterMap: { - (pf: (a: A) => Option.Option): (self: Stream) => Stream - (self: Stream, pf: (a: A) => Option.Option): Stream -} -``` - -Added in v2.0.0 - -## filterMapEffect - -Performs an effectful filter and map in a single step. - -**Signature** - -```ts -export declare const filterMapEffect: { - ( - pf: (a: A) => Option.Option> - ): (self: Stream) => Stream - ( - self: Stream, - pf: (a: A) => Option.Option> - ): Stream -} -``` - -Added in v2.0.0 - -## filterMapWhile - -Transforms all elements of the stream for as long as the specified partial -function is defined. - -**Signature** - -```ts -export declare const filterMapWhile: { - (pf: (a: A) => Option.Option): (self: Stream) => Stream - (self: Stream, pf: (a: A) => Option.Option): Stream -} -``` - -Added in v2.0.0 - -## filterMapWhileEffect - -Effectfully transforms all elements of the stream for as long as the -specified partial function is defined. - -**Signature** - -```ts -export declare const filterMapWhileEffect: { - ( - pf: (a: A) => Option.Option> - ): (self: Stream) => Stream - ( - self: Stream, - pf: (a: A) => Option.Option> - ): Stream -} -``` - -Added in v2.0.0 - -## forever - -Repeats this stream forever. - -**Signature** - -```ts -export declare const forever: (self: Stream) => Stream -``` - -Added in v2.0.0 - -## groupByKey - -Partition a stream using a function and process each stream individually. -This returns a data structure that can be used to further filter down which -groups shall be processed. - -After calling apply on the GroupBy object, the remaining groups will be -processed in parallel and the resulting streams merged in a -nondeterministic fashion. - -Up to `buffer` elements may be buffered in any group stream before the -producer is backpressured. Take care to consume from all streams in order -to prevent deadlocks. - -For example, to collect the first 2 words for every starting letter from a -stream of words: - -```ts -import * as GroupBy from "./GroupBy" -import * as Stream from "./Stream" -import { pipe } from "./Function" - -pipe( - Stream.fromIterable(["hello", "world", "hi", "holla"]), - Stream.groupByKey((word) => word[0]), - GroupBy.evaluate((key, stream) => - pipe( - stream, - Stream.take(2), - Stream.map((words) => [key, words] as const) - ) - ) -) -``` - -**Signature** - -```ts -export declare const groupByKey: { - ( - f: (a: A) => K, - options?: { readonly bufferSize?: number | undefined } - ): (self: Stream) => GroupBy.GroupBy - ( - self: Stream, - f: (a: A) => K, - options?: { readonly bufferSize?: number | undefined } - ): GroupBy.GroupBy -} -``` - -Added in v2.0.0 - -## grouped - -Partitions the stream with specified `chunkSize`. - -**Signature** - -```ts -export declare const grouped: { - (chunkSize: number): (self: Stream) => Stream> - (self: Stream, chunkSize: number): Stream> -} -``` - -Added in v2.0.0 - -## groupedWithin - -Partitions the stream with the specified `chunkSize` or until the specified -`duration` has passed, whichever is satisfied first. - -**Signature** - -```ts -export declare const groupedWithin: { - ( - chunkSize: number, - duration: Duration.DurationInput - ): (self: Stream) => Stream> - (self: Stream, chunkSize: number, duration: Duration.DurationInput): Stream> -} -``` - -Added in v2.0.0 - -## haltAfter - -Specialized version of haltWhen which halts the evaluation of this stream -after the given duration. - -An element in the process of being pulled will not be interrupted when the -given duration completes. See `interruptAfter` for this behavior. - -**Signature** - -```ts -export declare const haltAfter: { - (duration: Duration.DurationInput): (self: Stream) => Stream - (self: Stream, duration: Duration.DurationInput): Stream -} -``` - -Added in v2.0.0 - -## haltWhen - -Halts the evaluation of this stream when the provided effect completes. The -given effect will be forked as part of the returned stream, and its success -will be discarded. - -An element in the process of being pulled will not be interrupted when the -effect completes. See `interruptWhen` for this behavior. - -If the effect completes with a failure, the stream will emit that failure. - -**Signature** - -```ts -export declare const haltWhen: { - (effect: Effect.Effect): (self: Stream) => Stream - (self: Stream, effect: Effect.Effect): Stream -} -``` - -Added in v2.0.0 - -## haltWhenDeferred - -Halts the evaluation of this stream when the provided promise resolves. - -If the promise completes with a failure, the stream will emit that failure. - -**Signature** - -```ts -export declare const haltWhenDeferred: { - (deferred: Deferred.Deferred): (self: Stream) => Stream - (self: Stream, deferred: Deferred.Deferred): Stream -} -``` - -Added in v2.0.0 - -## identity - -The identity pipeline, which does not modify streams in any way. - -**Signature** - -```ts -export declare const identity: () => Stream -``` - -Added in v2.0.0 - -## interleave - -Interleaves this stream and the specified stream deterministically by -alternating pulling values from this stream and the specified stream. When -one stream is exhausted all remaining values in the other stream will be -pulled. - -**Signature** - -```ts -export declare const interleave: { - (that: Stream): (self: Stream) => Stream - (self: Stream, that: Stream): Stream -} -``` - -Added in v2.0.0 - -## interleaveWith - -Combines this stream and the specified stream deterministically using the -stream of boolean values `pull` to control which stream to pull from next. -A value of `true` indicates to pull from this stream and a value of `false` -indicates to pull from the specified stream. Only consumes as many elements -as requested by the `pull` stream. If either this stream or the specified -stream are exhausted further requests for values from that stream will be -ignored. - -**Signature** - -```ts -export declare const interleaveWith: { - ( - that: Stream, - decider: Stream - ): (self: Stream) => Stream - ( - self: Stream, - that: Stream, - decider: Stream - ): Stream -} -``` - -Added in v2.0.0 - -## interruptAfter - -Specialized version of `Stream.interruptWhen` which interrupts the -evaluation of this stream after the given `Duration`. - -**Signature** - -```ts -export declare const interruptAfter: { - (duration: Duration.DurationInput): (self: Stream) => Stream - (self: Stream, duration: Duration.DurationInput): Stream -} -``` - -Added in v2.0.0 - -## interruptWhen - -Interrupts the evaluation of this stream when the provided effect -completes. The given effect will be forked as part of this stream, and its -success will be discarded. This combinator will also interrupt any -in-progress element being pulled from upstream. - -If the effect completes with a failure before the stream completes, the -returned stream will emit that failure. - -**Signature** - -```ts -export declare const interruptWhen: { - (effect: Effect.Effect): (self: Stream) => Stream - (self: Stream, effect: Effect.Effect): Stream -} -``` - -Added in v2.0.0 - -## interruptWhenDeferred - -Interrupts the evaluation of this stream when the provided promise -resolves. This combinator will also interrupt any in-progress element being -pulled from upstream. - -If the promise completes with a failure, the stream will emit that failure. - -**Signature** - -```ts -export declare const interruptWhenDeferred: { - (deferred: Deferred.Deferred): (self: Stream) => Stream - (self: Stream, deferred: Deferred.Deferred): Stream -} -``` - -Added in v2.0.0 - -## intersperse - -Intersperse stream with provided `element`. - -**Signature** - -```ts -export declare const intersperse: { - (element: A2): (self: Stream) => Stream - (self: Stream, element: A2): Stream -} -``` - -Added in v2.0.0 - -## intersperseAffixes - -Intersperse the specified element, also adding a prefix and a suffix. - -**Signature** - -```ts -export declare const intersperseAffixes: { - (options: { - readonly start: A2 - readonly middle: A3 - readonly end: A4 - }): (self: Stream) => Stream - ( - self: Stream, - options: { readonly start: A2; readonly middle: A3; readonly end: A4 } - ): Stream -} -``` - -Added in v2.0.0 - -## mapBoth - -Returns a stream whose failure and success channels have been mapped by the -specified `onFailure` and `onSuccess` functions. - -**Signature** - -```ts -export declare const mapBoth: { - (options: { - readonly onFailure: (e: E) => E2 - readonly onSuccess: (a: A) => A2 - }): (self: Stream) => Stream - ( - self: Stream, - options: { readonly onFailure: (e: E) => E2; readonly onSuccess: (a: A) => A2 } - ): Stream -} -``` - -Added in v2.0.0 - -## merge - -Merges this stream and the specified stream together. - -New produced stream will terminate when both specified stream terminate if -no termination strategy is specified. - -**Signature** - -```ts -export declare const merge: { - ( - that: Stream, - options?: { readonly haltStrategy?: HaltStrategy.HaltStrategyInput | undefined } - ): (self: Stream) => Stream - ( - self: Stream, - that: Stream, - options?: { readonly haltStrategy?: HaltStrategy.HaltStrategyInput | undefined } - ): Stream -} -``` - -Added in v2.0.0 - -## mergeAll - -Merges a variable list of streams in a non-deterministic fashion. Up to `n` -streams may be consumed in parallel and up to `outputBuffer` chunks may be -buffered by this operator. - -**Signature** - -```ts -export declare const mergeAll: { - (options: { - readonly concurrency: number | "unbounded" - readonly bufferSize?: number | undefined - }): (streams: Iterable>) => Stream - ( - streams: Iterable>, - options: { readonly concurrency: number | "unbounded"; readonly bufferSize?: number | undefined } - ): Stream -} -``` - -Added in v2.0.0 - -## mergeEither - -Merges this stream and the specified stream together to produce a stream of -eithers. - -**Signature** - -```ts -export declare const mergeEither: { - ( - that: Stream - ): (self: Stream) => Stream> - (self: Stream, that: Stream): Stream> -} -``` - -Added in v2.0.0 - -## mergeLeft - -Merges this stream and the specified stream together, discarding the values -from the right stream. - -**Signature** - -```ts -export declare const mergeLeft: { - (that: Stream): (self: Stream) => Stream - (self: Stream, that: Stream): Stream -} -``` - -Added in v2.0.0 - -## mergeRight - -Merges this stream and the specified stream together, discarding the values -from the left stream. - -**Signature** - -```ts -export declare const mergeRight: { - (that: Stream): (self: Stream) => Stream - (self: Stream, that: Stream): Stream -} -``` - -Added in v2.0.0 - -## mergeWith - -Merges this stream and the specified stream together to a common element -type with the specified mapping functions. - -New produced stream will terminate when both specified stream terminate if -no termination strategy is specified. - -**Signature** - -```ts -export declare const mergeWith: { - ( - other: Stream, - options: { - readonly onSelf: (a: A) => A3 - readonly onOther: (a2: A2) => A4 - readonly haltStrategy?: HaltStrategy.HaltStrategyInput | undefined - } - ): (self: Stream) => Stream - ( - self: Stream, - other: Stream, - options: { - readonly onSelf: (a: A) => A3 - readonly onOther: (a2: A2) => A4 - readonly haltStrategy?: HaltStrategy.HaltStrategyInput | undefined - } - ): Stream -} -``` - -Added in v2.0.0 - -## mkString - -Returns a combined string resulting from concatenating each of the values -from the stream. - -**Signature** - -```ts -export declare const mkString: (self: Stream) => Effect.Effect -``` - -Added in v2.0.0 - -## onDone - -Runs the specified effect if this stream ends. - -**Signature** - -```ts -export declare const onDone: { - (cleanup: () => Effect.Effect): (self: Stream) => Stream - (self: Stream, cleanup: () => Effect.Effect): Stream -} -``` - -Added in v2.0.0 - -## onError - -Runs the specified effect if this stream fails, providing the error to the -effect if it exists. - -Note: Unlike `Effect.onError` there is no guarantee that the provided -effect will not be interrupted. - -**Signature** - -```ts -export declare const onError: { - ( - cleanup: (cause: Cause.Cause) => Effect.Effect - ): (self: Stream) => Stream - ( - self: Stream, - cleanup: (cause: Cause.Cause) => Effect.Effect - ): Stream -} -``` - -Added in v2.0.0 - -## partition - -Partition a stream using a predicate. The first stream will contain all -element evaluated to true and the second one will contain all element -evaluated to false. The faster stream may advance by up to buffer elements -further than the slower one. - -**Signature** - -```ts -export declare const partition: { - ( - predicate: Predicate, - options?: { bufferSize?: number | undefined } - ): (self: Stream) => Effect.Effect, Stream]> - ( - self: Stream, - predicate: Predicate, - options?: { bufferSize?: number | undefined } - ): Effect.Effect, Stream]> -} -``` - -Added in v2.0.0 - -## partitionEither - -Split a stream by an effectful predicate. The faster stream may advance by -up to buffer elements further than the slower one. - -**Signature** - -```ts -export declare const partitionEither: { - ( - predicate: (a: A) => Effect.Effect>, - options?: { readonly bufferSize?: number | undefined } - ): ( - self: Stream - ) => Effect.Effect, Stream]> - ( - self: Stream, - predicate: (a: A) => Effect.Effect>, - options?: { readonly bufferSize?: number | undefined } - ): Effect.Effect, Stream]> -} -``` - -Added in v2.0.0 - -## peel - -Peels off enough material from the stream to construct a `Z` using the -provided `Sink` and then returns both the `Z` and the rest of the -`Stream` in a scope. Like all scoped values, the provided stream is -valid only within the scope. - -**Signature** - -```ts -export declare const peel: { - ( - sink: Sink.Sink - ): (self: Stream) => Effect.Effect]> - ( - self: Stream, - sink: Sink.Sink - ): Effect.Effect]> -} -``` - -Added in v2.0.0 - -## pipeThrough - -Pipes all of the values from this stream through the provided sink. - -See also `Stream.transduce`. - -**Signature** - -```ts -export declare const pipeThrough: { - (sink: Sink.Sink): (self: Stream) => Stream - (self: Stream, sink: Sink.Sink): Stream -} -``` - -Added in v2.0.0 - -## pipeThroughChannel - -Pipes all the values from this stream through the provided channel. - -**Signature** - -```ts -export declare const pipeThroughChannel: { - ( - channel: Channel.Channel, unknown, E2, Chunk.Chunk, unknown> - ): (self: Stream) => Stream - ( - self: Stream, - channel: Channel.Channel, unknown, E2, Chunk.Chunk, unknown> - ): Stream -} -``` - -Added in v2.0.0 - -## pipeThroughChannelOrFail - -Pipes all values from this stream through the provided channel, passing -through any error emitted by this stream unchanged. - -**Signature** - -```ts -export declare const pipeThroughChannelOrFail: { - ( - chan: Channel.Channel, unknown, E2, Chunk.Chunk, unknown> - ): (self: Stream) => Stream - ( - self: Stream, - chan: Channel.Channel, unknown, E2, Chunk.Chunk, unknown> - ): Stream -} -``` - -Added in v2.0.0 - -## prepend - -Emits the provided chunk before emitting any other value. - -**Signature** - -```ts -export declare const prepend: { - (values: Chunk.Chunk): (self: Stream) => Stream - (self: Stream, values: Chunk.Chunk): Stream -} -``` - -Added in v2.0.0 - -## rechunk - -Re-chunks the elements of the stream into chunks of `n` elements each. The -last chunk might contain less than `n` elements. - -**Signature** - -```ts -export declare const rechunk: { - (n: number): (self: Stream) => Stream - (self: Stream, n: number): Stream -} -``` - -Added in v2.0.0 - -## repeat - -Repeats the entire stream using the specified schedule. The stream will -execute normally, and then repeat again according to the provided schedule. - -**Signature** - -```ts -export declare const repeat: { - (schedule: Schedule.Schedule): (self: Stream) => Stream - (self: Stream, schedule: Schedule.Schedule): Stream -} -``` - -Added in v2.0.0 - -## repeatEither - -Repeats the entire stream using the specified schedule. The stream will -execute normally, and then repeat again according to the provided schedule. -The schedule output will be emitted at the end of each repetition. - -**Signature** - -```ts -export declare const repeatEither: { - ( - schedule: Schedule.Schedule - ): (self: Stream) => Stream> - ( - self: Stream, - schedule: Schedule.Schedule - ): Stream> -} -``` - -Added in v2.0.0 - -## repeatElements - -Repeats each element of the stream using the provided schedule. Repetitions -are done in addition to the first execution, which means using -`Schedule.recurs(1)` actually results in the original effect, plus an -additional recurrence, for a total of two repetitions of each value in the -stream. - -**Signature** - -```ts -export declare const repeatElements: { - (schedule: Schedule.Schedule): (self: Stream) => Stream - (self: Stream, schedule: Schedule.Schedule): Stream -} -``` - -Added in v2.0.0 - -## repeatElementsWith - -Repeats each element of the stream using the provided schedule. When the -schedule is finished, then the output of the schedule will be emitted into -the stream. Repetitions are done in addition to the first execution, which -means using `Schedule.recurs(1)` actually results in the original effect, -plus an additional recurrence, for a total of two repetitions of each value -in the stream. - -This function accepts two conversion functions, which allow the output of -this stream and the output of the provided schedule to be unified into a -single type. For example, `Either` or similar data type. - -**Signature** - -```ts -export declare const repeatElementsWith: { - ( - schedule: Schedule.Schedule, - options: { readonly onElement: (a: A) => C; readonly onSchedule: (b: B) => C } - ): (self: Stream) => Stream - ( - self: Stream, - schedule: Schedule.Schedule, - options: { readonly onElement: (a: A) => C; readonly onSchedule: (b: B) => C } - ): Stream -} -``` - -Added in v2.0.0 - -## repeatWith - -Repeats the entire stream using the specified schedule. The stream will -execute normally, and then repeat again according to the provided schedule. -The schedule output will be emitted at the end of each repetition and can -be unified with the stream elements using the provided functions. - -**Signature** - -```ts -export declare const repeatWith: { - ( - schedule: Schedule.Schedule, - options: { readonly onElement: (a: A) => C; readonly onSchedule: (b: B) => C } - ): (self: Stream) => Stream - ( - self: Stream, - schedule: Schedule.Schedule, - options: { readonly onElement: (a: A) => C; readonly onSchedule: (b: B) => C } - ): Stream -} -``` - -Added in v2.0.0 - -## retry - -When the stream fails, retry it according to the given schedule - -This retries the entire stream, so will re-execute all of the stream's -acquire operations. - -The schedule is reset as soon as the first element passes through the -stream again. - -**Signature** - -```ts -export declare const retry: { - ( - schedule: Schedule.Schedule - ): (self: Stream) => Stream - (self: Stream, schedule: Schedule.Schedule): Stream -} -``` - -Added in v2.0.0 - -## scan - -Statefully maps over the elements of this stream to produce all -intermediate results of type `S` given an initial S. - -**Signature** - -```ts -export declare const scan: { - (s: S, f: (s: S, a: A) => S): (self: Stream) => Stream - (self: Stream, s: S, f: (s: S, a: A) => S): Stream -} -``` - -Added in v2.0.0 - -## scanEffect - -Statefully and effectfully maps over the elements of this stream to produce -all intermediate results of type `S` given an initial S. - -**Signature** - -```ts -export declare const scanEffect: { - ( - s: S, - f: (s: S, a: A) => Effect.Effect - ): (self: Stream) => Stream - ( - self: Stream, - s: S, - f: (s: S, a: A) => Effect.Effect - ): Stream -} -``` - -Added in v2.0.0 - -## scanReduce - -Statefully maps over the elements of this stream to produce all -intermediate results. - -See also `Stream.scan`. - -**Signature** - -```ts -export declare const scanReduce: { - (f: (a2: A2 | A, a: A) => A2): (self: Stream) => Stream - (self: Stream, f: (a2: A2 | A, a: A) => A2): Stream -} -``` - -Added in v2.0.0 - -## scanReduceEffect - -Statefully and effectfully maps over the elements of this stream to produce -all intermediate results. - -See also `Stream.scanEffect`. - -**Signature** - -```ts -export declare const scanReduceEffect: ( - f: (a2: A2 | A, a: A) => Effect.Effect -) => (self: Stream) => Stream -``` - -Added in v2.0.0 - -## schedule - -Schedules the output of the stream using the provided `schedule`. - -**Signature** - -```ts -export declare const schedule: { - ( - schedule: Schedule.Schedule - ): (self: Stream) => Stream - (self: Stream, schedule: Schedule.Schedule): Stream -} -``` - -Added in v2.0.0 - -## scheduleWith - -Schedules the output of the stream using the provided `schedule` and emits -its output at the end (if `schedule` is finite). Uses the provided function -to align the stream and schedule outputs on the same type. - -**Signature** - -```ts -export declare const scheduleWith: { - ( - schedule: Schedule.Schedule, - options: { readonly onElement: (a: A) => C; readonly onSchedule: (b: B) => C } - ): (self: Stream) => Stream - ( - self: Stream, - schedule: Schedule.Schedule, - options: { readonly onElement: (a: A) => C; readonly onSchedule: (b: B) => C } - ): Stream -} -``` - -Added in v2.0.0 - -## sliding - -Emits a sliding window of `n` elements. - -```ts -import * as Stream from "./Stream" -import { pipe } from "./Function" - -pipe(Stream.make(1, 2, 3, 4), Stream.sliding(2), Stream.runCollect) -// => Chunk(Chunk(1, 2), Chunk(2, 3), Chunk(3, 4)) -``` - -**Signature** - -```ts -export declare const sliding: { - (chunkSize: number): (self: Stream) => Stream> - (self: Stream, chunkSize: number): Stream> -} -``` - -Added in v2.0.0 - -## slidingSize - -Like `sliding`, but with a configurable `stepSize` parameter. - -**Signature** - -```ts -export declare const slidingSize: { - (chunkSize: number, stepSize: number): (self: Stream) => Stream> - (self: Stream, chunkSize: number, stepSize: number): Stream> -} -``` - -Added in v2.0.0 - -## some - -Converts an option on values into an option on errors. - -**Signature** - -```ts -export declare const some: (self: Stream>) => Stream, A> -``` - -Added in v2.0.0 - -## someOrElse - -Extracts the optional value, or returns the given 'default'. - -**Signature** - -```ts -export declare const someOrElse: { - (fallback: LazyArg): (self: Stream>) => Stream - (self: Stream>, fallback: LazyArg): Stream -} -``` - -Added in v2.0.0 - -## someOrFail - -Extracts the optional value, or fails with the given error 'e'. - -**Signature** - -```ts -export declare const someOrFail: { - (error: LazyArg): (self: Stream>) => Stream - (self: Stream>, error: LazyArg): Stream -} -``` - -Added in v2.0.0 - -## split - -Splits elements based on a predicate. - -```ts -import * as Stream from "./Stream" -import { pipe } from "./Function" - -pipe( - Stream.range(1, 10), - Stream.split((n) => n % 4 === 0), - Stream.runCollect -) -// => Chunk(Chunk(1, 2, 3), Chunk(5, 6, 7), Chunk(9)) -``` - -**Signature** - -```ts -export declare const split: { - (predicate: Predicate): (self: Stream) => Stream> - (self: Stream, predicate: Predicate): Stream> -} -``` - -Added in v2.0.0 - -## splitOnChunk - -Splits elements on a delimiter and transforms the splits into desired output. - -**Signature** - -```ts -export declare const splitOnChunk: { - (delimiter: Chunk.Chunk): (self: Stream) => Stream> - (self: Stream, delimiter: Chunk.Chunk): Stream> -} -``` - -Added in v2.0.0 - -## take - -Takes the specified number of elements from this stream. - -**Signature** - -```ts -export declare const take: { - (n: number): (self: Stream) => Stream - (self: Stream, n: number): Stream -} -``` - -Added in v2.0.0 - -## takeRight - -Takes the last specified number of elements from this stream. - -**Signature** - -```ts -export declare const takeRight: { - (n: number): (self: Stream) => Stream - (self: Stream, n: number): Stream -} -``` - -Added in v2.0.0 - -## takeUntil - -Takes all elements of the stream until the specified predicate evaluates to -`true`. - -**Signature** - -```ts -export declare const takeUntil: { - (predicate: Predicate): (self: Stream) => Stream - (self: Stream, predicate: Predicate): Stream -} -``` - -Added in v2.0.0 - -## takeUntilEffect - -Takes all elements of the stream until the specified effectual predicate -evaluates to `true`. - -**Signature** - -```ts -export declare const takeUntilEffect: { - ( - predicate: (a: A) => Effect.Effect - ): (self: Stream) => Stream - ( - self: Stream, - predicate: (a: A) => Effect.Effect - ): Stream -} -``` - -Added in v2.0.0 - -## takeWhile - -Takes all elements of the stream for as long as the specified predicate -evaluates to `true`. - -**Signature** - -```ts -export declare const takeWhile: { - (predicate: Predicate): (self: Stream) => Stream - (self: Stream, predicate: Predicate): Stream -} -``` - -Added in v2.0.0 - -## tapErrorCause - -Returns a stream that effectfully "peeks" at the cause of failure of the -stream. - -**Signature** - -```ts -export declare const tapErrorCause: { - ( - f: (cause: Cause.Cause) => Effect.Effect - ): (self: Stream) => Stream - ( - self: Stream, - f: (cause: Cause.Cause) => Effect.Effect - ): Stream -} -``` - -Added in v2.0.0 - -## throttle - -Delays the chunks of this stream according to the given bandwidth -parameters using the token bucket algorithm. Allows for burst in the -processing of elements by allowing the token bucket to accumulate tokens up -to a `units + burst` threshold. The weight of each chunk is determined by -the `costFn` function. - -If using the "enforce" strategy, chunks that do not meet the bandwidth -constraints are dropped. If using the "shape" strategy, chunks are delayed -until they can be emitted without exceeding the bandwidth constraints. - -Defaults to the "shape" strategy. - -**Signature** - -```ts -export declare const throttle: { - (options: { - readonly cost: (chunk: Chunk.Chunk) => number - readonly units: number - readonly duration: Duration.DurationInput - readonly burst?: number | undefined - readonly strategy?: "enforce" | "shape" | undefined - }): (self: Stream) => Stream - ( - self: Stream, - options: { - readonly cost: (chunk: Chunk.Chunk) => number - readonly units: number - readonly duration: Duration.DurationInput - readonly burst?: number | undefined - readonly strategy?: "enforce" | "shape" | undefined - } - ): Stream -} -``` - -Added in v2.0.0 - -## throttleEffect - -Delays the chunks of this stream according to the given bandwidth -parameters using the token bucket algorithm. Allows for burst in the -processing of elements by allowing the token bucket to accumulate tokens up -to a `units + burst` threshold. The weight of each chunk is determined by -the effectful `costFn` function. - -If using the "enforce" strategy, chunks that do not meet the bandwidth -constraints are dropped. If using the "shape" strategy, chunks are delayed -until they can be emitted without exceeding the bandwidth constraints. - -Defaults to the "shape" strategy. - -**Signature** - -```ts -export declare const throttleEffect: { - (options: { - readonly cost: (chunk: Chunk.Chunk) => Effect.Effect - readonly units: number - readonly duration: Duration.DurationInput - readonly burst?: number | undefined - readonly strategy?: "enforce" | "shape" | undefined - }): (self: Stream) => Stream - ( - self: Stream, - options: { - readonly cost: (chunk: Chunk.Chunk) => Effect.Effect - readonly units: number - readonly duration: Duration.DurationInput - readonly burst?: number | undefined - readonly strategy?: "enforce" | "shape" | undefined - } - ): Stream -} -``` - -Added in v2.0.0 - -## timeout - -Ends the stream if it does not produce a value after the specified duration. - -**Signature** - -```ts -export declare const timeout: { - (duration: Duration.DurationInput): (self: Stream) => Stream - (self: Stream, duration: Duration.DurationInput): Stream -} -``` - -Added in v2.0.0 - -## timeoutFail - -Fails the stream with given error if it does not produce a value after d -duration. - -**Signature** - -```ts -export declare const timeoutFail: { - (error: LazyArg, duration: Duration.DurationInput): (self: Stream) => Stream - (self: Stream, error: LazyArg, duration: Duration.DurationInput): Stream -} -``` - -Added in v2.0.0 - -## timeoutFailCause - -Fails the stream with given cause if it does not produce a value after d -duration. - -**Signature** - -```ts -export declare const timeoutFailCause: { - ( - cause: LazyArg>, - duration: Duration.DurationInput - ): (self: Stream) => Stream - ( - self: Stream, - cause: LazyArg>, - duration: Duration.DurationInput - ): Stream -} -``` - -Added in v2.0.0 - -## timeoutTo - -Switches the stream if it does not produce a value after the specified -duration. - -**Signature** - -```ts -export declare const timeoutTo: { - ( - duration: Duration.DurationInput, - that: Stream - ): (self: Stream) => Stream - ( - self: Stream, - duration: Duration.DurationInput, - that: Stream - ): Stream -} -``` - -Added in v2.0.0 - -## transduce - -Applies the transducer to the stream and emits its outputs. - -**Signature** - -```ts -export declare const transduce: { - (sink: Sink.Sink): (self: Stream) => Stream - (self: Stream, sink: Sink.Sink): Stream -} -``` - -Added in v2.0.0 - -## when - -Returns the specified stream if the given condition is satisfied, otherwise -returns an empty stream. - -**Signature** - -```ts -export declare const when: { - (predicate: LazyArg): (self: Stream) => Stream - (self: Stream, predicate: LazyArg): Stream -} -``` - -Added in v2.0.0 - -## whenCaseEffect - -Returns the stream when the given partial function is defined for the given -effectful value, otherwise returns an empty stream. - -**Signature** - -```ts -export declare const whenCaseEffect: { - ( - pf: (a: A) => Option.Option> - ): (self: Effect.Effect) => Stream - ( - self: Effect.Effect, - pf: (a: A) => Option.Option> - ): Stream -} -``` - -Added in v2.0.0 - -## whenEffect - -Returns the stream if the given effectful condition is satisfied, otherwise -returns an empty stream. - -**Signature** - -```ts -export declare const whenEffect: { - (effect: Effect.Effect): (self: Stream) => Stream - (self: Stream, effect: Effect.Effect): Stream -} -``` - -Added in v2.0.0 - -# zipping - -## zip - -Zips this stream with another point-wise and emits tuples of elements from -both streams. - -The new stream will end when one of the sides ends. - -**Signature** - -```ts -export declare const zip: { - (that: Stream): (self: Stream) => Stream - (self: Stream, that: Stream): Stream -} -``` - -Added in v2.0.0 - -## zipAll - -Zips this stream with another point-wise, creating a new stream of pairs of -elements from both sides. - -The defaults `defaultLeft` and `defaultRight` will be used if the streams -have different lengths and one of the streams has ended before the other. - -**Signature** - -```ts -export declare const zipAll: { - (options: { - readonly other: Stream - readonly defaultSelf: A - readonly defaultOther: A2 - }): (self: Stream) => Stream - ( - self: Stream, - options: { readonly other: Stream; readonly defaultSelf: A; readonly defaultOther: A2 } - ): Stream -} -``` - -Added in v2.0.0 - -## zipAllLeft - -Zips this stream with another point-wise, and keeps only elements from this -stream. - -The provided default value will be used if the other stream ends before -this one. - -**Signature** - -```ts -export declare const zipAllLeft: { - (that: Stream, defaultLeft: A): (self: Stream) => Stream - (self: Stream, that: Stream, defaultLeft: A): Stream -} -``` - -Added in v2.0.0 - -## zipAllRight - -Zips this stream with another point-wise, and keeps only elements from the -other stream. - -The provided default value will be used if this stream ends before the -other one. - -**Signature** - -```ts -export declare const zipAllRight: { - ( - that: Stream, - defaultRight: A2 - ): (self: Stream) => Stream - (self: Stream, that: Stream, defaultRight: A2): Stream -} -``` - -Added in v2.0.0 - -## zipAllSortedByKey - -Zips this stream that is sorted by distinct keys and the specified stream -that is sorted by distinct keys to produce a new stream that is sorted by -distinct keys. Combines values associated with each key into a tuple, -using the specified values `defaultLeft` and `defaultRight` to fill in -missing values. - -This allows zipping potentially unbounded streams of data by key in -constant space but the caller is responsible for ensuring that the -streams are sorted by distinct keys. - -**Signature** - -```ts -export declare const zipAllSortedByKey: { - (options: { - readonly other: Stream - readonly defaultSelf: A - readonly defaultOther: A2 - readonly order: Order.Order - }): (self: Stream) => Stream - ( - self: Stream, - options: { - readonly other: Stream - readonly defaultSelf: A - readonly defaultOther: A2 - readonly order: Order.Order - } - ): Stream -} -``` - -Added in v2.0.0 - -## zipAllSortedByKeyLeft - -Zips this stream that is sorted by distinct keys and the specified stream -that is sorted by distinct keys to produce a new stream that is sorted by -distinct keys. Keeps only values from this stream, using the specified -value `default` to fill in missing values. - -This allows zipping potentially unbounded streams of data by key in -constant space but the caller is responsible for ensuring that the -streams are sorted by distinct keys. - -**Signature** - -```ts -export declare const zipAllSortedByKeyLeft: { - (options: { - readonly other: Stream - readonly defaultSelf: A - readonly order: Order.Order - }): (self: Stream) => Stream - ( - self: Stream, - options: { - readonly other: Stream - readonly defaultSelf: A - readonly order: Order.Order - } - ): Stream -} -``` - -Added in v2.0.0 - -## zipAllSortedByKeyRight - -Zips this stream that is sorted by distinct keys and the specified stream -that is sorted by distinct keys to produce a new stream that is sorted by -distinct keys. Keeps only values from that stream, using the specified -value `default` to fill in missing values. - -This allows zipping potentially unbounded streams of data by key in -constant space but the caller is responsible for ensuring that the -streams are sorted by distinct keys. - -**Signature** - -```ts -export declare const zipAllSortedByKeyRight: { - (options: { - readonly other: Stream - readonly defaultOther: A2 - readonly order: Order.Order - }): (self: Stream) => Stream - ( - self: Stream, - options: { - readonly other: Stream - readonly defaultOther: A2 - readonly order: Order.Order - } - ): Stream -} -``` - -Added in v2.0.0 - -## zipAllSortedByKeyWith - -Zips this stream that is sorted by distinct keys and the specified stream -that is sorted by distinct keys to produce a new stream that is sorted by -distinct keys. Uses the functions `left`, `right`, and `both` to handle -the cases where a key and value exist in this stream, that stream, or -both streams. - -This allows zipping potentially unbounded streams of data by key in -constant space but the caller is responsible for ensuring that the -streams are sorted by distinct keys. - -**Signature** - -```ts -export declare const zipAllSortedByKeyWith: { - (options: { - readonly other: Stream - readonly onSelf: (a: A) => A3 - readonly onOther: (a2: A2) => A3 - readonly onBoth: (a: A, a2: A2) => A3 - readonly order: Order.Order - }): (self: Stream) => Stream - ( - self: Stream, - options: { - readonly other: Stream - readonly onSelf: (a: A) => A3 - readonly onOther: (a2: A2) => A3 - readonly onBoth: (a: A, a2: A2) => A3 - readonly order: Order.Order - } - ): Stream -} -``` - -Added in v2.0.0 - -## zipAllWith - -Zips this stream with another point-wise. The provided functions will be -used to create elements for the composed stream. - -The functions `left` and `right` will be used if the streams have different -lengths and one of the streams has ended before the other. - -**Signature** - -```ts -export declare const zipAllWith: { - (options: { - readonly other: Stream - readonly onSelf: (a: A) => A3 - readonly onOther: (a2: A2) => A3 - readonly onBoth: (a: A, a2: A2) => A3 - }): (self: Stream) => Stream - ( - self: Stream, - options: { - readonly other: Stream - readonly onSelf: (a: A) => A3 - readonly onOther: (a2: A2) => A3 - readonly onBoth: (a: A, a2: A2) => A3 - } - ): Stream -} -``` - -Added in v2.0.0 - -## zipFlatten - -Zips this stream with another point-wise and emits tuples of elements from -both streams. - -The new stream will end when one of the sides ends. - -**Signature** - -```ts -export declare const zipFlatten: { - ( - that: Stream - ): (self: Stream) => Stream - ( - self: Stream, - that: Stream - ): Stream -} -``` - -Added in v2.0.0 - -## zipLatest - -Zips the two streams so that when a value is emitted by either of the two -streams, it is combined with the latest value from the other stream to -produce a result. - -Note: tracking the latest value is done on a per-chunk basis. That means -that emitted elements that are not the last value in chunks will never be -used for zipping. - -**Signature** - -```ts -export declare const zipLatest: { - (that: Stream): (self: Stream) => Stream - (self: Stream, that: Stream): Stream -} -``` - -Added in v2.0.0 - -## zipLatestWith - -Zips the two streams so that when a value is emitted by either of the two -streams, it is combined with the latest value from the other stream to -produce a result. - -Note: tracking the latest value is done on a per-chunk basis. That means -that emitted elements that are not the last value in chunks will never be -used for zipping. - -**Signature** - -```ts -export declare const zipLatestWith: { - ( - that: Stream, - f: (a: A, a2: A2) => A3 - ): (self: Stream) => Stream - ( - self: Stream, - that: Stream, - f: (a: A, a2: A2) => A3 - ): Stream -} -``` - -Added in v2.0.0 - -## zipLeft - -Zips this stream with another point-wise, but keeps only the outputs of -this stream. - -The new stream will end when one of the sides ends. - -**Signature** - -```ts -export declare const zipLeft: { - (that: Stream): (self: Stream) => Stream - (self: Stream, that: Stream): Stream -} -``` - -Added in v2.0.0 - -## zipRight - -Zips this stream with another point-wise, but keeps only the outputs of the -other stream. - -The new stream will end when one of the sides ends. - -**Signature** - -```ts -export declare const zipRight: { - (that: Stream): (self: Stream) => Stream - (self: Stream, that: Stream): Stream -} -``` - -Added in v2.0.0 - -## zipWith - -Zips this stream with another point-wise and applies the function to the -paired elements. - -The new stream will end when one of the sides ends. - -**Signature** - -```ts -export declare const zipWith: { - ( - that: Stream, - f: (a: A, a2: A2) => A3 - ): (self: Stream) => Stream - ( - self: Stream, - that: Stream, - f: (a: A, a2: A2) => A3 - ): Stream -} -``` - -Added in v2.0.0 - -## zipWithChunks - -Zips this stream with another point-wise and applies the function to the -paired elements. - -The new stream will end when one of the sides ends. - -**Signature** - -```ts -export declare const zipWithChunks: { - ( - that: Stream, - f: ( - left: Chunk.Chunk, - right: Chunk.Chunk - ) => readonly [Chunk.Chunk, Either.Either, Chunk.Chunk>] - ): (self: Stream) => Stream - ( - self: Stream, - that: Stream, - f: ( - left: Chunk.Chunk, - right: Chunk.Chunk - ) => readonly [Chunk.Chunk, Either.Either, Chunk.Chunk>] - ): Stream -} -``` - -Added in v2.0.0 - -## zipWithIndex - -Zips this stream together with the index of elements. - -**Signature** - -```ts -export declare const zipWithIndex: (self: Stream) => Stream -``` - -Added in v2.0.0 - -## zipWithNext - -Zips each element with the next element if present. - -**Signature** - -```ts -export declare const zipWithNext: (self: Stream) => Stream]> -``` - -Added in v2.0.0 - -## zipWithPrevious - -Zips each element with the previous element. Initially accompanied by -`None`. - -**Signature** - -```ts -export declare const zipWithPrevious: (self: Stream) => Stream, A]> -``` - -Added in v2.0.0 - -## zipWithPreviousAndNext - -Zips each element with both the previous and next element. - -**Signature** - -```ts -export declare const zipWithPreviousAndNext: ( - self: Stream -) => Stream, A, Option.Option]> -``` - -Added in v2.0.0 diff --git a/docs/modules/StreamEmit.ts.md b/docs/modules/StreamEmit.ts.md deleted file mode 100644 index 802d760a5..000000000 --- a/docs/modules/StreamEmit.ts.md +++ /dev/null @@ -1,104 +0,0 @@ ---- -title: StreamEmit.ts -nav_order: 109 -parent: Modules ---- - -## StreamEmit overview - -Added in v2.0.0 - ---- - -

Table of contents

- -- [models](#models) - - [Emit (interface)](#emit-interface) - - [EmitOps (interface)](#emitops-interface) - ---- - -# models - -## Emit (interface) - -An `Emit` represents an asynchronous callback that can be -called multiple times. The callback can be called with a value of type -`Effect, Chunk
>`, where succeeding with a `Chunk` -indicates to emit those elements, failing with `Some` indicates to -terminate with that error, and failing with `None` indicates to terminate -with an end of stream signal. - -**Signature** - -```ts -export interface Emit extends EmitOps { - (f: Effect.Effect, Chunk.Chunk>): Promise -} -``` - -Added in v2.0.0 - -## EmitOps (interface) - -**Signature** - -```ts -export interface EmitOps { - /** - * Emits a chunk containing the specified values. - */ - readonly chunk: (chunk: Chunk.Chunk) => Promise - - /** - * Terminates with a cause that dies with the specified defect. - */ - readonly die: (defect: Err) => Promise - - /** - * Terminates with a cause that dies with a `Throwable` with the specified - * message. - */ - readonly dieMessage: (message: string) => Promise - - /** - * Either emits the specified value if this `Exit` is a `Success` or else - * terminates with the specified cause if this `Exit` is a `Failure`. - */ - readonly done: (exit: Exit.Exit) => Promise - - /** - * Terminates with an end of stream signal. - */ - readonly end: () => Promise - - /** - * Terminates with the specified error. - */ - readonly fail: (error: E) => Promise - - /** - * Either emits the success value of this effect or terminates the stream - * with the failure value of this effect. - */ - readonly fromEffect: (effect: Effect.Effect) => Promise - - /** - * Either emits the success value of this effect or terminates the stream - * with the failure value of this effect. - */ - readonly fromEffectChunk: (effect: Effect.Effect>) => Promise - - /** - * Terminates the stream with the specified cause. - */ - readonly halt: (cause: Cause.Cause) => Promise - - /** - * Emits a chunk containing the specified value. - */ - readonly single: (value: A) => Promise -} -``` - -Added in v2.0.0 diff --git a/docs/modules/StreamHaltStrategy.ts.md b/docs/modules/StreamHaltStrategy.ts.md deleted file mode 100644 index eb4027f32..000000000 --- a/docs/modules/StreamHaltStrategy.ts.md +++ /dev/null @@ -1,215 +0,0 @@ ---- -title: StreamHaltStrategy.ts -nav_order: 110 -parent: Modules ---- - -## StreamHaltStrategy overview - -Added in v2.0.0 - ---- - -

Table of contents

- -- [constructors](#constructors) - - [Both](#both) - - [Either](#either) - - [Left](#left) - - [Right](#right) - - [fromInput](#frominput) -- [folding](#folding) - - [match](#match) -- [models](#models) - - [Both (interface)](#both-interface) - - [Either (interface)](#either-interface) - - [HaltStrategy (type alias)](#haltstrategy-type-alias) - - [HaltStrategyInput (type alias)](#haltstrategyinput-type-alias) - - [Left (interface)](#left-interface) - - [Right (interface)](#right-interface) -- [refinements](#refinements) - - [isBoth](#isboth) - - [isEither](#iseither) - - [isLeft](#isleft) - - [isRight](#isright) - ---- - -# constructors - -## Both - -**Signature** - -```ts -export declare const Both: HaltStrategy -``` - -Added in v2.0.0 - -## Either - -**Signature** - -```ts -export declare const Either: HaltStrategy -``` - -Added in v2.0.0 - -## Left - -**Signature** - -```ts -export declare const Left: HaltStrategy -``` - -Added in v2.0.0 - -## Right - -**Signature** - -```ts -export declare const Right: HaltStrategy -``` - -Added in v2.0.0 - -## fromInput - -**Signature** - -```ts -export declare const fromInput: (input: HaltStrategyInput) => HaltStrategy -``` - -Added in v2.0.0 - -# folding - -## match - -**Signature** - -```ts -export declare const match: { - (onLeft: () => Z, onRight: () => Z, onBoth: () => Z, onEither: () => Z): (self: HaltStrategy) => Z - (self: HaltStrategy, onLeft: () => Z, onRight: () => Z, onBoth: () => Z, onEither: () => Z): Z -} -``` - -Added in v2.0.0 - -# models - -## Both (interface) - -**Signature** - -```ts -export interface Both { - readonly _tag: "Both" -} -``` - -Added in v2.0.0 - -## Either (interface) - -**Signature** - -```ts -export interface Either { - readonly _tag: "Either" -} -``` - -Added in v2.0.0 - -## HaltStrategy (type alias) - -**Signature** - -```ts -export type HaltStrategy = Left | Right | Both | Either -``` - -Added in v2.0.0 - -## HaltStrategyInput (type alias) - -**Signature** - -```ts -export type HaltStrategyInput = HaltStrategy | "left" | "right" | "both" | "either" -``` - -Added in v2.0.0 - -## Left (interface) - -**Signature** - -```ts -export interface Left { - readonly _tag: "Left" -} -``` - -Added in v2.0.0 - -## Right (interface) - -**Signature** - -```ts -export interface Right { - readonly _tag: "Right" -} -``` - -Added in v2.0.0 - -# refinements - -## isBoth - -**Signature** - -```ts -export declare const isBoth: (self: HaltStrategy) => self is Both -``` - -Added in v2.0.0 - -## isEither - -**Signature** - -```ts -export declare const isEither: (self: HaltStrategy) => self is Either -``` - -Added in v2.0.0 - -## isLeft - -**Signature** - -```ts -export declare const isLeft: (self: HaltStrategy) => self is Left -``` - -Added in v2.0.0 - -## isRight - -**Signature** - -```ts -export declare const isRight: (self: HaltStrategy) => self is Right -``` - -Added in v2.0.0 diff --git a/docs/modules/Streamable.ts.md b/docs/modules/Streamable.ts.md deleted file mode 100644 index e7d9225ec..000000000 --- a/docs/modules/Streamable.ts.md +++ /dev/null @@ -1,63 +0,0 @@ ---- -title: Streamable.ts -nav_order: 108 -parent: Modules ---- - -## Streamable overview - -Added in v2.0.0 - ---- - -

Table of contents

- -- [constructors](#constructors) - - [Class (class)](#class-class) - - [pipe (method)](#pipe-method) - - [toStream (method)](#tostream-method) - - [[Stream.StreamTypeId] (property)](#streamstreamtypeid-property) - ---- - -# constructors - -## Class (class) - -**Signature** - -```ts -export declare class Class -``` - -Added in v2.0.0 - -### pipe (method) - -**Signature** - -```ts -pipe() -``` - -Added in v2.0.0 - -### toStream (method) - -**Signature** - -```ts -abstract toStream(): Stream.Stream -``` - -Added in v2.0.0 - -### [Stream.StreamTypeId] (property) - -**Signature** - -```ts -readonly [Stream.StreamTypeId]: { _R: (_: never) => never; _E: (_: never) => never; _A: (_: never) => never; } -``` - -Added in v2.0.0 diff --git a/docs/modules/String.ts.md b/docs/modules/String.ts.md deleted file mode 100644 index fb5e4f512..000000000 --- a/docs/modules/String.ts.md +++ /dev/null @@ -1,950 +0,0 @@ ---- -title: String.ts -nav_order: 111 -parent: Modules ---- - -## String overview - -This module provides utility functions and type class instances for working with the `string` type in TypeScript. -It includes functions for basic string manipulation, as well as type class instances for -`Equivalence` and `Order`. - -Added in v2.0.0 - ---- - -

Table of contents

- -- [guards](#guards) - - [isString](#isstring) -- [instances](#instances) - - [Equivalence](#equivalence) - - [Order](#order) -- [utils](#utils) - - [Concat (type alias)](#concat-type-alias) - - [Trim (type alias)](#trim-type-alias) - - [TrimEnd (type alias)](#trimend-type-alias) - - [TrimStart (type alias)](#trimstart-type-alias) - - [at](#at) - - [capitalize](#capitalize) - - [charAt](#charat) - - [charCodeAt](#charcodeat) - - [codePointAt](#codepointat) - - [concat](#concat) - - [empty](#empty) - - [endsWith](#endswith) - - [includes](#includes) - - [indexOf](#indexof) - - [isEmpty](#isempty) - - [isNonEmpty](#isnonempty) - - [lastIndexOf](#lastindexof) - - [length](#length) - - [linesWithSeparators](#lineswithseparators) - - [localeCompare](#localecompare) - - [match](#match) - - [matchAll](#matchall) - - [normalize](#normalize) - - [padEnd](#padend) - - [padStart](#padstart) - - [repeat](#repeat) - - [replace](#replace) - - [replaceAll](#replaceall) - - [search](#search) - - [slice](#slice) - - [split](#split) - - [startsWith](#startswith) - - [stripMargin](#stripmargin) - - [stripMarginWith](#stripmarginwith) - - [substring](#substring) - - [takeLeft](#takeleft) - - [takeRight](#takeright) - - [toLocaleLowerCase](#tolocalelowercase) - - [toLocaleUpperCase](#tolocaleuppercase) - - [toLowerCase](#tolowercase) - - [toUpperCase](#touppercase) - - [trim](#trim) - - [trimEnd](#trimend) - - [trimStart](#trimstart) - - [uncapitalize](#uncapitalize) - ---- - -# guards - -## isString - -Tests if a value is a `string`. - -**Signature** - -```ts -export declare const isString: Refinement -``` - -**Example** - -```ts -import { isString } from "effect/String" - -assert.deepStrictEqual(isString("a"), true) -assert.deepStrictEqual(isString(1), false) -``` - -Added in v2.0.0 - -# instances - -## Equivalence - -**Signature** - -```ts -export declare const Equivalence: equivalence.Equivalence -``` - -Added in v2.0.0 - -## Order - -**Signature** - -```ts -export declare const Order: order.Order -``` - -Added in v2.0.0 - -# utils - -## Concat (type alias) - -Concatenates two strings at the type level. - -**Signature** - -```ts -export type Concat
= `${A}${B}` -``` - -Added in v2.0.0 - -## Trim (type alias) - -**Signature** - -```ts -export type Trim = TrimEnd> -``` - -Added in v2.0.0 - -## TrimEnd (type alias) - -**Signature** - -```ts -export type TrimEnd = A extends `${infer B} ` - ? TrimEnd - : A extends `${infer B}\n` - ? TrimEnd - : A extends `${infer B}\t` - ? TrimEnd - : A extends `${infer B}\r` - ? TrimEnd - : A -``` - -Added in v2.0.0 - -## TrimStart (type alias) - -**Signature** - -```ts -export type TrimStart = A extends ` ${infer B}` - ? TrimStart - : A extends `\n${infer B}` - ? TrimStart - : A extends `\t${infer B}` - ? TrimStart - : A extends `\r${infer B}` - ? TrimStart - : A -``` - -Added in v2.0.0 - -## at - -**Signature** - -```ts -export declare const at: { - (index: number): (self: string) => Option.Option - (self: string, index: number): Option.Option -} -``` - -**Example** - -```ts -import * as S from "effect/String" -import * as Option from "effect/Option" -import { pipe } from "effect/Function" - -assert.deepStrictEqual(pipe("abc", S.at(1)), Option.some("b")) -assert.deepStrictEqual(pipe("abc", S.at(4)), Option.none()) -``` - -Added in v2.0.0 - -## capitalize - -**Signature** - -```ts -export declare const capitalize: (self: T) => Capitalize -``` - -**Example** - -```ts -import * as S from "effect/String" -import { pipe } from "effect/Function" - -assert.deepStrictEqual(pipe("abc", S.capitalize), "Abc") -``` - -Added in v2.0.0 - -## charAt - -**Signature** - -```ts -export declare const charAt: { - (index: number): (self: string) => Option.Option - (self: string, index: number): Option.Option -} -``` - -**Example** - -```ts -import * as S from "effect/String" -import * as Option from "effect/Option" -import { pipe } from "effect/Function" - -assert.deepStrictEqual(pipe("abc", S.charAt(1)), Option.some("b")) -assert.deepStrictEqual(pipe("abc", S.charAt(4)), Option.none()) -``` - -Added in v2.0.0 - -## charCodeAt - -**Signature** - -```ts -export declare const charCodeAt: { - (index: number): (self: string) => Option.Option - (self: string, index: number): Option.Option -} -``` - -**Example** - -```ts -import * as S from "effect/String" -import * as Option from "effect/Option" -import { pipe } from "effect/Function" - -assert.deepStrictEqual(pipe("abc", S.charCodeAt(1)), Option.some(98)) -assert.deepStrictEqual(pipe("abc", S.charCodeAt(4)), Option.none()) -``` - -Added in v2.0.0 - -## codePointAt - -**Signature** - -```ts -export declare const codePointAt: { - (index: number): (self: string) => Option.Option - (self: string, index: number): Option.Option -} -``` - -**Example** - -```ts -import * as S from "effect/String" -import * as Option from "effect/Option" -import { pipe } from "effect/Function" - -assert.deepStrictEqual(pipe("abc", S.codePointAt(1)), Option.some(98)) -``` - -Added in v2.0.0 - -## concat - -Concatenates two strings at runtime. - -**Signature** - -```ts -export declare const concat: { - (that: B): (self: A) => `${A}${B}` - (self: A, that: B): `${A}${B}` -} -``` - -Added in v2.0.0 - -## empty - -The empty string `""`. - -**Signature** - -```ts -export declare const empty: "" -``` - -Added in v2.0.0 - -## endsWith - -**Signature** - -```ts -export declare const endsWith: (searchString: string, position?: number) => (self: string) => boolean -``` - -Added in v2.0.0 - -## includes - -Returns `true` if `searchString` appears as a substring of `self`, at one or more positions that are -greater than or equal to `position`; otherwise, returns `false`. - -**Signature** - -```ts -export declare const includes: (searchString: string, position?: number) => (self: string) => boolean -``` - -Added in v2.0.0 - -## indexOf - -**Signature** - -```ts -export declare const indexOf: (searchString: string) => (self: string) => Option.Option -``` - -**Example** - -```ts -import * as S from "effect/String" -import * as Option from "effect/Option" -import { pipe } from "effect/Function" - -assert.deepStrictEqual(pipe("abbbc", S.indexOf("b")), Option.some(1)) -``` - -Added in v2.0.0 - -## isEmpty - -Test whether a `string` is empty. - -**Signature** - -```ts -export declare const isEmpty: (self: string) => self is "" -``` - -**Example** - -```ts -import * as S from "effect/String" - -assert.deepStrictEqual(S.isEmpty(""), true) -assert.deepStrictEqual(S.isEmpty("a"), false) -``` - -Added in v2.0.0 - -## isNonEmpty - -Test whether a `string` is non empty. - -**Signature** - -```ts -export declare const isNonEmpty: (self: string) => boolean -``` - -Added in v2.0.0 - -## lastIndexOf - -**Signature** - -```ts -export declare const lastIndexOf: (searchString: string) => (self: string) => Option.Option -``` - -**Example** - -```ts -import * as S from "effect/String" -import * as Option from "effect/Option" -import { pipe } from "effect/Function" - -assert.deepStrictEqual(pipe("abbbc", S.lastIndexOf("b")), Option.some(3)) -assert.deepStrictEqual(pipe("abbbc", S.lastIndexOf("d")), Option.none()) -``` - -Added in v2.0.0 - -## length - -Calculate the number of characters in a `string`. - -**Signature** - -```ts -export declare const length: (self: string) => number -``` - -**Example** - -```ts -import * as S from "effect/String" - -assert.deepStrictEqual(S.length("abc"), 3) -``` - -Added in v2.0.0 - -## linesWithSeparators - -Returns an `IterableIterator` which yields each line contained within the -string as well as the trailing newline character. - -**Signature** - -```ts -export declare const linesWithSeparators: (s: string) => LinesIterator -``` - -Added in v2.0.0 - -## localeCompare - -**Signature** - -```ts -export declare const localeCompare: ( - that: string, - locales?: Array, - options?: Intl.CollatorOptions -) => (self: string) => Ordering.Ordering -``` - -**Example** - -```ts -import * as S from "effect/String" -import { pipe } from "effect/Function" - -assert.deepStrictEqual(pipe("a", S.localeCompare("b")), -1) -assert.deepStrictEqual(pipe("b", S.localeCompare("a")), 1) -assert.deepStrictEqual(pipe("a", S.localeCompare("a")), 0) -``` - -Added in v2.0.0 - -## match - -It is the `pipe`-able version of the native `match` method. - -**Signature** - -```ts -export declare const match: (regexp: RegExp | string) => (self: string) => Option.Option -``` - -Added in v2.0.0 - -## matchAll - -It is the `pipe`-able version of the native `matchAll` method. - -**Signature** - -```ts -export declare const matchAll: (regexp: RegExp) => (self: string) => IterableIterator -``` - -Added in v2.0.0 - -## normalize - -**Signature** - -```ts -export declare const normalize: (form?: "NFC" | "NFD" | "NFKC" | "NFKD") => (self: string) => string -``` - -**Example** - -```ts -import * as S from "effect/String" -import { pipe } from "effect/Function" - -const str = "\u1E9B\u0323" -assert.deepStrictEqual(pipe(str, S.normalize()), "\u1E9B\u0323") -assert.deepStrictEqual(pipe(str, S.normalize("NFC")), "\u1E9B\u0323") -assert.deepStrictEqual(pipe(str, S.normalize("NFD")), "\u017F\u0323\u0307") -assert.deepStrictEqual(pipe(str, S.normalize("NFKC")), "\u1E69") -assert.deepStrictEqual(pipe(str, S.normalize("NFKD")), "\u0073\u0323\u0307") -``` - -Added in v2.0.0 - -## padEnd - -**Signature** - -```ts -export declare const padEnd: (maxLength: number, fillString?: string) => (self: string) => string -``` - -**Example** - -```ts -import * as S from "effect/String" -import { pipe } from "effect/Function" - -assert.deepStrictEqual(pipe("a", S.padEnd(5)), "a ") -assert.deepStrictEqual(pipe("a", S.padEnd(5, "_")), "a____") -``` - -Added in v2.0.0 - -## padStart - -**Signature** - -```ts -export declare const padStart: (maxLength: number, fillString?: string) => (self: string) => string -``` - -**Example** - -```ts -import * as S from "effect/String" -import { pipe } from "effect/Function" - -assert.deepStrictEqual(pipe("a", S.padStart(5)), " a") -assert.deepStrictEqual(pipe("a", S.padStart(5, "_")), "____a") -``` - -Added in v2.0.0 - -## repeat - -**Signature** - -```ts -export declare const repeat: (count: number) => (self: string) => string -``` - -**Example** - -```ts -import * as S from "effect/String" -import { pipe } from "effect/Function" - -assert.deepStrictEqual(pipe("a", S.repeat(5)), "aaaaa") -``` - -Added in v2.0.0 - -## replace - -**Signature** - -```ts -export declare const replace: (searchValue: string | RegExp, replaceValue: string) => (self: string) => string -``` - -**Example** - -```ts -import * as S from "effect/String" -import { pipe } from "effect/Function" - -assert.deepStrictEqual(pipe("abc", S.replace("b", "d")), "adc") -``` - -Added in v2.0.0 - -## replaceAll - -**Signature** - -```ts -export declare const replaceAll: (searchValue: string | RegExp, replaceValue: string) => (self: string) => string -``` - -**Example** - -```ts -import * as S from "effect/String" -import { pipe } from "effect/Function" - -assert.deepStrictEqual(pipe("ababb", S.replaceAll("b", "c")), "acacc") -assert.deepStrictEqual(pipe("ababb", S.replaceAll(/ba/g, "cc")), "accbb") -``` - -Added in v2.0.0 - -## search - -**Signature** - -```ts -export declare const search: { - (regexp: RegExp | string): (self: string) => Option.Option - (self: string, regexp: RegExp | string): Option.Option -} -``` - -**Example** - -```ts -import * as S from "effect/String" -import * as Option from "effect/Option" -import { pipe } from "effect/Function" - -assert.deepStrictEqual(pipe("ababb", S.search("b")), Option.some(1)) -assert.deepStrictEqual(pipe("ababb", S.search(/abb/)), Option.some(2)) -assert.deepStrictEqual(pipe("ababb", S.search("d")), Option.none()) -``` - -Added in v2.0.0 - -## slice - -**Signature** - -```ts -export declare const slice: (start?: number, end?: number) => (self: string) => string -``` - -**Example** - -```ts -import * as S from "effect/String" -import { pipe } from "effect/Function" - -assert.deepStrictEqual(pipe("abcd", S.slice(1, 3)), "bc") -``` - -Added in v2.0.0 - -## split - -**Signature** - -```ts -export declare const split: { - (separator: string | RegExp): (self: string) => [string, ...string[]] - (self: string, separator: string | RegExp): [string, ...string[]] -} -``` - -**Example** - -```ts -import * as S from "effect/String" -import { pipe } from "effect/Function" - -assert.deepStrictEqual(pipe("abc", S.split("")), ["a", "b", "c"]) -assert.deepStrictEqual(pipe("", S.split("")), [""]) -``` - -Added in v2.0.0 - -## startsWith - -**Signature** - -```ts -export declare const startsWith: (searchString: string, position?: number) => (self: string) => boolean -``` - -Added in v2.0.0 - -## stripMargin - -For every line in this string, strip a leading prefix consisting of blanks -or control characters followed by the `"|"` character from the line. - -**Signature** - -```ts -export declare const stripMargin: (self: string) => string -``` - -Added in v2.0.0 - -## stripMarginWith - -For every line in this string, strip a leading prefix consisting of blanks -or control characters followed by the character specified by `marginChar` -from the line. - -**Signature** - -```ts -export declare const stripMarginWith: { - (marginChar: string): (self: string) => string - (self: string, marginChar: string): string -} -``` - -Added in v2.0.0 - -## substring - -**Signature** - -```ts -export declare const substring: (start: number, end?: number) => (self: string) => string -``` - -**Example** - -```ts -import * as S from "effect/String" -import { pipe } from "effect/Function" - -assert.deepStrictEqual(pipe("abcd", S.substring(1)), "bcd") -assert.deepStrictEqual(pipe("abcd", S.substring(1, 3)), "bc") -``` - -Added in v2.0.0 - -## takeLeft - -Keep the specified number of characters from the start of a string. - -If `n` is larger than the available number of characters, the string will -be returned whole. - -If `n` is not a positive number, an empty string will be returned. - -If `n` is a float, it will be rounded down to the nearest integer. - -**Signature** - -```ts -export declare const takeLeft: { (n: number): (self: string) => string; (self: string, n: number): string } -``` - -**Example** - -```ts -import * as S from "effect/String" - -assert.deepStrictEqual(S.takeLeft("Hello World", 5), "Hello") -``` - -Added in v2.0.0 - -## takeRight - -Keep the specified number of characters from the end of a string. - -If `n` is larger than the available number of characters, the string will -be returned whole. - -If `n` is not a positive number, an empty string will be returned. - -If `n` is a float, it will be rounded down to the nearest integer. - -**Signature** - -```ts -export declare const takeRight: { (n: number): (self: string) => string; (self: string, n: number): string } -``` - -**Example** - -```ts -import * as S from "effect/String" - -assert.deepStrictEqual(S.takeRight("Hello World", 5), "World") -``` - -Added in v2.0.0 - -## toLocaleLowerCase - -**Signature** - -```ts -export declare const toLocaleLowerCase: (locale?: string | Array) => (self: string) => string -``` - -**Example** - -```ts -import * as S from "effect/String" -import { pipe } from "effect/Function" - -const str = "\u0130" -assert.deepStrictEqual(pipe(str, S.toLocaleLowerCase("tr")), "i") -``` - -Added in v2.0.0 - -## toLocaleUpperCase - -**Signature** - -```ts -export declare const toLocaleUpperCase: (locale?: string | Array) => (self: string) => string -``` - -**Example** - -```ts -import * as S from "effect/String" -import { pipe } from "effect/Function" - -const str = "i\u0307" -assert.deepStrictEqual(pipe(str, S.toLocaleUpperCase("lt-LT")), "I") -``` - -Added in v2.0.0 - -## toLowerCase - -**Signature** - -```ts -export declare const toLowerCase: (self: T) => Lowercase -``` - -**Example** - -```ts -import * as S from "effect/String" -import { pipe } from "effect/Function" - -assert.deepStrictEqual(pipe("A", S.toLowerCase), "a") -``` - -Added in v2.0.0 - -## toUpperCase - -**Signature** - -```ts -export declare const toUpperCase: (self: S) => Uppercase -``` - -**Example** - -```ts -import * as S from "effect/String" -import { pipe } from "effect/Function" - -assert.deepStrictEqual(pipe("a", S.toUpperCase), "A") -``` - -Added in v2.0.0 - -## trim - -**Signature** - -```ts -export declare const trim: (self: A) => TrimEnd> -``` - -**Example** - -```ts -import * as S from "effect/String" - -assert.deepStrictEqual(S.trim(" a "), "a") -``` - -Added in v2.0.0 - -## trimEnd - -**Signature** - -```ts -export declare const trimEnd: (self: A) => TrimEnd -``` - -**Example** - -```ts -import * as S from "effect/String" - -assert.deepStrictEqual(S.trimEnd(" a "), " a") -``` - -Added in v2.0.0 - -## trimStart - -**Signature** - -```ts -export declare const trimStart: (self: A) => TrimStart -``` - -**Example** - -```ts -import * as S from "effect/String" - -assert.deepStrictEqual(S.trimStart(" a "), "a ") -``` - -Added in v2.0.0 - -## uncapitalize - -**Signature** - -```ts -export declare const uncapitalize: (self: T) => Uncapitalize -``` - -**Example** - -```ts -import * as S from "effect/String" -import { pipe } from "effect/Function" - -assert.deepStrictEqual(pipe("ABC", S.uncapitalize), "aBC") -``` - -Added in v2.0.0 diff --git a/docs/modules/Struct.ts.md b/docs/modules/Struct.ts.md deleted file mode 100644 index 1e90a7300..000000000 --- a/docs/modules/Struct.ts.md +++ /dev/null @@ -1,166 +0,0 @@ ---- -title: Struct.ts -nav_order: 112 -parent: Modules ---- - -## Struct overview - -This module provides utility functions for working with structs in TypeScript. - -Added in v2.0.0 - ---- - -

Table of contents

- -- [combinators](#combinators) - - [getEquivalence](#getequivalence) - - [getOrder](#getorder) -- [utils](#utils) - - [evolve](#evolve) - - [omit](#omit) - - [pick](#pick) - ---- - -# combinators - -## getEquivalence - -Given a struct of `Equivalence`s returns a new `Equivalence` that compares values of a struct -by applying each `Equivalence` to the corresponding property of the struct. - -Alias of {@link Equivalence.struct}. - -**Signature** - -```ts -export declare const getEquivalence: >>( - isEquivalents: R -) => Equivalence.Equivalence<{ readonly [K in keyof R]: [R[K]] extends [Equivalence.Equivalence] ? A : never }> -``` - -**Example** - -```ts -import { getEquivalence } from "effect/Struct" -import * as S from "effect/String" -import * as N from "effect/Number" - -const PersonEquivalence = getEquivalence({ - name: S.Equivalence, - age: N.Equivalence -}) - -assert.deepStrictEqual(PersonEquivalence({ name: "John", age: 25 }, { name: "John", age: 25 }), true) -assert.deepStrictEqual(PersonEquivalence({ name: "John", age: 25 }, { name: "John", age: 40 }), false) -``` - -Added in v2.0.0 - -## getOrder - -This function creates and returns a new `Order` for a struct of values based on the given `Order`s -for each property in the struct. - -Alias of {@link order.struct}. - -**Signature** - -```ts -export declare const getOrder: }>( - fields: R -) => order.Order<{ [K in keyof R]: [R[K]] extends [order.Order] ? A : never }> -``` - -Added in v2.0.0 - -# utils - -## evolve - -Transforms the values of a Struct provided a transformation function for each key. -If no transformation function is provided for a key, it will return the origional value for that key. - -**Signature** - -```ts -export declare const evolve: { - unknown }>>( - t: T - ): (obj: O) => { - [K in keyof O]: K extends keyof T ? (T[K] extends (...a: any) => any ? ReturnType : O[K]) : O[K] - } - unknown }>>( - obj: O, - t: T - ): { [K in keyof O]: K extends keyof T ? (T[K] extends (...a: any) => any ? ReturnType : O[K]) : O[K] } -} -``` - -**Example** - -```ts -import { evolve } from "effect/Struct" -import { pipe } from "effect/Function" - -assert.deepStrictEqual( - pipe( - { a: "a", b: 1, c: 3 }, - evolve({ - a: (a) => a.length, - b: (b) => b * 2 - }) - ), - { a: 1, b: 2, c: 3 } -) -``` - -Added in v2.0.0 - -## omit - -Create a new object by omitting properties of an existing object. - -**Signature** - -```ts -export declare const omit: ( - ...keys: Keys -) => (s: S) => Simplify> -``` - -**Example** - -```ts -import { omit } from "effect/Struct" -import { pipe } from "effect/Function" - -assert.deepStrictEqual(pipe({ a: "a", b: 1, c: true }, omit("c")), { a: "a", b: 1 }) -``` - -Added in v2.0.0 - -## pick - -Create a new object by picking properties of an existing object. - -**Signature** - -```ts -export declare const pick: ( - ...keys: Keys -) => (s: S) => Simplify> -``` - -**Example** - -```ts -import { pick } from "effect/Struct" -import { pipe } from "effect/Function" - -assert.deepStrictEqual(pipe({ a: "a", b: 1, c: true }, pick("a", "b")), { a: "a", b: 1 }) -``` - -Added in v2.0.0 diff --git a/docs/modules/SubscriptionRef.ts.md b/docs/modules/SubscriptionRef.ts.md deleted file mode 100644 index 6c6cd18a9..000000000 --- a/docs/modules/SubscriptionRef.ts.md +++ /dev/null @@ -1,405 +0,0 @@ ---- -title: SubscriptionRef.ts -nav_order: 113 -parent: Modules ---- - -## SubscriptionRef overview - -Added in v2.0.0 - ---- - -

Table of contents

- -- [constructors](#constructors) - - [make](#make) -- [getters](#getters) - - [get](#get) -- [models](#models) - - [SubscriptionRef (interface)](#subscriptionref-interface) -- [symbols](#symbols) - - [SubscriptionRefTypeId](#subscriptionreftypeid) - - [SubscriptionRefTypeId (type alias)](#subscriptionreftypeid-type-alias) -- [utils](#utils) - - [SubscriptionRef (namespace)](#subscriptionref-namespace) - - [Variance (interface)](#variance-interface) - - [getAndSet](#getandset) - - [getAndUpdate](#getandupdate) - - [getAndUpdateEffect](#getandupdateeffect) - - [getAndUpdateSome](#getandupdatesome) - - [getAndUpdateSomeEffect](#getandupdatesomeeffect) - - [modify](#modify) - - [modifyEffect](#modifyeffect) - - [modifySome](#modifysome) - - [modifySomeEffect](#modifysomeeffect) - - [set](#set) - - [setAndGet](#setandget) - - [update](#update) - - [updateAndGet](#updateandget) - - [updateAndGetEffect](#updateandgeteffect) - - [updateEffect](#updateeffect) - - [updateSome](#updatesome) - - [updateSomeAndGet](#updatesomeandget) - - [updateSomeAndGetEffect](#updatesomeandgeteffect) - - [updateSomeEffect](#updatesomeeffect) - ---- - -# constructors - -## make - -Creates a new `SubscriptionRef` with the specified value. - -**Signature** - -```ts -export declare const make:
(value: A) => Effect.Effect> -``` - -Added in v2.0.0 - -# getters - -## get - -**Signature** - -```ts -export declare const get: (self: SubscriptionRef) => Effect.Effect -``` - -Added in v2.0.0 - -# models - -## SubscriptionRef (interface) - -A `SubscriptionRef` is a `Ref` that can be subscribed to in order to -receive the current value as well as all changes to the value. - -**Signature** - -```ts -export interface SubscriptionRef extends SubscriptionRef.Variance, Synchronized.SynchronizedRef, Pipeable { - /** @internal */ - readonly ref: Ref.Ref - /** @internal */ - readonly pubsub: PubSub.PubSub - /** @internal */ - readonly semaphore: Effect.Semaphore - /** - * A stream containing the current value of the `Ref` as well as all changes - * to that value. - */ - readonly changes: Stream.Stream -} -``` - -Added in v2.0.0 - -# symbols - -## SubscriptionRefTypeId - -**Signature** - -```ts -export declare const SubscriptionRefTypeId: typeof SubscriptionRefTypeId -``` - -Added in v2.0.0 - -## SubscriptionRefTypeId (type alias) - -**Signature** - -```ts -export type SubscriptionRefTypeId = typeof SubscriptionRefTypeId -``` - -Added in v2.0.0 - -# utils - -## SubscriptionRef (namespace) - -Added in v2.0.0 - -### Variance (interface) - -**Signature** - -```ts -export interface Variance { - readonly [SubscriptionRefTypeId]: { - readonly _A: (_: never) => A - } -} -``` - -Added in v2.0.0 - -## getAndSet - -**Signature** - -```ts -export declare const getAndSet: { - (value: A): (self: SubscriptionRef) => Effect.Effect - (self: SubscriptionRef, value: A): Effect.Effect -} -``` - -Added in v2.0.0 - -## getAndUpdate - -**Signature** - -```ts -export declare const getAndUpdate: { - (f: (a: A) => A): (self: SubscriptionRef) => Effect.Effect - (self: SubscriptionRef, f: (a: A) => A): Effect.Effect -} -``` - -Added in v2.0.0 - -## getAndUpdateEffect - -**Signature** - -```ts -export declare const getAndUpdateEffect: { - (f: (a: A) => Effect.Effect): (self: SubscriptionRef) => Effect.Effect - (self: SubscriptionRef, f: (a: A) => Effect.Effect): Effect.Effect -} -``` - -Added in v2.0.0 - -## getAndUpdateSome - -**Signature** - -```ts -export declare const getAndUpdateSome: { - (pf: (a: A) => Option.Option): (self: SubscriptionRef) => Effect.Effect - (self: SubscriptionRef, pf: (a: A) => Option.Option): Effect.Effect -} -``` - -Added in v2.0.0 - -## getAndUpdateSomeEffect - -**Signature** - -```ts -export declare const getAndUpdateSomeEffect: { - (pf: (a: A) => Option.Option>): (self: SubscriptionRef) => Effect.Effect - (self: SubscriptionRef, pf: (a: A) => Option.Option>): Effect.Effect -} -``` - -Added in v2.0.0 - -## modify - -**Signature** - -```ts -export declare const modify: { - (f: (a: A) => readonly [B, A]): (self: SubscriptionRef) => Effect.Effect - (self: SubscriptionRef, f: (a: A) => readonly [B, A]): Effect.Effect -} -``` - -Added in v2.0.0 - -## modifyEffect - -**Signature** - -```ts -export declare const modifyEffect: { - (f: (a: A) => Effect.Effect): (self: SubscriptionRef) => Effect.Effect - (self: SubscriptionRef, f: (a: A) => Effect.Effect): Effect.Effect -} -``` - -Added in v2.0.0 - -## modifySome - -**Signature** - -```ts -export declare const modifySome: { - ( - fallback: B, - pf: (a: A) => Option.Option - ): (self: SubscriptionRef) => Effect.Effect - ( - self: SubscriptionRef, - fallback: B, - pf: (a: A) => Option.Option - ): Effect.Effect -} -``` - -Added in v2.0.0 - -## modifySomeEffect - -**Signature** - -```ts -export declare const modifySomeEffect: { - ( - fallback: B, - pf: (a: A) => Option.Option> - ): (self: SubscriptionRef) => Effect.Effect - ( - self: SubscriptionRef, - fallback: B, - pf: (a: A) => Option.Option> - ): Effect.Effect -} -``` - -Added in v2.0.0 - -## set - -**Signature** - -```ts -export declare const set: { - (value: A): (self: SubscriptionRef) => Effect.Effect - (self: SubscriptionRef, value: A): Effect.Effect -} -``` - -Added in v2.0.0 - -## setAndGet - -**Signature** - -```ts -export declare const setAndGet: { - (value: A): (self: SubscriptionRef) => Effect.Effect - (self: SubscriptionRef, value: A): Effect.Effect -} -``` - -Added in v2.0.0 - -## update - -**Signature** - -```ts -export declare const update: { - (f: (a: A) => A): (self: SubscriptionRef) => Effect.Effect - (self: SubscriptionRef, f: (a: A) => A): Effect.Effect -} -``` - -Added in v2.0.0 - -## updateAndGet - -**Signature** - -```ts -export declare const updateAndGet: { - (f: (a: A) => A): (self: SubscriptionRef) => Effect.Effect - (self: SubscriptionRef, f: (a: A) => A): Effect.Effect -} -``` - -Added in v2.0.0 - -## updateAndGetEffect - -**Signature** - -```ts -export declare const updateAndGetEffect: { - (f: (a: A) => Effect.Effect): (self: SubscriptionRef) => Effect.Effect - (self: SubscriptionRef, f: (a: A) => Effect.Effect): Effect.Effect -} -``` - -Added in v2.0.0 - -## updateEffect - -**Signature** - -```ts -export declare const updateEffect: { - (f: (a: A) => Effect.Effect): (self: SubscriptionRef) => Effect.Effect - (self: SubscriptionRef, f: (a: A) => Effect.Effect): Effect.Effect -} -``` - -Added in v2.0.0 - -## updateSome - -**Signature** - -```ts -export declare const updateSome: { - (f: (a: A) => Option.Option): (self: SubscriptionRef) => Effect.Effect - (self: SubscriptionRef, f: (a: A) => Option.Option): Effect.Effect -} -``` - -Added in v2.0.0 - -## updateSomeAndGet - -**Signature** - -```ts -export declare const updateSomeAndGet: { - (pf: (a: A) => Option.Option): (self: SubscriptionRef) => Effect.Effect - (self: SubscriptionRef, pf: (a: A) => Option.Option): Effect.Effect -} -``` - -Added in v2.0.0 - -## updateSomeAndGetEffect - -**Signature** - -```ts -export declare const updateSomeAndGetEffect: { - (pf: (a: A) => Option.Option>): (self: SubscriptionRef) => Effect.Effect - (self: SubscriptionRef, pf: (a: A) => Option.Option>): Effect.Effect -} -``` - -Added in v2.0.0 - -## updateSomeEffect - -**Signature** - -```ts -export declare const updateSomeEffect: { - ( - pf: (a: A) => Option.Option> - ): (self: SubscriptionRef) => Effect.Effect - (self: SubscriptionRef, pf: (a: A) => Option.Option>): Effect.Effect -} -``` - -Added in v2.0.0 diff --git a/docs/modules/Supervisor.ts.md b/docs/modules/Supervisor.ts.md deleted file mode 100644 index 148982c25..000000000 --- a/docs/modules/Supervisor.ts.md +++ /dev/null @@ -1,356 +0,0 @@ ---- -title: Supervisor.ts -nav_order: 114 -parent: Modules ---- - -## Supervisor overview - -A `Supervisor` is allowed to supervise the launching and termination of -fibers, producing some visible value of type `T` from the supervision. - -Added in v2.0.0 - ---- - -

Table of contents

- -- [constructors](#constructors) - - [AbstractSupervisor (class)](#abstractsupervisor-class) - - [onStart (method)](#onstart-method) - - [onEnd (method)](#onend-method) - - [onEffect (method)](#oneffect-method) - - [onSuspend (method)](#onsuspend-method) - - [onResume (method)](#onresume-method) - - [map (method)](#map-method) - - [zip (method)](#zip-method) - - [onRun (method)](#onrun-method) - - [value (property)](#value-property) - - [[SupervisorTypeId] (property)](#supervisortypeid-property) - - [fibersIn](#fibersin) - - [fromEffect](#fromeffect) - - [none](#none) - - [track](#track) -- [context](#context) - - [addSupervisor](#addsupervisor) -- [models](#models) - - [Supervisor (interface)](#supervisor-interface) -- [symbols](#symbols) - - [SupervisorTypeId](#supervisortypeid) - - [SupervisorTypeId (type alias)](#supervisortypeid-type-alias) -- [unsafe](#unsafe) - - [unsafeTrack](#unsafetrack) -- [utils](#utils) - - [Supervisor (namespace)](#supervisor-namespace) - - [Variance (interface)](#variance-interface) - ---- - -# constructors - -## AbstractSupervisor (class) - -**Signature** - -```ts -export declare class AbstractSupervisor -``` - -Added in v2.0.0 - -### onStart (method) - -**Signature** - -```ts -onStart( - _context: Context.Context, - _effect: Effect.Effect, - _parent: Option.Option>, - _fiber: Fiber.RuntimeFiber - ): void -``` - -Added in v2.0.0 - -### onEnd (method) - -**Signature** - -```ts -onEnd( - _value: Exit.Exit, - _fiber: Fiber.RuntimeFiber - ): void -``` - -Added in v2.0.0 - -### onEffect (method) - -**Signature** - -```ts -onEffect( - _fiber: Fiber.RuntimeFiber, - _effect: Effect.Effect - ): void -``` - -Added in v2.0.0 - -### onSuspend (method) - -**Signature** - -```ts -onSuspend( - _fiber: Fiber.RuntimeFiber - ): void -``` - -Added in v2.0.0 - -### onResume (method) - -**Signature** - -```ts -onResume( - _fiber: Fiber.RuntimeFiber - ): void -``` - -Added in v2.0.0 - -### map (method) - -**Signature** - -```ts -map(f: (a: T) => B): Supervisor -``` - -Added in v2.0.0 - -### zip (method) - -**Signature** - -```ts -zip
( - right: Supervisor - ): Supervisor<[T, A]> -``` - -Added in v2.0.0 - -### onRun (method) - -**Signature** - -```ts -onRun(execution: () => X, _fiber: Fiber.RuntimeFiber): X -``` - -Added in v2.0.0 - -### value (property) - -**Signature** - -```ts -value: Effect.Effect -``` - -Added in v2.0.0 - -### [SupervisorTypeId] (property) - -**Signature** - -```ts -readonly [SupervisorTypeId]: { _T: (_: never) => never; } -``` - -Added in v2.0.0 - -## fibersIn - -Creates a new supervisor that tracks children in a set. - -**Signature** - -```ts -export declare const fibersIn: ( - ref: MutableRef.MutableRef>> -) => Effect.Effect>>> -``` - -Added in v2.0.0 - -## fromEffect - -Creates a new supervisor that constantly yields effect when polled - -**Signature** - -```ts -export declare const fromEffect: (effect: Effect.Effect) => Supervisor -``` - -Added in v2.0.0 - -## none - -A supervisor that doesn't do anything in response to supervision events. - -**Signature** - -```ts -export declare const none: Supervisor -``` - -Added in v2.0.0 - -## track - -Creates a new supervisor that tracks children in a set. - -**Signature** - -```ts -export declare const track: Effect.Effect[]>> -``` - -Added in v2.0.0 - -# context - -## addSupervisor - -**Signature** - -```ts -export declare const addSupervisor: (supervisor: Supervisor) => Layer.Layer -``` - -Added in v2.0.0 - -# models - -## Supervisor (interface) - -**Signature** - -```ts -export interface Supervisor extends Supervisor.Variance { - /** - * Returns an `Effect` that succeeds with the value produced by this - * supervisor. This value may change over time, reflecting what the supervisor - * produces as it supervises fibers. - */ - readonly value: Effect.Effect - - /** - * Supervises the start of a `Fiber`. - */ - readonly onStart: ( - context: Context.Context, - effect: Effect.Effect, - parent: Option.Option>, - fiber: Fiber.RuntimeFiber - ) => void - - /** - * Supervises the end of a `Fiber`. - */ - readonly onEnd: (value: Exit.Exit, fiber: Fiber.RuntimeFiber) => void - - /** - * Supervises the execution of an `Effect` by a `Fiber`. - */ - readonly onEffect: (fiber: Fiber.RuntimeFiber, effect: Effect.Effect) => void - - /** - * Supervises the suspension of a computation running within a `Fiber`. - */ - readonly onSuspend: (fiber: Fiber.RuntimeFiber) => void - - /** - * Supervises the resumption of a computation running within a `Fiber`. - */ - readonly onResume: (fiber: Fiber.RuntimeFiber) => void - - /** - * Maps this supervisor to another one, which has the same effect, but whose - * value has been transformed by the specified function. - */ - readonly map: (f: (a: T) => B) => Supervisor - - /** - * Returns a new supervisor that performs the function of this supervisor, and - * the function of the specified supervisor, producing a tuple of the outputs - * produced by both supervisors. - */ - readonly zip: (right: Supervisor) => Supervisor<[T, A]> -} -``` - -Added in v2.0.0 - -# symbols - -## SupervisorTypeId - -**Signature** - -```ts -export declare const SupervisorTypeId: typeof SupervisorTypeId -``` - -Added in v2.0.0 - -## SupervisorTypeId (type alias) - -**Signature** - -```ts -export type SupervisorTypeId = typeof SupervisorTypeId -``` - -Added in v2.0.0 - -# unsafe - -## unsafeTrack - -Unsafely creates a new supervisor that tracks children in a set. - -**Signature** - -```ts -export declare const unsafeTrack: () => Supervisor>> -``` - -Added in v2.0.0 - -# utils - -## Supervisor (namespace) - -Added in v2.0.0 - -### Variance (interface) - -**Signature** - -```ts -export interface Variance { - readonly [SupervisorTypeId]: { - readonly _T: (_: never) => T - } -} -``` - -Added in v2.0.0 diff --git a/docs/modules/Symbol.ts.md b/docs/modules/Symbol.ts.md deleted file mode 100644 index 2afd33740..000000000 --- a/docs/modules/Symbol.ts.md +++ /dev/null @@ -1,55 +0,0 @@ ---- -title: Symbol.ts -nav_order: 115 -parent: Modules ---- - -## Symbol overview - -Added in v2.0.0 - ---- - -

Table of contents

- -- [guards](#guards) - - [isSymbol](#issymbol) -- [instances](#instances) - - [Equivalence](#equivalence) - ---- - -# guards - -## isSymbol - -Tests if a value is a `symbol`. - -**Signature** - -```ts -export declare const isSymbol: (u: unknown) => u is symbol -``` - -**Example** - -```ts -import { isSymbol } from "effect/Predicate" - -assert.deepStrictEqual(isSymbol(Symbol.for("a")), true) -assert.deepStrictEqual(isSymbol("a"), false) -``` - -Added in v2.0.0 - -# instances - -## Equivalence - -**Signature** - -```ts -export declare const Equivalence: equivalence.Equivalence -``` - -Added in v2.0.0 diff --git a/docs/modules/SynchronizedRef.ts.md b/docs/modules/SynchronizedRef.ts.md deleted file mode 100644 index e03715f64..000000000 --- a/docs/modules/SynchronizedRef.ts.md +++ /dev/null @@ -1,400 +0,0 @@ ---- -title: SynchronizedRef.ts -nav_order: 116 -parent: Modules ---- - -## SynchronizedRef overview - -Added in v2.0.0 - ---- - -

Table of contents

- -- [constructors](#constructors) - - [make](#make) -- [getters](#getters) - - [get](#get) -- [models](#models) - - [SynchronizedRef (interface)](#synchronizedref-interface) -- [symbols](#symbols) - - [SynchronizedRefTypeId](#synchronizedreftypeid) - - [SynchronizedRefTypeId (type alias)](#synchronizedreftypeid-type-alias) -- [unsafe](#unsafe) - - [unsafeMake](#unsafemake) -- [utils](#utils) - - [SynchronizedRef (namespace)](#synchronizedref-namespace) - - [Variance (interface)](#variance-interface) - - [getAndSet](#getandset) - - [getAndUpdate](#getandupdate) - - [getAndUpdateEffect](#getandupdateeffect) - - [getAndUpdateSome](#getandupdatesome) - - [getAndUpdateSomeEffect](#getandupdatesomeeffect) - - [modify](#modify) - - [modifyEffect](#modifyeffect) - - [modifySome](#modifysome) - - [modifySomeEffect](#modifysomeeffect) - - [set](#set) - - [setAndGet](#setandget) - - [update](#update) - - [updateAndGet](#updateandget) - - [updateAndGetEffect](#updateandgeteffect) - - [updateEffect](#updateeffect) - - [updateSome](#updatesome) - - [updateSomeAndGet](#updatesomeandget) - - [updateSomeAndGetEffect](#updatesomeandgeteffect) - - [updateSomeEffect](#updatesomeeffect) - ---- - -# constructors - -## make - -**Signature** - -```ts -export declare const make:
(value: A) => Effect.Effect> -``` - -Added in v2.0.0 - -# getters - -## get - -**Signature** - -```ts -export declare const get: (self: SynchronizedRef) => Effect.Effect -``` - -Added in v2.0.0 - -# models - -## SynchronizedRef (interface) - -**Signature** - -```ts -export interface SynchronizedRef extends SynchronizedRef.Variance, Ref.Ref { - readonly modifyEffect: (f: (a: A) => Effect.Effect) => Effect.Effect -} -``` - -Added in v2.0.0 - -# symbols - -## SynchronizedRefTypeId - -**Signature** - -```ts -export declare const SynchronizedRefTypeId: typeof SynchronizedRefTypeId -``` - -Added in v2.0.0 - -## SynchronizedRefTypeId (type alias) - -**Signature** - -```ts -export type SynchronizedRefTypeId = typeof SynchronizedRefTypeId -``` - -Added in v2.0.0 - -# unsafe - -## unsafeMake - -**Signature** - -```ts -export declare const unsafeMake: (value: A) => SynchronizedRef -``` - -Added in v2.0.0 - -# utils - -## SynchronizedRef (namespace) - -Added in v2.0.0 - -### Variance (interface) - -**Signature** - -```ts -export interface Variance { - readonly [SynchronizedRefTypeId]: { - readonly _A: (_: never) => A - } -} -``` - -Added in v2.0.0 - -## getAndSet - -**Signature** - -```ts -export declare const getAndSet: { - (value: A): (self: Ref.Ref) => Effect.Effect - (self: Ref.Ref, value: A): Effect.Effect -} -``` - -Added in v2.0.0 - -## getAndUpdate - -**Signature** - -```ts -export declare const getAndUpdate: { - (f: (a: A) => A): (self: Ref.Ref) => Effect.Effect - (self: Ref.Ref, f: (a: A) => A): Effect.Effect -} -``` - -Added in v2.0.0 - -## getAndUpdateEffect - -**Signature** - -```ts -export declare const getAndUpdateEffect: { - (f: (a: A) => Effect.Effect): (self: SynchronizedRef) => Effect.Effect - (self: SynchronizedRef, f: (a: A) => Effect.Effect): Effect.Effect -} -``` - -Added in v2.0.0 - -## getAndUpdateSome - -**Signature** - -```ts -export declare const getAndUpdateSome: { - (pf: (a: A) => Option.Option): (self: Ref.Ref) => Effect.Effect - (self: Ref.Ref, pf: (a: A) => Option.Option): Effect.Effect -} -``` - -Added in v2.0.0 - -## getAndUpdateSomeEffect - -**Signature** - -```ts -export declare const getAndUpdateSomeEffect: { - (pf: (a: A) => Option.Option>): (self: SynchronizedRef) => Effect.Effect - (self: SynchronizedRef, pf: (a: A) => Option.Option>): Effect.Effect -} -``` - -Added in v2.0.0 - -## modify - -**Signature** - -```ts -export declare const modify: { - (f: (a: A) => readonly [B, A]): (self: SynchronizedRef) => Effect.Effect - (self: SynchronizedRef, f: (a: A) => readonly [B, A]): Effect.Effect -} -``` - -Added in v2.0.0 - -## modifyEffect - -**Signature** - -```ts -export declare const modifyEffect: { - (f: (a: A) => Effect.Effect): (self: SynchronizedRef) => Effect.Effect - (self: SynchronizedRef, f: (a: A) => Effect.Effect): Effect.Effect -} -``` - -Added in v2.0.0 - -## modifySome - -**Signature** - -```ts -export declare const modifySome: { - ( - fallback: B, - pf: (a: A) => Option.Option - ): (self: Ref.Ref) => Effect.Effect - (self: Ref.Ref, fallback: B, pf: (a: A) => Option.Option): Effect.Effect -} -``` - -Added in v2.0.0 - -## modifySomeEffect - -**Signature** - -```ts -export declare const modifySomeEffect: { - ( - fallback: B, - pf: (a: A) => Option.Option> - ): (self: SynchronizedRef) => Effect.Effect - ( - self: SynchronizedRef, - fallback: B, - pf: (a: A) => Option.Option> - ): Effect.Effect -} -``` - -Added in v2.0.0 - -## set - -**Signature** - -```ts -export declare const set: { - (value: A): (self: Ref.Ref) => Effect.Effect - (self: Ref.Ref, value: A): Effect.Effect -} -``` - -Added in v2.0.0 - -## setAndGet - -**Signature** - -```ts -export declare const setAndGet: { - (value: A): (self: Ref.Ref) => Effect.Effect - (self: Ref.Ref, value: A): Effect.Effect -} -``` - -Added in v2.0.0 - -## update - -**Signature** - -```ts -export declare const update: { - (f: (a: A) => A): (self: Ref.Ref) => Effect.Effect - (self: Ref.Ref, f: (a: A) => A): Effect.Effect -} -``` - -Added in v2.0.0 - -## updateAndGet - -**Signature** - -```ts -export declare const updateAndGet: { - (f: (a: A) => A): (self: Ref.Ref) => Effect.Effect - (self: Ref.Ref, f: (a: A) => A): Effect.Effect -} -``` - -Added in v2.0.0 - -## updateAndGetEffect - -**Signature** - -```ts -export declare const updateAndGetEffect: { - (f: (a: A) => Effect.Effect): (self: SynchronizedRef) => Effect.Effect - (self: SynchronizedRef, f: (a: A) => Effect.Effect): Effect.Effect -} -``` - -Added in v2.0.0 - -## updateEffect - -**Signature** - -```ts -export declare const updateEffect: { - (f: (a: A) => Effect.Effect): (self: SynchronizedRef) => Effect.Effect - (self: SynchronizedRef, f: (a: A) => Effect.Effect): Effect.Effect -} -``` - -Added in v2.0.0 - -## updateSome - -**Signature** - -```ts -export declare const updateSome: { - (f: (a: A) => Option.Option): (self: Ref.Ref) => Effect.Effect - (self: Ref.Ref, f: (a: A) => Option.Option): Effect.Effect -} -``` - -Added in v2.0.0 - -## updateSomeAndGet - -**Signature** - -```ts -export declare const updateSomeAndGet: { - (pf: (a: A) => Option.Option): (self: Ref.Ref) => Effect.Effect - (self: Ref.Ref, pf: (a: A) => Option.Option): Effect.Effect -} -``` - -Added in v2.0.0 - -## updateSomeAndGetEffect - -**Signature** - -```ts -export declare const updateSomeAndGetEffect: { - (pf: (a: A) => Option.Option>): (self: SynchronizedRef) => Effect.Effect - (self: SynchronizedRef, pf: (a: A) => Option.Option>): Effect.Effect -} -``` - -Added in v2.0.0 - -## updateSomeEffect - -**Signature** - -```ts -export declare const updateSomeEffect: { - ( - pf: (a: A) => Option.Option> - ): (self: SynchronizedRef) => Effect.Effect - (self: SynchronizedRef, pf: (a: A) => Option.Option>): Effect.Effect -} -``` - -Added in v2.0.0 diff --git a/docs/modules/TArray.ts.md b/docs/modules/TArray.ts.md deleted file mode 100644 index 775edb0fe..000000000 --- a/docs/modules/TArray.ts.md +++ /dev/null @@ -1,732 +0,0 @@ ---- -title: TArray.ts -nav_order: 118 -parent: Modules ---- - -## TArray overview - -Added in v2.0.0 - ---- - -

Table of contents

- -- [constructors](#constructors) - - [empty](#empty) - - [fromIterable](#fromiterable) - - [make](#make) -- [destructors](#destructors) - - [toArray](#toarray) -- [elements](#elements) - - [collectFirst](#collectfirst) - - [collectFirstSTM](#collectfirststm) - - [contains](#contains) - - [every](#every) - - [everySTM](#everystm) - - [findFirst](#findfirst) - - [findFirstIndex](#findfirstindex) - - [findFirstIndexFrom](#findfirstindexfrom) - - [findFirstIndexWhere](#findfirstindexwhere) - - [findFirstIndexWhereFrom](#findfirstindexwherefrom) - - [findFirstIndexWhereFromSTM](#findfirstindexwherefromstm) - - [findFirstIndexWhereSTM](#findfirstindexwherestm) - - [findFirstSTM](#findfirststm) - - [findLast](#findlast) - - [findLastIndex](#findlastindex) - - [findLastIndexFrom](#findlastindexfrom) - - [findLastSTM](#findlaststm) - - [forEach](#foreach) - - [get](#get) - - [headOption](#headoption) - - [lastOption](#lastoption) - - [maxOption](#maxoption) - - [minOption](#minoption) - - [reduceOption](#reduceoption) - - [reduceOptionSTM](#reduceoptionstm) - - [some](#some) - - [someSTM](#somestm) - - [transform](#transform) - - [transformSTM](#transformstm) - - [update](#update) - - [updateSTM](#updatestm) -- [folding](#folding) - - [count](#count) - - [countSTM](#countstm) - - [reduce](#reduce) - - [reduceSTM](#reducestm) -- [getters](#getters) - - [size](#size) -- [models](#models) - - [TArray (interface)](#tarray-interface) -- [symbols](#symbols) - - [TArrayTypeId](#tarraytypeid) - - [TArrayTypeId (type alias)](#tarraytypeid-type-alias) -- [utils](#utils) - - [TArray (namespace)](#tarray-namespace) - - [Variance (interface)](#variance-interface) - ---- - -# constructors - -## empty - -Makes an empty `TArray`. - -**Signature** - -```ts -export declare const empty:
() => STM.STM> -``` - -Added in v2.0.0 - -## fromIterable - -Makes a new `TArray` initialized with provided iterable. - -**Signature** - -```ts -export declare const fromIterable: (iterable: Iterable) => STM.STM> -``` - -Added in v2.0.0 - -## make - -Makes a new `TArray` that is initialized with specified values. - -**Signature** - -```ts -export declare const make: ( - ...elements: Elements -) => STM.STM> -``` - -Added in v2.0.0 - -# destructors - -## toArray - -Collects all elements into a chunk. - -**Signature** - -```ts -export declare const toArray: (self: TArray) => STM.STM -``` - -Added in v2.0.0 - -# elements - -## collectFirst - -Finds the result of applying a partial function to the first value in its -domain. - -**Signature** - -```ts -export declare const collectFirst: { - (pf: (a: A) => Option.Option): (self: TArray) => STM.STM> - (self: TArray, pf: (a: A) => Option.Option): STM.STM> -} -``` - -Added in v2.0.0 - -## collectFirstSTM - -Finds the result of applying an transactional partial function to the first -value in its domain. - -**Signature** - -```ts -export declare const collectFirstSTM: { - (pf: (a: A) => Option.Option>): (self: TArray) => STM.STM> - (self: TArray, pf: (a: A) => Option.Option>): STM.STM> -} -``` - -Added in v2.0.0 - -## contains - -Determine if the array contains a specified value. - -**Signature** - -```ts -export declare const contains: { - (value: A): (self: TArray) => STM.STM - (self: TArray, value: A): STM.STM -} -``` - -Added in v2.0.0 - -## every - -Atomically evaluate the conjunction of a predicate across the members of -the array. - -**Signature** - -```ts -export declare const every: { - (predicate: Predicate): (self: TArray) => STM.STM - (self: TArray, predicate: Predicate): STM.STM -} -``` - -Added in v2.0.0 - -## everySTM - -Atomically evaluate the conjunction of a transactional predicate across the -members of the array. - -**Signature** - -```ts -export declare const everySTM: { - (predicate: (value: A) => STM.STM): (self: TArray) => STM.STM - (self: TArray, predicate: (value: A) => STM.STM): STM.STM -} -``` - -Added in v2.0.0 - -## findFirst - -Find the first element in the array matching the specified predicate. - -**Signature** - -```ts -export declare const findFirst: { - (predicate: Predicate): (self: TArray) => STM.STM> - (self: TArray, predicate: Predicate): STM.STM> -} -``` - -Added in v2.0.0 - -## findFirstIndex - -Get the first index of a specific value in the array. - -**Signature** - -```ts -export declare const findFirstIndex: { - (value: A): (self: TArray) => STM.STM> - (self: TArray, value: A): STM.STM> -} -``` - -Added in v2.0.0 - -## findFirstIndexFrom - -Get the first index of a specific value in the array starting from the -specified index. - -**Signature** - -```ts -export declare const findFirstIndexFrom: { - (value: A, from: number): (self: TArray) => STM.STM> - (self: TArray, value: A, from: number): STM.STM> -} -``` - -Added in v2.0.0 - -## findFirstIndexWhere - -Get the index of the first entry in the array matching a predicate. - -**Signature** - -```ts -export declare const findFirstIndexWhere: { - (predicate: Predicate): (self: TArray) => STM.STM> - (self: TArray, predicate: Predicate): STM.STM> -} -``` - -Added in v2.0.0 - -## findFirstIndexWhereFrom - -Get the index of the first entry in the array starting from the specified -index, matching a predicate. - -**Signature** - -```ts -export declare const findFirstIndexWhereFrom: { - (predicate: Predicate, from: number): (self: TArray) => STM.STM> - (self: TArray, predicate: Predicate, from: number): STM.STM> -} -``` - -Added in v2.0.0 - -## findFirstIndexWhereFromSTM - -Starting at specified index, get the index of the next entry that matches a -transactional predicate. - -**Signature** - -```ts -export declare const findFirstIndexWhereFromSTM: { - ( - predicate: (value: A) => STM.STM, - from: number - ): (self: TArray) => STM.STM> - ( - self: TArray, - predicate: (value: A) => STM.STM, - from: number - ): STM.STM> -} -``` - -Added in v2.0.0 - -## findFirstIndexWhereSTM - -Get the index of the next entry that matches a transactional predicate. - -**Signature** - -```ts -export declare const findFirstIndexWhereSTM: { - (predicate: (value: A) => STM.STM): (self: TArray) => STM.STM> - (self: TArray, predicate: (value: A) => STM.STM): STM.STM> -} -``` - -Added in v2.0.0 - -## findFirstSTM - -Find the first element in the array matching a transactional predicate. - -**Signature** - -```ts -export declare const findFirstSTM: { - (predicate: (value: A) => STM.STM): (self: TArray) => STM.STM> - (self: TArray, predicate: (value: A) => STM.STM): STM.STM> -} -``` - -Added in v2.0.0 - -## findLast - -Find the last element in the array matching a predicate. - -**Signature** - -```ts -export declare const findLast: { - (predicate: Predicate): (self: TArray) => STM.STM> - (self: TArray, predicate: Predicate): STM.STM> -} -``` - -Added in v2.0.0 - -## findLastIndex - -Get the last index of a specific value in the array bounded above by a -specific index. - -**Signature** - -```ts -export declare const findLastIndex: { - (value: A): (self: TArray) => STM.STM> - (self: TArray, value: A): STM.STM> -} -``` - -Added in v2.0.0 - -## findLastIndexFrom - -Get the last index of a specific value in the array bounded above by a -specific index. - -**Signature** - -```ts -export declare const findLastIndexFrom: { - (value: A, end: number): (self: TArray) => STM.STM> - (self: TArray, value: A, end: number): STM.STM> -} -``` - -Added in v2.0.0 - -## findLastSTM - -Find the last element in the array matching a transactional predicate. - -**Signature** - -```ts -export declare const findLastSTM: { - (predicate: (value: A) => STM.STM): (self: TArray) => STM.STM> - (self: TArray, predicate: (value: A) => STM.STM): STM.STM> -} -``` - -Added in v2.0.0 - -## forEach - -Atomically performs transactional effect for each item in array. - -**Signature** - -```ts -export declare const forEach: { - (f: (value: A) => STM.STM): (self: TArray) => STM.STM - (self: TArray, f: (value: A) => STM.STM): STM.STM -} -``` - -Added in v2.0.0 - -## get - -Extracts value from ref in array. - -**Signature** - -```ts -export declare const get: { - (index: number): (self: TArray) => STM.STM - (self: TArray, index: number): STM.STM -} -``` - -Added in v2.0.0 - -## headOption - -The first entry of the array, if it exists. - -**Signature** - -```ts -export declare const headOption: (self: TArray) => STM.STM> -``` - -Added in v2.0.0 - -## lastOption - -The last entry in the array, if it exists. - -**Signature** - -```ts -export declare const lastOption: (self: TArray) => STM.STM> -``` - -Added in v2.0.0 - -## maxOption - -Atomically compute the greatest element in the array, if it exists. - -**Signature** - -```ts -export declare const maxOption: { - (order: Order.Order): (self: TArray) => STM.STM> - (self: TArray, order: Order.Order): STM.STM> -} -``` - -Added in v2.0.0 - -## minOption - -Atomically compute the least element in the array, if it exists. - -**Signature** - -```ts -export declare const minOption: { - (order: Order.Order): (self: TArray) => STM.STM> - (self: TArray, order: Order.Order): STM.STM> -} -``` - -Added in v2.0.0 - -## reduceOption - -Atomically reduce the array, if non-empty, by a binary operator. - -**Signature** - -```ts -export declare const reduceOption: { - (f: (x: A, y: A) => A): (self: TArray) => STM.STM> - (self: TArray, f: (x: A, y: A) => A): STM.STM> -} -``` - -Added in v2.0.0 - -## reduceOptionSTM - -Atomically reduce the non-empty array using a transactional binary -operator. - -**Signature** - -```ts -export declare const reduceOptionSTM: { - (f: (x: A, y: A) => STM.STM): (self: TArray) => STM.STM> - (self: TArray, f: (x: A, y: A) => STM.STM): STM.STM> -} -``` - -Added in v2.0.0 - -## some - -Determine if the array contains a value satisfying a predicate. - -**Signature** - -```ts -export declare const some: { - (predicate: Predicate): (self: TArray) => STM.STM - (self: TArray, predicate: Predicate): STM.STM -} -``` - -Added in v2.0.0 - -## someSTM - -Determine if the array contains a value satisfying a transactional -predicate. - -**Signature** - -```ts -export declare const someSTM: { - (predicate: (value: A) => STM.STM): (self: TArray) => STM.STM - (self: TArray, predicate: (value: A) => STM.STM): STM.STM -} -``` - -Added in v2.0.0 - -## transform - -Atomically updates all elements using a pure function. - -**Signature** - -```ts -export declare const transform: { - (f: (value: A) => A): (self: TArray) => STM.STM - (self: TArray, f: (value: A) => A): STM.STM -} -``` - -Added in v2.0.0 - -## transformSTM - -Atomically updates all elements using a transactional effect. - -**Signature** - -```ts -export declare const transformSTM: { - (f: (value: A) => STM.STM): (self: TArray) => STM.STM - (self: TArray, f: (value: A) => STM.STM): STM.STM -} -``` - -Added in v2.0.0 - -## update - -Updates element in the array with given function. - -**Signature** - -```ts -export declare const update: { - (index: number, f: (value: A) => A): (self: TArray) => STM.STM - (self: TArray, index: number, f: (value: A) => A): STM.STM -} -``` - -Added in v2.0.0 - -## updateSTM - -Atomically updates element in the array with given transactional effect. - -**Signature** - -```ts -export declare const updateSTM: { - (index: number, f: (value: A) => STM.STM): (self: TArray) => STM.STM - (self: TArray, index: number, f: (value: A) => STM.STM): STM.STM -} -``` - -Added in v2.0.0 - -# folding - -## count - -Count the values in the array matching a predicate. - -**Signature** - -```ts -export declare const count: { - (predicate: Predicate): (self: TArray) => STM.STM - (self: TArray, predicate: Predicate): STM.STM -} -``` - -Added in v2.0.0 - -## countSTM - -Count the values in the array matching a transactional predicate. - -**Signature** - -```ts -export declare const countSTM: { - (predicate: (value: A) => STM.STM): (self: TArray) => STM.STM - (self: TArray, predicate: (value: A) => STM.STM): STM.STM -} -``` - -Added in v2.0.0 - -## reduce - -Atomically folds using a pure function. - -**Signature** - -```ts -export declare const reduce: { - (zero: Z, f: (accumulator: Z, current: A) => Z): (self: TArray) => STM.STM - (self: TArray, zero: Z, f: (accumulator: Z, current: A) => Z): STM.STM -} -``` - -Added in v2.0.0 - -## reduceSTM - -Atomically folds using a transactional function. - -**Signature** - -```ts -export declare const reduceSTM: { - (zero: Z, f: (accumulator: Z, current: A) => STM.STM): (self: TArray) => STM.STM - (self: TArray, zero: Z, f: (accumulator: Z, current: A) => STM.STM): STM.STM -} -``` - -Added in v2.0.0 - -# getters - -## size - -Returns the size of the `TArray`. - -**Signature** - -```ts -export declare const size: (self: TArray) => number -``` - -Added in v2.0.0 - -# models - -## TArray (interface) - -**Signature** - -```ts -export interface TArray extends TArray.Variance {} -``` - -Added in v2.0.0 - -# symbols - -## TArrayTypeId - -**Signature** - -```ts -export declare const TArrayTypeId: typeof TArrayTypeId -``` - -Added in v2.0.0 - -## TArrayTypeId (type alias) - -**Signature** - -```ts -export type TArrayTypeId = typeof TArrayTypeId -``` - -Added in v2.0.0 - -# utils - -## TArray (namespace) - -Added in v2.0.0 - -### Variance (interface) - -**Signature** - -```ts -export interface Variance { - readonly [TArrayTypeId]: { - readonly _A: (_: never) => A - } -} -``` - -Added in v2.0.0 diff --git a/docs/modules/TDeferred.ts.md b/docs/modules/TDeferred.ts.md deleted file mode 100644 index de6151562..000000000 --- a/docs/modules/TDeferred.ts.md +++ /dev/null @@ -1,163 +0,0 @@ ---- -title: TDeferred.ts -nav_order: 119 -parent: Modules ---- - -## TDeferred overview - -Added in v2.0.0 - ---- - -

Table of contents

- -- [constructors](#constructors) - - [make](#make) -- [getters](#getters) - - [await](#await) - - [poll](#poll) -- [models](#models) - - [TDeferred (interface)](#tdeferred-interface) -- [mutations](#mutations) - - [done](#done) - - [fail](#fail) - - [succeed](#succeed) -- [symbols](#symbols) - - [TDeferredTypeId](#tdeferredtypeid) - - [TDeferredTypeId (type alias)](#tdeferredtypeid-type-alias) -- [utils](#utils) - - [TDeferred (namespace)](#tdeferred-namespace) - - [Variance (interface)](#variance-interface) - ---- - -# constructors - -## make - -**Signature** - -```ts -export declare const make: () => STM.STM> -``` - -Added in v2.0.0 - -# getters - -## await - -**Signature** - -```ts -export declare const await: (self: TDeferred) => STM.STM -``` - -Added in v2.0.0 - -## poll - -**Signature** - -```ts -export declare const poll: (self: TDeferred) => STM.STM>> -``` - -Added in v2.0.0 - -# models - -## TDeferred (interface) - -**Signature** - -```ts -export interface TDeferred extends TDeferred.Variance {} -``` - -Added in v2.0.0 - -# mutations - -## done - -**Signature** - -```ts -export declare const done: { - (either: Either.Either): (self: TDeferred) => STM.STM - (self: TDeferred, either: Either.Either): STM.STM -} -``` - -Added in v2.0.0 - -## fail - -**Signature** - -```ts -export declare const fail: { - (error: E):
(self: TDeferred) => STM.STM - (self: TDeferred, error: E): STM.STM -} -``` - -Added in v2.0.0 - -## succeed - -**Signature** - -```ts -export declare const succeed: { - (value: A): (self: TDeferred) => STM.STM - (self: TDeferred, value: A): STM.STM -} -``` - -Added in v2.0.0 - -# symbols - -## TDeferredTypeId - -**Signature** - -```ts -export declare const TDeferredTypeId: typeof TDeferredTypeId -``` - -Added in v2.0.0 - -## TDeferredTypeId (type alias) - -**Signature** - -```ts -export type TDeferredTypeId = typeof TDeferredTypeId -``` - -Added in v2.0.0 - -# utils - -## TDeferred (namespace) - -Added in v2.0.0 - -### Variance (interface) - -**Signature** - -```ts -export interface Variance { - readonly [TDeferredTypeId]: { - readonly _E: (_: never) => E - readonly _A: (_: never) => A - } -} -``` - -Added in v2.0.0 diff --git a/docs/modules/TMap.ts.md b/docs/modules/TMap.ts.md deleted file mode 100644 index 1193a98a2..000000000 --- a/docs/modules/TMap.ts.md +++ /dev/null @@ -1,721 +0,0 @@ ---- -title: TMap.ts -nav_order: 129 -parent: Modules ---- - -## TMap overview - -Added in v2.0.0 - ---- - -

Table of contents

- -- [constructors](#constructors) - - [empty](#empty) - - [fromIterable](#fromiterable) - - [make](#make) -- [destructors](#destructors) - - [toArray](#toarray) - - [toChunk](#tochunk) - - [toHashMap](#tohashmap) - - [toMap](#tomap) -- [elements](#elements) - - [find](#find) - - [findAll](#findall) - - [findAllSTM](#findallstm) - - [findSTM](#findstm) - - [forEach](#foreach) - - [get](#get) - - [getOrElse](#getorelse) - - [has](#has) - - [keys](#keys) - - [values](#values) -- [folding](#folding) - - [reduce](#reduce) - - [reduceSTM](#reducestm) -- [getters](#getters) - - [isEmpty](#isempty) - - [size](#size) -- [models](#models) - - [TMap (interface)](#tmap-interface) -- [mutations](#mutations) - - [merge](#merge) - - [remove](#remove) - - [removeAll](#removeall) - - [removeIf](#removeif) - - [retainIf](#retainif) - - [set](#set) - - [setIfAbsent](#setifabsent) - - [takeFirst](#takefirst) - - [takeFirstSTM](#takefirststm) - - [takeSome](#takesome) - - [takeSomeSTM](#takesomestm) - - [transform](#transform) - - [transformSTM](#transformstm) - - [transformValues](#transformvalues) - - [transformValuesSTM](#transformvaluesstm) - - [updateWith](#updatewith) -- [symbols](#symbols) - - [TMapTypeId](#tmaptypeid) - - [TMapTypeId (type alias)](#tmaptypeid-type-alias) -- [utils](#utils) - - [TMap (namespace)](#tmap-namespace) - - [Variance (interface)](#variance-interface) - ---- - -# constructors - -## empty - -Makes an empty `TMap`. - -**Signature** - -```ts -export declare const empty: () => STM.STM> -``` - -Added in v2.0.0 - -## fromIterable - -Makes a new `TMap` initialized with provided iterable. - -**Signature** - -```ts -export declare const fromIterable: (iterable: Iterable) => STM.STM> -``` - -Added in v2.0.0 - -## make - -Makes a new `TMap` that is initialized with specified values. - -**Signature** - -```ts -export declare const make: (...entries: (readonly [K, V])[]) => STM.STM> -``` - -Added in v2.0.0 - -# destructors - -## toArray - -Collects all bindings into an `Array`. - -**Signature** - -```ts -export declare const toArray: (self: TMap) => STM.STM -``` - -Added in v2.0.0 - -## toChunk - -Collects all bindings into a `Chunk`. - -**Signature** - -```ts -export declare const toChunk: (self: TMap) => STM.STM> -``` - -Added in v2.0.0 - -## toHashMap - -Collects all bindings into a `HashMap`. - -**Signature** - -```ts -export declare const toHashMap: (self: TMap) => STM.STM> -``` - -Added in v2.0.0 - -## toMap - -Collects all bindings into a `Map`. - -**Signature** - -```ts -export declare const toMap: (self: TMap) => STM.STM> -``` - -Added in v2.0.0 - -# elements - -## find - -Finds the key/value pair matching the specified predicate, and uses the -provided function to extract a value out of it. - -**Signature** - -```ts -export declare const find: { - (pf: (key: K, value: V) => Option.Option
): (self: TMap) => STM.STM> - (self: TMap, pf: (key: K, value: V) => Option.Option): STM.STM> -} -``` - -Added in v2.0.0 - -## findAll - -Finds all the key/value pairs matching the specified predicate, and uses -the provided function to extract values out them. - -**Signature** - -```ts -export declare const findAll: { - (pf: (key: K, value: V) => Option.Option): (self: TMap) => STM.STM - (self: TMap, pf: (key: K, value: V) => Option.Option): STM.STM -} -``` - -Added in v2.0.0 - -## findAllSTM - -Finds all the key/value pairs matching the specified predicate, and uses -the provided effectful function to extract values out of them.. - -**Signature** - -```ts -export declare const findAllSTM: { - (pf: (key: K, value: V) => STM.STM, A>): (self: TMap) => STM.STM - (self: TMap, pf: (key: K, value: V) => STM.STM, A>): STM.STM -} -``` - -Added in v2.0.0 - -## findSTM - -Finds the key/value pair matching the specified predicate, and uses the -provided effectful function to extract a value out of it. - -**Signature** - -```ts -export declare const findSTM: { - ( - f: (key: K, value: V) => STM.STM, A> - ): (self: TMap) => STM.STM> - ( - self: TMap, - f: (key: K, value: V) => STM.STM, A> - ): STM.STM> -} -``` - -Added in v2.0.0 - -## forEach - -Atomically performs transactional-effect for each binding present in map. - -**Signature** - -```ts -export declare const forEach: { - (f: (key: K, value: V) => STM.STM): (self: TMap) => STM.STM - (self: TMap, f: (key: K, value: V) => STM.STM): STM.STM -} -``` - -Added in v2.0.0 - -## get - -Retrieves value associated with given key. - -**Signature** - -```ts -export declare const get: { - (key: K): (self: TMap) => STM.STM> - (self: TMap, key: K): STM.STM> -} -``` - -Added in v2.0.0 - -## getOrElse - -Retrieves value associated with given key or default value, in case the key -isn't present. - -**Signature** - -```ts -export declare const getOrElse: { - (key: K, fallback: LazyArg): (self: TMap) => STM.STM - (self: TMap, key: K, fallback: LazyArg): STM.STM -} -``` - -Added in v2.0.0 - -## has - -Tests whether or not map contains a key. - -**Signature** - -```ts -export declare const has: { - (key: K): (self: TMap) => STM.STM - (self: TMap, key: K): STM.STM -} -``` - -Added in v2.0.0 - -## keys - -Collects all keys stored in map. - -**Signature** - -```ts -export declare const keys: (self: TMap) => STM.STM -``` - -Added in v2.0.0 - -## values - -Collects all values stored in map. - -**Signature** - -```ts -export declare const values: (self: TMap) => STM.STM -``` - -Added in v2.0.0 - -# folding - -## reduce - -Atomically folds using a pure function. - -**Signature** - -```ts -export declare const reduce: { - (zero: Z, f: (acc: Z, value: V, key: K) => Z): (self: TMap) => STM.STM - (self: TMap, zero: Z, f: (acc: Z, value: V, key: K) => Z): STM.STM -} -``` - -Added in v2.0.0 - -## reduceSTM - -Atomically folds using a transactional function. - -**Signature** - -```ts -export declare const reduceSTM: { - (zero: Z, f: (acc: Z, value: V, key: K) => STM.STM): (self: TMap) => STM.STM - (self: TMap, zero: Z, f: (acc: Z, value: V, key: K) => STM.STM): STM.STM -} -``` - -Added in v2.0.0 - -# getters - -## isEmpty - -Tests if the map is empty or not. - -**Signature** - -```ts -export declare const isEmpty: (self: TMap) => STM.STM -``` - -Added in v2.0.0 - -## size - -Returns the number of bindings. - -**Signature** - -```ts -export declare const size: (self: TMap) => STM.STM -``` - -Added in v2.0.0 - -# models - -## TMap (interface) - -Transactional map implemented on top of `TRef` and `TArray`. Resolves -conflicts via chaining. - -**Signature** - -```ts -export interface TMap extends TMap.Variance {} -``` - -Added in v2.0.0 - -# mutations - -## merge - -If the key is not already associated with a value, stores the provided value, -otherwise merge the existing value with the new one using function `f` and -store the result. - -**Signature** - -```ts -export declare const merge: { - (key: K, value: V, f: (x: V, y: V) => V): (self: TMap) => STM.STM - (self: TMap, key: K, value: V, f: (x: V, y: V) => V): STM.STM -} -``` - -Added in v2.0.0 - -## remove - -Removes binding for given key. - -**Signature** - -```ts -export declare const remove: { - (key: K): (self: TMap) => STM.STM - (self: TMap, key: K): STM.STM -} -``` - -Added in v2.0.0 - -## removeAll - -Deletes all entries associated with the specified keys. - -**Signature** - -```ts -export declare const removeAll: { - (keys: Iterable): (self: TMap) => STM.STM - (self: TMap, keys: Iterable): STM.STM -} -``` - -Added in v2.0.0 - -## removeIf - -Removes entries from a `TMap` that satisfy the specified predicate and returns the removed entries -(or `void` if `discard = true`). - -**Signature** - -```ts -export declare const removeIf: { - ( - predicate: (key: K, value: V) => boolean, - options: { readonly discard: true } - ): (self: TMap) => STM.STM - ( - predicate: (key: K, value: V) => boolean, - options?: { readonly discard: false } - ): (self: TMap) => STM.STM - ( - self: TMap, - predicate: (key: K, value: V) => boolean, - options: { readonly discard: true } - ): STM.STM - ( - self: TMap, - predicate: (key: K, value: V) => boolean, - options?: { readonly discard: false } - ): STM.STM -} -``` - -Added in v2.0.0 - -## retainIf - -Retains entries in a `TMap` that satisfy the specified predicate and returns the removed entries -(or `void` if `discard = true`). - -**Signature** - -```ts -export declare const retainIf: { - ( - predicate: (key: K, value: V) => boolean, - options: { readonly discard: true } - ): (self: TMap) => STM.STM - ( - predicate: (key: K, value: V) => boolean, - options?: { readonly discard: false } - ): (self: TMap) => STM.STM - ( - self: TMap, - predicate: (key: K, value: V) => boolean, - options: { readonly discard: true } - ): STM.STM - ( - self: TMap, - predicate: (key: K, value: V) => boolean, - options?: { readonly discard: false } - ): STM.STM -} -``` - -Added in v2.0.0 - -## set - -Stores new binding into the map. - -**Signature** - -```ts -export declare const set: { - (key: K, value: V): (self: TMap) => STM.STM - (self: TMap, key: K, value: V): STM.STM -} -``` - -Added in v2.0.0 - -## setIfAbsent - -Stores new binding in the map if it does not already exist. - -**Signature** - -```ts -export declare const setIfAbsent: { - (key: K, value: V): (self: TMap) => STM.STM - (self: TMap, key: K, value: V): STM.STM -} -``` - -Added in v2.0.0 - -## takeFirst - -Takes the first matching value, or retries until there is one. - -**Signature** - -```ts -export declare const takeFirst: { - (pf: (key: K, value: V) => Option.Option): (self: TMap) => STM.STM - (self: TMap, pf: (key: K, value: V) => Option.Option): STM.STM -} -``` - -Added in v2.0.0 - -## takeFirstSTM - -Takes the first matching value, or retries until there is one. - -**Signature** - -```ts -export declare const takeFirstSTM: { - (pf: (key: K, value: V) => STM.STM, A>): (self: TMap) => STM.STM - (self: TMap, pf: (key: K, value: V) => STM.STM, A>): STM.STM -} -``` - -Added in v2.0.0 - -## takeSome - -Takes all matching values, or retries until there is at least one. - -**Signature** - -```ts -export declare const takeSome: { - (pf: (key: K, value: V) => Option.Option): (self: TMap) => STM.STM - (self: TMap, pf: (key: K, value: V) => Option.Option): STM.STM -} -``` - -Added in v2.0.0 - -## takeSomeSTM - -Takes all matching values, or retries until there is at least one. - -**Signature** - -```ts -export declare const takeSomeSTM: { - ( - pf: (key: K, value: V) => STM.STM, A> - ): (self: TMap) => STM.STM - ( - self: TMap, - pf: (key: K, value: V) => STM.STM, A> - ): STM.STM -} -``` - -Added in v2.0.0 - -## transform - -Atomically updates all bindings using a pure function. - -**Signature** - -```ts -export declare const transform: { - (f: (key: K, value: V) => readonly [K, V]): (self: TMap) => STM.STM - (self: TMap, f: (key: K, value: V) => readonly [K, V]): STM.STM -} -``` - -Added in v2.0.0 - -## transformSTM - -Atomically updates all bindings using a transactional function. - -**Signature** - -```ts -export declare const transformSTM: { - (f: (key: K, value: V) => STM.STM): (self: TMap) => STM.STM - (self: TMap, f: (key: K, value: V) => STM.STM): STM.STM -} -``` - -Added in v2.0.0 - -## transformValues - -Atomically updates all values using a pure function. - -**Signature** - -```ts -export declare const transformValues: { - (f: (value: V) => V): (self: TMap) => STM.STM - (self: TMap, f: (value: V) => V): STM.STM -} -``` - -Added in v2.0.0 - -## transformValuesSTM - -Atomically updates all values using a transactional function. - -**Signature** - -```ts -export declare const transformValuesSTM: { - (f: (value: V) => STM.STM): (self: TMap) => STM.STM - (self: TMap, f: (value: V) => STM.STM): STM.STM -} -``` - -Added in v2.0.0 - -## updateWith - -Updates the mapping for the specified key with the specified function, -which takes the current value of the key as an input, if it exists, and -either returns `Some` with a new value to indicate to update the value in -the map or `None` to remove the value from the map. Returns `Some` with the -updated value or `None` if the value was removed from the map. - -**Signature** - -```ts -export declare const updateWith: { - ( - key: K, - f: (value: Option.Option) => Option.Option - ): (self: TMap) => STM.STM> - ( - self: TMap, - key: K, - f: (value: Option.Option) => Option.Option - ): STM.STM> -} -``` - -Added in v2.0.0 - -# symbols - -## TMapTypeId - -**Signature** - -```ts -export declare const TMapTypeId: typeof TMapTypeId -``` - -Added in v2.0.0 - -## TMapTypeId (type alias) - -**Signature** - -```ts -export type TMapTypeId = typeof TMapTypeId -``` - -Added in v2.0.0 - -# utils - -## TMap (namespace) - -Added in v2.0.0 - -### Variance (interface) - -**Signature** - -```ts -export interface Variance { - readonly [TMapTypeId]: { - readonly _K: (_: never) => K - readonly _V: (_: never) => V - } -} -``` - -Added in v2.0.0 diff --git a/docs/modules/TPriorityQueue.ts.md b/docs/modules/TPriorityQueue.ts.md deleted file mode 100644 index e40ad76ab..000000000 --- a/docs/modules/TPriorityQueue.ts.md +++ /dev/null @@ -1,350 +0,0 @@ ---- -title: TPriorityQueue.ts -nav_order: 130 -parent: Modules ---- - -## TPriorityQueue overview - -Added in v2.0.0 - ---- - -

Table of contents

- -- [constructors](#constructors) - - [empty](#empty) - - [fromIterable](#fromiterable) - - [make](#make) -- [destructors](#destructors) - - [toArray](#toarray) - - [toChunk](#tochunk) -- [getters](#getters) - - [isEmpty](#isempty) - - [isNonEmpty](#isnonempty) - - [peek](#peek) - - [peekOption](#peekoption) - - [removeIf](#removeif) - - [retainIf](#retainif) - - [size](#size) -- [models](#models) - - [TPriorityQueue (interface)](#tpriorityqueue-interface) -- [mutations](#mutations) - - [offer](#offer) - - [offerAll](#offerall) - - [take](#take) - - [takeAll](#takeall) - - [takeOption](#takeoption) - - [takeUpTo](#takeupto) -- [symbols](#symbols) - - [TPriorityQueueTypeId](#tpriorityqueuetypeid) - - [TPriorityQueueTypeId (type alias)](#tpriorityqueuetypeid-type-alias) -- [utils](#utils) - - [TPriorityQueue (namespace)](#tpriorityqueue-namespace) - - [Variance (interface)](#variance-interface) - ---- - -# constructors - -## empty - -Constructs a new empty `TPriorityQueue` with the specified `Order`. - -**Signature** - -```ts -export declare const empty:
(order: Order.Order) => STM.STM> -``` - -Added in v2.0.0 - -## fromIterable - -Makes a new `TPriorityQueue` initialized with provided iterable. - -**Signature** - -```ts -export declare const fromIterable: ( - order: Order.Order -) => (iterable: Iterable) => STM.STM> -``` - -Added in v2.0.0 - -## make - -Makes a new `TPriorityQueue` that is initialized with specified values. - -**Signature** - -```ts -export declare const make: (order: Order.Order) => (...elements: A[]) => STM.STM> -``` - -Added in v2.0.0 - -# destructors - -## toArray - -Collects all values into an array. - -**Signature** - -```ts -export declare const toArray: (self: TPriorityQueue) => STM.STM -``` - -Added in v2.0.0 - -## toChunk - -Collects all values into a `Chunk`. - -**Signature** - -```ts -export declare const toChunk: (self: TPriorityQueue) => STM.STM> -``` - -Added in v2.0.0 - -# getters - -## isEmpty - -Checks whether the queue is empty. - -**Signature** - -```ts -export declare const isEmpty: (self: TPriorityQueue) => STM.STM -``` - -Added in v2.0.0 - -## isNonEmpty - -Checks whether the queue is not empty. - -**Signature** - -```ts -export declare const isNonEmpty: (self: TPriorityQueue) => STM.STM -``` - -Added in v2.0.0 - -## peek - -Peeks at the first value in the queue without removing it, retrying until a -value is in the queue. - -**Signature** - -```ts -export declare const peek: (self: TPriorityQueue) => STM.STM -``` - -Added in v2.0.0 - -## peekOption - -Peeks at the first value in the queue without removing it, returning `None` -if there is not a value in the queue. - -**Signature** - -```ts -export declare const peekOption: (self: TPriorityQueue) => STM.STM> -``` - -Added in v2.0.0 - -## removeIf - -Removes all elements from the queue matching the specified predicate. - -**Signature** - -```ts -export declare const removeIf: { - (predicate: Predicate): (self: TPriorityQueue) => STM.STM - (self: TPriorityQueue, predicate: Predicate): STM.STM -} -``` - -Added in v2.0.0 - -## retainIf - -Retains only elements from the queue matching the specified predicate. - -**Signature** - -```ts -export declare const retainIf: { - (predicate: Predicate): (self: TPriorityQueue) => STM.STM - (self: TPriorityQueue, predicate: Predicate): STM.STM -} -``` - -Added in v2.0.0 - -## size - -Returns the size of the queue. - -**Signature** - -```ts -export declare const size: (self: TPriorityQueue) => STM.STM -``` - -Added in v2.0.0 - -# models - -## TPriorityQueue (interface) - -A `TPriorityQueue` contains values of type `A` that an `Order` is defined -on. Unlike a `TQueue`, `take` returns the highest priority value (the value -that is first in the specified ordering) as opposed to the first value -offered to the queue. The ordering that elements with the same priority will -be taken from the queue is not guaranteed. - -**Signature** - -```ts -export interface TPriorityQueue extends TPriorityQueue.Variance {} -``` - -Added in v2.0.0 - -# mutations - -## offer - -Offers the specified value to the queue. - -**Signature** - -```ts -export declare const offer: { - (value: A): (self: TPriorityQueue) => STM.STM - (self: TPriorityQueue, value: A): STM.STM -} -``` - -Added in v2.0.0 - -## offerAll - -Offers all of the elements in the specified collection to the queue. - -**Signature** - -```ts -export declare const offerAll: { - (values: Iterable): (self: TPriorityQueue) => STM.STM - (self: TPriorityQueue, values: Iterable): STM.STM -} -``` - -Added in v2.0.0 - -## take - -Takes a value from the queue, retrying until a value is in the queue. - -**Signature** - -```ts -export declare const take: (self: TPriorityQueue) => STM.STM -``` - -Added in v2.0.0 - -## takeAll - -Takes all values from the queue. - -**Signature** - -```ts -export declare const takeAll: (self: TPriorityQueue) => STM.STM -``` - -Added in v2.0.0 - -## takeOption - -Takes a value from the queue, returning `None` if there is not a value in -the queue. - -**Signature** - -```ts -export declare const takeOption: (self: TPriorityQueue) => STM.STM> -``` - -Added in v2.0.0 - -## takeUpTo - -Takes up to the specified maximum number of elements from the queue. - -**Signature** - -```ts -export declare const takeUpTo: { - (n: number): (self: TPriorityQueue) => STM.STM - (self: TPriorityQueue, n: number): STM.STM -} -``` - -Added in v2.0.0 - -# symbols - -## TPriorityQueueTypeId - -**Signature** - -```ts -export declare const TPriorityQueueTypeId: typeof TPriorityQueueTypeId -``` - -Added in v2.0.0 - -## TPriorityQueueTypeId (type alias) - -**Signature** - -```ts -export type TPriorityQueueTypeId = typeof TPriorityQueueTypeId -``` - -Added in v2.0.0 - -# utils - -## TPriorityQueue (namespace) - -Added in v2.0.0 - -### Variance (interface) - -**Signature** - -```ts -export interface Variance { - readonly [TPriorityQueueTypeId]: { - readonly _A: (_: never) => A - } -} -``` - -Added in v2.0.0 diff --git a/docs/modules/TPubSub.ts.md b/docs/modules/TPubSub.ts.md deleted file mode 100644 index c39efd38f..000000000 --- a/docs/modules/TPubSub.ts.md +++ /dev/null @@ -1,270 +0,0 @@ ---- -title: TPubSub.ts -nav_order: 131 -parent: Modules ---- - -## TPubSub overview - -Added in v2.0.0 - ---- - -

Table of contents

- -- [constructors](#constructors) - - [bounded](#bounded) - - [dropping](#dropping) - - [sliding](#sliding) - - [unbounded](#unbounded) -- [getters](#getters) - - [capacity](#capacity) - - [isEmpty](#isempty) - - [isFull](#isfull) - - [isShutdown](#isshutdown) - - [size](#size) -- [models](#models) - - [TPubSub (interface)](#tpubsub-interface) -- [mutations](#mutations) - - [awaitShutdown](#awaitshutdown) - - [publish](#publish) - - [publishAll](#publishall) - - [subscribe](#subscribe) - - [subscribeScoped](#subscribescoped) -- [symbols](#symbols) - - [TPubSubTypeId](#tpubsubtypeid) - - [TPubSubTypeId (type alias)](#tpubsubtypeid-type-alias) - ---- - -# constructors - -## bounded - -Creates a bounded `TPubSub` with the back pressure strategy. The `TPubSub` will retain -messages until they have been taken by all subscribers, applying back -pressure to publishers if the `TPubSub` is at capacity. - -**Signature** - -```ts -export declare const bounded:
(requestedCapacity: number) => STM.STM> -``` - -Added in v2.0.0 - -## dropping - -Creates a bounded `TPubSub` with the dropping strategy. The `TPubSub` will drop new -messages if the `TPubSub` is at capacity. - -**Signature** - -```ts -export declare const dropping: (requestedCapacity: number) => STM.STM> -``` - -Added in v2.0.0 - -## sliding - -Creates a bounded `TPubSub` with the sliding strategy. The `TPubSub` will add new -messages and drop old messages if the `TPubSub` is at capacity. - -For best performance use capacities that are powers of two. - -**Signature** - -```ts -export declare const sliding: (requestedCapacity: number) => STM.STM> -``` - -Added in v2.0.0 - -## unbounded - -Creates an unbounded `TPubSub`. - -**Signature** - -```ts -export declare const unbounded: () => STM.STM> -``` - -Added in v2.0.0 - -# getters - -## capacity - -Returns the number of elements the `TPubSub` can hold. - -**Signature** - -```ts -export declare const capacity: (self: TPubSub) => number -``` - -Added in v2.0.0 - -## isEmpty - -Returns `true` if the `TPubSub` contains zero elements, `false` otherwise. - -**Signature** - -```ts -export declare const isEmpty: (self: TPubSub) => STM.STM -``` - -Added in v2.0.0 - -## isFull - -Returns `true` if the `TPubSub` contains at least one element, `false` -otherwise. - -**Signature** - -```ts -export declare const isFull: (self: TPubSub) => STM.STM -``` - -Added in v2.0.0 - -## isShutdown - -Returns `true` if `shutdown` has been called, otherwise returns `false`. - -**Signature** - -```ts -export declare const isShutdown: (self: TPubSub) => STM.STM -``` - -Added in v2.0.0 - -## size - -Retrieves the size of the `TPubSub`, which is equal to the number of elements -in the `TPubSub`. This may be negative if fibers are suspended waiting for -elements to be added to the `TPubSub`. - -**Signature** - -```ts -export declare const size: (self: TPubSub) => STM.STM -``` - -Added in v2.0.0 - -# models - -## TPubSub (interface) - -**Signature** - -```ts -export interface TPubSub extends TQueue.TEnqueue {} -``` - -Added in v2.0.0 - -# mutations - -## awaitShutdown - -Waits until the `TPubSub` is shutdown. The `STM` returned by this method will -not resume until the queue has been shutdown. If the `TPubSub` is already -shutdown, the `STM` will resume right away. - -**Signature** - -```ts -export declare const awaitShutdown: (self: TPubSub) => STM.STM -``` - -Added in v2.0.0 - -## publish - -Publishes a message to the `TPubSub`, returning whether the message was published -to the `TPubSub`. - -**Signature** - -```ts -export declare const publish: { - (value: A): (self: TPubSub) => STM.STM - (self: TPubSub, value: A): STM.STM -} -``` - -Added in v2.0.0 - -## publishAll - -Publishes all of the specified messages to the `TPubSub`, returning whether they -were published to the `TPubSub`. - -**Signature** - -```ts -export declare const publishAll: { - (iterable: Iterable): (self: TPubSub) => STM.STM - (self: TPubSub, iterable: Iterable): STM.STM -} -``` - -Added in v2.0.0 - -## subscribe - -Subscribes to receive messages from the `TPubSub`. The resulting subscription can -be evaluated multiple times to take a message from the `TPubSub` each time. The -caller is responsible for unsubscribing from the `TPubSub` by shutting down the -queue. - -**Signature** - -```ts -export declare const subscribe: (self: TPubSub) => STM.STM> -``` - -Added in v2.0.0 - -## subscribeScoped - -Subscribes to receive messages from the `TPubSub`. The resulting subscription can -be evaluated multiple times within the scope to take a message from the `TPubSub` -each time. - -**Signature** - -```ts -export declare const subscribeScoped: (self: TPubSub) => Effect.Effect> -``` - -Added in v2.0.0 - -# symbols - -## TPubSubTypeId - -**Signature** - -```ts -export declare const TPubSubTypeId: typeof TPubSubTypeId -``` - -Added in v2.0.0 - -## TPubSubTypeId (type alias) - -**Signature** - -```ts -export type TPubSubTypeId = typeof TPubSubTypeId -``` - -Added in v2.0.0 diff --git a/docs/modules/TQueue.ts.md b/docs/modules/TQueue.ts.md deleted file mode 100644 index ab656a922..000000000 --- a/docs/modules/TQueue.ts.md +++ /dev/null @@ -1,636 +0,0 @@ ---- -title: TQueue.ts -nav_order: 132 -parent: Modules ---- - -## TQueue overview - -Added in v2.0.0 - ---- - -

Table of contents

- -- [constructors](#constructors) - - [bounded](#bounded) - - [dropping](#dropping) - - [sliding](#sliding) - - [unbounded](#unbounded) -- [getters](#getters) - - [capacity](#capacity) - - [isEmpty](#isempty) - - [isFull](#isfull) - - [isShutdown](#isshutdown) - - [peek](#peek) - - [peekOption](#peekoption) - - [poll](#poll) - - [size](#size) -- [models](#models) - - [BaseTQueue (interface)](#basetqueue-interface) - - [TDequeue (interface)](#tdequeue-interface) - - [TEnqueue (interface)](#tenqueue-interface) - - [TQueue (interface)](#tqueue-interface) -- [mutations](#mutations) - - [awaitShutdown](#awaitshutdown) - - [offer](#offer) - - [offerAll](#offerall) - - [seek](#seek) - - [shutdown](#shutdown) - - [take](#take) - - [takeAll](#takeall) - - [takeBetween](#takebetween) - - [takeN](#taken) - - [takeUpTo](#takeupto) -- [refinements](#refinements) - - [isTDequeue](#istdequeue) - - [isTEnqueue](#istenqueue) - - [isTQueue](#istqueue) -- [symbols](#symbols) - - [TDequeueTypeId](#tdequeuetypeid) - - [TDequeueTypeId (type alias)](#tdequeuetypeid-type-alias) - - [TEnqueueTypeId](#tenqueuetypeid) - - [TEnqueueTypeId (type alias)](#tenqueuetypeid-type-alias) -- [utils](#utils) - - [TQueue (namespace)](#tqueue-namespace) - - [TDequeueVariance (interface)](#tdequeuevariance-interface) - - [TEnqueueVariance (interface)](#tenqueuevariance-interface) - ---- - -# constructors - -## bounded - -Creates a bounded queue with the back pressure strategy. The queue will -retain values until they have been taken, applying back pressure to -offerors if the queue is at capacity. - -For best performance use capacities that are powers of two. - -**Signature** - -```ts -export declare const bounded:
(requestedCapacity: number) => STM.STM> -``` - -Added in v2.0.0 - -## dropping - -Creates a bounded queue with the dropping strategy. The queue will drop new -values if the queue is at capacity. - -For best performance use capacities that are powers of two. - -**Signature** - -```ts -export declare const dropping: (requestedCapacity: number) => STM.STM> -``` - -Added in v2.0.0 - -## sliding - -Creates a bounded queue with the sliding strategy. The queue will add new -values and drop old values if the queue is at capacity. - -For best performance use capacities that are powers of two. - -**Signature** - -```ts -export declare const sliding: (requestedCapacity: number) => STM.STM> -``` - -Added in v2.0.0 - -## unbounded - -Creates an unbounded queue. - -**Signature** - -```ts -export declare const unbounded: () => STM.STM> -``` - -Added in v2.0.0 - -# getters - -## capacity - -Returns the number of elements the queue can hold. - -**Signature** - -```ts -export declare const capacity: (self: TQueue) => number -``` - -Added in v2.0.0 - -## isEmpty - -Returns `true` if the `TQueue` contains zero elements, `false` otherwise. - -**Signature** - -```ts -export declare const isEmpty: (self: TQueue) => STM.STM -``` - -Added in v2.0.0 - -## isFull - -Returns `true` if the `TQueue` contains at least one element, `false` -otherwise. - -**Signature** - -```ts -export declare const isFull: (self: TQueue) => STM.STM -``` - -Added in v2.0.0 - -## isShutdown - -Returns `true` if `shutdown` has been called, otherwise returns `false`. - -**Signature** - -```ts -export declare const isShutdown: (self: TQueue) => STM.STM -``` - -Added in v2.0.0 - -## peek - -Views the next element in the queue without removing it, retrying if the -queue is empty. - -**Signature** - -```ts -export declare const peek: (self: TDequeue) => STM.STM -``` - -Added in v2.0.0 - -## peekOption - -Views the next element in the queue without removing it, returning `None` -if the queue is empty. - -**Signature** - -```ts -export declare const peekOption: (self: TDequeue) => STM.STM> -``` - -Added in v2.0.0 - -## poll - -Takes a single element from the queue, returning `None` if the queue is -empty. - -**Signature** - -```ts -export declare const poll: (self: TDequeue) => STM.STM> -``` - -Added in v2.0.0 - -## size - -Retrieves the size of the queue, which is equal to the number of elements -in the queue. This may be negative if fibers are suspended waiting for -elements to be added to the queue. - -**Signature** - -```ts -export declare const size: (self: TQueue) => STM.STM -``` - -Added in v2.0.0 - -# models - -## BaseTQueue (interface) - -The base interface that all `TQueue`s must implement. - -**Signature** - -```ts -export interface BaseTQueue { - /** - * Returns the number of elements the queue can hold. - */ - readonly capacity: () => number - - /** - * Retrieves the size of the queue, which is equal to the number of elements - * in the queue. This may be negative if fibers are suspended waiting for - * elements to be added to the queue. - */ - readonly size: STM.STM - - /** - * Returns `true` if the `TQueue` contains at least one element, `false` - * otherwise. - */ - readonly isFull: STM.STM - - /** - * Returns `true` if the `TQueue` contains zero elements, `false` otherwise. - */ - readonly isEmpty: STM.STM - - /** - * Interrupts any fibers that are suspended on `offer` or `take`. Future calls - * to `offer*` and `take*` will be interrupted immediately. - */ - readonly shutdown: STM.STM - - /** - * Returns `true` if `shutdown` has been called, otherwise returns `false`. - */ - readonly isShutdown: STM.STM - - /** - * Waits until the queue is shutdown. The `STM` returned by this method will - * not resume until the queue has been shutdown. If the queue is already - * shutdown, the `STM` will resume right away. - */ - readonly awaitShutdown: STM.STM -} -``` - -Added in v2.0.0 - -## TDequeue (interface) - -**Signature** - -```ts -export interface TDequeue extends TQueue.TDequeueVariance, BaseTQueue { - /** - * Views the next element in the queue without removing it, retrying if the - * queue is empty. - */ - readonly peek: STM.STM - - /** - * Views the next element in the queue without removing it, returning `None` - * if the queue is empty. - */ - readonly peekOption: STM.STM> - - /** - * Takes the oldest value in the queue. If the queue is empty, this will return - * a computation that resumes when an item has been added to the queue. - */ - readonly take: STM.STM - - /** - * Takes all the values in the queue and returns the values. If the queue is - * empty returns an empty collection. - */ - readonly takeAll: STM.STM> - - /** - * Takes up to max number of values from the queue. - */ - readonly takeUpTo: (max: number) => STM.STM> -} -``` - -Added in v2.0.0 - -## TEnqueue (interface) - -**Signature** - -```ts -export interface TEnqueue extends TQueue.TEnqueueVariance, BaseTQueue { - /** - * Places one value in the queue. - */ - readonly offer: (value: A) => STM.STM - - /** - * For Bounded TQueue: uses the `BackPressure` Strategy, places the values in - * the queue and always returns true. If the queue has reached capacity, then - * the fiber performing the `offerAll` will be suspended until there is room - * in the queue. - * - * For Unbounded TQueue: Places all values in the queue and returns true. - * - * For Sliding TQueue: uses `Sliding` Strategy If there is room in the queue, - * it places the values otherwise it removes the old elements and enqueues the - * new ones. Always returns true. - * - * For Dropping TQueue: uses `Dropping` Strategy, It places the values in the - * queue but if there is no room it will not enqueue them and return false. - */ - readonly offerAll: (iterable: Iterable) => STM.STM -} -``` - -Added in v2.0.0 - -## TQueue (interface) - -**Signature** - -```ts -export interface TQueue extends TEnqueue, TDequeue {} -``` - -Added in v2.0.0 - -# mutations - -## awaitShutdown - -Waits until the queue is shutdown. The `STM` returned by this method will -not resume until the queue has been shutdown. If the queue is already -shutdown, the `STM` will resume right away. - -**Signature** - -```ts -export declare const awaitShutdown: (self: TQueue) => STM.STM -``` - -Added in v2.0.0 - -## offer - -Places one value in the queue. - -**Signature** - -```ts -export declare const offer: { - (value: A): (self: TEnqueue) => STM.STM - (self: TEnqueue, value: A): STM.STM -} -``` - -Added in v2.0.0 - -## offerAll - -For Bounded TQueue: uses the `BackPressure` Strategy, places the values in -the queue and always returns true. If the queue has reached capacity, then -the fiber performing the `offerAll` will be suspended until there is room -in the queue. - -For Unbounded TQueue: Places all values in the queue and returns true. - -For Sliding TQueue: uses `Sliding` Strategy If there is room in the queue, -it places the values otherwise it removes the old elements and enqueues the -new ones. Always returns true. - -For Dropping TQueue: uses `Dropping` Strategy, It places the values in the -queue but if there is no room it will not enqueue them and return false. - -**Signature** - -```ts -export declare const offerAll: { - (iterable: Iterable): (self: TEnqueue) => STM.STM - (self: TEnqueue, iterable: Iterable): STM.STM -} -``` - -Added in v2.0.0 - -## seek - -Drops elements from the queue while they do not satisfy the predicate, -taking and returning the first element that does satisfy the predicate. -Retries if no elements satisfy the predicate. - -**Signature** - -```ts -export declare const seek: { - (predicate: Predicate): (self: TDequeue) => STM.STM - (self: TDequeue, predicate: Predicate): STM.STM -} -``` - -Added in v2.0.0 - -## shutdown - -Interrupts any fibers that are suspended on `offer` or `take`. Future calls -to `offer*` and `take*` will be interrupted immediately. - -**Signature** - -```ts -export declare const shutdown: (self: TQueue) => STM.STM -``` - -Added in v2.0.0 - -## take - -Takes the oldest value in the queue. If the queue is empty, this will return -a computation that resumes when an item has been added to the queue. - -**Signature** - -```ts -export declare const take: (self: TDequeue) => STM.STM -``` - -Added in v2.0.0 - -## takeAll - -Takes all the values in the queue and returns the values. If the queue is -empty returns an empty collection. - -**Signature** - -```ts -export declare const takeAll: (self: TDequeue) => STM.STM -``` - -Added in v2.0.0 - -## takeBetween - -Takes a number of elements from the queue between the specified minimum and -maximum. If there are fewer than the minimum number of elements available, -retries until at least the minimum number of elements have been collected. - -**Signature** - -```ts -export declare const takeBetween: { - (min: number, max: number): (self: TDequeue) => STM.STM - (self: TDequeue, min: number, max: number): STM.STM -} -``` - -Added in v2.0.0 - -## takeN - -Takes the specified number of elements from the queue. If there are fewer -than the specified number of elements available, it retries until they -become available. - -**Signature** - -```ts -export declare const takeN: { - (n: number): (self: TDequeue) => STM.STM - (self: TDequeue, n: number): STM.STM -} -``` - -Added in v2.0.0 - -## takeUpTo - -Takes up to max number of values from the queue. - -**Signature** - -```ts -export declare const takeUpTo: { - (max: number): (self: TDequeue) => STM.STM - (self: TDequeue, max: number): STM.STM -} -``` - -Added in v2.0.0 - -# refinements - -## isTDequeue - -Returns `true` if the specified value is a `TDequeue`, `false` otherwise. - -**Signature** - -```ts -export declare const isTDequeue: (u: unknown) => u is TDequeue -``` - -Added in v2.0.0 - -## isTEnqueue - -Returns `true` if the specified value is a `TEnqueue`, `false` otherwise. - -**Signature** - -```ts -export declare const isTEnqueue: (u: unknown) => u is TEnqueue -``` - -Added in v2.0.0 - -## isTQueue - -Returns `true` if the specified value is a `TQueue`, `false` otherwise. - -**Signature** - -```ts -export declare const isTQueue: (u: unknown) => u is TQueue -``` - -Added in v2.0.0 - -# symbols - -## TDequeueTypeId - -**Signature** - -```ts -export declare const TDequeueTypeId: typeof TDequeueTypeId -``` - -Added in v2.0.0 - -## TDequeueTypeId (type alias) - -**Signature** - -```ts -export type TDequeueTypeId = typeof TDequeueTypeId -``` - -Added in v2.0.0 - -## TEnqueueTypeId - -**Signature** - -```ts -export declare const TEnqueueTypeId: typeof TEnqueueTypeId -``` - -Added in v2.0.0 - -## TEnqueueTypeId (type alias) - -**Signature** - -```ts -export type TEnqueueTypeId = typeof TEnqueueTypeId -``` - -Added in v2.0.0 - -# utils - -## TQueue (namespace) - -Added in v2.0.0 - -### TDequeueVariance (interface) - -**Signature** - -```ts -export interface TDequeueVariance { - readonly [TDequeueTypeId]: { - readonly _Out: (_: never) => A - } -} -``` - -Added in v2.0.0 - -### TEnqueueVariance (interface) - -**Signature** - -```ts -export interface TEnqueueVariance { - readonly [TEnqueueTypeId]: { - readonly _In: (_: A) => void - } -} -``` - -Added in v2.0.0 diff --git a/docs/modules/TRandom.ts.md b/docs/modules/TRandom.ts.md deleted file mode 100644 index 05969102b..000000000 --- a/docs/modules/TRandom.ts.md +++ /dev/null @@ -1,195 +0,0 @@ ---- -title: TRandom.ts -nav_order: 134 -parent: Modules ---- - -## TRandom overview - -Added in v2.0.0 - ---- - -

Table of contents

- -- [context](#context) - - [Tag](#tag) - - [live](#live) -- [models](#models) - - [TRandom (interface)](#trandom-interface) -- [random](#random) - - [next](#next) - - [nextBoolean](#nextboolean) - - [nextInt](#nextint) - - [nextIntBetween](#nextintbetween) - - [nextRange](#nextrange) - - [shuffle](#shuffle) -- [symbols](#symbols) - - [TRandomTypeId](#trandomtypeid) - - [TRandomTypeId (type alias)](#trandomtypeid-type-alias) - ---- - -# context - -## Tag - -The service tag used to access `TRandom` in the environment of an effect. - -**Signature** - -```ts -export declare const Tag: Context.Tag -``` - -Added in v2.0.0 - -## live - -The "live" `TRandom` service wrapped into a `Layer`. - -**Signature** - -```ts -export declare const live: Layer.Layer -``` - -Added in v2.0.0 - -# models - -## TRandom (interface) - -**Signature** - -```ts -export interface TRandom { - readonly [TRandomTypeId]: TRandomTypeId - /** - * Returns the next numeric value from the pseudo-random number generator. - */ - readonly next: STM.STM - /** - * Returns the next boolean value from the pseudo-random number generator. - */ - readonly nextBoolean: STM.STM - /** - * Returns the next integer value from the pseudo-random number generator. - */ - readonly nextInt: STM.STM - /** - * Returns the next numeric value in the specified range from the - * pseudo-random number generator. - */ - readonly nextRange: (min: number, max: number) => STM.STM - /** - * Returns the next integer value in the specified range from the - * pseudo-random number generator. - */ - readonly nextIntBetween: (min: number, max: number) => STM.STM - /** - * Uses the pseudo-random number generator to shuffle the specified iterable. - */ - readonly shuffle:
(elements: Iterable) => STM.STM> -} -``` - -Added in v2.0.0 - -# random - -## next - -Returns the next number from the pseudo-random number generator. - -**Signature** - -```ts -export declare const next: STM.STM -``` - -Added in v2.0.0 - -## nextBoolean - -Returns the next boolean value from the pseudo-random number generator. - -**Signature** - -```ts -export declare const nextBoolean: STM.STM -``` - -Added in v2.0.0 - -## nextInt - -Returns the next integer from the pseudo-random number generator. - -**Signature** - -```ts -export declare const nextInt: STM.STM -``` - -Added in v2.0.0 - -## nextIntBetween - -Returns the next integer in the specified range from the pseudo-random number -generator. - -**Signature** - -```ts -export declare const nextIntBetween: (low: number, high: number) => STM.STM -``` - -Added in v2.0.0 - -## nextRange - -Returns the next number in the specified range from the pseudo-random number -generator. - -**Signature** - -```ts -export declare const nextRange: (min: number, max: number) => STM.STM -``` - -Added in v2.0.0 - -## shuffle - -Uses the pseudo-random number generator to shuffle the specified iterable. - -**Signature** - -```ts -export declare const shuffle: (elements: Iterable) => STM.STM -``` - -Added in v2.0.0 - -# symbols - -## TRandomTypeId - -**Signature** - -```ts -export declare const TRandomTypeId: typeof TRandomTypeId -``` - -Added in v2.0.0 - -## TRandomTypeId (type alias) - -**Signature** - -```ts -export type TRandomTypeId = typeof TRandomTypeId -``` - -Added in v2.0.0 diff --git a/docs/modules/TReentrantLock.ts.md b/docs/modules/TReentrantLock.ts.md deleted file mode 100644 index 0382429ef..000000000 --- a/docs/modules/TReentrantLock.ts.md +++ /dev/null @@ -1,349 +0,0 @@ ---- -title: TReentrantLock.ts -nav_order: 135 -parent: Modules ---- - -## TReentrantLock overview - -Added in v2.0.0 - ---- - -

Table of contents

- -- [constructors](#constructors) - - [make](#make) -- [models](#models) - - [TReentrantLock (interface)](#treentrantlock-interface) -- [mutations](#mutations) - - [acquireRead](#acquireread) - - [acquireWrite](#acquirewrite) - - [fiberReadLocks](#fiberreadlocks) - - [fiberWriteLocks](#fiberwritelocks) - - [lock](#lock) - - [locked](#locked) - - [readLock](#readlock) - - [readLocked](#readlocked) - - [readLocks](#readlocks) - - [releaseRead](#releaseread) - - [releaseWrite](#releasewrite) - - [withLock](#withlock) - - [withReadLock](#withreadlock) - - [withWriteLock](#withwritelock) - - [writeLock](#writelock) - - [writeLocked](#writelocked) - - [writeLocks](#writelocks) -- [symbols](#symbols) - - [TReentrantLockTypeId](#treentrantlocktypeid) - - [TReentrantLockTypeId (type alias)](#treentrantlocktypeid-type-alias) -- [utils](#utils) - - [TReentrantLock (namespace)](#treentrantlock-namespace) - - [Proto (interface)](#proto-interface) - ---- - -# constructors - -## make - -Makes a new reentrant read/write lock. - -**Signature** - -```ts -export declare const make: STM.STM -``` - -Added in v2.0.0 - -# models - -## TReentrantLock (interface) - -A `TReentrantLock` is a reentrant read/write lock. Multiple readers may all -concurrently acquire read locks. Only one writer is allowed to acquire a -write lock at any given time. Read locks may be upgraded into write locks. A -fiber that has a write lock may acquire other write locks or read locks. - -The two primary methods of this structure are `readLock`, which acquires a -read lock in a scoped context, and `writeLock`, which acquires a write lock -in a scoped context. - -Although located in the STM package, there is no need for locks within STM -transactions. However, this lock can be quite useful in effectful code, to -provide consistent read/write access to mutable state; and being in STM -allows this structure to be composed into more complicated concurrent -structures that are consumed from effectful code. - -**Signature** - -```ts -export interface TReentrantLock extends TReentrantLock.Proto {} -``` - -Added in v2.0.0 - -# mutations - -## acquireRead - -Acquires a read lock. The transaction will suspend until no other fiber is -holding a write lock. Succeeds with the number of read locks held by this -fiber. - -**Signature** - -```ts -export declare const acquireRead: (self: TReentrantLock) => STM.STM -``` - -Added in v2.0.0 - -## acquireWrite - -Acquires a write lock. The transaction will suspend until no other fibers -are holding read or write locks. Succeeds with the number of write locks -held by this fiber. - -**Signature** - -```ts -export declare const acquireWrite: (self: TReentrantLock) => STM.STM -``` - -Added in v2.0.0 - -## fiberReadLocks - -Retrieves the number of acquired read locks for this fiber. - -**Signature** - -```ts -export declare const fiberReadLocks: (self: TReentrantLock) => STM.STM -``` - -Added in v2.0.0 - -## fiberWriteLocks - -Retrieves the number of acquired write locks for this fiber. - -**Signature** - -```ts -export declare const fiberWriteLocks: (self: TReentrantLock) => STM.STM -``` - -Added in v2.0.0 - -## lock - -Just a convenience method for applications that only need reentrant locks, -without needing a distinction between readers / writers. - -See `TReentrantLock.writeLock`. - -**Signature** - -```ts -export declare const lock: (self: TReentrantLock) => Effect.Effect -``` - -Added in v2.0.0 - -## locked - -Determines if any fiber has a read or write lock. - -**Signature** - -```ts -export declare const locked: (self: TReentrantLock) => STM.STM -``` - -Added in v2.0.0 - -## readLock - -Obtains a read lock in a scoped context. - -**Signature** - -```ts -export declare const readLock: (self: TReentrantLock) => Effect.Effect -``` - -Added in v2.0.0 - -## readLocked - -Determines if any fiber has a read lock. - -**Signature** - -```ts -export declare const readLocked: (self: TReentrantLock) => STM.STM -``` - -Added in v2.0.0 - -## readLocks - -Retrieves the total number of acquired read locks. - -**Signature** - -```ts -export declare const readLocks: (self: TReentrantLock) => STM.STM -``` - -Added in v2.0.0 - -## releaseRead - -Releases a read lock held by this fiber. Succeeds with the outstanding -number of read locks held by this fiber. - -**Signature** - -```ts -export declare const releaseRead: (self: TReentrantLock) => STM.STM -``` - -Added in v2.0.0 - -## releaseWrite - -Releases a write lock held by this fiber. Succeeds with the outstanding -number of write locks held by this fiber. - -**Signature** - -```ts -export declare const releaseWrite: (self: TReentrantLock) => STM.STM -``` - -Added in v2.0.0 - -## withLock - -Runs the specified workflow with a lock. - -**Signature** - -```ts -export declare const withLock: { - (self: TReentrantLock): (effect: Effect.Effect) => Effect.Effect - (effect: Effect.Effect, self: TReentrantLock): Effect.Effect -} -``` - -Added in v2.0.0 - -## withReadLock - -Runs the specified workflow with a read lock. - -**Signature** - -```ts -export declare const withReadLock: { - (self: TReentrantLock): (effect: Effect.Effect) => Effect.Effect - (effect: Effect.Effect, self: TReentrantLock): Effect.Effect -} -``` - -Added in v2.0.0 - -## withWriteLock - -Runs the specified workflow with a write lock. - -**Signature** - -```ts -export declare const withWriteLock: { - (self: TReentrantLock): (effect: Effect.Effect) => Effect.Effect - (effect: Effect.Effect, self: TReentrantLock): Effect.Effect -} -``` - -Added in v2.0.0 - -## writeLock - -Obtains a write lock in a scoped context. - -**Signature** - -```ts -export declare const writeLock: (self: TReentrantLock) => Effect.Effect -``` - -Added in v2.0.0 - -## writeLocked - -Determines if a write lock is held by some fiber. - -**Signature** - -```ts -export declare const writeLocked: (self: TReentrantLock) => STM.STM -``` - -Added in v2.0.0 - -## writeLocks - -Computes the number of write locks held by fibers. - -**Signature** - -```ts -export declare const writeLocks: (self: TReentrantLock) => STM.STM -``` - -Added in v2.0.0 - -# symbols - -## TReentrantLockTypeId - -**Signature** - -```ts -export declare const TReentrantLockTypeId: typeof TReentrantLockTypeId -``` - -Added in v2.0.0 - -## TReentrantLockTypeId (type alias) - -**Signature** - -```ts -export type TReentrantLockTypeId = typeof TReentrantLockTypeId -``` - -Added in v2.0.0 - -# utils - -## TReentrantLock (namespace) - -Added in v2.0.0 - -### Proto (interface) - -**Signature** - -```ts -export interface Proto { - readonly [TReentrantLockTypeId]: TReentrantLockTypeId -} -``` - -Added in v2.0.0 diff --git a/docs/modules/TRef.ts.md b/docs/modules/TRef.ts.md deleted file mode 100644 index e7fa503cd..000000000 --- a/docs/modules/TRef.ts.md +++ /dev/null @@ -1,273 +0,0 @@ ---- -title: TRef.ts -nav_order: 136 -parent: Modules ---- - -## TRef overview - -Added in v2.0.0 - ---- - -

Table of contents

- -- [constructors](#constructors) - - [make](#make) -- [models](#models) - - [TRef (interface)](#tref-interface) -- [mutations](#mutations) - - [get](#get) - - [getAndSet](#getandset) - - [getAndUpdate](#getandupdate) - - [getAndUpdateSome](#getandupdatesome) - - [modify](#modify) - - [modifySome](#modifysome) - - [set](#set) - - [setAndGet](#setandget) - - [update](#update) - - [updateAndGet](#updateandget) - - [updateSome](#updatesome) - - [updateSomeAndGet](#updatesomeandget) -- [symbols](#symbols) - - [TRefTypeId](#treftypeid) - - [TRefTypeId (type alias)](#treftypeid-type-alias) -- [utils](#utils) - - [TRef (namespace)](#tref-namespace) - - [Variance (interface)](#variance-interface) - ---- - -# constructors - -## make - -**Signature** - -```ts -export declare const make:
(value: A) => STM.STM> -``` - -Added in v2.0.0 - -# models - -## TRef (interface) - -A `TRef` is a purely functional description of a mutable reference that can -be modified as part of a transactional effect. The fundamental operations of -a `TRef` are `set` and `get`. `set` transactionally sets the reference to a -new value. `get` gets the current value of the reference. - -NOTE: While `TRef` provides the transactional equivalent of a mutable -reference, the value inside the `TRef` should be immutable. - -**Signature** - -```ts -export interface TRef extends TRef.Variance { - /** - * Note: the method is unbound, exposed only for potential extensions. - */ - readonly modify: (f: (a: A) => readonly [B, A]) => STM.STM -} -``` - -Added in v2.0.0 - -# mutations - -## get - -**Signature** - -```ts -export declare const get: (self: TRef) => STM.STM -``` - -Added in v2.0.0 - -## getAndSet - -**Signature** - -```ts -export declare const getAndSet: { - (value: A): (self: TRef) => STM.STM - (self: TRef, value: A): STM.STM -} -``` - -Added in v2.0.0 - -## getAndUpdate - -**Signature** - -```ts -export declare const getAndUpdate: { - (f: (a: A) => A): (self: TRef) => STM.STM - (self: TRef, f: (a: A) => A): STM.STM -} -``` - -Added in v2.0.0 - -## getAndUpdateSome - -**Signature** - -```ts -export declare const getAndUpdateSome: { - (f: (a: A) => Option.Option): (self: TRef) => STM.STM - (self: TRef, f: (a: A) => Option.Option): STM.STM -} -``` - -Added in v2.0.0 - -## modify - -**Signature** - -```ts -export declare const modify: { - (f: (a: A) => readonly [B, A]): (self: TRef) => STM.STM - (self: TRef, f: (a: A) => readonly [B, A]): STM.STM -} -``` - -Added in v2.0.0 - -## modifySome - -**Signature** - -```ts -export declare const modifySome: { - (fallback: B, f: (a: A) => Option.Option): (self: TRef) => STM.STM - (self: TRef, fallback: B, f: (a: A) => Option.Option): STM.STM -} -``` - -Added in v2.0.0 - -## set - -**Signature** - -```ts -export declare const set: { - (value: A): (self: TRef) => STM.STM - (self: TRef, value: A): STM.STM -} -``` - -Added in v2.0.0 - -## setAndGet - -**Signature** - -```ts -export declare const setAndGet: { - (value: A): (self: TRef) => STM.STM - (self: TRef, value: A): STM.STM -} -``` - -Added in v2.0.0 - -## update - -**Signature** - -```ts -export declare const update: { - (f: (a: A) => A): (self: TRef) => STM.STM - (self: TRef, f: (a: A) => A): STM.STM -} -``` - -Added in v2.0.0 - -## updateAndGet - -**Signature** - -```ts -export declare const updateAndGet: { - (f: (a: A) => A): (self: TRef) => STM.STM - (self: TRef, f: (a: A) => A): STM.STM -} -``` - -Added in v2.0.0 - -## updateSome - -**Signature** - -```ts -export declare const updateSome: { - (f: (a: A) => Option.Option): (self: TRef) => STM.STM - (self: TRef, f: (a: A) => Option.Option): STM.STM -} -``` - -Added in v2.0.0 - -## updateSomeAndGet - -**Signature** - -```ts -export declare const updateSomeAndGet: { - (f: (a: A) => Option.Option): (self: TRef) => STM.STM - (self: TRef, f: (a: A) => Option.Option): STM.STM -} -``` - -Added in v2.0.0 - -# symbols - -## TRefTypeId - -**Signature** - -```ts -export declare const TRefTypeId: typeof TRefTypeId -``` - -Added in v2.0.0 - -## TRefTypeId (type alias) - -**Signature** - -```ts -export type TRefTypeId = typeof TRefTypeId -``` - -Added in v2.0.0 - -# utils - -## TRef (namespace) - -Added in v2.0.0 - -### Variance (interface) - -**Signature** - -```ts -export interface Variance { - readonly [TRefTypeId]: { - readonly _A: (_: A) => A - } -} -``` - -Added in v2.0.0 diff --git a/docs/modules/TSemaphore.ts.md b/docs/modules/TSemaphore.ts.md deleted file mode 100644 index 49274bfe2..000000000 --- a/docs/modules/TSemaphore.ts.md +++ /dev/null @@ -1,224 +0,0 @@ ---- -title: TSemaphore.ts -nav_order: 137 -parent: Modules ---- - -## TSemaphore overview - -Added in v2.0.0 - ---- - -

Table of contents

- -- [constructors](#constructors) - - [make](#make) -- [getters](#getters) - - [available](#available) -- [models](#models) - - [TSemaphore (interface)](#tsemaphore-interface) -- [mutations](#mutations) - - [acquire](#acquire) - - [acquireN](#acquiren) - - [release](#release) - - [releaseN](#releasen) - - [withPermit](#withpermit) - - [withPermitScoped](#withpermitscoped) - - [withPermits](#withpermits) - - [withPermitsScoped](#withpermitsscoped) -- [symbols](#symbols) - - [TSemaphoreTypeId](#tsemaphoretypeid) - - [TSemaphoreTypeId (type alias)](#tsemaphoretypeid-type-alias) -- [unsafe](#unsafe) - - [unsafeMake](#unsafemake) -- [utils](#utils) - - [TSemaphore (namespace)](#tsemaphore-namespace) - - [Proto (interface)](#proto-interface) - ---- - -# constructors - -## make - -**Signature** - -```ts -export declare const make: (permits: number) => STM.STM -``` - -Added in v2.0.0 - -# getters - -## available - -**Signature** - -```ts -export declare const available: (self: TSemaphore) => STM.STM -``` - -Added in v2.0.0 - -# models - -## TSemaphore (interface) - -**Signature** - -```ts -export interface TSemaphore extends TSemaphore.Proto {} -``` - -Added in v2.0.0 - -# mutations - -## acquire - -**Signature** - -```ts -export declare const acquire: (self: TSemaphore) => STM.STM -``` - -Added in v2.0.0 - -## acquireN - -**Signature** - -```ts -export declare const acquireN: { - (n: number): (self: TSemaphore) => STM.STM - (self: TSemaphore, n: number): STM.STM -} -``` - -Added in v2.0.0 - -## release - -**Signature** - -```ts -export declare const release: (self: TSemaphore) => STM.STM -``` - -Added in v2.0.0 - -## releaseN - -**Signature** - -```ts -export declare const releaseN: { - (n: number): (self: TSemaphore) => STM.STM - (self: TSemaphore, n: number): STM.STM -} -``` - -Added in v2.0.0 - -## withPermit - -**Signature** - -```ts -export declare const withPermit: { - (semaphore: TSemaphore): (self: Effect.Effect) => Effect.Effect - (self: Effect.Effect, semaphore: TSemaphore): Effect.Effect -} -``` - -Added in v2.0.0 - -## withPermitScoped - -**Signature** - -```ts -export declare const withPermitScoped: (self: TSemaphore) => Effect.Effect -``` - -Added in v2.0.0 - -## withPermits - -**Signature** - -```ts -export declare const withPermits: { - (semaphore: TSemaphore, permits: number): (self: Effect.Effect) => Effect.Effect - (self: Effect.Effect, semaphore: TSemaphore, permits: number): Effect.Effect -} -``` - -Added in v2.0.0 - -## withPermitsScoped - -**Signature** - -```ts -export declare const withPermitsScoped: { - (permits: number): (self: TSemaphore) => Effect.Effect - (self: TSemaphore, permits: number): Effect.Effect -} -``` - -Added in v2.0.0 - -# symbols - -## TSemaphoreTypeId - -**Signature** - -```ts -export declare const TSemaphoreTypeId: typeof TSemaphoreTypeId -``` - -Added in v2.0.0 - -## TSemaphoreTypeId (type alias) - -**Signature** - -```ts -export type TSemaphoreTypeId = typeof TSemaphoreTypeId -``` - -Added in v2.0.0 - -# unsafe - -## unsafeMake - -**Signature** - -```ts -export declare const unsafeMake: (permits: number) => TSemaphore -``` - -Added in v2.0.0 - -# utils - -## TSemaphore (namespace) - -Added in v2.0.0 - -### Proto (interface) - -**Signature** - -```ts -export interface Proto { - readonly [TSemaphoreTypeId]: TSemaphoreTypeId -} -``` - -Added in v2.0.0 diff --git a/docs/modules/TSet.ts.md b/docs/modules/TSet.ts.md deleted file mode 100644 index e9f00d58b..000000000 --- a/docs/modules/TSet.ts.md +++ /dev/null @@ -1,514 +0,0 @@ ---- -title: TSet.ts -nav_order: 138 -parent: Modules ---- - -## TSet overview - -Added in v2.0.0 - ---- - -

Table of contents

- -- [constructors](#constructors) - - [empty](#empty) - - [fromIterable](#fromiterable) - - [make](#make) -- [destructors](#destructors) - - [toArray](#toarray) - - [toChunk](#tochunk) - - [toHashSet](#tohashset) - - [toReadonlySet](#toreadonlyset) -- [elements](#elements) - - [forEach](#foreach) - - [has](#has) -- [folding](#folding) - - [reduce](#reduce) - - [reduceSTM](#reducestm) -- [getters](#getters) - - [isEmpty](#isempty) - - [size](#size) -- [models](#models) - - [TSet (interface)](#tset-interface) -- [mutations](#mutations) - - [add](#add) - - [difference](#difference) - - [intersection](#intersection) - - [remove](#remove) - - [removeAll](#removeall) - - [removeIf](#removeif) - - [retainIf](#retainif) - - [takeFirst](#takefirst) - - [takeFirstSTM](#takefirststm) - - [takeSome](#takesome) - - [takeSomeSTM](#takesomestm) - - [transform](#transform) - - [transformSTM](#transformstm) - - [union](#union) -- [symbols](#symbols) - - [TSetTypeId](#tsettypeid) - - [TSetTypeId (type alias)](#tsettypeid-type-alias) -- [utils](#utils) - - [TSet (namespace)](#tset-namespace) - - [Variance (interface)](#variance-interface) - ---- - -# constructors - -## empty - -Makes an empty `TSet`. - -**Signature** - -```ts -export declare const empty:
() => STM.STM> -``` - -Added in v2.0.0 - -## fromIterable - -Makes a new `TSet` initialized with provided iterable. - -**Signature** - -```ts -export declare const fromIterable: (iterable: Iterable) => STM.STM> -``` - -Added in v2.0.0 - -## make - -Makes a new `TSet` that is initialized with specified values. - -**Signature** - -```ts -export declare const make: ( - ...elements: Elements -) => STM.STM> -``` - -Added in v2.0.0 - -# destructors - -## toArray - -Collects all elements into a `Array`. - -**Signature** - -```ts -export declare const toArray: (self: TSet) => STM.STM -``` - -Added in v2.0.0 - -## toChunk - -Collects all elements into a `Chunk`. - -**Signature** - -```ts -export declare const toChunk: (self: TSet) => STM.STM> -``` - -Added in v2.0.0 - -## toHashSet - -Collects all elements into a `HashSet`. - -**Signature** - -```ts -export declare const toHashSet: (self: TSet) => STM.STM> -``` - -Added in v2.0.0 - -## toReadonlySet - -Collects all elements into a `ReadonlySet`. - -**Signature** - -```ts -export declare const toReadonlySet: (self: TSet) => STM.STM> -``` - -Added in v2.0.0 - -# elements - -## forEach - -Atomically performs transactional-effect for each element in set. - -**Signature** - -```ts -export declare const forEach: { - (f: (value: A) => STM.STM): (self: TSet) => STM.STM - (self: TSet, f: (value: A) => STM.STM): STM.STM -} -``` - -Added in v2.0.0 - -## has - -Tests whether or not set contains an element. - -**Signature** - -```ts -export declare const has: { - (value: A): (self: TSet) => STM.STM - (self: TSet, value: A): STM.STM -} -``` - -Added in v2.0.0 - -# folding - -## reduce - -Atomically folds using a pure function. - -**Signature** - -```ts -export declare const reduce: { - (zero: Z, f: (accumulator: Z, value: A) => Z): (self: TSet) => STM.STM - (self: TSet, zero: Z, f: (accumulator: Z, value: A) => Z): STM.STM -} -``` - -Added in v2.0.0 - -## reduceSTM - -Atomically folds using a transactional function. - -**Signature** - -```ts -export declare const reduceSTM: { - (zero: Z, f: (accumulator: Z, value: A) => STM.STM): (self: TSet) => STM.STM - (self: TSet, zero: Z, f: (accumulator: Z, value: A) => STM.STM): STM.STM -} -``` - -Added in v2.0.0 - -# getters - -## isEmpty - -Tests if the set is empty or not - -**Signature** - -```ts -export declare const isEmpty: (self: TSet) => STM.STM -``` - -Added in v2.0.0 - -## size - -Returns the set's cardinality. - -**Signature** - -```ts -export declare const size: (self: TSet) => STM.STM -``` - -Added in v2.0.0 - -# models - -## TSet (interface) - -Transactional set implemented on top of `TMap`. - -**Signature** - -```ts -export interface TSet extends TSet.Variance {} -``` - -Added in v2.0.0 - -# mutations - -## add - -Stores new element in the set. - -**Signature** - -```ts -export declare const add: { - (value: A): (self: TSet) => STM.STM - (self: TSet, value: A): STM.STM -} -``` - -Added in v2.0.0 - -## difference - -Atomically transforms the set into the difference of itself and the -provided set. - -**Signature** - -```ts -export declare const difference: { - (other: TSet): (self: TSet) => STM.STM - (self: TSet, other: TSet): STM.STM -} -``` - -Added in v2.0.0 - -## intersection - -Atomically transforms the set into the intersection of itself and the -provided set. - -**Signature** - -```ts -export declare const intersection: { - (other: TSet): (self: TSet) => STM.STM - (self: TSet, other: TSet): STM.STM -} -``` - -Added in v2.0.0 - -## remove - -Removes a single element from the set. - -**Signature** - -```ts -export declare const remove: { - (value: A): (self: TSet) => STM.STM - (self: TSet, value: A): STM.STM -} -``` - -Added in v2.0.0 - -## removeAll - -Removes elements from the set. - -**Signature** - -```ts -export declare const removeAll: { - (iterable: Iterable): (self: TSet) => STM.STM - (self: TSet, iterable: Iterable): STM.STM -} -``` - -Added in v2.0.0 - -## removeIf - -Removes entries from a `TSet` that satisfy the specified predicate and returns the removed entries -(or `void` if `discard = true`). - -**Signature** - -```ts -export declare const removeIf: { - (predicate: Predicate, options: { readonly discard: true }): (self: TSet) => STM.STM - (predicate: Predicate, options?: { readonly discard: false }): (self: TSet) => STM.STM - (self: TSet, predicate: Predicate, options: { readonly discard: true }): STM.STM - (self: TSet, predicate: Predicate, options?: { readonly discard: false }): STM.STM -} -``` - -Added in v2.0.0 - -## retainIf - -Retains entries in a `TSet` that satisfy the specified predicate and returns the removed entries -(or `void` if `discard = true`). - -**Signature** - -```ts -export declare const retainIf: { - (predicate: Predicate, options: { readonly discard: true }): (self: TSet) => STM.STM - (predicate: Predicate, options?: { readonly discard: false }): (self: TSet) => STM.STM - (self: TSet, predicate: Predicate, options: { readonly discard: true }): STM.STM - (self: TSet, predicate: Predicate, options?: { readonly discard: false }): STM.STM -} -``` - -Added in v2.0.0 - -## takeFirst - -Takes the first matching value, or retries until there is one. - -**Signature** - -```ts -export declare const takeFirst: { - (pf: (a: A) => Option.Option): (self: TSet) => STM.STM - (self: TSet, pf: (a: A) => Option.Option): STM.STM -} -``` - -Added in v2.0.0 - -## takeFirstSTM - -Takes the first matching value, or retries until there is one. - -**Signature** - -```ts -export declare const takeFirstSTM: { - (pf: (a: A) => STM.STM, B>): (self: TSet) => STM.STM - (self: TSet, pf: (a: A) => STM.STM, B>): STM.STM -} -``` - -Added in v2.0.0 - -## takeSome - -Takes all matching values, or retries until there is at least one. - -**Signature** - -```ts -export declare const takeSome: { - (pf: (a: A) => Option.Option): (self: TSet) => STM.STM - (self: TSet, pf: (a: A) => Option.Option): STM.STM -} -``` - -Added in v2.0.0 - -## takeSomeSTM - -Takes all matching values, or retries until there is at least one. - -**Signature** - -```ts -export declare const takeSomeSTM: { - (pf: (a: A) => STM.STM, B>): (self: TSet) => STM.STM - (self: TSet, pf: (a: A) => STM.STM, B>): STM.STM -} -``` - -Added in v2.0.0 - -## transform - -Atomically updates all elements using a pure function. - -**Signature** - -```ts -export declare const transform: { - (f: (a: A) => A): (self: TSet) => STM.STM - (self: TSet, f: (a: A) => A): STM.STM -} -``` - -Added in v2.0.0 - -## transformSTM - -Atomically updates all elements using a transactional function. - -**Signature** - -```ts -export declare const transformSTM: { - (f: (a: A) => STM.STM): (self: TSet) => STM.STM - (self: TSet, f: (a: A) => STM.STM): STM.STM -} -``` - -Added in v2.0.0 - -## union - -Atomically transforms the set into the union of itself and the provided -set. - -**Signature** - -```ts -export declare const union: { - (other: TSet): (self: TSet) => STM.STM - (self: TSet, other: TSet): STM.STM -} -``` - -Added in v2.0.0 - -# symbols - -## TSetTypeId - -**Signature** - -```ts -export declare const TSetTypeId: typeof TSetTypeId -``` - -Added in v2.0.0 - -## TSetTypeId (type alias) - -**Signature** - -```ts -export type TSetTypeId = typeof TSetTypeId -``` - -Added in v2.0.0 - -# utils - -## TSet (namespace) - -Added in v2.0.0 - -### Variance (interface) - -**Signature** - -```ts -export interface Variance { - readonly [TSetTypeId]: { - readonly _A: (_: never) => A - } -} -``` - -Added in v2.0.0 diff --git a/docs/modules/Take.ts.md b/docs/modules/Take.ts.md deleted file mode 100644 index 8c623857e..000000000 --- a/docs/modules/Take.ts.md +++ /dev/null @@ -1,397 +0,0 @@ ---- -title: Take.ts -nav_order: 117 -parent: Modules ---- - -## Take overview - -Added in v2.0.0 - ---- - -

Table of contents

- -- [constructors](#constructors) - - [chunk](#chunk) - - [die](#die) - - [dieMessage](#diemessage) - - [end](#end) - - [fail](#fail) - - [failCause](#failcause) - - [fromEffect](#fromeffect) - - [fromExit](#fromexit) - - [fromPull](#frompull) - - [make](#make) - - [of](#of) -- [destructors](#destructors) - - [done](#done) - - [match](#match) - - [matchEffect](#matcheffect) -- [getters](#getters) - - [isDone](#isdone) - - [isFailure](#isfailure) - - [isSuccess](#issuccess) -- [mapping](#mapping) - - [map](#map) -- [models](#models) - - [Take (interface)](#take-interface) -- [sequencing](#sequencing) - - [tap](#tap) -- [symbols](#symbols) - - [TakeTypeId](#taketypeid) - - [TakeTypeId (type alias)](#taketypeid-type-alias) -- [utils](#utils) - - [Take (namespace)](#take-namespace) - - [Variance (interface)](#variance-interface) - ---- - -# constructors - -## chunk - -Creates a `Take` with the specified chunk. - -**Signature** - -```ts -export declare const chunk:
(chunk: Chunk.Chunk) => Take -``` - -Added in v2.0.0 - -## die - -Creates a failing `Take` with the specified defect. - -**Signature** - -```ts -export declare const die: (defect: unknown) => Take -``` - -Added in v2.0.0 - -## dieMessage - -Creates a failing `Take` with the specified error message. - -**Signature** - -```ts -export declare const dieMessage: (message: string) => Take -``` - -Added in v2.0.0 - -## end - -Represents the end-of-stream marker. - -**Signature** - -```ts -export declare const end: Take -``` - -Added in v2.0.0 - -## fail - -Creates a failing `Take` with the specified error. - -**Signature** - -```ts -export declare const fail: (error: E) => Take -``` - -Added in v2.0.0 - -## failCause - -Creates a failing `Take` with the specified cause. - -**Signature** - -```ts -export declare const failCause: (cause: Cause.Cause) => Take -``` - -Added in v2.0.0 - -## fromEffect - -Creates an effect from `Effect` that does not fail, but succeeds with -the `Take`. Error from stream when pulling is converted to -`Take.failCause`. Creates a single value chunk. - -**Signature** - -```ts -export declare const fromEffect: (effect: Effect.Effect) => Effect.Effect> -``` - -Added in v2.0.0 - -## fromExit - -Creates a `Take` from an `Exit`. - -**Signature** - -```ts -export declare const fromExit: (exit: Exit.Exit) => Take -``` - -Added in v2.0.0 - -## fromPull - -Creates effect from `Effect, Chunk>` that does not fail, but -succeeds with the `Take`. Errors from stream when pulling are converted -to `Take.failCause`, and the end-of-stream is converted to `Take.end`. - -**Signature** - -```ts -export declare const fromPull: ( - pull: Effect.Effect, Chunk.Chunk> -) => Effect.Effect> -``` - -Added in v2.0.0 - -## make - -Constructs a `Take`. - -**Signature** - -```ts -export declare const make: (exit: Exit.Exit, Chunk.Chunk>) => Take -``` - -Added in v2.0.0 - -## of - -Creates a `Take` with a single value chunk. - -**Signature** - -```ts -export declare const of: (value: A) => Take -``` - -Added in v2.0.0 - -# destructors - -## done - -Transforms a `Take` to an `Effect`. - -**Signature** - -```ts -export declare const done: (self: Take) => Effect.Effect, Chunk.Chunk> -``` - -Added in v2.0.0 - -## match - -Folds over the failure cause, success value and end-of-stream marker to -yield a value. - -**Signature** - -```ts -export declare const match: { - (options: { - readonly onEnd: () => Z - readonly onFailure: (cause: Cause.Cause) => Z2 - readonly onSuccess: (chunk: Chunk.Chunk) => Z3 - }): (self: Take) => Z | Z2 | Z3 - ( - self: Take, - options: { - readonly onEnd: () => Z - readonly onFailure: (cause: Cause.Cause) => Z2 - readonly onSuccess: (chunk: Chunk.Chunk) => Z3 - } - ): Z | Z2 | Z3 -} -``` - -Added in v2.0.0 - -## matchEffect - -Effectful version of `Take.fold`. - -Folds over the failure cause, success value and end-of-stream marker to -yield an effect. - -**Signature** - -```ts -export declare const matchEffect: { - (options: { - readonly onEnd: Effect.Effect - readonly onFailure: (cause: Cause.Cause) => Effect.Effect - readonly onSuccess: (chunk: Chunk.Chunk) => Effect.Effect - }): (self: Take) => Effect.Effect - ( - self: Take, - options: { - readonly onEnd: Effect.Effect - readonly onFailure: (cause: Cause.Cause) => Effect.Effect - readonly onSuccess: (chunk: Chunk.Chunk) => Effect.Effect - } - ): Effect.Effect -} -``` - -Added in v2.0.0 - -# getters - -## isDone - -Checks if this `take` is done (`Take.end`). - -**Signature** - -```ts -export declare const isDone: (self: Take) => boolean -``` - -Added in v2.0.0 - -## isFailure - -Checks if this `take` is a failure. - -**Signature** - -```ts -export declare const isFailure: (self: Take) => boolean -``` - -Added in v2.0.0 - -## isSuccess - -Checks if this `take` is a success. - -**Signature** - -```ts -export declare const isSuccess: (self: Take) => boolean -``` - -Added in v2.0.0 - -# mapping - -## map - -Transforms `Take` to `Take` by applying function `f`. - -**Signature** - -```ts -export declare const map: { - (f: (a: A) => B): (self: Take) => Take - (self: Take, f: (a: A) => B): Take -} -``` - -Added in v2.0.0 - -# models - -## Take (interface) - -A `Take` represents a single `take` from a queue modeling a stream of -values. A `Take` may be a failure cause `Cause`, a chunk value `Chunk`, -or an end-of-stream marker. - -**Signature** - -```ts -export interface Take extends Take.Variance, Pipeable { - /** @internal */ - readonly exit: Exit.Exit, Chunk.Chunk> -} -``` - -Added in v2.0.0 - -# sequencing - -## tap - -Returns an effect that effectfully "peeks" at the success of this take. - -**Signature** - -```ts -export declare const tap: { - ( - f: (chunk: Chunk.Chunk) => Effect.Effect - ): (self: Take) => Effect.Effect - ( - self: Take, - f: (chunk: Chunk.Chunk) => Effect.Effect - ): Effect.Effect -} -``` - -Added in v2.0.0 - -# symbols - -## TakeTypeId - -**Signature** - -```ts -export declare const TakeTypeId: typeof TakeTypeId -``` - -Added in v2.0.0 - -## TakeTypeId (type alias) - -**Signature** - -```ts -export type TakeTypeId = typeof TakeTypeId -``` - -Added in v2.0.0 - -# utils - -## Take (namespace) - -Added in v2.0.0 - -### Variance (interface) - -**Signature** - -```ts -export interface Variance { - readonly [TakeTypeId]: { - readonly _E: (_: never) => E - readonly _A: (_: never) => A - } -} -``` - -Added in v2.0.0 diff --git a/docs/modules/TestAnnotation.ts.md b/docs/modules/TestAnnotation.ts.md deleted file mode 100644 index f7a113e9e..000000000 --- a/docs/modules/TestAnnotation.ts.md +++ /dev/null @@ -1,164 +0,0 @@ ---- -title: TestAnnotation.ts -nav_order: 120 -parent: Modules ---- - -## TestAnnotation overview - -Added in v2.0.0 - ---- - -

Table of contents

- -- [utils](#utils) - - [TestAnnotation (interface)](#testannotation-interface) - - [TestAnnotationTypeId](#testannotationtypeid) - - [TestAnnotationTypeId (type alias)](#testannotationtypeid-type-alias) - - [compose](#compose) - - [fibers](#fibers) - - [ignored](#ignored) - - [isTestAnnotation](#istestannotation) - - [make](#make) - - [repeated](#repeated) - - [retried](#retried) - - [tagged](#tagged) - ---- - -# utils - -## TestAnnotation (interface) - -**Signature** - -```ts -export interface TestAnnotation
extends Equal.Equal { - readonly [TestAnnotationTypeId]: TestAnnotationTypeId - readonly identifier: string - readonly tag: Context.Tag - readonly initial: A - readonly combine: (a: A, b: A) => A -} -``` - -Added in v2.0.0 - -## TestAnnotationTypeId - -**Signature** - -```ts -export declare const TestAnnotationTypeId: typeof TestAnnotationTypeId -``` - -Added in v2.0.0 - -## TestAnnotationTypeId (type alias) - -**Signature** - -```ts -export type TestAnnotationTypeId = typeof TestAnnotationTypeId -``` - -Added in v2.0.0 - -## compose - -**Signature** - -```ts -export declare const compose: ( - left: Either.Either>, - right: Either.Either> -) => Either.Either> -``` - -Added in v2.0.0 - -## fibers - -**Signature** - -```ts -export declare const fibers: TestAnnotation< - Either.Either>>>> -> -``` - -Added in v2.0.0 - -## ignored - -An annotation which counts ignored tests. - -**Signature** - -```ts -export declare const ignored: TestAnnotation -``` - -Added in v2.0.0 - -## isTestAnnotation - -**Signature** - -```ts -export declare const isTestAnnotation: (u: unknown) => u is TestAnnotation -``` - -Added in v2.0.0 - -## make - -**Signature** - -```ts -export declare const make: ( - identifier: string, - tag: Context.Tag, - initial: A, - combine: (a: A, b: A) => A -) => TestAnnotation -``` - -Added in v2.0.0 - -## repeated - -An annotation which counts repeated tests. - -**Signature** - -```ts -export declare const repeated: TestAnnotation -``` - -Added in v2.0.0 - -## retried - -An annotation which counts retried tests. - -**Signature** - -```ts -export declare const retried: TestAnnotation -``` - -Added in v2.0.0 - -## tagged - -An annotation which tags tests with strings. - -**Signature** - -```ts -export declare const tagged: TestAnnotation> -``` - -Added in v2.0.0 diff --git a/docs/modules/TestAnnotationMap.ts.md b/docs/modules/TestAnnotationMap.ts.md deleted file mode 100644 index 88e9f42c4..000000000 --- a/docs/modules/TestAnnotationMap.ts.md +++ /dev/null @@ -1,165 +0,0 @@ ---- -title: TestAnnotationMap.ts -nav_order: 121 -parent: Modules ---- - -## TestAnnotationMap overview - -Added in v2.0.0 - ---- - -

Table of contents

- -- [utils](#utils) - - [TestAnnotationMap (interface)](#testannotationmap-interface) - - [TestAnnotationMapTypeId](#testannotationmaptypeid) - - [TestAnnotationMapTypeId (type alias)](#testannotationmaptypeid-type-alias) - - [annotate](#annotate) - - [combine](#combine) - - [empty](#empty) - - [get](#get) - - [isTestAnnotationMap](#istestannotationmap) - - [make](#make) - - [overwrite](#overwrite) - - [update](#update) - ---- - -# utils - -## TestAnnotationMap (interface) - -An annotation map keeps track of annotations of different types. - -**Signature** - -```ts -export interface TestAnnotationMap { - readonly [TestAnnotationMapTypeId]: TestAnnotationMapTypeId - /** @internal */ - readonly map: ReadonlyMap, unknown> -} -``` - -Added in v2.0.0 - -## TestAnnotationMapTypeId - -**Signature** - -```ts -export declare const TestAnnotationMapTypeId: typeof TestAnnotationMapTypeId -``` - -Added in v2.0.0 - -## TestAnnotationMapTypeId (type alias) - -**Signature** - -```ts -export type TestAnnotationMapTypeId = typeof TestAnnotationMapTypeId -``` - -Added in v2.0.0 - -## annotate - -Appends the specified annotation to the annotation map. - -**Signature** - -```ts -export declare const annotate: (
( - key: TestAnnotation.TestAnnotation, - value: A -) => (self: TestAnnotationMap) => TestAnnotationMap) & - ((self: TestAnnotationMap, key: TestAnnotation.TestAnnotation, value: A) => TestAnnotationMap) -``` - -Added in v2.0.0 - -## combine - -**Signature** - -```ts -export declare const combine: ((that: TestAnnotationMap) => (self: TestAnnotationMap) => TestAnnotationMap) & - ((self: TestAnnotationMap, that: TestAnnotationMap) => TestAnnotationMap) -``` - -Added in v2.0.0 - -## empty - -**Signature** - -```ts -export declare const empty: (_: void) => TestAnnotationMap -``` - -Added in v2.0.0 - -## get - -Retrieves the annotation of the specified type, or its default value if -there is none. - -**Signature** - -```ts -export declare const get: ((key: TestAnnotation.TestAnnotation) => (self: TestAnnotationMap) => A) & - ((self: TestAnnotationMap, key: TestAnnotation.TestAnnotation) => A) -``` - -Added in v2.0.0 - -## isTestAnnotationMap - -**Signature** - -```ts -export declare const isTestAnnotationMap: (u: unknown) => u is TestAnnotationMap -``` - -Added in v2.0.0 - -## make - -**Signature** - -```ts -export declare const make: (map: ReadonlyMap, unknown>) => TestAnnotationMap -``` - -Added in v2.0.0 - -## overwrite - -**Signature** - -```ts -export declare const overwrite: (( - key: TestAnnotation.TestAnnotation, - value: A -) => (self: TestAnnotationMap) => TestAnnotationMap) & - ((self: TestAnnotationMap, key: TestAnnotation.TestAnnotation, value: A) => TestAnnotationMap) -``` - -Added in v2.0.0 - -## update - -**Signature** - -```ts -export declare const update: (( - key: TestAnnotation.TestAnnotation, - f: (value: A) => A -) => (self: TestAnnotationMap) => TestAnnotationMap) & - ((self: TestAnnotationMap, key: TestAnnotation.TestAnnotation, f: (value: A) => A) => TestAnnotationMap) -``` - -Added in v2.0.0 diff --git a/docs/modules/TestAnnotations.ts.md b/docs/modules/TestAnnotations.ts.md deleted file mode 100644 index be3ccfae8..000000000 --- a/docs/modules/TestAnnotations.ts.md +++ /dev/null @@ -1,113 +0,0 @@ ---- -title: TestAnnotations.ts -nav_order: 122 -parent: Modules ---- - -## TestAnnotations overview - -Added in v2.0.0 - ---- - -

Table of contents

- -- [utils](#utils) - - [TestAnnotations](#testannotations) - - [TestAnnotations (interface)](#testannotations-interface) - - [TestAnnotationsTypeId](#testannotationstypeid) - - [TestAnnotationsTypeId (type alias)](#testannotationstypeid-type-alias) - - [isTestAnnotations](#istestannotations) - - [make](#make) - ---- - -# utils - -## TestAnnotations - -**Signature** - -```ts -export declare const TestAnnotations: Context.Tag -``` - -Added in v2.0.0 - -## TestAnnotations (interface) - -The `Annotations` trait provides access to an annotation map that tests can -add arbitrary annotations to. Each annotation consists of a string -identifier, an initial value, and a function for combining two values. -Annotations form monoids and you can think of `Annotations` as a more -structured logging service or as a super polymorphic version of the writer -monad effect. - -**Signature** - -```ts -export interface TestAnnotations { - readonly [TestAnnotationsTypeId]: TestAnnotationsTypeId - - readonly ref: Ref.Ref - - /** - * Accesses an `Annotations` instance in the context and retrieves the - * annotation of the specified type, or its default value if there is none. - */ - readonly get:
(key: TestAnnotation.TestAnnotation) => Effect.Effect - - /** - * Accesses an `Annotations` instance in the context and appends the - * specified annotation to the annotation map. - */ - readonly annotate: (key: TestAnnotation.TestAnnotation, value: A) => Effect.Effect - - /** - * Returns the set of all fibers in this test. - */ - readonly supervisedFibers: Effect.Effect>> -} -``` - -Added in v2.0.0 - -## TestAnnotationsTypeId - -**Signature** - -```ts -export declare const TestAnnotationsTypeId: typeof TestAnnotationsTypeId -``` - -Added in v2.0.0 - -## TestAnnotationsTypeId (type alias) - -**Signature** - -```ts -export type TestAnnotationsTypeId = typeof TestAnnotationsTypeId -``` - -Added in v2.0.0 - -## isTestAnnotations - -**Signature** - -```ts -export declare const isTestAnnotations: (u: unknown) => u is TestAnnotations -``` - -Added in v2.0.0 - -## make - -**Signature** - -```ts -export declare const make: (ref: Ref.Ref) => TestAnnotations -``` - -Added in v2.0.0 diff --git a/docs/modules/TestClock.ts.md b/docs/modules/TestClock.ts.md deleted file mode 100644 index 04229d85c..000000000 --- a/docs/modules/TestClock.ts.md +++ /dev/null @@ -1,266 +0,0 @@ ---- -title: TestClock.ts -nav_order: 123 -parent: Modules ---- - -## TestClock overview - -Added in v2.0.0 - ---- - -

Table of contents

- -- [utils](#utils) - - [Data (interface)](#data-interface) - - [TestClock](#testclock) - - [TestClock (interface)](#testclock-interface) - - [adjust](#adjust) - - [adjustWith](#adjustwith) - - [currentTimeMillis](#currenttimemillis) - - [defaultTestClock](#defaulttestclock) - - [live](#live) - - [makeData](#makedata) - - [save](#save) - - [setTime](#settime) - - [sleep](#sleep) - - [sleeps](#sleeps) - - [testClock](#testclock-1) - - [testClockWith](#testclockwith) - ---- - -# utils - -## Data (interface) - -`Data` represents the state of the `TestClock`, including the clock time. - -**Signature** - -```ts -export interface Data { - readonly instant: number - readonly sleeps: Chunk.Chunk]> -} -``` - -Added in v2.0.1 - -## TestClock - -**Signature** - -```ts -export declare const TestClock: Context.Tag -``` - -Added in v2.0.0 - -## TestClock (interface) - -A `TestClock` makes it easy to deterministically and efficiently test effects -involving the passage of time. - -Instead of waiting for actual time to pass, `sleep` and methods implemented -in terms of it schedule effects to take place at a given clock time. Users -can adjust the clock time using the `adjust` and `setTime` methods, and all -effects scheduled to take place on or before that time will automatically be -run in order. - -For example, here is how we can test `Effect.timeout` using `TestClock`: - -```ts -import * as Duration from "effect/Duration" -import * as Effect from "effect/Effect" -import * as Fiber from "effect/Fiber" -import * as TestClock from "effect/TestClock" -import * as Option from "effect/Option" - -Effect.gen(function* () { - const fiber = yield* pipe(Effect.sleep(Duration.minutes(5)), Effect.timeout(Duration.minutes(1)), Effect.fork) - yield* TestClock.adjust(Duration.minutes(1)) - const result = yield* Fiber.join(fiber) - assert.deepStrictEqual(result, Option.none()) -}) -``` - -Note how we forked the fiber that `sleep` was invoked on. Calls to `sleep` -and methods derived from it will semantically block until the time is set to -on or after the time they are scheduled to run. If we didn't fork the fiber -on which we called sleep we would never get to set the time on the line -below. Thus, a useful pattern when using `TestClock` is to fork the effect -being tested, then adjust the clock time, and finally verify that the -expected effects have been performed. - -**Signature** - -```ts -export interface TestClock extends Clock.Clock { - readonly adjust: (duration: Duration.DurationInput) => Effect.Effect - readonly adjustWith: ( - duration: Duration.DurationInput - ) => (effect: Effect.Effect) => Effect.Effect - readonly save: Effect.Effect> - readonly setTime: (time: number) => Effect.Effect - readonly sleeps: Effect.Effect> -} -``` - -Added in v2.0.0 - -## adjust - -Accesses a `TestClock` instance in the context and increments the time -by the specified duration, running any actions scheduled for on or before -the new time in order. - -**Signature** - -```ts -export declare const adjust: (durationInput: Duration.DurationInput) => Effect.Effect -``` - -Added in v2.0.0 - -## adjustWith - -**Signature** - -```ts -export declare const adjustWith: (( - duration: Duration.DurationInput -) => (effect: Effect.Effect) => Effect.Effect) & - ((effect: Effect.Effect, duration: Duration.DurationInput) => Effect.Effect) -``` - -Added in v2.0.0 - -## currentTimeMillis - -Accesses the current time of a `TestClock` instance in the context in -milliseconds. - -**Signature** - -```ts -export declare const currentTimeMillis: Effect.Effect -``` - -Added in v2.0.0 - -## defaultTestClock - -**Signature** - -```ts -export declare const defaultTestClock: Layer.Layer -``` - -Added in v2.0.0 - -## live - -**Signature** - -```ts -export declare const live: (data: Data) => Layer.Layer -``` - -Added in v2.0.0 - -## makeData - -**Signature** - -```ts -export declare const makeData: ( - instant: number, - sleeps: Chunk.Chunk]> -) => Data -``` - -Added in v2.0.0 - -## save - -Accesses a `TestClock` instance in the context and saves the clock -state in an effect which, when run, will restore the `TestClock` to the -saved state. - -**Signature** - -```ts -export declare const save: () => Effect.Effect> -``` - -Added in v2.0.0 - -## setTime - -Accesses a `TestClock` instance in the context and sets the clock time -to the specified `Instant`, running any actions scheduled for on or before -the new time in order. - -**Signature** - -```ts -export declare const setTime: (instant: number) => Effect.Effect -``` - -Added in v2.0.0 - -## sleep - -Semantically blocks the current fiber until the clock time is equal to or -greater than the specified duration. Once the clock time is adjusted to -on or after the duration, the fiber will automatically be resumed. - -**Signature** - -```ts -export declare const sleep: (durationInput: Duration.DurationInput) => Effect.Effect -``` - -Added in v2.0.0 - -## sleeps - -Accesses a `TestClock` instance in the context and returns a list of -times that effects are scheduled to run. - -**Signature** - -```ts -export declare const sleeps: () => Effect.Effect> -``` - -Added in v2.0.0 - -## testClock - -Retrieves the `TestClock` service for this test. - -**Signature** - -```ts -export declare const testClock: () => Effect.Effect -``` - -Added in v2.0.0 - -## testClockWith - -Retrieves the `TestClock` service for this test and uses it to run the -specified workflow. - -**Signature** - -```ts -export declare const testClockWith: ( - f: (testClock: TestClock) => Effect.Effect -) => Effect.Effect -``` - -Added in v2.0.0 diff --git a/docs/modules/TestConfig.ts.md b/docs/modules/TestConfig.ts.md deleted file mode 100644 index 869a547cc..000000000 --- a/docs/modules/TestConfig.ts.md +++ /dev/null @@ -1,80 +0,0 @@ ---- -title: TestConfig.ts -nav_order: 124 -parent: Modules ---- - -## TestConfig overview - -Added in v2.0.0 - ---- - -

Table of contents

- -- [utils](#utils) - - [TestConfig](#testconfig) - - [TestConfig (interface)](#testconfig-interface) - - [make](#make) - ---- - -# utils - -## TestConfig - -**Signature** - -```ts -export declare const TestConfig: Context.Tag -``` - -Added in v2.0.0 - -## TestConfig (interface) - -The `TestConfig` service provides access to default configuration settings -used by tests, including the number of times to repeat tests to ensure -they are stable, the number of times to retry flaky tests, the sufficient -number of samples to check from a random variable, and the maximum number of -shrinkings to minimize large failures. - -**Signature** - -```ts -export interface TestConfig { - /** - * The number of times to repeat tests to ensure they are stable. - */ - readonly repeats: number - /** - * The number of times to retry flaky tests. - */ - readonly retries: number - /** - * The number of sufficient samples to check for a random variable. - */ - readonly samples: number - /** - * The maximum number of shrinkings to minimize large failures - */ - readonly shrinks: number -} -``` - -Added in v2.0.0 - -## make - -**Signature** - -```ts -export declare const make: (params: { - readonly repeats: number - readonly retries: number - readonly samples: number - readonly shrinks: number -}) => TestConfig -``` - -Added in v2.0.0 diff --git a/docs/modules/TestContext.ts.md b/docs/modules/TestContext.ts.md deleted file mode 100644 index 42de83f17..000000000 --- a/docs/modules/TestContext.ts.md +++ /dev/null @@ -1,41 +0,0 @@ ---- -title: TestContext.ts -nav_order: 125 -parent: Modules ---- - -## TestContext overview - -Added in v2.0.0 - ---- - -

Table of contents

- -- [utils](#utils) - - [LiveContext](#livecontext) - - [TestContext](#testcontext) - ---- - -# utils - -## LiveContext - -**Signature** - -```ts -export declare const LiveContext: Layer.Layer -``` - -Added in v2.0.0 - -## TestContext - -**Signature** - -```ts -export declare const TestContext: Layer.Layer -``` - -Added in v2.0.0 diff --git a/docs/modules/TestLive.ts.md b/docs/modules/TestLive.ts.md deleted file mode 100644 index 0a0ee69fc..000000000 --- a/docs/modules/TestLive.ts.md +++ /dev/null @@ -1,82 +0,0 @@ ---- -title: TestLive.ts -nav_order: 126 -parent: Modules ---- - -## TestLive overview - -Added in v2.0.0 - ---- - -

Table of contents

- -- [utils](#utils) - - [TestLive](#testlive) - - [TestLive (interface)](#testlive-interface) - - [TestLiveTypeId](#testlivetypeid) - - [TestLiveTypeId (type alias)](#testlivetypeid-type-alias) - - [make](#make) - ---- - -# utils - -## TestLive - -**Signature** - -```ts -export declare const TestLive: Context.Tag -``` - -Added in v2.0.0 - -## TestLive (interface) - -The `Live` trait provides access to the "live" default Effect services from -within tests for workflows such as printing test results to the console or -timing out tests where it is necessary to access the real implementations of -these services. - -**Signature** - -```ts -export interface TestLive { - readonly [TestLiveTypeId]: TestLiveTypeId - readonly provide: (effect: Effect.Effect) => Effect.Effect -} -``` - -Added in v2.0.0 - -## TestLiveTypeId - -**Signature** - -```ts -export declare const TestLiveTypeId: typeof TestLiveTypeId -``` - -Added in v2.0.0 - -## TestLiveTypeId (type alias) - -**Signature** - -```ts -export type TestLiveTypeId = typeof TestLiveTypeId -``` - -Added in v2.0.0 - -## make - -**Signature** - -```ts -export declare const make: (services: Context.Context) => TestLive -``` - -Added in v2.0.0 diff --git a/docs/modules/TestServices.ts.md b/docs/modules/TestServices.ts.md deleted file mode 100644 index ef5fdfd3e..000000000 --- a/docs/modules/TestServices.ts.md +++ /dev/null @@ -1,502 +0,0 @@ ---- -title: TestServices.ts -nav_order: 127 -parent: Modules ---- - -## TestServices overview - -Added in v2.0.0 - ---- - -

Table of contents

- -- [utils](#utils) - - [TestServices (type alias)](#testservices-type-alias) - - [annotate](#annotate) - - [annotations](#annotations) - - [annotationsLayer](#annotationslayer) - - [annotationsWith](#annotationswith) - - [currentServices](#currentservices) - - [get](#get) - - [live](#live) - - [liveLayer](#livelayer) - - [liveServices](#liveservices) - - [liveWith](#livewith) - - [provideLive](#providelive) - - [provideWithLive](#providewithlive) - - [repeats](#repeats) - - [retries](#retries) - - [samples](#samples) - - [shrinks](#shrinks) - - [size](#size) - - [sized](#sized) - - [sizedLayer](#sizedlayer) - - [sizedWith](#sizedwith) - - [supervisedFibers](#supervisedfibers) - - [testConfig](#testconfig) - - [testConfigLayer](#testconfiglayer) - - [testConfigWith](#testconfigwith) - - [withAnnotations](#withannotations) - - [withAnnotationsScoped](#withannotationsscoped) - - [withLive](#withlive) - - [withLiveScoped](#withlivescoped) - - [withSize](#withsize) - - [withSized](#withsized) - - [withSizedScoped](#withsizedscoped) - - [withTestConfig](#withtestconfig) - - [withTestConfigScoped](#withtestconfigscoped) - ---- - -# utils - -## TestServices (type alias) - -**Signature** - -```ts -export type TestServices = Annotations.TestAnnotations | Live.TestLive | Sized.TestSized | TestConfig.TestConfig -``` - -Added in v2.0.0 - -## annotate - -Accesses an `Annotations` instance in the context and appends the -specified annotation to the annotation map. - -**Signature** - -```ts -export declare const annotate:
(key: TestAnnotation.TestAnnotation, value: A) => Effect.Effect -``` - -Added in v2.0.0 - -## annotations - -Retrieves the `Annotations` service for this test. - -**Signature** - -```ts -export declare const annotations: () => Effect.Effect -``` - -Added in v2.0.0 - -## annotationsLayer - -Constructs a new `Annotations` service wrapped in a layer. - -**Signature** - -```ts -export declare const annotationsLayer: () => Layer.Layer -``` - -Added in v2.0.0 - -## annotationsWith - -Retrieves the `Annotations` service for this test and uses it to run the -specified workflow. - -**Signature** - -```ts -export declare const annotationsWith: ( - f: (annotations: Annotations.TestAnnotations) => Effect.Effect -) => Effect.Effect -``` - -Added in v2.0.0 - -## currentServices - -**Signature** - -```ts -export declare const currentServices: FiberRef.FiberRef> -``` - -Added in v2.0.0 - -## get - -Accesses an `Annotations` instance in the context and retrieves the -annotation of the specified type, or its default value if there is none. - -**Signature** - -```ts -export declare const get: (key: TestAnnotation.TestAnnotation) => Effect.Effect -``` - -Added in v2.0.0 - -## live - -Retrieves the `Live` service for this test. - -**Signature** - -```ts -export declare const live: Effect.Effect -``` - -Added in v2.0.0 - -## liveLayer - -Constructs a new `Live` service wrapped in a layer. - -**Signature** - -```ts -export declare const liveLayer: () => Layer.Layer -``` - -Added in v2.0.0 - -## liveServices - -The default Effect test services. - -**Signature** - -```ts -export declare const liveServices: Context.Context -``` - -Added in v2.0.0 - -## liveWith - -Retrieves the `Live` service for this test and uses it to run the specified -workflow. - -**Signature** - -```ts -export declare const liveWith: (f: (live: Live.TestLive) => Effect.Effect) => Effect.Effect -``` - -Added in v2.0.0 - -## provideLive - -Provides a workflow with the "live" default Effect services. - -**Signature** - -```ts -export declare const provideLive: (effect: Effect.Effect) => Effect.Effect -``` - -Added in v2.0.0 - -## provideWithLive - -Runs a transformation function with the live default Effect services while -ensuring that the workflow itself is run with the test services. - -**Signature** - -```ts -export declare const provideWithLive: (( - f: (effect: Effect.Effect) => Effect.Effect -) => (self: Effect.Effect) => Effect.Effect) & - (( - self: Effect.Effect, - f: (effect: Effect.Effect) => Effect.Effect - ) => Effect.Effect) -``` - -Added in v2.0.0 - -## repeats - -The number of times to repeat tests to ensure they are stable. - -**Signature** - -```ts -export declare const repeats: Effect.Effect -``` - -Added in v2.0.0 - -## retries - -The number of times to retry flaky tests. - -**Signature** - -```ts -export declare const retries: Effect.Effect -``` - -Added in v2.0.0 - -## samples - -The number of sufficient samples to check for a random variable. - -**Signature** - -```ts -export declare const samples: Effect.Effect -``` - -Added in v2.0.0 - -## shrinks - -The maximum number of shrinkings to minimize large failures. - -**Signature** - -```ts -export declare const shrinks: Effect.Effect -``` - -Added in v2.0.0 - -## size - -**Signature** - -```ts -export declare const size: Effect.Effect -``` - -Added in v2.0.0 - -## sized - -Retrieves the `Sized` service for this test. - -**Signature** - -```ts -export declare const sized: Effect.Effect -``` - -Added in v2.0.0 - -## sizedLayer - -**Signature** - -```ts -export declare const sizedLayer: (size: number) => Layer.Layer -``` - -Added in v2.0.0 - -## sizedWith - -Retrieves the `Sized` service for this test and uses it to run the -specified workflow. - -**Signature** - -```ts -export declare const sizedWith: ( - f: (sized: Sized.TestSized) => Effect.Effect -) => Effect.Effect -``` - -Added in v2.0.0 - -## supervisedFibers - -Returns the set of all fibers in this test. - -**Signature** - -```ts -export declare const supervisedFibers: () => Effect.Effect< - never, - never, - SortedSet.SortedSet> -> -``` - -Added in v2.0.0 - -## testConfig - -Retrieves the `TestConfig` service for this test. - -**Signature** - -```ts -export declare const testConfig: Effect.Effect -``` - -Added in v2.0.0 - -## testConfigLayer - -Constructs a new `TestConfig` service with the specified settings. - -**Signature** - -```ts -export declare const testConfigLayer: (params: { - readonly repeats: number - readonly retries: number - readonly samples: number - readonly shrinks: number -}) => Layer.Layer -``` - -Added in v2.0.0 - -## testConfigWith - -Retrieves the `TestConfig` service for this test and uses it to run the -specified workflow. - -**Signature** - -```ts -export declare const testConfigWith: ( - f: (config: TestConfig.TestConfig) => Effect.Effect -) => Effect.Effect -``` - -Added in v2.0.0 - -## withAnnotations - -Executes the specified workflow with the specified implementation of the -annotations service. - -**Signature** - -```ts -export declare const withAnnotations: (( - annotations: Annotations.TestAnnotations -) => (effect: Effect.Effect) => Effect.Effect) & - ((effect: Effect.Effect, annotations: Annotations.TestAnnotations) => Effect.Effect) -``` - -Added in v2.0.0 - -## withAnnotationsScoped - -Sets the implementation of the annotations service to the specified value -and restores it to its original value when the scope is closed. - -**Signature** - -```ts -export declare const withAnnotationsScoped: ( - annotations: Annotations.TestAnnotations -) => Effect.Effect -``` - -Added in v2.0.0 - -## withLive - -Executes the specified workflow with the specified implementation of the -live service. - -**Signature** - -```ts -export declare const withLive: (( - live: Live.TestLive -) => (effect: Effect.Effect) => Effect.Effect) & - ((effect: Effect.Effect, live: Live.TestLive) => Effect.Effect) -``` - -Added in v2.0.0 - -## withLiveScoped - -Sets the implementation of the live service to the specified value and -restores it to its original value when the scope is closed. - -**Signature** - -```ts -export declare const withLiveScoped: (live: Live.TestLive) => Effect.Effect -``` - -Added in v2.0.0 - -## withSize - -**Signature** - -```ts -export declare const withSize: ((size: number) => (effect: Effect.Effect) => Effect.Effect) & - ((effect: Effect.Effect, size: number) => Effect.Effect) -``` - -Added in v2.0.0 - -## withSized - -Executes the specified workflow with the specified implementation of the -sized service. - -**Signature** - -```ts -export declare const withSized: (( - sized: Sized.TestSized -) => (effect: Effect.Effect) => Effect.Effect) & - ((effect: Effect.Effect, sized: Sized.TestSized) => Effect.Effect) -``` - -Added in v2.0.0 - -## withSizedScoped - -Sets the implementation of the sized service to the specified value and -restores it to its original value when the scope is closed. - -**Signature** - -```ts -export declare const withSizedScoped: (sized: Sized.TestSized) => Effect.Effect -``` - -Added in v2.0.0 - -## withTestConfig - -Executes the specified workflow with the specified implementation of the -config service. - -**Signature** - -```ts -export declare const withTestConfig: (( - config: TestConfig.TestConfig -) => (effect: Effect.Effect) => Effect.Effect) & - ((effect: Effect.Effect, config: TestConfig.TestConfig) => Effect.Effect) -``` - -Added in v2.0.0 - -## withTestConfigScoped - -Sets the implementation of the config service to the specified value and -restores it to its original value when the scope is closed. - -**Signature** - -```ts -export declare const withTestConfigScoped: (config: TestConfig.TestConfig) => Effect.Effect -``` - -Added in v2.0.0 diff --git a/docs/modules/TestSized.ts.md b/docs/modules/TestSized.ts.md deleted file mode 100644 index b76760a4f..000000000 --- a/docs/modules/TestSized.ts.md +++ /dev/null @@ -1,90 +0,0 @@ ---- -title: TestSized.ts -nav_order: 128 -parent: Modules ---- - -## TestSized overview - -Added in v2.0.0 - ---- - -

Table of contents

- -- [utils](#utils) - - [TestSized](#testsized) - - [TestSized (interface)](#testsized-interface) - - [TestSizedTypeId](#testsizedtypeid) - - [TestSizedTypeId (type alias)](#testsizedtypeid-type-alias) - - [fromFiberRef](#fromfiberref) - - [make](#make) - ---- - -# utils - -## TestSized - -**Signature** - -```ts -export declare const TestSized: Context.Tag -``` - -Added in v2.0.0 - -## TestSized (interface) - -**Signature** - -```ts -export interface TestSized { - readonly [TestSizedTypeId]: TestSizedTypeId - readonly fiberRef: FiberRef.FiberRef - readonly size: Effect.Effect - readonly withSize: (size: number) => (effect: Effect.Effect) => Effect.Effect -} -``` - -Added in v2.0.0 - -## TestSizedTypeId - -**Signature** - -```ts -export declare const TestSizedTypeId: typeof TestSizedTypeId -``` - -Added in v2.0.0 - -## TestSizedTypeId (type alias) - -**Signature** - -```ts -export type TestSizedTypeId = typeof TestSizedTypeId -``` - -Added in v2.0.0 - -## fromFiberRef - -**Signature** - -```ts -export declare const fromFiberRef: (fiberRef: FiberRef.FiberRef) => TestSized -``` - -Added in v2.0.0 - -## make - -**Signature** - -```ts -export declare const make: (size: number) => TestSized -``` - -Added in v2.0.0 diff --git a/docs/modules/Tracer.ts.md b/docs/modules/Tracer.ts.md deleted file mode 100644 index 0e322515a..000000000 --- a/docs/modules/Tracer.ts.md +++ /dev/null @@ -1,220 +0,0 @@ ---- -title: Tracer.ts -nav_order: 133 -parent: Modules ---- - -## Tracer overview - -Added in v2.0.0 - ---- - -

Table of contents

- -- [constructors](#constructors) - - [externalSpan](#externalspan) - - [make](#make) - - [tracerWith](#tracerwith) -- [models](#models) - - [ExternalSpan (interface)](#externalspan-interface) - - [ParentSpan (type alias)](#parentspan-type-alias) - - [Span (interface)](#span-interface) - - [SpanLink (interface)](#spanlink-interface) - - [SpanStatus (type alias)](#spanstatus-type-alias) -- [tags](#tags) - - [ParentSpan](#parentspan) - - [Tracer](#tracer) -- [utils](#utils) - - [Tracer (interface)](#tracer-interface) - - [TracerTypeId](#tracertypeid) - - [TracerTypeId (type alias)](#tracertypeid-type-alias) - ---- - -# constructors - -## externalSpan - -**Signature** - -```ts -export declare const externalSpan: (options: { - readonly spanId: string - readonly traceId: string - readonly sampled?: boolean | undefined - readonly context?: Context.Context | undefined -}) => ExternalSpan -``` - -Added in v2.0.0 - -## make - -**Signature** - -```ts -export declare const make: (options: Omit) => Tracer -``` - -Added in v2.0.0 - -## tracerWith - -**Signature** - -```ts -export declare const tracerWith: (f: (tracer: Tracer) => Effect.Effect) => Effect.Effect -``` - -Added in v2.0.0 - -# models - -## ExternalSpan (interface) - -**Signature** - -```ts -export interface ExternalSpan { - readonly _tag: "ExternalSpan" - readonly spanId: string - readonly traceId: string - readonly sampled: boolean - readonly context: Context.Context -} -``` - -Added in v2.0.0 - -## ParentSpan (type alias) - -**Signature** - -```ts -export type ParentSpan = Span | ExternalSpan -``` - -Added in v2.0.0 - -## Span (interface) - -**Signature** - -```ts -export interface Span { - readonly _tag: "Span" - readonly name: string - readonly spanId: string - readonly traceId: string - readonly parent: Option.Option - readonly context: Context.Context - readonly status: SpanStatus - readonly attributes: ReadonlyMap - readonly links: ReadonlyArray - readonly sampled: boolean - readonly end: (endTime: bigint, exit: Exit.Exit) => void - readonly attribute: (key: string, value: unknown) => void - readonly event: (name: string, startTime: bigint, attributes?: Record) => void -} -``` - -Added in v2.0.0 - -## SpanLink (interface) - -**Signature** - -```ts -export interface SpanLink { - readonly _tag: "SpanLink" - readonly span: ParentSpan - readonly attributes: Readonly> -} -``` - -Added in v2.0.0 - -## SpanStatus (type alias) - -**Signature** - -```ts -export type SpanStatus = - | { - _tag: "Started" - startTime: bigint - } - | { - _tag: "Ended" - startTime: bigint - endTime: bigint - exit: Exit.Exit - } -``` - -Added in v2.0.0 - -# tags - -## ParentSpan - -**Signature** - -```ts -export declare const ParentSpan: Context.Tag -``` - -Added in v2.0.0 - -## Tracer - -**Signature** - -```ts -export declare const Tracer: Context.Tag -``` - -Added in v2.0.0 - -# utils - -## Tracer (interface) - -**Signature** - -```ts -export interface Tracer { - readonly [TracerTypeId]: TracerTypeId - readonly span: ( - name: string, - parent: Option.Option, - context: Context.Context, - links: ReadonlyArray, - startTime: bigint - ) => Span - readonly context: (f: () => X, fiber: Fiber.RuntimeFiber) => X -} -``` - -Added in v2.0.0 - -## TracerTypeId - -**Signature** - -```ts -export declare const TracerTypeId: typeof TracerTypeId -``` - -Added in v2.0.0 - -## TracerTypeId (type alias) - -**Signature** - -```ts -export type TracerTypeId = typeof TracerTypeId -``` - -Added in v2.0.0 diff --git a/docs/modules/Tuple.ts.md b/docs/modules/Tuple.ts.md deleted file mode 100644 index fc920c125..000000000 --- a/docs/modules/Tuple.ts.md +++ /dev/null @@ -1,275 +0,0 @@ ---- -title: Tuple.ts -nav_order: 139 -parent: Modules ---- - -## Tuple overview - -This module provides utility functions for working with tuples in TypeScript. - -Added in v2.0.0 - ---- - -

Table of contents

- -- [combinators](#combinators) - - [getEquivalence](#getequivalence) - - [getOrder](#getorder) -- [concatenating](#concatenating) - - [appendElement](#appendelement) -- [constructors](#constructors) - - [make](#make) -- [getters](#getters) - - [getFirst](#getfirst) - - [getSecond](#getsecond) -- [mapping](#mapping) - - [mapBoth](#mapboth) - - [mapFirst](#mapfirst) - - [mapSecond](#mapsecond) -- [type lambdas](#type-lambdas) - - [TupleTypeLambda (interface)](#tupletypelambda-interface) -- [utils](#utils) - - [swap](#swap) - ---- - -# combinators - -## getEquivalence - -Given a tuple of `Equivalence`s returns a new `Equivalence` that compares values of a tuple -by applying each `Equivalence` to the corresponding element of the tuple. - -**Signature** - -```ts -export declare const getEquivalence: []>( - ...isEquivalents: T -) => Equivalence.Equivalence< - Readonly<{ [I in keyof T]: [T[I]] extends [Equivalence.Equivalence] ? A : never }> -> -``` - -Added in v2.0.0 - -## getOrder - -This function creates and returns a new `Order` for a tuple of values based on the given `Order`s for each element in the tuple. -The returned `Order` compares two tuples of the same type by applying the corresponding `Order` to each element in the tuple. -It is useful when you need to compare two tuples of the same type and you have a specific way of comparing each element -of the tuple. - -**Signature** - -```ts -export declare const getOrder: []>( - ...elements: T -) => order.Order<{ [I in keyof T]: [T[I]] extends [order.Order] ? A : never }> -``` - -Added in v2.0.0 - -# concatenating - -## appendElement - -Appends an element to the end of a tuple. - -**Signature** - -```ts -export declare const appendElement: { - (that: B):
(self: A) => [...A, B] - (self: A, that: B): [...A, B] -} -``` - -Added in v2.0.0 - -# constructors - -## make - -Constructs a new tuple from the provided values. - -**Signature** - -```ts -export declare const make: (...elements: A) => A -``` - -**Example** - -```ts -import { make } from "effect/Tuple" - -assert.deepStrictEqual(make(1, "hello", true), [1, "hello", true]) -``` - -Added in v2.0.0 - -# getters - -## getFirst - -Return the first element of a tuple. - -**Signature** - -```ts -export declare const getFirst: (self: readonly [L, R]) => L -``` - -**Example** - -```ts -import { getFirst } from "effect/Tuple" - -assert.deepStrictEqual(getFirst(["hello", 42]), "hello") -``` - -Added in v2.0.0 - -## getSecond - -Return the second element of a tuple. - -**Signature** - -```ts -export declare const getSecond: (self: readonly [L, R]) => R -``` - -**Example** - -```ts -import { getSecond } from "effect/Tuple" - -assert.deepStrictEqual(getSecond(["hello", 42]), 42) -``` - -Added in v2.0.0 - -# mapping - -## mapBoth - -Transforms both elements of a tuple using the given functions. - -**Signature** - -```ts -export declare const mapBoth: { - (options: { - readonly onFirst: (e: L1) => L2 - readonly onSecond: (a: R1) => R2 - }): (self: readonly [L1, R1]) => [L2, R2] - ( - self: readonly [L1, R1], - options: { readonly onFirst: (e: L1) => L2; readonly onSecond: (a: R1) => R2 } - ): [L2, R2] -} -``` - -**Example** - -```ts -import { mapBoth } from "effect/Tuple" - -assert.deepStrictEqual(mapBoth(["hello", 42], { onFirst: (s) => s.toUpperCase(), onSecond: (n) => n.toString() }), [ - "HELLO", - "42" -]) -``` - -Added in v2.0.0 - -## mapFirst - -Transforms the first component of a tuple using a given function. - -**Signature** - -```ts -export declare const mapFirst: { - (f: (left: L1) => L2): (self: readonly [L1, R]) => [L2, R] - (self: readonly [L1, R], f: (left: L1) => L2): [L2, R] -} -``` - -**Example** - -```ts -import { mapFirst } from "effect/Tuple" - -assert.deepStrictEqual( - mapFirst(["hello", 42], (s) => s.toUpperCase()), - ["HELLO", 42] -) -``` - -Added in v2.0.0 - -## mapSecond - -Transforms the second component of a tuple using a given function. - -**Signature** - -```ts -export declare const mapSecond: { - (f: (right: R1) => R2): (self: readonly [L, R1]) => [L, R2] - (self: readonly [L, R1], f: (right: R1) => R2): [L, R2] -} -``` - -**Example** - -```ts -import { mapSecond } from "effect/Tuple" - -assert.deepStrictEqual( - mapSecond(["hello", 42], (n) => n.toString()), - ["hello", "42"] -) -``` - -Added in v2.0.0 - -# type lambdas - -## TupleTypeLambda (interface) - -**Signature** - -```ts -export interface TupleTypeLambda extends TypeLambda { - readonly type: [this["Out1"], this["Target"]] -} -``` - -Added in v2.0.0 - -# utils - -## swap - -Swaps the two elements of a tuple. - -**Signature** - -```ts -export declare const swap: (self: readonly [L, R]) => [R, L] -``` - -**Example** - -```ts -import { swap } from "effect/Tuple" - -assert.deepStrictEqual(swap(["hello", 42]), [42, "hello"]) -``` - -Added in v2.0.0 diff --git a/docs/modules/Types.ts.md b/docs/modules/Types.ts.md deleted file mode 100644 index d5c8e854a..000000000 --- a/docs/modules/Types.ts.md +++ /dev/null @@ -1,233 +0,0 @@ ---- -title: Types.ts -nav_order: 140 -parent: Modules ---- - -## Types overview - -A collection of types that are commonly used types. - -Added in v2.0.0 - ---- - -

Table of contents

- -- [models](#models) - - [Concurrency (type alias)](#concurrency-type-alias) - - [Equals (type alias)](#equals-type-alias) - - [MergeLeft (type alias)](#mergeleft-type-alias) - - [MergeRight (type alias)](#mergeright-type-alias) -- [types](#types) - - [ExcludeTag (type alias)](#excludetag-type-alias) - - [ExtractTag (type alias)](#extracttag-type-alias) - - [Mutable (type alias)](#mutable-type-alias) - - [Simplify (type alias)](#simplify-type-alias) - - [Tags (type alias)](#tags-type-alias) - - [UnionToIntersection (type alias)](#uniontointersection-type-alias) - ---- - -# models - -## Concurrency (type alias) - -Describes the concurrency to use when executing multiple Effect's. - -**Signature** - -```ts -export type Concurrency = number | "unbounded" | "inherit" -``` - -Added in v2.0.0 - -## Equals (type alias) - -Determines if two types are equal. - -**Signature** - -```ts -export type Equals = (() => T extends X ? 1 : 2) extends () => T extends Y ? 1 : 2 ? true : false -``` - -**Example** - -```ts -import * as Types from "effect/Types" - -type Res1 = Types.Equals<{ a: number }, { a: number }> // true -type Res2 = Types.Equals<{ a: number }, { b: number }> // false -``` - -Added in v2.0.0 - -## MergeLeft (type alias) - -Merges two object where the keys of the left object take precedence in the case of a conflict. - -**Signature** - -```ts -export type MergeLeft = Simplify<{ - [k in keyof K | keyof H]: k extends keyof K ? K[k] : k extends keyof H ? H[k] : never -}> -``` - -**Example** - -```ts -import * as Types from "effect/Types" -type MergeLeft = Types.MergeLeft<{ a: number; b: number }, { a: string }> // { a: number; b: number; } -``` - -Added in v2.0.0 - -## MergeRight (type alias) - -Merges two object where the keys of the right object take precedence in the case of a conflict. - -**Signature** - -```ts -export type MergeRight = Simplify<{ - [k in keyof K | keyof H]: k extends keyof H ? H[k] : k extends keyof K ? K[k] : never -}> -``` - -**Example** - -```ts -import * as Types from "effect/Types" -type MergeRight = Types.MergeRight<{ a: number; b: number }, { a: string }> // { a: string; b: number; } -``` - -Added in v2.0.0 - -# types - -## ExcludeTag (type alias) - -Excludes the tagged object from the type. - -**Signature** - -```ts -export type ExcludeTag> = Exclude -``` - -**Example** - -```ts -import * as Types from "effect/Types" - -type Res = Types.ExcludeTag // string | { _tag: "b" } -``` - -Added in v2.0.0 - -## ExtractTag (type alias) - -Extracts the type of the given tag. - -**Signature** - -```ts -export type ExtractTag> = Extract -``` - -**Example** - -```ts -import * as Types from "effect/Types" - -type Res = Types.ExtractTag<{ _tag: "a"; a: number } | { _tag: "b"; b: number }, "b"> // { _tag: "b", b: number } -``` - -Added in v2.0.0 - -## Mutable (type alias) - -Make all properties in `T` mutable. Supports arrays, tuples, and records as well. - -**Signature** - -```ts -export type Mutable = { - -readonly [P in keyof T]: T[P] -} -``` - -**Example** - -```ts -import type * as Types from "effect/Types" - -type MutableStruct = Types.Mutable<{ readonly a: string; readonly b: number }> // { a: string; b: number; } - -type MutableArray = Types.Mutable> // string[] - -type MutableTuple = Types.Mutable // [string, number] - -type MutableRecord = Types.Mutable<{ readonly [_: string]: number }> // { [x: string]: number; } -``` - -Added in v2.0.0 - -## Simplify (type alias) - -Simplifies the type signature of a type. - -**Signature** - -```ts -export type Simplify
= { - [K in keyof A]: A[K] -} extends infer B - ? B - : never -``` - -**Example** - -```ts -import * as Types from "effect/Types" - -type Res = Types.Simplify<{ a: number } & { b: number }> // { a: number; b: number; } -``` - -Added in v2.0.0 - -## Tags (type alias) - -Returns the tags in a type. - -**Signature** - -```ts -export type Tags = E extends { _tag: string } ? E["_tag"] : never -``` - -**Example** - -```ts -import * as Types from "effect/Types" - -type Res = Types.Tags // "a" | "b" -``` - -Added in v2.0.0 - -## UnionToIntersection (type alias) - -A utility type that transforms a union type `T` into an intersection type. - -**Signature** - -```ts -export type UnionToIntersection = (T extends any ? (x: T) => any : never) extends (x: infer R) => any ? R : never -``` - -Added in v2.0.0 diff --git a/docs/modules/Unify.ts.md b/docs/modules/Unify.ts.md deleted file mode 100644 index 981322d4a..000000000 --- a/docs/modules/Unify.ts.md +++ /dev/null @@ -1,91 +0,0 @@ ---- -title: Unify.ts -nav_order: 141 -parent: Modules ---- - -## Unify overview - -Added in v2.0.0 - ---- - -

Table of contents

- -- [utils](#utils) - - [Unify (type alias)](#unify-type-alias) - - [ignoreSymbol (type alias)](#ignoresymbol-type-alias) - - [typeSymbol (type alias)](#typesymbol-type-alias) - - [unify](#unify) - - [unifySymbol (type alias)](#unifysymbol-type-alias) - ---- - -# utils - -## Unify (type alias) - -**Signature** - -```ts -export type Unify
= Values & { [typeSymbol]: A }>> extends infer Z - ? Z | Exclude | FilterOut - : never -``` - -Added in v2.0.0 - -## ignoreSymbol (type alias) - -**Signature** - -```ts -export type ignoreSymbol = typeof ignoreSymbol -``` - -Added in v2.0.0 - -## typeSymbol (type alias) - -**Signature** - -```ts -export type typeSymbol = typeof typeSymbol -``` - -Added in v2.0.0 - -## unify - -**Signature** - -```ts -export declare const unify: { - ( - x: (...args: Args) => (...args: Args2) => (...args: Args3) => (...args: Args4) => (...args: Args5) => T - ): (...args: Args) => (...args: Args2) => (...args: Args3) => (...args: Args4) => (...args: Args5) => Unify - ( - x: (...args: Args) => (...args: Args2) => (...args: Args3) => (...args: Args4) => T - ): (...args: Args) => (...args: Args2) => (...args: Args3) => (...args: Args4) => Unify - ( - x: (...args: Args) => (...args: Args2) => (...args: Args3) => T - ): (...args: Args) => (...args: Args2) => (...args: Args3) => Unify - ( - x: (...args: Args) => (...args: Args2) => T - ): (...args: Args) => (...args: Args2) => Unify - (x: (...args: Args) => T): (...args: Args) => Unify - (x: T): Unify -} -``` - -Added in v2.0.0 - -## unifySymbol (type alias) - -**Signature** - -```ts -export type unifySymbol = typeof unifySymbol -``` - -Added in v2.0.0 diff --git a/docs/modules/UpstreamPullRequest.ts.md b/docs/modules/UpstreamPullRequest.ts.md deleted file mode 100644 index 02d59a043..000000000 --- a/docs/modules/UpstreamPullRequest.ts.md +++ /dev/null @@ -1,201 +0,0 @@ ---- -title: UpstreamPullRequest.ts -nav_order: 142 -parent: Modules ---- - -## UpstreamPullRequest overview - -Added in v2.0.0 - ---- - -

Table of contents

- -- [constructors](#constructors) - - [NoUpstream](#noupstream) - - [Pulled](#pulled) -- [folding](#folding) - - [match](#match) -- [models](#models) - - [NoUpstream (interface)](#noupstream-interface) - - [Pulled (interface)](#pulled-interface) - - [UpstreamPullRequest (type alias)](#upstreampullrequest-type-alias) -- [refinements](#refinements) - - [isNoUpstream](#isnoupstream) - - [isPulled](#ispulled) - - [isUpstreamPullRequest](#isupstreampullrequest) -- [symbols](#symbols) - - [UpstreamPullRequestTypeId](#upstreampullrequesttypeid) - - [UpstreamPullRequestTypeId (type alias)](#upstreampullrequesttypeid-type-alias) -- [utils](#utils) - - [UpstreamPullRequest (namespace)](#upstreampullrequest-namespace) - - [Variance (interface)](#variance-interface) - ---- - -# constructors - -## NoUpstream - -**Signature** - -```ts -export declare const NoUpstream: (activeDownstreamCount: number) => UpstreamPullRequest -``` - -Added in v2.0.0 - -## Pulled - -**Signature** - -```ts -export declare const Pulled:
(value: A) => UpstreamPullRequest -``` - -Added in v2.0.0 - -# folding - -## match - -Folds an `UpstreamPullRequest` into a value of type `Z`. - -**Signature** - -```ts -export declare const match: { - (options: { - readonly onPulled: (value: A) => Z - readonly onNoUpstream: (activeDownstreamCount: number) => Z - }): (self: UpstreamPullRequest) => Z - ( - self: UpstreamPullRequest, - options: { readonly onPulled: (value: A) => Z; readonly onNoUpstream: (activeDownstreamCount: number) => Z } - ): Z -} -``` - -Added in v2.0.0 - -# models - -## NoUpstream (interface) - -**Signature** - -```ts -export interface NoUpstream extends UpstreamPullRequest.Variance { - readonly _tag: "NoUpstream" - readonly activeDownstreamCount: number -} -``` - -Added in v2.0.0 - -## Pulled (interface) - -**Signature** - -```ts -export interface Pulled extends UpstreamPullRequest.Variance { - readonly _tag: "Pulled" - readonly value: A -} -``` - -Added in v2.0.0 - -## UpstreamPullRequest (type alias) - -**Signature** - -```ts -export type UpstreamPullRequest = Pulled | NoUpstream -``` - -Added in v2.0.0 - -# refinements - -## isNoUpstream - -Returns `true` if the specified `UpstreamPullRequest` is a `NoUpstream`, -`false` otherwise. - -**Signature** - -```ts -export declare const isNoUpstream: (self: UpstreamPullRequest) => self is NoUpstream -``` - -Added in v2.0.0 - -## isPulled - -Returns `true` if the specified `UpstreamPullRequest` is a `Pulled`, `false` -otherwise. - -**Signature** - -```ts -export declare const isPulled: (self: UpstreamPullRequest) => self is Pulled -``` - -Added in v2.0.0 - -## isUpstreamPullRequest - -Returns `true` if the specified value is an `UpstreamPullRequest`, `false` -otherwise. - -**Signature** - -```ts -export declare const isUpstreamPullRequest: (u: unknown) => u is UpstreamPullRequest -``` - -Added in v2.0.0 - -# symbols - -## UpstreamPullRequestTypeId - -**Signature** - -```ts -export declare const UpstreamPullRequestTypeId: typeof UpstreamPullRequestTypeId -``` - -Added in v2.0.0 - -## UpstreamPullRequestTypeId (type alias) - -**Signature** - -```ts -export type UpstreamPullRequestTypeId = typeof UpstreamPullRequestTypeId -``` - -Added in v2.0.0 - -# utils - -## UpstreamPullRequest (namespace) - -Added in v2.0.0 - -### Variance (interface) - -**Signature** - -```ts -export interface Variance { - readonly [UpstreamPullRequestTypeId]: { - readonly _A: (_: never) => A - } -} -``` - -Added in v2.0.0 diff --git a/docs/modules/UpstreamPullStrategy.ts.md b/docs/modules/UpstreamPullStrategy.ts.md deleted file mode 100644 index 1d2c3373b..000000000 --- a/docs/modules/UpstreamPullStrategy.ts.md +++ /dev/null @@ -1,204 +0,0 @@ ---- -title: UpstreamPullStrategy.ts -nav_order: 143 -parent: Modules ---- - -## UpstreamPullStrategy overview - -Added in v2.0.0 - ---- - -

Table of contents

- -- [constructors](#constructors) - - [PullAfterAllEnqueued](#pullafterallenqueued) - - [PullAfterNext](#pullafternext) -- [folding](#folding) - - [match](#match) -- [models](#models) - - [PullAfterAllEnqueued (interface)](#pullafterallenqueued-interface) - - [PullAfterNext (interface)](#pullafternext-interface) - - [UpstreamPullStrategy (type alias)](#upstreampullstrategy-type-alias) -- [refinements](#refinements) - - [isPullAfterAllEnqueued](#ispullafterallenqueued) - - [isPullAfterNext](#ispullafternext) - - [isUpstreamPullStrategy](#isupstreampullstrategy) -- [symbols](#symbols) - - [UpstreamPullStrategyTypeId](#upstreampullstrategytypeid) - - [UpstreamPullStrategyTypeId (type alias)](#upstreampullstrategytypeid-type-alias) -- [utils](#utils) - - [UpstreamPullStrategy (namespace)](#upstreampullstrategy-namespace) - - [Variance (interface)](#variance-interface) - ---- - -# constructors - -## PullAfterAllEnqueued - -**Signature** - -```ts -export declare const PullAfterAllEnqueued:
(emitSeparator: Option.Option) => UpstreamPullStrategy -``` - -Added in v2.0.0 - -## PullAfterNext - -**Signature** - -```ts -export declare const PullAfterNext: (emitSeparator: Option.Option) => UpstreamPullStrategy -``` - -Added in v2.0.0 - -# folding - -## match - -Folds an `UpstreamPullStrategy` into a value of type `Z`. - -**Signature** - -```ts -export declare const match: { - (options: { - readonly onNext: (emitSeparator: Option.Option) => Z - readonly onAllEnqueued: (emitSeparator: Option.Option) => Z - }): (self: UpstreamPullStrategy) => Z - ( - self: UpstreamPullStrategy, - options: { - readonly onNext: (emitSeparator: Option.Option) => Z - readonly onAllEnqueued: (emitSeparator: Option.Option) => Z - } - ): Z -} -``` - -Added in v2.0.0 - -# models - -## PullAfterAllEnqueued (interface) - -**Signature** - -```ts -export interface PullAfterAllEnqueued extends UpstreamPullStrategy.Variance { - readonly _tag: "PullAfterAllEnqueued" - readonly emitSeparator: Option.Option -} -``` - -Added in v2.0.0 - -## PullAfterNext (interface) - -**Signature** - -```ts -export interface PullAfterNext extends UpstreamPullStrategy.Variance { - readonly _tag: "PullAfterNext" - readonly emitSeparator: Option.Option -} -``` - -Added in v2.0.0 - -## UpstreamPullStrategy (type alias) - -**Signature** - -```ts -export type UpstreamPullStrategy = PullAfterNext | PullAfterAllEnqueued -``` - -Added in v2.0.0 - -# refinements - -## isPullAfterAllEnqueued - -Returns `true` if the specified `UpstreamPullStrategy` is a -`PullAfterAllEnqueued`, `false` otherwise. - -**Signature** - -```ts -export declare const isPullAfterAllEnqueued: (self: UpstreamPullStrategy) => self is PullAfterAllEnqueued -``` - -Added in v2.0.0 - -## isPullAfterNext - -Returns `true` if the specified `UpstreamPullStrategy` is a `PullAfterNext`, -`false` otherwise. - -**Signature** - -```ts -export declare const isPullAfterNext: (self: UpstreamPullStrategy) => self is PullAfterNext -``` - -Added in v2.0.0 - -## isUpstreamPullStrategy - -Returns `true` if the specified value is an `UpstreamPullStrategy`, `false` -otherwise. - -**Signature** - -```ts -export declare const isUpstreamPullStrategy: (u: unknown) => u is UpstreamPullStrategy -``` - -Added in v2.0.0 - -# symbols - -## UpstreamPullStrategyTypeId - -**Signature** - -```ts -export declare const UpstreamPullStrategyTypeId: typeof UpstreamPullStrategyTypeId -``` - -Added in v2.0.0 - -## UpstreamPullStrategyTypeId (type alias) - -**Signature** - -```ts -export type UpstreamPullStrategyTypeId = typeof UpstreamPullStrategyTypeId -``` - -Added in v2.0.0 - -# utils - -## UpstreamPullStrategy (namespace) - -Added in v2.0.0 - -### Variance (interface) - -**Signature** - -```ts -export interface Variance { - readonly [UpstreamPullStrategyTypeId]: { - readonly _A: (_: never) => A - } -} -``` - -Added in v2.0.0 diff --git a/docs/modules/Utils.ts.md b/docs/modules/Utils.ts.md deleted file mode 100644 index 553af01f4..000000000 --- a/docs/modules/Utils.ts.md +++ /dev/null @@ -1,592 +0,0 @@ ---- -title: Utils.ts -nav_order: 144 -parent: Modules ---- - -## Utils overview - -Added in v2.0.0 - ---- - -

Table of contents

- -- [adapters](#adapters) - - [adapter](#adapter) -- [constructors](#constructors) - - [GenKindImpl (class)](#genkindimpl-class) - - [[Symbol.iterator] (method)](#symboliterator-method) - - [[GenKindTypeId] (property)](#genkindtypeid-property) - - [SingleShotGen (class)](#singleshotgen-class) - - [next (method)](#next-method) - - [return (method)](#return-method) - - [throw (method)](#throw-method) - - [[Symbol.iterator] (method)](#symboliterator-method-1) - - [makeGenKind](#makegenkind) -- [model](#model) - - [OptionalNumber (type alias)](#optionalnumber-type-alias) - - [PCGRandom (class)](#pcgrandom-class) - - [getState (method)](#getstate-method) - - [setState (method)](#setstate-method) - - [integer (method)](#integer-method) - - [number (method)](#number-method) - - [PCGRandomState (type alias)](#pcgrandomstate-type-alias) -- [models](#models) - - [Adapter (interface)](#adapter-interface) - - [Gen (interface)](#gen-interface) - - [GenKind (interface)](#genkind-interface) - - [Variance (interface)](#variance-interface) -- [symbols](#symbols) - - [GenKindTypeId](#genkindtypeid) - - [GenKindTypeId (type alias)](#genkindtypeid-type-alias) - ---- - -# adapters - -## adapter - -**Signature** - -```ts -export declare const adapter: () => Adapter -``` - -Added in v2.0.0 - -# constructors - -## GenKindImpl (class) - -**Signature** - -```ts -export declare class GenKindImpl { constructor( - /** - * @since 2.0.0 - */ - readonly value: Kind - ) } -``` - -Added in v2.0.0 - -### [Symbol.iterator] (method) - -**Signature** - -```ts -[Symbol.iterator](): Generator, A> -``` - -Added in v2.0.0 - -### [GenKindTypeId] (property) - -**Signature** - -```ts -readonly [GenKindTypeId]: typeof GenKindTypeId -``` - -Added in v2.0.0 - -## SingleShotGen (class) - -**Signature** - -```ts -export declare class SingleShotGen { constructor(readonly self: T) } -``` - -Added in v2.0.0 - -### next (method) - -**Signature** - -```ts -next(a: A): IteratorResult -``` - -Added in v2.0.0 - -### return (method) - -**Signature** - -```ts -return(a: A): IteratorResult -``` - -Added in v2.0.0 - -### throw (method) - -**Signature** - -```ts -throw(e: unknown): IteratorResult -``` - -Added in v2.0.0 - -### [Symbol.iterator] (method) - -**Signature** - -```ts -[Symbol.iterator](): Generator -``` - -Added in v2.0.0 - -## makeGenKind - -**Signature** - -```ts -export declare const makeGenKind: ( - kind: Kind -) => GenKind -``` - -Added in v2.0.0 - -# model - -## OptionalNumber (type alias) - -**Signature** - -```ts -export type OptionalNumber = number | null | undefined -``` - -Added in v2.0.0 - -## PCGRandom (class) - -PCG is a family of simple fast space-efficient statistically good algorithms -for random number generation. Unlike many general-purpose RNGs, they are also -hard to predict. - -**Signature** - -```ts -export declare class PCGRandom { - constructor(seedHi?: OptionalNumber, seedLo?: OptionalNumber, incHi?: OptionalNumber, incLo?: OptionalNumber) -} -``` - -Added in v2.0.0 - -### getState (method) - -Returns a copy of the internal state of this random number generator as a -JavaScript Array. - -**Signature** - -```ts -getState(): PCGRandomState -``` - -Added in v2.0.0 - -### setState (method) - -Restore state previously retrieved using `getState()`. - -**Signature** - -```ts -setState(state: PCGRandomState) -``` - -Added in v2.0.0 - -### integer (method) - -Get a uniformly distributed 32 bit integer between [0, max). - -**Signature** - -```ts -integer(max: number) -``` - -Added in v2.0.0 - -### number (method) - -Get a uniformly distributed IEEE-754 double between 0.0 and 1.0, with -53 bits of precision (every bit of the mantissa is randomized). - -**Signature** - -```ts -number() -``` - -Added in v2.0.0 - -## PCGRandomState (type alias) - -**Signature** - -```ts -export type PCGRandomState = [number, number, number, number] -``` - -Added in v2.0.0 - -# models - -## Adapter (interface) - -**Signature** - -```ts -export interface Adapter { - <_R, _O, _E, _A>(self: Kind): GenKind - (a: A, ab: (a: A) => Kind): GenKind - (a: A, ab: (a: A) => B, bc: (b: B) => Kind): GenKind - ( - a: A, - ab: (a: A) => B, - bc: (b: B) => C, - cd: (c: C) => Kind - ): GenKind - ( - a: A, - ab: (a: A) => B, - bc: (b: B) => C, - cd: (c: C) => D, - de: (d: D) => Kind - ): GenKind - ( - a: A, - ab: (a: A) => B, - bc: (b: B) => C, - cd: (c: C) => D, - de: (d: D) => E, - ef: (e: E) => Kind - ): GenKind - ( - a: A, - ab: (a: A) => B, - bc: (b: B) => C, - cd: (c: C) => D, - de: (d: D) => E, - ef: (e: E) => F, - fg: (f: F) => Kind - ): GenKind - ( - a: A, - ab: (a: A) => B, - bc: (b: B) => C, - cd: (c: C) => D, - de: (d: D) => E, - ef: (e: E) => F, - fg: (f: F) => G, - gh: (g: F) => Kind - ): GenKind - ( - a: A, - ab: (a: A) => B, - bc: (b: B) => C, - cd: (c: C) => D, - de: (d: D) => E, - ef: (e: E) => F, - fg: (f: F) => G, - gh: (g: G) => H, - hi: (g: H) => Kind - ): GenKind - ( - a: A, - ab: (a: A) => B, - bc: (b: B) => C, - cd: (c: C) => D, - de: (d: D) => E, - ef: (e: E) => F, - fg: (f: F) => G, - gh: (g: G) => H, - hi: (h: H) => I, - ij: (i: I) => Kind - ): GenKind - ( - a: A, - ab: (a: A) => B, - bc: (b: B) => C, - cd: (c: C) => D, - de: (d: D) => E, - ef: (e: E) => F, - fg: (f: F) => G, - gh: (g: G) => H, - hi: (h: H) => I, - ij: (i: I) => J, - jk: (j: J) => Kind - ): GenKind - ( - a: A, - ab: (a: A) => B, - bc: (b: B) => C, - cd: (c: C) => D, - de: (d: D) => E, - ef: (e: E) => F, - fg: (f: F) => G, - gh: (g: G) => H, - hi: (h: H) => I, - ij: (i: I) => J, - jk: (j: J) => K, - kl: (k: K) => Kind - ): GenKind - ( - a: A, - ab: (a: A) => B, - bc: (b: B) => C, - cd: (c: C) => D, - de: (d: D) => E, - ef: (e: E) => F, - fg: (f: F) => G, - gh: (g: G) => H, - hi: (h: H) => I, - ij: (i: I) => J, - jk: (j: J) => K, - kl: (k: K) => L, - lm: (l: L) => Kind - ): GenKind - ( - a: A, - ab: (a: A) => B, - bc: (b: B) => C, - cd: (c: C) => D, - de: (d: D) => E, - ef: (e: E) => F, - fg: (f: F) => G, - gh: (g: G) => H, - hi: (h: H) => I, - ij: (i: I) => J, - jk: (j: J) => K, - kl: (k: K) => L, - lm: (l: L) => M, - mn: (m: M) => Kind - ): GenKind - ( - a: A, - ab: (a: A) => B, - bc: (b: B) => C, - cd: (c: C) => D, - de: (d: D) => E, - ef: (e: E) => F, - fg: (f: F) => G, - gh: (g: G) => H, - hi: (h: H) => I, - ij: (i: I) => J, - jk: (j: J) => K, - kl: (k: K) => L, - lm: (l: L) => M, - mn: (m: M) => N, - no: (n: N) => Kind - ): GenKind - ( - a: A, - ab: (a: A) => B, - bc: (b: B) => C, - cd: (c: C) => D, - de: (d: D) => E, - ef: (e: E) => F, - fg: (f: F) => G, - gh: (g: G) => H, - hi: (h: H) => I, - ij: (i: I) => J, - jk: (j: J) => K, - kl: (k: K) => L, - lm: (l: L) => M, - mn: (m: M) => N, - no: (n: N) => O, - op: (o: O) => Kind - ): GenKind - ( - a: A, - ab: (a: A) => B, - bc: (b: B) => C, - cd: (c: C) => D, - de: (d: D) => E, - ef: (e: E) => F, - fg: (f: F) => G, - gh: (g: G) => H, - hi: (h: H) => I, - ij: (i: I) => J, - jk: (j: J) => K, - kl: (k: K) => L, - lm: (l: L) => M, - mn: (m: M) => N, - no: (n: N) => O, - op: (o: O) => P, - pq: (p: P) => Kind - ): GenKind - ( - a: A, - ab: (a: A) => B, - bc: (b: B) => C, - cd: (c: C) => D, - de: (d: D) => E, - ef: (e: E) => F, - fg: (f: F) => G, - gh: (g: G) => H, - hi: (h: H) => I, - ij: (i: I) => J, - jk: (j: J) => K, - kl: (k: K) => L, - lm: (l: L) => M, - mn: (m: M) => N, - no: (n: N) => O, - op: (o: O) => P, - pq: (p: P) => Q, - qr: (q: Q) => Kind - ): GenKind - ( - a: A, - ab: (a: A) => B, - bc: (b: B) => C, - cd: (c: C) => D, - de: (d: D) => E, - ef: (e: E) => F, - fg: (f: F) => G, - gh: (g: G) => H, - hi: (h: H) => I, - ij: (i: I) => J, - jk: (j: J) => K, - kl: (k: K) => L, - lm: (l: L) => M, - mn: (m: M) => N, - no: (n: N) => O, - op: (o: O) => P, - pq: (p: P) => Q, - qr: (q: Q) => R, - rs: (r: R) => Kind - ): GenKind - ( - a: A, - ab: (a: A) => B, - bc: (b: B) => C, - cd: (c: C) => D, - de: (d: D) => E, - ef: (e: E) => F, - fg: (f: F) => G, - gh: (g: G) => H, - hi: (h: H) => I, - ij: (i: I) => J, - jk: (j: J) => K, - kl: (k: K) => L, - lm: (l: L) => M, - mn: (m: M) => N, - no: (n: N) => O, - op: (o: O) => P, - pq: (p: P) => Q, - qr: (q: Q) => R, - rs: (r: R) => S, - st: (s: S) => Kind - ): GenKind - ( - a: A, - ab: (a: A) => B, - bc: (b: B) => C, - cd: (c: C) => D, - de: (d: D) => E, - ef: (e: E) => F, - fg: (f: F) => G, - gh: (g: G) => H, - hi: (h: H) => I, - ij: (i: I) => J, - jk: (j: J) => K, - kl: (k: K) => L, - lm: (l: L) => M, - mn: (m: M) => N, - no: (n: N) => O, - op: (o: O) => P, - pq: (p: P) => Q, - qr: (q: Q) => R, - rs: (r: R) => S, - st: (s: S) => T, - tu: (s: T) => Kind - ): GenKind -} -``` - -Added in v2.0.0 - -## Gen (interface) - -**Signature** - -```ts -export interface Gen { - , A>( - body: (resume: Z) => Generator - ): Kind< - F, - [K] extends [Variance] ? R : never, - [K] extends [Variance] ? O : never, - [K] extends [Variance] ? E : never, - A - > -} -``` - -Added in v2.0.0 - -## GenKind (interface) - -**Signature** - -```ts -export interface GenKind extends Variance { - readonly value: Kind - - readonly [Symbol.iterator]: () => Generator, A> -} -``` - -Added in v2.0.0 - -## Variance (interface) - -**Signature** - -```ts -export interface Variance { - readonly [GenKindTypeId]: GenKindTypeId - readonly _F: (_: F) => F - readonly _R: (_: R) => unknown - readonly _O: (_: never) => O - readonly _E: (_: never) => E -} -``` - -Added in v2.0.0 - -# symbols - -## GenKindTypeId - -**Signature** - -```ts -export declare const GenKindTypeId: typeof GenKindTypeId -``` - -Added in v2.0.0 - -## GenKindTypeId (type alias) - -**Signature** - -```ts -export type GenKindTypeId = typeof GenKindTypeId -``` - -Added in v2.0.0 diff --git a/docs/modules/index.md b/docs/modules/index.md deleted file mode 100644 index d20a6b7c3..000000000 --- a/docs/modules/index.md +++ /dev/null @@ -1,6 +0,0 @@ ---- -title: Modules -has_children: true -permalink: /docs/modules -nav_order: 2 ---- diff --git a/docs/modules/index.ts.md b/docs/modules/index.ts.md deleted file mode 100644 index b76bfd847..000000000 --- a/docs/modules/index.ts.md +++ /dev/null @@ -1,2028 +0,0 @@ ---- -title: index.ts -nav_order: 44 -parent: Modules ---- - -## index overview - -Added in v2.0.0 - ---- - -

Table of contents

- -- [exports](#exports) - - [From "./BigDecimal.js"](#from-bigdecimaljs) - - [From "./BigInt.js"](#from-bigintjs) - - [From "./Boolean.js"](#from-booleanjs) - - [From "./Brand.js"](#from-brandjs) - - [From "./Cache.js"](#from-cachejs) - - [From "./Cause.js"](#from-causejs) - - [From "./Channel.js"](#from-channeljs) - - [From "./ChildExecutorDecision.js"](#from-childexecutordecisionjs) - - [From "./Chunk.js"](#from-chunkjs) - - [From "./Clock.js"](#from-clockjs) - - [From "./Config.js"](#from-configjs) - - [From "./ConfigError.js"](#from-configerrorjs) - - [From "./ConfigProvider.js"](#from-configproviderjs) - - [From "./ConfigProviderPathPatch.js"](#from-configproviderpathpatchjs) - - [From "./ConfigSecret.js"](#from-configsecretjs) - - [From "./Console.js"](#from-consolejs) - - [From "./Context.js"](#from-contextjs) - - [From "./Data.js"](#from-datajs) - - [From "./DefaultServices.js"](#from-defaultservicesjs) - - [From "./Deferred.js"](#from-deferredjs) - - [From "./Differ.js"](#from-differjs) - - [From "./Duration.js"](#from-durationjs) - - [From "./Effect.js"](#from-effectjs) - - [From "./Effectable.js"](#from-effectablejs) - - [From "./Either.js"](#from-eitherjs) - - [From "./Encoding.js"](#from-encodingjs) - - [From "./Equal.js"](#from-equaljs) - - [From "./Equivalence.js"](#from-equivalencejs) - - [From "./ExecutionStrategy.js"](#from-executionstrategyjs) - - [From "./Exit.js"](#from-exitjs) - - [From "./Fiber.js"](#from-fiberjs) - - [From "./FiberId.js"](#from-fiberidjs) - - [From "./FiberRef.js"](#from-fiberrefjs) - - [From "./FiberRefs.js"](#from-fiberrefsjs) - - [From "./FiberRefsPatch.js"](#from-fiberrefspatchjs) - - [From "./FiberStatus.js"](#from-fiberstatusjs) - - [From "./Function.js"](#from-functionjs) - - [From "./GlobalValue.js"](#from-globalvaluejs) - - [From "./GroupBy.js"](#from-groupbyjs) - - [From "./HKT.js"](#from-hktjs) - - [From "./Hash.js"](#from-hashjs) - - [From "./HashMap.js"](#from-hashmapjs) - - [From "./HashSet.js"](#from-hashsetjs) - - [From "./Inspectable.js"](#from-inspectablejs) - - [From "./KeyedPool.js"](#from-keyedpooljs) - - [From "./Layer.js"](#from-layerjs) - - [From "./List.js"](#from-listjs) - - [From "./LogLevel.js"](#from-logleveljs) - - [From "./LogSpan.js"](#from-logspanjs) - - [From "./Logger.js"](#from-loggerjs) - - [From "./Match.js"](#from-matchjs) - - [From "./MergeDecision.js"](#from-mergedecisionjs) - - [From "./MergeState.js"](#from-mergestatejs) - - [From "./MergeStrategy.js"](#from-mergestrategyjs) - - [From "./Metric.js"](#from-metricjs) - - [From "./MetricBoundaries.js"](#from-metricboundariesjs) - - [From "./MetricHook.js"](#from-metrichookjs) - - [From "./MetricKey.js"](#from-metrickeyjs) - - [From "./MetricKeyType.js"](#from-metrickeytypejs) - - [From "./MetricLabel.js"](#from-metriclabeljs) - - [From "./MetricPair.js"](#from-metricpairjs) - - [From "./MetricPolling.js"](#from-metricpollingjs) - - [From "./MetricRegistry.js"](#from-metricregistryjs) - - [From "./MetricState.js"](#from-metricstatejs) - - [From "./MutableHashMap.js"](#from-mutablehashmapjs) - - [From "./MutableHashSet.js"](#from-mutablehashsetjs) - - [From "./MutableList.js"](#from-mutablelistjs) - - [From "./MutableQueue.js"](#from-mutablequeuejs) - - [From "./MutableRef.js"](#from-mutablerefjs) - - [From "./NonEmptyIterable.js"](#from-nonemptyiterablejs) - - [From "./Number.js"](#from-numberjs) - - [From "./Option.js"](#from-optionjs) - - [From "./Order.js"](#from-orderjs) - - [From "./Ordering.js"](#from-orderingjs) - - [From "./Pipeable.js"](#from-pipeablejs) - - [From "./Pool.js"](#from-pooljs) - - [From "./Predicate.js"](#from-predicatejs) - - [From "./PubSub.js"](#from-pubsubjs) - - [From "./Queue.js"](#from-queuejs) - - [From "./Random.js"](#from-randomjs) - - [From "./ReadonlyArray.js"](#from-readonlyarrayjs) - - [From "./ReadonlyRecord.js"](#from-readonlyrecordjs) - - [From "./RedBlackTree.js"](#from-redblacktreejs) - - [From "./Ref.js"](#from-refjs) - - [From "./Reloadable.js"](#from-reloadablejs) - - [From "./Request.js"](#from-requestjs) - - [From "./RequestBlock.js"](#from-requestblockjs) - - [From "./RequestResolver.js"](#from-requestresolverjs) - - [From "./Resource.js"](#from-resourcejs) - - [From "./Runtime.js"](#from-runtimejs) - - [From "./RuntimeFlags.js"](#from-runtimeflagsjs) - - [From "./RuntimeFlagsPatch.js"](#from-runtimeflagspatchjs) - - [From "./STM.js"](#from-stmjs) - - [From "./Schedule.js"](#from-schedulejs) - - [From "./ScheduleDecision.js"](#from-scheduledecisionjs) - - [From "./ScheduleInterval.js"](#from-scheduleintervaljs) - - [From "./ScheduleIntervals.js"](#from-scheduleintervalsjs) - - [From "./Scheduler.js"](#from-schedulerjs) - - [From "./Scope.js"](#from-scopejs) - - [From "./ScopedCache.js"](#from-scopedcachejs) - - [From "./ScopedRef.js"](#from-scopedrefjs) - - [From "./SingleProducerAsyncInput.js"](#from-singleproducerasyncinputjs) - - [From "./Sink.js"](#from-sinkjs) - - [From "./SortedMap.js"](#from-sortedmapjs) - - [From "./SortedSet.js"](#from-sortedsetjs) - - [From "./Stream.js"](#from-streamjs) - - [From "./StreamEmit.js"](#from-streamemitjs) - - [From "./StreamHaltStrategy.js"](#from-streamhaltstrategyjs) - - [From "./Streamable.js"](#from-streamablejs) - - [From "./String.js"](#from-stringjs) - - [From "./Struct.js"](#from-structjs) - - [From "./SubscriptionRef.js"](#from-subscriptionrefjs) - - [From "./Supervisor.js"](#from-supervisorjs) - - [From "./Symbol.js"](#from-symboljs) - - [From "./SynchronizedRef.js"](#from-synchronizedrefjs) - - [From "./TArray.js"](#from-tarrayjs) - - [From "./TDeferred.js"](#from-tdeferredjs) - - [From "./TMap.js"](#from-tmapjs) - - [From "./TPriorityQueue.js"](#from-tpriorityqueuejs) - - [From "./TPubSub.js"](#from-tpubsubjs) - - [From "./TQueue.js"](#from-tqueuejs) - - [From "./TRandom.js"](#from-trandomjs) - - [From "./TReentrantLock.js"](#from-treentrantlockjs) - - [From "./TRef.js"](#from-trefjs) - - [From "./TSemaphore.js"](#from-tsemaphorejs) - - [From "./TSet.js"](#from-tsetjs) - - [From "./Take.js"](#from-takejs) - - [From "./TestAnnotation.js"](#from-testannotationjs) - - [From "./TestAnnotationMap.js"](#from-testannotationmapjs) - - [From "./TestAnnotations.js"](#from-testannotationsjs) - - [From "./TestClock.js"](#from-testclockjs) - - [From "./TestConfig.js"](#from-testconfigjs) - - [From "./TestContext.js"](#from-testcontextjs) - - [From "./TestLive.js"](#from-testlivejs) - - [From "./TestServices.js"](#from-testservicesjs) - - [From "./TestSized.js"](#from-testsizedjs) - - [From "./Tracer.js"](#from-tracerjs) - - [From "./Tuple.js"](#from-tuplejs) - - [From "./Types.js"](#from-typesjs) - - [From "./Unify.js"](#from-unifyjs) - - [From "./UpstreamPullRequest.js"](#from-upstreampullrequestjs) - - [From "./UpstreamPullStrategy.js"](#from-upstreampullstrategyjs) - - [From "./Utils.js"](#from-utilsjs) -- [utils](#utils) - - [absurd](#absurd) - - [flow](#flow) - - [hole](#hole) - - [identity](#identity) - - [pipe](#pipe) - - [unsafeCoerce](#unsafecoerce) - ---- - -# exports - -## From "./BigDecimal.js" - -This module provides utility functions and type class instances for working with the `BigDecimal` type in TypeScript. -It includes functions for basic arithmetic operations, as well as type class instances for `Equivalence` and `Order`. - -A `BigDecimal` allows storing any real number to arbitrary precision; which avoids common floating point errors -(such as 0.1 + 0.2 ≠ 0.3) at the cost of complexity. - -Internally, `BigDecimal` uses a `BigInt` object, paired with a 64-bit integer which determines the position of the -decimal point. Therefore, the precision _is not_ actually arbitrary, but limited to 263 decimal places. - -It is not recommended to convert a floating point number to a decimal directly, as the floating point representation -may be unexpected. - -**Signature** - -```ts -export * as BigDecimal from "./BigDecimal.js" -``` - -Added in v2.0.0 - -## From "./BigInt.js" - -This module provides utility functions and type class instances for working with the `bigint` type in TypeScript. -It includes functions for basic arithmetic operations, as well as type class instances for -`Equivalence` and `Order`. - -**Signature** - -```ts -export * as BigInt from "./BigInt.js" -``` - -Added in v2.0.0 - -## From "./Boolean.js" - -This module provides utility functions and type class instances for working with the `boolean` type in TypeScript. -It includes functions for basic boolean operations, as well as type class instances for -`Equivalence` and `Order`. - -**Signature** - -```ts -export * as Boolean from "./Boolean.js" -``` - -Added in v2.0.0 - -## From "./Brand.js" - -This module provides types and utility functions to create and work with branded types, -which are TypeScript types with an added type tag to prevent accidental usage of a value in the wrong context. - -The `refined` and `nominal` functions are both used to create branded types in TypeScript. -The main difference between them is that `refined` allows for validation of the data, while `nominal` does not. - -The `nominal` function is used to create a new branded type that has the same underlying type as the input, but with a different name. -This is useful when you want to distinguish between two values of the same type that have different meanings. -The `nominal` function does not perform any validation of the input data. - -On the other hand, the `refined` function is used to create a new branded type that has the same underlying type as the input, -but with a different name, and it also allows for validation of the input data. -The `refined` function takes a predicate that is used to validate the input data. -If the input data fails the validation, a `BrandErrors` is returned, which provides information about the specific validation failure. - -**Signature** - -```ts -export * as Brand from "./Brand.js" -``` - -Added in v2.0.0 - -## From "./Cache.js" - -Re-exports all named exports from the "./Cache.js" module as `Cache`. - -**Signature** - -```ts -export * as Cache from "./Cache.js" -``` - -Added in v2.0.0 - -## From "./Cause.js" - -The `Effect` type is polymorphic in values of type `E` and we can -work with any error type that we want. However, there is a lot of information -that is not inside an arbitrary `E` value. So as a result, an `Effect` needs -somewhere to store things like unexpected errors or defects, stack and -execution traces, causes of fiber interruptions, and so forth. - -Effect-TS is very strict about preserving the full information related to a -failure. It captures all type of errors into the `Cause` data type. `Effect` -uses the `Cause` data type to store the full story of failure. So its -error model is lossless. It doesn't throw information related to the failure -result. So we can figure out exactly what happened during the operation of -our effects. - -It is important to note that `Cause` is an underlying data type representing -errors occuring within an `Effect` workflow. Thus, we don't usually deal with -`Cause`s directly. Even though it is not a data type that we deal with very -often, the `Cause` of a failing `Effect` workflow can be accessed at any -time, which gives us total access to all parallel and sequential errors in -occurring within our codebase. - -**Signature** - -```ts -export * as Cause from "./Cause.js" -``` - -Added in v2.0.0 - -## From "./Channel.js" - -Re-exports all named exports from the "./Channel.js" module as `Channel`. - -**Signature** - -```ts -export * as Channel from "./Channel.js" -``` - -Added in v2.0.0 - -## From "./ChildExecutorDecision.js" - -Re-exports all named exports from the "./ChildExecutorDecision.js" module as `ChildExecutorDecision`. - -**Signature** - -```ts -export * as ChildExecutorDecision from "./ChildExecutorDecision.js" -``` - -Added in v2.0.0 - -## From "./Chunk.js" - -Re-exports all named exports from the "./Chunk.js" module as `Chunk`. - -**Signature** - -```ts -export * as Chunk from "./Chunk.js" -``` - -Added in v2.0.0 - -## From "./Clock.js" - -Re-exports all named exports from the "./Clock.js" module as `Clock`. - -**Signature** - -```ts -export * as Clock from "./Clock.js" -``` - -Added in v2.0.0 - -## From "./Config.js" - -Re-exports all named exports from the "./Config.js" module as `Config`. - -**Signature** - -```ts -export * as Config from "./Config.js" -``` - -Added in v2.0.0 - -## From "./ConfigError.js" - -Re-exports all named exports from the "./ConfigError.js" module as `ConfigError`. - -**Signature** - -```ts -export * as ConfigError from "./ConfigError.js" -``` - -Added in v2.0.0 - -## From "./ConfigProvider.js" - -Re-exports all named exports from the "./ConfigProvider.js" module as `ConfigProvider`. - -**Signature** - -```ts -export * as ConfigProvider from "./ConfigProvider.js" -``` - -Added in v2.0.0 - -## From "./ConfigProviderPathPatch.js" - -Re-exports all named exports from the "./ConfigProviderPathPatch.js" module as `ConfigProviderPathPatch`. - -**Signature** - -```ts -export * as ConfigProviderPathPatch from "./ConfigProviderPathPatch.js" -``` - -Added in v2.0.0 - -## From "./ConfigSecret.js" - -Re-exports all named exports from the "./ConfigSecret.js" module as `ConfigSecret`. - -**Signature** - -```ts -export * as ConfigSecret from "./ConfigSecret.js" -``` - -Added in v2.0.0 - -## From "./Console.js" - -Re-exports all named exports from the "./Console.js" module as `Console`. - -**Signature** - -```ts -export * as Console from "./Console.js" -``` - -Added in v2.0.0 - -## From "./Context.js" - -This module provides a data structure called `Context` that can be used for dependency injection in effectful -programs. It is essentially a table mapping `Tag`s to their implementations (called `Service`s), and can be used to -manage dependencies in a type-safe way. The `Context` data structure is essentially a way of providing access to a set -of related services that can be passed around as a single unit. This module provides functions to create, modify, and -query the contents of a `Context`, as well as a number of utility types for working with tags and services. - -**Signature** - -```ts -export * as Context from "./Context.js" -``` - -Added in v2.0.0 - -## From "./Data.js" - -Re-exports all named exports from the "./Data.js" module as `Data`. - -**Signature** - -```ts -export * as Data from "./Data.js" -``` - -Added in v2.0.0 - -## From "./DefaultServices.js" - -Re-exports all named exports from the "./DefaultServices.js" module as `DefaultServices`. - -**Signature** - -```ts -export * as DefaultServices from "./DefaultServices.js" -``` - -Added in v2.0.0 - -## From "./Deferred.js" - -Re-exports all named exports from the "./Deferred.js" module as `Deferred`. - -**Signature** - -```ts -export * as Deferred from "./Deferred.js" -``` - -Added in v2.0.0 - -## From "./Differ.js" - -Re-exports all named exports from the "./Differ.js" module as `Differ`. - -**Signature** - -```ts -export * as Differ from "./Differ.js" -``` - -Added in v2.0.0 - -## From "./Duration.js" - -Re-exports all named exports from the "./Duration.js" module as `Duration`. - -**Signature** - -```ts -export * as Duration from "./Duration.js" -``` - -Added in v2.0.0 - -## From "./Effect.js" - -Re-exports all named exports from the "./Effect.js" module as `Effect`. - -**Signature** - -```ts -export * as Effect from "./Effect.js" -``` - -Added in v2.0.0 - -## From "./Effectable.js" - -Re-exports all named exports from the "./Effectable.js" module as `Effectable`. - -**Signature** - -```ts -export * as Effectable from "./Effectable.js" -``` - -Added in v2.0.0 - -## From "./Either.js" - -Re-exports all named exports from the "./Either.js" module as `Either`. - -**Signature** - -```ts -export * as Either from "./Either.js" -``` - -Added in v2.0.0 - -## From "./Encoding.js" - -This module provides encoding & decoding functionality for: - -- base64 (RFC4648) -- base64 (URL) -- hex - -**Signature** - -```ts -export * as Encoding from "./Encoding.js" -``` - -Added in v2.0.0 - -## From "./Equal.js" - -Re-exports all named exports from the "./Equal.js" module as `Equal`. - -**Signature** - -```ts -export * as Equal from "./Equal.js" -``` - -Added in v2.0.0 - -## From "./Equivalence.js" - -This module provides an implementation of the `Equivalence` type class, which defines a binary relation -that is reflexive, symmetric, and transitive. In other words, it defines a notion of equivalence between values of a certain type. -These properties are also known in mathematics as an "equivalence relation". - -**Signature** - -```ts -export * as Equivalence from "./Equivalence.js" -``` - -Added in v2.0.0 - -## From "./ExecutionStrategy.js" - -Re-exports all named exports from the "./ExecutionStrategy.js" module as `ExecutionStrategy`. - -**Signature** - -```ts -export * as ExecutionStrategy from "./ExecutionStrategy.js" -``` - -Added in v2.0.0 - -## From "./Exit.js" - -Re-exports all named exports from the "./Exit.js" module as `Exit`. - -**Signature** - -```ts -export * as Exit from "./Exit.js" -``` - -Added in v2.0.0 - -## From "./Fiber.js" - -Re-exports all named exports from the "./Fiber.js" module as `Fiber`. - -**Signature** - -```ts -export * as Fiber from "./Fiber.js" -``` - -Added in v2.0.0 - -## From "./FiberId.js" - -Re-exports all named exports from the "./FiberId.js" module as `FiberId`. - -**Signature** - -```ts -export * as FiberId from "./FiberId.js" -``` - -Added in v2.0.0 - -## From "./FiberRef.js" - -Re-exports all named exports from the "./FiberRef.js" module as `FiberRef`. - -**Signature** - -```ts -export * as FiberRef from "./FiberRef.js" -``` - -Added in v2.0.0 - -## From "./FiberRefs.js" - -Re-exports all named exports from the "./FiberRefs.js" module as `FiberRefs`. - -**Signature** - -```ts -export * as FiberRefs from "./FiberRefs.js" -``` - -Added in v2.0.0 - -## From "./FiberRefsPatch.js" - -Re-exports all named exports from the "./FiberRefsPatch.js" module as `FiberRefsPatch`. - -**Signature** - -```ts -export * as FiberRefsPatch from "./FiberRefsPatch.js" -``` - -Added in v2.0.0 - -## From "./FiberStatus.js" - -Re-exports all named exports from the "./FiberStatus.js" module as `FiberStatus`. - -**Signature** - -```ts -export * as FiberStatus from "./FiberStatus.js" -``` - -Added in v2.0.0 - -## From "./Function.js" - -Re-exports all named exports from the "./Function.js" module as `Function`. - -**Signature** - -```ts -export * as Function from "./Function.js" -``` - -Added in v2.0.0 - -## From "./GlobalValue.js" - -Re-exports all named exports from the "./GlobalValue.js" module as `GlobalValue`. - -**Signature** - -```ts -export * as GlobalValue from "./GlobalValue.js" -``` - -Added in v2.0.0 - -## From "./GroupBy.js" - -Re-exports all named exports from the "./GroupBy.js" module as `GroupBy`. - -**Signature** - -```ts -export * as GroupBy from "./GroupBy.js" -``` - -Added in v2.0.0 - -## From "./HKT.js" - -Re-exports all named exports from the "./HKT.js" module as `HKT`. - -**Signature** - -```ts -export * as HKT from "./HKT.js" -``` - -Added in v2.0.0 - -## From "./Hash.js" - -Re-exports all named exports from the "./Hash.js" module as `Hash`. - -**Signature** - -```ts -export * as Hash from "./Hash.js" -``` - -Added in v2.0.0 - -## From "./HashMap.js" - -Re-exports all named exports from the "./HashMap.js" module as `HashMap`. - -**Signature** - -```ts -export * as HashMap from "./HashMap.js" -``` - -Added in v2.0.0 - -## From "./HashSet.js" - -Re-exports all named exports from the "./HashSet.js" module as `HashSet`. - -**Signature** - -```ts -export * as HashSet from "./HashSet.js" -``` - -Added in v2.0.0 - -## From "./Inspectable.js" - -Re-exports all named exports from the "./Inspectable.js" module as `Inspectable`. - -**Signature** - -```ts -export * as Inspectable from "./Inspectable.js" -``` - -Added in v2.0.0 - -## From "./KeyedPool.js" - -Re-exports all named exports from the "./KeyedPool.js" module as `KeyedPool`. - -**Signature** - -```ts -export * as KeyedPool from "./KeyedPool.js" -``` - -Added in v2.0.0 - -## From "./Layer.js" - -A `Layer` describes how to build one or more services in your -application. Services can be injected into effects via -`Effect.provideService`. Effects can require services via `Effect.service`. - -Layer can be thought of as recipes for producing bundles of services, given -their dependencies (other services). - -Construction of services can be effectful and utilize resources that must be -acquired and safely released when the services are done being utilized. - -By default layers are shared, meaning that if the same layer is used twice -the layer will only be allocated a single time. - -Because of their excellent composition properties, layers are the idiomatic -way in Effect-TS to create services that depend on other services. - -**Signature** - -```ts -export * as Layer from "./Layer.js" -``` - -Added in v2.0.0 - -## From "./List.js" - -A data type for immutable linked lists representing ordered collections of elements of type `A`. - -This data type is optimal for last-in-first-out (LIFO), stack-like access patterns. If you need another access pattern, for example, random access or FIFO, consider using a collection more suited to this than `List`. - -**Performance** - -- Time: `List` has `O(1)` prepend and head/tail access. Most other operations are `O(n)` on the number of elements in the list. This includes the index-based lookup of elements, `length`, `append` and `reverse`. -- Space: `List` implements structural sharing of the tail list. This means that many operations are either zero- or constant-memory cost. - -**Signature** - -```ts -export * as List from "./List.js" -``` - -Added in v2.0.0 - -## From "./LogLevel.js" - -Re-exports all named exports from the "./LogLevel.js" module as `LogLevel`. - -**Signature** - -```ts -export * as LogLevel from "./LogLevel.js" -``` - -Added in v2.0.0 - -## From "./LogSpan.js" - -Re-exports all named exports from the "./LogSpan.js" module as `LogSpan`. - -**Signature** - -```ts -export * as LogSpan from "./LogSpan.js" -``` - -Added in v2.0.0 - -## From "./Logger.js" - -Re-exports all named exports from the "./Logger.js" module as `Logger`. - -**Signature** - -```ts -export * as Logger from "./Logger.js" -``` - -Added in v2.0.0 - -## From "./Match.js" - -Re-exports all named exports from the "./Match.js" module as `Match`. - -**Signature** - -```ts -export * as Match from "./Match.js" -``` - -Added in v1.0.0 - -## From "./MergeDecision.js" - -Re-exports all named exports from the "./MergeDecision.js" module as `MergeDecision`. - -**Signature** - -```ts -export * as MergeDecision from "./MergeDecision.js" -``` - -Added in v2.0.0 - -## From "./MergeState.js" - -Re-exports all named exports from the "./MergeState.js" module as `MergeState`. - -**Signature** - -```ts -export * as MergeState from "./MergeState.js" -``` - -Added in v2.0.0 - -## From "./MergeStrategy.js" - -Re-exports all named exports from the "./MergeStrategy.js" module as `MergeStrategy`. - -**Signature** - -```ts -export * as MergeStrategy from "./MergeStrategy.js" -``` - -Added in v2.0.0 - -## From "./Metric.js" - -Re-exports all named exports from the "./Metric.js" module as `Metric`. - -**Signature** - -```ts -export * as Metric from "./Metric.js" -``` - -Added in v2.0.0 - -## From "./MetricBoundaries.js" - -Re-exports all named exports from the "./MetricBoundaries.js" module as `MetricBoundaries`. - -**Signature** - -```ts -export * as MetricBoundaries from "./MetricBoundaries.js" -``` - -Added in v2.0.0 - -## From "./MetricHook.js" - -Re-exports all named exports from the "./MetricHook.js" module as `MetricHook`. - -**Signature** - -```ts -export * as MetricHook from "./MetricHook.js" -``` - -Added in v2.0.0 - -## From "./MetricKey.js" - -Re-exports all named exports from the "./MetricKey.js" module as `MetricKey`. - -**Signature** - -```ts -export * as MetricKey from "./MetricKey.js" -``` - -Added in v2.0.0 - -## From "./MetricKeyType.js" - -Re-exports all named exports from the "./MetricKeyType.js" module as `MetricKeyType`. - -**Signature** - -```ts -export * as MetricKeyType from "./MetricKeyType.js" -``` - -Added in v2.0.0 - -## From "./MetricLabel.js" - -Re-exports all named exports from the "./MetricLabel.js" module as `MetricLabel`. - -**Signature** - -```ts -export * as MetricLabel from "./MetricLabel.js" -``` - -Added in v2.0.0 - -## From "./MetricPair.js" - -Re-exports all named exports from the "./MetricPair.js" module as `MetricPair`. - -**Signature** - -```ts -export * as MetricPair from "./MetricPair.js" -``` - -Added in v2.0.0 - -## From "./MetricPolling.js" - -Re-exports all named exports from the "./MetricPolling.js" module as `MetricPolling`. - -**Signature** - -```ts -export * as MetricPolling from "./MetricPolling.js" -``` - -Added in v2.0.0 - -## From "./MetricRegistry.js" - -Re-exports all named exports from the "./MetricRegistry.js" module as `MetricRegistry`. - -**Signature** - -```ts -export * as MetricRegistry from "./MetricRegistry.js" -``` - -Added in v2.0.0 - -## From "./MetricState.js" - -Re-exports all named exports from the "./MetricState.js" module as `MetricState`. - -**Signature** - -```ts -export * as MetricState from "./MetricState.js" -``` - -Added in v2.0.0 - -## From "./MutableHashMap.js" - -Re-exports all named exports from the "./MutableHashMap.js" module as `MutableHashMap`. - -**Signature** - -```ts -export * as MutableHashMap from "./MutableHashMap.js" -``` - -Added in v2.0.0 - -## From "./MutableHashSet.js" - -Re-exports all named exports from the "./MutableHashSet.js" module as `MutableHashSet`. - -**Signature** - -```ts -export * as MutableHashSet from "./MutableHashSet.js" -``` - -Added in v2.0.0 - -## From "./MutableList.js" - -Re-exports all named exports from the "./MutableList.js" module as `MutableList`. - -**Signature** - -```ts -export * as MutableList from "./MutableList.js" -``` - -Added in v2.0.0 - -## From "./MutableQueue.js" - -Re-exports all named exports from the "./MutableQueue.js" module as `MutableQueue`. - -**Signature** - -```ts -export * as MutableQueue from "./MutableQueue.js" -``` - -Added in v2.0.0 - -## From "./MutableRef.js" - -Re-exports all named exports from the "./MutableRef.js" module as `MutableRef`. - -**Signature** - -```ts -export * as MutableRef from "./MutableRef.js" -``` - -Added in v2.0.0 - -## From "./NonEmptyIterable.js" - -Re-exports all named exports from the "./NonEmptyIterable.js" module as `NonEmptyIterable`. - -**Signature** - -```ts -export * as NonEmptyIterable from "./NonEmptyIterable.js" -``` - -Added in v2.0.0 - -## From "./Number.js" - -This module provides utility functions and type class instances for working with the `number` type in TypeScript. -It includes functions for basic arithmetic operations, as well as type class instances for -`Equivalence` and `Order`. - -**Signature** - -```ts -export * as Number from "./Number.js" -``` - -Added in v2.0.0 - -## From "./Option.js" - -Re-exports all named exports from the "./Option.js" module as `Option`. - -**Signature** - -```ts -export * as Option from "./Option.js" -``` - -Added in v2.0.0 - -## From "./Order.js" - -Re-exports all named exports from the "./Order.js" module as `Order`. - -**Signature** - -```ts -export * as Order from "./Order.js" -``` - -Added in v2.0.0 - -## From "./Ordering.js" - -Re-exports all named exports from the "./Ordering.js" module as `Ordering`. - -**Signature** - -```ts -export * as Ordering from "./Ordering.js" -``` - -Added in v2.0.0 - -## From "./Pipeable.js" - -Re-exports all named exports from the "./Pipeable.js" module as `Pipeable`. - -**Signature** - -```ts -export * as Pipeable from "./Pipeable.js" -``` - -Added in v2.0.0 - -## From "./Pool.js" - -Re-exports all named exports from the "./Pool.js" module as `Pool`. - -**Signature** - -```ts -export * as Pool from "./Pool.js" -``` - -Added in v2.0.0 - -## From "./Predicate.js" - -Re-exports all named exports from the "./Predicate.js" module as `Predicate`. - -**Signature** - -```ts -export * as Predicate from "./Predicate.js" -``` - -Added in v2.0.0 - -## From "./PubSub.js" - -Re-exports all named exports from the "./PubSub.js" module as `PubSub`. - -**Signature** - -```ts -export * as PubSub from "./PubSub.js" -``` - -Added in v2.0.0 - -## From "./Queue.js" - -Re-exports all named exports from the "./Queue.js" module as `Queue`. - -**Signature** - -```ts -export * as Queue from "./Queue.js" -``` - -Added in v2.0.0 - -## From "./Random.js" - -Re-exports all named exports from the "./Random.js" module as `Random`. - -**Signature** - -```ts -export * as Random from "./Random.js" -``` - -Added in v2.0.0 - -## From "./ReadonlyArray.js" - -This module provides utility functions for working with arrays in TypeScript. - -**Signature** - -```ts -export * as ReadonlyArray from "./ReadonlyArray.js" -``` - -Added in v2.0.0 - -## From "./ReadonlyRecord.js" - -This module provides utility functions for working with records in TypeScript. - -**Signature** - -```ts -export * as ReadonlyRecord from "./ReadonlyRecord.js" -``` - -Added in v2.0.0 - -## From "./RedBlackTree.js" - -Re-exports all named exports from the "./RedBlackTree.js" module as `RedBlackTree`. - -**Signature** - -```ts -export * as RedBlackTree from "./RedBlackTree.js" -``` - -Added in v2.0.0 - -## From "./Ref.js" - -Re-exports all named exports from the "./Ref.js" module as `Ref`. - -**Signature** - -```ts -export * as Ref from "./Ref.js" -``` - -Added in v2.0.0 - -## From "./Reloadable.js" - -Re-exports all named exports from the "./Reloadable.js" module as `Reloadable`. - -**Signature** - -```ts -export * as Reloadable from "./Reloadable.js" -``` - -Added in v2.0.0 - -## From "./Request.js" - -Re-exports all named exports from the "./Request.js" module as `Request`. - -**Signature** - -```ts -export * as Request from "./Request.js" -``` - -Added in v2.0.0 - -## From "./RequestBlock.js" - -Re-exports all named exports from the "./RequestBlock.js" module as `RequestBlock`. - -**Signature** - -```ts -export * as RequestBlock from "./RequestBlock.js" -``` - -Added in v2.0.0 - -## From "./RequestResolver.js" - -Re-exports all named exports from the "./RequestResolver.js" module as `RequestResolver`. - -**Signature** - -```ts -export * as RequestResolver from "./RequestResolver.js" -``` - -Added in v2.0.0 - -## From "./Resource.js" - -Re-exports all named exports from the "./Resource.js" module as `Resource`. - -**Signature** - -```ts -export * as Resource from "./Resource.js" -``` - -Added in v2.0.0 - -## From "./Runtime.js" - -Re-exports all named exports from the "./Runtime.js" module as `Runtime`. - -**Signature** - -```ts -export * as Runtime from "./Runtime.js" -``` - -Added in v2.0.0 - -## From "./RuntimeFlags.js" - -Re-exports all named exports from the "./RuntimeFlags.js" module as `RuntimeFlags`. - -**Signature** - -```ts -export * as RuntimeFlags from "./RuntimeFlags.js" -``` - -Added in v2.0.0 - -## From "./RuntimeFlagsPatch.js" - -Re-exports all named exports from the "./RuntimeFlagsPatch.js" module as `RuntimeFlagsPatch`. - -**Signature** - -```ts -export * as RuntimeFlagsPatch from "./RuntimeFlagsPatch.js" -``` - -Added in v2.0.0 - -## From "./STM.js" - -Re-exports all named exports from the "./STM.js" module as `STM`. - -**Signature** - -```ts -export * as STM from "./STM.js" -``` - -Added in v2.0.0 - -## From "./Schedule.js" - -Re-exports all named exports from the "./Schedule.js" module as `Schedule`. - -**Signature** - -```ts -export * as Schedule from "./Schedule.js" -``` - -Added in v2.0.0 - -## From "./ScheduleDecision.js" - -Re-exports all named exports from the "./ScheduleDecision.js" module as `ScheduleDecision`. - -**Signature** - -```ts -export * as ScheduleDecision from "./ScheduleDecision.js" -``` - -Added in v2.0.0 - -## From "./ScheduleInterval.js" - -Re-exports all named exports from the "./ScheduleInterval.js" module as `ScheduleInterval`. - -**Signature** - -```ts -export * as ScheduleInterval from "./ScheduleInterval.js" -``` - -Added in v2.0.0 - -## From "./ScheduleIntervals.js" - -Re-exports all named exports from the "./ScheduleIntervals.js" module as `ScheduleIntervals`. - -**Signature** - -```ts -export * as ScheduleIntervals from "./ScheduleIntervals.js" -``` - -Added in v2.0.0 - -## From "./Scheduler.js" - -Re-exports all named exports from the "./Scheduler.js" module as `Scheduler`. - -**Signature** - -```ts -export * as Scheduler from "./Scheduler.js" -``` - -Added in v2.0.0 - -## From "./Scope.js" - -Re-exports all named exports from the "./Scope.js" module as `Scope`. - -**Signature** - -```ts -export * as Scope from "./Scope.js" -``` - -Added in v2.0.0 - -## From "./ScopedCache.js" - -Re-exports all named exports from the "./ScopedCache.js" module as `ScopedCache`. - -**Signature** - -```ts -export * as ScopedCache from "./ScopedCache.js" -``` - -Added in v2.0.0 - -## From "./ScopedRef.js" - -Re-exports all named exports from the "./ScopedRef.js" module as `ScopedRef`. - -**Signature** - -```ts -export * as ScopedRef from "./ScopedRef.js" -``` - -Added in v2.0.0 - -## From "./SingleProducerAsyncInput.js" - -Re-exports all named exports from the "./SingleProducerAsyncInput.js" module as `SingleProducerAsyncInput`. - -**Signature** - -```ts -export * as SingleProducerAsyncInput from "./SingleProducerAsyncInput.js" -``` - -Added in v2.0.0 - -## From "./Sink.js" - -Re-exports all named exports from the "./Sink.js" module as `Sink`. - -**Signature** - -```ts -export * as Sink from "./Sink.js" -``` - -Added in v2.0.0 - -## From "./SortedMap.js" - -Re-exports all named exports from the "./SortedMap.js" module as `SortedMap`. - -**Signature** - -```ts -export * as SortedMap from "./SortedMap.js" -``` - -Added in v2.0.0 - -## From "./SortedSet.js" - -Re-exports all named exports from the "./SortedSet.js" module as `SortedSet`. - -**Signature** - -```ts -export * as SortedSet from "./SortedSet.js" -``` - -Added in v2.0.0 - -## From "./Stream.js" - -Re-exports all named exports from the "./Stream.js" module as `Stream`. - -**Signature** - -```ts -export * as Stream from "./Stream.js" -``` - -Added in v2.0.0 - -## From "./StreamEmit.js" - -Re-exports all named exports from the "./StreamEmit.js" module as `StreamEmit`. - -**Signature** - -```ts -export * as StreamEmit from "./StreamEmit.js" -``` - -Added in v2.0.0 - -## From "./StreamHaltStrategy.js" - -Re-exports all named exports from the "./StreamHaltStrategy.js" module as `StreamHaltStrategy`. - -**Signature** - -```ts -export * as StreamHaltStrategy from "./StreamHaltStrategy.js" -``` - -Added in v2.0.0 - -## From "./Streamable.js" - -Re-exports all named exports from the "./Streamable.js" module as `Streamable`. - -**Signature** - -```ts -export * as Streamable from "./Streamable.js" -``` - -Added in v2.0.0 - -## From "./String.js" - -This module provides utility functions and type class instances for working with the `string` type in TypeScript. -It includes functions for basic string manipulation, as well as type class instances for -`Equivalence` and `Order`. - -**Signature** - -```ts -export * as String from "./String.js" -``` - -Added in v2.0.0 - -## From "./Struct.js" - -This module provides utility functions for working with structs in TypeScript. - -**Signature** - -```ts -export * as Struct from "./Struct.js" -``` - -Added in v2.0.0 - -## From "./SubscriptionRef.js" - -Re-exports all named exports from the "./SubscriptionRef.js" module as `SubscriptionRef`. - -**Signature** - -```ts -export * as SubscriptionRef from "./SubscriptionRef.js" -``` - -Added in v2.0.0 - -## From "./Supervisor.js" - -A `Supervisor` is allowed to supervise the launching and termination of -fibers, producing some visible value of type `T` from the supervision. - -**Signature** - -```ts -export * as Supervisor from "./Supervisor.js" -``` - -Added in v2.0.0 - -## From "./Symbol.js" - -Re-exports all named exports from the "./Symbol.js" module as `Symbol`. - -**Signature** - -```ts -export * as Symbol from "./Symbol.js" -``` - -Added in v2.0.0 - -## From "./SynchronizedRef.js" - -Re-exports all named exports from the "./SynchronizedRef.js" module as `SynchronizedRef`. - -**Signature** - -```ts -export * as SynchronizedRef from "./SynchronizedRef.js" -``` - -Added in v2.0.0 - -## From "./TArray.js" - -Re-exports all named exports from the "./TArray.js" module as `TArray`. - -**Signature** - -```ts -export * as TArray from "./TArray.js" -``` - -Added in v2.0.0 - -## From "./TDeferred.js" - -Re-exports all named exports from the "./TDeferred.js" module as `TDeferred`. - -**Signature** - -```ts -export * as TDeferred from "./TDeferred.js" -``` - -Added in v2.0.0 - -## From "./TMap.js" - -Re-exports all named exports from the "./TMap.js" module as `TMap`. - -**Signature** - -```ts -export * as TMap from "./TMap.js" -``` - -Added in v2.0.0 - -## From "./TPriorityQueue.js" - -Re-exports all named exports from the "./TPriorityQueue.js" module as `TPriorityQueue`. - -**Signature** - -```ts -export * as TPriorityQueue from "./TPriorityQueue.js" -``` - -Added in v2.0.0 - -## From "./TPubSub.js" - -Re-exports all named exports from the "./TPubSub.js" module as `TPubSub`. - -**Signature** - -```ts -export * as TPubSub from "./TPubSub.js" -``` - -Added in v2.0.0 - -## From "./TQueue.js" - -Re-exports all named exports from the "./TQueue.js" module as `TQueue`. - -**Signature** - -```ts -export * as TQueue from "./TQueue.js" -``` - -Added in v2.0.0 - -## From "./TRandom.js" - -Re-exports all named exports from the "./TRandom.js" module as `TRandom`. - -**Signature** - -```ts -export * as TRandom from "./TRandom.js" -``` - -Added in v2.0.0 - -## From "./TReentrantLock.js" - -Re-exports all named exports from the "./TReentrantLock.js" module as `TReentrantLock`. - -**Signature** - -```ts -export * as TReentrantLock from "./TReentrantLock.js" -``` - -Added in v2.0.0 - -## From "./TRef.js" - -Re-exports all named exports from the "./TRef.js" module as `TRef`. - -**Signature** - -```ts -export * as TRef from "./TRef.js" -``` - -Added in v2.0.0 - -## From "./TSemaphore.js" - -Re-exports all named exports from the "./TSemaphore.js" module as `TSemaphore`. - -**Signature** - -```ts -export * as TSemaphore from "./TSemaphore.js" -``` - -Added in v2.0.0 - -## From "./TSet.js" - -Re-exports all named exports from the "./TSet.js" module as `TSet`. - -**Signature** - -```ts -export * as TSet from "./TSet.js" -``` - -Added in v2.0.0 - -## From "./Take.js" - -Re-exports all named exports from the "./Take.js" module as `Take`. - -**Signature** - -```ts -export * as Take from "./Take.js" -``` - -Added in v2.0.0 - -## From "./TestAnnotation.js" - -Re-exports all named exports from the "./TestAnnotation.js" module as `TestAnnotation`. - -**Signature** - -```ts -export * as TestAnnotation from "./TestAnnotation.js" -``` - -Added in v2.0.0 - -## From "./TestAnnotationMap.js" - -Re-exports all named exports from the "./TestAnnotationMap.js" module as `TestAnnotationMap`. - -**Signature** - -```ts -export * as TestAnnotationMap from "./TestAnnotationMap.js" -``` - -Added in v2.0.0 - -## From "./TestAnnotations.js" - -Re-exports all named exports from the "./TestAnnotations.js" module as `TestAnnotations`. - -**Signature** - -```ts -export * as TestAnnotations from "./TestAnnotations.js" -``` - -Added in v2.0.0 - -## From "./TestClock.js" - -Re-exports all named exports from the "./TestClock.js" module as `TestClock`. - -**Signature** - -```ts -export * as TestClock from "./TestClock.js" -``` - -Added in v2.0.0 - -## From "./TestConfig.js" - -Re-exports all named exports from the "./TestConfig.js" module as `TestConfig`. - -**Signature** - -```ts -export * as TestConfig from "./TestConfig.js" -``` - -Added in v2.0.0 - -## From "./TestContext.js" - -Re-exports all named exports from the "./TestContext.js" module as `TestContext`. - -**Signature** - -```ts -export * as TestContext from "./TestContext.js" -``` - -Added in v2.0.0 - -## From "./TestLive.js" - -Re-exports all named exports from the "./TestLive.js" module as `TestLive`. - -**Signature** - -```ts -export * as TestLive from "./TestLive.js" -``` - -Added in v2.0.0 - -## From "./TestServices.js" - -Re-exports all named exports from the "./TestServices.js" module as `TestServices`. - -**Signature** - -```ts -export * as TestServices from "./TestServices.js" -``` - -Added in v2.0.0 - -## From "./TestSized.js" - -Re-exports all named exports from the "./TestSized.js" module as `TestSized`. - -**Signature** - -```ts -export * as TestSized from "./TestSized.js" -``` - -Added in v2.0.0 - -## From "./Tracer.js" - -Re-exports all named exports from the "./Tracer.js" module as `Tracer`. - -**Signature** - -```ts -export * as Tracer from "./Tracer.js" -``` - -Added in v2.0.0 - -## From "./Tuple.js" - -This module provides utility functions for working with tuples in TypeScript. - -**Signature** - -```ts -export * as Tuple from "./Tuple.js" -``` - -Added in v2.0.0 - -## From "./Types.js" - -A collection of types that are commonly used types. - -**Signature** - -```ts -export * as Types from "./Types.js" -``` - -Added in v2.0.0 - -## From "./Unify.js" - -Re-exports all named exports from the "./Unify.js" module as `Unify`. - -**Signature** - -```ts -export * as Unify from "./Unify.js" -``` - -Added in v2.0.0 - -## From "./UpstreamPullRequest.js" - -Re-exports all named exports from the "./UpstreamPullRequest.js" module as `UpstreamPullRequest`. - -**Signature** - -```ts -export * as UpstreamPullRequest from "./UpstreamPullRequest.js" -``` - -Added in v2.0.0 - -## From "./UpstreamPullStrategy.js" - -Re-exports all named exports from the "./UpstreamPullStrategy.js" module as `UpstreamPullStrategy`. - -**Signature** - -```ts -export * as UpstreamPullStrategy from "./UpstreamPullStrategy.js" -``` - -Added in v2.0.0 - -## From "./Utils.js" - -Re-exports all named exports from the "./Utils.js" module as `Utils`. - -**Signature** - -```ts -export * as Utils from "./Utils.js" -``` - -Added in v2.0.0 - -# utils - -## absurd - -**Signature** - -```ts -export declare const absurd:
(_: never) => A -``` - -Added in v2.0.0 - -## flow - -**Signature** - -```ts -export declare const flow: typeof flow -``` - -Added in v2.0.0 - -## hole - -**Signature** - -```ts -export declare const hole: () => T -``` - -Added in v2.0.0 - -## identity - -**Signature** - -```ts -export declare const identity: (a: A) => A -``` - -Added in v2.0.0 - -## pipe - -**Signature** - -```ts -export declare const pipe: typeof pipe -``` - -Added in v2.0.0 - -## unsafeCoerce - -**Signature** - -```ts -export declare const unsafeCoerce: (a: A) => B -``` - -Added in v2.0.0 diff --git a/dtslint/tsconfig.json b/dtslint/tsconfig.json deleted file mode 100644 index 308fd6798..000000000 --- a/dtslint/tsconfig.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "compilerOptions": { - "noEmit": true, - "strict": true, - "exactOptionalPropertyTypes": true, - "noImplicitReturns": false, - "noUnusedLocals": false, - "noErrorTruncation": true, - "noUnusedParameters": false, - "noFallthroughCasesInSwitch": true, - "moduleResolution": "node", - "module": "commonjs", - "target": "ES2021", - "lib": ["ES2021", "DOM"], - "paths": { - "effect": [ - "../src/index.ts" - ], - "effect/test/*": [ - "../test/*" - ], - "effect/examples/*": [ - "../examples/*" - ], - "effect/*": [ - "../src/*" - ] - } - } -} diff --git a/package.json b/package.json index 2e4d07319..2ed9dbdaa 100644 --- a/package.json +++ b/package.json @@ -1,51 +1,22 @@ { - "name": "effect", - "version": "2.0.0-next.55", - "type": "module", - "packageManager": "pnpm@8.10.0", - "publishConfig": { - "access": "public", - "directory": "dist" - }, - "author": "Michael Arnaldi ", - "license": "MIT", - "sideEffects": false, - "repository": { - "type": "git", - "url": "https://github.com/Effect-TS/effect.git" - }, - "bugs": { - "url": "https://github.com/Effect-TS/effect/issues" - }, - "homepage": "https://github.com/Effect-TS/effect", - "description": "Functional programming in TypeScript", - "tags": [ - "typescript", - "algebraic-data-types", - "functional-programming" - ], - "keywords": [ - "typescript", - "algebraic-data-types", - "functional-programming" + "private": true, + "packageManager": "pnpm@8.10.2", + "workspaces": [ + "packages/*" ], "scripts": { - "build": "pnpm build-prepare && pnpm build-esm && pnpm build-cjs && pnpm build-annotate && build-utils pack-v2", - "build-prepare": "build-utils prepare-v2", - "build-esm": "tsc -b tsconfig.build.json", - "build-cjs": "babel build/esm --plugins @babel/transform-export-namespace-from --plugins @babel/transform-modules-commonjs --out-dir build/cjs --source-maps", - "build-annotate": "babel build --plugins annotate-pure-calls --out-dir build --source-maps", - "clean": "rimraf build dist coverage .tsbuildinfo", + "clean": "node scripts/clean.mjs", + "build": "tsc -b tsconfig.build.json && pnpm --recursive --parallel run build", + "circular": "madge --extensions ts --circular --no-color --no-spinner packages/*/src", "test": "vitest", + "coverage": "vitest --coverage", "check": "tsc -b tsconfig.json", - "coverage": "vitest --run --coverage related", - "circular": "madge --extensions ts --circular --no-color --no-spinner --warning src", - "update-version": "changeset version && pnpm install --no-frozen-lockfile && node scripts/version.mjs", - "lint": "eslint src test", - "lint-fix": "eslint src test --fix", - "docgen": "docgen", - "dtslint": "dtslint dtslint", - "dtslint-clean": "dtslint --installAll" + "indexgen": "pnpm --recursive --parallel exec build-utils prepare-v2", + "docgen": "pnpm --recursive --parallel exec docgen && pnpm docgen-cp", + "docgen-cp": "node scripts/docs-cp.js", + "lint": "eslint \"packages/*/{src,test,examples,dtslint}/**/*.ts\"", + "lint-fix": "pnpm lint --fix", + "dtslint": "pnpm --recursive --parallel run dtslint" }, "devDependencies": { "@babel/cli": "^7.23.0", @@ -55,12 +26,12 @@ "@changesets/changelog-github": "^0.4.8", "@changesets/cli": "^2.26.2", "@edge-runtime/vm": "^3.1.6", - "@effect/build-utils": "^0.3.1", + "@effect/build-utils": "^0.4.1", "@effect/docgen": "^0.3.1", "@effect/dtslint": "^0.0.3", "@effect/eslint-plugin": "^0.1.2", "@effect/language-service": "^0.0.21", - "@size-limit/preset-small-lib": "^10.0.2", + "@size-limit/preset-small-lib": "^11.0.0", "@types/node": "^20.8.4", "@typescript-eslint/eslint-plugin": "^6.7.5", "@typescript-eslint/parser": "^6.7.5", @@ -69,7 +40,7 @@ "babel-plugin-annotate-pure-calls": "^0.4.0", "eslint": "^8.51.0", "eslint-import-resolver-typescript": "^3.6.1", - "eslint-plugin-codegen": "^0.17.0", + "eslint-plugin-codegen": "^0.18.1", "eslint-plugin-deprecation": "^2.0.0", "eslint-plugin-import": "^2.28.1", "eslint-plugin-simple-import-sort": "^10.0.0", @@ -79,1593 +50,15 @@ "playwright": "^1.39.0", "prettier": "^3.0.3", "rimraf": "^5.0.5", - "size-limit": "^10.0.2", - "tsx": "^3.14.0", + "size-limit": "^11.0.0", + "tsx": "^4.1.2", "typescript": "^5.2.2", "vite": "^4.4.11", "vitest": "^0.34.6" }, - "size-limit": [ - { - "name": "BigDecimal", - "path": "./dist/dist/esm/index.js", - "limit": "5 kB", - "import": "{ BigDecimal }" - }, - { - "name": "BigInt", - "path": "./dist/dist/esm/index.js", - "limit": "4 kB", - "import": "{ BigInt }" - }, - { - "name": "Boolean", - "path": "./dist/dist/esm/index.js", - "limit": "1 kB", - "import": "{ Boolean }" - }, - { - "name": "Brand", - "path": "./dist/dist/esm/index.js", - "limit": "4 kB", - "import": "{ Brand }" - }, - { - "name": "Cache", - "path": "./dist/dist/esm/index.js", - "limit": "46 kB", - "import": "{ Cache }" - }, - { - "name": "Cause", - "path": "./dist/dist/esm/index.js", - "limit": "11 kB", - "import": "{ Cause }" - }, - { - "name": "Channel", - "path": "./dist/dist/esm/index.js", - "limit": "51 kB", - "import": "{ Channel }" - }, - { - "name": "ChildExecutorDecision", - "path": "./dist/dist/esm/index.js", - "limit": "1 kB", - "import": "{ ChildExecutorDecision }" - }, - { - "name": "Chunk", - "path": "./dist/dist/esm/index.js", - "limit": "7 kB", - "import": "{ Chunk }" - }, - { - "name": "Clock", - "path": "./dist/dist/esm/index.js", - "limit": "17 kB", - "import": "{ Clock }" - }, - { - "name": "Config", - "path": "./dist/dist/esm/index.js", - "limit": "9 kB", - "import": "{ Config }" - }, - { - "name": "ConfigError", - "path": "./dist/dist/esm/index.js", - "limit": "4 kB", - "import": "{ ConfigError }" - }, - { - "name": "ConfigProvider", - "path": "./dist/dist/esm/index.js", - "limit": "15 kB", - "import": "{ ConfigProvider }" - }, - { - "name": "ConfigProviderPathPatch", - "path": "./dist/dist/esm/index.js", - "limit": "1 kB", - "import": "{ ConfigProviderPathPatch }" - }, - { - "name": "ConfigSecret", - "path": "./dist/dist/esm/index.js", - "limit": "4 kB", - "import": "{ ConfigSecret }" - }, - { - "name": "Console", - "path": "./dist/dist/esm/index.js", - "limit": "34 kB", - "import": "{ Console }" - }, - { - "name": "Context", - "path": "./dist/dist/esm/index.js", - "limit": "4 kB", - "import": "{ Context }" - }, - { - "name": "Data", - "path": "./dist/dist/esm/index.js", - "limit": "11 kB", - "import": "{ Data }" - }, - { - "name": "DefaultServices", - "path": "./dist/dist/esm/index.js", - "limit": "17 kB", - "import": "{ DefaultServices }" - }, - { - "name": "Deferred", - "path": "./dist/dist/esm/index.js", - "limit": "12 kB", - "import": "{ Deferred }" - }, - { - "name": "Differ", - "path": "./dist/dist/esm/index.js", - "limit": "8 kB", - "import": "{ Differ }" - }, - { - "name": "Duration", - "path": "./dist/dist/esm/index.js", - "limit": "5 kB", - "import": "{ Duration }" - }, - { - "name": "Effect", - "path": "./dist/dist/esm/index.js", - "limit": "51 kB", - "import": "{ Effect }" - }, - { - "name": "Effectable", - "path": "./dist/dist/esm/index.js", - "limit": "3 kB", - "import": "{ Effectable }" - }, - { - "name": "Either", - "path": "./dist/dist/esm/index.js", - "limit": "4 kB", - "import": "{ Either }" - }, - { - "name": "Encoding", - "path": "./dist/dist/esm/index.js", - "limit": "5 kB", - "import": "{ Encoding }" - }, - { - "name": "Equal", - "path": "./dist/dist/esm/index.js", - "limit": "2 kB", - "import": "{ Equal }" - }, - { - "name": "Equivalence", - "path": "./dist/dist/esm/index.js", - "limit": "1 kB", - "import": "{ Equivalence }" - }, - { - "name": "ExecutionStrategy", - "path": "./dist/dist/esm/index.js", - "limit": "1 kB", - "import": "{ ExecutionStrategy }" - }, - { - "name": "Exit", - "path": "./dist/dist/esm/index.js", - "limit": "10 kB", - "import": "{ Exit }" - }, - { - "name": "Fiber", - "path": "./dist/dist/esm/index.js", - "limit": "37 kB", - "import": "{ Fiber }" - }, - { - "name": "FiberId", - "path": "./dist/dist/esm/index.js", - "limit": "7 kB", - "import": "{ FiberId }" - }, - { - "name": "FiberRef", - "path": "./dist/dist/esm/index.js", - "limit": "36 kB", - "import": "{ FiberRef }" - }, - { - "name": "FiberRefs", - "path": "./dist/dist/esm/index.js", - "limit": "8 kB", - "import": "{ FiberRefs }" - }, - { - "name": "FiberRefsPatch", - "path": "./dist/dist/esm/index.js", - "limit": "4 kB", - "import": "{ FiberRefsPatch }" - }, - { - "name": "FiberStatus", - "path": "./dist/dist/esm/index.js", - "limit": "3 kB", - "import": "{ FiberStatus }" - }, - { - "name": "Function", - "path": "./dist/dist/esm/index.js", - "limit": "1 kB", - "import": "{ Function }" - }, - { - "name": "GlobalValue", - "path": "./dist/dist/esm/index.js", - "limit": "1 kB", - "import": "{ GlobalValue }" - }, - { - "name": "GroupBy", - "path": "./dist/dist/esm/index.js", - "limit": "49 kB", - "import": "{ GroupBy }" - }, - { - "name": "HKT", - "path": "./dist/dist/esm/index.js", - "limit": "1 kB", - "import": "{ HKT }" - }, - { - "name": "Hash", - "path": "./dist/dist/esm/index.js", - "limit": "2 kB", - "import": "{ Hash }" - }, - { - "name": "HashMap", - "path": "./dist/dist/esm/index.js", - "limit": "6 kB", - "import": "{ HashMap }" - }, - { - "name": "HashSet", - "path": "./dist/dist/esm/index.js", - "limit": "6 kB", - "import": "{ HashSet }" - }, - { - "name": "Inspectable", - "path": "./dist/dist/esm/index.js", - "limit": "1 kB", - "import": "{ Inspectable }" - }, - { - "name": "KeyedPool", - "path": "./dist/dist/esm/index.js", - "limit": "40 kB", - "import": "{ KeyedPool }" - }, - { - "name": "Layer", - "path": "./dist/dist/esm/index.js", - "limit": "42 kB", - "import": "{ Layer }" - }, - { - "name": "List", - "path": "./dist/dist/esm/index.js", - "limit": "6 kB", - "import": "{ List }" - }, - { - "name": "LogLevel", - "path": "./dist/dist/esm/index.js", - "limit": "11 kB", - "import": "{ LogLevel }" - }, - { - "name": "LogSpan", - "path": "./dist/dist/esm/index.js", - "limit": "1 kB", - "import": "{ LogSpan }" - }, - { - "name": "Logger", - "path": "./dist/dist/esm/index.js", - "limit": "40 kB", - "import": "{ Logger }" - }, - { - "name": "Match", - "path": "./dist/dist/esm/index.js", - "limit": "5 kB", - "import": "{ Match }" - }, - { - "name": "MergeDecision", - "path": "./dist/dist/esm/index.js", - "limit": "1 kB", - "import": "{ MergeDecision }" - }, - { - "name": "MergeState", - "path": "./dist/dist/esm/index.js", - "limit": "1 kB", - "import": "{ MergeState }" - }, - { - "name": "MergeStrategy", - "path": "./dist/dist/esm/index.js", - "limit": "1 kB", - "import": "{ MergeStrategy }" - }, - { - "name": "Metric", - "path": "./dist/dist/esm/index.js", - "limit": "34 kB", - "import": "{ Metric }" - }, - { - "name": "MetricBoundaries", - "path": "./dist/dist/esm/index.js", - "limit": "4 kB", - "import": "{ MetricBoundaries }" - }, - { - "name": "MetricHook", - "path": "./dist/dist/esm/index.js", - "limit": "9 kB", - "import": "{ MetricHook }" - }, - { - "name": "MetricKey", - "path": "./dist/dist/esm/index.js", - "limit": "7 kB", - "import": "{ MetricKey }" - }, - { - "name": "MetricKeyType", - "path": "./dist/dist/esm/index.js", - "limit": "4 kB", - "import": "{ MetricKeyType }" - }, - { - "name": "MetricLabel", - "path": "./dist/dist/esm/index.js", - "limit": "3 kB", - "import": "{ MetricLabel }" - }, - { - "name": "MetricPair", - "path": "./dist/dist/esm/index.js", - "limit": "1 kB", - "import": "{ MetricPair }" - }, - { - "name": "MetricPolling", - "path": "./dist/dist/esm/index.js", - "limit": "34 kB", - "import": "{ MetricPolling }" - }, - { - "name": "MetricRegistry", - "path": "./dist/dist/esm/index.js", - "limit": "10 kB", - "import": "{ MetricRegistry }" - }, - { - "name": "MetricState", - "path": "./dist/dist/esm/index.js", - "limit": "3 kB", - "import": "{ MetricState }" - }, - { - "name": "MutableHashMap", - "path": "./dist/dist/esm/index.js", - "limit": "6 kB", - "import": "{ MutableHashMap }" - }, - { - "name": "MutableHashSet", - "path": "./dist/dist/esm/index.js", - "limit": "6 kB", - "import": "{ MutableHashSet }" - }, - { - "name": "MutableList", - "path": "./dist/dist/esm/index.js", - "limit": "2 kB", - "import": "{ MutableList }" - }, - { - "name": "MutableQueue", - "path": "./dist/dist/esm/index.js", - "limit": "4 kB", - "import": "{ MutableQueue }" - }, - { - "name": "MutableRef", - "path": "./dist/dist/esm/index.js", - "limit": "3 kB", - "import": "{ MutableRef }" - }, - { - "name": "NonEmptyIterable", - "path": "./dist/dist/esm/index.js", - "limit": "1 kB", - "import": "{ NonEmptyIterable }" - }, - { - "name": "Number", - "path": "./dist/dist/esm/index.js", - "limit": "4 kB", - "import": "{ Number }" - }, - { - "name": "Option", - "path": "./dist/dist/esm/index.js", - "limit": "5 kB", - "import": "{ Option }" - }, - { - "name": "Order", - "path": "./dist/dist/esm/index.js", - "limit": "2 kB", - "import": "{ Order }" - }, - { - "name": "Ordering", - "path": "./dist/dist/esm/index.js", - "limit": "1 kB", - "import": "{ Ordering }" - }, - { - "name": "Pipeable", - "path": "./dist/dist/esm/index.js", - "limit": "1 kB", - "import": "{ Pipeable }" - }, - { - "name": "Pool", - "path": "./dist/dist/esm/index.js", - "limit": "39 kB", - "import": "{ Pool }" - }, - { - "name": "Predicate", - "path": "./dist/dist/esm/index.js", - "limit": "2 kB", - "import": "{ Predicate }" - }, - { - "name": "PubSub", - "path": "./dist/dist/esm/index.js", - "limit": "40 kB", - "import": "{ PubSub }" - }, - { - "name": "Queue", - "path": "./dist/dist/esm/index.js", - "limit": "36 kB", - "import": "{ Queue }" - }, - { - "name": "Random", - "path": "./dist/dist/esm/index.js", - "limit": "17 kB", - "import": "{ Random }" - }, - { - "name": "ReadonlyArray", - "path": "./dist/dist/esm/index.js", - "limit": "7 kB", - "import": "{ ReadonlyArray }" - }, - { - "name": "ReadonlyRecord", - "path": "./dist/dist/esm/index.js", - "limit": "4 kB", - "import": "{ ReadonlyRecord }" - }, - { - "name": "RedBlackTree", - "path": "./dist/dist/esm/index.js", - "limit": "8 kB", - "import": "{ RedBlackTree }" - }, - { - "name": "Ref", - "path": "./dist/dist/esm/index.js", - "limit": "5 kB", - "import": "{ Ref }" - }, - { - "name": "Reloadable", - "path": "./dist/dist/esm/index.js", - "limit": "38 kB", - "import": "{ Reloadable }" - }, - { - "name": "Request", - "path": "./dist/dist/esm/index.js", - "limit": "37 kB", - "import": "{ Request }" - }, - { - "name": "RequestBlock", - "path": "./dist/dist/esm/index.js", - "limit": "12 kB", - "import": "{ RequestBlock }" - }, - { - "name": "RequestResolver", - "path": "./dist/dist/esm/index.js", - "limit": "36 kB", - "import": "{ RequestResolver }" - }, - { - "name": "Resource", - "path": "./dist/dist/esm/index.js", - "limit": "36 kB", - "import": "{ Resource }" - }, - { - "name": "Runtime", - "path": "./dist/dist/esm/index.js", - "limit": "34 kB", - "import": "{ Runtime }" - }, - { - "name": "RuntimeFlags", - "path": "./dist/dist/esm/index.js", - "limit": "34 kB", - "import": "{ RuntimeFlags }" - }, - { - "name": "RuntimeFlagsPatch", - "path": "./dist/dist/esm/index.js", - "limit": "1 kB", - "import": "{ RuntimeFlagsPatch }" - }, - { - "name": "STM", - "path": "./dist/dist/esm/index.js", - "limit": "18 kB", - "import": "{ STM }" - }, - { - "name": "Schedule", - "path": "./dist/dist/esm/index.js", - "limit": "23 kB", - "import": "{ Schedule }" - }, - { - "name": "ScheduleDecision", - "path": "./dist/dist/esm/index.js", - "limit": "3 kB", - "import": "{ ScheduleDecision }" - }, - { - "name": "ScheduleInterval", - "path": "./dist/dist/esm/index.js", - "limit": "4 kB", - "import": "{ ScheduleInterval }" - }, - { - "name": "ScheduleIntervals", - "path": "./dist/dist/esm/index.js", - "limit": "5 kB", - "import": "{ ScheduleIntervals }" - }, - { - "name": "Scheduler", - "path": "./dist/dist/esm/index.js", - "limit": "11 kB", - "import": "{ Scheduler }" - }, - { - "name": "Scope", - "path": "./dist/dist/esm/index.js", - "limit": "34 kB", - "import": "{ Scope }" - }, - { - "name": "ScopedCache", - "path": "./dist/dist/esm/index.js", - "limit": "38 kB", - "import": "{ ScopedCache }" - }, - { - "name": "ScopedRef", - "path": "./dist/dist/esm/index.js", - "limit": "35 kB", - "import": "{ ScopedRef }" - }, - { - "name": "SingleProducerAsyncInput", - "path": "./dist/dist/esm/index.js", - "limit": "35 kB", - "import": "{ SingleProducerAsyncInput }" - }, - { - "name": "Sink", - "path": "./dist/dist/esm/index.js", - "limit": "53 kB", - "import": "{ Sink }" - }, - { - "name": "SortedMap", - "path": "./dist/dist/esm/index.js", - "limit": "6 kB", - "import": "{ SortedMap }" - }, - { - "name": "SortedSet", - "path": "./dist/dist/esm/index.js", - "limit": "6 kB", - "import": "{ SortedSet }" - }, - { - "name": "Stream", - "path": "./dist/dist/esm/index.js", - "limit": "72 kB", - "import": "{ Stream }" - }, - { - "name": "StreamEmit", - "path": "./dist/dist/esm/index.js", - "limit": "1 kB", - "import": "{ StreamEmit }" - }, - { - "name": "StreamHaltStrategy", - "path": "./dist/dist/esm/index.js", - "limit": "1 kB", - "import": "{ StreamHaltStrategy }" - }, - { - "name": "Streamable", - "path": "./dist/dist/esm/index.js", - "limit": "12 kB", - "import": "{ Streamable }" - }, - { - "name": "String", - "path": "./dist/dist/esm/index.js", - "limit": "4 kB", - "import": "{ String }" - }, - { - "name": "Struct", - "path": "./dist/dist/esm/index.js", - "limit": "1 kB", - "import": "{ Struct }" - }, - { - "name": "SubscriptionRef", - "path": "./dist/dist/esm/index.js", - "limit": "50 kB", - "import": "{ SubscriptionRef }" - }, - { - "name": "Supervisor", - "path": "./dist/dist/esm/index.js", - "limit": "34 kB", - "import": "{ Supervisor }" - }, - { - "name": "Symbol", - "path": "./dist/dist/esm/index.js", - "limit": "1 kB", - "import": "{ Symbol }" - }, - { - "name": "SynchronizedRef", - "path": "./dist/dist/esm/index.js", - "limit": "34 kB", - "import": "{ SynchronizedRef }" - }, - { - "name": "TArray", - "path": "./dist/dist/esm/index.js", - "limit": "16 kB", - "import": "{ TArray }" - }, - { - "name": "TDeferred", - "path": "./dist/dist/esm/index.js", - "limit": "15 kB", - "import": "{ TDeferred }" - }, - { - "name": "TMap", - "path": "./dist/dist/esm/index.js", - "limit": "17 kB", - "import": "{ TMap }" - }, - { - "name": "TPriorityQueue", - "path": "./dist/dist/esm/index.js", - "limit": "18 kB", - "import": "{ TPriorityQueue }" - }, - { - "name": "TPubSub", - "path": "./dist/dist/esm/index.js", - "limit": "38 kB", - "import": "{ TPubSub }" - }, - { - "name": "TQueue", - "path": "./dist/dist/esm/index.js", - "limit": "16 kB", - "import": "{ TQueue }" - }, - { - "name": "TRandom", - "path": "./dist/dist/esm/index.js", - "limit": "15 kB", - "import": "{ TRandom }" - }, - { - "name": "TReentrantLock", - "path": "./dist/dist/esm/index.js", - "limit": "38 kB", - "import": "{ TReentrantLock }" - }, - { - "name": "TRef", - "path": "./dist/dist/esm/index.js", - "limit": "15 kB", - "import": "{ TRef }" - }, - { - "name": "TSemaphore", - "path": "./dist/dist/esm/index.js", - "limit": "38 kB", - "import": "{ TSemaphore }" - }, - { - "name": "TSet", - "path": "./dist/dist/esm/index.js", - "limit": "17 kB", - "import": "{ TSet }" - }, - { - "name": "Take", - "path": "./dist/dist/esm/index.js", - "limit": "10 kB", - "import": "{ Take }" - }, - { - "name": "TestAnnotation", - "path": "./dist/dist/esm/index.js", - "limit": "7 kB", - "import": "{ TestAnnotation }" - }, - { - "name": "TestAnnotationMap", - "path": "./dist/dist/esm/index.js", - "limit": "1 kB", - "import": "{ TestAnnotationMap }" - }, - { - "name": "TestAnnotations", - "path": "./dist/dist/esm/index.js", - "limit": "13 kB", - "import": "{ TestAnnotations }" - }, - { - "name": "TestClock", - "path": "./dist/dist/esm/index.js", - "limit": "38 kB", - "import": "{ TestClock }" - }, - { - "name": "TestConfig", - "path": "./dist/dist/esm/index.js", - "limit": "3 kB", - "import": "{ TestConfig }" - }, - { - "name": "TestContext", - "path": "./dist/dist/esm/index.js", - "limit": "39 kB", - "import": "{ TestContext }" - }, - { - "name": "TestLive", - "path": "./dist/dist/esm/index.js", - "limit": "17 kB", - "import": "{ TestLive }" - }, - { - "name": "TestServices", - "path": "./dist/dist/esm/index.js", - "limit": "35 kB", - "import": "{ TestServices }" - }, - { - "name": "TestSized", - "path": "./dist/dist/esm/index.js", - "limit": "11 kB", - "import": "{ TestSized }" - }, - { - "name": "Tracer", - "path": "./dist/dist/esm/index.js", - "limit": "17 kB", - "import": "{ Tracer }" - }, - { - "name": "Tuple", - "path": "./dist/dist/esm/index.js", - "limit": "1 kB", - "import": "{ Tuple }" - }, - { - "name": "Types", - "path": "./dist/dist/esm/index.js", - "limit": "1 kB", - "import": "{ Types }" - }, - { - "name": "Unify", - "path": "./dist/dist/esm/index.js", - "limit": "1 kB", - "import": "{ Unify }" - }, - { - "name": "UpstreamPullRequest", - "path": "./dist/dist/esm/index.js", - "limit": "1 kB", - "import": "{ UpstreamPullRequest }" - }, - { - "name": "UpstreamPullStrategy", - "path": "./dist/dist/esm/index.js", - "limit": "1 kB", - "import": "{ UpstreamPullStrategy }" - }, - { - "name": "Utils", - "path": "./dist/dist/esm/index.js", - "limit": "2 kB", - "import": "{ Utils }" - } - ], - "exports": { - "./package.json": "./package.json", - ".": { - "types": "./dist/dts/index.d.ts", - "import": "./dist/esm/index.js", - "require": "./dist/cjs/index.js" - }, - "./BigDecimal": { - "types": "./dist/dts/BigDecimal.d.ts", - "import": "./dist/esm/BigDecimal.js", - "require": "./dist/cjs/BigDecimal.js" - }, - "./BigInt": { - "types": "./dist/dts/BigInt.d.ts", - "import": "./dist/esm/BigInt.js", - "require": "./dist/cjs/BigInt.js" - }, - "./Boolean": { - "types": "./dist/dts/Boolean.d.ts", - "import": "./dist/esm/Boolean.js", - "require": "./dist/cjs/Boolean.js" - }, - "./Brand": { - "types": "./dist/dts/Brand.d.ts", - "import": "./dist/esm/Brand.js", - "require": "./dist/cjs/Brand.js" - }, - "./Cache": { - "types": "./dist/dts/Cache.d.ts", - "import": "./dist/esm/Cache.js", - "require": "./dist/cjs/Cache.js" - }, - "./Cause": { - "types": "./dist/dts/Cause.d.ts", - "import": "./dist/esm/Cause.js", - "require": "./dist/cjs/Cause.js" - }, - "./Channel": { - "types": "./dist/dts/Channel.d.ts", - "import": "./dist/esm/Channel.js", - "require": "./dist/cjs/Channel.js" - }, - "./ChildExecutorDecision": { - "types": "./dist/dts/ChildExecutorDecision.d.ts", - "import": "./dist/esm/ChildExecutorDecision.js", - "require": "./dist/cjs/ChildExecutorDecision.js" - }, - "./Chunk": { - "types": "./dist/dts/Chunk.d.ts", - "import": "./dist/esm/Chunk.js", - "require": "./dist/cjs/Chunk.js" - }, - "./Clock": { - "types": "./dist/dts/Clock.d.ts", - "import": "./dist/esm/Clock.js", - "require": "./dist/cjs/Clock.js" - }, - "./Config": { - "types": "./dist/dts/Config.d.ts", - "import": "./dist/esm/Config.js", - "require": "./dist/cjs/Config.js" - }, - "./ConfigError": { - "types": "./dist/dts/ConfigError.d.ts", - "import": "./dist/esm/ConfigError.js", - "require": "./dist/cjs/ConfigError.js" - }, - "./ConfigProvider": { - "types": "./dist/dts/ConfigProvider.d.ts", - "import": "./dist/esm/ConfigProvider.js", - "require": "./dist/cjs/ConfigProvider.js" - }, - "./ConfigProviderPathPatch": { - "types": "./dist/dts/ConfigProviderPathPatch.d.ts", - "import": "./dist/esm/ConfigProviderPathPatch.js", - "require": "./dist/cjs/ConfigProviderPathPatch.js" - }, - "./ConfigSecret": { - "types": "./dist/dts/ConfigSecret.d.ts", - "import": "./dist/esm/ConfigSecret.js", - "require": "./dist/cjs/ConfigSecret.js" - }, - "./Console": { - "types": "./dist/dts/Console.d.ts", - "import": "./dist/esm/Console.js", - "require": "./dist/cjs/Console.js" - }, - "./Context": { - "types": "./dist/dts/Context.d.ts", - "import": "./dist/esm/Context.js", - "require": "./dist/cjs/Context.js" - }, - "./Data": { - "types": "./dist/dts/Data.d.ts", - "import": "./dist/esm/Data.js", - "require": "./dist/cjs/Data.js" - }, - "./DefaultServices": { - "types": "./dist/dts/DefaultServices.d.ts", - "import": "./dist/esm/DefaultServices.js", - "require": "./dist/cjs/DefaultServices.js" - }, - "./Deferred": { - "types": "./dist/dts/Deferred.d.ts", - "import": "./dist/esm/Deferred.js", - "require": "./dist/cjs/Deferred.js" - }, - "./Differ": { - "types": "./dist/dts/Differ.d.ts", - "import": "./dist/esm/Differ.js", - "require": "./dist/cjs/Differ.js" - }, - "./Duration": { - "types": "./dist/dts/Duration.d.ts", - "import": "./dist/esm/Duration.js", - "require": "./dist/cjs/Duration.js" - }, - "./Effect": { - "types": "./dist/dts/Effect.d.ts", - "import": "./dist/esm/Effect.js", - "require": "./dist/cjs/Effect.js" - }, - "./Effectable": { - "types": "./dist/dts/Effectable.d.ts", - "import": "./dist/esm/Effectable.js", - "require": "./dist/cjs/Effectable.js" - }, - "./Either": { - "types": "./dist/dts/Either.d.ts", - "import": "./dist/esm/Either.js", - "require": "./dist/cjs/Either.js" - }, - "./Encoding": { - "types": "./dist/dts/Encoding.d.ts", - "import": "./dist/esm/Encoding.js", - "require": "./dist/cjs/Encoding.js" - }, - "./Equal": { - "types": "./dist/dts/Equal.d.ts", - "import": "./dist/esm/Equal.js", - "require": "./dist/cjs/Equal.js" - }, - "./Equivalence": { - "types": "./dist/dts/Equivalence.d.ts", - "import": "./dist/esm/Equivalence.js", - "require": "./dist/cjs/Equivalence.js" - }, - "./ExecutionStrategy": { - "types": "./dist/dts/ExecutionStrategy.d.ts", - "import": "./dist/esm/ExecutionStrategy.js", - "require": "./dist/cjs/ExecutionStrategy.js" - }, - "./Exit": { - "types": "./dist/dts/Exit.d.ts", - "import": "./dist/esm/Exit.js", - "require": "./dist/cjs/Exit.js" - }, - "./Fiber": { - "types": "./dist/dts/Fiber.d.ts", - "import": "./dist/esm/Fiber.js", - "require": "./dist/cjs/Fiber.js" - }, - "./FiberId": { - "types": "./dist/dts/FiberId.d.ts", - "import": "./dist/esm/FiberId.js", - "require": "./dist/cjs/FiberId.js" - }, - "./FiberRef": { - "types": "./dist/dts/FiberRef.d.ts", - "import": "./dist/esm/FiberRef.js", - "require": "./dist/cjs/FiberRef.js" - }, - "./FiberRefs": { - "types": "./dist/dts/FiberRefs.d.ts", - "import": "./dist/esm/FiberRefs.js", - "require": "./dist/cjs/FiberRefs.js" - }, - "./FiberRefsPatch": { - "types": "./dist/dts/FiberRefsPatch.d.ts", - "import": "./dist/esm/FiberRefsPatch.js", - "require": "./dist/cjs/FiberRefsPatch.js" - }, - "./FiberStatus": { - "types": "./dist/dts/FiberStatus.d.ts", - "import": "./dist/esm/FiberStatus.js", - "require": "./dist/cjs/FiberStatus.js" - }, - "./Function": { - "types": "./dist/dts/Function.d.ts", - "import": "./dist/esm/Function.js", - "require": "./dist/cjs/Function.js" - }, - "./GlobalValue": { - "types": "./dist/dts/GlobalValue.d.ts", - "import": "./dist/esm/GlobalValue.js", - "require": "./dist/cjs/GlobalValue.js" - }, - "./GroupBy": { - "types": "./dist/dts/GroupBy.d.ts", - "import": "./dist/esm/GroupBy.js", - "require": "./dist/cjs/GroupBy.js" - }, - "./HKT": { - "types": "./dist/dts/HKT.d.ts", - "import": "./dist/esm/HKT.js", - "require": "./dist/cjs/HKT.js" - }, - "./Hash": { - "types": "./dist/dts/Hash.d.ts", - "import": "./dist/esm/Hash.js", - "require": "./dist/cjs/Hash.js" - }, - "./HashMap": { - "types": "./dist/dts/HashMap.d.ts", - "import": "./dist/esm/HashMap.js", - "require": "./dist/cjs/HashMap.js" - }, - "./HashSet": { - "types": "./dist/dts/HashSet.d.ts", - "import": "./dist/esm/HashSet.js", - "require": "./dist/cjs/HashSet.js" - }, - "./Inspectable": { - "types": "./dist/dts/Inspectable.d.ts", - "import": "./dist/esm/Inspectable.js", - "require": "./dist/cjs/Inspectable.js" - }, - "./KeyedPool": { - "types": "./dist/dts/KeyedPool.d.ts", - "import": "./dist/esm/KeyedPool.js", - "require": "./dist/cjs/KeyedPool.js" - }, - "./Layer": { - "types": "./dist/dts/Layer.d.ts", - "import": "./dist/esm/Layer.js", - "require": "./dist/cjs/Layer.js" - }, - "./List": { - "types": "./dist/dts/List.d.ts", - "import": "./dist/esm/List.js", - "require": "./dist/cjs/List.js" - }, - "./LogLevel": { - "types": "./dist/dts/LogLevel.d.ts", - "import": "./dist/esm/LogLevel.js", - "require": "./dist/cjs/LogLevel.js" - }, - "./LogSpan": { - "types": "./dist/dts/LogSpan.d.ts", - "import": "./dist/esm/LogSpan.js", - "require": "./dist/cjs/LogSpan.js" - }, - "./Logger": { - "types": "./dist/dts/Logger.d.ts", - "import": "./dist/esm/Logger.js", - "require": "./dist/cjs/Logger.js" - }, - "./Match": { - "types": "./dist/dts/Match.d.ts", - "import": "./dist/esm/Match.js", - "require": "./dist/cjs/Match.js" - }, - "./MergeDecision": { - "types": "./dist/dts/MergeDecision.d.ts", - "import": "./dist/esm/MergeDecision.js", - "require": "./dist/cjs/MergeDecision.js" - }, - "./MergeState": { - "types": "./dist/dts/MergeState.d.ts", - "import": "./dist/esm/MergeState.js", - "require": "./dist/cjs/MergeState.js" - }, - "./MergeStrategy": { - "types": "./dist/dts/MergeStrategy.d.ts", - "import": "./dist/esm/MergeStrategy.js", - "require": "./dist/cjs/MergeStrategy.js" - }, - "./Metric": { - "types": "./dist/dts/Metric.d.ts", - "import": "./dist/esm/Metric.js", - "require": "./dist/cjs/Metric.js" - }, - "./MetricBoundaries": { - "types": "./dist/dts/MetricBoundaries.d.ts", - "import": "./dist/esm/MetricBoundaries.js", - "require": "./dist/cjs/MetricBoundaries.js" - }, - "./MetricHook": { - "types": "./dist/dts/MetricHook.d.ts", - "import": "./dist/esm/MetricHook.js", - "require": "./dist/cjs/MetricHook.js" - }, - "./MetricKey": { - "types": "./dist/dts/MetricKey.d.ts", - "import": "./dist/esm/MetricKey.js", - "require": "./dist/cjs/MetricKey.js" - }, - "./MetricKeyType": { - "types": "./dist/dts/MetricKeyType.d.ts", - "import": "./dist/esm/MetricKeyType.js", - "require": "./dist/cjs/MetricKeyType.js" - }, - "./MetricLabel": { - "types": "./dist/dts/MetricLabel.d.ts", - "import": "./dist/esm/MetricLabel.js", - "require": "./dist/cjs/MetricLabel.js" - }, - "./MetricPair": { - "types": "./dist/dts/MetricPair.d.ts", - "import": "./dist/esm/MetricPair.js", - "require": "./dist/cjs/MetricPair.js" - }, - "./MetricPolling": { - "types": "./dist/dts/MetricPolling.d.ts", - "import": "./dist/esm/MetricPolling.js", - "require": "./dist/cjs/MetricPolling.js" - }, - "./MetricRegistry": { - "types": "./dist/dts/MetricRegistry.d.ts", - "import": "./dist/esm/MetricRegistry.js", - "require": "./dist/cjs/MetricRegistry.js" - }, - "./MetricState": { - "types": "./dist/dts/MetricState.d.ts", - "import": "./dist/esm/MetricState.js", - "require": "./dist/cjs/MetricState.js" - }, - "./MutableHashMap": { - "types": "./dist/dts/MutableHashMap.d.ts", - "import": "./dist/esm/MutableHashMap.js", - "require": "./dist/cjs/MutableHashMap.js" - }, - "./MutableHashSet": { - "types": "./dist/dts/MutableHashSet.d.ts", - "import": "./dist/esm/MutableHashSet.js", - "require": "./dist/cjs/MutableHashSet.js" - }, - "./MutableList": { - "types": "./dist/dts/MutableList.d.ts", - "import": "./dist/esm/MutableList.js", - "require": "./dist/cjs/MutableList.js" - }, - "./MutableQueue": { - "types": "./dist/dts/MutableQueue.d.ts", - "import": "./dist/esm/MutableQueue.js", - "require": "./dist/cjs/MutableQueue.js" - }, - "./MutableRef": { - "types": "./dist/dts/MutableRef.d.ts", - "import": "./dist/esm/MutableRef.js", - "require": "./dist/cjs/MutableRef.js" - }, - "./NonEmptyIterable": { - "types": "./dist/dts/NonEmptyIterable.d.ts", - "import": "./dist/esm/NonEmptyIterable.js", - "require": "./dist/cjs/NonEmptyIterable.js" - }, - "./Number": { - "types": "./dist/dts/Number.d.ts", - "import": "./dist/esm/Number.js", - "require": "./dist/cjs/Number.js" - }, - "./Option": { - "types": "./dist/dts/Option.d.ts", - "import": "./dist/esm/Option.js", - "require": "./dist/cjs/Option.js" - }, - "./Order": { - "types": "./dist/dts/Order.d.ts", - "import": "./dist/esm/Order.js", - "require": "./dist/cjs/Order.js" - }, - "./Ordering": { - "types": "./dist/dts/Ordering.d.ts", - "import": "./dist/esm/Ordering.js", - "require": "./dist/cjs/Ordering.js" - }, - "./Pipeable": { - "types": "./dist/dts/Pipeable.d.ts", - "import": "./dist/esm/Pipeable.js", - "require": "./dist/cjs/Pipeable.js" - }, - "./Pool": { - "types": "./dist/dts/Pool.d.ts", - "import": "./dist/esm/Pool.js", - "require": "./dist/cjs/Pool.js" - }, - "./Predicate": { - "types": "./dist/dts/Predicate.d.ts", - "import": "./dist/esm/Predicate.js", - "require": "./dist/cjs/Predicate.js" - }, - "./PubSub": { - "types": "./dist/dts/PubSub.d.ts", - "import": "./dist/esm/PubSub.js", - "require": "./dist/cjs/PubSub.js" - }, - "./Queue": { - "types": "./dist/dts/Queue.d.ts", - "import": "./dist/esm/Queue.js", - "require": "./dist/cjs/Queue.js" - }, - "./Random": { - "types": "./dist/dts/Random.d.ts", - "import": "./dist/esm/Random.js", - "require": "./dist/cjs/Random.js" - }, - "./ReadonlyArray": { - "types": "./dist/dts/ReadonlyArray.d.ts", - "import": "./dist/esm/ReadonlyArray.js", - "require": "./dist/cjs/ReadonlyArray.js" - }, - "./ReadonlyRecord": { - "types": "./dist/dts/ReadonlyRecord.d.ts", - "import": "./dist/esm/ReadonlyRecord.js", - "require": "./dist/cjs/ReadonlyRecord.js" - }, - "./RedBlackTree": { - "types": "./dist/dts/RedBlackTree.d.ts", - "import": "./dist/esm/RedBlackTree.js", - "require": "./dist/cjs/RedBlackTree.js" - }, - "./Ref": { - "types": "./dist/dts/Ref.d.ts", - "import": "./dist/esm/Ref.js", - "require": "./dist/cjs/Ref.js" - }, - "./Reloadable": { - "types": "./dist/dts/Reloadable.d.ts", - "import": "./dist/esm/Reloadable.js", - "require": "./dist/cjs/Reloadable.js" - }, - "./Request": { - "types": "./dist/dts/Request.d.ts", - "import": "./dist/esm/Request.js", - "require": "./dist/cjs/Request.js" - }, - "./RequestBlock": { - "types": "./dist/dts/RequestBlock.d.ts", - "import": "./dist/esm/RequestBlock.js", - "require": "./dist/cjs/RequestBlock.js" - }, - "./RequestResolver": { - "types": "./dist/dts/RequestResolver.d.ts", - "import": "./dist/esm/RequestResolver.js", - "require": "./dist/cjs/RequestResolver.js" - }, - "./Resource": { - "types": "./dist/dts/Resource.d.ts", - "import": "./dist/esm/Resource.js", - "require": "./dist/cjs/Resource.js" - }, - "./Runtime": { - "types": "./dist/dts/Runtime.d.ts", - "import": "./dist/esm/Runtime.js", - "require": "./dist/cjs/Runtime.js" - }, - "./RuntimeFlags": { - "types": "./dist/dts/RuntimeFlags.d.ts", - "import": "./dist/esm/RuntimeFlags.js", - "require": "./dist/cjs/RuntimeFlags.js" - }, - "./RuntimeFlagsPatch": { - "types": "./dist/dts/RuntimeFlagsPatch.d.ts", - "import": "./dist/esm/RuntimeFlagsPatch.js", - "require": "./dist/cjs/RuntimeFlagsPatch.js" - }, - "./STM": { - "types": "./dist/dts/STM.d.ts", - "import": "./dist/esm/STM.js", - "require": "./dist/cjs/STM.js" - }, - "./Schedule": { - "types": "./dist/dts/Schedule.d.ts", - "import": "./dist/esm/Schedule.js", - "require": "./dist/cjs/Schedule.js" - }, - "./ScheduleDecision": { - "types": "./dist/dts/ScheduleDecision.d.ts", - "import": "./dist/esm/ScheduleDecision.js", - "require": "./dist/cjs/ScheduleDecision.js" - }, - "./ScheduleInterval": { - "types": "./dist/dts/ScheduleInterval.d.ts", - "import": "./dist/esm/ScheduleInterval.js", - "require": "./dist/cjs/ScheduleInterval.js" - }, - "./ScheduleIntervals": { - "types": "./dist/dts/ScheduleIntervals.d.ts", - "import": "./dist/esm/ScheduleIntervals.js", - "require": "./dist/cjs/ScheduleIntervals.js" - }, - "./Scheduler": { - "types": "./dist/dts/Scheduler.d.ts", - "import": "./dist/esm/Scheduler.js", - "require": "./dist/cjs/Scheduler.js" - }, - "./Scope": { - "types": "./dist/dts/Scope.d.ts", - "import": "./dist/esm/Scope.js", - "require": "./dist/cjs/Scope.js" - }, - "./ScopedCache": { - "types": "./dist/dts/ScopedCache.d.ts", - "import": "./dist/esm/ScopedCache.js", - "require": "./dist/cjs/ScopedCache.js" - }, - "./ScopedRef": { - "types": "./dist/dts/ScopedRef.d.ts", - "import": "./dist/esm/ScopedRef.js", - "require": "./dist/cjs/ScopedRef.js" - }, - "./SingleProducerAsyncInput": { - "types": "./dist/dts/SingleProducerAsyncInput.d.ts", - "import": "./dist/esm/SingleProducerAsyncInput.js", - "require": "./dist/cjs/SingleProducerAsyncInput.js" - }, - "./Sink": { - "types": "./dist/dts/Sink.d.ts", - "import": "./dist/esm/Sink.js", - "require": "./dist/cjs/Sink.js" - }, - "./SortedMap": { - "types": "./dist/dts/SortedMap.d.ts", - "import": "./dist/esm/SortedMap.js", - "require": "./dist/cjs/SortedMap.js" - }, - "./SortedSet": { - "types": "./dist/dts/SortedSet.d.ts", - "import": "./dist/esm/SortedSet.js", - "require": "./dist/cjs/SortedSet.js" - }, - "./Stream": { - "types": "./dist/dts/Stream.d.ts", - "import": "./dist/esm/Stream.js", - "require": "./dist/cjs/Stream.js" - }, - "./StreamEmit": { - "types": "./dist/dts/StreamEmit.d.ts", - "import": "./dist/esm/StreamEmit.js", - "require": "./dist/cjs/StreamEmit.js" - }, - "./StreamHaltStrategy": { - "types": "./dist/dts/StreamHaltStrategy.d.ts", - "import": "./dist/esm/StreamHaltStrategy.js", - "require": "./dist/cjs/StreamHaltStrategy.js" - }, - "./Streamable": { - "types": "./dist/dts/Streamable.d.ts", - "import": "./dist/esm/Streamable.js", - "require": "./dist/cjs/Streamable.js" - }, - "./String": { - "types": "./dist/dts/String.d.ts", - "import": "./dist/esm/String.js", - "require": "./dist/cjs/String.js" - }, - "./Struct": { - "types": "./dist/dts/Struct.d.ts", - "import": "./dist/esm/Struct.js", - "require": "./dist/cjs/Struct.js" - }, - "./SubscriptionRef": { - "types": "./dist/dts/SubscriptionRef.d.ts", - "import": "./dist/esm/SubscriptionRef.js", - "require": "./dist/cjs/SubscriptionRef.js" - }, - "./Supervisor": { - "types": "./dist/dts/Supervisor.d.ts", - "import": "./dist/esm/Supervisor.js", - "require": "./dist/cjs/Supervisor.js" - }, - "./Symbol": { - "types": "./dist/dts/Symbol.d.ts", - "import": "./dist/esm/Symbol.js", - "require": "./dist/cjs/Symbol.js" - }, - "./SynchronizedRef": { - "types": "./dist/dts/SynchronizedRef.d.ts", - "import": "./dist/esm/SynchronizedRef.js", - "require": "./dist/cjs/SynchronizedRef.js" - }, - "./TArray": { - "types": "./dist/dts/TArray.d.ts", - "import": "./dist/esm/TArray.js", - "require": "./dist/cjs/TArray.js" - }, - "./TDeferred": { - "types": "./dist/dts/TDeferred.d.ts", - "import": "./dist/esm/TDeferred.js", - "require": "./dist/cjs/TDeferred.js" - }, - "./TMap": { - "types": "./dist/dts/TMap.d.ts", - "import": "./dist/esm/TMap.js", - "require": "./dist/cjs/TMap.js" - }, - "./TPriorityQueue": { - "types": "./dist/dts/TPriorityQueue.d.ts", - "import": "./dist/esm/TPriorityQueue.js", - "require": "./dist/cjs/TPriorityQueue.js" - }, - "./TPubSub": { - "types": "./dist/dts/TPubSub.d.ts", - "import": "./dist/esm/TPubSub.js", - "require": "./dist/cjs/TPubSub.js" - }, - "./TQueue": { - "types": "./dist/dts/TQueue.d.ts", - "import": "./dist/esm/TQueue.js", - "require": "./dist/cjs/TQueue.js" - }, - "./TRandom": { - "types": "./dist/dts/TRandom.d.ts", - "import": "./dist/esm/TRandom.js", - "require": "./dist/cjs/TRandom.js" - }, - "./TReentrantLock": { - "types": "./dist/dts/TReentrantLock.d.ts", - "import": "./dist/esm/TReentrantLock.js", - "require": "./dist/cjs/TReentrantLock.js" - }, - "./TRef": { - "types": "./dist/dts/TRef.d.ts", - "import": "./dist/esm/TRef.js", - "require": "./dist/cjs/TRef.js" - }, - "./TSemaphore": { - "types": "./dist/dts/TSemaphore.d.ts", - "import": "./dist/esm/TSemaphore.js", - "require": "./dist/cjs/TSemaphore.js" - }, - "./TSet": { - "types": "./dist/dts/TSet.d.ts", - "import": "./dist/esm/TSet.js", - "require": "./dist/cjs/TSet.js" - }, - "./Take": { - "types": "./dist/dts/Take.d.ts", - "import": "./dist/esm/Take.js", - "require": "./dist/cjs/Take.js" - }, - "./TestAnnotation": { - "types": "./dist/dts/TestAnnotation.d.ts", - "import": "./dist/esm/TestAnnotation.js", - "require": "./dist/cjs/TestAnnotation.js" - }, - "./TestAnnotationMap": { - "types": "./dist/dts/TestAnnotationMap.d.ts", - "import": "./dist/esm/TestAnnotationMap.js", - "require": "./dist/cjs/TestAnnotationMap.js" - }, - "./TestAnnotations": { - "types": "./dist/dts/TestAnnotations.d.ts", - "import": "./dist/esm/TestAnnotations.js", - "require": "./dist/cjs/TestAnnotations.js" - }, - "./TestClock": { - "types": "./dist/dts/TestClock.d.ts", - "import": "./dist/esm/TestClock.js", - "require": "./dist/cjs/TestClock.js" - }, - "./TestConfig": { - "types": "./dist/dts/TestConfig.d.ts", - "import": "./dist/esm/TestConfig.js", - "require": "./dist/cjs/TestConfig.js" - }, - "./TestContext": { - "types": "./dist/dts/TestContext.d.ts", - "import": "./dist/esm/TestContext.js", - "require": "./dist/cjs/TestContext.js" - }, - "./TestLive": { - "types": "./dist/dts/TestLive.d.ts", - "import": "./dist/esm/TestLive.js", - "require": "./dist/cjs/TestLive.js" - }, - "./TestServices": { - "types": "./dist/dts/TestServices.d.ts", - "import": "./dist/esm/TestServices.js", - "require": "./dist/cjs/TestServices.js" - }, - "./TestSized": { - "types": "./dist/dts/TestSized.d.ts", - "import": "./dist/esm/TestSized.js", - "require": "./dist/cjs/TestSized.js" - }, - "./Tracer": { - "types": "./dist/dts/Tracer.d.ts", - "import": "./dist/esm/Tracer.js", - "require": "./dist/cjs/Tracer.js" - }, - "./Tuple": { - "types": "./dist/dts/Tuple.d.ts", - "import": "./dist/esm/Tuple.js", - "require": "./dist/cjs/Tuple.js" - }, - "./Types": { - "types": "./dist/dts/Types.d.ts", - "import": "./dist/esm/Types.js", - "require": "./dist/cjs/Types.js" - }, - "./Unify": { - "types": "./dist/dts/Unify.d.ts", - "import": "./dist/esm/Unify.js", - "require": "./dist/cjs/Unify.js" - }, - "./UpstreamPullRequest": { - "types": "./dist/dts/UpstreamPullRequest.d.ts", - "import": "./dist/esm/UpstreamPullRequest.js", - "require": "./dist/cjs/UpstreamPullRequest.js" - }, - "./UpstreamPullStrategy": { - "types": "./dist/dts/UpstreamPullStrategy.d.ts", - "import": "./dist/esm/UpstreamPullStrategy.js", - "require": "./dist/cjs/UpstreamPullStrategy.js" - }, - "./Utils": { - "types": "./dist/dts/Utils.d.ts", - "import": "./dist/esm/Utils.js", - "require": "./dist/cjs/Utils.js" + "pnpm": { + "patchedDependencies": { + "@changesets/assemble-release-plan@5.2.4": "patches/@changesets__assemble-release-plan@5.2.4.patch" } } } diff --git a/CHANGELOG.md b/packages/effect/CHANGELOG.md similarity index 100% rename from CHANGELOG.md rename to packages/effect/CHANGELOG.md diff --git a/packages/effect/LICENSE b/packages/effect/LICENSE new file mode 100644 index 000000000..be1f5c14c --- /dev/null +++ b/packages/effect/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2023 Effectful Technologies Inc + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/packages/effect/README.md b/packages/effect/README.md new file mode 100644 index 000000000..d545a305e --- /dev/null +++ b/packages/effect/README.md @@ -0,0 +1,59 @@ +# Effect + +Welcome to Effect, a powerful TypeScript framework that provides a fully-fledged functional effect system with a rich standard library. + +# Requirements + +- TypeScript 5.0 or newer +- The `strict` flag enabled in your `tsconfig.json` file + +``` +{ + // ... + "compilerOptions": { + // ... + "strict": true, + } +} +``` + +## Documentation + +For detailed information and usage examples, please visit the [Effect website](https://www.effect.website/). + +## Introduction to Effect + +To get started with Effect, watch our introductory video on YouTube. This video provides an overview of Effect and its key features, making it a great starting point for newcomers: + +[![Introduction to Effect](https://img.youtube.com/vi/SloZE4i4Zfk/maxresdefault.jpg)](https://youtu.be/SloZE4i4Zfk) + +## Connect with Our Community + +Join our vibrant community on Discord to interact with fellow developers, ask questions, and share your experiences. Here's the invite link to our Discord server: [Join Effect's Discord Community](https://discord.gg/hdt7t7jpvn). + +## API Reference + +For detailed information on the Effect API, please refer to our [API Reference](https://effect-ts.github.io/effect/). + +## Pull Requests + +We welcome contributions via pull requests! Here are some guidelines to help you get started: + +1. Fork the repository and clone it to your local machine. +2. Create a new branch for your changes: `git checkout -b my-new-feature` +3. Install dependencies: `pnpm install` (`pnpm@8.x`) +4. Make your changes and add tests if applicable. +5. Run the tests: `pnpm test` +6. Generate the documentation if applicable: `pnpm docgen` +7. Create a changeset for your changes: before committing your changes, create a changeset to document the modifications. This helps in tracking and communicating the changes effectively. To create a changeset, run the following command: `pnpm changeset`. +8. Commit your changes: after creating the changeset, commit your changes with a descriptive commit message: `git commit -am 'Add some feature'`. +9. Push your changes to your fork: `git push origin my-new-feature`. +10. Open a pull request against our `main` branch. + +### Pull Request Guidelines + +- Please make sure your changes are consistent with the project's existing style and conventions. +- Please write clear commit messages and include a summary of your changes in the pull request description. +- Please make sure all tests pass and add new tests as necessary. +- If your change requires documentation, please update the relevant documentation. +- Please be patient! We will do our best to review your pull request as soon as possible. diff --git a/docgen.json b/packages/effect/docgen.json similarity index 100% rename from docgen.json rename to packages/effect/docgen.json diff --git a/dtslint/Chunk.ts b/packages/effect/dtslint/Chunk.ts similarity index 100% rename from dtslint/Chunk.ts rename to packages/effect/dtslint/Chunk.ts diff --git a/dtslint/Config.ts b/packages/effect/dtslint/Config.ts similarity index 100% rename from dtslint/Config.ts rename to packages/effect/dtslint/Config.ts diff --git a/dtslint/Data.ts b/packages/effect/dtslint/Data.ts similarity index 100% rename from dtslint/Data.ts rename to packages/effect/dtslint/Data.ts diff --git a/dtslint/Duration.ts b/packages/effect/dtslint/Duration.ts similarity index 100% rename from dtslint/Duration.ts rename to packages/effect/dtslint/Duration.ts diff --git a/dtslint/Effect.ts b/packages/effect/dtslint/Effect.ts similarity index 100% rename from dtslint/Effect.ts rename to packages/effect/dtslint/Effect.ts diff --git a/dtslint/Either.ts b/packages/effect/dtslint/Either.ts similarity index 100% rename from dtslint/Either.ts rename to packages/effect/dtslint/Either.ts diff --git a/dtslint/HKT.ts b/packages/effect/dtslint/HKT.ts similarity index 100% rename from dtslint/HKT.ts rename to packages/effect/dtslint/HKT.ts diff --git a/dtslint/HashMap.ts b/packages/effect/dtslint/HashMap.ts similarity index 100% rename from dtslint/HashMap.ts rename to packages/effect/dtslint/HashMap.ts diff --git a/dtslint/HashSet.ts b/packages/effect/dtslint/HashSet.ts similarity index 100% rename from dtslint/HashSet.ts rename to packages/effect/dtslint/HashSet.ts diff --git a/dtslint/List.ts b/packages/effect/dtslint/List.ts similarity index 100% rename from dtslint/List.ts rename to packages/effect/dtslint/List.ts diff --git a/dtslint/Option.ts b/packages/effect/dtslint/Option.ts similarity index 100% rename from dtslint/Option.ts rename to packages/effect/dtslint/Option.ts diff --git a/dtslint/Predicate.ts b/packages/effect/dtslint/Predicate.ts similarity index 100% rename from dtslint/Predicate.ts rename to packages/effect/dtslint/Predicate.ts diff --git a/dtslint/ReadonlyArray.ts b/packages/effect/dtslint/ReadonlyArray.ts similarity index 100% rename from dtslint/ReadonlyArray.ts rename to packages/effect/dtslint/ReadonlyArray.ts diff --git a/dtslint/ReadonlyRecord.ts b/packages/effect/dtslint/ReadonlyRecord.ts similarity index 100% rename from dtslint/ReadonlyRecord.ts rename to packages/effect/dtslint/ReadonlyRecord.ts diff --git a/dtslint/RedBlackTree.ts b/packages/effect/dtslint/RedBlackTree.ts similarity index 100% rename from dtslint/RedBlackTree.ts rename to packages/effect/dtslint/RedBlackTree.ts diff --git a/dtslint/SortedMap.ts b/packages/effect/dtslint/SortedMap.ts similarity index 100% rename from dtslint/SortedMap.ts rename to packages/effect/dtslint/SortedMap.ts diff --git a/dtslint/SortedSet.ts b/packages/effect/dtslint/SortedSet.ts similarity index 100% rename from dtslint/SortedSet.ts rename to packages/effect/dtslint/SortedSet.ts diff --git a/dtslint/String.ts b/packages/effect/dtslint/String.ts similarity index 100% rename from dtslint/String.ts rename to packages/effect/dtslint/String.ts diff --git a/dtslint/Struct.ts b/packages/effect/dtslint/Struct.ts similarity index 100% rename from dtslint/Struct.ts rename to packages/effect/dtslint/Struct.ts diff --git a/dtslint/TMap.ts b/packages/effect/dtslint/TMap.ts similarity index 100% rename from dtslint/TMap.ts rename to packages/effect/dtslint/TMap.ts diff --git a/dtslint/TSet.ts b/packages/effect/dtslint/TSet.ts similarity index 100% rename from dtslint/TSet.ts rename to packages/effect/dtslint/TSet.ts diff --git a/dtslint/Tuple.ts b/packages/effect/dtslint/Tuple.ts similarity index 100% rename from dtslint/Tuple.ts rename to packages/effect/dtslint/Tuple.ts diff --git a/dtslint/Types.ts b/packages/effect/dtslint/Types.ts similarity index 100% rename from dtslint/Types.ts rename to packages/effect/dtslint/Types.ts diff --git a/dtslint/Unify.ts b/packages/effect/dtslint/Unify.ts similarity index 100% rename from dtslint/Unify.ts rename to packages/effect/dtslint/Unify.ts diff --git a/packages/effect/dtslint/tsconfig.json b/packages/effect/dtslint/tsconfig.json new file mode 100644 index 000000000..ada9500c8 --- /dev/null +++ b/packages/effect/dtslint/tsconfig.json @@ -0,0 +1,10 @@ +{ + "extends": "../../../tsconfig.base.json", + "include": [ + "." + ], + "compilerOptions": { + "incremental": false, + "composite": false + } +} diff --git a/packages/effect/package.json b/packages/effect/package.json new file mode 100644 index 000000000..098c4f9d3 --- /dev/null +++ b/packages/effect/package.json @@ -0,0 +1,899 @@ +{ + "name": "effect", + "version": "2.0.0-next.55", + "type": "module", + "publishConfig": { + "access": "public", + "directory": "dist" + }, + "author": "Michael Arnaldi ", + "license": "MIT", + "repository": { + "type": "git", + "url": "https://github.com/Effect-TS/effect.git", + "directory": "packages/effect" + }, + "bugs": { + "url": "https://github.com/Effect-TS/effect/issues" + }, + "homepage": "https://github.com/Effect-TS/effect", + "description": "Functional programming in TypeScript", + "tags": [ + "typescript", + "algebraic-data-types", + "functional-programming" + ], + "keywords": [ + "typescript", + "algebraic-data-types", + "functional-programming" + ], + "scripts": { + "build": "pnpm build-prepare && pnpm build-esm && pnpm build-cjs && pnpm build-annotate && build-utils pack-v2", + "build-prepare": "build-utils prepare-v2", + "build-esm": "tsc -b tsconfig.build.json", + "build-cjs": "babel build/esm --plugins @babel/transform-export-namespace-from --plugins @babel/transform-modules-commonjs --out-dir build/cjs --source-maps", + "build-annotate": "babel build --plugins annotate-pure-calls --out-dir build --source-maps", + "dtslint": "dtslint dtslint" + }, + "size-limit": [ + { + "name": "BigDecimal", + "path": "./dist/dist/esm/index.js", + "limit": "5 kB", + "import": "{ BigDecimal }" + }, + { + "name": "BigInt", + "path": "./dist/dist/esm/index.js", + "limit": "4 kB", + "import": "{ BigInt }" + }, + { + "name": "Boolean", + "path": "./dist/dist/esm/index.js", + "limit": "1 kB", + "import": "{ Boolean }" + }, + { + "name": "Brand", + "path": "./dist/dist/esm/index.js", + "limit": "4 kB", + "import": "{ Brand }" + }, + { + "name": "Cache", + "path": "./dist/dist/esm/index.js", + "limit": "46 kB", + "import": "{ Cache }" + }, + { + "name": "Cause", + "path": "./dist/dist/esm/index.js", + "limit": "11 kB", + "import": "{ Cause }" + }, + { + "name": "Channel", + "path": "./dist/dist/esm/index.js", + "limit": "51 kB", + "import": "{ Channel }" + }, + { + "name": "ChildExecutorDecision", + "path": "./dist/dist/esm/index.js", + "limit": "1 kB", + "import": "{ ChildExecutorDecision }" + }, + { + "name": "Chunk", + "path": "./dist/dist/esm/index.js", + "limit": "7 kB", + "import": "{ Chunk }" + }, + { + "name": "Clock", + "path": "./dist/dist/esm/index.js", + "limit": "17 kB", + "import": "{ Clock }" + }, + { + "name": "Config", + "path": "./dist/dist/esm/index.js", + "limit": "9 kB", + "import": "{ Config }" + }, + { + "name": "ConfigError", + "path": "./dist/dist/esm/index.js", + "limit": "4 kB", + "import": "{ ConfigError }" + }, + { + "name": "ConfigProvider", + "path": "./dist/dist/esm/index.js", + "limit": "15 kB", + "import": "{ ConfigProvider }" + }, + { + "name": "ConfigProviderPathPatch", + "path": "./dist/dist/esm/index.js", + "limit": "1 kB", + "import": "{ ConfigProviderPathPatch }" + }, + { + "name": "ConfigSecret", + "path": "./dist/dist/esm/index.js", + "limit": "4 kB", + "import": "{ ConfigSecret }" + }, + { + "name": "Console", + "path": "./dist/dist/esm/index.js", + "limit": "34 kB", + "import": "{ Console }" + }, + { + "name": "Context", + "path": "./dist/dist/esm/index.js", + "limit": "4 kB", + "import": "{ Context }" + }, + { + "name": "Data", + "path": "./dist/dist/esm/index.js", + "limit": "11 kB", + "import": "{ Data }" + }, + { + "name": "DefaultServices", + "path": "./dist/dist/esm/index.js", + "limit": "17 kB", + "import": "{ DefaultServices }" + }, + { + "name": "Deferred", + "path": "./dist/dist/esm/index.js", + "limit": "12 kB", + "import": "{ Deferred }" + }, + { + "name": "Differ", + "path": "./dist/dist/esm/index.js", + "limit": "8 kB", + "import": "{ Differ }" + }, + { + "name": "Duration", + "path": "./dist/dist/esm/index.js", + "limit": "5 kB", + "import": "{ Duration }" + }, + { + "name": "Effect", + "path": "./dist/dist/esm/index.js", + "limit": "51 kB", + "import": "{ Effect }" + }, + { + "name": "Effectable", + "path": "./dist/dist/esm/index.js", + "limit": "3 kB", + "import": "{ Effectable }" + }, + { + "name": "Either", + "path": "./dist/dist/esm/index.js", + "limit": "4 kB", + "import": "{ Either }" + }, + { + "name": "Encoding", + "path": "./dist/dist/esm/index.js", + "limit": "5 kB", + "import": "{ Encoding }" + }, + { + "name": "Equal", + "path": "./dist/dist/esm/index.js", + "limit": "2 kB", + "import": "{ Equal }" + }, + { + "name": "Equivalence", + "path": "./dist/dist/esm/index.js", + "limit": "1 kB", + "import": "{ Equivalence }" + }, + { + "name": "ExecutionStrategy", + "path": "./dist/dist/esm/index.js", + "limit": "1 kB", + "import": "{ ExecutionStrategy }" + }, + { + "name": "Exit", + "path": "./dist/dist/esm/index.js", + "limit": "10 kB", + "import": "{ Exit }" + }, + { + "name": "Fiber", + "path": "./dist/dist/esm/index.js", + "limit": "37 kB", + "import": "{ Fiber }" + }, + { + "name": "FiberId", + "path": "./dist/dist/esm/index.js", + "limit": "7 kB", + "import": "{ FiberId }" + }, + { + "name": "FiberRef", + "path": "./dist/dist/esm/index.js", + "limit": "36 kB", + "import": "{ FiberRef }" + }, + { + "name": "FiberRefs", + "path": "./dist/dist/esm/index.js", + "limit": "8 kB", + "import": "{ FiberRefs }" + }, + { + "name": "FiberRefsPatch", + "path": "./dist/dist/esm/index.js", + "limit": "4 kB", + "import": "{ FiberRefsPatch }" + }, + { + "name": "FiberStatus", + "path": "./dist/dist/esm/index.js", + "limit": "3 kB", + "import": "{ FiberStatus }" + }, + { + "name": "Function", + "path": "./dist/dist/esm/index.js", + "limit": "1 kB", + "import": "{ Function }" + }, + { + "name": "GlobalValue", + "path": "./dist/dist/esm/index.js", + "limit": "1 kB", + "import": "{ GlobalValue }" + }, + { + "name": "GroupBy", + "path": "./dist/dist/esm/index.js", + "limit": "49 kB", + "import": "{ GroupBy }" + }, + { + "name": "HKT", + "path": "./dist/dist/esm/index.js", + "limit": "1 kB", + "import": "{ HKT }" + }, + { + "name": "Hash", + "path": "./dist/dist/esm/index.js", + "limit": "2 kB", + "import": "{ Hash }" + }, + { + "name": "HashMap", + "path": "./dist/dist/esm/index.js", + "limit": "6 kB", + "import": "{ HashMap }" + }, + { + "name": "HashSet", + "path": "./dist/dist/esm/index.js", + "limit": "6 kB", + "import": "{ HashSet }" + }, + { + "name": "Inspectable", + "path": "./dist/dist/esm/index.js", + "limit": "1 kB", + "import": "{ Inspectable }" + }, + { + "name": "KeyedPool", + "path": "./dist/dist/esm/index.js", + "limit": "40 kB", + "import": "{ KeyedPool }" + }, + { + "name": "Layer", + "path": "./dist/dist/esm/index.js", + "limit": "42 kB", + "import": "{ Layer }" + }, + { + "name": "List", + "path": "./dist/dist/esm/index.js", + "limit": "6 kB", + "import": "{ List }" + }, + { + "name": "LogLevel", + "path": "./dist/dist/esm/index.js", + "limit": "11 kB", + "import": "{ LogLevel }" + }, + { + "name": "LogSpan", + "path": "./dist/dist/esm/index.js", + "limit": "1 kB", + "import": "{ LogSpan }" + }, + { + "name": "Logger", + "path": "./dist/dist/esm/index.js", + "limit": "40 kB", + "import": "{ Logger }" + }, + { + "name": "Match", + "path": "./dist/dist/esm/index.js", + "limit": "5 kB", + "import": "{ Match }" + }, + { + "name": "MergeDecision", + "path": "./dist/dist/esm/index.js", + "limit": "1 kB", + "import": "{ MergeDecision }" + }, + { + "name": "MergeState", + "path": "./dist/dist/esm/index.js", + "limit": "1 kB", + "import": "{ MergeState }" + }, + { + "name": "MergeStrategy", + "path": "./dist/dist/esm/index.js", + "limit": "1 kB", + "import": "{ MergeStrategy }" + }, + { + "name": "Metric", + "path": "./dist/dist/esm/index.js", + "limit": "34 kB", + "import": "{ Metric }" + }, + { + "name": "MetricBoundaries", + "path": "./dist/dist/esm/index.js", + "limit": "4 kB", + "import": "{ MetricBoundaries }" + }, + { + "name": "MetricHook", + "path": "./dist/dist/esm/index.js", + "limit": "9 kB", + "import": "{ MetricHook }" + }, + { + "name": "MetricKey", + "path": "./dist/dist/esm/index.js", + "limit": "7 kB", + "import": "{ MetricKey }" + }, + { + "name": "MetricKeyType", + "path": "./dist/dist/esm/index.js", + "limit": "4 kB", + "import": "{ MetricKeyType }" + }, + { + "name": "MetricLabel", + "path": "./dist/dist/esm/index.js", + "limit": "3 kB", + "import": "{ MetricLabel }" + }, + { + "name": "MetricPair", + "path": "./dist/dist/esm/index.js", + "limit": "1 kB", + "import": "{ MetricPair }" + }, + { + "name": "MetricPolling", + "path": "./dist/dist/esm/index.js", + "limit": "34 kB", + "import": "{ MetricPolling }" + }, + { + "name": "MetricRegistry", + "path": "./dist/dist/esm/index.js", + "limit": "10 kB", + "import": "{ MetricRegistry }" + }, + { + "name": "MetricState", + "path": "./dist/dist/esm/index.js", + "limit": "3 kB", + "import": "{ MetricState }" + }, + { + "name": "MutableHashMap", + "path": "./dist/dist/esm/index.js", + "limit": "6 kB", + "import": "{ MutableHashMap }" + }, + { + "name": "MutableHashSet", + "path": "./dist/dist/esm/index.js", + "limit": "6 kB", + "import": "{ MutableHashSet }" + }, + { + "name": "MutableList", + "path": "./dist/dist/esm/index.js", + "limit": "2 kB", + "import": "{ MutableList }" + }, + { + "name": "MutableQueue", + "path": "./dist/dist/esm/index.js", + "limit": "4 kB", + "import": "{ MutableQueue }" + }, + { + "name": "MutableRef", + "path": "./dist/dist/esm/index.js", + "limit": "3 kB", + "import": "{ MutableRef }" + }, + { + "name": "NonEmptyIterable", + "path": "./dist/dist/esm/index.js", + "limit": "1 kB", + "import": "{ NonEmptyIterable }" + }, + { + "name": "Number", + "path": "./dist/dist/esm/index.js", + "limit": "4 kB", + "import": "{ Number }" + }, + { + "name": "Option", + "path": "./dist/dist/esm/index.js", + "limit": "5 kB", + "import": "{ Option }" + }, + { + "name": "Order", + "path": "./dist/dist/esm/index.js", + "limit": "2 kB", + "import": "{ Order }" + }, + { + "name": "Ordering", + "path": "./dist/dist/esm/index.js", + "limit": "1 kB", + "import": "{ Ordering }" + }, + { + "name": "Pipeable", + "path": "./dist/dist/esm/index.js", + "limit": "1 kB", + "import": "{ Pipeable }" + }, + { + "name": "Pool", + "path": "./dist/dist/esm/index.js", + "limit": "39 kB", + "import": "{ Pool }" + }, + { + "name": "Predicate", + "path": "./dist/dist/esm/index.js", + "limit": "2 kB", + "import": "{ Predicate }" + }, + { + "name": "PubSub", + "path": "./dist/dist/esm/index.js", + "limit": "40 kB", + "import": "{ PubSub }" + }, + { + "name": "Queue", + "path": "./dist/dist/esm/index.js", + "limit": "36 kB", + "import": "{ Queue }" + }, + { + "name": "Random", + "path": "./dist/dist/esm/index.js", + "limit": "17 kB", + "import": "{ Random }" + }, + { + "name": "ReadonlyArray", + "path": "./dist/dist/esm/index.js", + "limit": "7 kB", + "import": "{ ReadonlyArray }" + }, + { + "name": "ReadonlyRecord", + "path": "./dist/dist/esm/index.js", + "limit": "4 kB", + "import": "{ ReadonlyRecord }" + }, + { + "name": "RedBlackTree", + "path": "./dist/dist/esm/index.js", + "limit": "8 kB", + "import": "{ RedBlackTree }" + }, + { + "name": "Ref", + "path": "./dist/dist/esm/index.js", + "limit": "5 kB", + "import": "{ Ref }" + }, + { + "name": "Reloadable", + "path": "./dist/dist/esm/index.js", + "limit": "38 kB", + "import": "{ Reloadable }" + }, + { + "name": "Request", + "path": "./dist/dist/esm/index.js", + "limit": "37 kB", + "import": "{ Request }" + }, + { + "name": "RequestBlock", + "path": "./dist/dist/esm/index.js", + "limit": "12 kB", + "import": "{ RequestBlock }" + }, + { + "name": "RequestResolver", + "path": "./dist/dist/esm/index.js", + "limit": "36 kB", + "import": "{ RequestResolver }" + }, + { + "name": "Resource", + "path": "./dist/dist/esm/index.js", + "limit": "36 kB", + "import": "{ Resource }" + }, + { + "name": "Runtime", + "path": "./dist/dist/esm/index.js", + "limit": "34 kB", + "import": "{ Runtime }" + }, + { + "name": "RuntimeFlags", + "path": "./dist/dist/esm/index.js", + "limit": "34 kB", + "import": "{ RuntimeFlags }" + }, + { + "name": "RuntimeFlagsPatch", + "path": "./dist/dist/esm/index.js", + "limit": "1 kB", + "import": "{ RuntimeFlagsPatch }" + }, + { + "name": "STM", + "path": "./dist/dist/esm/index.js", + "limit": "18 kB", + "import": "{ STM }" + }, + { + "name": "Schedule", + "path": "./dist/dist/esm/index.js", + "limit": "23 kB", + "import": "{ Schedule }" + }, + { + "name": "ScheduleDecision", + "path": "./dist/dist/esm/index.js", + "limit": "3 kB", + "import": "{ ScheduleDecision }" + }, + { + "name": "ScheduleInterval", + "path": "./dist/dist/esm/index.js", + "limit": "4 kB", + "import": "{ ScheduleInterval }" + }, + { + "name": "ScheduleIntervals", + "path": "./dist/dist/esm/index.js", + "limit": "5 kB", + "import": "{ ScheduleIntervals }" + }, + { + "name": "Scheduler", + "path": "./dist/dist/esm/index.js", + "limit": "11 kB", + "import": "{ Scheduler }" + }, + { + "name": "Scope", + "path": "./dist/dist/esm/index.js", + "limit": "34 kB", + "import": "{ Scope }" + }, + { + "name": "ScopedCache", + "path": "./dist/dist/esm/index.js", + "limit": "38 kB", + "import": "{ ScopedCache }" + }, + { + "name": "ScopedRef", + "path": "./dist/dist/esm/index.js", + "limit": "35 kB", + "import": "{ ScopedRef }" + }, + { + "name": "SingleProducerAsyncInput", + "path": "./dist/dist/esm/index.js", + "limit": "35 kB", + "import": "{ SingleProducerAsyncInput }" + }, + { + "name": "Sink", + "path": "./dist/dist/esm/index.js", + "limit": "53 kB", + "import": "{ Sink }" + }, + { + "name": "SortedMap", + "path": "./dist/dist/esm/index.js", + "limit": "6 kB", + "import": "{ SortedMap }" + }, + { + "name": "SortedSet", + "path": "./dist/dist/esm/index.js", + "limit": "6 kB", + "import": "{ SortedSet }" + }, + { + "name": "Stream", + "path": "./dist/dist/esm/index.js", + "limit": "72 kB", + "import": "{ Stream }" + }, + { + "name": "StreamEmit", + "path": "./dist/dist/esm/index.js", + "limit": "1 kB", + "import": "{ StreamEmit }" + }, + { + "name": "StreamHaltStrategy", + "path": "./dist/dist/esm/index.js", + "limit": "1 kB", + "import": "{ StreamHaltStrategy }" + }, + { + "name": "Streamable", + "path": "./dist/dist/esm/index.js", + "limit": "12 kB", + "import": "{ Streamable }" + }, + { + "name": "String", + "path": "./dist/dist/esm/index.js", + "limit": "4 kB", + "import": "{ String }" + }, + { + "name": "Struct", + "path": "./dist/dist/esm/index.js", + "limit": "1 kB", + "import": "{ Struct }" + }, + { + "name": "SubscriptionRef", + "path": "./dist/dist/esm/index.js", + "limit": "50 kB", + "import": "{ SubscriptionRef }" + }, + { + "name": "Supervisor", + "path": "./dist/dist/esm/index.js", + "limit": "34 kB", + "import": "{ Supervisor }" + }, + { + "name": "Symbol", + "path": "./dist/dist/esm/index.js", + "limit": "1 kB", + "import": "{ Symbol }" + }, + { + "name": "SynchronizedRef", + "path": "./dist/dist/esm/index.js", + "limit": "34 kB", + "import": "{ SynchronizedRef }" + }, + { + "name": "TArray", + "path": "./dist/dist/esm/index.js", + "limit": "16 kB", + "import": "{ TArray }" + }, + { + "name": "TDeferred", + "path": "./dist/dist/esm/index.js", + "limit": "15 kB", + "import": "{ TDeferred }" + }, + { + "name": "TMap", + "path": "./dist/dist/esm/index.js", + "limit": "17 kB", + "import": "{ TMap }" + }, + { + "name": "TPriorityQueue", + "path": "./dist/dist/esm/index.js", + "limit": "18 kB", + "import": "{ TPriorityQueue }" + }, + { + "name": "TPubSub", + "path": "./dist/dist/esm/index.js", + "limit": "38 kB", + "import": "{ TPubSub }" + }, + { + "name": "TQueue", + "path": "./dist/dist/esm/index.js", + "limit": "16 kB", + "import": "{ TQueue }" + }, + { + "name": "TRandom", + "path": "./dist/dist/esm/index.js", + "limit": "15 kB", + "import": "{ TRandom }" + }, + { + "name": "TReentrantLock", + "path": "./dist/dist/esm/index.js", + "limit": "38 kB", + "import": "{ TReentrantLock }" + }, + { + "name": "TRef", + "path": "./dist/dist/esm/index.js", + "limit": "15 kB", + "import": "{ TRef }" + }, + { + "name": "TSemaphore", + "path": "./dist/dist/esm/index.js", + "limit": "38 kB", + "import": "{ TSemaphore }" + }, + { + "name": "TSet", + "path": "./dist/dist/esm/index.js", + "limit": "17 kB", + "import": "{ TSet }" + }, + { + "name": "Take", + "path": "./dist/dist/esm/index.js", + "limit": "10 kB", + "import": "{ Take }" + }, + { + "name": "TestAnnotation", + "path": "./dist/dist/esm/index.js", + "limit": "7 kB", + "import": "{ TestAnnotation }" + }, + { + "name": "TestAnnotationMap", + "path": "./dist/dist/esm/index.js", + "limit": "1 kB", + "import": "{ TestAnnotationMap }" + }, + { + "name": "TestAnnotations", + "path": "./dist/dist/esm/index.js", + "limit": "13 kB", + "import": "{ TestAnnotations }" + }, + { + "name": "TestClock", + "path": "./dist/dist/esm/index.js", + "limit": "38 kB", + "import": "{ TestClock }" + }, + { + "name": "TestConfig", + "path": "./dist/dist/esm/index.js", + "limit": "3 kB", + "import": "{ TestConfig }" + }, + { + "name": "TestContext", + "path": "./dist/dist/esm/index.js", + "limit": "39 kB", + "import": "{ TestContext }" + }, + { + "name": "TestLive", + "path": "./dist/dist/esm/index.js", + "limit": "17 kB", + "import": "{ TestLive }" + }, + { + "name": "TestServices", + "path": "./dist/dist/esm/index.js", + "limit": "35 kB", + "import": "{ TestServices }" + }, + { + "name": "TestSized", + "path": "./dist/dist/esm/index.js", + "limit": "11 kB", + "import": "{ TestSized }" + }, + { + "name": "Tracer", + "path": "./dist/dist/esm/index.js", + "limit": "17 kB", + "import": "{ Tracer }" + }, + { + "name": "Tuple", + "path": "./dist/dist/esm/index.js", + "limit": "1 kB", + "import": "{ Tuple }" + }, + { + "name": "Types", + "path": "./dist/dist/esm/index.js", + "limit": "1 kB", + "import": "{ Types }" + }, + { + "name": "Unify", + "path": "./dist/dist/esm/index.js", + "limit": "1 kB", + "import": "{ Unify }" + }, + { + "name": "UpstreamPullRequest", + "path": "./dist/dist/esm/index.js", + "limit": "1 kB", + "import": "{ UpstreamPullRequest }" + }, + { + "name": "UpstreamPullStrategy", + "path": "./dist/dist/esm/index.js", + "limit": "1 kB", + "import": "{ UpstreamPullStrategy }" + }, + { + "name": "Utils", + "path": "./dist/dist/esm/index.js", + "limit": "2 kB", + "import": "{ Utils }" + } + ] +} diff --git a/src/.index.ts b/packages/effect/src/.index.ts similarity index 100% rename from src/.index.ts rename to packages/effect/src/.index.ts diff --git a/src/BigDecimal.ts b/packages/effect/src/BigDecimal.ts similarity index 100% rename from src/BigDecimal.ts rename to packages/effect/src/BigDecimal.ts diff --git a/src/BigInt.ts b/packages/effect/src/BigInt.ts similarity index 100% rename from src/BigInt.ts rename to packages/effect/src/BigInt.ts diff --git a/src/Boolean.ts b/packages/effect/src/Boolean.ts similarity index 100% rename from src/Boolean.ts rename to packages/effect/src/Boolean.ts diff --git a/src/Brand.ts b/packages/effect/src/Brand.ts similarity index 100% rename from src/Brand.ts rename to packages/effect/src/Brand.ts diff --git a/src/Cache.ts b/packages/effect/src/Cache.ts similarity index 100% rename from src/Cache.ts rename to packages/effect/src/Cache.ts diff --git a/src/Cause.ts b/packages/effect/src/Cause.ts similarity index 100% rename from src/Cause.ts rename to packages/effect/src/Cause.ts diff --git a/src/Channel.ts b/packages/effect/src/Channel.ts similarity index 100% rename from src/Channel.ts rename to packages/effect/src/Channel.ts diff --git a/src/ChildExecutorDecision.ts b/packages/effect/src/ChildExecutorDecision.ts similarity index 100% rename from src/ChildExecutorDecision.ts rename to packages/effect/src/ChildExecutorDecision.ts diff --git a/src/Chunk.ts b/packages/effect/src/Chunk.ts similarity index 100% rename from src/Chunk.ts rename to packages/effect/src/Chunk.ts diff --git a/src/Clock.ts b/packages/effect/src/Clock.ts similarity index 100% rename from src/Clock.ts rename to packages/effect/src/Clock.ts diff --git a/src/Config.ts b/packages/effect/src/Config.ts similarity index 100% rename from src/Config.ts rename to packages/effect/src/Config.ts diff --git a/src/ConfigError.ts b/packages/effect/src/ConfigError.ts similarity index 100% rename from src/ConfigError.ts rename to packages/effect/src/ConfigError.ts diff --git a/src/ConfigProvider.ts b/packages/effect/src/ConfigProvider.ts similarity index 100% rename from src/ConfigProvider.ts rename to packages/effect/src/ConfigProvider.ts diff --git a/src/ConfigProviderPathPatch.ts b/packages/effect/src/ConfigProviderPathPatch.ts similarity index 100% rename from src/ConfigProviderPathPatch.ts rename to packages/effect/src/ConfigProviderPathPatch.ts diff --git a/src/ConfigSecret.ts b/packages/effect/src/ConfigSecret.ts similarity index 100% rename from src/ConfigSecret.ts rename to packages/effect/src/ConfigSecret.ts diff --git a/src/Console.ts b/packages/effect/src/Console.ts similarity index 100% rename from src/Console.ts rename to packages/effect/src/Console.ts diff --git a/src/Context.ts b/packages/effect/src/Context.ts similarity index 100% rename from src/Context.ts rename to packages/effect/src/Context.ts diff --git a/src/Data.ts b/packages/effect/src/Data.ts similarity index 100% rename from src/Data.ts rename to packages/effect/src/Data.ts diff --git a/src/DefaultServices.ts b/packages/effect/src/DefaultServices.ts similarity index 100% rename from src/DefaultServices.ts rename to packages/effect/src/DefaultServices.ts diff --git a/src/Deferred.ts b/packages/effect/src/Deferred.ts similarity index 100% rename from src/Deferred.ts rename to packages/effect/src/Deferred.ts diff --git a/src/Differ.ts b/packages/effect/src/Differ.ts similarity index 100% rename from src/Differ.ts rename to packages/effect/src/Differ.ts diff --git a/src/Duration.ts b/packages/effect/src/Duration.ts similarity index 100% rename from src/Duration.ts rename to packages/effect/src/Duration.ts diff --git a/src/Effect.ts b/packages/effect/src/Effect.ts similarity index 100% rename from src/Effect.ts rename to packages/effect/src/Effect.ts diff --git a/src/Effectable.ts b/packages/effect/src/Effectable.ts similarity index 100% rename from src/Effectable.ts rename to packages/effect/src/Effectable.ts diff --git a/src/Either.ts b/packages/effect/src/Either.ts similarity index 100% rename from src/Either.ts rename to packages/effect/src/Either.ts diff --git a/src/Encoding.ts b/packages/effect/src/Encoding.ts similarity index 100% rename from src/Encoding.ts rename to packages/effect/src/Encoding.ts diff --git a/src/Equal.ts b/packages/effect/src/Equal.ts similarity index 100% rename from src/Equal.ts rename to packages/effect/src/Equal.ts diff --git a/src/Equivalence.ts b/packages/effect/src/Equivalence.ts similarity index 100% rename from src/Equivalence.ts rename to packages/effect/src/Equivalence.ts diff --git a/src/ExecutionStrategy.ts b/packages/effect/src/ExecutionStrategy.ts similarity index 100% rename from src/ExecutionStrategy.ts rename to packages/effect/src/ExecutionStrategy.ts diff --git a/src/Exit.ts b/packages/effect/src/Exit.ts similarity index 100% rename from src/Exit.ts rename to packages/effect/src/Exit.ts diff --git a/src/Fiber.ts b/packages/effect/src/Fiber.ts similarity index 100% rename from src/Fiber.ts rename to packages/effect/src/Fiber.ts diff --git a/src/FiberId.ts b/packages/effect/src/FiberId.ts similarity index 100% rename from src/FiberId.ts rename to packages/effect/src/FiberId.ts diff --git a/src/FiberRef.ts b/packages/effect/src/FiberRef.ts similarity index 100% rename from src/FiberRef.ts rename to packages/effect/src/FiberRef.ts diff --git a/src/FiberRefs.ts b/packages/effect/src/FiberRefs.ts similarity index 100% rename from src/FiberRefs.ts rename to packages/effect/src/FiberRefs.ts diff --git a/src/FiberRefsPatch.ts b/packages/effect/src/FiberRefsPatch.ts similarity index 100% rename from src/FiberRefsPatch.ts rename to packages/effect/src/FiberRefsPatch.ts diff --git a/src/FiberStatus.ts b/packages/effect/src/FiberStatus.ts similarity index 100% rename from src/FiberStatus.ts rename to packages/effect/src/FiberStatus.ts diff --git a/src/Function.ts b/packages/effect/src/Function.ts similarity index 100% rename from src/Function.ts rename to packages/effect/src/Function.ts diff --git a/src/GlobalValue.ts b/packages/effect/src/GlobalValue.ts similarity index 100% rename from src/GlobalValue.ts rename to packages/effect/src/GlobalValue.ts diff --git a/src/GroupBy.ts b/packages/effect/src/GroupBy.ts similarity index 100% rename from src/GroupBy.ts rename to packages/effect/src/GroupBy.ts diff --git a/src/HKT.ts b/packages/effect/src/HKT.ts similarity index 100% rename from src/HKT.ts rename to packages/effect/src/HKT.ts diff --git a/src/Hash.ts b/packages/effect/src/Hash.ts similarity index 100% rename from src/Hash.ts rename to packages/effect/src/Hash.ts diff --git a/src/HashMap.ts b/packages/effect/src/HashMap.ts similarity index 100% rename from src/HashMap.ts rename to packages/effect/src/HashMap.ts diff --git a/src/HashSet.ts b/packages/effect/src/HashSet.ts similarity index 100% rename from src/HashSet.ts rename to packages/effect/src/HashSet.ts diff --git a/src/Inspectable.ts b/packages/effect/src/Inspectable.ts similarity index 100% rename from src/Inspectable.ts rename to packages/effect/src/Inspectable.ts diff --git a/src/KeyedPool.ts b/packages/effect/src/KeyedPool.ts similarity index 100% rename from src/KeyedPool.ts rename to packages/effect/src/KeyedPool.ts diff --git a/src/Layer.ts b/packages/effect/src/Layer.ts similarity index 100% rename from src/Layer.ts rename to packages/effect/src/Layer.ts diff --git a/src/List.ts b/packages/effect/src/List.ts similarity index 100% rename from src/List.ts rename to packages/effect/src/List.ts diff --git a/src/LogLevel.ts b/packages/effect/src/LogLevel.ts similarity index 100% rename from src/LogLevel.ts rename to packages/effect/src/LogLevel.ts diff --git a/src/LogSpan.ts b/packages/effect/src/LogSpan.ts similarity index 100% rename from src/LogSpan.ts rename to packages/effect/src/LogSpan.ts diff --git a/src/Logger.ts b/packages/effect/src/Logger.ts similarity index 100% rename from src/Logger.ts rename to packages/effect/src/Logger.ts diff --git a/src/Match.ts b/packages/effect/src/Match.ts similarity index 100% rename from src/Match.ts rename to packages/effect/src/Match.ts diff --git a/src/MergeDecision.ts b/packages/effect/src/MergeDecision.ts similarity index 100% rename from src/MergeDecision.ts rename to packages/effect/src/MergeDecision.ts diff --git a/src/MergeState.ts b/packages/effect/src/MergeState.ts similarity index 100% rename from src/MergeState.ts rename to packages/effect/src/MergeState.ts diff --git a/src/MergeStrategy.ts b/packages/effect/src/MergeStrategy.ts similarity index 100% rename from src/MergeStrategy.ts rename to packages/effect/src/MergeStrategy.ts diff --git a/src/Metric.ts b/packages/effect/src/Metric.ts similarity index 100% rename from src/Metric.ts rename to packages/effect/src/Metric.ts diff --git a/src/MetricBoundaries.ts b/packages/effect/src/MetricBoundaries.ts similarity index 100% rename from src/MetricBoundaries.ts rename to packages/effect/src/MetricBoundaries.ts diff --git a/src/MetricHook.ts b/packages/effect/src/MetricHook.ts similarity index 100% rename from src/MetricHook.ts rename to packages/effect/src/MetricHook.ts diff --git a/src/MetricKey.ts b/packages/effect/src/MetricKey.ts similarity index 100% rename from src/MetricKey.ts rename to packages/effect/src/MetricKey.ts diff --git a/src/MetricKeyType.ts b/packages/effect/src/MetricKeyType.ts similarity index 100% rename from src/MetricKeyType.ts rename to packages/effect/src/MetricKeyType.ts diff --git a/src/MetricLabel.ts b/packages/effect/src/MetricLabel.ts similarity index 100% rename from src/MetricLabel.ts rename to packages/effect/src/MetricLabel.ts diff --git a/src/MetricPair.ts b/packages/effect/src/MetricPair.ts similarity index 100% rename from src/MetricPair.ts rename to packages/effect/src/MetricPair.ts diff --git a/src/MetricPolling.ts b/packages/effect/src/MetricPolling.ts similarity index 100% rename from src/MetricPolling.ts rename to packages/effect/src/MetricPolling.ts diff --git a/src/MetricRegistry.ts b/packages/effect/src/MetricRegistry.ts similarity index 100% rename from src/MetricRegistry.ts rename to packages/effect/src/MetricRegistry.ts diff --git a/src/MetricState.ts b/packages/effect/src/MetricState.ts similarity index 100% rename from src/MetricState.ts rename to packages/effect/src/MetricState.ts diff --git a/src/MutableHashMap.ts b/packages/effect/src/MutableHashMap.ts similarity index 100% rename from src/MutableHashMap.ts rename to packages/effect/src/MutableHashMap.ts diff --git a/src/MutableHashSet.ts b/packages/effect/src/MutableHashSet.ts similarity index 100% rename from src/MutableHashSet.ts rename to packages/effect/src/MutableHashSet.ts diff --git a/src/MutableList.ts b/packages/effect/src/MutableList.ts similarity index 100% rename from src/MutableList.ts rename to packages/effect/src/MutableList.ts diff --git a/src/MutableQueue.ts b/packages/effect/src/MutableQueue.ts similarity index 100% rename from src/MutableQueue.ts rename to packages/effect/src/MutableQueue.ts diff --git a/src/MutableRef.ts b/packages/effect/src/MutableRef.ts similarity index 100% rename from src/MutableRef.ts rename to packages/effect/src/MutableRef.ts diff --git a/src/NonEmptyIterable.ts b/packages/effect/src/NonEmptyIterable.ts similarity index 100% rename from src/NonEmptyIterable.ts rename to packages/effect/src/NonEmptyIterable.ts diff --git a/src/Number.ts b/packages/effect/src/Number.ts similarity index 100% rename from src/Number.ts rename to packages/effect/src/Number.ts diff --git a/src/Option.ts b/packages/effect/src/Option.ts similarity index 100% rename from src/Option.ts rename to packages/effect/src/Option.ts diff --git a/src/Order.ts b/packages/effect/src/Order.ts similarity index 100% rename from src/Order.ts rename to packages/effect/src/Order.ts diff --git a/src/Ordering.ts b/packages/effect/src/Ordering.ts similarity index 100% rename from src/Ordering.ts rename to packages/effect/src/Ordering.ts diff --git a/src/Pipeable.ts b/packages/effect/src/Pipeable.ts similarity index 100% rename from src/Pipeable.ts rename to packages/effect/src/Pipeable.ts diff --git a/src/Pool.ts b/packages/effect/src/Pool.ts similarity index 100% rename from src/Pool.ts rename to packages/effect/src/Pool.ts diff --git a/src/Predicate.ts b/packages/effect/src/Predicate.ts similarity index 100% rename from src/Predicate.ts rename to packages/effect/src/Predicate.ts diff --git a/src/PubSub.ts b/packages/effect/src/PubSub.ts similarity index 100% rename from src/PubSub.ts rename to packages/effect/src/PubSub.ts diff --git a/src/Queue.ts b/packages/effect/src/Queue.ts similarity index 100% rename from src/Queue.ts rename to packages/effect/src/Queue.ts diff --git a/src/Random.ts b/packages/effect/src/Random.ts similarity index 100% rename from src/Random.ts rename to packages/effect/src/Random.ts diff --git a/src/ReadonlyArray.ts b/packages/effect/src/ReadonlyArray.ts similarity index 100% rename from src/ReadonlyArray.ts rename to packages/effect/src/ReadonlyArray.ts diff --git a/src/ReadonlyRecord.ts b/packages/effect/src/ReadonlyRecord.ts similarity index 100% rename from src/ReadonlyRecord.ts rename to packages/effect/src/ReadonlyRecord.ts diff --git a/src/RedBlackTree.ts b/packages/effect/src/RedBlackTree.ts similarity index 100% rename from src/RedBlackTree.ts rename to packages/effect/src/RedBlackTree.ts diff --git a/src/Ref.ts b/packages/effect/src/Ref.ts similarity index 100% rename from src/Ref.ts rename to packages/effect/src/Ref.ts diff --git a/src/Reloadable.ts b/packages/effect/src/Reloadable.ts similarity index 100% rename from src/Reloadable.ts rename to packages/effect/src/Reloadable.ts diff --git a/src/Request.ts b/packages/effect/src/Request.ts similarity index 100% rename from src/Request.ts rename to packages/effect/src/Request.ts diff --git a/src/RequestBlock.ts b/packages/effect/src/RequestBlock.ts similarity index 100% rename from src/RequestBlock.ts rename to packages/effect/src/RequestBlock.ts diff --git a/src/RequestResolver.ts b/packages/effect/src/RequestResolver.ts similarity index 100% rename from src/RequestResolver.ts rename to packages/effect/src/RequestResolver.ts diff --git a/src/Resource.ts b/packages/effect/src/Resource.ts similarity index 100% rename from src/Resource.ts rename to packages/effect/src/Resource.ts diff --git a/src/Runtime.ts b/packages/effect/src/Runtime.ts similarity index 100% rename from src/Runtime.ts rename to packages/effect/src/Runtime.ts diff --git a/src/RuntimeFlags.ts b/packages/effect/src/RuntimeFlags.ts similarity index 100% rename from src/RuntimeFlags.ts rename to packages/effect/src/RuntimeFlags.ts diff --git a/src/RuntimeFlagsPatch.ts b/packages/effect/src/RuntimeFlagsPatch.ts similarity index 100% rename from src/RuntimeFlagsPatch.ts rename to packages/effect/src/RuntimeFlagsPatch.ts diff --git a/src/STM.ts b/packages/effect/src/STM.ts similarity index 100% rename from src/STM.ts rename to packages/effect/src/STM.ts diff --git a/src/Schedule.ts b/packages/effect/src/Schedule.ts similarity index 100% rename from src/Schedule.ts rename to packages/effect/src/Schedule.ts diff --git a/src/ScheduleDecision.ts b/packages/effect/src/ScheduleDecision.ts similarity index 100% rename from src/ScheduleDecision.ts rename to packages/effect/src/ScheduleDecision.ts diff --git a/src/ScheduleInterval.ts b/packages/effect/src/ScheduleInterval.ts similarity index 100% rename from src/ScheduleInterval.ts rename to packages/effect/src/ScheduleInterval.ts diff --git a/src/ScheduleIntervals.ts b/packages/effect/src/ScheduleIntervals.ts similarity index 100% rename from src/ScheduleIntervals.ts rename to packages/effect/src/ScheduleIntervals.ts diff --git a/src/Scheduler.ts b/packages/effect/src/Scheduler.ts similarity index 100% rename from src/Scheduler.ts rename to packages/effect/src/Scheduler.ts diff --git a/src/Scope.ts b/packages/effect/src/Scope.ts similarity index 100% rename from src/Scope.ts rename to packages/effect/src/Scope.ts diff --git a/src/ScopedCache.ts b/packages/effect/src/ScopedCache.ts similarity index 100% rename from src/ScopedCache.ts rename to packages/effect/src/ScopedCache.ts diff --git a/src/ScopedRef.ts b/packages/effect/src/ScopedRef.ts similarity index 100% rename from src/ScopedRef.ts rename to packages/effect/src/ScopedRef.ts diff --git a/src/SingleProducerAsyncInput.ts b/packages/effect/src/SingleProducerAsyncInput.ts similarity index 100% rename from src/SingleProducerAsyncInput.ts rename to packages/effect/src/SingleProducerAsyncInput.ts diff --git a/src/Sink.ts b/packages/effect/src/Sink.ts similarity index 100% rename from src/Sink.ts rename to packages/effect/src/Sink.ts diff --git a/src/SortedMap.ts b/packages/effect/src/SortedMap.ts similarity index 100% rename from src/SortedMap.ts rename to packages/effect/src/SortedMap.ts diff --git a/src/SortedSet.ts b/packages/effect/src/SortedSet.ts similarity index 100% rename from src/SortedSet.ts rename to packages/effect/src/SortedSet.ts diff --git a/src/Stream.ts b/packages/effect/src/Stream.ts similarity index 100% rename from src/Stream.ts rename to packages/effect/src/Stream.ts diff --git a/src/StreamEmit.ts b/packages/effect/src/StreamEmit.ts similarity index 100% rename from src/StreamEmit.ts rename to packages/effect/src/StreamEmit.ts diff --git a/src/StreamHaltStrategy.ts b/packages/effect/src/StreamHaltStrategy.ts similarity index 100% rename from src/StreamHaltStrategy.ts rename to packages/effect/src/StreamHaltStrategy.ts diff --git a/src/Streamable.ts b/packages/effect/src/Streamable.ts similarity index 100% rename from src/Streamable.ts rename to packages/effect/src/Streamable.ts diff --git a/src/String.ts b/packages/effect/src/String.ts similarity index 100% rename from src/String.ts rename to packages/effect/src/String.ts diff --git a/src/Struct.ts b/packages/effect/src/Struct.ts similarity index 100% rename from src/Struct.ts rename to packages/effect/src/Struct.ts diff --git a/src/SubscriptionRef.ts b/packages/effect/src/SubscriptionRef.ts similarity index 100% rename from src/SubscriptionRef.ts rename to packages/effect/src/SubscriptionRef.ts diff --git a/src/Supervisor.ts b/packages/effect/src/Supervisor.ts similarity index 100% rename from src/Supervisor.ts rename to packages/effect/src/Supervisor.ts diff --git a/src/Symbol.ts b/packages/effect/src/Symbol.ts similarity index 100% rename from src/Symbol.ts rename to packages/effect/src/Symbol.ts diff --git a/src/SynchronizedRef.ts b/packages/effect/src/SynchronizedRef.ts similarity index 100% rename from src/SynchronizedRef.ts rename to packages/effect/src/SynchronizedRef.ts diff --git a/src/TArray.ts b/packages/effect/src/TArray.ts similarity index 100% rename from src/TArray.ts rename to packages/effect/src/TArray.ts diff --git a/src/TDeferred.ts b/packages/effect/src/TDeferred.ts similarity index 100% rename from src/TDeferred.ts rename to packages/effect/src/TDeferred.ts diff --git a/src/TMap.ts b/packages/effect/src/TMap.ts similarity index 100% rename from src/TMap.ts rename to packages/effect/src/TMap.ts diff --git a/src/TPriorityQueue.ts b/packages/effect/src/TPriorityQueue.ts similarity index 100% rename from src/TPriorityQueue.ts rename to packages/effect/src/TPriorityQueue.ts diff --git a/src/TPubSub.ts b/packages/effect/src/TPubSub.ts similarity index 100% rename from src/TPubSub.ts rename to packages/effect/src/TPubSub.ts diff --git a/src/TQueue.ts b/packages/effect/src/TQueue.ts similarity index 100% rename from src/TQueue.ts rename to packages/effect/src/TQueue.ts diff --git a/src/TRandom.ts b/packages/effect/src/TRandom.ts similarity index 100% rename from src/TRandom.ts rename to packages/effect/src/TRandom.ts diff --git a/src/TReentrantLock.ts b/packages/effect/src/TReentrantLock.ts similarity index 100% rename from src/TReentrantLock.ts rename to packages/effect/src/TReentrantLock.ts diff --git a/src/TRef.ts b/packages/effect/src/TRef.ts similarity index 100% rename from src/TRef.ts rename to packages/effect/src/TRef.ts diff --git a/src/TSemaphore.ts b/packages/effect/src/TSemaphore.ts similarity index 100% rename from src/TSemaphore.ts rename to packages/effect/src/TSemaphore.ts diff --git a/src/TSet.ts b/packages/effect/src/TSet.ts similarity index 100% rename from src/TSet.ts rename to packages/effect/src/TSet.ts diff --git a/src/Take.ts b/packages/effect/src/Take.ts similarity index 100% rename from src/Take.ts rename to packages/effect/src/Take.ts diff --git a/src/TestAnnotation.ts b/packages/effect/src/TestAnnotation.ts similarity index 100% rename from src/TestAnnotation.ts rename to packages/effect/src/TestAnnotation.ts diff --git a/src/TestAnnotationMap.ts b/packages/effect/src/TestAnnotationMap.ts similarity index 100% rename from src/TestAnnotationMap.ts rename to packages/effect/src/TestAnnotationMap.ts diff --git a/src/TestAnnotations.ts b/packages/effect/src/TestAnnotations.ts similarity index 100% rename from src/TestAnnotations.ts rename to packages/effect/src/TestAnnotations.ts diff --git a/src/TestClock.ts b/packages/effect/src/TestClock.ts similarity index 100% rename from src/TestClock.ts rename to packages/effect/src/TestClock.ts diff --git a/src/TestConfig.ts b/packages/effect/src/TestConfig.ts similarity index 100% rename from src/TestConfig.ts rename to packages/effect/src/TestConfig.ts diff --git a/src/TestContext.ts b/packages/effect/src/TestContext.ts similarity index 100% rename from src/TestContext.ts rename to packages/effect/src/TestContext.ts diff --git a/src/TestLive.ts b/packages/effect/src/TestLive.ts similarity index 100% rename from src/TestLive.ts rename to packages/effect/src/TestLive.ts diff --git a/src/TestServices.ts b/packages/effect/src/TestServices.ts similarity index 100% rename from src/TestServices.ts rename to packages/effect/src/TestServices.ts diff --git a/src/TestSized.ts b/packages/effect/src/TestSized.ts similarity index 100% rename from src/TestSized.ts rename to packages/effect/src/TestSized.ts diff --git a/src/Tracer.ts b/packages/effect/src/Tracer.ts similarity index 100% rename from src/Tracer.ts rename to packages/effect/src/Tracer.ts diff --git a/src/Tuple.ts b/packages/effect/src/Tuple.ts similarity index 100% rename from src/Tuple.ts rename to packages/effect/src/Tuple.ts diff --git a/src/Types.ts b/packages/effect/src/Types.ts similarity index 100% rename from src/Types.ts rename to packages/effect/src/Types.ts diff --git a/src/Unify.ts b/packages/effect/src/Unify.ts similarity index 100% rename from src/Unify.ts rename to packages/effect/src/Unify.ts diff --git a/src/UpstreamPullRequest.ts b/packages/effect/src/UpstreamPullRequest.ts similarity index 100% rename from src/UpstreamPullRequest.ts rename to packages/effect/src/UpstreamPullRequest.ts diff --git a/src/UpstreamPullStrategy.ts b/packages/effect/src/UpstreamPullStrategy.ts similarity index 100% rename from src/UpstreamPullStrategy.ts rename to packages/effect/src/UpstreamPullStrategy.ts diff --git a/src/Utils.ts b/packages/effect/src/Utils.ts similarity index 100% rename from src/Utils.ts rename to packages/effect/src/Utils.ts diff --git a/src/index.ts b/packages/effect/src/index.ts similarity index 100% rename from src/index.ts rename to packages/effect/src/index.ts diff --git a/src/internal/Iterable.ts b/packages/effect/src/internal/Iterable.ts similarity index 100% rename from src/internal/Iterable.ts rename to packages/effect/src/internal/Iterable.ts diff --git a/src/internal/blockedRequests.ts b/packages/effect/src/internal/blockedRequests.ts similarity index 100% rename from src/internal/blockedRequests.ts rename to packages/effect/src/internal/blockedRequests.ts diff --git a/src/internal/cache.ts b/packages/effect/src/internal/cache.ts similarity index 100% rename from src/internal/cache.ts rename to packages/effect/src/internal/cache.ts diff --git a/src/internal/cause.ts b/packages/effect/src/internal/cause.ts similarity index 100% rename from src/internal/cause.ts rename to packages/effect/src/internal/cause.ts diff --git a/src/internal/channel.ts b/packages/effect/src/internal/channel.ts similarity index 100% rename from src/internal/channel.ts rename to packages/effect/src/internal/channel.ts diff --git a/src/internal/channel/channelExecutor.ts b/packages/effect/src/internal/channel/channelExecutor.ts similarity index 100% rename from src/internal/channel/channelExecutor.ts rename to packages/effect/src/internal/channel/channelExecutor.ts diff --git a/src/internal/channel/channelState.ts b/packages/effect/src/internal/channel/channelState.ts similarity index 100% rename from src/internal/channel/channelState.ts rename to packages/effect/src/internal/channel/channelState.ts diff --git a/src/internal/channel/childExecutorDecision.ts b/packages/effect/src/internal/channel/childExecutorDecision.ts similarity index 100% rename from src/internal/channel/childExecutorDecision.ts rename to packages/effect/src/internal/channel/childExecutorDecision.ts diff --git a/src/internal/channel/continuation.ts b/packages/effect/src/internal/channel/continuation.ts similarity index 100% rename from src/internal/channel/continuation.ts rename to packages/effect/src/internal/channel/continuation.ts diff --git a/src/internal/channel/mergeDecision.ts b/packages/effect/src/internal/channel/mergeDecision.ts similarity index 100% rename from src/internal/channel/mergeDecision.ts rename to packages/effect/src/internal/channel/mergeDecision.ts diff --git a/src/internal/channel/mergeState.ts b/packages/effect/src/internal/channel/mergeState.ts similarity index 100% rename from src/internal/channel/mergeState.ts rename to packages/effect/src/internal/channel/mergeState.ts diff --git a/src/internal/channel/mergeStrategy.ts b/packages/effect/src/internal/channel/mergeStrategy.ts similarity index 100% rename from src/internal/channel/mergeStrategy.ts rename to packages/effect/src/internal/channel/mergeStrategy.ts diff --git a/src/internal/channel/singleProducerAsyncInput.ts b/packages/effect/src/internal/channel/singleProducerAsyncInput.ts similarity index 100% rename from src/internal/channel/singleProducerAsyncInput.ts rename to packages/effect/src/internal/channel/singleProducerAsyncInput.ts diff --git a/src/internal/channel/subexecutor.ts b/packages/effect/src/internal/channel/subexecutor.ts similarity index 100% rename from src/internal/channel/subexecutor.ts rename to packages/effect/src/internal/channel/subexecutor.ts diff --git a/src/internal/channel/upstreamPullRequest.ts b/packages/effect/src/internal/channel/upstreamPullRequest.ts similarity index 100% rename from src/internal/channel/upstreamPullRequest.ts rename to packages/effect/src/internal/channel/upstreamPullRequest.ts diff --git a/src/internal/channel/upstreamPullStrategy.ts b/packages/effect/src/internal/channel/upstreamPullStrategy.ts similarity index 100% rename from src/internal/channel/upstreamPullStrategy.ts rename to packages/effect/src/internal/channel/upstreamPullStrategy.ts diff --git a/src/internal/clock.ts b/packages/effect/src/internal/clock.ts similarity index 100% rename from src/internal/clock.ts rename to packages/effect/src/internal/clock.ts diff --git a/src/internal/completedRequestMap.ts b/packages/effect/src/internal/completedRequestMap.ts similarity index 100% rename from src/internal/completedRequestMap.ts rename to packages/effect/src/internal/completedRequestMap.ts diff --git a/src/internal/concurrency.ts b/packages/effect/src/internal/concurrency.ts similarity index 100% rename from src/internal/concurrency.ts rename to packages/effect/src/internal/concurrency.ts diff --git a/src/internal/config.ts b/packages/effect/src/internal/config.ts similarity index 100% rename from src/internal/config.ts rename to packages/effect/src/internal/config.ts diff --git a/src/internal/configError.ts b/packages/effect/src/internal/configError.ts similarity index 100% rename from src/internal/configError.ts rename to packages/effect/src/internal/configError.ts diff --git a/src/internal/configProvider.ts b/packages/effect/src/internal/configProvider.ts similarity index 100% rename from src/internal/configProvider.ts rename to packages/effect/src/internal/configProvider.ts diff --git a/src/internal/configProvider/pathPatch.ts b/packages/effect/src/internal/configProvider/pathPatch.ts similarity index 100% rename from src/internal/configProvider/pathPatch.ts rename to packages/effect/src/internal/configProvider/pathPatch.ts diff --git a/src/internal/configSecret.ts b/packages/effect/src/internal/configSecret.ts similarity index 100% rename from src/internal/configSecret.ts rename to packages/effect/src/internal/configSecret.ts diff --git a/src/internal/console.ts b/packages/effect/src/internal/console.ts similarity index 100% rename from src/internal/console.ts rename to packages/effect/src/internal/console.ts diff --git a/src/internal/context.ts b/packages/effect/src/internal/context.ts similarity index 100% rename from src/internal/context.ts rename to packages/effect/src/internal/context.ts diff --git a/src/internal/core-effect.ts b/packages/effect/src/internal/core-effect.ts similarity index 100% rename from src/internal/core-effect.ts rename to packages/effect/src/internal/core-effect.ts diff --git a/src/internal/core-stream.ts b/packages/effect/src/internal/core-stream.ts similarity index 100% rename from src/internal/core-stream.ts rename to packages/effect/src/internal/core-stream.ts diff --git a/src/internal/core.ts b/packages/effect/src/internal/core.ts similarity index 100% rename from src/internal/core.ts rename to packages/effect/src/internal/core.ts diff --git a/src/internal/data.ts b/packages/effect/src/internal/data.ts similarity index 100% rename from src/internal/data.ts rename to packages/effect/src/internal/data.ts diff --git a/src/internal/dataSource.ts b/packages/effect/src/internal/dataSource.ts similarity index 100% rename from src/internal/dataSource.ts rename to packages/effect/src/internal/dataSource.ts diff --git a/src/internal/defaultServices.ts b/packages/effect/src/internal/defaultServices.ts similarity index 100% rename from src/internal/defaultServices.ts rename to packages/effect/src/internal/defaultServices.ts diff --git a/src/internal/defaultServices/console.ts b/packages/effect/src/internal/defaultServices/console.ts similarity index 100% rename from src/internal/defaultServices/console.ts rename to packages/effect/src/internal/defaultServices/console.ts diff --git a/src/internal/deferred.ts b/packages/effect/src/internal/deferred.ts similarity index 100% rename from src/internal/deferred.ts rename to packages/effect/src/internal/deferred.ts diff --git a/src/internal/differ.ts b/packages/effect/src/internal/differ.ts similarity index 100% rename from src/internal/differ.ts rename to packages/effect/src/internal/differ.ts diff --git a/src/internal/differ/chunkPatch.ts b/packages/effect/src/internal/differ/chunkPatch.ts similarity index 100% rename from src/internal/differ/chunkPatch.ts rename to packages/effect/src/internal/differ/chunkPatch.ts diff --git a/src/internal/differ/contextPatch.ts b/packages/effect/src/internal/differ/contextPatch.ts similarity index 100% rename from src/internal/differ/contextPatch.ts rename to packages/effect/src/internal/differ/contextPatch.ts diff --git a/src/internal/differ/hashMapPatch.ts b/packages/effect/src/internal/differ/hashMapPatch.ts similarity index 100% rename from src/internal/differ/hashMapPatch.ts rename to packages/effect/src/internal/differ/hashMapPatch.ts diff --git a/src/internal/differ/hashSetPatch.ts b/packages/effect/src/internal/differ/hashSetPatch.ts similarity index 100% rename from src/internal/differ/hashSetPatch.ts rename to packages/effect/src/internal/differ/hashSetPatch.ts diff --git a/src/internal/differ/orPatch.ts b/packages/effect/src/internal/differ/orPatch.ts similarity index 100% rename from src/internal/differ/orPatch.ts rename to packages/effect/src/internal/differ/orPatch.ts diff --git a/src/internal/effect/circular.ts b/packages/effect/src/internal/effect/circular.ts similarity index 100% rename from src/internal/effect/circular.ts rename to packages/effect/src/internal/effect/circular.ts diff --git a/src/internal/effectable.ts b/packages/effect/src/internal/effectable.ts similarity index 100% rename from src/internal/effectable.ts rename to packages/effect/src/internal/effectable.ts diff --git a/src/internal/either.ts b/packages/effect/src/internal/either.ts similarity index 100% rename from src/internal/either.ts rename to packages/effect/src/internal/either.ts diff --git a/src/internal/encoding/base64.ts b/packages/effect/src/internal/encoding/base64.ts similarity index 100% rename from src/internal/encoding/base64.ts rename to packages/effect/src/internal/encoding/base64.ts diff --git a/src/internal/encoding/base64Url.ts b/packages/effect/src/internal/encoding/base64Url.ts similarity index 100% rename from src/internal/encoding/base64Url.ts rename to packages/effect/src/internal/encoding/base64Url.ts diff --git a/src/internal/encoding/common.ts b/packages/effect/src/internal/encoding/common.ts similarity index 100% rename from src/internal/encoding/common.ts rename to packages/effect/src/internal/encoding/common.ts diff --git a/src/internal/encoding/hex.ts b/packages/effect/src/internal/encoding/hex.ts similarity index 100% rename from src/internal/encoding/hex.ts rename to packages/effect/src/internal/encoding/hex.ts diff --git a/src/internal/executionStrategy.ts b/packages/effect/src/internal/executionStrategy.ts similarity index 100% rename from src/internal/executionStrategy.ts rename to packages/effect/src/internal/executionStrategy.ts diff --git a/src/internal/fiber.ts b/packages/effect/src/internal/fiber.ts similarity index 100% rename from src/internal/fiber.ts rename to packages/effect/src/internal/fiber.ts diff --git a/src/internal/fiberId.ts b/packages/effect/src/internal/fiberId.ts similarity index 100% rename from src/internal/fiberId.ts rename to packages/effect/src/internal/fiberId.ts diff --git a/src/internal/fiberMessage.ts b/packages/effect/src/internal/fiberMessage.ts similarity index 100% rename from src/internal/fiberMessage.ts rename to packages/effect/src/internal/fiberMessage.ts diff --git a/src/internal/fiberRefs.ts b/packages/effect/src/internal/fiberRefs.ts similarity index 100% rename from src/internal/fiberRefs.ts rename to packages/effect/src/internal/fiberRefs.ts diff --git a/src/internal/fiberRefs/patch.ts b/packages/effect/src/internal/fiberRefs/patch.ts similarity index 100% rename from src/internal/fiberRefs/patch.ts rename to packages/effect/src/internal/fiberRefs/patch.ts diff --git a/src/internal/fiberRuntime.ts b/packages/effect/src/internal/fiberRuntime.ts similarity index 100% rename from src/internal/fiberRuntime.ts rename to packages/effect/src/internal/fiberRuntime.ts diff --git a/src/internal/fiberScope.ts b/packages/effect/src/internal/fiberScope.ts similarity index 100% rename from src/internal/fiberScope.ts rename to packages/effect/src/internal/fiberScope.ts diff --git a/src/internal/fiberStatus.ts b/packages/effect/src/internal/fiberStatus.ts similarity index 100% rename from src/internal/fiberStatus.ts rename to packages/effect/src/internal/fiberStatus.ts diff --git a/src/internal/groupBy.ts b/packages/effect/src/internal/groupBy.ts similarity index 100% rename from src/internal/groupBy.ts rename to packages/effect/src/internal/groupBy.ts diff --git a/src/internal/hashMap.ts b/packages/effect/src/internal/hashMap.ts similarity index 100% rename from src/internal/hashMap.ts rename to packages/effect/src/internal/hashMap.ts diff --git a/src/internal/hashMap/array.ts b/packages/effect/src/internal/hashMap/array.ts similarity index 100% rename from src/internal/hashMap/array.ts rename to packages/effect/src/internal/hashMap/array.ts diff --git a/src/internal/hashMap/bitwise.ts b/packages/effect/src/internal/hashMap/bitwise.ts similarity index 100% rename from src/internal/hashMap/bitwise.ts rename to packages/effect/src/internal/hashMap/bitwise.ts diff --git a/src/internal/hashMap/config.ts b/packages/effect/src/internal/hashMap/config.ts similarity index 100% rename from src/internal/hashMap/config.ts rename to packages/effect/src/internal/hashMap/config.ts diff --git a/src/internal/hashMap/keySet.ts b/packages/effect/src/internal/hashMap/keySet.ts similarity index 100% rename from src/internal/hashMap/keySet.ts rename to packages/effect/src/internal/hashMap/keySet.ts diff --git a/src/internal/hashMap/node.ts b/packages/effect/src/internal/hashMap/node.ts similarity index 100% rename from src/internal/hashMap/node.ts rename to packages/effect/src/internal/hashMap/node.ts diff --git a/src/internal/hashSet.ts b/packages/effect/src/internal/hashSet.ts similarity index 100% rename from src/internal/hashSet.ts rename to packages/effect/src/internal/hashSet.ts diff --git a/src/internal/keyedPool.ts b/packages/effect/src/internal/keyedPool.ts similarity index 100% rename from src/internal/keyedPool.ts rename to packages/effect/src/internal/keyedPool.ts diff --git a/src/internal/layer.ts b/packages/effect/src/internal/layer.ts similarity index 100% rename from src/internal/layer.ts rename to packages/effect/src/internal/layer.ts diff --git a/src/internal/layer/circular.ts b/packages/effect/src/internal/layer/circular.ts similarity index 100% rename from src/internal/layer/circular.ts rename to packages/effect/src/internal/layer/circular.ts diff --git a/src/internal/logSpan.ts b/packages/effect/src/internal/logSpan.ts similarity index 100% rename from src/internal/logSpan.ts rename to packages/effect/src/internal/logSpan.ts diff --git a/src/internal/logger-circular.ts b/packages/effect/src/internal/logger-circular.ts similarity index 100% rename from src/internal/logger-circular.ts rename to packages/effect/src/internal/logger-circular.ts diff --git a/src/internal/logger.ts b/packages/effect/src/internal/logger.ts similarity index 100% rename from src/internal/logger.ts rename to packages/effect/src/internal/logger.ts diff --git a/src/internal/matcher.ts b/packages/effect/src/internal/matcher.ts similarity index 100% rename from src/internal/matcher.ts rename to packages/effect/src/internal/matcher.ts diff --git a/src/internal/metric.ts b/packages/effect/src/internal/metric.ts similarity index 100% rename from src/internal/metric.ts rename to packages/effect/src/internal/metric.ts diff --git a/src/internal/metric/boundaries.ts b/packages/effect/src/internal/metric/boundaries.ts similarity index 100% rename from src/internal/metric/boundaries.ts rename to packages/effect/src/internal/metric/boundaries.ts diff --git a/src/internal/metric/hook.ts b/packages/effect/src/internal/metric/hook.ts similarity index 100% rename from src/internal/metric/hook.ts rename to packages/effect/src/internal/metric/hook.ts diff --git a/src/internal/metric/key.ts b/packages/effect/src/internal/metric/key.ts similarity index 100% rename from src/internal/metric/key.ts rename to packages/effect/src/internal/metric/key.ts diff --git a/src/internal/metric/keyType.ts b/packages/effect/src/internal/metric/keyType.ts similarity index 100% rename from src/internal/metric/keyType.ts rename to packages/effect/src/internal/metric/keyType.ts diff --git a/src/internal/metric/label.ts b/packages/effect/src/internal/metric/label.ts similarity index 100% rename from src/internal/metric/label.ts rename to packages/effect/src/internal/metric/label.ts diff --git a/src/internal/metric/pair.ts b/packages/effect/src/internal/metric/pair.ts similarity index 100% rename from src/internal/metric/pair.ts rename to packages/effect/src/internal/metric/pair.ts diff --git a/src/internal/metric/polling.ts b/packages/effect/src/internal/metric/polling.ts similarity index 100% rename from src/internal/metric/polling.ts rename to packages/effect/src/internal/metric/polling.ts diff --git a/src/internal/metric/registry.ts b/packages/effect/src/internal/metric/registry.ts similarity index 100% rename from src/internal/metric/registry.ts rename to packages/effect/src/internal/metric/registry.ts diff --git a/src/internal/metric/state.ts b/packages/effect/src/internal/metric/state.ts similarity index 100% rename from src/internal/metric/state.ts rename to packages/effect/src/internal/metric/state.ts diff --git a/src/internal/opCodes/cause.ts b/packages/effect/src/internal/opCodes/cause.ts similarity index 100% rename from src/internal/opCodes/cause.ts rename to packages/effect/src/internal/opCodes/cause.ts diff --git a/src/internal/opCodes/channel.ts b/packages/effect/src/internal/opCodes/channel.ts similarity index 100% rename from src/internal/opCodes/channel.ts rename to packages/effect/src/internal/opCodes/channel.ts diff --git a/src/internal/opCodes/channelChildExecutorDecision.ts b/packages/effect/src/internal/opCodes/channelChildExecutorDecision.ts similarity index 100% rename from src/internal/opCodes/channelChildExecutorDecision.ts rename to packages/effect/src/internal/opCodes/channelChildExecutorDecision.ts diff --git a/src/internal/opCodes/channelMergeDecision.ts b/packages/effect/src/internal/opCodes/channelMergeDecision.ts similarity index 100% rename from src/internal/opCodes/channelMergeDecision.ts rename to packages/effect/src/internal/opCodes/channelMergeDecision.ts diff --git a/src/internal/opCodes/channelMergeState.ts b/packages/effect/src/internal/opCodes/channelMergeState.ts similarity index 100% rename from src/internal/opCodes/channelMergeState.ts rename to packages/effect/src/internal/opCodes/channelMergeState.ts diff --git a/src/internal/opCodes/channelMergeStrategy.ts b/packages/effect/src/internal/opCodes/channelMergeStrategy.ts similarity index 100% rename from src/internal/opCodes/channelMergeStrategy.ts rename to packages/effect/src/internal/opCodes/channelMergeStrategy.ts diff --git a/src/internal/opCodes/channelState.ts b/packages/effect/src/internal/opCodes/channelState.ts similarity index 100% rename from src/internal/opCodes/channelState.ts rename to packages/effect/src/internal/opCodes/channelState.ts diff --git a/src/internal/opCodes/channelUpstreamPullRequest.ts b/packages/effect/src/internal/opCodes/channelUpstreamPullRequest.ts similarity index 100% rename from src/internal/opCodes/channelUpstreamPullRequest.ts rename to packages/effect/src/internal/opCodes/channelUpstreamPullRequest.ts diff --git a/src/internal/opCodes/channelUpstreamPullStrategy.ts b/packages/effect/src/internal/opCodes/channelUpstreamPullStrategy.ts similarity index 100% rename from src/internal/opCodes/channelUpstreamPullStrategy.ts rename to packages/effect/src/internal/opCodes/channelUpstreamPullStrategy.ts diff --git a/src/internal/opCodes/config.ts b/packages/effect/src/internal/opCodes/config.ts similarity index 100% rename from src/internal/opCodes/config.ts rename to packages/effect/src/internal/opCodes/config.ts diff --git a/src/internal/opCodes/configError.ts b/packages/effect/src/internal/opCodes/configError.ts similarity index 100% rename from src/internal/opCodes/configError.ts rename to packages/effect/src/internal/opCodes/configError.ts diff --git a/src/internal/opCodes/continuation.ts b/packages/effect/src/internal/opCodes/continuation.ts similarity index 100% rename from src/internal/opCodes/continuation.ts rename to packages/effect/src/internal/opCodes/continuation.ts diff --git a/src/internal/opCodes/deferred.ts b/packages/effect/src/internal/opCodes/deferred.ts similarity index 100% rename from src/internal/opCodes/deferred.ts rename to packages/effect/src/internal/opCodes/deferred.ts diff --git a/src/internal/opCodes/effect.ts b/packages/effect/src/internal/opCodes/effect.ts similarity index 100% rename from src/internal/opCodes/effect.ts rename to packages/effect/src/internal/opCodes/effect.ts diff --git a/src/internal/opCodes/layer.ts b/packages/effect/src/internal/opCodes/layer.ts similarity index 100% rename from src/internal/opCodes/layer.ts rename to packages/effect/src/internal/opCodes/layer.ts diff --git a/src/internal/opCodes/streamHaltStrategy.ts b/packages/effect/src/internal/opCodes/streamHaltStrategy.ts similarity index 100% rename from src/internal/opCodes/streamHaltStrategy.ts rename to packages/effect/src/internal/opCodes/streamHaltStrategy.ts diff --git a/src/internal/option.ts b/packages/effect/src/internal/option.ts similarity index 100% rename from src/internal/option.ts rename to packages/effect/src/internal/option.ts diff --git a/src/internal/pool.ts b/packages/effect/src/internal/pool.ts similarity index 100% rename from src/internal/pool.ts rename to packages/effect/src/internal/pool.ts diff --git a/src/internal/pubsub.ts b/packages/effect/src/internal/pubsub.ts similarity index 100% rename from src/internal/pubsub.ts rename to packages/effect/src/internal/pubsub.ts diff --git a/src/internal/query.ts b/packages/effect/src/internal/query.ts similarity index 100% rename from src/internal/query.ts rename to packages/effect/src/internal/query.ts diff --git a/src/internal/queue.ts b/packages/effect/src/internal/queue.ts similarity index 100% rename from src/internal/queue.ts rename to packages/effect/src/internal/queue.ts diff --git a/src/internal/random.ts b/packages/effect/src/internal/random.ts similarity index 100% rename from src/internal/random.ts rename to packages/effect/src/internal/random.ts diff --git a/src/internal/readonlyArray.ts b/packages/effect/src/internal/readonlyArray.ts similarity index 100% rename from src/internal/readonlyArray.ts rename to packages/effect/src/internal/readonlyArray.ts diff --git a/src/internal/redBlackTree.ts b/packages/effect/src/internal/redBlackTree.ts similarity index 100% rename from src/internal/redBlackTree.ts rename to packages/effect/src/internal/redBlackTree.ts diff --git a/src/internal/redBlackTree/iterator.ts b/packages/effect/src/internal/redBlackTree/iterator.ts similarity index 100% rename from src/internal/redBlackTree/iterator.ts rename to packages/effect/src/internal/redBlackTree/iterator.ts diff --git a/src/internal/redBlackTree/node.ts b/packages/effect/src/internal/redBlackTree/node.ts similarity index 100% rename from src/internal/redBlackTree/node.ts rename to packages/effect/src/internal/redBlackTree/node.ts diff --git a/src/internal/ref.ts b/packages/effect/src/internal/ref.ts similarity index 100% rename from src/internal/ref.ts rename to packages/effect/src/internal/ref.ts diff --git a/src/internal/reloadable.ts b/packages/effect/src/internal/reloadable.ts similarity index 100% rename from src/internal/reloadable.ts rename to packages/effect/src/internal/reloadable.ts diff --git a/src/internal/request.ts b/packages/effect/src/internal/request.ts similarity index 100% rename from src/internal/request.ts rename to packages/effect/src/internal/request.ts diff --git a/src/internal/resource.ts b/packages/effect/src/internal/resource.ts similarity index 100% rename from src/internal/resource.ts rename to packages/effect/src/internal/resource.ts diff --git a/src/internal/ringBuffer.ts b/packages/effect/src/internal/ringBuffer.ts similarity index 100% rename from src/internal/ringBuffer.ts rename to packages/effect/src/internal/ringBuffer.ts diff --git a/src/internal/runtime.ts b/packages/effect/src/internal/runtime.ts similarity index 100% rename from src/internal/runtime.ts rename to packages/effect/src/internal/runtime.ts diff --git a/src/internal/runtimeFlags.ts b/packages/effect/src/internal/runtimeFlags.ts similarity index 100% rename from src/internal/runtimeFlags.ts rename to packages/effect/src/internal/runtimeFlags.ts diff --git a/src/internal/runtimeFlagsPatch.ts b/packages/effect/src/internal/runtimeFlagsPatch.ts similarity index 100% rename from src/internal/runtimeFlagsPatch.ts rename to packages/effect/src/internal/runtimeFlagsPatch.ts diff --git a/src/internal/schedule.ts b/packages/effect/src/internal/schedule.ts similarity index 100% rename from src/internal/schedule.ts rename to packages/effect/src/internal/schedule.ts diff --git a/src/internal/schedule/decision.ts b/packages/effect/src/internal/schedule/decision.ts similarity index 100% rename from src/internal/schedule/decision.ts rename to packages/effect/src/internal/schedule/decision.ts diff --git a/src/internal/schedule/interval.ts b/packages/effect/src/internal/schedule/interval.ts similarity index 100% rename from src/internal/schedule/interval.ts rename to packages/effect/src/internal/schedule/interval.ts diff --git a/src/internal/schedule/intervals.ts b/packages/effect/src/internal/schedule/intervals.ts similarity index 100% rename from src/internal/schedule/intervals.ts rename to packages/effect/src/internal/schedule/intervals.ts diff --git a/src/internal/scopedCache.ts b/packages/effect/src/internal/scopedCache.ts similarity index 100% rename from src/internal/scopedCache.ts rename to packages/effect/src/internal/scopedCache.ts diff --git a/src/internal/scopedRef.ts b/packages/effect/src/internal/scopedRef.ts similarity index 100% rename from src/internal/scopedRef.ts rename to packages/effect/src/internal/scopedRef.ts diff --git a/src/internal/singleShotGen.ts b/packages/effect/src/internal/singleShotGen.ts similarity index 100% rename from src/internal/singleShotGen.ts rename to packages/effect/src/internal/singleShotGen.ts diff --git a/src/internal/sink.ts b/packages/effect/src/internal/sink.ts similarity index 100% rename from src/internal/sink.ts rename to packages/effect/src/internal/sink.ts diff --git a/src/internal/stack.ts b/packages/effect/src/internal/stack.ts similarity index 100% rename from src/internal/stack.ts rename to packages/effect/src/internal/stack.ts diff --git a/src/internal/stm/core.ts b/packages/effect/src/internal/stm/core.ts similarity index 100% rename from src/internal/stm/core.ts rename to packages/effect/src/internal/stm/core.ts diff --git a/src/internal/stm/opCodes/stm.ts b/packages/effect/src/internal/stm/opCodes/stm.ts similarity index 100% rename from src/internal/stm/opCodes/stm.ts rename to packages/effect/src/internal/stm/opCodes/stm.ts diff --git a/src/internal/stm/opCodes/stmState.ts b/packages/effect/src/internal/stm/opCodes/stmState.ts similarity index 100% rename from src/internal/stm/opCodes/stmState.ts rename to packages/effect/src/internal/stm/opCodes/stmState.ts diff --git a/src/internal/stm/opCodes/strategy.ts b/packages/effect/src/internal/stm/opCodes/strategy.ts similarity index 100% rename from src/internal/stm/opCodes/strategy.ts rename to packages/effect/src/internal/stm/opCodes/strategy.ts diff --git a/src/internal/stm/opCodes/tExit.ts b/packages/effect/src/internal/stm/opCodes/tExit.ts similarity index 100% rename from src/internal/stm/opCodes/tExit.ts rename to packages/effect/src/internal/stm/opCodes/tExit.ts diff --git a/src/internal/stm/opCodes/tryCommit.ts b/packages/effect/src/internal/stm/opCodes/tryCommit.ts similarity index 100% rename from src/internal/stm/opCodes/tryCommit.ts rename to packages/effect/src/internal/stm/opCodes/tryCommit.ts diff --git a/src/internal/stm/stm.ts b/packages/effect/src/internal/stm/stm.ts similarity index 100% rename from src/internal/stm/stm.ts rename to packages/effect/src/internal/stm/stm.ts diff --git a/src/internal/stm/stm/entry.ts b/packages/effect/src/internal/stm/stm/entry.ts similarity index 100% rename from src/internal/stm/stm/entry.ts rename to packages/effect/src/internal/stm/stm/entry.ts diff --git a/src/internal/stm/stm/journal.ts b/packages/effect/src/internal/stm/stm/journal.ts similarity index 100% rename from src/internal/stm/stm/journal.ts rename to packages/effect/src/internal/stm/stm/journal.ts diff --git a/src/internal/stm/stm/opCodes/stm.ts b/packages/effect/src/internal/stm/stm/opCodes/stm.ts similarity index 100% rename from src/internal/stm/stm/opCodes/stm.ts rename to packages/effect/src/internal/stm/stm/opCodes/stm.ts diff --git a/src/internal/stm/stm/opCodes/stmState.ts b/packages/effect/src/internal/stm/stm/opCodes/stmState.ts similarity index 100% rename from src/internal/stm/stm/opCodes/stmState.ts rename to packages/effect/src/internal/stm/stm/opCodes/stmState.ts diff --git a/src/internal/stm/stm/opCodes/strategy.ts b/packages/effect/src/internal/stm/stm/opCodes/strategy.ts similarity index 100% rename from src/internal/stm/stm/opCodes/strategy.ts rename to packages/effect/src/internal/stm/stm/opCodes/strategy.ts diff --git a/src/internal/stm/stm/opCodes/tExit.ts b/packages/effect/src/internal/stm/stm/opCodes/tExit.ts similarity index 100% rename from src/internal/stm/stm/opCodes/tExit.ts rename to packages/effect/src/internal/stm/stm/opCodes/tExit.ts diff --git a/src/internal/stm/stm/opCodes/tryCommit.ts b/packages/effect/src/internal/stm/stm/opCodes/tryCommit.ts similarity index 100% rename from src/internal/stm/stm/opCodes/tryCommit.ts rename to packages/effect/src/internal/stm/stm/opCodes/tryCommit.ts diff --git a/src/internal/stm/stm/stmState.ts b/packages/effect/src/internal/stm/stm/stmState.ts similarity index 100% rename from src/internal/stm/stm/stmState.ts rename to packages/effect/src/internal/stm/stm/stmState.ts diff --git a/src/internal/stm/stm/tExit.ts b/packages/effect/src/internal/stm/stm/tExit.ts similarity index 100% rename from src/internal/stm/stm/tExit.ts rename to packages/effect/src/internal/stm/stm/tExit.ts diff --git a/src/internal/stm/stm/tryCommit.ts b/packages/effect/src/internal/stm/stm/tryCommit.ts similarity index 100% rename from src/internal/stm/stm/tryCommit.ts rename to packages/effect/src/internal/stm/stm/tryCommit.ts diff --git a/src/internal/stm/stm/txnId.ts b/packages/effect/src/internal/stm/stm/txnId.ts similarity index 100% rename from src/internal/stm/stm/txnId.ts rename to packages/effect/src/internal/stm/stm/txnId.ts diff --git a/src/internal/stm/stm/versioned.ts b/packages/effect/src/internal/stm/stm/versioned.ts similarity index 100% rename from src/internal/stm/stm/versioned.ts rename to packages/effect/src/internal/stm/stm/versioned.ts diff --git a/src/internal/stm/tArray.ts b/packages/effect/src/internal/stm/tArray.ts similarity index 100% rename from src/internal/stm/tArray.ts rename to packages/effect/src/internal/stm/tArray.ts diff --git a/src/internal/stm/tDeferred.ts b/packages/effect/src/internal/stm/tDeferred.ts similarity index 100% rename from src/internal/stm/tDeferred.ts rename to packages/effect/src/internal/stm/tDeferred.ts diff --git a/src/internal/stm/tMap.ts b/packages/effect/src/internal/stm/tMap.ts similarity index 100% rename from src/internal/stm/tMap.ts rename to packages/effect/src/internal/stm/tMap.ts diff --git a/src/internal/stm/tPriorityQueue.ts b/packages/effect/src/internal/stm/tPriorityQueue.ts similarity index 100% rename from src/internal/stm/tPriorityQueue.ts rename to packages/effect/src/internal/stm/tPriorityQueue.ts diff --git a/src/internal/stm/tPubSub.ts b/packages/effect/src/internal/stm/tPubSub.ts similarity index 100% rename from src/internal/stm/tPubSub.ts rename to packages/effect/src/internal/stm/tPubSub.ts diff --git a/src/internal/stm/tQueue.ts b/packages/effect/src/internal/stm/tQueue.ts similarity index 100% rename from src/internal/stm/tQueue.ts rename to packages/effect/src/internal/stm/tQueue.ts diff --git a/src/internal/stm/tRandom.ts b/packages/effect/src/internal/stm/tRandom.ts similarity index 100% rename from src/internal/stm/tRandom.ts rename to packages/effect/src/internal/stm/tRandom.ts diff --git a/src/internal/stm/tReentrantLock.ts b/packages/effect/src/internal/stm/tReentrantLock.ts similarity index 100% rename from src/internal/stm/tReentrantLock.ts rename to packages/effect/src/internal/stm/tReentrantLock.ts diff --git a/src/internal/stm/tRef.ts b/packages/effect/src/internal/stm/tRef.ts similarity index 100% rename from src/internal/stm/tRef.ts rename to packages/effect/src/internal/stm/tRef.ts diff --git a/src/internal/stm/tSemaphore.ts b/packages/effect/src/internal/stm/tSemaphore.ts similarity index 100% rename from src/internal/stm/tSemaphore.ts rename to packages/effect/src/internal/stm/tSemaphore.ts diff --git a/src/internal/stm/tSet.ts b/packages/effect/src/internal/stm/tSet.ts similarity index 100% rename from src/internal/stm/tSet.ts rename to packages/effect/src/internal/stm/tSet.ts diff --git a/src/internal/stream.ts b/packages/effect/src/internal/stream.ts similarity index 100% rename from src/internal/stream.ts rename to packages/effect/src/internal/stream.ts diff --git a/src/internal/stream/debounceState.ts b/packages/effect/src/internal/stream/debounceState.ts similarity index 100% rename from src/internal/stream/debounceState.ts rename to packages/effect/src/internal/stream/debounceState.ts diff --git a/src/internal/stream/emit.ts b/packages/effect/src/internal/stream/emit.ts similarity index 100% rename from src/internal/stream/emit.ts rename to packages/effect/src/internal/stream/emit.ts diff --git a/src/internal/stream/haltStrategy.ts b/packages/effect/src/internal/stream/haltStrategy.ts similarity index 100% rename from src/internal/stream/haltStrategy.ts rename to packages/effect/src/internal/stream/haltStrategy.ts diff --git a/src/internal/stream/handoff.ts b/packages/effect/src/internal/stream/handoff.ts similarity index 100% rename from src/internal/stream/handoff.ts rename to packages/effect/src/internal/stream/handoff.ts diff --git a/src/internal/stream/handoffSignal.ts b/packages/effect/src/internal/stream/handoffSignal.ts similarity index 100% rename from src/internal/stream/handoffSignal.ts rename to packages/effect/src/internal/stream/handoffSignal.ts diff --git a/src/internal/stream/pull.ts b/packages/effect/src/internal/stream/pull.ts similarity index 100% rename from src/internal/stream/pull.ts rename to packages/effect/src/internal/stream/pull.ts diff --git a/src/internal/stream/sinkEndReason.ts b/packages/effect/src/internal/stream/sinkEndReason.ts similarity index 100% rename from src/internal/stream/sinkEndReason.ts rename to packages/effect/src/internal/stream/sinkEndReason.ts diff --git a/src/internal/stream/zipAllState.ts b/packages/effect/src/internal/stream/zipAllState.ts similarity index 100% rename from src/internal/stream/zipAllState.ts rename to packages/effect/src/internal/stream/zipAllState.ts diff --git a/src/internal/stream/zipChunksState.ts b/packages/effect/src/internal/stream/zipChunksState.ts similarity index 100% rename from src/internal/stream/zipChunksState.ts rename to packages/effect/src/internal/stream/zipChunksState.ts diff --git a/src/internal/string-utils.ts b/packages/effect/src/internal/string-utils.ts similarity index 100% rename from src/internal/string-utils.ts rename to packages/effect/src/internal/string-utils.ts diff --git a/src/internal/subscriptionRef.ts b/packages/effect/src/internal/subscriptionRef.ts similarity index 100% rename from src/internal/subscriptionRef.ts rename to packages/effect/src/internal/subscriptionRef.ts diff --git a/src/internal/supervisor.ts b/packages/effect/src/internal/supervisor.ts similarity index 100% rename from src/internal/supervisor.ts rename to packages/effect/src/internal/supervisor.ts diff --git a/src/internal/supervisor/patch.ts b/packages/effect/src/internal/supervisor/patch.ts similarity index 100% rename from src/internal/supervisor/patch.ts rename to packages/effect/src/internal/supervisor/patch.ts diff --git a/src/internal/synchronizedRef.ts b/packages/effect/src/internal/synchronizedRef.ts similarity index 100% rename from src/internal/synchronizedRef.ts rename to packages/effect/src/internal/synchronizedRef.ts diff --git a/src/internal/take.ts b/packages/effect/src/internal/take.ts similarity index 100% rename from src/internal/take.ts rename to packages/effect/src/internal/take.ts diff --git a/src/internal/testing/sleep.ts b/packages/effect/src/internal/testing/sleep.ts similarity index 100% rename from src/internal/testing/sleep.ts rename to packages/effect/src/internal/testing/sleep.ts diff --git a/src/internal/testing/suspendedWarningData.ts b/packages/effect/src/internal/testing/suspendedWarningData.ts similarity index 100% rename from src/internal/testing/suspendedWarningData.ts rename to packages/effect/src/internal/testing/suspendedWarningData.ts diff --git a/src/internal/testing/warningData.ts b/packages/effect/src/internal/testing/warningData.ts similarity index 100% rename from src/internal/testing/warningData.ts rename to packages/effect/src/internal/testing/warningData.ts diff --git a/src/internal/timeout.ts b/packages/effect/src/internal/timeout.ts similarity index 100% rename from src/internal/timeout.ts rename to packages/effect/src/internal/timeout.ts diff --git a/src/internal/tracer.ts b/packages/effect/src/internal/tracer.ts similarity index 100% rename from src/internal/tracer.ts rename to packages/effect/src/internal/tracer.ts diff --git a/src/internal/version.ts b/packages/effect/src/internal/version.ts similarity index 100% rename from src/internal/version.ts rename to packages/effect/src/internal/version.ts diff --git a/test/BigDecimal.ts b/packages/effect/test/BigDecimal.ts similarity index 100% rename from test/BigDecimal.ts rename to packages/effect/test/BigDecimal.ts diff --git a/test/BigInt.ts b/packages/effect/test/BigInt.ts similarity index 100% rename from test/BigInt.ts rename to packages/effect/test/BigInt.ts diff --git a/test/Boolean.ts b/packages/effect/test/Boolean.ts similarity index 100% rename from test/Boolean.ts rename to packages/effect/test/Boolean.ts diff --git a/test/Brand.ts b/packages/effect/test/Brand.ts similarity index 100% rename from test/Brand.ts rename to packages/effect/test/Brand.ts diff --git a/test/Cause.ts b/packages/effect/test/Cause.ts similarity index 100% rename from test/Cause.ts rename to packages/effect/test/Cause.ts diff --git a/test/Channel/constructors.ts b/packages/effect/test/Channel/constructors.ts similarity index 100% rename from test/Channel/constructors.ts rename to packages/effect/test/Channel/constructors.ts diff --git a/test/Channel/environment.ts b/packages/effect/test/Channel/environment.ts similarity index 100% rename from test/Channel/environment.ts rename to packages/effect/test/Channel/environment.ts diff --git a/test/Channel/error-handling.ts b/packages/effect/test/Channel/error-handling.ts similarity index 100% rename from test/Channel/error-handling.ts rename to packages/effect/test/Channel/error-handling.ts diff --git a/test/Channel/finalization.ts b/packages/effect/test/Channel/finalization.ts similarity index 100% rename from test/Channel/finalization.ts rename to packages/effect/test/Channel/finalization.ts diff --git a/test/Channel/foreign.ts b/packages/effect/test/Channel/foreign.ts similarity index 100% rename from test/Channel/foreign.ts rename to packages/effect/test/Channel/foreign.ts diff --git a/test/Channel/interruption.ts b/packages/effect/test/Channel/interruption.ts similarity index 100% rename from test/Channel/interruption.ts rename to packages/effect/test/Channel/interruption.ts diff --git a/test/Channel/mapping.ts b/packages/effect/test/Channel/mapping.ts similarity index 100% rename from test/Channel/mapping.ts rename to packages/effect/test/Channel/mapping.ts diff --git a/test/Channel/merging.ts b/packages/effect/test/Channel/merging.ts similarity index 100% rename from test/Channel/merging.ts rename to packages/effect/test/Channel/merging.ts diff --git a/test/Channel/reading.ts b/packages/effect/test/Channel/reading.ts similarity index 100% rename from test/Channel/reading.ts rename to packages/effect/test/Channel/reading.ts diff --git a/test/Channel/scoping.ts b/packages/effect/test/Channel/scoping.ts similarity index 100% rename from test/Channel/scoping.ts rename to packages/effect/test/Channel/scoping.ts diff --git a/test/Channel/sequencing.ts b/packages/effect/test/Channel/sequencing.ts similarity index 100% rename from test/Channel/sequencing.ts rename to packages/effect/test/Channel/sequencing.ts diff --git a/test/Channel/stack-safety.ts b/packages/effect/test/Channel/stack-safety.ts similarity index 100% rename from test/Channel/stack-safety.ts rename to packages/effect/test/Channel/stack-safety.ts diff --git a/test/Chunk.ts b/packages/effect/test/Chunk.ts similarity index 100% rename from test/Chunk.ts rename to packages/effect/test/Chunk.ts diff --git a/test/Config.ts b/packages/effect/test/Config.ts similarity index 100% rename from test/Config.ts rename to packages/effect/test/Config.ts diff --git a/test/ConfigProvider.ts b/packages/effect/test/ConfigProvider.ts similarity index 100% rename from test/ConfigProvider.ts rename to packages/effect/test/ConfigProvider.ts diff --git a/test/Context.ts b/packages/effect/test/Context.ts similarity index 100% rename from test/Context.ts rename to packages/effect/test/Context.ts diff --git a/test/Data.ts b/packages/effect/test/Data.ts similarity index 100% rename from test/Data.ts rename to packages/effect/test/Data.ts diff --git a/test/Deferred.ts b/packages/effect/test/Deferred.ts similarity index 100% rename from test/Deferred.ts rename to packages/effect/test/Deferred.ts diff --git a/test/Differ.ts b/packages/effect/test/Differ.ts similarity index 100% rename from test/Differ.ts rename to packages/effect/test/Differ.ts diff --git a/test/Duration.ts b/packages/effect/test/Duration.ts similarity index 100% rename from test/Duration.ts rename to packages/effect/test/Duration.ts diff --git a/test/Effect/acquire-release.ts b/packages/effect/test/Effect/acquire-release.ts similarity index 100% rename from test/Effect/acquire-release.ts rename to packages/effect/test/Effect/acquire-release.ts diff --git a/test/Effect/applicative.ts b/packages/effect/test/Effect/applicative.ts similarity index 100% rename from test/Effect/applicative.ts rename to packages/effect/test/Effect/applicative.ts diff --git a/test/Effect/async.ts b/packages/effect/test/Effect/async.ts similarity index 100% rename from test/Effect/async.ts rename to packages/effect/test/Effect/async.ts diff --git a/test/Effect/caching.ts b/packages/effect/test/Effect/caching.ts similarity index 100% rename from test/Effect/caching.ts rename to packages/effect/test/Effect/caching.ts diff --git a/test/Effect/cause-rendering.ts b/packages/effect/test/Effect/cause-rendering.ts similarity index 100% rename from test/Effect/cause-rendering.ts rename to packages/effect/test/Effect/cause-rendering.ts diff --git a/test/Effect/collecting.ts b/packages/effect/test/Effect/collecting.ts similarity index 100% rename from test/Effect/collecting.ts rename to packages/effect/test/Effect/collecting.ts diff --git a/test/Effect/concurrency.ts b/packages/effect/test/Effect/concurrency.ts similarity index 100% rename from test/Effect/concurrency.ts rename to packages/effect/test/Effect/concurrency.ts diff --git a/test/Effect/constructors.ts b/packages/effect/test/Effect/constructors.ts similarity index 100% rename from test/Effect/constructors.ts rename to packages/effect/test/Effect/constructors.ts diff --git a/test/Effect/destructors.ts b/packages/effect/test/Effect/destructors.ts similarity index 100% rename from test/Effect/destructors.ts rename to packages/effect/test/Effect/destructors.ts diff --git a/test/Effect/environment.ts b/packages/effect/test/Effect/environment.ts similarity index 100% rename from test/Effect/environment.ts rename to packages/effect/test/Effect/environment.ts diff --git a/test/Effect/error-handling.ts b/packages/effect/test/Effect/error-handling.ts similarity index 100% rename from test/Effect/error-handling.ts rename to packages/effect/test/Effect/error-handling.ts diff --git a/test/Effect/error.ts b/packages/effect/test/Effect/error.ts similarity index 100% rename from test/Effect/error.ts rename to packages/effect/test/Effect/error.ts diff --git a/test/Effect/filtering.ts b/packages/effect/test/Effect/filtering.ts similarity index 100% rename from test/Effect/filtering.ts rename to packages/effect/test/Effect/filtering.ts diff --git a/test/Effect/finalization.ts b/packages/effect/test/Effect/finalization.ts similarity index 100% rename from test/Effect/finalization.ts rename to packages/effect/test/Effect/finalization.ts diff --git a/test/Effect/foreign.ts b/packages/effect/test/Effect/foreign.ts similarity index 100% rename from test/Effect/foreign.ts rename to packages/effect/test/Effect/foreign.ts diff --git a/test/Effect/forking.ts b/packages/effect/test/Effect/forking.ts similarity index 100% rename from test/Effect/forking.ts rename to packages/effect/test/Effect/forking.ts diff --git a/test/Effect/interruption.ts b/packages/effect/test/Effect/interruption.ts similarity index 100% rename from test/Effect/interruption.ts rename to packages/effect/test/Effect/interruption.ts diff --git a/test/Effect/join-order.ts b/packages/effect/test/Effect/join-order.ts similarity index 100% rename from test/Effect/join-order.ts rename to packages/effect/test/Effect/join-order.ts diff --git a/test/Effect/mapping.ts b/packages/effect/test/Effect/mapping.ts similarity index 100% rename from test/Effect/mapping.ts rename to packages/effect/test/Effect/mapping.ts diff --git a/test/Effect/memoization.ts b/packages/effect/test/Effect/memoization.ts similarity index 100% rename from test/Effect/memoization.ts rename to packages/effect/test/Effect/memoization.ts diff --git a/test/Effect/promise.ts b/packages/effect/test/Effect/promise.ts similarity index 100% rename from test/Effect/promise.ts rename to packages/effect/test/Effect/promise.ts diff --git a/test/Effect/provide-runtime.ts b/packages/effect/test/Effect/provide-runtime.ts similarity index 100% rename from test/Effect/provide-runtime.ts rename to packages/effect/test/Effect/provide-runtime.ts diff --git a/test/Effect/query-deadlock.ts b/packages/effect/test/Effect/query-deadlock.ts similarity index 100% rename from test/Effect/query-deadlock.ts rename to packages/effect/test/Effect/query-deadlock.ts diff --git a/test/Effect/query-nested.ts b/packages/effect/test/Effect/query-nested.ts similarity index 100% rename from test/Effect/query-nested.ts rename to packages/effect/test/Effect/query-nested.ts diff --git a/test/Effect/query.ts b/packages/effect/test/Effect/query.ts similarity index 100% rename from test/Effect/query.ts rename to packages/effect/test/Effect/query.ts diff --git a/test/Effect/racing.ts b/packages/effect/test/Effect/racing.ts similarity index 100% rename from test/Effect/racing.ts rename to packages/effect/test/Effect/racing.ts diff --git a/test/Effect/rendezvous.ts b/packages/effect/test/Effect/rendezvous.ts similarity index 100% rename from test/Effect/rendezvous.ts rename to packages/effect/test/Effect/rendezvous.ts diff --git a/test/Effect/repeating.ts b/packages/effect/test/Effect/repeating.ts similarity index 100% rename from test/Effect/repeating.ts rename to packages/effect/test/Effect/repeating.ts diff --git a/test/Effect/retrying.ts b/packages/effect/test/Effect/retrying.ts similarity index 100% rename from test/Effect/retrying.ts rename to packages/effect/test/Effect/retrying.ts diff --git a/test/Effect/runtimeFlags.ts b/packages/effect/test/Effect/runtimeFlags.ts similarity index 100% rename from test/Effect/runtimeFlags.ts rename to packages/effect/test/Effect/runtimeFlags.ts diff --git a/test/Effect/scheduler.ts b/packages/effect/test/Effect/scheduler.ts similarity index 100% rename from test/Effect/scheduler.ts rename to packages/effect/test/Effect/scheduler.ts diff --git a/test/Effect/scheduling.ts b/packages/effect/test/Effect/scheduling.ts similarity index 100% rename from test/Effect/scheduling.ts rename to packages/effect/test/Effect/scheduling.ts diff --git a/test/Effect/scope-ref.ts b/packages/effect/test/Effect/scope-ref.ts similarity index 100% rename from test/Effect/scope-ref.ts rename to packages/effect/test/Effect/scope-ref.ts diff --git a/test/Effect/semaphore.ts b/packages/effect/test/Effect/semaphore.ts similarity index 100% rename from test/Effect/semaphore.ts rename to packages/effect/test/Effect/semaphore.ts diff --git a/test/Effect/sequencing.ts b/packages/effect/test/Effect/sequencing.ts similarity index 100% rename from test/Effect/sequencing.ts rename to packages/effect/test/Effect/sequencing.ts diff --git a/test/Effect/stack-safety.ts b/packages/effect/test/Effect/stack-safety.ts similarity index 100% rename from test/Effect/stack-safety.ts rename to packages/effect/test/Effect/stack-safety.ts diff --git a/test/Effect/structural.ts b/packages/effect/test/Effect/structural.ts similarity index 100% rename from test/Effect/structural.ts rename to packages/effect/test/Effect/structural.ts diff --git a/test/Effect/sync.ts b/packages/effect/test/Effect/sync.ts similarity index 100% rename from test/Effect/sync.ts rename to packages/effect/test/Effect/sync.ts diff --git a/test/Effect/tapping.ts b/packages/effect/test/Effect/tapping.ts similarity index 100% rename from test/Effect/tapping.ts rename to packages/effect/test/Effect/tapping.ts diff --git a/test/Effect/timeout.ts b/packages/effect/test/Effect/timeout.ts similarity index 100% rename from test/Effect/timeout.ts rename to packages/effect/test/Effect/timeout.ts diff --git a/test/Effect/traversing.ts b/packages/effect/test/Effect/traversing.ts similarity index 100% rename from test/Effect/traversing.ts rename to packages/effect/test/Effect/traversing.ts diff --git a/test/Effect/tryPromise.ts b/packages/effect/test/Effect/tryPromise.ts similarity index 100% rename from test/Effect/tryPromise.ts rename to packages/effect/test/Effect/tryPromise.ts diff --git a/test/Effect/validation.ts b/packages/effect/test/Effect/validation.ts similarity index 100% rename from test/Effect/validation.ts rename to packages/effect/test/Effect/validation.ts diff --git a/test/Either.ts b/packages/effect/test/Either.ts similarity index 100% rename from test/Either.ts rename to packages/effect/test/Either.ts diff --git a/test/Encoding.ts b/packages/effect/test/Encoding.ts similarity index 100% rename from test/Encoding.ts rename to packages/effect/test/Encoding.ts diff --git a/test/Equivalence.ts b/packages/effect/test/Equivalence.ts similarity index 100% rename from test/Equivalence.ts rename to packages/effect/test/Equivalence.ts diff --git a/test/Exit.ts b/packages/effect/test/Exit.ts similarity index 100% rename from test/Exit.ts rename to packages/effect/test/Exit.ts diff --git a/test/Fiber.ts b/packages/effect/test/Fiber.ts similarity index 100% rename from test/Fiber.ts rename to packages/effect/test/Fiber.ts diff --git a/test/FiberRef.ts b/packages/effect/test/FiberRef.ts similarity index 100% rename from test/FiberRef.ts rename to packages/effect/test/FiberRef.ts diff --git a/test/FiberRefs.ts b/packages/effect/test/FiberRefs.ts similarity index 100% rename from test/FiberRefs.ts rename to packages/effect/test/FiberRefs.ts diff --git a/test/Function.ts b/packages/effect/test/Function.ts similarity index 100% rename from test/Function.ts rename to packages/effect/test/Function.ts diff --git a/test/GlobalValue.ts b/packages/effect/test/GlobalValue.ts similarity index 100% rename from test/GlobalValue.ts rename to packages/effect/test/GlobalValue.ts diff --git a/test/Hash.ts b/packages/effect/test/Hash.ts similarity index 100% rename from test/Hash.ts rename to packages/effect/test/Hash.ts diff --git a/test/HashMap.ts b/packages/effect/test/HashMap.ts similarity index 100% rename from test/HashMap.ts rename to packages/effect/test/HashMap.ts diff --git a/test/HashSet.ts b/packages/effect/test/HashSet.ts similarity index 100% rename from test/HashSet.ts rename to packages/effect/test/HashSet.ts diff --git a/test/Inspectable.ts b/packages/effect/test/Inspectable.ts similarity index 100% rename from test/Inspectable.ts rename to packages/effect/test/Inspectable.ts diff --git a/test/KeyedPool.ts b/packages/effect/test/KeyedPool.ts similarity index 100% rename from test/KeyedPool.ts rename to packages/effect/test/KeyedPool.ts diff --git a/test/Layer.ts b/packages/effect/test/Layer.ts similarity index 100% rename from test/Layer.ts rename to packages/effect/test/Layer.ts diff --git a/test/List.ts b/packages/effect/test/List.ts similarity index 100% rename from test/List.ts rename to packages/effect/test/List.ts diff --git a/test/LogLevel.ts b/packages/effect/test/LogLevel.ts similarity index 100% rename from test/LogLevel.ts rename to packages/effect/test/LogLevel.ts diff --git a/test/Logger.ts b/packages/effect/test/Logger.ts similarity index 100% rename from test/Logger.ts rename to packages/effect/test/Logger.ts diff --git a/test/Match.ts b/packages/effect/test/Match.ts similarity index 100% rename from test/Match.ts rename to packages/effect/test/Match.ts diff --git a/test/Metric.ts b/packages/effect/test/Metric.ts similarity index 100% rename from test/Metric.ts rename to packages/effect/test/Metric.ts diff --git a/test/MutableHashMap.ts b/packages/effect/test/MutableHashMap.ts similarity index 100% rename from test/MutableHashMap.ts rename to packages/effect/test/MutableHashMap.ts diff --git a/test/MutableHashSet.ts b/packages/effect/test/MutableHashSet.ts similarity index 100% rename from test/MutableHashSet.ts rename to packages/effect/test/MutableHashSet.ts diff --git a/test/MutableList.ts b/packages/effect/test/MutableList.ts similarity index 100% rename from test/MutableList.ts rename to packages/effect/test/MutableList.ts diff --git a/test/MutableQueue.ts b/packages/effect/test/MutableQueue.ts similarity index 100% rename from test/MutableQueue.ts rename to packages/effect/test/MutableQueue.ts diff --git a/test/MutableRef.ts b/packages/effect/test/MutableRef.ts similarity index 100% rename from test/MutableRef.ts rename to packages/effect/test/MutableRef.ts diff --git a/test/NonEmptyIterable.ts b/packages/effect/test/NonEmptyIterable.ts similarity index 100% rename from test/NonEmptyIterable.ts rename to packages/effect/test/NonEmptyIterable.ts diff --git a/test/Number.ts b/packages/effect/test/Number.ts similarity index 100% rename from test/Number.ts rename to packages/effect/test/Number.ts diff --git a/test/Option.ts b/packages/effect/test/Option.ts similarity index 100% rename from test/Option.ts rename to packages/effect/test/Option.ts diff --git a/test/Order.ts b/packages/effect/test/Order.ts similarity index 100% rename from test/Order.ts rename to packages/effect/test/Order.ts diff --git a/test/Ordering.ts b/packages/effect/test/Ordering.ts similarity index 100% rename from test/Ordering.ts rename to packages/effect/test/Ordering.ts diff --git a/test/Pipeable.ts b/packages/effect/test/Pipeable.ts similarity index 100% rename from test/Pipeable.ts rename to packages/effect/test/Pipeable.ts diff --git a/test/Pool.ts b/packages/effect/test/Pool.ts similarity index 100% rename from test/Pool.ts rename to packages/effect/test/Pool.ts diff --git a/test/Predicate.ts b/packages/effect/test/Predicate.ts similarity index 100% rename from test/Predicate.ts rename to packages/effect/test/Predicate.ts diff --git a/test/PubSub.ts b/packages/effect/test/PubSub.ts similarity index 100% rename from test/PubSub.ts rename to packages/effect/test/PubSub.ts diff --git a/test/Queue.ts b/packages/effect/test/Queue.ts similarity index 100% rename from test/Queue.ts rename to packages/effect/test/Queue.ts diff --git a/test/Random.ts b/packages/effect/test/Random.ts similarity index 100% rename from test/Random.ts rename to packages/effect/test/Random.ts diff --git a/test/ReadonlyArray.ts b/packages/effect/test/ReadonlyArray.ts similarity index 100% rename from test/ReadonlyArray.ts rename to packages/effect/test/ReadonlyArray.ts diff --git a/test/ReadonlyRecord.ts b/packages/effect/test/ReadonlyRecord.ts similarity index 100% rename from test/ReadonlyRecord.ts rename to packages/effect/test/ReadonlyRecord.ts diff --git a/test/RedBlackTree.ts b/packages/effect/test/RedBlackTree.ts similarity index 100% rename from test/RedBlackTree.ts rename to packages/effect/test/RedBlackTree.ts diff --git a/test/Ref.ts b/packages/effect/test/Ref.ts similarity index 100% rename from test/Ref.ts rename to packages/effect/test/Ref.ts diff --git a/test/Reloadable.ts b/packages/effect/test/Reloadable.ts similarity index 100% rename from test/Reloadable.ts rename to packages/effect/test/Reloadable.ts diff --git a/test/Resource.ts b/packages/effect/test/Resource.ts similarity index 100% rename from test/Resource.ts rename to packages/effect/test/Resource.ts diff --git a/test/RuntimeFlags.ts b/packages/effect/test/RuntimeFlags.ts similarity index 100% rename from test/RuntimeFlags.ts rename to packages/effect/test/RuntimeFlags.ts diff --git a/test/STM.ts b/packages/effect/test/STM.ts similarity index 100% rename from test/STM.ts rename to packages/effect/test/STM.ts diff --git a/test/Schedule.ts b/packages/effect/test/Schedule.ts similarity index 100% rename from test/Schedule.ts rename to packages/effect/test/Schedule.ts diff --git a/test/Scope.ts b/packages/effect/test/Scope.ts similarity index 100% rename from test/Scope.ts rename to packages/effect/test/Scope.ts diff --git a/test/ScopedCache.ts b/packages/effect/test/ScopedCache.ts similarity index 100% rename from test/ScopedCache.ts rename to packages/effect/test/ScopedCache.ts diff --git a/test/ScopedRef.ts b/packages/effect/test/ScopedRef.ts similarity index 100% rename from test/ScopedRef.ts rename to packages/effect/test/ScopedRef.ts diff --git a/test/Sink/collecting.ts b/packages/effect/test/Sink/collecting.ts similarity index 100% rename from test/Sink/collecting.ts rename to packages/effect/test/Sink/collecting.ts diff --git a/test/Sink/constructors.ts b/packages/effect/test/Sink/constructors.ts similarity index 100% rename from test/Sink/constructors.ts rename to packages/effect/test/Sink/constructors.ts diff --git a/test/Sink/dropping.ts b/packages/effect/test/Sink/dropping.ts similarity index 100% rename from test/Sink/dropping.ts rename to packages/effect/test/Sink/dropping.ts diff --git a/test/Sink/elements.ts b/packages/effect/test/Sink/elements.ts similarity index 100% rename from test/Sink/elements.ts rename to packages/effect/test/Sink/elements.ts diff --git a/test/Sink/environment.ts b/packages/effect/test/Sink/environment.ts similarity index 100% rename from test/Sink/environment.ts rename to packages/effect/test/Sink/environment.ts diff --git a/test/Sink/error-handling.ts b/packages/effect/test/Sink/error-handling.ts similarity index 100% rename from test/Sink/error-handling.ts rename to packages/effect/test/Sink/error-handling.ts diff --git a/test/Sink/filtering.ts b/packages/effect/test/Sink/filtering.ts similarity index 100% rename from test/Sink/filtering.ts rename to packages/effect/test/Sink/filtering.ts diff --git a/test/Sink/finalization.ts b/packages/effect/test/Sink/finalization.ts similarity index 100% rename from test/Sink/finalization.ts rename to packages/effect/test/Sink/finalization.ts diff --git a/test/Sink/folding.ts b/packages/effect/test/Sink/folding.ts similarity index 100% rename from test/Sink/folding.ts rename to packages/effect/test/Sink/folding.ts diff --git a/test/Sink/foreign.ts b/packages/effect/test/Sink/foreign.ts similarity index 100% rename from test/Sink/foreign.ts rename to packages/effect/test/Sink/foreign.ts diff --git a/test/Sink/mapping.ts b/packages/effect/test/Sink/mapping.ts similarity index 100% rename from test/Sink/mapping.ts rename to packages/effect/test/Sink/mapping.ts diff --git a/test/Sink/racing.ts b/packages/effect/test/Sink/racing.ts similarity index 100% rename from test/Sink/racing.ts rename to packages/effect/test/Sink/racing.ts diff --git a/test/Sink/refining.ts b/packages/effect/test/Sink/refining.ts similarity index 100% rename from test/Sink/refining.ts rename to packages/effect/test/Sink/refining.ts diff --git a/test/Sink/scoping.ts b/packages/effect/test/Sink/scoping.ts similarity index 100% rename from test/Sink/scoping.ts rename to packages/effect/test/Sink/scoping.ts diff --git a/test/Sink/sequencing.ts b/packages/effect/test/Sink/sequencing.ts similarity index 100% rename from test/Sink/sequencing.ts rename to packages/effect/test/Sink/sequencing.ts diff --git a/test/Sink/traversing.ts b/packages/effect/test/Sink/traversing.ts similarity index 100% rename from test/Sink/traversing.ts rename to packages/effect/test/Sink/traversing.ts diff --git a/test/Sink/zipping.ts b/packages/effect/test/Sink/zipping.ts similarity index 100% rename from test/Sink/zipping.ts rename to packages/effect/test/Sink/zipping.ts diff --git a/test/SortedMap.ts b/packages/effect/test/SortedMap.ts similarity index 100% rename from test/SortedMap.ts rename to packages/effect/test/SortedMap.ts diff --git a/test/SortedSet.ts b/packages/effect/test/SortedSet.ts similarity index 100% rename from test/SortedSet.ts rename to packages/effect/test/SortedSet.ts diff --git a/test/Stream/aggregation.ts b/packages/effect/test/Stream/aggregation.ts similarity index 100% rename from test/Stream/aggregation.ts rename to packages/effect/test/Stream/aggregation.ts diff --git a/test/Stream/async.ts b/packages/effect/test/Stream/async.ts similarity index 100% rename from test/Stream/async.ts rename to packages/effect/test/Stream/async.ts diff --git a/test/Stream/broadcasting.ts b/packages/effect/test/Stream/broadcasting.ts similarity index 100% rename from test/Stream/broadcasting.ts rename to packages/effect/test/Stream/broadcasting.ts diff --git a/test/Stream/buffering.ts b/packages/effect/test/Stream/buffering.ts similarity index 100% rename from test/Stream/buffering.ts rename to packages/effect/test/Stream/buffering.ts diff --git a/test/Stream/changing.ts b/packages/effect/test/Stream/changing.ts similarity index 100% rename from test/Stream/changing.ts rename to packages/effect/test/Stream/changing.ts diff --git a/test/Stream/collecting.ts b/packages/effect/test/Stream/collecting.ts similarity index 100% rename from test/Stream/collecting.ts rename to packages/effect/test/Stream/collecting.ts diff --git a/test/Stream/concatenation.ts b/packages/effect/test/Stream/concatenation.ts similarity index 100% rename from test/Stream/concatenation.ts rename to packages/effect/test/Stream/concatenation.ts diff --git a/test/Stream/conditionals.ts b/packages/effect/test/Stream/conditionals.ts similarity index 100% rename from test/Stream/conditionals.ts rename to packages/effect/test/Stream/conditionals.ts diff --git a/test/Stream/constructors.ts b/packages/effect/test/Stream/constructors.ts similarity index 100% rename from test/Stream/constructors.ts rename to packages/effect/test/Stream/constructors.ts diff --git a/test/Stream/conversions.ts b/packages/effect/test/Stream/conversions.ts similarity index 100% rename from test/Stream/conversions.ts rename to packages/effect/test/Stream/conversions.ts diff --git a/test/Stream/distributing.ts b/packages/effect/test/Stream/distributing.ts similarity index 100% rename from test/Stream/distributing.ts rename to packages/effect/test/Stream/distributing.ts diff --git a/test/Stream/draining.ts b/packages/effect/test/Stream/draining.ts similarity index 100% rename from test/Stream/draining.ts rename to packages/effect/test/Stream/draining.ts diff --git a/test/Stream/dropping.ts b/packages/effect/test/Stream/dropping.ts similarity index 100% rename from test/Stream/dropping.ts rename to packages/effect/test/Stream/dropping.ts diff --git a/test/Stream/encoding.ts b/packages/effect/test/Stream/encoding.ts similarity index 100% rename from test/Stream/encoding.ts rename to packages/effect/test/Stream/encoding.ts diff --git a/test/Stream/environment.ts b/packages/effect/test/Stream/environment.ts similarity index 100% rename from test/Stream/environment.ts rename to packages/effect/test/Stream/environment.ts diff --git a/test/Stream/error-handling.ts b/packages/effect/test/Stream/error-handling.ts similarity index 100% rename from test/Stream/error-handling.ts rename to packages/effect/test/Stream/error-handling.ts diff --git a/test/Stream/filtering.ts b/packages/effect/test/Stream/filtering.ts similarity index 100% rename from test/Stream/filtering.ts rename to packages/effect/test/Stream/filtering.ts diff --git a/test/Stream/finding.ts b/packages/effect/test/Stream/finding.ts similarity index 100% rename from test/Stream/finding.ts rename to packages/effect/test/Stream/finding.ts diff --git a/test/Stream/foreign.ts b/packages/effect/test/Stream/foreign.ts similarity index 100% rename from test/Stream/foreign.ts rename to packages/effect/test/Stream/foreign.ts diff --git a/test/Stream/getters.ts b/packages/effect/test/Stream/getters.ts similarity index 100% rename from test/Stream/getters.ts rename to packages/effect/test/Stream/getters.ts diff --git a/test/Stream/grouping.ts b/packages/effect/test/Stream/grouping.ts similarity index 100% rename from test/Stream/grouping.ts rename to packages/effect/test/Stream/grouping.ts diff --git a/test/Stream/halting.ts b/packages/effect/test/Stream/halting.ts similarity index 100% rename from test/Stream/halting.ts rename to packages/effect/test/Stream/halting.ts diff --git a/test/Stream/interleaving.ts b/packages/effect/test/Stream/interleaving.ts similarity index 100% rename from test/Stream/interleaving.ts rename to packages/effect/test/Stream/interleaving.ts diff --git a/test/Stream/interrupting.ts b/packages/effect/test/Stream/interrupting.ts similarity index 100% rename from test/Stream/interrupting.ts rename to packages/effect/test/Stream/interrupting.ts diff --git a/test/Stream/interspersing.ts b/packages/effect/test/Stream/interspersing.ts similarity index 100% rename from test/Stream/interspersing.ts rename to packages/effect/test/Stream/interspersing.ts diff --git a/test/Stream/mapping.ts b/packages/effect/test/Stream/mapping.ts similarity index 100% rename from test/Stream/mapping.ts rename to packages/effect/test/Stream/mapping.ts diff --git a/test/Stream/merging.ts b/packages/effect/test/Stream/merging.ts similarity index 100% rename from test/Stream/merging.ts rename to packages/effect/test/Stream/merging.ts diff --git a/test/Stream/pagination.ts b/packages/effect/test/Stream/pagination.ts similarity index 100% rename from test/Stream/pagination.ts rename to packages/effect/test/Stream/pagination.ts diff --git a/test/Stream/partitioning.ts b/packages/effect/test/Stream/partitioning.ts similarity index 100% rename from test/Stream/partitioning.ts rename to packages/effect/test/Stream/partitioning.ts diff --git a/test/Stream/peeling.ts b/packages/effect/test/Stream/peeling.ts similarity index 100% rename from test/Stream/peeling.ts rename to packages/effect/test/Stream/peeling.ts diff --git a/test/Stream/repeating.ts b/packages/effect/test/Stream/repeating.ts similarity index 100% rename from test/Stream/repeating.ts rename to packages/effect/test/Stream/repeating.ts diff --git a/test/Stream/retrying.ts b/packages/effect/test/Stream/retrying.ts similarity index 100% rename from test/Stream/retrying.ts rename to packages/effect/test/Stream/retrying.ts diff --git a/test/Stream/running.ts b/packages/effect/test/Stream/running.ts similarity index 100% rename from test/Stream/running.ts rename to packages/effect/test/Stream/running.ts diff --git a/test/Stream/scanning.ts b/packages/effect/test/Stream/scanning.ts similarity index 100% rename from test/Stream/scanning.ts rename to packages/effect/test/Stream/scanning.ts diff --git a/test/Stream/scheduling.ts b/packages/effect/test/Stream/scheduling.ts similarity index 100% rename from test/Stream/scheduling.ts rename to packages/effect/test/Stream/scheduling.ts diff --git a/test/Stream/scoping.ts b/packages/effect/test/Stream/scoping.ts similarity index 100% rename from test/Stream/scoping.ts rename to packages/effect/test/Stream/scoping.ts diff --git a/test/Stream/sequencing.ts b/packages/effect/test/Stream/sequencing.ts similarity index 100% rename from test/Stream/sequencing.ts rename to packages/effect/test/Stream/sequencing.ts diff --git a/test/Stream/sliding.ts b/packages/effect/test/Stream/sliding.ts similarity index 100% rename from test/Stream/sliding.ts rename to packages/effect/test/Stream/sliding.ts diff --git a/test/Stream/splitting.ts b/packages/effect/test/Stream/splitting.ts similarity index 100% rename from test/Stream/splitting.ts rename to packages/effect/test/Stream/splitting.ts diff --git a/test/Stream/streamable.ts b/packages/effect/test/Stream/streamable.ts similarity index 100% rename from test/Stream/streamable.ts rename to packages/effect/test/Stream/streamable.ts diff --git a/test/Stream/taking.ts b/packages/effect/test/Stream/taking.ts similarity index 100% rename from test/Stream/taking.ts rename to packages/effect/test/Stream/taking.ts diff --git a/test/Stream/tapping.ts b/packages/effect/test/Stream/tapping.ts similarity index 100% rename from test/Stream/tapping.ts rename to packages/effect/test/Stream/tapping.ts diff --git a/test/Stream/throttling.ts b/packages/effect/test/Stream/throttling.ts similarity index 100% rename from test/Stream/throttling.ts rename to packages/effect/test/Stream/throttling.ts diff --git a/test/Stream/timeouts.ts b/packages/effect/test/Stream/timeouts.ts similarity index 100% rename from test/Stream/timeouts.ts rename to packages/effect/test/Stream/timeouts.ts diff --git a/test/Stream/transducing.ts b/packages/effect/test/Stream/transducing.ts similarity index 100% rename from test/Stream/transducing.ts rename to packages/effect/test/Stream/transducing.ts diff --git a/test/Stream/zipping.ts b/packages/effect/test/Stream/zipping.ts similarity index 100% rename from test/Stream/zipping.ts rename to packages/effect/test/Stream/zipping.ts diff --git a/test/String.ts b/packages/effect/test/String.ts similarity index 100% rename from test/String.ts rename to packages/effect/test/String.ts diff --git a/test/Struct.ts b/packages/effect/test/Struct.ts similarity index 100% rename from test/Struct.ts rename to packages/effect/test/Struct.ts diff --git a/test/SubscriptionRef.ts b/packages/effect/test/SubscriptionRef.ts similarity index 100% rename from test/SubscriptionRef.ts rename to packages/effect/test/SubscriptionRef.ts diff --git a/test/Symbol.ts b/packages/effect/test/Symbol.ts similarity index 100% rename from test/Symbol.ts rename to packages/effect/test/Symbol.ts diff --git a/test/Synchronized.ts b/packages/effect/test/Synchronized.ts similarity index 100% rename from test/Synchronized.ts rename to packages/effect/test/Synchronized.ts diff --git a/test/TArray.ts b/packages/effect/test/TArray.ts similarity index 100% rename from test/TArray.ts rename to packages/effect/test/TArray.ts diff --git a/test/TMap.ts b/packages/effect/test/TMap.ts similarity index 100% rename from test/TMap.ts rename to packages/effect/test/TMap.ts diff --git a/test/TPriorityQueue.ts b/packages/effect/test/TPriorityQueue.ts similarity index 100% rename from test/TPriorityQueue.ts rename to packages/effect/test/TPriorityQueue.ts diff --git a/test/TPubSub.ts b/packages/effect/test/TPubSub.ts similarity index 100% rename from test/TPubSub.ts rename to packages/effect/test/TPubSub.ts diff --git a/test/TQueue.ts b/packages/effect/test/TQueue.ts similarity index 100% rename from test/TQueue.ts rename to packages/effect/test/TQueue.ts diff --git a/test/TRandom.ts b/packages/effect/test/TRandom.ts similarity index 100% rename from test/TRandom.ts rename to packages/effect/test/TRandom.ts diff --git a/test/TReentrantLock.ts b/packages/effect/test/TReentrantLock.ts similarity index 100% rename from test/TReentrantLock.ts rename to packages/effect/test/TReentrantLock.ts diff --git a/test/TSet.ts b/packages/effect/test/TSet.ts similarity index 100% rename from test/TSet.ts rename to packages/effect/test/TSet.ts diff --git a/test/Tracer.ts b/packages/effect/test/Tracer.ts similarity index 100% rename from test/Tracer.ts rename to packages/effect/test/Tracer.ts diff --git a/test/Tuple.ts b/packages/effect/test/Tuple.ts similarity index 100% rename from test/Tuple.ts rename to packages/effect/test/Tuple.ts diff --git a/test/util.ts b/packages/effect/test/util.ts similarity index 100% rename from test/util.ts rename to packages/effect/test/util.ts diff --git a/test/utils/cache/ObservableResource.ts b/packages/effect/test/utils/cache/ObservableResource.ts similarity index 100% rename from test/utils/cache/ObservableResource.ts rename to packages/effect/test/utils/cache/ObservableResource.ts diff --git a/test/utils/cache/WatchableLookup.ts b/packages/effect/test/utils/cache/WatchableLookup.ts similarity index 100% rename from test/utils/cache/WatchableLookup.ts rename to packages/effect/test/utils/cache/WatchableLookup.ts diff --git a/test/utils/cause.ts b/packages/effect/test/utils/cause.ts similarity index 100% rename from test/utils/cause.ts rename to packages/effect/test/utils/cause.ts diff --git a/test/utils/coordination.ts b/packages/effect/test/utils/coordination.ts similarity index 100% rename from test/utils/coordination.ts rename to packages/effect/test/utils/coordination.ts diff --git a/test/utils/counter.ts b/packages/effect/test/utils/counter.ts similarity index 100% rename from test/utils/counter.ts rename to packages/effect/test/utils/counter.ts diff --git a/test/utils/equals.ts b/packages/effect/test/utils/equals.ts similarity index 100% rename from test/utils/equals.ts rename to packages/effect/test/utils/equals.ts diff --git a/test/utils/extend.ts b/packages/effect/test/utils/extend.ts similarity index 100% rename from test/utils/extend.ts rename to packages/effect/test/utils/extend.ts diff --git a/test/utils/latch.ts b/packages/effect/test/utils/latch.ts similarity index 100% rename from test/utils/latch.ts rename to packages/effect/test/utils/latch.ts diff --git a/test/utils/types.ts b/packages/effect/test/utils/types.ts similarity index 100% rename from test/utils/types.ts rename to packages/effect/test/utils/types.ts diff --git a/test/utils/unfoldEffect.ts b/packages/effect/test/utils/unfoldEffect.ts similarity index 100% rename from test/utils/unfoldEffect.ts rename to packages/effect/test/utils/unfoldEffect.ts diff --git a/packages/effect/tsconfig.build.json b/packages/effect/tsconfig.build.json new file mode 100644 index 000000000..e3c415a69 --- /dev/null +++ b/packages/effect/tsconfig.build.json @@ -0,0 +1,9 @@ +{ + "extends": "./tsconfig.src.json", + "compilerOptions": { + "tsBuildInfoFile": ".tsbuildinfo/build.tsbuildinfo", + "outDir": "build/esm", + "declarationDir": "build/dts", + "stripInternal": true + } +} diff --git a/packages/effect/tsconfig.json b/packages/effect/tsconfig.json new file mode 100644 index 000000000..294669b56 --- /dev/null +++ b/packages/effect/tsconfig.json @@ -0,0 +1,11 @@ +{ + "extends": "../../tsconfig.base.json", + "references": [ + { + "path": "tsconfig.src.json" + }, + { + "path": "tsconfig.test.json" + } + ] +} diff --git a/tsconfig.src.json b/packages/effect/tsconfig.src.json similarity index 80% rename from tsconfig.src.json rename to packages/effect/tsconfig.src.json index b85ae3e94..7f692da20 100644 --- a/tsconfig.src.json +++ b/packages/effect/tsconfig.src.json @@ -1,5 +1,5 @@ { - "extends": "./tsconfig.base.json", + "extends": "../../tsconfig.base.json", "include": [ "src" ], diff --git a/tsconfig.test.json b/packages/effect/tsconfig.test.json similarity index 84% rename from tsconfig.test.json rename to packages/effect/tsconfig.test.json index ef1fde512..e53c27524 100644 --- a/tsconfig.test.json +++ b/packages/effect/tsconfig.test.json @@ -1,5 +1,5 @@ { - "extends": "./tsconfig.base.json", + "extends": "../../tsconfig.base.json", "include": [ "test", ], diff --git a/packages/effect/vitest.config.ts b/packages/effect/vitest.config.ts new file mode 100644 index 000000000..1c63519f5 --- /dev/null +++ b/packages/effect/vitest.config.ts @@ -0,0 +1,18 @@ +import { defineConfig, mergeConfig } from "vitest/config" +import sharedConfig from "../../vitest.shared" + +export default mergeConfig( + sharedConfig, + defineConfig({ + test: { + include: ["./test/**/*.{js,mjs,cjs,ts,mts,cts,jsx,tsx}"], + exclude: ["./test/util.ts", "./test/utils/**/*.ts", "./test/**/*.init.ts"], + browser: { + name: "chromium", + provider: "playwright", + headless: true + }, + fakeTimers: { toFake: undefined } + }, + }) +) diff --git a/patches/@changesets__assemble-release-plan@5.2.4.patch b/patches/@changesets__assemble-release-plan@5.2.4.patch new file mode 100644 index 000000000..51b579b71 --- /dev/null +++ b/patches/@changesets__assemble-release-plan@5.2.4.patch @@ -0,0 +1,67 @@ +diff --git a/dist/assemble-release-plan.cjs.dev.js b/dist/assemble-release-plan.cjs.dev.js +index e1376ca756d69816f8c79637ee7b45161f092167..d430938d9f167a5136bdbe7a446ae4cd8d83fa7d 100644 +--- a/dist/assemble-release-plan.cjs.dev.js ++++ b/dist/assemble-release-plan.cjs.dev.js +@@ -138,16 +138,6 @@ function determineDependents({ + } of dependencyVersionRanges) { + if (nextRelease.type === "none") { + continue; +- } else if (shouldBumpMajor({ +- dependent, +- depType, +- versionRange, +- releases, +- nextRelease, +- preInfo, +- onlyUpdatePeerDependentsWhenOutOfRange: config.___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH.onlyUpdatePeerDependentsWhenOutOfRange +- })) { +- type = "major"; + } else if ((!releases.has(dependent) || releases.get(dependent).type === "none") && (config.___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH.updateInternalDependents === "always" || !semverSatisfies__default['default'](incrementVersion(nextRelease, preInfo), versionRange))) { + switch (depType) { + case "dependencies": +diff --git a/dist/assemble-release-plan.cjs.prod.js b/dist/assemble-release-plan.cjs.prod.js +index 3a83720644a94cdf6e62fa188a72c51c0384d00e..dc45739511ebb0e547f5c7e204f0da679cd4ee88 100644 +--- a/dist/assemble-release-plan.cjs.prod.js ++++ b/dist/assemble-release-plan.cjs.prod.js +@@ -70,15 +70,7 @@ function determineDependents({releases: releases, packagesByName: packagesByName + if (!dependentPackage) throw new Error("Dependency map is incorrect"); + if (config.ignore.includes(dependent)) type = "none"; else { + const dependencyVersionRanges = getDependencyVersionRanges(dependentPackage.packageJson, nextRelease); +- for (const {depType: depType, versionRange: versionRange} of dependencyVersionRanges) if ("none" !== nextRelease.type) if (shouldBumpMajor({ +- dependent: dependent, +- depType: depType, +- versionRange: versionRange, +- releases: releases, +- nextRelease: nextRelease, +- preInfo: preInfo, +- onlyUpdatePeerDependentsWhenOutOfRange: config.___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH.onlyUpdatePeerDependentsWhenOutOfRange +- })) type = "major"; else if (!(releases.has(dependent) && "none" !== releases.get(dependent).type || "always" !== config.___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH.updateInternalDependents && semverSatisfies__default.default(incrementVersion(nextRelease, preInfo), versionRange))) switch (depType) { ++ for (const {depType: depType, versionRange: versionRange} of dependencyVersionRanges) if ("none" !== nextRelease.type) if (!(releases.has(dependent) && "none" !== releases.get(dependent).type || "always" !== config.___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH.updateInternalDependents && semverSatisfies__default.default(incrementVersion(nextRelease, preInfo), versionRange))) switch (depType) { + case "dependencies": + case "optionalDependencies": + case "peerDependencies": +diff --git a/src/determine-dependents.ts b/src/determine-dependents.ts +index 08c08127ccfb5974d81b3ace592fced5b68aeaf7..13c52dfc709fab33f5a8df4237e82e19bbb9893c 100644 +--- a/src/determine-dependents.ts ++++ b/src/determine-dependents.ts +@@ -67,20 +67,6 @@ export default function determineDependents({ + for (const { depType, versionRange } of dependencyVersionRanges) { + if (nextRelease.type === "none") { + continue; +- } else if ( +- shouldBumpMajor({ +- dependent, +- depType, +- versionRange, +- releases, +- nextRelease, +- preInfo, +- onlyUpdatePeerDependentsWhenOutOfRange: +- config.___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH +- .onlyUpdatePeerDependentsWhenOutOfRange, +- }) +- ) { +- type = "major"; + } else if ( + (!releases.has(dependent) || + releases.get(dependent)!.type === "none") && \ No newline at end of file diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 24c890e13..cbae0bab2 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -4,115 +4,126 @@ settings: autoInstallPeers: true excludeLinksFromLockfile: false -devDependencies: - '@babel/cli': - specifier: ^7.23.0 - version: 7.23.0(@babel/core@7.23.2) - '@babel/core': - specifier: ^7.23.0 - version: 7.23.2 - '@babel/plugin-transform-export-namespace-from': - specifier: ^7.22.11 - version: 7.22.11(@babel/core@7.23.2) - '@babel/plugin-transform-modules-commonjs': - specifier: ^7.23.0 - version: 7.23.0(@babel/core@7.23.2) - '@changesets/changelog-github': - specifier: ^0.4.8 - version: 0.4.8 - '@changesets/cli': - specifier: ^2.26.2 - version: 2.26.2 - '@edge-runtime/vm': - specifier: ^3.1.6 - version: 3.1.6 - '@effect/build-utils': - specifier: ^0.3.1 - version: 0.3.1 - '@effect/docgen': - specifier: ^0.3.1 - version: 0.3.1(fast-check@3.13.2)(tsx@3.14.0)(typescript@5.2.2) - '@effect/dtslint': - specifier: ^0.0.3 - version: 0.0.3(typescript@5.2.2) - '@effect/eslint-plugin': - specifier: ^0.1.2 - version: 0.1.2 - '@effect/language-service': - specifier: ^0.0.21 - version: 0.0.21 - '@size-limit/preset-small-lib': - specifier: ^10.0.2 - version: 10.0.2(size-limit@10.0.2) - '@types/node': - specifier: ^20.8.4 - version: 20.8.9 - '@typescript-eslint/eslint-plugin': - specifier: ^6.7.5 - version: 6.9.0(@typescript-eslint/parser@6.9.0)(eslint@8.52.0)(typescript@5.2.2) - '@typescript-eslint/parser': - specifier: ^6.7.5 - version: 6.9.0(eslint@8.52.0)(typescript@5.2.2) - '@vitest/browser': - specifier: ^0.34.6 - version: 0.34.6(esbuild@0.18.20)(vitest@0.34.6) - '@vitest/coverage-v8': - specifier: ^0.34.6 - version: 0.34.6(vitest@0.34.6) - babel-plugin-annotate-pure-calls: - specifier: ^0.4.0 - version: 0.4.0(@babel/core@7.23.2) - eslint: - specifier: ^8.51.0 - version: 8.52.0 - eslint-import-resolver-typescript: - specifier: ^3.6.1 - version: 3.6.1(@typescript-eslint/parser@6.9.0)(eslint-plugin-import@2.29.0)(eslint@8.52.0) - eslint-plugin-codegen: - specifier: ^0.17.0 - version: 0.17.0 - eslint-plugin-deprecation: - specifier: ^2.0.0 - version: 2.0.0(eslint@8.52.0)(typescript@5.2.2) - eslint-plugin-import: - specifier: ^2.28.1 - version: 2.29.0(@typescript-eslint/parser@6.9.0)(eslint-import-resolver-typescript@3.6.1)(eslint@8.52.0) - eslint-plugin-simple-import-sort: - specifier: ^10.0.0 - version: 10.0.0(eslint@8.52.0) - eslint-plugin-sort-destructure-keys: - specifier: ^1.5.0 - version: 1.5.0(eslint@8.52.0) - fast-check: - specifier: ^3.13.1 - version: 3.13.2 - madge: - specifier: ^6.1.0 - version: 6.1.0(typescript@5.2.2) - playwright: - specifier: ^1.39.0 - version: 1.39.0 - prettier: - specifier: ^3.0.3 - version: 3.0.3 - rimraf: - specifier: ^5.0.5 - version: 5.0.5 - size-limit: - specifier: ^10.0.2 - version: 10.0.2 - tsx: - specifier: ^3.14.0 - version: 3.14.0 - typescript: - specifier: ^5.2.2 - version: 5.2.2 - vite: - specifier: ^4.4.11 - version: 4.5.0(@types/node@20.8.9) - vitest: - specifier: ^0.34.6 - version: 0.34.6(@edge-runtime/vm@3.1.6)(@vitest/browser@0.34.6)(playwright@1.39.0) +patchedDependencies: + '@changesets/assemble-release-plan@5.2.4': + hash: z2vvyydifzjx5lfl7g6is67lqy + path: patches/@changesets__assemble-release-plan@5.2.4.patch + +importers: + + .: + devDependencies: + '@babel/cli': + specifier: ^7.23.0 + version: 7.23.0(@babel/core@7.23.3) + '@babel/core': + specifier: ^7.23.0 + version: 7.23.3 + '@babel/plugin-transform-export-namespace-from': + specifier: ^7.22.11 + version: 7.23.3(@babel/core@7.23.3) + '@babel/plugin-transform-modules-commonjs': + specifier: ^7.23.0 + version: 7.23.3(@babel/core@7.23.3) + '@changesets/changelog-github': + specifier: ^0.4.8 + version: 0.4.8 + '@changesets/cli': + specifier: ^2.26.2 + version: 2.26.2 + '@edge-runtime/vm': + specifier: ^3.1.6 + version: 3.1.7 + '@effect/build-utils': + specifier: ^0.4.1 + version: 0.4.1 + '@effect/docgen': + specifier: ^0.3.1 + version: 0.3.3(tsx@4.1.2)(typescript@5.2.2) + '@effect/dtslint': + specifier: ^0.0.3 + version: 0.0.3(typescript@5.2.2) + '@effect/eslint-plugin': + specifier: ^0.1.2 + version: 0.1.2 + '@effect/language-service': + specifier: ^0.0.21 + version: 0.0.21 + '@size-limit/preset-small-lib': + specifier: ^11.0.0 + version: 11.0.0(size-limit@11.0.0) + '@types/node': + specifier: ^20.8.4 + version: 20.9.0 + '@typescript-eslint/eslint-plugin': + specifier: ^6.7.5 + version: 6.11.0(@typescript-eslint/parser@6.11.0)(eslint@8.53.0)(typescript@5.2.2) + '@typescript-eslint/parser': + specifier: ^6.7.5 + version: 6.11.0(eslint@8.53.0)(typescript@5.2.2) + '@vitest/browser': + specifier: ^0.34.6 + version: 0.34.6(esbuild@0.18.20)(vitest@0.34.6) + '@vitest/coverage-v8': + specifier: ^0.34.6 + version: 0.34.6(vitest@0.34.6) + babel-plugin-annotate-pure-calls: + specifier: ^0.4.0 + version: 0.4.0(@babel/core@7.23.3) + eslint: + specifier: ^8.51.0 + version: 8.53.0 + eslint-import-resolver-typescript: + specifier: ^3.6.1 + version: 3.6.1(@typescript-eslint/parser@6.11.0)(eslint-plugin-import@2.29.0)(eslint@8.53.0) + eslint-plugin-codegen: + specifier: ^0.18.1 + version: 0.18.1 + eslint-plugin-deprecation: + specifier: ^2.0.0 + version: 2.0.0(eslint@8.53.0)(typescript@5.2.2) + eslint-plugin-import: + specifier: ^2.28.1 + version: 2.29.0(@typescript-eslint/parser@6.11.0)(eslint-import-resolver-typescript@3.6.1)(eslint@8.53.0) + eslint-plugin-simple-import-sort: + specifier: ^10.0.0 + version: 10.0.0(eslint@8.53.0) + eslint-plugin-sort-destructure-keys: + specifier: ^1.5.0 + version: 1.5.0(eslint@8.53.0) + fast-check: + specifier: ^3.13.1 + version: 3.13.2 + madge: + specifier: ^6.1.0 + version: 6.1.0(typescript@5.2.2) + playwright: + specifier: ^1.39.0 + version: 1.39.0 + prettier: + specifier: ^3.0.3 + version: 3.1.0 + rimraf: + specifier: ^5.0.5 + version: 5.0.5 + size-limit: + specifier: ^11.0.0 + version: 11.0.0 + tsx: + specifier: ^4.1.2 + version: 4.1.2 + typescript: + specifier: ^5.2.2 + version: 5.2.2 + vite: + specifier: ^4.4.11 + version: 4.5.0(@types/node@20.9.0) + vitest: + specifier: ^0.34.6 + version: 0.34.6(@edge-runtime/vm@3.1.7)(@vitest/browser@0.34.6)(playwright@1.39.0) + + packages/effect: + publishDirectory: dist packages: @@ -129,14 +140,14 @@ packages: '@jridgewell/trace-mapping': 0.3.20 dev: true - /@babel/cli@7.23.0(@babel/core@7.23.2): + /@babel/cli@7.23.0(@babel/core@7.23.3): resolution: {integrity: sha512-17E1oSkGk2IwNILM4jtfAvgjt+ohmpfBky8aLerUfYZhiPNg7ca+CRCxZn8QDxwNhV/upsc2VHBCqGFIR+iBfA==} engines: {node: '>=6.9.0'} hasBin: true peerDependencies: '@babel/core': ^7.0.0-0 dependencies: - '@babel/core': 7.23.2 + '@babel/core': 7.23.3 '@jridgewell/trace-mapping': 0.3.20 commander: 4.1.1 convert-source-map: 2.0.0 @@ -157,25 +168,25 @@ packages: chalk: 2.4.2 dev: true - /@babel/compat-data@7.23.2: - resolution: {integrity: sha512-0S9TQMmDHlqAZ2ITT95irXKfxN9bncq8ZCoJhun3nHL/lLUxd2NKBJYoNGWH7S0hz6fRQwWlAWn/ILM0C70KZQ==} + /@babel/compat-data@7.23.3: + resolution: {integrity: sha512-BmR4bWbDIoFJmJ9z2cZ8Gmm2MXgEDgjdWgpKmKWUt54UGFJdlj31ECtbaDvCG/qVdG3AQ1SfpZEs01lUFbzLOQ==} engines: {node: '>=6.9.0'} dev: true - /@babel/core@7.23.2: - resolution: {integrity: sha512-n7s51eWdaWZ3vGT2tD4T7J6eJs3QoBXydv7vkUM06Bf1cbVD2Kc2UrkzhiQwobfV7NwOnQXYL7UBJ5VPU+RGoQ==} + /@babel/core@7.23.3: + resolution: {integrity: sha512-Jg+msLuNuCJDyBvFv5+OKOUjWMZgd85bKjbICd3zWrKAo+bJ49HJufi7CQE0q0uR8NGyO6xkCACScNqyjHSZew==} engines: {node: '>=6.9.0'} dependencies: '@ampproject/remapping': 2.2.1 '@babel/code-frame': 7.22.13 - '@babel/generator': 7.23.0 + '@babel/generator': 7.23.3 '@babel/helper-compilation-targets': 7.22.15 - '@babel/helper-module-transforms': 7.23.0(@babel/core@7.23.2) + '@babel/helper-module-transforms': 7.23.3(@babel/core@7.23.3) '@babel/helpers': 7.23.2 - '@babel/parser': 7.23.0 + '@babel/parser': 7.23.3 '@babel/template': 7.22.15 - '@babel/traverse': 7.23.2 - '@babel/types': 7.23.0 + '@babel/traverse': 7.23.3 + '@babel/types': 7.23.3 convert-source-map: 2.0.0 debug: 4.3.4 gensync: 1.0.0-beta.2 @@ -188,16 +199,16 @@ packages: /@babel/generator@7.12.17: resolution: {integrity: sha512-DSA7ruZrY4WI8VxuS1jWSRezFnghEoYEFrZcw9BizQRmOZiUsiHl59+qEARGPqPikwA/GPTyRCi7isuCK/oyqg==} dependencies: - '@babel/types': 7.23.0 + '@babel/types': 7.23.3 jsesc: 2.5.2 source-map: 0.5.7 dev: true - /@babel/generator@7.23.0: - resolution: {integrity: sha512-lN85QRR+5IbYrMWM6Y4pE/noaQtg4pNiqeNGX60eqOfo6gtEj6uw/JagelB8vVztSd7R6M5n1+PQkDbHbBRU4g==} + /@babel/generator@7.23.3: + resolution: {integrity: sha512-keeZWAV4LU3tW0qRi19HRpabC/ilM0HRBBzf9/k8FFiG4KVpiv0FIy4hHfLfFQZNhziCTPTmd59zoyv6DNISzg==} engines: {node: '>=6.9.0'} dependencies: - '@babel/types': 7.23.0 + '@babel/types': 7.23.3 '@jridgewell/gen-mapping': 0.3.3 '@jridgewell/trace-mapping': 0.3.20 jsesc: 2.5.2 @@ -207,7 +218,7 @@ packages: resolution: {integrity: sha512-y6EEzULok0Qvz8yyLkCvVX+02ic+By2UdOhylwUOvOn9dvYc9mKICJuuU1n1XBI02YWsNsnrY1kc6DVbjcXbtw==} engines: {node: '>=6.9.0'} dependencies: - '@babel/compat-data': 7.23.2 + '@babel/compat-data': 7.23.3 '@babel/helper-validator-option': 7.22.15 browserslist: 4.22.1 lru-cache: 5.1.1 @@ -224,30 +235,30 @@ packages: engines: {node: '>=6.9.0'} dependencies: '@babel/template': 7.22.15 - '@babel/types': 7.23.0 + '@babel/types': 7.23.3 dev: true /@babel/helper-hoist-variables@7.22.5: resolution: {integrity: sha512-wGjk9QZVzvknA6yKIUURb8zY3grXCcOZt+/7Wcy8O2uctxhplmUPkOdlgoNhmdVee2c92JXbf1xpMtVNbfoxRw==} engines: {node: '>=6.9.0'} dependencies: - '@babel/types': 7.23.0 + '@babel/types': 7.23.3 dev: true /@babel/helper-module-imports@7.22.15: resolution: {integrity: sha512-0pYVBnDKZO2fnSPCrgM/6WMc7eS20Fbok+0r88fp+YtWVLZrp4CkafFGIp+W0VKw4a22sgebPT99y+FDNMdP4w==} engines: {node: '>=6.9.0'} dependencies: - '@babel/types': 7.23.0 + '@babel/types': 7.23.3 dev: true - /@babel/helper-module-transforms@7.23.0(@babel/core@7.23.2): - resolution: {integrity: sha512-WhDWw1tdrlT0gMgUJSlX0IQvoO1eN279zrAUbVB+KpV2c3Tylz8+GnKOLllCS6Z/iZQEyVYxhZVUdPTqs2YYPw==} + /@babel/helper-module-transforms@7.23.3(@babel/core@7.23.3): + resolution: {integrity: sha512-7bBs4ED9OmswdfDzpz4MpWgSrV7FXlc3zIagvLFjS5H+Mk7Snr21vQ6QwrsoCGMfNC4e4LQPdoULEt4ykz0SRQ==} engines: {node: '>=6.9.0'} peerDependencies: '@babel/core': ^7.0.0 dependencies: - '@babel/core': 7.23.2 + '@babel/core': 7.23.3 '@babel/helper-environment-visitor': 7.22.20 '@babel/helper-module-imports': 7.22.15 '@babel/helper-simple-access': 7.22.5 @@ -264,14 +275,14 @@ packages: resolution: {integrity: sha512-n0H99E/K+Bika3++WNL17POvo4rKWZ7lZEp1Q+fStVbUi8nxPQEBOlTmCOxW/0JsS56SKKQ+ojAe2pHKJHN35w==} engines: {node: '>=6.9.0'} dependencies: - '@babel/types': 7.23.0 + '@babel/types': 7.23.3 dev: true /@babel/helper-split-export-declaration@7.22.6: resolution: {integrity: sha512-AsUnxuLhRYsisFiaJwvp1QF+I3KjD5FOxut14q/GzovUe6orHLesW2C7d754kRm53h5gqrz6sFl6sxc4BVtE/g==} engines: {node: '>=6.9.0'} dependencies: - '@babel/types': 7.23.0 + '@babel/types': 7.23.3 dev: true /@babel/helper-string-parser@7.22.5: @@ -294,8 +305,8 @@ packages: engines: {node: '>=6.9.0'} dependencies: '@babel/template': 7.22.15 - '@babel/traverse': 7.23.2 - '@babel/types': 7.23.0 + '@babel/traverse': 7.23.3 + '@babel/types': 7.23.3 transitivePeerDependencies: - supports-color dev: true @@ -309,42 +320,42 @@ packages: js-tokens: 4.0.0 dev: true - /@babel/parser@7.23.0: - resolution: {integrity: sha512-vvPKKdMemU85V9WE/l5wZEmImpCtLqbnTvqDS2U1fJ96KrxoW7KrXhNsNCblQlg8Ck4b85yxdTyelsMUgFUXiw==} + /@babel/parser@7.23.3: + resolution: {integrity: sha512-uVsWNvlVsIninV2prNz/3lHCb+5CJ+e+IUBfbjToAHODtfGYLfCFuY4AU7TskI+dAKk+njsPiBjq1gKTvZOBaw==} engines: {node: '>=6.0.0'} hasBin: true dependencies: - '@babel/types': 7.23.0 + '@babel/types': 7.23.3 dev: true - /@babel/plugin-syntax-export-namespace-from@7.8.3(@babel/core@7.23.2): + /@babel/plugin-syntax-export-namespace-from@7.8.3(@babel/core@7.23.3): resolution: {integrity: sha512-MXf5laXo6c1IbEbegDmzGPwGNTsHZmEy6QGznu5Sh2UCWvueywb2ee+CCE4zQiZstxU9BMoQO9i6zUFSY0Kj0Q==} peerDependencies: '@babel/core': ^7.0.0-0 dependencies: - '@babel/core': 7.23.2 + '@babel/core': 7.23.3 '@babel/helper-plugin-utils': 7.22.5 dev: true - /@babel/plugin-transform-export-namespace-from@7.22.11(@babel/core@7.23.2): - resolution: {integrity: sha512-xa7aad7q7OiT8oNZ1mU7NrISjlSkVdMbNxn9IuLZyL9AJEhs1Apba3I+u5riX1dIkdptP5EKDG5XDPByWxtehw==} + /@babel/plugin-transform-export-namespace-from@7.23.3(@babel/core@7.23.3): + resolution: {integrity: sha512-yCLhW34wpJWRdTxxWtFZASJisihrfyMOTOQexhVzA78jlU+dH7Dw+zQgcPepQ5F3C6bAIiblZZ+qBggJdHiBAg==} engines: {node: '>=6.9.0'} peerDependencies: '@babel/core': ^7.0.0-0 dependencies: - '@babel/core': 7.23.2 + '@babel/core': 7.23.3 '@babel/helper-plugin-utils': 7.22.5 - '@babel/plugin-syntax-export-namespace-from': 7.8.3(@babel/core@7.23.2) + '@babel/plugin-syntax-export-namespace-from': 7.8.3(@babel/core@7.23.3) dev: true - /@babel/plugin-transform-modules-commonjs@7.23.0(@babel/core@7.23.2): - resolution: {integrity: sha512-32Xzss14/UVc7k9g775yMIvkVK8xwKE0DPdP5JTapr3+Z9w4tzeOuLNY6BXDQR6BdnzIlXnCGAzsk/ICHBLVWQ==} + /@babel/plugin-transform-modules-commonjs@7.23.3(@babel/core@7.23.3): + resolution: {integrity: sha512-aVS0F65LKsdNOtcz6FRCpE4OgsP2OFnW46qNxNIX9h3wuzaNcSQsJysuMwqSibC98HPrf2vCgtxKNwS0DAlgcA==} engines: {node: '>=6.9.0'} peerDependencies: '@babel/core': ^7.0.0-0 dependencies: - '@babel/core': 7.23.2 - '@babel/helper-module-transforms': 7.23.0(@babel/core@7.23.2) + '@babel/core': 7.23.3 + '@babel/helper-module-transforms': 7.23.3(@babel/core@7.23.3) '@babel/helper-plugin-utils': 7.22.5 '@babel/helper-simple-access': 7.22.5 dev: true @@ -361,30 +372,30 @@ packages: engines: {node: '>=6.9.0'} dependencies: '@babel/code-frame': 7.22.13 - '@babel/parser': 7.23.0 - '@babel/types': 7.23.0 + '@babel/parser': 7.23.3 + '@babel/types': 7.23.3 dev: true - /@babel/traverse@7.23.2: - resolution: {integrity: sha512-azpe59SQ48qG6nu2CzcMLbxUudtN+dOM9kDbUqGq3HXUJRlo7i8fvPoxQUzYgLZ4cMVmuZgm8vvBpNeRhd6XSw==} + /@babel/traverse@7.23.3: + resolution: {integrity: sha512-+K0yF1/9yR0oHdE0StHuEj3uTPzwwbrLGfNOndVJVV2TqA5+j3oljJUb4nmB954FLGjNem976+B+eDuLIjesiQ==} engines: {node: '>=6.9.0'} dependencies: '@babel/code-frame': 7.22.13 - '@babel/generator': 7.23.0 + '@babel/generator': 7.23.3 '@babel/helper-environment-visitor': 7.22.20 '@babel/helper-function-name': 7.23.0 '@babel/helper-hoist-variables': 7.22.5 '@babel/helper-split-export-declaration': 7.22.6 - '@babel/parser': 7.23.0 - '@babel/types': 7.23.0 + '@babel/parser': 7.23.3 + '@babel/types': 7.23.3 debug: 4.3.4 globals: 11.12.0 transitivePeerDependencies: - supports-color dev: true - /@babel/types@7.23.0: - resolution: {integrity: sha512-0oIyUfKoI3mSqMvsxBdclDwxXKXAUA8v/apZbc+iSyARYou1o8ZGDxbUYyLFoW2arqS2jDGqJuZvv1d/io1axg==} + /@babel/types@7.23.3: + resolution: {integrity: sha512-OZnvoH2l8PK5eUvEcUyCt/sXgr/h+UWpVuBbOljwcrAgUl6lpchoQ++PHGyQy1AtYnVA6CEq3y5xeEI10brpXw==} engines: {node: '>=6.9.0'} dependencies: '@babel/helper-string-parser': 7.22.5 @@ -414,7 +425,7 @@ packages: semver: 7.5.4 dev: true - /@changesets/assemble-release-plan@5.2.4: + /@changesets/assemble-release-plan@5.2.4(patch_hash=z2vvyydifzjx5lfl7g6is67lqy): resolution: {integrity: sha512-xJkWX+1/CUaOUWTguXEbCDTyWJFECEhmdtbkjhn5GVBGxdP/JwaHBIU9sW3FR6gD07UwZ7ovpiPclQZs+j+mvg==} dependencies: '@babel/runtime': 7.23.2 @@ -424,6 +435,7 @@ packages: '@manypkg/get-packages': 1.1.3 semver: 7.5.4 dev: true + patched: true /@changesets/changelog-git@0.1.14: resolution: {integrity: sha512-+vRfnKtXVWsDDxGctOfzJsPhaCdXRYoe+KyWYoq5X/GqoISREiat0l3L8B0a453B2B4dfHGcZaGyowHbp9BSaA==} @@ -447,7 +459,7 @@ packages: dependencies: '@babel/runtime': 7.23.2 '@changesets/apply-release-plan': 6.1.4 - '@changesets/assemble-release-plan': 5.2.4 + '@changesets/assemble-release-plan': 5.2.4(patch_hash=z2vvyydifzjx5lfl7g6is67lqy) '@changesets/changelog-git': 0.1.14 '@changesets/config': 2.3.1 '@changesets/errors': 0.1.4 @@ -460,8 +472,8 @@ packages: '@changesets/types': 5.2.1 '@changesets/write': 0.2.3 '@manypkg/get-packages': 1.1.3 - '@types/is-ci': 3.0.3 - '@types/semver': 7.5.4 + '@types/is-ci': 3.0.4 + '@types/semver': 7.5.5 ansi-colors: 4.1.3 chalk: 2.4.2 enquirer: 2.4.1 @@ -521,7 +533,7 @@ packages: resolution: {integrity: sha512-6IwKTubNEgoOZwDontYc2x2cWXfr6IKxP3IhKeK+WjyD6y3M4Gl/jdQvBw+m/5zWILSOCAaGLu2ZF6Q+WiPniw==} dependencies: '@babel/runtime': 7.23.2 - '@changesets/assemble-release-plan': 5.2.4 + '@changesets/assemble-release-plan': 5.2.4(patch_hash=z2vvyydifzjx5lfl7g6is67lqy) '@changesets/config': 2.3.1 '@changesets/pre': 1.0.14 '@changesets/read': 0.5.9 @@ -615,46 +627,38 @@ packages: resolution: {integrity: sha512-rPwwm/RrFIolz6xHa8Kzpshuwpe+xu/XcEw9iUmRF2tnyIwxxaW7XoFKaQ+GfPju81cKpH4vJeq7/2IizKvyjg==} dev: true - /@edge-runtime/primitives@4.0.4: - resolution: {integrity: sha512-ktlFVHheT3mXz++atzAB13p/+VLMLiinWvn68/wfpLjsat/LuCccOGuNIe8gLPdVbucvw6N8TTn39iRVwz4gxA==} + /@edge-runtime/primitives@4.0.5: + resolution: {integrity: sha512-t7QiN5d/KpXgCvIfSt6Nm9Hj3WVdNgc5CpOD73jasY+9EvTI7Ngdj5cXvjcHrPcmYWJZMySPgeEeoL/1N/Llag==} engines: {node: '>=16'} dev: true - /@edge-runtime/vm@3.1.6: - resolution: {integrity: sha512-ChMpk3eBZegGIkHjoDDQhnnx+c5rzolC/2+NNymVJsivHtTVMIYQAOdG4jyTUMhmmrEGnXUgnHxOflR+1M4SIA==} + /@edge-runtime/vm@3.1.7: + resolution: {integrity: sha512-hUMFbDQ/nZN+1TLMi6iMO1QFz9RSV8yGG8S42WFPFma1d7VSNE0eMdJUmwjmtav22/iQkzHMmu6oTSfAvRGS8g==} engines: {node: '>=16'} dependencies: - '@edge-runtime/primitives': 4.0.4 + '@edge-runtime/primitives': 4.0.5 dev: true - /@effect/build-utils@0.3.1: - resolution: {integrity: sha512-MoyN7zj3Y068rV08SDaOSAyoKXjOSgG2C4O1fHuDmihnti5XLNt0rpCORbPhQhIwzFp14YLYeZihp3ypDmWlQQ==} + /@effect/build-utils@0.4.1: + resolution: {integrity: sha512-p4Fm6jAnXEi1HaG6lRQN6uBWfFmMpoXetedMshuKO19EFk9OSAkcTl4Hb2wiE/Ex34xsmxg9gKlFpAZR6gc0ww==} engines: {node: '>=16.17.1'} hasBin: true dev: true - /@effect/docgen@0.3.1(fast-check@3.13.2)(tsx@3.14.0)(typescript@5.2.2): - resolution: {integrity: sha512-4Lc+fKBkxz9rC+XjI3buB3bSNkiBaYT4cxynxt+G4n0pP+BDsztn75Bl+tKlGCTJUROhD2bhadmn3R2ydRslqA==} + /@effect/docgen@0.3.3(tsx@4.1.2)(typescript@5.2.2): + resolution: {integrity: sha512-9UtuKZ2r1ZPfAf9RxkZ7u5H8Lc8HdrzXIROJrs8DXxNDBDeFdZWbMksCfIPqSkFGDgBrCIOEFDUS11JCmk/udA==} engines: {node: '>=16.17.1'} hasBin: true peerDependencies: - tsx: ^3.14.0 + tsx: ^4.1.0 typescript: ^5.2.2 dependencies: - '@effect/platform-node': 0.28.2(@effect/schema@0.47.2)(effect@2.0.0-next.54) - '@effect/schema': 0.47.2(effect@2.0.0-next.54)(fast-check@3.13.2) - chalk: 5.3.0 doctrine: 3.0.0 - effect: 2.0.0-next.54 glob: 10.3.10 markdown-toc: github.com/effect-ts/markdown-toc/4bfeb0f140105440ea0d12df2fa23199cc3ec1d5 - prettier: 3.0.3 - ts-morph: 20.0.0 - tsconfck: 3.0.0(typescript@5.2.2) - tsx: 3.14.0 + prettier: 3.1.0 + tsx: 4.1.2 typescript: 5.2.2 - transitivePeerDependencies: - - fast-check dev: true /@effect/dtslint@0.0.3(typescript@5.2.2): @@ -680,42 +684,6 @@ packages: resolution: {integrity: sha512-e8vfKbjnbYiyneBincEFS0tzXluopGK77OkVFbPRtUbNDS5tJfb+jiwOQEiqASDsadcZmd+9J9+Q6v/z7GuN2g==} dev: true - /@effect/platform-node@0.28.2(@effect/schema@0.47.2)(effect@2.0.0-next.54): - resolution: {integrity: sha512-KU+ta/gantpbD5lnZBcgTuu7lgxeHQCy0dvvY2iieOG2UMzo8yogBLTTrjlpcbruFsriXEkF5+/y2uzyb17SDg==} - engines: {node: '>=18.0.0'} - peerDependencies: - effect: 2.0.0-next.54 - dependencies: - '@effect/platform': 0.27.2(@effect/schema@0.47.2)(effect@2.0.0-next.54) - busboy: 1.6.0 - effect: 2.0.0-next.54 - mime: 3.0.0 - transitivePeerDependencies: - - '@effect/schema' - dev: true - - /@effect/platform@0.27.2(@effect/schema@0.47.2)(effect@2.0.0-next.54): - resolution: {integrity: sha512-Ya8clQi5FWdlrsyPfhsh4zldvDM+NZe50QPANVXByqOpAWTw3XgPNRTMom/Yx464+VTORN6Pc4q82THWat1iOA==} - peerDependencies: - '@effect/schema': ^0.47.1 - effect: 2.0.0-next.54 - dependencies: - '@effect/schema': 0.47.2(effect@2.0.0-next.54)(fast-check@3.13.2) - effect: 2.0.0-next.54 - find-my-way: 7.7.0 - path-browserify: 1.0.1 - dev: true - - /@effect/schema@0.47.2(effect@2.0.0-next.54)(fast-check@3.13.2): - resolution: {integrity: sha512-AwZg9c/NCD2rKEQuWjQUwFMWBi7xokJyL3jid5jtiLB7kjmrtRnHBxleeOEVoSrdBMJu6yXle3HvdHXefyA2jQ==} - peerDependencies: - effect: 2.0.0-next.54 - fast-check: ^3.13.2 - dependencies: - effect: 2.0.0-next.54 - fast-check: 3.13.2 - dev: true - /@esbuild/android-arm64@0.18.20: resolution: {integrity: sha512-Nz4rJcchGDtENV0eMKUNa6L12zz2zBDXuhj/Vjh18zGqB44Bi7MBMSXjgunJgjRhCmKOjnPuZp4Mb6OKqtMHLQ==} engines: {node: '>=12'} @@ -1112,13 +1080,13 @@ packages: dev: true optional: true - /@eslint-community/eslint-utils@4.4.0(eslint@8.52.0): + /@eslint-community/eslint-utils@4.4.0(eslint@8.53.0): resolution: {integrity: sha512-1/sA4dwrzBAyeUoQ6oxahHKmrZvsnLCg4RfxW3ZFGGmQkSNQPFNLV9CUEFQP1x9EYXHTo5p6xdhZM1Ne9p/AfA==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: eslint: ^6.0.0 || ^7.0.0 || >=8.0.0 dependencies: - eslint: 8.52.0 + eslint: 8.53.0 eslint-visitor-keys: 3.4.3 dev: true @@ -1127,8 +1095,8 @@ packages: engines: {node: ^12.0.0 || ^14.0.0 || >=16.0.0} dev: true - /@eslint/eslintrc@2.1.2: - resolution: {integrity: sha512-+wvgpDsrB1YqAMdEUCcnTlpfVBH7Vqn6A/NT3D8WVXFIaKMlErPIZT3oCIAVCOtarRpMtelZLqJeU3t7WY6X6g==} + /@eslint/eslintrc@2.1.3: + resolution: {integrity: sha512-yZzuIG+jnVu6hNSzFEN07e8BxF3uAzYtQb6uDkaYZLo6oYZDCq454c5kB8zxnzfCYyP4MIuyBn10L0DqwujTmA==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} dependencies: ajv: 6.12.6 @@ -1144,8 +1112,8 @@ packages: - supports-color dev: true - /@eslint/js@8.52.0: - resolution: {integrity: sha512-mjZVbpaeMZludF2fsWLD0Z9gCref1Tk4i9+wddjRvpUNqqcndPkBD09N/Mapey0b3jaXbLm2kICwFv2E64QinA==} + /@eslint/js@8.53.0: + resolution: {integrity: sha512-Kn7K8dx/5U6+cT1yEhpX1w4PCSg0M+XyRILPgvwcEBjerFWCwQj5sbr3/VmxqV0JGHCBCzyd6LxypEuehypY1w==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} dev: true @@ -1197,10 +1165,10 @@ packages: resolution: {integrity: sha512-fC6QCp7Sc5sX6g8Tvbmj4XUTbyrik0akgRy03yjXbQaBWWNWGE7SGtJk98m0N8nzegD/7SggrUlivxo5ax4KWQ==} engines: {node: '>= 10.14.2'} dependencies: - '@types/istanbul-lib-coverage': 2.0.5 - '@types/istanbul-reports': 3.0.3 - '@types/node': 20.8.9 - '@types/yargs': 15.0.17 + '@types/istanbul-lib-coverage': 2.0.6 + '@types/istanbul-reports': 3.0.4 + '@types/node': 20.9.0 + '@types/yargs': 15.0.18 chalk: 4.1.2 dev: true @@ -1305,7 +1273,7 @@ packages: rollup: optional: true dependencies: - '@types/estree': 1.0.4 + '@types/estree': 1.0.5 estree-walker: 2.0.2 picomatch: 2.3.1 dev: true @@ -1314,128 +1282,123 @@ packages: resolution: {integrity: sha512-+Fj43pSMwJs4KRrH/938Uf+uAELIgVBmQzg/q1YG10djyfA3TnrU8N8XzqCh/okZdszqBQTZf96idMfE5lnwTA==} dev: true - /@size-limit/esbuild@10.0.2(size-limit@10.0.2): - resolution: {integrity: sha512-RaVAAp4BDxMBkSAzv23Mk6rWw/tgmvcqhO7g9EF8Co2q2sEH2vTK1ucAwisJyO1frVSmmkS+MuYLIrmjW8CxEw==} + /@sindresorhus/merge-streams@1.0.0: + resolution: {integrity: sha512-rUV5WyJrJLoloD4NDN1V1+LDMDWOa4OTsT4yYJwQNpTU6FWxkxHpL7eu4w+DmiH8x/EAM1otkPE1+LaspIbplw==} + engines: {node: '>=18'} + dev: true + + /@size-limit/esbuild@11.0.0(size-limit@11.0.0): + resolution: {integrity: sha512-OOmba2ZuMpaUhmBXgCfgrO7L6zkUDwvFFfW8T+dK08968LQ79Q+kNgEXQAd+dhj9TlTkHyyEDczWmx16e9cXoQ==} engines: {node: ^18.0.0 || >=20.0.0} peerDependencies: - size-limit: 10.0.2 + size-limit: 11.0.0 dependencies: esbuild: 0.19.5 nanoid: 5.0.3 - size-limit: 10.0.2 + size-limit: 11.0.0 dev: true - /@size-limit/file@10.0.2(size-limit@10.0.2): - resolution: {integrity: sha512-27jzgQtER/2WP4+ciLe8aExkceSfqQFSDEbFVhXnbpFvQBqGZ7uEQG9bDX7a5VGxTdMtGwzZndMsCOlinmLzSg==} + /@size-limit/file@11.0.0(size-limit@11.0.0): + resolution: {integrity: sha512-tTg6sSiFbiogiof3GV4iIRCPS4+46Hvq4QWXGXp00Be/tOnpglXF62xNpCfFwefx9YCXxCyeYSqqaRBjpRCsmQ==} engines: {node: ^18.0.0 || >=20.0.0} peerDependencies: - size-limit: 10.0.2 + size-limit: 11.0.0 dependencies: - semver: 7.5.4 - size-limit: 10.0.2 + size-limit: 11.0.0 dev: true - /@size-limit/preset-small-lib@10.0.2(size-limit@10.0.2): - resolution: {integrity: sha512-VK9uKlGILqTYaBszvJ8eoiLoFbmb03/LpZanqs8jzKwdvexOEH86OHtfi9rin8VWseAfQYHHLklJ3xwbSb4xCQ==} + /@size-limit/preset-small-lib@11.0.0(size-limit@11.0.0): + resolution: {integrity: sha512-B4KDPbx5E8Vsn/aXilt2iAeofRBJdT8svQRSylTQPw5RkrumXUBKioM1dmWUXcnuHR2zUveJXlMxGmbdmxbJpQ==} peerDependencies: - size-limit: 10.0.2 + size-limit: 11.0.0 dependencies: - '@size-limit/esbuild': 10.0.2(size-limit@10.0.2) - '@size-limit/file': 10.0.2(size-limit@10.0.2) - size-limit: 10.0.2 + '@size-limit/esbuild': 11.0.0(size-limit@11.0.0) + '@size-limit/file': 11.0.0(size-limit@11.0.0) + size-limit: 11.0.0 dev: true - /@ts-morph/common@0.21.0: - resolution: {integrity: sha512-ES110Mmne5Vi4ypUKrtVQfXFDtCsDXiUiGxF6ILVlE90dDD4fdpC1LSjydl/ml7xJWKSDZwUYD2zkOePMSrPBA==} + /@types/chai-subset@1.3.5: + resolution: {integrity: sha512-c2mPnw+xHtXDoHmdtcCXGwyLMiauiAyxWMzhGpqHC4nqI/Y5G2XhTampslK2rb59kpcuHon03UH8W6iYUzw88A==} dependencies: - fast-glob: 3.3.1 - minimatch: 7.4.6 - mkdirp: 2.1.6 - path-browserify: 1.0.1 + '@types/chai': 4.3.10 dev: true - /@types/chai-subset@1.3.4: - resolution: {integrity: sha512-CCWNXrJYSUIojZ1149ksLl3AN9cmZ5djf+yUoVVV+NuYrtydItQVlL2ZDqyC6M6O9LWRnVf8yYDxbXHO2TfQZg==} - dependencies: - '@types/chai': 4.3.9 - dev: true - - /@types/chai@4.3.9: - resolution: {integrity: sha512-69TtiDzu0bcmKQv3yg1Zx409/Kd7r0b5F1PfpYJfSHzLGtB53547V4u+9iqKYsTu/O2ai6KTb0TInNpvuQ3qmg==} + /@types/chai@4.3.10: + resolution: {integrity: sha512-of+ICnbqjmFCiixUnqRulbylyXQrPqIGf/B3Jax1wIF3DvSheysQxAWvqHhZiW3IQrycvokcLcFQlveGp+vyNg==} dev: true - /@types/estree@1.0.4: - resolution: {integrity: sha512-2JwWnHK9H+wUZNorf2Zr6ves96WHoWDJIftkcxPKsS7Djta6Zu519LarhRNljPXkpsZR2ZMwNCPeW7omW07BJw==} + /@types/estree@1.0.5: + resolution: {integrity: sha512-/kYRxGDLWzHOB7q+wtSUQlFrtcdUccpfy+X+9iMBpHK8QLLhx2wIPYuS5DYtR9Wa/YlZAbIovy7qVdB1Aq6Lyw==} dev: true - /@types/is-ci@3.0.3: - resolution: {integrity: sha512-FdHbjLiN2e8fk9QYQyVYZrK8svUDJpxSaSWLUga8EZS1RGAvvrqM9zbVARBtQuYPeLgnJxM2xloOswPwj1o2cQ==} + /@types/is-ci@3.0.4: + resolution: {integrity: sha512-AkCYCmwlXeuH89DagDCzvCAyltI2v9lh3U3DqSg/GrBYoReAaWwxfXCqMx9UV5MajLZ4ZFwZzV4cABGIxk2XRw==} dependencies: ci-info: 3.9.0 dev: true - /@types/istanbul-lib-coverage@2.0.5: - resolution: {integrity: sha512-zONci81DZYCZjiLe0r6equvZut0b+dBRPBN5kBDjsONnutYNtJMoWQ9uR2RkL1gLG9NMTzvf+29e5RFfPbeKhQ==} + /@types/istanbul-lib-coverage@2.0.6: + resolution: {integrity: sha512-2QF/t/auWm0lsy8XtKVPG19v3sSOQlJe/YHZgfjb/KBBHOGSV+J2q/S671rcq9uTBrLAXmZpqJiaQbMT+zNU1w==} dev: true - /@types/istanbul-lib-report@3.0.2: - resolution: {integrity: sha512-8toY6FgdltSdONav1XtUHl4LN1yTmLza+EuDazb/fEmRNCwjyqNVIQWs2IfC74IqjHkREs/nQ2FWq5kZU9IC0w==} + /@types/istanbul-lib-report@3.0.3: + resolution: {integrity: sha512-NQn7AHQnk/RSLOxrBbGyJM/aVQ+pjj5HCgasFxc0K/KhoATfQ/47AyUl15I2yBUpihjmas+a+VJBOqecrFH+uA==} dependencies: - '@types/istanbul-lib-coverage': 2.0.5 + '@types/istanbul-lib-coverage': 2.0.6 dev: true - /@types/istanbul-reports@3.0.3: - resolution: {integrity: sha512-1nESsePMBlf0RPRffLZi5ujYh7IH1BWL4y9pr+Bn3cJBdxz+RTP8bUFljLz9HvzhhOSWKdyBZ4DIivdL6rvgZg==} + /@types/istanbul-reports@3.0.4: + resolution: {integrity: sha512-pk2B1NWalF9toCRu6gjBzR69syFjP4Od8WRAX+0mmf9lAjCRicLOWc+ZrxZHx/0XRjotgkF9t6iaMJ+aXcOdZQ==} dependencies: - '@types/istanbul-lib-report': 3.0.2 + '@types/istanbul-lib-report': 3.0.3 dev: true - /@types/json-schema@7.0.14: - resolution: {integrity: sha512-U3PUjAudAdJBeC2pgN8uTIKgxrb4nlDF3SF0++EldXQvQBGkpFZMSnwQiIoDU77tv45VgNkl/L4ouD+rEomujw==} + /@types/json-schema@7.0.15: + resolution: {integrity: sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==} dev: true /@types/json5@0.0.29: resolution: {integrity: sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ==} dev: true - /@types/minimist@1.2.4: - resolution: {integrity: sha512-Kfe/D3hxHTusnPNRbycJE1N77WHDsdS4AjUYIzlDzhDrS47NrwuL3YW4VITxwR7KCVpzwgy4Rbj829KSSQmwXQ==} + /@types/minimist@1.2.5: + resolution: {integrity: sha512-hov8bUuiLiyFPGyFPE1lwWhmzYbirOXQNNo40+y3zow8aFVTeyn3VWL0VFFfdNddA8S4Vf0Tc062rzyNr7Paag==} dev: true /@types/node@12.20.55: resolution: {integrity: sha512-J8xLz7q2OFulZ2cyGTLE1TbbZcjpno7FaN6zdJNrgAdrJ+DZzh/uFR6YrTb4C+nXakvud8Q4+rbhoIWlYQbUFQ==} dev: true - /@types/node@20.8.9: - resolution: {integrity: sha512-UzykFsT3FhHb1h7yD4CA4YhBHq545JC0YnEz41xkipN88eKQtL6rSgocL5tbAP6Ola9Izm/Aw4Ora8He4x0BHg==} + /@types/node@20.9.0: + resolution: {integrity: sha512-nekiGu2NDb1BcVofVcEKMIwzlx4NjHlcjhoxxKBNLtz15Y1z7MYf549DFvkHSId02Ax6kGwWntIBPC3l/JZcmw==} dependencies: undici-types: 5.26.5 dev: true - /@types/normalize-package-data@2.4.3: - resolution: {integrity: sha512-ehPtgRgaULsFG8x0NeYJvmyH1hmlfsNLujHe9dQEia/7MAJYdzMSi19JtchUHjmBA6XC/75dK55mzZH+RyieSg==} + /@types/normalize-package-data@2.4.4: + resolution: {integrity: sha512-37i+OaWTh9qeK4LSHPsyRC7NahnGotNuZvjLSgcPzblpHB3rrCJxAOgI5gCdKm7coonsaX1Of0ILiTcnZjbfxA==} dev: true - /@types/semver@7.5.4: - resolution: {integrity: sha512-MMzuxN3GdFwskAnb6fz0orFvhfqi752yjaXylr0Rp4oDg5H0Zn1IuyRhDVvYOwAXoJirx2xuS16I3WjxnAIHiQ==} + /@types/semver@7.5.5: + resolution: {integrity: sha512-+d+WYC1BxJ6yVOgUgzK8gWvp5qF8ssV5r4nsDcZWKRWcDQLQ619tvWAxJQYGgBrO1MnLJC7a5GtiYsAoQ47dJg==} dev: true - /@types/stack-utils@2.0.2: - resolution: {integrity: sha512-g7CK9nHdwjK2n0ymT2CW698FuWJRIx+RP6embAzZ2Qi8/ilIrA1Imt2LVSeHUzKvpoi7BhmmQcXz95eS0f2JXw==} + /@types/stack-utils@2.0.3: + resolution: {integrity: sha512-9aEbYZ3TbYMznPdcdr3SmIrLXwC/AKZXQeCf9Pgao5CKb8CyHuEX5jzWPTkvregvhRJHcpRO6BFoGW9ycaOkYw==} dev: true - /@types/yargs-parser@21.0.2: - resolution: {integrity: sha512-5qcvofLPbfjmBfKaLfj/+f+Sbd6pN4zl7w7VSVI5uz7m9QZTuB2aZAa2uo1wHFBNN2x6g/SoTkXmd8mQnQF2Cw==} + /@types/yargs-parser@21.0.3: + resolution: {integrity: sha512-I4q9QU9MQv4oEOz4tAHJtNz1cwuLxn2F3xcc2iV5WdqLPpUnj30aUuxt1mAxYTG+oe8CZMV/+6rU4S4gRDzqtQ==} dev: true - /@types/yargs@15.0.17: - resolution: {integrity: sha512-cj53I8GUcWJIgWVTSVe2L7NJAB5XWGdsoMosVvUgv1jEnMbAcsbaCzt1coUcyi8Sda5PgTWAooG8jNyDTD+CWA==} + /@types/yargs@15.0.18: + resolution: {integrity: sha512-DDi2KmvAnNsT/EvU8jp1UR7pOJojBtJ3GLZ/uw1MUq4VbbESppPWoHUY4h0OB4BbEbGJiyEsmUcuZDZtoR+ZwQ==} dependencies: - '@types/yargs-parser': 21.0.2 + '@types/yargs-parser': 21.0.3 dev: true - /@typescript-eslint/eslint-plugin@6.9.0(@typescript-eslint/parser@6.9.0)(eslint@8.52.0)(typescript@5.2.2): - resolution: {integrity: sha512-lgX7F0azQwRPB7t7WAyeHWVfW1YJ9NIgd9mvGhfQpRY56X6AVf8mwM8Wol+0z4liE7XX3QOt8MN1rUKCfSjRIA==} + /@typescript-eslint/eslint-plugin@6.11.0(@typescript-eslint/parser@6.11.0)(eslint@8.53.0)(typescript@5.2.2): + resolution: {integrity: sha512-uXnpZDc4VRjY4iuypDBKzW1rz9T5YBBK0snMn8MaTSNd2kMlj50LnLBABELjJiOL5YHk7ZD8hbSpI9ubzqYI0w==} engines: {node: ^16.0.0 || >=18.0.0} peerDependencies: '@typescript-eslint/parser': ^6.0.0 || ^6.0.0-alpha @@ -1446,13 +1409,13 @@ packages: optional: true dependencies: '@eslint-community/regexpp': 4.10.0 - '@typescript-eslint/parser': 6.9.0(eslint@8.52.0)(typescript@5.2.2) - '@typescript-eslint/scope-manager': 6.9.0 - '@typescript-eslint/type-utils': 6.9.0(eslint@8.52.0)(typescript@5.2.2) - '@typescript-eslint/utils': 6.9.0(eslint@8.52.0)(typescript@5.2.2) - '@typescript-eslint/visitor-keys': 6.9.0 + '@typescript-eslint/parser': 6.11.0(eslint@8.53.0)(typescript@5.2.2) + '@typescript-eslint/scope-manager': 6.11.0 + '@typescript-eslint/type-utils': 6.11.0(eslint@8.53.0)(typescript@5.2.2) + '@typescript-eslint/utils': 6.11.0(eslint@8.53.0)(typescript@5.2.2) + '@typescript-eslint/visitor-keys': 6.11.0 debug: 4.3.4 - eslint: 8.52.0 + eslint: 8.53.0 graphemer: 1.4.0 ignore: 5.2.4 natural-compare: 1.4.0 @@ -1463,8 +1426,8 @@ packages: - supports-color dev: true - /@typescript-eslint/parser@6.9.0(eslint@8.52.0)(typescript@5.2.2): - resolution: {integrity: sha512-GZmjMh4AJ/5gaH4XF2eXA8tMnHWP+Pm1mjQR2QN4Iz+j/zO04b9TOvJYOX2sCNIQHtRStKTxRY1FX7LhpJT4Gw==} + /@typescript-eslint/parser@6.11.0(eslint@8.53.0)(typescript@5.2.2): + resolution: {integrity: sha512-+whEdjk+d5do5nxfxx73oanLL9ghKO3EwM9kBCkUtWMRwWuPaFv9ScuqlYfQ6pAD6ZiJhky7TZ2ZYhrMsfMxVQ==} engines: {node: ^16.0.0 || >=18.0.0} peerDependencies: eslint: ^7.0.0 || ^8.0.0 @@ -1473,27 +1436,27 @@ packages: typescript: optional: true dependencies: - '@typescript-eslint/scope-manager': 6.9.0 - '@typescript-eslint/types': 6.9.0 - '@typescript-eslint/typescript-estree': 6.9.0(typescript@5.2.2) - '@typescript-eslint/visitor-keys': 6.9.0 + '@typescript-eslint/scope-manager': 6.11.0 + '@typescript-eslint/types': 6.11.0 + '@typescript-eslint/typescript-estree': 6.11.0(typescript@5.2.2) + '@typescript-eslint/visitor-keys': 6.11.0 debug: 4.3.4 - eslint: 8.52.0 + eslint: 8.53.0 typescript: 5.2.2 transitivePeerDependencies: - supports-color dev: true - /@typescript-eslint/scope-manager@6.9.0: - resolution: {integrity: sha512-1R8A9Mc39n4pCCz9o79qRO31HGNDvC7UhPhv26TovDsWPBDx+Sg3rOZdCELIA3ZmNoWAuxaMOT7aWtGRSYkQxw==} + /@typescript-eslint/scope-manager@6.11.0: + resolution: {integrity: sha512-0A8KoVvIURG4uhxAdjSaxy8RdRE//HztaZdG8KiHLP8WOXSk0vlF7Pvogv+vlJA5Rnjj/wDcFENvDaHb+gKd1A==} engines: {node: ^16.0.0 || >=18.0.0} dependencies: - '@typescript-eslint/types': 6.9.0 - '@typescript-eslint/visitor-keys': 6.9.0 + '@typescript-eslint/types': 6.11.0 + '@typescript-eslint/visitor-keys': 6.11.0 dev: true - /@typescript-eslint/type-utils@6.9.0(eslint@8.52.0)(typescript@5.2.2): - resolution: {integrity: sha512-XXeahmfbpuhVbhSOROIzJ+b13krFmgtc4GlEuu1WBT+RpyGPIA4Y/eGnXzjbDj5gZLzpAXO/sj+IF/x2GtTMjQ==} + /@typescript-eslint/type-utils@6.11.0(eslint@8.53.0)(typescript@5.2.2): + resolution: {integrity: sha512-nA4IOXwZtqBjIoYrJcYxLRO+F9ri+leVGoJcMW1uqr4r1Hq7vW5cyWrA43lFbpRvQ9XgNrnfLpIkO3i1emDBIA==} engines: {node: ^16.0.0 || >=18.0.0} peerDependencies: eslint: ^7.0.0 || ^8.0.0 @@ -1502,10 +1465,10 @@ packages: typescript: optional: true dependencies: - '@typescript-eslint/typescript-estree': 6.9.0(typescript@5.2.2) - '@typescript-eslint/utils': 6.9.0(eslint@8.52.0)(typescript@5.2.2) + '@typescript-eslint/typescript-estree': 6.11.0(typescript@5.2.2) + '@typescript-eslint/utils': 6.11.0(eslint@8.53.0)(typescript@5.2.2) debug: 4.3.4 - eslint: 8.52.0 + eslint: 8.53.0 ts-api-utils: 1.0.3(typescript@5.2.2) typescript: 5.2.2 transitivePeerDependencies: @@ -1522,8 +1485,8 @@ packages: engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} dev: true - /@typescript-eslint/types@6.9.0: - resolution: {integrity: sha512-+KB0lbkpxBkBSiVCuQvduqMJy+I1FyDbdwSpM3IoBS7APl4Bu15lStPjgBIdykdRqQNYqYNMa8Kuidax6phaEw==} + /@typescript-eslint/types@6.11.0: + resolution: {integrity: sha512-ZbEzuD4DwEJxwPqhv3QULlRj8KYTAnNsXxmfuUXFCxZmO6CF2gM/y+ugBSAQhrqaJL3M+oe4owdWunaHM6beqA==} engines: {node: ^16.0.0 || >=18.0.0} dev: true @@ -1569,8 +1532,8 @@ packages: - supports-color dev: true - /@typescript-eslint/typescript-estree@6.9.0(typescript@5.2.2): - resolution: {integrity: sha512-NJM2BnJFZBEAbCfBP00zONKXvMqihZCrmwCaik0UhLr0vAgb6oguXxLX1k00oQyD+vZZ+CJn3kocvv2yxm4awQ==} + /@typescript-eslint/typescript-estree@6.11.0(typescript@5.2.2): + resolution: {integrity: sha512-Aezzv1o2tWJwvZhedzvD5Yv7+Lpu1by/U1LZ5gLc4tCx8jUmuSCMioPFRjliN/6SJIvY6HpTtJIWubKuYYYesQ==} engines: {node: ^16.0.0 || >=18.0.0} peerDependencies: typescript: '*' @@ -1578,8 +1541,8 @@ packages: typescript: optional: true dependencies: - '@typescript-eslint/types': 6.9.0 - '@typescript-eslint/visitor-keys': 6.9.0 + '@typescript-eslint/types': 6.11.0 + '@typescript-eslint/visitor-keys': 6.11.0 debug: 4.3.4 globby: 11.1.0 is-glob: 4.0.3 @@ -1590,19 +1553,19 @@ packages: - supports-color dev: true - /@typescript-eslint/utils@6.9.0(eslint@8.52.0)(typescript@5.2.2): - resolution: {integrity: sha512-5Wf+Jsqya7WcCO8me504FBigeQKVLAMPmUzYgDbWchINNh1KJbxCgVya3EQ2MjvJMVeXl3pofRmprqX6mfQkjQ==} + /@typescript-eslint/utils@6.11.0(eslint@8.53.0)(typescript@5.2.2): + resolution: {integrity: sha512-p23ibf68fxoZy605dc0dQAEoUsoiNoP3MD9WQGiHLDuTSOuqoTsa4oAy+h3KDkTcxbbfOtUjb9h3Ta0gT4ug2g==} engines: {node: ^16.0.0 || >=18.0.0} peerDependencies: eslint: ^7.0.0 || ^8.0.0 dependencies: - '@eslint-community/eslint-utils': 4.4.0(eslint@8.52.0) - '@types/json-schema': 7.0.14 - '@types/semver': 7.5.4 - '@typescript-eslint/scope-manager': 6.9.0 - '@typescript-eslint/types': 6.9.0 - '@typescript-eslint/typescript-estree': 6.9.0(typescript@5.2.2) - eslint: 8.52.0 + '@eslint-community/eslint-utils': 4.4.0(eslint@8.53.0) + '@types/json-schema': 7.0.15 + '@types/semver': 7.5.5 + '@typescript-eslint/scope-manager': 6.11.0 + '@typescript-eslint/types': 6.11.0 + '@typescript-eslint/typescript-estree': 6.11.0(typescript@5.2.2) + eslint: 8.53.0 semver: 7.5.4 transitivePeerDependencies: - supports-color @@ -1625,11 +1588,11 @@ packages: eslint-visitor-keys: 3.4.3 dev: true - /@typescript-eslint/visitor-keys@6.9.0: - resolution: {integrity: sha512-dGtAfqjV6RFOtIP8I0B4ZTBRrlTT8NHHlZZSchQx3qReaoDeXhYM++M4So2AgFK9ZB0emRPA6JI1HkafzA2Ibg==} + /@typescript-eslint/visitor-keys@6.11.0: + resolution: {integrity: sha512-+SUN/W7WjBr05uRxPggJPSzyB8zUpaYo2hByKasWbqr3PM8AXfZt8UHdNpBS1v9SA62qnSSMF3380SwDqqprgQ==} engines: {node: ^16.0.0 || >=18.0.0} dependencies: - '@typescript-eslint/types': 6.9.0 + '@typescript-eslint/types': 6.11.0 eslint-visitor-keys: 3.4.3 dev: true @@ -1646,7 +1609,7 @@ packages: magic-string: 0.30.5 modern-node-polyfills: 1.0.0(esbuild@0.18.20) sirv: 2.0.3 - vitest: 0.34.6(@edge-runtime/vm@3.1.6)(@vitest/browser@0.34.6)(playwright@1.39.0) + vitest: 0.34.6(@edge-runtime/vm@3.1.7)(@vitest/browser@0.34.6)(playwright@1.39.0) transitivePeerDependencies: - esbuild - rollup @@ -1659,16 +1622,16 @@ packages: dependencies: '@ampproject/remapping': 2.2.1 '@bcoe/v8-coverage': 0.2.3 - istanbul-lib-coverage: 3.2.0 + istanbul-lib-coverage: 3.2.2 istanbul-lib-report: 3.0.1 istanbul-lib-source-maps: 4.0.1 istanbul-reports: 3.1.6 magic-string: 0.30.5 picocolors: 1.0.0 - std-env: 3.4.3 + std-env: 3.5.0 test-exclude: 6.0.0 v8-to-istanbul: 9.1.3 - vitest: 0.34.6(@edge-runtime/vm@3.1.6)(@vitest/browser@0.34.6)(playwright@1.39.0) + vitest: 0.34.6(@edge-runtime/vm@3.1.7)(@vitest/browser@0.34.6)(playwright@1.39.0) transitivePeerDependencies: - supports-color dev: true @@ -1906,12 +1869,12 @@ packages: engines: {node: '>= 0.4'} dev: true - /babel-plugin-annotate-pure-calls@0.4.0(@babel/core@7.23.2): + /babel-plugin-annotate-pure-calls@0.4.0(@babel/core@7.23.3): resolution: {integrity: sha512-oi4M/PWUJOU9ZyRGoPTfPMqdyMp06jbJAomd3RcyYuzUtBOddv98BqLm96Lucpi2QFoQHkdGQt0ACvw7VzVEQA==} peerDependencies: '@babel/core': ^6.0.0-0 || 7.x dependencies: - '@babel/core': 7.23.2 + '@babel/core': 7.23.3 dev: true /balanced-match@1.0.2: @@ -1974,8 +1937,8 @@ packages: engines: {node: ^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7} hasBin: true dependencies: - caniuse-lite: 1.0.30001558 - electron-to-chromium: 1.4.569 + caniuse-lite: 1.0.30001562 + electron-to-chromium: 1.4.583 node-releases: 2.0.13 update-browserslist-db: 1.0.13(browserslist@4.22.1) dev: true @@ -1996,13 +1959,6 @@ packages: engines: {node: '>=0.10.0'} dev: true - /busboy@1.6.0: - resolution: {integrity: sha512-8SFQbg/0hQ9xy3UNTB0YEnsNBbWfhf7RtnzpL7TkBiTBRfrQ9Fxcnz7VJsleJpyp6rVLvXiuORqjlHi5q+PYuA==} - engines: {node: '>=10.16.0'} - dependencies: - streamsearch: 1.1.0 - dev: true - /bytes-iec@3.1.1: resolution: {integrity: sha512-fey6+4jDK7TFtFg/klGSvNKJctyU7n2aQdnM+CO0ruLPbqqMOM8Tio0Pc+deqUeVKX1tL5DQep1zQ7+37aTAsA==} engines: {node: '>= 0.8'} @@ -2040,8 +1996,8 @@ packages: engines: {node: '>=6'} dev: true - /caniuse-lite@1.0.30001558: - resolution: {integrity: sha512-/Et7DwLqpjS47JPEcz6VnxU9PwcIdVi0ciLXRWBQdj1XFye68pSQYpV0QtPTfUKWuOaEig+/Vez2l74eDc1tPQ==} + /caniuse-lite@1.0.30001562: + resolution: {integrity: sha512-kfte3Hym//51EdX4239i+Rmp20EsLIYGdPkERegTgU19hQWCRhsRFGKHTliUlsry53tv17K7n077Kqa0WJU4ng==} dev: true /chai@4.3.10: @@ -2074,11 +2030,6 @@ packages: supports-color: 7.2.0 dev: true - /chalk@5.3.0: - resolution: {integrity: sha512-dLitG79d+GV1Nb/VYcCDFivJeK1hiukt9QjRNVOsUtTy1rR1YJsmpGGTZ3qJos+uw7WmWF4wUwBd9jxjocFC2w==} - engines: {node: ^12.17.0 || ^14.13 || >=16.0.0} - dev: true - /chardet@0.7.0: resolution: {integrity: sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA==} dev: true @@ -2092,7 +2043,6 @@ packages: /chokidar@3.5.3: resolution: {integrity: sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==} engines: {node: '>= 8.10.0'} - requiresBuild: true dependencies: anymatch: 3.1.3 braces: 3.0.2 @@ -2144,10 +2094,6 @@ packages: engines: {node: '>=0.8'} dev: true - /code-block-writer@12.0.0: - resolution: {integrity: sha512-q4dMFMlXtKR3XNBHyMHt/3pwYNA69EDk00lloMOaaUMKPUXBw6lpXtbu3MMVG6/uOihGnRDOlkyqsONEUj60+w==} - dev: true - /color-convert@1.9.3: resolution: {integrity: sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==} dependencies: @@ -2567,12 +2513,8 @@ packages: resolution: {integrity: sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==} dev: true - /effect@2.0.0-next.54: - resolution: {integrity: sha512-qROhKMxlm6fpa90YRfWSgKeelDfhaDq2igPK+pIKupGehiCnZH4vd2qrY71HVZ10qZgXxh0VXpGyDQxJC+EQqw==} - dev: true - - /electron-to-chromium@1.4.569: - resolution: {integrity: sha512-LsrJjZ0IbVy12ApW3gpYpcmHS3iRxH4bkKOW98y1/D+3cvDUWGcbzbsFinfUS8knpcZk/PG/2p/RnkMCYN7PVg==} + /electron-to-chromium@1.4.583: + resolution: {integrity: sha512-93y1gcONABZ7uqYe/JWDVQP/Pj/sQSunF0HVAPdlg/pfBnOyBMLlQUxWvkqcljJg1+W6cjvPuYD+r1Th9Tn8mA==} dev: true /emoji-regex@8.0.0: @@ -2776,7 +2718,7 @@ packages: - supports-color dev: true - /eslint-import-resolver-typescript@3.6.1(@typescript-eslint/parser@6.9.0)(eslint-plugin-import@2.29.0)(eslint@8.52.0): + /eslint-import-resolver-typescript@3.6.1(@typescript-eslint/parser@6.11.0)(eslint-plugin-import@2.29.0)(eslint@8.53.0): resolution: {integrity: sha512-xgdptdoi5W3niYeuQxKmzVDTATvLYqhpwmykwsh7f6HIOStGWEIL9iqZgQDF9u9OEzrRwR8no5q2VT+bjAujTg==} engines: {node: ^14.18.0 || >=16.0.0} peerDependencies: @@ -2785,10 +2727,10 @@ packages: dependencies: debug: 4.3.4 enhanced-resolve: 5.15.0 - eslint: 8.52.0 - eslint-module-utils: 2.8.0(@typescript-eslint/parser@6.9.0)(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.1)(eslint@8.52.0) - eslint-plugin-import: 2.29.0(@typescript-eslint/parser@6.9.0)(eslint-import-resolver-typescript@3.6.1)(eslint@8.52.0) - fast-glob: 3.3.1 + eslint: 8.53.0 + eslint-module-utils: 2.8.0(@typescript-eslint/parser@6.11.0)(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.1)(eslint@8.53.0) + eslint-plugin-import: 2.29.0(@typescript-eslint/parser@6.11.0)(eslint-import-resolver-typescript@3.6.1)(eslint@8.53.0) + fast-glob: 3.3.2 get-tsconfig: 4.7.2 is-core-module: 2.13.1 is-glob: 4.0.3 @@ -2799,7 +2741,7 @@ packages: - supports-color dev: true - /eslint-module-utils@2.8.0(@typescript-eslint/parser@6.9.0)(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.1)(eslint@8.52.0): + /eslint-module-utils@2.8.0(@typescript-eslint/parser@6.11.0)(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.1)(eslint@8.53.0): resolution: {integrity: sha512-aWajIYfsqCKRDgUfjEXNN/JlrzauMuSEy5sbd7WXbtW3EH6A6MpwEh42c7qD+MqQo9QMJ6fWLAeIJynx0g6OAw==} engines: {node: '>=4'} peerDependencies: @@ -2820,25 +2762,26 @@ packages: eslint-import-resolver-webpack: optional: true dependencies: - '@typescript-eslint/parser': 6.9.0(eslint@8.52.0)(typescript@5.2.2) + '@typescript-eslint/parser': 6.11.0(eslint@8.53.0)(typescript@5.2.2) debug: 3.2.7 - eslint: 8.52.0 + eslint: 8.53.0 eslint-import-resolver-node: 0.3.9 - eslint-import-resolver-typescript: 3.6.1(@typescript-eslint/parser@6.9.0)(eslint-plugin-import@2.29.0)(eslint@8.52.0) + eslint-import-resolver-typescript: 3.6.1(@typescript-eslint/parser@6.11.0)(eslint-plugin-import@2.29.0)(eslint@8.53.0) transitivePeerDependencies: - supports-color dev: true - /eslint-plugin-codegen@0.17.0: - resolution: {integrity: sha512-6DDDob+7PjyNJyy9ynHFFsLp0+aUtWbXiiT/SfU161NCxo1zevewq7VvtDiJh15gMBvVZSFs6hXqYJWT3NUZvA==} + /eslint-plugin-codegen@0.18.1: + resolution: {integrity: sha512-Sy5nJ7tMahHWygM02w2gAO70MX6Lp0ZK0PD9kMpPPGtoQhyS2n1oN7s9zLpDx5pmFDf3woj6LadqztNpJ5RepQ==} + engines: {node: '>=12.0.0'} dependencies: - '@babel/core': 7.23.2 + '@babel/core': 7.23.3 '@babel/generator': 7.12.17 - '@babel/parser': 7.23.0 - '@babel/traverse': 7.23.2 + '@babel/parser': 7.23.3 + '@babel/traverse': 7.23.3 expect: 26.6.2 fp-ts: 2.16.1 - glob: 7.2.3 + glob: 10.3.10 io-ts: 2.2.20(fp-ts@2.16.1) io-ts-extra: 0.11.6 js-yaml: 3.14.1 @@ -2849,14 +2792,14 @@ packages: - supports-color dev: true - /eslint-plugin-deprecation@2.0.0(eslint@8.52.0)(typescript@5.2.2): + /eslint-plugin-deprecation@2.0.0(eslint@8.53.0)(typescript@5.2.2): resolution: {integrity: sha512-OAm9Ohzbj11/ZFyICyR5N6LbOIvQMp7ZU2zI7Ej0jIc8kiGUERXPNMfw2QqqHD1ZHtjMub3yPZILovYEYucgoQ==} peerDependencies: eslint: ^7.0.0 || ^8.0.0 typescript: ^4.2.4 || ^5.0.0 dependencies: - '@typescript-eslint/utils': 6.9.0(eslint@8.52.0)(typescript@5.2.2) - eslint: 8.52.0 + '@typescript-eslint/utils': 6.11.0(eslint@8.53.0)(typescript@5.2.2) + eslint: 8.53.0 tslib: 2.6.2 tsutils: 3.21.0(typescript@5.2.2) typescript: 5.2.2 @@ -2864,7 +2807,7 @@ packages: - supports-color dev: true - /eslint-plugin-import@2.29.0(@typescript-eslint/parser@6.9.0)(eslint-import-resolver-typescript@3.6.1)(eslint@8.52.0): + /eslint-plugin-import@2.29.0(@typescript-eslint/parser@6.11.0)(eslint-import-resolver-typescript@3.6.1)(eslint@8.53.0): resolution: {integrity: sha512-QPOO5NO6Odv5lpoTkddtutccQjysJuFxoPS7fAHO+9m9udNHvTCPSAMW9zGAYj8lAIdr40I8yPCdUYrncXtrwg==} engines: {node: '>=4'} peerDependencies: @@ -2874,16 +2817,16 @@ packages: '@typescript-eslint/parser': optional: true dependencies: - '@typescript-eslint/parser': 6.9.0(eslint@8.52.0)(typescript@5.2.2) + '@typescript-eslint/parser': 6.11.0(eslint@8.53.0)(typescript@5.2.2) array-includes: 3.1.7 array.prototype.findlastindex: 1.2.3 array.prototype.flat: 1.3.2 array.prototype.flatmap: 1.3.2 debug: 3.2.7 doctrine: 2.1.0 - eslint: 8.52.0 + eslint: 8.53.0 eslint-import-resolver-node: 0.3.9 - eslint-module-utils: 2.8.0(@typescript-eslint/parser@6.9.0)(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.1)(eslint@8.52.0) + eslint-module-utils: 2.8.0(@typescript-eslint/parser@6.11.0)(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.1)(eslint@8.53.0) hasown: 2.0.0 is-core-module: 2.13.1 is-glob: 4.0.3 @@ -2899,21 +2842,21 @@ packages: - supports-color dev: true - /eslint-plugin-simple-import-sort@10.0.0(eslint@8.52.0): + /eslint-plugin-simple-import-sort@10.0.0(eslint@8.53.0): resolution: {integrity: sha512-AeTvO9UCMSNzIHRkg8S6c3RPy5YEwKWSQPx3DYghLedo2ZQxowPFLGDN1AZ2evfg6r6mjBSZSLxLFsWSu3acsw==} peerDependencies: eslint: '>=5.0.0' dependencies: - eslint: 8.52.0 + eslint: 8.53.0 dev: true - /eslint-plugin-sort-destructure-keys@1.5.0(eslint@8.52.0): + /eslint-plugin-sort-destructure-keys@1.5.0(eslint@8.53.0): resolution: {integrity: sha512-xGLyqHtbFXZNXQSvAiQ4ISBYokrbUywEhmaA50fKtSKgceCv5y3zjoNuZwcnajdM6q29Nxj+oXC9KcqfMsAPrg==} engines: {node: '>=6.0.0'} peerDependencies: eslint: 3 - 8 dependencies: - eslint: 8.52.0 + eslint: 8.53.0 natural-compare-lite: 1.4.0 dev: true @@ -2935,15 +2878,15 @@ packages: engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} dev: true - /eslint@8.52.0: - resolution: {integrity: sha512-zh/JHnaixqHZsolRB/w9/02akBk9EPrOs9JwcTP2ek7yL5bVvXuRariiaAjjoJ5DvuwQ1WAE/HsMz+w17YgBCg==} + /eslint@8.53.0: + resolution: {integrity: sha512-N4VuiPjXDUa4xVeV/GC/RV3hQW9Nw+Y463lkWaKKXKYMvmRiRDAtfpuPFLN+E1/6ZhyR8J2ig+eVREnYgUsiag==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} hasBin: true dependencies: - '@eslint-community/eslint-utils': 4.4.0(eslint@8.52.0) + '@eslint-community/eslint-utils': 4.4.0(eslint@8.53.0) '@eslint-community/regexpp': 4.10.0 - '@eslint/eslintrc': 2.1.2 - '@eslint/js': 8.52.0 + '@eslint/eslintrc': 2.1.3 + '@eslint/js': 8.53.0 '@humanwhocodes/config-array': 0.11.13 '@humanwhocodes/module-importer': 1.0.1 '@nodelib/fs.walk': 1.2.8 @@ -3023,7 +2966,7 @@ packages: /estree-walker@3.0.3: resolution: {integrity: sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g==} dependencies: - '@types/estree': 1.0.4 + '@types/estree': 1.0.5 dev: true /esutils@2.0.3: @@ -3077,16 +3020,12 @@ packages: pure-rand: 6.0.4 dev: true - /fast-decode-uri-component@1.0.1: - resolution: {integrity: sha512-WKgKWg5eUxvRZGwW8FvfbaH7AXSh2cL+3j5fMGzUMCxWBJ3dV3a7Wz8y2f/uQ0e3B6WmodD3oS54jTQ9HVTIIg==} - dev: true - /fast-deep-equal@3.1.3: resolution: {integrity: sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==} dev: true - /fast-glob@3.3.1: - resolution: {integrity: sha512-kNFPyjhh5cKjrUltxs+wFx+ZkbRaxxmZ+X0ZU31SOsxCEtP9VPgtq2teZw1DebupL5GmDaNQ6yKMMVcM41iqDg==} + /fast-glob@3.3.2: + resolution: {integrity: sha512-oX2ruAFQwf/Orj8m737Y5adxDQO0LAB7/S5MnxCdTNDd4p6BsyIVsv9JQsATbTSq8KHRpLwIHbVlUNatxd+1Ow==} engines: {node: '>=8.6.0'} dependencies: '@nodelib/fs.stat': 2.0.5 @@ -3104,12 +3043,6 @@ packages: resolution: {integrity: sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==} dev: true - /fast-querystring@1.1.2: - resolution: {integrity: sha512-g6KuKWmFXc0fID8WWH0jit4g0AGBoJhCkJMb1RmbsSEUNvQ+ZC8D6CUZ+GtF8nMzSPXnhiePyyqqipzNNEnHjg==} - dependencies: - fast-decode-uri-component: 1.0.1 - dev: true - /fastq@1.15.0: resolution: {integrity: sha512-wBrocU2LCXXa+lWBt8RoIRD89Fi8OdABODa/kEnyeyjS5aZO5/GNvI5sEINADqP/h8M29UHTHUb53sUu5Ihqdw==} dependencies: @@ -3120,7 +3053,7 @@ packages: resolution: {integrity: sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg==} engines: {node: ^10.12.0 || >=12.0.0} dependencies: - flat-cache: 3.1.1 + flat-cache: 3.2.0 dev: true /filing-cabinet@3.3.1: @@ -3164,15 +3097,6 @@ packages: to-regex-range: 5.0.1 dev: true - /find-my-way@7.7.0: - resolution: {integrity: sha512-+SrHpvQ52Q6W9f3wJoJBbAQULJuNEEQwBvlvYwACDhBTLOTMiQ0HYWh4+vC3OivGP2ENcTI1oKlFA2OepJNjhQ==} - engines: {node: '>=14'} - dependencies: - fast-deep-equal: 3.1.3 - fast-querystring: 1.1.2 - safe-regex2: 2.0.0 - dev: true - /find-up@4.1.0: resolution: {integrity: sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==} engines: {node: '>=8'} @@ -3196,9 +3120,9 @@ packages: pkg-dir: 4.2.0 dev: true - /flat-cache@3.1.1: - resolution: {integrity: sha512-/qM2b3LUIaIgviBQovTLvijfyOQXPtSRnRK26ksj2J7rzPIecePUIpJsZ4T02Qg+xiAEKIs5K8dsHEd+VaKa/Q==} - engines: {node: '>=12.0.0'} + /flat-cache@3.2.0: + resolution: {integrity: sha512-CYcENa+FtcUKLmhhqyctpclsq7QF38pKjZHsGNiSQF5r4FtoKDWabFDl3hzaEQMvT1LHEysw5twgLvpYYb4vbw==} + engines: {node: ^10.12.0 || >=12.0.0} dependencies: flatted: 3.2.9 keyv: 4.5.4 @@ -3243,7 +3167,7 @@ packages: dependencies: graceful-fs: 4.2.11 jsonfile: 6.1.0 - universalify: 2.0.0 + universalify: 2.0.1 dev: true /fs-extra@7.0.1: @@ -3425,21 +3349,22 @@ packages: dependencies: array-union: 2.1.0 dir-glob: 3.0.1 - fast-glob: 3.3.1 + fast-glob: 3.3.2 ignore: 5.2.4 merge2: 1.4.1 slash: 3.0.0 dev: true - /globby@13.2.2: - resolution: {integrity: sha512-Y1zNGV+pzQdh7H39l9zgB4PJqjRNqydvdYCDG4HFXM4XuvSaQQlEc91IU1yALL8gUTDomgBAfz3XJdmUS+oo0w==} - engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} + /globby@14.0.0: + resolution: {integrity: sha512-/1WM/LNHRAOH9lZta77uGbq0dAEQM+XjNesWwhlERDVenqothRbnzTrL3/LrIoEPPjeUHC3vrS6TwoyxeHs7MQ==} + engines: {node: '>=18'} dependencies: - dir-glob: 3.0.1 - fast-glob: 3.3.1 + '@sindresorhus/merge-streams': 1.0.0 + fast-glob: 3.3.2 ignore: 5.2.4 - merge2: 1.4.1 - slash: 4.0.0 + path-type: 5.0.0 + slash: 5.1.0 + unicorn-magic: 0.1.0 dev: true /gonzales-pe@4.3.0: @@ -3874,8 +3799,8 @@ packages: engines: {node: '>=0.10.0'} dev: true - /istanbul-lib-coverage@3.2.0: - resolution: {integrity: sha512-eOeJ5BHCmHYvQK7xt9GkdHuzuCGS1Y6g9Gvnx3Ym33fz/HpLRYxiS0wHNr+m/MBC8B647Xt608vCDEvhl9c6Mw==} + /istanbul-lib-coverage@3.2.2: + resolution: {integrity: sha512-O8dpsF+r0WV/8MNRKfnmrtCWhuKjxrq2w+jpzBL5UZKTi2LeVWnWOmWRxFlesJONmc+wLAGvKQZEOanko0LFTg==} engines: {node: '>=8'} dev: true @@ -3883,7 +3808,7 @@ packages: resolution: {integrity: sha512-GCfE1mtsHGOELCU8e/Z7YWzpmybrx/+dSTfLrvY8qRmaY6zXTKWn6WQIjaAFw069icm6GVMNkgu0NzI4iPZUNw==} engines: {node: '>=10'} dependencies: - istanbul-lib-coverage: 3.2.0 + istanbul-lib-coverage: 3.2.2 make-dir: 4.0.0 supports-color: 7.2.0 dev: true @@ -3893,7 +3818,7 @@ packages: engines: {node: '>=10'} dependencies: debug: 4.3.4 - istanbul-lib-coverage: 3.2.0 + istanbul-lib-coverage: 3.2.2 source-map: 0.6.1 transitivePeerDependencies: - supports-color @@ -3947,7 +3872,7 @@ packages: dependencies: '@babel/code-frame': 7.22.13 '@jest/types': 26.6.2 - '@types/stack-utils': 2.0.2 + '@types/stack-utils': 2.0.3 chalk: 4.1.2 graceful-fs: 4.2.11 micromatch: 4.0.5 @@ -4028,7 +3953,7 @@ packages: /jsonfile@6.1.0: resolution: {integrity: sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==} dependencies: - universalify: 2.0.0 + universalify: 2.0.1 optionalDependencies: graceful-fs: 4.2.11 dev: true @@ -4167,9 +4092,11 @@ packages: get-func-name: 2.0.2 dev: true - /lru-cache@10.0.1: - resolution: {integrity: sha512-IJ4uwUTi2qCccrioU6g9g/5rvvVl13bsdczUUcqbciD9iLr095yj8DQKdObriEvuNSx325N1rV1O0sJFszx75g==} + /lru-cache@10.0.2: + resolution: {integrity: sha512-Yj9mA8fPiVgOUpByoTZO5pNrcl5Yk37FcSHsUINpAsaBIEZIuqcCclDZJCVxqQShDsmYX8QG63svJiTbOATZwg==} engines: {node: 14 || >=16.14} + dependencies: + semver: 7.5.4 dev: true /lru-cache@4.1.5: @@ -4274,7 +4201,7 @@ packages: resolution: {integrity: sha512-3YffViIt2QWgTy6Pale5QpopX/IvU3LPL03jOTqp6pGj3VjesdO/U8CuHMKpnQr4shCNCM5fd5XFFvIIl6JBHg==} engines: {node: '>=8'} dependencies: - '@types/minimist': 1.2.4 + '@types/minimist': 1.2.5 camelcase-keys: 6.2.2 decamelize-keys: 1.1.1 hard-rejection: 2.1.0 @@ -4300,12 +4227,6 @@ packages: picomatch: 2.3.1 dev: true - /mime@3.0.0: - resolution: {integrity: sha512-jSCU7/VB1loIWBZe14aEYHU/+1UMEHoaO7qxCOVJOw9GgH72VAWppxNcjU+x9a2k3GSIBXNKxXQFqRvvZ7vr3A==} - engines: {node: '>=10.0.0'} - hasBin: true - dev: true - /mimic-fn@2.1.0: resolution: {integrity: sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==} engines: {node: '>=6'} @@ -4322,13 +4243,6 @@ packages: brace-expansion: 1.1.11 dev: true - /minimatch@7.4.6: - resolution: {integrity: sha512-sBz8G/YjVniEz6lKPNpKxXwazJe4c19fEfV2GDMX6AjFz+MX9uDWIZW8XreVhkFW3fkIdTv/gxWr/Kks5FFAVw==} - engines: {node: '>=10'} - dependencies: - brace-expansion: 2.0.1 - dev: true - /minimatch@9.0.3: resolution: {integrity: sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg==} engines: {node: '>=16 || 14 >=14.17'} @@ -4374,12 +4288,6 @@ packages: minimist: 1.2.8 dev: true - /mkdirp@2.1.6: - resolution: {integrity: sha512-+hEnITedc8LAtIP9u3HJDFIdcLV2vXP33sqLLIzkv1Db1zO/1OxbvYf0Y1OC/S/Qo5dxHXepofhmxL02PsKe+A==} - engines: {node: '>=10'} - hasBin: true - dev: true - /mlly@1.4.2: resolution: {integrity: sha512-i/Ykufi2t1EZ6NaPLdfnZk2AX8cs0d+mTzVKuPfqPKPatxLApaBoxJQ9x1/uckXtrS/U5oisPMDkNs0yQTaBRg==} dependencies: @@ -4448,8 +4356,8 @@ packages: resolution: {integrity: sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==} dev: true - /nanoid@3.3.6: - resolution: {integrity: sha512-BGcqMMJuToF7i1rt+2PWSNVnWIkGCU78jBG3RxO/bZlnZPK2Cmi2QaffxGO/2RvWi9sL+FAiRiXMgsyxQ1DIDA==} + /nanoid@3.3.7: + resolution: {integrity: sha512-eSRppjcPIatRIMC1U6UngP8XFcz8MQWGQdt1MTBQ7NaAmvXDfvNxbvWV3x2y6CdEUciCSsDHDQZbhYaB8QEo2g==} engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1} hasBin: true dev: true @@ -4494,14 +4402,14 @@ packages: resolution: {integrity: sha512-8Q1hXew6ETzqKRAs3jjLioSxNfT1cx74ooiF8RlAONwVMcfq+UdzLC2eB5qcPldUxaE5w3ytLkrmV1TGddhZTA==} engines: {node: '>=6.0'} dependencies: - '@babel/parser': 7.23.0 + '@babel/parser': 7.23.3 dev: true /node-source-walk@5.0.2: resolution: {integrity: sha512-Y4jr/8SRS5hzEdZ7SGuvZGwfORvNsSsNRwDXx5WisiqzsVfeftDvRgfeqWNgZvWSJbgubTRVRYBzK6UO+ErqjA==} engines: {node: '>=12'} dependencies: - '@babel/parser': 7.23.0 + '@babel/parser': 7.23.3 dev: true /normalize-package-data@2.5.0: @@ -4695,10 +4603,6 @@ packages: engines: {node: '>=6'} dev: true - /path-browserify@1.0.1: - resolution: {integrity: sha512-b7uo2UCUOYZcnF/3ID0lulOJi/bafxa1xPe7ZPsammBSpjSWQkjNxlt635YGS2MiR9GjvuXCtz2emr3jbsz98g==} - dev: true - /path-exists@4.0.0: resolution: {integrity: sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==} engines: {node: '>=8'} @@ -4722,7 +4626,7 @@ packages: resolution: {integrity: sha512-MkhCqzzBEpPvxxQ71Md0b1Kk51W01lrYvlMzSUaIzNsODdd7mqhiimSZlr+VegAz5Z6Vzt9Xg2ttE//XBhH3EQ==} engines: {node: '>=16 || 14 >=14.17'} dependencies: - lru-cache: 10.0.1 + lru-cache: 10.0.2 minipass: 7.0.4 dev: true @@ -4731,6 +4635,11 @@ packages: engines: {node: '>=8'} dev: true + /path-type@5.0.0: + resolution: {integrity: sha512-5HviZNaZcfqP95rwpv+1HDgUamezbqdSYTyzjTvwtJSnIH+3vnbmWsItli8OFEndS984VT55M3jduxZbX351gg==} + engines: {node: '>=12'} + dev: true + /pathe@1.1.1: resolution: {integrity: sha512-d+RQGp0MAYTIaDBIMmOfMwz3E+LOZnxx1HZd5R18mmCZY0QBlK0LDZfPc8FW8Ed2DlvsuE6PRjroDY+wg4+j/Q==} dev: true @@ -4814,7 +4723,7 @@ packages: resolution: {integrity: sha512-PS08Iboia9mts/2ygV3eLpY5ghnUcfLV/EXTOW1E2qYxJKGGBUtNjN76FYHnMs36RmARn41bC0AZmn+rR0OVpQ==} engines: {node: ^10 || ^12 || >=14} dependencies: - nanoid: 3.3.6 + nanoid: 3.3.7 picocolors: 1.0.0 source-map-js: 1.0.2 dev: true @@ -4883,8 +4792,8 @@ packages: hasBin: true dev: true - /prettier@3.0.3: - resolution: {integrity: sha512-L/4pUDMxcNa8R/EthV08Zt42WBO4h1rarVtK0K+QJG0X187OLo7l699jWw0GKuwzkPQ//jMFA/8Xm6Fh3J/DAg==} + /prettier@3.1.0: + resolution: {integrity: sha512-TQLvXjq5IAibjh8EpBIkNKxO749UEWABoiIZehEPiY4GNpVdhaFKqSTu+QrlU6D2dPAfubRmtJTi4K4YkQ5eXw==} engines: {node: '>=14'} hasBin: true dev: true @@ -4923,8 +4832,8 @@ packages: resolution: {integrity: sha512-b/YwNhb8lk1Zz2+bXXpS/LK9OisiZZ1SNsSLxN1x2OXVEhW2Ckr/7mWE5vrC1ZTiJlD9g19jWszTmJsB+oEpFQ==} dev: true - /punycode@2.3.0: - resolution: {integrity: sha512-rRV+zQD8tVFys26lAGR9WUuS4iUAngJScM+ZRSKtvl5tKeZ2t5bvdNFdNHBW9FWR4guGHlgmsZ1G7BSm2wTbuA==} + /punycode@2.3.1: + resolution: {integrity: sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==} engines: {node: '>=6'} dev: true @@ -4985,7 +4894,7 @@ packages: resolution: {integrity: sha512-Ug69mNOpfvKDAc2Q8DRpMjjzdtrnv9HcSMX+4VsZxD1aZ6ZzrIE7rlzXBtWTyhULSMKg076AW6WR5iZpD0JiOg==} engines: {node: '>=8'} dependencies: - '@types/normalize-package-data': 2.4.3 + '@types/normalize-package-data': 2.4.4 normalize-package-data: 2.5.0 parse-json: 5.2.0 type-fest: 0.6.0 @@ -5129,11 +5038,6 @@ packages: signal-exit: 3.0.7 dev: true - /ret@0.2.2: - resolution: {integrity: sha512-M0b3YWQs7R3Z917WRQy1HHA7Ba7D8hvZg6UE5mLykJxQVE2ju0IXbGlaHPPlkY+WN7wFP+wUMXmBFA0aV6vYGQ==} - engines: {node: '>=4'} - dev: true - /reusify@1.0.4: resolution: {integrity: sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==} engines: {iojs: '>=1.0.0', node: '>=0.10.0'} @@ -5194,12 +5098,6 @@ packages: is-regex: 1.1.4 dev: true - /safe-regex2@2.0.0: - resolution: {integrity: sha512-PaUSFsUaNNuKwkBijoAPHAK6/eM6VirvyPWlZ7BAQy4D+hCvh4B6lIG+nPdhbFfIbP+gTGBcrdsOaUs0F+ZBOQ==} - dependencies: - ret: 0.2.2 - dev: true - /safer-buffer@2.1.2: resolution: {integrity: sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==} dev: true @@ -5314,14 +5212,14 @@ packages: totalist: 3.0.1 dev: true - /size-limit@10.0.2: - resolution: {integrity: sha512-ULFHMr+OQjuyqdGSqkDGY3XfnGO0l3cIfJaNe6F6ZqO+QzWUYunZh9DYHovNctsN7R9fR9gzzzW4Ze8TiJ060g==} + /size-limit@11.0.0: + resolution: {integrity: sha512-6+i4rE1GRzx/vRpuitRYQiZJNTXJjde+4P2NPg8AK7pURrE1+hA3mGstzvT8vQ8DuYFnvp9fh4CHM7Heq3EKXA==} engines: {node: ^18.0.0 || >=20.0.0} hasBin: true dependencies: bytes-iec: 3.1.1 chokidar: 3.5.3 - globby: 13.2.2 + globby: 14.0.0 lilconfig: 2.1.0 nanospinner: 1.1.0 picocolors: 1.0.0 @@ -5337,9 +5235,9 @@ packages: engines: {node: '>=8'} dev: true - /slash@4.0.0: - resolution: {integrity: sha512-3dOsAHXXUkQTpOYcoAxLIorMTp4gIQr5IW3iVb7A7lFIp0VHhnynm9izx6TssdrIcVIESAlVjtnO2K8bg+Coew==} - engines: {node: '>=12'} + /slash@5.1.0: + resolution: {integrity: sha512-ZA6oR3T/pEyuqwMgAKT0/hAv8oAXckzbkmR0UkUosQ+Mc4RxGoJkRmwHgHufaenlyAgE1Mxgpdcrf75y6XcnDg==} + engines: {node: '>=14.16'} dev: true /smartwrap@2.0.2: @@ -5421,8 +5319,8 @@ packages: resolution: {integrity: sha512-1XMJE5fQo1jGH6Y/7ebnwPOBEkIEnT4QF32d5R1+VXdXveM0IBMJt8zfaxX1P3QhVwrYe+576+jkANtSS2mBbw==} dev: true - /std-env@3.4.3: - resolution: {integrity: sha512-f9aPhy8fYBuMN+sNfakZV18U39PbalgjXG3lLB9WkaYTxijru61wb57V9wxxNthXM5Sd88ETBWi29qLAsHO52Q==} + /std-env@3.5.0: + resolution: {integrity: sha512-JGUEaALvL0Mf6JCfYnJOTcobY+Nc7sG/TemDRBqCA0wEr4DER7zDchaaixTlmOxAjG1uRJmX82EQcxwTQTkqVA==} dev: true /stream-to-array@2.3.0: @@ -5437,11 +5335,6 @@ packages: mixme: 0.5.9 dev: true - /streamsearch@1.1.0: - resolution: {integrity: sha512-Mcc5wHehp9aXz1ax6bZUyY5afg9u2rv5cqQI3mRrYkGC8rW2hM02jWuwjtL++LS5qinSyhj2QfLyNsuc+VsExg==} - engines: {node: '>=10.0.0'} - dev: true - /string-width@4.2.3: resolution: {integrity: sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==} engines: {node: '>=8'} @@ -5701,26 +5594,6 @@ packages: engines: {node: '>=14.16'} dev: true - /ts-morph@20.0.0: - resolution: {integrity: sha512-JVmEJy2Wow5n/84I3igthL9sudQ8qzjh/6i4tmYCm6IqYyKFlNbJZi7oBdjyqcWSWYRu3CtL0xbT6fS03ESZIg==} - dependencies: - '@ts-morph/common': 0.21.0 - code-block-writer: 12.0.0 - dev: true - - /tsconfck@3.0.0(typescript@5.2.2): - resolution: {integrity: sha512-w3wnsIrJNi7avf4Zb0VjOoodoO0woEqGgZGQm+LHH9przdUI+XDKsWAXwxHA1DaRTjeuZNcregSzr7RaA8zG9A==} - engines: {node: ^18 || >=20} - hasBin: true - peerDependencies: - typescript: ^5.0.0 - peerDependenciesMeta: - typescript: - optional: true - dependencies: - typescript: 5.2.2 - dev: true - /tsconfig-paths@3.14.2: resolution: {integrity: sha512-o/9iXgCYc5L/JxCHPe3Hvh8Q/2xm5Z+p18PESBU6Ff33695QnCHBEjcytY2q19ua7Mbl/DavtBOLq+oG0RCL+g==} dependencies: @@ -5801,8 +5674,9 @@ packages: typescript: 5.2.2 dev: true - /tsx@3.14.0: - resolution: {integrity: sha512-xHtFaKtHxM9LOklMmJdI3BEnQq/D5F73Of2E1GDrITi9sgoVkvIsrQUTY1G8FlmGtA+awCI4EBlTRRYxkL2sRg==} + /tsx@4.1.2: + resolution: {integrity: sha512-1spM1bFV6MP2s4tO4tDC7g52fsaFdtEWdO4GfGdqi20qUgPbnAJqixOyIAvCSx1DDj3YIUB4CD06owTWUsOAuQ==} + engines: {node: '>=18.0.0'} hasBin: true dependencies: esbuild: 0.18.20 @@ -5935,6 +5809,11 @@ packages: resolution: {integrity: sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==} dev: true + /unicorn-magic@0.1.0: + resolution: {integrity: sha512-lRfVq8fE8gz6QMBuDM6a+LO3IAzTi05H6gCVaUpir2E1Rwpo4ZUog45KpNXKC/Mn3Yb9UDuHumeFTo9iV/D9FQ==} + engines: {node: '>=18'} + dev: true + /uniq@1.0.1: resolution: {integrity: sha512-Gw+zz50YNKPDKXs+9d+aKAjVwpjNwqzvNpLigIruT4HA9lMZNdMqs9x07kKHB/L9WRzqp4+DlTU5s4wG2esdoA==} dev: true @@ -5944,8 +5823,8 @@ packages: engines: {node: '>= 4.0.0'} dev: true - /universalify@2.0.0: - resolution: {integrity: sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ==} + /universalify@2.0.1: + resolution: {integrity: sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw==} engines: {node: '>= 10.0.0'} dev: true @@ -5963,7 +5842,7 @@ packages: /uri-js@4.4.1: resolution: {integrity: sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==} dependencies: - punycode: 2.3.0 + punycode: 2.3.1 dev: true /util-deprecate@1.0.2: @@ -5975,7 +5854,7 @@ packages: engines: {node: '>=10.12.0'} dependencies: '@jridgewell/trace-mapping': 0.3.20 - '@types/istanbul-lib-coverage': 2.0.5 + '@types/istanbul-lib-coverage': 2.0.6 convert-source-map: 2.0.0 dev: true @@ -5986,7 +5865,7 @@ packages: spdx-expression-parse: 3.0.1 dev: true - /vite-node@0.34.6(@types/node@20.8.9): + /vite-node@0.34.6(@types/node@20.9.0): resolution: {integrity: sha512-nlBMJ9x6n7/Amaz6F3zJ97EBwR2FkzhBRxF5e+jE6LA3yi6Wtc2lyTij1OnDMIr34v5g/tVQtsVAzhT0jc5ygA==} engines: {node: '>=v14.18.0'} hasBin: true @@ -5996,7 +5875,7 @@ packages: mlly: 1.4.2 pathe: 1.1.1 picocolors: 1.0.0 - vite: 4.5.0(@types/node@20.8.9) + vite: 4.5.0(@types/node@20.9.0) transitivePeerDependencies: - '@types/node' - less @@ -6008,7 +5887,7 @@ packages: - terser dev: true - /vite@4.5.0(@types/node@20.8.9): + /vite@4.5.0(@types/node@20.9.0): resolution: {integrity: sha512-ulr8rNLA6rkyFAlVWw2q5YJ91v098AFQ2R0PRFwPzREXOUJQPtFUG0t+/ZikhaOCDqFoDhN6/v8Sq0o4araFAw==} engines: {node: ^14.18.0 || >=16.0.0} hasBin: true @@ -6036,7 +5915,7 @@ packages: terser: optional: true dependencies: - '@types/node': 20.8.9 + '@types/node': 20.9.0 esbuild: 0.18.20 postcss: 8.4.31 rollup: 3.29.4 @@ -6044,7 +5923,7 @@ packages: fsevents: 2.3.3 dev: true - /vitest@0.34.6(@edge-runtime/vm@3.1.6)(@vitest/browser@0.34.6)(playwright@1.39.0): + /vitest@0.34.6(@edge-runtime/vm@3.1.7)(@vitest/browser@0.34.6)(playwright@1.39.0): resolution: {integrity: sha512-+5CALsOvbNKnS+ZHMXtuUC7nL8/7F1F2DnHGjSsszX8zCjWSSviphCb/NuS9Nzf4Q03KyyDRBAXhF/8lffME4Q==} engines: {node: '>=v14.18.0'} hasBin: true @@ -6075,10 +5954,10 @@ packages: webdriverio: optional: true dependencies: - '@edge-runtime/vm': 3.1.6 - '@types/chai': 4.3.9 - '@types/chai-subset': 1.3.4 - '@types/node': 20.8.9 + '@edge-runtime/vm': 3.1.7 + '@types/chai': 4.3.10 + '@types/chai-subset': 1.3.5 + '@types/node': 20.9.0 '@vitest/browser': 0.34.6(esbuild@0.18.20)(vitest@0.34.6) '@vitest/expect': 0.34.6 '@vitest/runner': 0.34.6 @@ -6095,12 +5974,12 @@ packages: pathe: 1.1.1 picocolors: 1.0.0 playwright: 1.39.0 - std-env: 3.4.3 + std-env: 3.5.0 strip-literal: 1.3.0 tinybench: 2.5.1 tinypool: 0.7.0 - vite: 4.5.0(@types/node@20.8.9) - vite-node: 0.34.6(@types/node@20.8.9) + vite: 4.5.0(@types/node@20.9.0) + vite-node: 0.34.6(@types/node@20.9.0) why-is-node-running: 2.2.2 transitivePeerDependencies: - less @@ -6321,5 +6200,3 @@ packages: repeat-string: 1.6.1 strip-color: 0.1.0 dev: true - -publishDirectory: dist diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml new file mode 100644 index 000000000..924b55f42 --- /dev/null +++ b/pnpm-workspace.yaml @@ -0,0 +1,2 @@ +packages: + - packages/* diff --git a/scripts/clean.mjs b/scripts/clean.mjs new file mode 100644 index 000000000..60b038868 --- /dev/null +++ b/scripts/clean.mjs @@ -0,0 +1,16 @@ +import * as Fs from "node:fs"; +import * as Glob from "glob"; + +[".", ...Glob.sync("packages/*")].forEach((pkg) => { + const files = [ + ".tsbuildinfo", + "docs", + "build", + "dist", + "coverage", + ]; + + files.forEach((file) => { + Fs.rmSync(`${pkg}/${file}`, { recursive: true, force: true }, () => {}); + }); +}); diff --git a/tsconfig.base.json b/tsconfig.base.json index 735e3be3c..06c39ca68 100644 --- a/tsconfig.base.json +++ b/tsconfig.base.json @@ -13,7 +13,11 @@ "emitDecoratorMetadata": true, "experimentalDecorators": true, "moduleResolution": "NodeNext", - "lib": ["ES2022", "DOM"], + "lib": [ + "ES2022", + "DOM", + "DOM.Iterable" + ], "isolatedModules": true, "sourceMap": true, "declarationMap": true, @@ -36,11 +40,16 @@ "incremental": true, "removeComments": false, "paths": { - "effect": ["./src/index.js"], - "effect/*": ["./src/*.js"], - "effect-test/*": ["./test/*.js"] + "effect": [ + "./packages/effect/src/index.js" + ], + "effect/*": [ + "./packages/effect/src/*.js" + ], + "effect-test/*": [ + "./packages/effect/test/*.js" + ] }, - "types": ["node"], "plugins": [ { "name": "@effect/language-service" diff --git a/tsconfig.build.json b/tsconfig.build.json index e3c415a69..b70cd28e0 100644 --- a/tsconfig.build.json +++ b/tsconfig.build.json @@ -1,9 +1,8 @@ { - "extends": "./tsconfig.src.json", - "compilerOptions": { - "tsBuildInfoFile": ".tsbuildinfo/build.tsbuildinfo", - "outDir": "build/esm", - "declarationDir": "build/dts", - "stripInternal": true - } + "extends": "./tsconfig.base.json", + "references": [ + { + "path": "packages/effect/tsconfig.build.json" + } + ] } diff --git a/tsconfig.json b/tsconfig.json index 7eb12b079..ad132bb87 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -2,10 +2,7 @@ "extends": "./tsconfig.base.json", "references": [ { - "path": "./tsconfig.src.json" - }, - { - "path": "./tsconfig.test.json" + "path": "packages/effect" } ] } diff --git a/vitest.config.ts b/vitest.config.ts deleted file mode 100644 index 0c8b13430..000000000 --- a/vitest.config.ts +++ /dev/null @@ -1,22 +0,0 @@ -/// -import path from "path" -import { defineConfig } from "vite" - -export default defineConfig({ - test: { - include: ["./test/**/*.{js,mjs,cjs,ts,mts,cts,jsx,tsx}"], - exclude: ["./test/util.ts", "./test/utils/**/*.ts", "./test/**/*.init.ts"], - browser: { - name: "chromium", - provider: "playwright", - headless: true - }, - fakeTimers: { toFake: undefined } - }, - resolve: { - alias: { - "effect-test": path.join(__dirname, "test"), - "effect": path.join(__dirname, "src") - } - } -}) diff --git a/vitest.shared.ts b/vitest.shared.ts new file mode 100644 index 000000000..4a5e91f2c --- /dev/null +++ b/vitest.shared.ts @@ -0,0 +1,12 @@ +import * as path from "path" +import { defineConfig } from "vitest/config" + +export default defineConfig({ + resolve: { + alias: { + "effect-test": path.join(__dirname, "packages/effect/test"), + "effect": path.join(__dirname, "packages/effect/src") + } + } +}) + diff --git a/vitest.workspace.ts b/vitest.workspace.ts new file mode 100644 index 000000000..9fbb0e206 --- /dev/null +++ b/vitest.workspace.ts @@ -0,0 +1,5 @@ +import { defineWorkspace } from "vitest/config" + +export default defineWorkspace([ + "packages/*" +])