import type { TypeLambda } from "@fp-ts/core/HKT";
import type * as invariant from "@fp-ts/core/typeclass/Invariant";
import type { Order } from "@fp-ts/core/typeclass/Order";
import type * as product_ from "@fp-ts/core/typeclass/Product";
import type * as semiProduct from "@fp-ts/core/typeclass/SemiProduct";
/**
* @category type class
* @since 1.0.0
*/
export interface Semigroup {
readonly combine: (self: A, that: A) => A;
readonly combineMany: (self: A, collection: Iterable) => A;
}
/**
* @category type lambdas
* @since 1.0.0
*/
export interface SemigroupTypeLambda extends TypeLambda {
readonly type: Semigroup;
}
/**
* @param combineMany - Useful when `combineMany` can be optimised
*
* @category constructors
* @since 1.0.0
*/
export declare const make: (combine: (self: A, that: A) => A, combineMany?: (self: A, collection: Iterable) => A) => Semigroup;
/**
* @category instances
* @since 1.0.0
*/
export declare const string: Semigroup;
/**
* `number` semigroup under addition.
*
* @category instances
* @since 1.0.0
*/
export declare const numberSum: Semigroup;
/**
* `number` semigroup under multiplication.
*
* @category instances
* @since 1.0.0
*/
export declare const numberMultiply: Semigroup;
/**
* `bigint` semigroup under addition.
*
* @category instances
* @since 1.0.0
*/
export declare const bigintSum: Semigroup;
/**
* `bigint` semigroup under multiplication.
*
* @category instances
* @since 1.0.0
*/
export declare const bigintMultiply: Semigroup;
/**
* `boolean` semigroup under conjunction.
*
* @category instances
* @since 1.0.0
*/
export declare const booleanAll: Semigroup;
/**
* `boolean` semigroup under disjunction.
*
* @category instances
* @since 1.0.0
*/
export declare const booleanAny: Semigroup;
/**
* This function creates and returns a new `Semigroup` for a tuple of values based on the given `Semigroup`s for each element in the tuple.
* The returned `Semigroup` combines two tuples of the same type by applying the corresponding `Semigroup` passed as arguments to each element in the tuple.
*
* It is useful when you need to combine two tuples of the same type and you have a specific way of combining each element of the tuple.
*
* @category combinators
* @since 1.0.0
*/
export declare const tuple: (...semigroups: { readonly [K in keyof A]: Semigroup; }) => Semigroup;
/**
* Given a type `A`, this function creates and returns a `Semigroup` for `Array`.
* The returned `Semigroup` combines two arrays by concatenating them.
*
* @category combinators
* @since 1.0.0
*/
export declare const mutableArray: () => Semigroup;
/**
* Given a type `A`, this function creates and returns a `Semigroup` for `ReadonlyArray`.
* The returned `Semigroup` combines two arrays by concatenating them.
*
* @category combinators
* @since 1.0.0
*/
export declare const array: () => Semigroup>;
/**
* This function creates and returns a new `Semigroup` for a struct of values based on the given `Semigroup`s for each property in the struct.
* The returned `Semigroup` combines two structs of the same type by applying the corresponding `Semigroup` passed as arguments to each property in the struct.
*
* It is useful when you need to combine two structs of the same type and you have a specific way of combining each property of the struct.
*
* @category combinators
* @since 1.0.0
*/
export declare const struct: (semigroups: { readonly [K in keyof A]: Semigroup; }) => Semigroup<{ readonly [K_1 in keyof A]: A[K_1]; }>;
/**
* `Semigroup` that returns last minimum of elements.
*
* @category constructors
* @since 1.0.0
*/
export declare const min: (O: Order) => Semigroup;
/**
* `Semigroup` that returns last maximum of elements.
*
* @category constructors
* @since 1.0.0
*/
export declare const max: (O: Order) => Semigroup;
/**
* @category constructors
* @since 1.0.0
*/
export declare const constant: (a: A) => Semigroup;
/**
* The dual of a `Semigroup`, obtained by flipping the arguments of `combine`.
*
* @since 1.0.0
*/
export declare const reverse: (S: Semigroup) => Semigroup;
/**
* @since 1.0.0
*/
export declare const intercalate: {
(separator: A): (S: Semigroup) => Semigroup;
(S: Semigroup, separator: A): Semigroup;
};
/**
* Always return the first argument.
*
* @category instances
* @since 1.0.0
*/
export declare const first: () => Semigroup;
/**
* Always return the last argument.
*
* @category instances
* @since 1.0.0
*/
export declare const last: () => Semigroup;
/**
* @since 1.0.0
*/
export declare const imap: {
(to: (a: A) => B, from: (b: B) => A): (self: Semigroup) => Semigroup;
(self: Semigroup, to: (a: A) => B, from: (b: B) => A): Semigroup;
};
/**
* @category instances
* @since 1.0.0
*/
export declare const Invariant: invariant.Invariant;
/**
* @category instances
* @since 1.0.0
*/
export declare const SemiProduct: semiProduct.SemiProduct;
/**
* @category instances
* @since 1.0.0
*/
export declare const Product: product_.Product;
//# sourceMappingURL=Semigroup.d.ts.map