import { Chain1 } from 'fp-ts/lib/Chain'; import { ChainRec1 } from 'fp-ts/lib/ChainRec'; import { Either } from 'fp-ts/lib/Either'; import { Stream, URI } from './uri'; /** * Chains a {@link Stream} by evaluating the function passed with the items * of it that returns another {@link Stream} instance of type `B`. * * @export * @template A The value type. * @template B The new value/output type. * @param {(a: A) => Stream} f The function that produces a stream of type * `B` from given `A` value. * * @return {(fa: Stream) => Stream} A function that takes a stream of * type `A` and returns another stream of type `B`. * * @__PURE__ */ export declare function chain(f: (a: A) => Stream): (fa: Stream) => Stream; /** * Chains a {@link Stream} by evaluating the function passed with the items * of it with an index that returns another {@link Stream} instance of type `B`. * * @export * @template A The value type. * @template B The new value/output type. * @param {(i: number, a: A) => Stream} f The function that produces a * stream of type `B` from given `A` value. * * @return {(fa: Stream) => Stream} A function that takes a stream of * type `A` and returns another stream of type `B`. * * @__PURE__ */ export declare function chainWithIndex(f: (i: number, a: A) => Stream): (fa: Stream) => Stream; /** * Recursively chain a {@link Stream} with a function that produces an * {@link Either} of `A` and `B` stream. * * All the `A` items in the stream will be used to recursively produce more * streams to chain. * * @export * @template A The producing type. * @template B The output type. * @param {(a: A) => Stream>} f The stream producter function. * @return {(a: A) => Stream} A function that takes an initial value to * start producing `B`s. * * @__PURE__ */ export declare function chainRecDepthFirst(f: (a: A) => Stream>): (a: A) => Stream; /** * Recursively chain a {@link Stream} with a function that produces an * {@link Either} of `A` and `B` stream. * * All the `A` items in the stream will be used to recursively produce more * streams to chain. * * @export * @template A The producing type. * @template B The output type. * @param {(a: A) => Stream>} f The stream producter function. * @return {(a: A) => Stream} A function that takes an initial value to * start producing `B`s. * * @__PURE__ */ export declare function chainRecBreadthFirst(f: (a: A) => Stream>): (a: A) => Stream; /** * The `Chain` category instance for {@link Stream}. */ export declare const Chain: Chain1; /** * The `ChainRec` category instance for {@link Stream} that uses `depth-first` * approach. */ export declare const ChainRecDepthFirst: ChainRec1; /** * The `ChainRec` category instance for {@link Stream} that uses `breadth-first` * approach. */ export declare const ChainRecBreadthFirst: ChainRec1; /** * @category do notation */ export declare const Do: Stream<{}>; /** * @category do notation */ export declare const bind: (name: Exclude, f: (a: A) => Stream) => (ma: Stream) => Stream<{ readonly [K in N | keyof A]: K extends keyof A ? A[K] : B; }>; /** * @category sequencing */ export declare const chainFirst: (f: (a: A) => Stream) => (first: Stream) => Stream;