/** * 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, FoldableComposition, FoldableComposition11, FoldableComposition12, FoldableComposition12C, FoldableComposition21, FoldableComposition2C1, FoldableComposition22, FoldableComposition22C, Foldable4, Foldable3C } from './Foldable' import { HKT, Kind, Kind2, Kind3, URIS, URIS2, URIS3, URIS4, Kind4 } from './HKT' import { Monoid } from './Monoid' /** * @category type classes * @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 type classes * @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 type classes * @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 type classes * @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 type classes * @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 type classes * @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 type classes * @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 } /** * @since 2.0.0 */ 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 } /** * @since 2.0.0 */ 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 } /** * @since 2.0.0 */ 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 } /** * @since 2.0.0 */ 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 } /** * @since 2.0.0 */ 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 } /** * @since 2.0.0 */ 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 } /** * @since 2.0.0 */ 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 } /** * @since 2.0.0 */ 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 } /** * @since 2.0.0 */ export declare function getFoldableWithIndexComposition( F: FoldableWithIndex2, G: FoldableWithIndex2C ): FoldableWithIndexComposition22C export declare function getFoldableWithIndexComposition( F: FoldableWithIndex2, G: FoldableWithIndex2 ): FoldableWithIndexComposition22 export declare function getFoldableWithIndexComposition( F: FoldableWithIndex2C, G: FoldableWithIndex1 ): FoldableWithIndexComposition2C1 export declare function getFoldableWithIndexComposition( F: FoldableWithIndex2, G: FoldableWithIndex1 ): FoldableWithIndexComposition21 export declare function getFoldableWithIndexComposition( F: FoldableWithIndex1, G: FoldableWithIndex2 ): FoldableWithIndexComposition12 export declare function getFoldableWithIndexComposition( F: FoldableWithIndex1, G: FoldableWithIndex2 ): FoldableWithIndexComposition12 export declare function getFoldableWithIndexComposition( F: FoldableWithIndex1, G: FoldableWithIndex1 ): FoldableWithIndexComposition11 export declare function getFoldableWithIndexComposition( F: FoldableWithIndex, G: FoldableWithIndex ): FoldableWithIndexComposition