import { Foldable1 } from 'fp-ts/lib/Foldable'; import { FoldableWithIndex1 } from 'fp-ts/lib/FoldableWithIndex'; import { Monoid } from 'fp-ts/lib/Monoid'; import { Stream, URI } from './uri'; /** * Map and fold a {@link Stream}. * * Map the {@link Stream} passing each value to the iterating function. * Then fold the results using the provided {@link Monoid}. * * @export * @template M The monoid type. * @param {Monoid} M The monoid instance. * @return {(f: (a: A) => M)} A function that will take the iterating * function. * * @category folding * @__PURE__ */ export declare function foldMap(M: Monoid): (f: (a: A) => M) => (fa: Stream) => M; /** * Same as {@link foldMap} but passing also the index to the iterating function. * * @export * @template M The monoid type. * @param {Monoid} M The monoid instance. * @return {(f: (i: number, a: A) => M)} A function that takes a stream and * returns the folded value. * * @category folding * @__PURE__ */ export declare function foldMapWithIndex(M: Monoid): (f: (i: number, a: A) => M) => (fa: Stream) => M; /** * Same as {@link reduce} but passing also the index to the iterating function. * * @export * @template A The value type. * @template B The reducing value type. * @param {B} b The initial value. * @param {(i: number, b: B, a: A) => B} f The reducing function. * @return {(fa: Stream) => B} A function that takes a stream and returns * the reduced value. * * @category folding * @__PURE__ */ export declare function reduceWithIndex(b: B, f: (i: number, b: B, a: A) => B): (fa: Stream) => B; /** * Reduces a {@link Stream}. * * `reduce` executes the supplied iterating function on each element of the * stream in order, passing in the element and the return value from the * calculation on the preceding element. * * The first time that the iterating function is called there is no * "return value of the previous calculation", the initial value is used in * its place. * * @export * @template A The value type. * @template B The reducing value type. * @param {B} b The initial value. * @param {(b: B, a: A) => B} f The reducing function. * @return {(fa: Stream) => B} Takes a stream and returns the reduced value. * * @category folding * @__PURE__ */ export declare function reduce(b: B, f: (b: B, a: A) => B): (fa: Stream) => B; /** * Same as {@link reduce} but applied from the end to the start. * * *Note*: The iterating function in this case takes the accumulator as the * last argument. * * @export * @template A The value type. * @template B The reducing value type. * @param {B} b The initial value. * @param {(i: number, b: B, a: A) => B} f The reducing function. * @return {(fa: Stream) => B} A function that takes a stream and returns the * reduced value. */ export declare function reduceRightWithIndex(b: B, f: (i: number, b: B, a: A) => B): (fa: Stream) => B; /** * Same as {@link reduce} but applied from the end to the start. * * @export * @template A The value type. * @template B The reducing value type. * @param {B} b The initial value. * @param {(a: A, b: B) => B} f The reducing function. * @return {(fa: Stream) => B} A function that takes a stream and returns * the reduced value. * * @category folding * @__PURE__ */ export declare function reduceRight(b: B, f: (a: A, b: B) => B): (fa: Stream) => B; /** * The `Foldable` category instance for {@link Stream}. * * @category model */ export declare const Foldable: Foldable1; /** * The `FoldableWithIndex` category instance for {@link Stream}. * * @category model */ export declare const FoldableWithIndex: FoldableWithIndex1;