import type { TypeLambda } from "effect/HKT";
import type { Order } from "effect/Order";
import type * as invariant from "./Invariant.js";
import * as product_ from "./Product.js";
import type * as semiProduct from "./SemiProduct.js";
/**
* @category type class
* @since 0.24.0
*/
export interface Semigroup {
readonly combine: (self: A, that: A) => A;
readonly combineMany: (self: A, collection: Iterable) => A;
}
/**
* @category type lambdas
* @since 0.24.0
*/
export interface SemigroupTypeLambda extends TypeLambda {
readonly type: Semigroup;
}
/**
* The `combineMany` parameter is optional and defaults to a standard
* implementation. You can provide a custom implementation when performance
* optimizations are possible.
*
* @category constructors
* @since 0.24.0
*/
export declare const make: (combine: Semigroup["combine"], combineMany?: Semigroup["combineMany"]) => Semigroup;
/**
* `Semigroup` that returns last minimum of elements.
*
* @category constructors
* @since 0.24.0
*/
export declare const min: (O: Order) => Semigroup;
/**
* `Semigroup` that returns last maximum of elements.
*
* @category constructors
* @since 0.24.0
*/
export declare const max: (O: Order) => Semigroup;
/**
* @category constructors
* @since 0.24.0
*/
export declare const constant: (a: A) => Semigroup;
/**
* The dual of a `Semigroup`, obtained by flipping the arguments of `combine`.
*
* @since 0.24.0
*/
export declare const reverse: (S: Semigroup) => Semigroup;
/**
* The `intercalate` API returns a function that takes a `Semigroup` instance and a separator value, and returns a new
* `Semigroup` instance that combines values with the given separator.
*
* This API is useful when you want to combine values with a specific separator. For example, when you want to concatenate
* an array of strings with a separator string in between.
*
* It is interesting to note that there is no equivalent API in the `Monoid` module. This is because the value `empty`,
* which is required for the `Monoid` interface, cannot exist.
*
* @since 0.24.0
*/
export declare const intercalate: {
/**
* The `intercalate` API returns a function that takes a `Semigroup` instance and a separator value, and returns a new
* `Semigroup` instance that combines values with the given separator.
*
* This API is useful when you want to combine values with a specific separator. For example, when you want to concatenate
* an array of strings with a separator string in between.
*
* It is interesting to note that there is no equivalent API in the `Monoid` module. This is because the value `empty`,
* which is required for the `Monoid` interface, cannot exist.
*
* @since 0.24.0
*/
(separator: A): (S: Semigroup) => Semigroup;
/**
* The `intercalate` API returns a function that takes a `Semigroup` instance and a separator value, and returns a new
* `Semigroup` instance that combines values with the given separator.
*
* This API is useful when you want to combine values with a specific separator. For example, when you want to concatenate
* an array of strings with a separator string in between.
*
* It is interesting to note that there is no equivalent API in the `Monoid` module. This is because the value `empty`,
* which is required for the `Monoid` interface, cannot exist.
*
* @since 0.24.0
*/
(S: Semigroup, separator: A): Semigroup;
};
/**
* Always return the first argument.
*
* @category instances
* @since 0.24.0
*/
export declare const first: () => Semigroup;
/**
* Always return the last argument.
*
* @category instances
* @since 0.24.0
*/
export declare const last: () => Semigroup;
/**
* @since 0.24.0
*/
export declare const imap: {
/**
* @since 0.24.0
*/
(to: (a: A) => B, from: (b: B) => A): (self: Semigroup) => Semigroup;
/**
* @since 0.24.0
*/
(self: Semigroup, to: (a: A) => B, from: (b: B) => A): Semigroup;
};
/**
* @category instances
* @since 0.24.0
*/
export declare const Invariant: invariant.Invariant;
/**
* @category instances
* @since 0.24.0
*/
export declare const SemiProduct: semiProduct.SemiProduct;
/**
* @category instances
* @since 0.24.0
*/
export declare const Product: product_.Product;
/**
* Similar to `Promise.all` but operates on `Semigroup`s.
*
* ```
* [Semigroup, Semigroup, ...] -> Semigroup<[A, B, ...]>
* ```
*
* 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 0.24.0
*/
export declare const tuple: >>(...elements: T) => Semigroup<{
readonly [I in keyof T]: [T[I]] extends [Semigroup] ? A : never;
}>;
/**
* 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 0.24.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 0.24.0
*/
export declare const struct: ;
}>(fields: R) => Semigroup<{
readonly [K in keyof R]: [R[K]] extends [Semigroup] ? A : never;
}>;
//# sourceMappingURL=Semigroup.d.ts.map