/** * @since 1.0.0 */ import type { Bounded } from "@fp-ts/core/typeclass/Bounded"; import type { Semigroup } from "@fp-ts/core/typeclass/Semigroup"; /** * @category type class * @since 1.0.0 */ export interface Monoid extends Semigroup { readonly empty: A; readonly combineAll: (collection: Iterable) => A; } /** * @category constructors * @since 1.0.0 */ export declare const fromSemigroup: (S: Semigroup, empty: A) => Monoid; /** * Get a monoid where `combine` will return the minimum, based on the provided bounded order. * * The `empty` value is the `maxBound` value. * * @category constructors * @since 1.0.0 */ export declare const min: (B: Bounded) => Monoid; /** * Get a monoid where `combine` will return the maximum, based on the provided bounded order. * * The `empty` value is the `minimum` value. * * @category constructors * @since 1.0.0 */ export declare const max: (B: Bounded) => Monoid; /** * The dual of a `Monoid`, obtained by swapping the arguments of `combine`. * * @category combinators * @since 1.0.0 */ export declare const reverse: (M: Monoid) => Monoid; /** * @category instances * @since 1.0.0 */ export declare const string: Monoid; /** * `number` monoid under addition. * * The `empty` value is `0`. * * @category instances * @since 1.0.0 */ export declare const numberSum: Monoid; /** * `number` monoid under multiplication. * * The `empty` value is `1`. * * @category instances * @since 1.0.0 */ export declare const numberMultiply: Monoid; /** * `number` monoid under addition. * * The `bigint` value is `0n`. * * @category instances * @since 1.0.0 */ export declare const bigintSum: Monoid; /** * `bigint` monoid under multiplication. * * The `empty` value is `1n`. * * @category instances * @since 1.0.0 */ export declare const bigintMultiply: Monoid; /** * `boolean` monoid under conjunction. * * The `empty` value is `true`. * * @category instances * @since 1.0.0 */ export declare const booleanAll: Monoid; /** * `boolean` monoid under disjunction. * * The `empty` value is `false`. * * @category instances * @since 1.0.0 */ export declare const booleanAny: Monoid; /** * This function creates and returns a new `Monoid` for a tuple of values based on the given `Monoid`s for each element in the tuple. * The returned `Monoid` combines two tuples of the same type by applying the corresponding `Monoid` passed as arguments to each element in the tuple. * * The `empty` value of the returned `Monoid` is the tuple of `empty` values of the input `Monoid`s. * * 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: (...monoids: { [K in keyof A]: Monoid; }) => Monoid; /** * Given a type `A`, this function creates and returns a `Monoid` for `Array`. * The returned `Monoid`'s `empty` value is the empty array. * * @category combinators * @since 1.0.0 */ export declare const mutableArray: () => Monoid; /** * Given a type `A`, this function creates and returns a `Semigroup` for `ReadonlyArray`. * The returned `Monoid`'s empty value is the empty array. * * @category combinators * @since 1.0.0 */ export declare const array: () => Monoid>; /** * This function creates and returns a new `Monoid` for a struct of values based on the given `Monoid`s for each property in the struct. * The returned `Monoid` combines two structs of the same type by applying the corresponding `Monoid` passed as arguments to each property in the struct. * * The `empty` value of the returned `Monoid` is a struct where each property is the `empty` value of the corresponding `Monoid` in the input `monoids` object. * * 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: (monoids: { readonly [K in keyof A]: Monoid; }) => Monoid<{ readonly [K_1 in keyof A]: A[K_1]; }>; //# sourceMappingURL=Monoid.d.ts.map