Stream overview

type Stream<T> = AsyncIterable<T>

This module provides a monadic interface over AsyncIterables. Unlike other collections, the elements of a Stream are not all stored in memory at the same time.

Added in v0.0.10


Table of contents


constructors

from

Signature

export declare const from: <A>(a: Streamable<A>) => Stream<A>

Added in v0.0.10

fromArrayLike

Signature

export declare const fromArrayLike: <A>(a: ArrayLike<A>) => Stream<A>

Added in v0.0.10

fromIterable

Signature

export declare const fromIterable: <A>(a: Iterable<A>) => Stream<A>

Added in v0.0.10

lazy

Signature

export declare function lazy<A, B extends Streamable<A>>(
  f: (previousResult: O.Option<B>) => TO.TaskOption<B>
): Stream<A>
export declare function lazy<E, A, B extends Streamable<A>>(
  f: (previousResult: O.Option<B>) => TE.TaskEither<E, O.Option<B>>
): Stream<E.Either<E, A>>

Added in v0.0.10

conversions

fromTaskEither

Signature

export declare const fromTaskEither: <E, A>(ma: TE.TaskEither<E, Streamable<A>>) => Stream<E.Either<E, A>>

Added in v0.0.10

of

Signature

export declare const of: <A>(a: A) => Stream<A>

Added in v0.0.10

toArray

Signature

export declare const toArray: <A>(fa: Stream<A>) => T.Task<A[]>

Added in v0.0.10

toEitherArray

Signature

export declare const toEitherArray: <E, A>(fa: Stream<E.Either<E, A>>) => TE.TaskEither<E, A[]>

Added in v0.0.10

filtering

compact

Signature

export declare const compact: <A>(fa: Stream<O.Option<A>>) => Stream<A>

Added in v0.0.10

filter

Signature

export declare const filter: {
  <A, B extends A>(refinement: Refinement<A, B>): (as: Stream<A>) => Stream<B>
  <A>(predicate: Predicate<A>): <B extends A>(bs: Stream<B>) => Stream<B>
  <A>(predicate: Predicate<A>): (as: Stream<A>) => Stream<A>
}

Added in v0.0.10

filterMap

Signature

export declare const filterMap: <A, B>(f: (a: A) => O.Option<B>) => (fa: Stream<A>) => Stream<B>

Added in v0.0.10

filterMapWithIndex

Signature

export declare const filterMapWithIndex: <A, B>(f: (i: number, a: A) => O.Option<B>) => (fa: Stream<A>) => Stream<B>

Added in v0.0.10

filterWithIndex

Signature

export declare const filterWithIndex: {
  <A, B extends A>(refinementWithIndex: RefinementWithIndex<number, A, B>): (as: Stream<A>) => Stream<B>
  <A>(predicateWithIndex: PredicateWithIndex<number, A>): <B extends A>(bs: Stream<B>) => Stream<B>
  <A>(predicateWithIndex: PredicateWithIndex<number, A>): (as: Stream<A>) => Stream<A>
}

Added in v0.0.10

partition

Signature

export declare const partition: {
  <A, B extends A>(refinement: Refinement<A, B>): (as: Stream<A>) => Separated<Stream<A>, Stream<B>>
  <A>(predicate: Predicate<A>): <B extends A>(bs: Stream<B>) => Separated<Stream<B>, Stream<B>>
  <A>(predicate: Predicate<A>): (as: Stream<A>) => Separated<Stream<A>, Stream<A>>
}

Added in v0.0.10

partitionMap

Signature

export declare const partitionMap: <A, B, C>(
  f: (a: A) => E.Either<B, C>
) => (fa: Stream<A>) => Separated<Stream<B>, Stream<C>>

Added in v0.0.10

partitionMapWithIndex

Signature

export declare const partitionMapWithIndex: <A, B, C>(
  f: (i: number, a: A) => E.Either<B, C>
) => (fa: Stream<A>) => Separated<Stream<B>, Stream<C>>

Added in v0.0.10

partitionWithIndex

Signature

