/** * The `Alternative` type class extends the `Alt` type class with a value that should be the left and right identity for `alt`. * * It is similar to `Monoid`, except that it applies to types of kind `* -> *`, like `Array` or `Option`, rather than * concrete types like `string` or `number`. * * `Alternative` instances should satisfy the following laws: * * 1. Left identity: `A.alt(zero, fa) <-> fa` * 2. Right identity: `A.alt(fa, zero) <-> fa` * 3. Annihilation: `A.map(zero, f) <-> zero` * 4. Distributivity: `A.ap(A.alt(fab, gab), fa) <-> A.alt(A.ap(fab, fa), A.ap(gab, fa))` * 5. Annihilation: `A.ap(zero, fa) <-> zero` * * @since 2.0.0 */ import { Alt, Alt1, Alt2, Alt2C, Alt3, Alt3C, Alt4 } from './Alt.js'; import { Applicative, Applicative1, Applicative2, Applicative2C, Applicative3, Applicative3C, Applicative4 } from './Applicative.js'; import { HKT, Kind, Kind2, Kind3, Kind4, URIS, URIS2, URIS3, URIS4 } from './HKT.js'; import { Monoid } from './Monoid.js'; import { Semigroup } from './Semigroup.js'; import { Zero, Zero1, Zero2, Zero2C, Zero3, Zero3C, Zero4 } from './Zero.js'; /** * @category model * @since 2.0.0 */ export interface Alternative extends Applicative, Alt, Zero { } /** * @category model * @since 2.0.0 */ export interface Alternative1 extends Applicative1, Alt1, Zero1 { } /** * @category model * @since 2.0.0 */ export interface Alternative2 extends Applicative2, Alt2, Zero2 { } /** * @category model * @since 2.0.0 */ export interface Alternative2C extends Applicative2C, Alt2C, Zero2C { } /** * @category model * @since 2.0.0 */ export interface Alternative3 extends Applicative3, Alt3, Zero3 { } /** * @category model * @since 2.10.0 */ export interface Alternative3C extends Applicative3C, Alt3C, Zero3C { } /** * @category model * @since 2.10.0 */ export interface Alternative4 extends Applicative4, Alt4, Zero4 { } /** * @since 2.11.0 */ export declare function altAll(F: Alternative4): (as: ReadonlyArray>) => Kind4; export declare function altAll(F: Alternative3): (as: ReadonlyArray>) => Kind3; export declare function altAll(F: Alternative3C): (as: ReadonlyArray>) => Kind3; export declare function altAll(F: Alternative2): (as: ReadonlyArray>) => Kind2; export declare function altAll(F: Alternative2C): (as: ReadonlyArray>) => Kind2; export declare function altAll(F: Alternative1): (as: ReadonlyArray>) => Kind; export declare function altAll(F: Alternative): (as: ReadonlyArray>) => HKT; /** * Lift a semigroup into a monoid alternative 'F', the inner values are concatenated using the provided `Semigroup`. * @since 2.13.0 */ export declare function getAlternativeMonoid(F: Alternative4): (S: Semigroup) => Monoid>; export declare function getAlternativeMonoid(F: Alternative3): (S: Semigroup) => Monoid>; export declare function getAlternativeMonoid(F: Alternative3C): (S: Semigroup) => Monoid>; export declare function getAlternativeMonoid(F: Alternative2): (S: Semigroup) => Monoid>; export declare function getAlternativeMonoid(F: Alternative2C): (S: Semigroup) => Monoid>; export declare function getAlternativeMonoid(F: Alternative1): (S: Semigroup) => Monoid>; export declare function getAlternativeMonoid(F: Alternative): (S: Semigroup) => Monoid>;