import type { TypeLambda } from "./HKT.js"; /** * @category type class * @since 2.0.0 */ export interface Order { (self: A, that: A): -1 | 0 | 1; } /** * @category type lambdas * @since 2.0.0 */ export interface OrderTypeLambda extends TypeLambda { readonly type: Order; } /** * @category constructors * @since 2.0.0 */ export declare const make: (compare: (self: A, that: A) => -1 | 0 | 1) => Order; /** * @category instances * @since 2.0.0 */ export declare const string: Order; /** * @category instances * @since 2.0.0 */ export declare const number: Order; /** * @category instances * @since 2.0.0 */ export declare const boolean: Order; /** * @category instances * @since 2.0.0 */ export declare const bigint: Order; /** * @since 2.0.0 */ export declare const reverse: (O: Order) => Order; /** * @category combining * @since 2.0.0 */ export declare const combine: { /** * @category combining * @since 2.0.0 */ (that: Order): (self: Order) => Order; /** * @category combining * @since 2.0.0 */ (self: Order, that: Order): Order; }; /** * @category combining * @since 2.0.0 */ export declare const combineMany: { /** * @category combining * @since 2.0.0 */ (collection: Iterable>): (self: Order) => Order; /** * @category combining * @since 2.0.0 */ (self: Order, collection: Iterable>): Order; }; /** * @since 2.0.0 */ export declare const empty: () => Order; /** * @category combining * @since 2.0.0 */ export declare const combineAll: (collection: Iterable>) => Order; /** * @category mapping * @since 2.0.0 */ export declare const mapInput: { /** * @category mapping * @since 2.0.0 */ (f: (b: B) => A): (self: Order) => Order; /** * @category mapping * @since 2.0.0 */ (self: Order, f: (b: B) => A): Order; }; /** * @category instances * @since 2.0.0 */ export declare const Date: Order; /** * @category combining * @since 2.0.0 */ export declare const product: { (that: Order): (self: Order) => Order; (self: Order, that: Order): Order; }; /** * @category combining * @since 2.0.0 */ export declare const all: (collection: Iterable>) => Order>; /** * @category combining * @since 2.0.0 */ export declare const productMany: { (collection: Iterable>): (self: Order) => Order]>; (self: Order, collection: Iterable>): Order]>; }; /** * 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. * * @category combinators * @since 2.0.0 */ export declare const tuple: >>(...elements: T) => Order] ? A : never; }>>; /** * 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. * * @category combinators * @since 2.0.0 */ export declare const array: (O: Order) => Order>; /** * 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. * * @category combinators * @since 2.0.0 */ export declare const struct: ; }>(fields: R) => Order<{ [K in keyof R]: [R[K]] extends [Order] ? A : never; }>; /** * Test whether one value is _strictly less than_ another. * * @since 2.0.0 */ export declare const lessThan: (O: Order) => { (that: A): (self: A) => boolean; (self: A, that: A): boolean; }; /** * Test whether one value is _strictly greater than_ another. * * @since 2.0.0 */ export declare const greaterThan: (O: Order) => { (that: A): (self: A) => boolean; (self: A, that: A): boolean; }; /** * Test whether one value is _non-strictly less than_ another. * * @since 2.0.0 */ export declare const lessThanOrEqualTo: (O: Order) => { (that: A): (self: A) => boolean; (self: A, that: A): boolean; }; /** * Test whether one value is _non-strictly greater than_ another. * * @since 2.0.0 */ export declare const greaterThanOrEqualTo: (O: Order) => { (that: A): (self: A) => boolean; (self: A, that: A): boolean; }; /** * Take the minimum of two values. If they are considered equal, the first argument is chosen. * * @since 2.0.0 */ export declare const min: (O: Order) => { (that: A): (self: A) => A; (self: A, that: A): A; }; /** * Take the maximum of two values. If they are considered equal, the first argument is chosen. * * @since 2.0.0 */ export declare const max: (O: Order) => { (that: A): (self: A) => A; (self: A, that: A): A; }; /** * Clamp a value between a minimum and a maximum. * * @example * ```ts * import * as assert from "node:assert" * import { Order, Number } from "effect" * * 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) * ``` * * @since 2.0.0 */ export declare const clamp: (O: Order) => { (options: { minimum: A; maximum: A; }): (self: A) => A; (self: A, options: { minimum: A; maximum: A; }): A; }; /** * Test whether a value is between a minimum and a maximum (inclusive). * * @since 2.0.0 */ export declare const between: (O: Order) => { (options: { minimum: A; maximum: A; }): (self: A) => boolean; (self: A, options: { minimum: A; maximum: A; }): boolean; }; //# sourceMappingURL=Order.d.ts.map