import { Either } from 'fp-ts/lib/Either'; import { Filterable1 } from 'fp-ts/lib/Filterable'; import { FilterableWithIndex1, PredicateWithIndex, RefinementWithIndex } from 'fp-ts/lib/FilterableWithIndex'; import { Option } from 'fp-ts/lib/Option'; import { Predicate } from 'fp-ts/lib/Predicate'; import { Refinement } from 'fp-ts/lib/Refinement'; import { Separated } from 'fp-ts/lib/Separated'; import { Stream, URI } from './uri'; /** * Returns a {@link Stream} that produces values that passes from the refinement * function. * * @export * @template A The value type. * @template B The refined output value type. * @param {Refinement} refinement The refinement function. * @return {(fa: Stream) => Stream} A function that takes a stream * and returns another stream passing the filter. * * @category filtering * @__PURE__ */ export declare function filter(refinement: Refinement): (fa: Stream) => Stream; /** * Returns a {@link Stream} that produces values that passes from the predicate * function. * * @export * @template A The value type. * @param {Predicate} predicate The predicate function. * @return {(fa: Stream) => Stream} A function that takes * a stream and returns another stream passing the filter. * * @category filtering * @__PURE__ */ export declare function filter(predicate: Predicate): (fa: Stream) => Stream; /** * Maps a {@link Stream} with an iterating function that takes the index and * the value of each element and returns an {@link Option}. It keeps only the * `Some` values dicarding the `None`s. * * Same as [`filterMap`](#filterMap), but with an iterating function which takes * also the index as input. * * @export * @template A The value type. * @template B The mapped type. * @param {(i: number, a: A) => Option} f The mapper function. * @return {(fa: Stream) => Stream} A function that takes a stream of * type `A` values and returns a stream of type `B` values. * * @__PURE__ */ export declare function filterMapWithIndex(f: (i: number, a: A) => Option): (fa: Stream) => Stream; /** * Maps a {@link Stream} with an iterating function that takes * the value of each element and returns an {@link Option}. It keeps only the * `Some` values dicarding the `None`s. * * @export * @template A The value type. * @template B The mapped type. * @param {(a: A) => Option} f The mapper function. * @return {(fa: Stream) => Stream} A function that takes a stream of * type `A` values and returns a stream of type `B` values. * * @__PURE__ */ export declare function filterMap(f: (a: A) => Option): (fa: Stream) => Stream; /** * Maps a {@link Stream} with an iterating function that takes the index and the * value of each element and returns an boolean. It keeps only the elements * returning `true` and discards the others. * * @export * @template A The value type. * @template B The refined new value type. * @param {RefinementWithIndex} refinementWithIndex The refinement * function with index. * * @return {(fa: Stream) => Stream} A function that takes a stream * to filter. * * @category filtering * @__PURE__ */ export declare function filterWithIndex(refinementWithIndex: RefinementWithIndex): (fa: Stream) => Stream; /** * Maps a {@link Stream} with an iterating function that takes the index and the * value of each element and returns an boolean. It keeps only the elements * returning `true` and discards the others. * * @export * @template A The value type. * @template B The refined new value type. * @param {PredicateWithIndex} predicateWithIndex The predicate * function with index. * * @return {(fa: Stream) => Stream} A function that takes a * stream to filter. * * @category filtering * @__PURE__ */ export declare function filterWithIndex(predicateWithIndex: PredicateWithIndex): (fa: Stream) => Stream; /** * Maps a {@link Stream} with an iterating function that takes the index and the * value of each element and returns an boolean. It keeps only the elements * returning `true` and discards the others. * * @export * @template A The value type. * @template B The refined new value type. * @param {PredicateWithIndex} predicateWithIndex The predicate * function with index. * * @return {(fa: Stream) => Stream} A function that takes a stream * to filter. * * @category filtering * @__PURE__ */ export declare function filterWithIndex(predicateWithIndex: PredicateWithIndex): (fa: Stream) => Stream; /** * Given an iterating function that is a {@link Predicate} or * a {@link Refinement}, `partition` creates two new {@link Stream}s where the * `right` contains the original {@link Stream} for which the iterating function * is `true`, `left` contains the elements for which it is `false`. * * @export * @template A The value type. * @template B The refined value type. * @param {Refinement} refinement The refinement function. * @return {(fa: Stream) => Separated, Stream>} A function * that takes a stream to separate it based on a given condition function. * * @category filtering * @__PURE__ */ export declare function partition(refinement: Refinement): (fa: Stream) => Separated, Stream>; /** * Given an iterating function that is a {@link Predicate} or * a {@link Refinement}, `partition` creates two new {@link Stream}s where the * `right` contains the original {@link Stream} for which the iterating function * is `true`, `left` contains the elements for which it is `false`. * * @export * @template A The value type. * @template B The refined value type. * @param {Predicate} predicate The predicate function. * @return {(fa: Stream) => Separated, Stream>} A * function that takes a stream to separate it based on a given condition * function. * * @category filtering * @__PURE__ */ export declare function partition(predicate: Predicate): (fb: Stream) => Separated, Stream>; /** * Given an iterating function that is a {@link Predicate} or * a {@link Refinement}, `partition` creates two new {@link Stream}s where the * `right` contains the original {@link Stream} for which the iterating function * is `true`, `left` contains the elements for which it is `false`. * * @export * @template A The value type. * @param {Predicate} predicate The predicate function. * @return {(fa: Stream) => Separated, Stream>} A * function that takes a stream to separate it based on a given condition * function. * * @category filtering * @__PURE__ */ export declare function partition(predicate: Predicate): (fb: Stream) => Separated, Stream>; /** * Same as [`partition`](#partition), but passing also the index to the * iterating function. * * @export * @template A The value type. * @template B The refined value type. * @param {RefinementWithIndex} refinementWithIndex The refinement * function. * @return {( * fa: Stream * ) => Separated, Stream>} A function that takes a stream * to separate it based on a given condition function. * * @category filtering * @__PURE__ */ export declare function partitionWithIndex(refinementWithIndex: RefinementWithIndex): (fa: Stream) => Separated, Stream>; /** * Same as [`partition`](#partition), but passing also the index to the * iterating function. * * @export * @template A The value type. * @template B The refined value type. * @param {PredicateWithIndex} predicateWithIndex The predicate * function. * @return {( * fa: Stream * ) => Separated, Stream>} A function that takes a stream * to separate it based on a given condition function. * * @category filtering * @__PURE__ */ export declare function partitionWithIndex(predicateWithIndex: PredicateWithIndex): (fb: Stream) => Separated, Stream>; /** * Same as [`partition`](#partition), but passing also the index to the * iterating function. * * @export * @template A The value type. * @param {PredicateWithIndex} predicateWithIndex The predicate * function. * @return {(fa: Stream) => Separated, Stream>} A function that * takes a stream to separate it based on a given condition function. * * @category filtering * @__PURE__ */ export declare function partitionWithIndex(predicateWithIndex: PredicateWithIndex): (fa: Stream) => Separated, Stream>; /** * Given an iterating function that returns an {@link Either}, * `partitionMap` applies the iterating function to each element and it creates * two {@link Stream}s where the `right` contains the values of `Right` results * and the `left` contains the values of `Left` results. * * @export * @template A The value type. * @template B The left type. * @template C The right type. * @param {(a: A) => Either} f The iterating function. * @return {(fa: Stream) => Separated, Stream>} A function that * takes a stream and returns a separate streams. * * @category filtering * @__PURE__ */ export declare function partitionMap(f: (a: A) => Either): (fa: Stream) => Separated, Stream>; /** * Same as [`partitionMap`](#partitionMap), but passing also the index to the * iterating function. * * @export * @template A The value type. * @template B The left type. * @template C The right type. * @param {(i: number, a: A) => Either} f The iterating function. * @return {(fa: Stream) => Separated, Stream>} A function that * takes a stream and returns a separate streams. * * @category filtering * @__PURE__ */ export declare function partitionMapWithIndex(f: (i: number, a: A) => Either): (fa: Stream) => Separated, Stream>; /** * The `Filterable` category instance for {@link Stream}. */ export declare const Filterable: Filterable1; /** * The `FilterableWithIndex` category instance for {@link Stream}. */ export declare const FilterableWithIndex: FilterableWithIndex1;