/** * A `Foldable` with an additional index. * A `FoldableWithIndex` instance must be compatible with its `Foldable` instance * * ```ts * reduce(fa, b, f) = reduceWithIndex(fa, b, (_, b, a) => f(b, a)) * foldMap(M)(fa, f) = foldMapWithIndex(M)(fa, (_, a) => f(a)) * reduceRight(fa, b, f) = reduceRightWithIndex(fa, b, (_, a, b) => f(a, b)) * ``` * * @since 2.0.0 */ import { Foldable, Foldable1, Foldable2, Foldable2C, Foldable3, Foldable3C, Foldable4, FoldableComposition, FoldableComposition11, FoldableComposition12, FoldableComposition12C, FoldableComposition21, FoldableComposition22, FoldableComposition22C, FoldableComposition2C1 } from './Foldable' import { HKT, Kind, Kind2, Kind3, Kind4, URIS, URIS2, URIS3, URIS4 } from './HKT' import { Monoid } from './Monoid' /** * @category model * @since 2.0.0 */ export interface FoldableWithIndex extends Foldable { readonly reduceWithIndex: (fa: HKT, b: B, f: (i: I, b: B, a: A) => B) => B readonly foldMapWithIndex: (M: Monoid) => (fa: HKT, f: (i: I, a: A) => M) => M readonly reduceRightWithIndex: (fa: HKT, b: B, f: (i: I, a: A, b: B) => B) => B } /** * @category model * @since 2.0.0 */ export interface FoldableWithIndex1 extends Foldable1 { readonly reduceWithIndex: (fa: Kind, b: B, f: (i: I, b: B, a: A) => B) => B readonly foldMapWithIndex: (M: Monoid) => (fa: Kind, f: (i: I, a: A) => M) => M readonly reduceRightWithIndex: (fa: Kind, b: B, f: (i: I, a: A, b: B) => B) => B } /** * @category model * @since 2.0.0 */ export interface FoldableWithIndex2 extends Foldable2 { readonly reduceWithIndex: (fa: Kind2, b: B, f: (i: I, b: B, a: A) => B) => B readonly foldMapWithIndex: (M: Monoid) => (fa: Kind2, f: (i: I, a: A) => M) => M readonly reduceRightWithIndex: (fa: Kind2, b: B, f: (i: I, a: A, b: B) => B) => B } /** * @category model * @since 2.0.0 */ export interface FoldableWithIndex2C extends Foldable2C { readonly reduceWithIndex: (fa: Kind2, b: B, f: (i: I, b: B, a: A) => B) => B readonly foldMapWithIndex: (M: Monoid) => (fa: Kind2, f: (i: I, a: A) => M) => M readonly reduceRightWithIndex: (fa: Kind2, b: B, f: (i: I, a: A, b: B) => B) => B } /** * @category model * @since 2.0.0 */ export interface FoldableWithIndex3 extends Foldable3 { readonly reduceWithIndex: (fa: Kind3, b: B, f: (i: I, b: B, a: A) => B) => B readonly foldMapWithIndex: (M: Monoid) => (fa: Kind3, f: (i: I, a: A) => M) => M readonly reduceRightWithIndex: (fa: Kind3, b: B, f: (i: I, a: A, b: B) => B) => B } /** * @category model * @since 2.2.0 */ export interface FoldableWithIndex3C extends Foldable3C { readonly reduceWithIndex: (fa: Kind3, b: B, f: (i: I, b: B, a: A) => B) => B readonly foldMapWithIndex: (M: Monoid) => (fa: Kind3, f: (i: I, a: A) => M) => M readonly reduceRightWithIndex: (fa: Kind3, b: B, f: (i: I, a: A, b: B) => B) => B } /** * @category model * @since 2.0.0 */ export interface FoldableWithIndex4 extends Foldable4 { readonly reduceWithIndex: (fa: Kind4, b: B, f: (i: I, b: B, a: A) => B) => B readonly foldMapWithIndex: (M: Monoid) => (fa: Kind4, f: (i: I, a: A) => M) => M readonly reduceRightWithIndex: (fa: Kind4, b: B, f: (i: I, a: A, b: B) => B) => B } /** * `reduceWithIndex` composition. * * @since 2.10.0 */ export declare function reduceWithIndex( F: FoldableWithIndex1, G: FoldableWithIndex1 ): (b: B, f: (ij: readonly [I, J], b: B, a: A) => B) => (fga: Kind>) => B export declare function reduceWithIndex( F: FoldableWithIndex, G: FoldableWithIndex ): (b: B, f: (ij: readonly [I, J], b: B, a: A) => B) => (fga: HKT>) => B /** * `foldMapWithIndex` composition. * * @since 2.10.0 */ export declare function foldMapWithIndex( F: FoldableWithIndex1, G: FoldableWithIndex1 ): (M: Monoid) => (f: (ij: readonly [I, J], a: A) => M) => (fga: Kind>) => M export declare function foldMapWithIndex( F: FoldableWithIndex, G: FoldableWithIndex ): (M: Monoid) => (f: (ij: readonly [I, J], a: A) => M) => (fga: HKT>) => M /** * `reduceRightWithIndex` composition. * * @since 2.10.0 */ export declare function reduceRightWithIndex( F: FoldableWithIndex1, G: FoldableWithIndex1 ): (b: B, f: (ij: readonly [I, J], a: A, b: B) => B) => (fga: Kind>) => B export declare function reduceRightWithIndex( F: FoldableWithIndex, G: FoldableWithIndex ): (b: B, f: (ij: readonly [I, J], a: A, b: B) => B) => (fga: HKT>) => B /** * @category zone of death * @since 2.0.0 * @deprecated */ export interface FoldableWithIndexComposition extends FoldableComposition { readonly reduceWithIndex: (fga: HKT>, b: B, f: (i: [FI, GI], b: B, a: A) => B) => B readonly foldMapWithIndex: (M: Monoid) => (fga: HKT>, f: (i: [FI, GI], a: A) => M) => M readonly reduceRightWithIndex: (fga: HKT>, b: B, f: (i: [FI, GI], a: A, b: B) => B) => B } /** * @category zone of death * @since 2.0.0 * @deprecated */ export interface FoldableWithIndexComposition11 extends FoldableComposition11 { readonly reduceWithIndex: (fga: Kind>, b: B, f: (i: [FI, GI], b: B, a: A) => B) => B readonly foldMapWithIndex: (M: Monoid) => (fga: Kind>, f: (i: [FI, GI], a: A) => M) => M readonly reduceRightWithIndex: (fga: Kind>, b: B, f: (i: [FI, GI], a: A, b: B) => B) => B } /** * @category zone of death * @since 2.0.0 * @deprecated */ export interface FoldableWithIndexComposition12 extends FoldableComposition12 { readonly reduceWithIndex: (fga: Kind>, b: B, f: (i: [FI, GI], b: B, a: A) => B) => B readonly foldMapWithIndex: (M: Monoid) => (fga: Kind>, f: (i: [FI, GI], a: A) => M) => M readonly reduceRightWithIndex: (fga: Kind>, b: B, f: (i: [FI, GI], a: A, b: B) => B) => B } /** * @category zone of death * @since 2.0.0 * @deprecated */ export interface FoldableWithIndexComposition12C extends FoldableComposition12C { readonly reduceWithIndex: (fga: Kind>, b: B, f: (i: [FI, GI], b: B, a: A) => B) => B readonly foldMapWithIndex: (M: Monoid) => (fga: Kind>, f: (i: [FI, GI], a: A) => M) => M readonly reduceRightWithIndex: (fga: Kind>, b: B, f: (i: [FI, GI], a: A, b: B) => B) => B } /** * @category zone of death * @since 2.0.0 * @deprecated */ export interface FoldableWithIndexComposition21 extends FoldableComposition21 { readonly reduceWithIndex: (fga: Kind2>, b: B, f: (i: [FI, GI], b: B, a: A) => B) => B readonly foldMapWithIndex: ( M: Monoid ) => (fga: Kind2>, f: (i: [FI, GI], a: A) => M) => M readonly reduceRightWithIndex: (fga: Kind2>, b: B, f: (i: [FI, GI], a: A, b: B) => B) => B } /** * @category zone of death * @since 2.0.0 * @deprecated */ export interface FoldableWithIndexComposition2C1 extends FoldableComposition2C1 { readonly reduceWithIndex: (fga: Kind2>, b: B, f: (i: [FI, GI], b: B, a: A) => B) => B readonly foldMapWithIndex: (M: Monoid) => (fga: Kind2>, f: (i: [FI, GI], a: A) => M) => M readonly reduceRightWithIndex: (fga: Kind2>, b: B, f: (i: [FI, GI], a: A, b: B) => B) => B } /** * @category zone of death * @since 2.0.0 * @deprecated */ export interface FoldableWithIndexComposition22 extends FoldableComposition22 { readonly reduceWithIndex: ( fga: Kind2>, b: B, f: (i: [FI, GI], b: B, a: A) => B ) => B readonly foldMapWithIndex: ( M: Monoid ) => (fga: Kind2>, f: (i: [FI, GI], a: A) => M) => M readonly reduceRightWithIndex: ( fga: Kind2>, b: B, f: (i: [FI, GI], a: A, b: B) => B ) => B } /** * @category zone of death * @since 2.0.0 * @deprecated */ export interface FoldableWithIndexComposition22C extends FoldableComposition22C { readonly reduceWithIndex: (fga: Kind2>, b: B, f: (i: [FI, GI], b: B, a: A) => B) => B readonly foldMapWithIndex: ( M: Monoid ) => (fga: Kind2>, f: (i: [FI, GI], a: A) => M) => M readonly reduceRightWithIndex: ( fga: Kind2>, b: B, f: (i: [FI, GI], a: A, b: B) => B ) => B } /** * Use * * - [reduceWithIndex](#reducewithindex) * - [foldMapWithIndex](#foldmapwithindex) * - [reduceRightWithIndex](#reducerightwithindex) * * instead. * * @category zone of death * @since 2.0.0 * @deprecated */ export declare function getFoldableWithIndexComposition( F: FoldableWithIndex2, G: FoldableWithIndex2C ): FoldableWithIndexComposition22C /** @deprecated */ export declare function getFoldableWithIndexComposition( F: FoldableWithIndex2, G: FoldableWithIndex2 ): FoldableWithIndexComposition22 /** @deprecated */ export declare function getFoldableWithIndexComposition( F: FoldableWithIndex2C, G: FoldableWithIndex1 ): FoldableWithIndexComposition2C1 /** @deprecated */ export declare function getFoldableWithIndexComposition( F: FoldableWithIndex2, G: FoldableWithIndex1 ): FoldableWithIndexComposition21 /** @deprecated */ export declare function getFoldableWithIndexComposition( F: FoldableWithIndex1, G: FoldableWithIndex2 ): FoldableWithIndexComposition12 /** @deprecated */ export declare function getFoldableWithIndexComposition( F: FoldableWithIndex1, G: FoldableWithIndex2 ): FoldableWithIndexComposition12 /** @deprecated */ export declare function getFoldableWithIndexComposition( F: FoldableWithIndex1, G: FoldableWithIndex1 ): FoldableWithIndexComposition11 /** @deprecated */ export declare function getFoldableWithIndexComposition( F: FoldableWithIndex, G: FoldableWithIndex ): FoldableWithIndexComposition