/** * 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 } from './Alt' import { Applicative, Applicative1, Applicative2, Applicative2C, Applicative3 } from './Applicative' import { HKT, Kind, Kind2, Kind3, URIS, URIS2, URIS3 } from './HKT' /** * @category type classes * @since 2.0.0 */ export interface Alternative extends Applicative, Alt { readonly zero: () => HKT } /** * @category type classes * @since 2.0.0 */ export interface Alternative1 extends Applicative1, Alt1 { readonly zero: () => Kind } /** * @category type classes * @since 2.0.0 */ export interface Alternative2 extends Applicative2, Alt2 { readonly zero: () => Kind2 } /** * @category type classes * @since 2.0.0 */ export interface Alternative2C extends Applicative2C, Alt2C { readonly zero: () => Kind2 } /** * @category type classes * @since 2.0.0 */ export interface Alternative3 extends Applicative3, Alt3 { readonly zero: () => Kind3 }