import { HKT, Kind, Kind2, Kind3, URIS, URIS2, URIS3 } from 'fp-ts/HKT'; import { Applicative, Applicative1, Applicative2, Applicative2C, Applicative3, Applicative3C } from 'fp-ts/lib/Applicative'; import { TraversableWithIndex1 } from 'fp-ts/lib/TraversableWithIndex'; import { URI } from './uri'; /** * Given an iterating function that returns a {@link HKT}, `traverse` applies * the iterating function with index to each element of the {@link Stream} and * then {@link sequence}-s the results using the provided `Applicative`. * * E.g. suppose you have a {@link Stream} and you want to format each element * with a function that returns a result or an error as * `f = (i: number, a: A) => Either`, using `traverse` you can apply * `f` to all elements and directly obtain as a result an * `Either>` i.e. a `Stream` if all the results are `B`, * or an `Error` if some of the results are `Error`s. * * @export * @template F The category type. * @param {Applicative} F The applicative instance. * @return {(f: (i: number, a: A) => HKT) => (ta: Kind) => HKT>} A function * that will take a stream of given `HKT` and will return that `HKT` containing * a stream of its type. * * @category traversing * @__PURE__ */ export declare function traverseWithIndex(F: Applicative3): (f: (i: number, a: A) => Kind3) => (ta: Kind) => Kind3>; export declare function traverseWithIndex(F: Applicative3C): (f: (i: number, a: A) => Kind3) => (ta: Kind) => Kind3>; export declare function traverseWithIndex(F: Applicative2): (f: (i: number, a: A) => Kind2) => (ta: Kind) => Kind2>; export declare function traverseWithIndex(F: Applicative2C): (f: (i: number, a: A) => Kind2) => (ta: Kind) => Kind2>; export declare function traverseWithIndex(F: Applicative1): (f: (i: number, a: A) => Kind) => (ta: Kind) => Kind>; export declare function traverseWithIndex(F: Applicative): (f: (i: number, a: A) => HKT) => (ta: Kind) => HKT>; /** * The `TraversableWithIndex` category instance for {@link Stream}. * * @category traversing */ export declare const TraversableWithIndex: TraversableWithIndex1;