export declare const partitionWithIndex: {
  <A, B extends A>(refinementWithIndex: RefinementWithIndex<number, A, B>): (
    as: Stream<A>
  ) => Separated<Stream<A>, Stream<B>>
  <A>(predicateWithIndex: PredicateWithIndex<number, A>): <B extends A>(
    bs: Stream<B>
  ) => Separated<Stream<B>, Stream<B>>
  <A>(predicateWithIndex: PredicateWithIndex<number, A>): (as: Stream<A>) => Separated<Stream<A>, Stream<A>>
}

Added in v0.0.10

separate

Signature

export declare const separate: <A, B>(fa: Stream<E.Either<A, B>>) => Separated<Stream<A>, Stream<B>>

Added in v0.0.10

instances

Applicative

Signature

export declare const Applicative: Applicative1<'Stream'>

Added in v0.0.10

Chain

Signature

export declare const Chain: Chain1<'Stream'>

Added in v0.0.10

Compactable

Signature

export declare const Compactable: Compactable1<'Stream'>

Added in v0.0.10

Filterable

Signature

export declare const Filterable: Filterable1<'Stream'>

Added in v0.0.10

FilterableWithIndex

Signature

export declare const FilterableWithIndex: FilterableWithIndex1<'Stream', number>

Added in v0.0.10

Functor

Signature

export declare const Functor: Functor1<'Stream'>

Added in v0.0.10

FunctorWithIndex

Signature

export declare const FunctorWithIndex: FunctorWithIndex1<'Stream', number>

Added in v0.0.10

Monad

Signature

export declare const Monad: Monad1<'Stream'>

Added in v0.0.10

Pointed

Signature

export declare const Pointed: Pointed1<'Stream'>

Added in v0.0.10

Zero

Signature

export declare const Zero: Zero1<'Stream'>

Added in v0.0.10

getMonoid

Signature

export declare const getMonoid: <A = never>() => Monoid<Stream<A>>

Added in v0.0.10

getSemigroup

Signature

export declare const getSemigroup: <A = never>() => Semigroup<Stream<A>>

Added in v0.0.10

mapping

map

Signature

export declare const map: <A, B>(f: (a: A) => B) => (fa: Stream<A>) => Stream<B>

Added in v0.0.10

mapWithIndex

Signature

export declare const mapWithIndex: <A, B>(f: (i: number, a: A) => B) => (fa: Stream<A>) => Stream<B>

Added in v0.0.10

model

Stream (type alias)

Signature

export type Stream<A> = AsyncIterable<A>

Added in v0.0.10

Streamable (type alias)

Signature

export type Streamable<A> = Array<A> | ArrayLike<A> | Iterable<A> | AsyncIterable<A>

Added in v0.0.10

sequencing

flatMap

Signature

export declare const flatMap: <A, B>(f: (a: A) => Stream<B>) => (fa: Stream<A>) => Stream<B>

Added in v0.0.10

flatten

Signature

export declare const flatten: <A>(mma: Stream<Stream<A>>) => Stream<A>

Added in v0.0.10

type lambdas

URI

Signature

export declare const URI: 'Stream'

Added in v0.0.10

URI (type alias)

Signature

export type URI = typeof URI

Added in v0.0.10

utils

ap

Signature

export declare const ap: <A>(fa: Stream<A>) => <B>(fab: Stream<(a: A) => B | Promise<B>>) => Stream<B>

Added in v0.0.10

appendAll

Signature

export declare const appendAll: <A>(more: Stream<A>) => (ma: Stream<A>) => Stream<A>

Added in v0.0.10

isArray

Signature

export declare const isArray: <A = unknown>(a: unknown) => a is A[]

Added in v0.0.10

isArrayLike

Signature

export declare const isArrayLike: <A = unknown>(a: unknown) => a is ArrayLike<A>

Added in v0.0.10

isAsyncIterable

Signature

export declare const isAsyncIterable: <A = unknown>(a: unknown) => a is Iterable<A>

Added in v0.0.10

isIterable

Signature

export declare const isIterable: <A = unknown>(a: unknown) => a is Iterable<A>

Added in v0.0.10

isStream

Signature

export declare const isStream: <A = unknown>(a: unknown) => a is Stream<A>

Added in v0.0.10

prependAll

Signature

export declare const prependAll: <A>(more: Stream<A>) => (ma: Stream<A>) => Stream<A>

Added in v0.0.10

zero

Signature

export declare const zero: <A>() => Stream<A>

Added in v0.0.10