import { Lazy } from 'fp-ts/lib/function'; import { Task } from 'fp-ts/lib/Task'; import { AsyncStream } from '../uri'; /** * Less strict version of {@link matchRight}. * * **Warning: This function consumes the stream.** * * @export * @template B The value type on empty. * @template A The value type on non empty. * @template C The result type of the non empty function. * @param {Lazy | Task} onEmpty The lazy function that will be executed * when the async stream is empty. * * @param {(head: A, tail: AsyncStream) => C | Promise} onNonEmpty The * function that will be executed when the async stream is not empty. * * @return {(fa: Stream) => Task} A function that takes an async * stream. * * @category pattern matching * @__PURE__ */ export declare function matchRightW(onEmpty: Lazy | Task, onNonEmpty: (init: AsyncStream, last: A) => C | Promise): (fa: AsyncStream) => Task; /** * Break an {@link AsyncStream} into its initial elements and the last element. * * **Warning: This function consumes the stream.** * * @export * @template B The value type on empty. * @template A The value type on non empty. * @param {Lazy | Task} onEmpty The lazy function that will be executed * when the stream is empty. * * @param {(head: A, tail: Stream) => B | Promise} onNonEmpty The function * that will be executed when the async stream is not empty. * * @return {(fa: Stream) => B | Promise} A function that takes a stream. * * @category pattern matching * @__PURE__ */ export declare function matchRight(onEmpty: Lazy | Task, onNonEmpty: (init: AsyncStream, last: A) => B | Promise): (fa: AsyncStream) => Task; /** * Alias for {@link matchRight}. * * **Warning: This function consumes the stream.** */ export declare const foldRight: typeof matchRight;