import { Refinement } from 'fp-ts/lib/Refinement'; import { Task } from 'fp-ts/lib/Task'; import { AsyncStream } from './uri'; import { AsyncPredicate } from './utils/async-predicate'; /** * Defines an interface where the `init` and the `rest` part of * the {@link AsyncStream} based on a condition. * * @export * @interface Spanned * @template I The init part of the {@link AsyncStream}. * @template R The rest of the {@link AsyncStream}. */ export interface Spanned { /** * The init part of the {@link AsyncStream} where the condition was met. * * @type {AsyncStream} * @memberof Spanned */ readonly init: AsyncStream; /** * The rest of the {@link AsyncStream}. * * @type {AsyncStream} * @memberof Spanned */ readonly rest: AsyncStream; } /** * Spans an {@link AsyncStream} from the left side of it based on a refinement. * * @export * @template A The value type. * @template B The refined value type. * @param {Refinement} refinement The refinement function. * @return {(fa: AsyncStream) => Task>} A function that takes * an {@link AsyncStream} and returns a {@link Task} of a {@link Spanned} * instance of it. * * @__PURE__ */ export declare function spanLeft(refinement: Refinement): (fa: AsyncStream) => Task>; /** * Spans an {@link AsyncStream} from the left side of it, based on a predicate. * * @export * @template A The value type. * @param {AsyncPredicate} predicate The predicate function. * @return {(fb: AsyncStream) => Task>} A function * that takes an {@link AsyncStream} and returns a {@link Task} of a * {@link Spanned} instance of it. * * @__PURE__ */ export declare function spanLeft(predicate: AsyncPredicate): (fb: AsyncStream) => Task>; /** * Spans a {@link AsyncStream} from the left side of it, based on a predicate. * * @export * @template A The value type. * @param {AsyncPredicate} predicate The predicate function. * @return {(fa: AsyncStream) => Task>} A function that takes * an {@link AsyncStream} and returns a {@link Task} of a {@link Spanned} * instance of it. * * @__PURE__ */ export declare function spanLeft(predicate: AsyncPredicate): (fa: AsyncStream) => Task>; /** * Spans a {@link AsyncStream} from the right side of it based on a refinement. * * **Warning: This function consumes the stream.** * * @export * @template A The value type. * @template B The refined value type. * @param {Refinement} refinement The refinement function. * @return {(fa: AsyncStream) => Task>} A function that takes * an {@link AsyncStream} and returns a {@link Task} of a {@link Spanned} * instance of it. * * @__PURE__ */ export declare function spanRight(refinement: Refinement): (fa: AsyncStream) => Task>; /** * Spans a {@link AsyncStream} from the right side of it, based on a predicate. * * **Warning: This function consumes the stream.** * * @export * @template A The value type. * @param {AsyncPredicate} predicate The predicate function. * @return {(fb: Stream) => Spanned} A function * that takes an {@link AsyncStream} and returns a {@link Task} of a * {@link Spanned} instance of it. * * @__PURE__ */ export declare function spanRight(predicate: AsyncPredicate): (fb: AsyncStream) => Task>; /** * Spans an {@link AsyncStream} from the right side of it, based on a predicate. * * **Warning: This function consumes the stream.** * * @export * @template A The value type. * @param {AsyncPredicate} predicate The predicate function. * @return {(fa: AsyncStream) => Task>} A function that takes * an {@link AsyncStream} and returns a {@link Spanned} instance of it. * * @__PURE__ */ export declare function spanRight(predicate: AsyncPredicate): (fa: AsyncStream) => Task>;