import * as Equal from 'effect/Equal'; import * as equivalence from 'effect/Equivalence'; import { type Inspectable } from 'effect/Inspectable'; import { type Pipeable } from 'effect/Pipeable'; declare const TypeId: unique symbol; export type TypeId = typeof TypeId; /** * An integer range, bounded inclusively of its minimum value, and either inclusively or exclusively of * its maximum value. */ export interface IntegerRange extends Equal.Equal, Pipeable, Inspectable { readonly [TypeId]: TypeId; readonly value: IntegerRangeValue; } /** * Describes the internal structure of an {@link IntegerRange}. */ export type IntegerRangeValue = { readonly _tag: 'Inclusive'; readonly min: number; readonly max: number; } | { readonly _tag: 'Exclusive'; readonly min: number; readonly max: number; }; /** * An input for constructing {@link IntegerRange} instances. * * @remarks * The tuple form of {@link IntegerRangeInput}, when used with {@link from}, will create an * {@link IntegerRange} that is _exclusive_ of `max` ( i.e., `min <= x < max`). When used with {@link inclusive} or * {@link exclusive}, `max` will be _inclusive_ or _exclusive_ respectively. * * The template string forms of {@link IntegerRangeInput} represent _inclusive_ or _exclusive_ ranges as follows: * - `'n..m'` will create a _exclusive_ range that contains all values `x` where `n <= x < m`, and * - `'n..=m'` will create an _inclusive_ range that contains all values `x` where `n <= x <= m`. */ export type IntegerRangeInput = IntegerRange | readonly [min: number, max: number] | `${number}..${number}` | `${number}..=${number}`; /** * Provides equivalence for {@link IntegerRange} instances. * * @remarks * For two {@link IntegerRange} instances to be considered equal, both their minimum and maximum values * must be equal, and they should both have the same type of inclusion (i.e., inclusive or exclusive). This is * not _range equivalence_ which determines if two {@link IntegerRange} instances represent the same sequence * of values. * * @category equivalence */ export declare const Equivalence: equivalence.Equivalence; /** * Determines if a value is an integer range. * * @param u The value to check. * @returns `true` if `u` is an {@link IntegerRange}; `false` otherwise. * * @category guards */ export declare const isIntegerRange: (u: unknown) => u is IntegerRange; /** * Determines if an integer range will be _inclusive_ of its maximum value. * * @param self The {@link IntegerRange} to check. * @returns `true` if `self` is an inclusive {@link IntegerRange}; `false` otherwise. * * @category guards */ export declare const isInclusive: (self: IntegerRange) => boolean; /** * Determines if an integer range will be _exclusive_ of its maximum value. * * @param self The {@link IntegerRange} to check. * @returns `true` if `self` is an exclusive {@link IntegerRange}; `false` otherwise. * * @category guards */ export declare const isExclusive: (self: IntegerRange) => boolean; /** * Determines if two integer ranges are equal. * * @category predicates */ export declare const equals: { (that: IntegerRange): (self: IntegerRange) => boolean; (self: IntegerRange, that: IntegerRange): boolean; }; /** * Determines if an integer range is inclusive of a value. * * @category predicates */ export declare const contains: { (value: number): (self: IntegerRange) => boolean; (self: IntegerRange, value: number): boolean; }; /** * Creates _inclusive_ integer ranges. * * @category constructors */ export declare const inclusive: { /** * @param range A tuple defining the minimum and maximum values of the integer range. * @returns An {@link IntegerRange} that is _inclusive_ of its maximum value. */ (range: readonly [min: number, max: number]): IntegerRange; /** * Creates an _inclusive_ integer range that is equivalent to a source {@link IntegerRange} with regards to * the values that it can contain. * * @param range The {@link IntegerRange} to use as a basis for an _inclusive_ integer range . * @returns `range`, if `range` is already an _inclusive_ integer range; otherwise, a new {@link IntegerRange} that * is an _inclusive_ version of `range`. */ (range: IntegerRange): IntegerRange; }; /** * Creates _exclusive_ integer ranges. * * @category constructors */ export declare const exclusive: { /** * @param range A tuple defining the minimum and maximum values of the integer range. * @returns An {@link IntegerRange} that is _exclusive_ of its maximum value. */ (range: readonly [min: number, max: number]): IntegerRange; /** * Creates an _exclusive_ integer range that is equivalent to a source {@link IntegerRange} with regards to * the values that it can contain. * * @param range The {@link IntegerRange} to use as a basis for an _exclusive_ integer range . * @returns `range`, if `range` is already an _exclusive_ integer range; otherwise, a new {@link IntegerRange} that * is an _exclusive_ version of `range`. */ (range: IntegerRange): IntegerRange; }; /** * Creates an integer range. * * @param input The input to use when constructing the integer range. * @returns An {@link IntegerRange} derived from `input`. * * @remarks * The tuple form of {@link IntegerRangeInput}, will create an {@link IntegerRange} that is _exclusive_ * of `max` ( i.e., `min <= x < max`). * * @category constructors */ export declare const from: (input: IntegerRangeInput) => IntegerRange; export {}; //# sourceMappingURL=IntegerRange.d.ts.map