AsyncIterableEither overview

export interface AsyncIterableEither<E, A> extends AsyncIterable<Either<E, A>> {}

AsyncIterableEither<E, A> represents an asynchronous stream that yields either of type A or yields an error of type E. If you want to represent an asynchronous stream that never fails, please see AsyncIterable.

Added in v1.0.0


Table of contents


apply

ap

Signature

export declare const ap: <E, A>(
  fa: AsyncIterableEither<E, A>
) => <B>(fab: AsyncIterableEither<E, (a: A) => B>) => AsyncIterableEither<E, B>

Added in v1.0.0

apFirst

Signature

export declare const apFirst: <E, B>(
  second: AsyncIterableEither<E, B>
) => <A>(first: AsyncIterableEither<E, A>) => AsyncIterableEither<E, A>

Added in v1.0.0

apSecond

Signature

export declare const apSecond: <E, B>(
  second: AsyncIterableEither<E, B>
) => <A>(first: AsyncIterableEither<E, A>) => AsyncIterableEither<E, B>

Added in v1.0.0

apW

Less strict version of ap.

The W suffix (short for Widening) means that the error types will be merged.

Signature

export declare const apW: <E2, A>(
  fa: AsyncIterableEither<E2, A>
) => <E1, B>(fab: AsyncIterableEither<E1, (a: A) => B>) => AsyncIterableEither<E2 | E1, B>

Added in v1.0.0

combinators

tap

Composes computations in sequence, using the return value of one computation to determine the next computation and keeping only the result of the first.

Signature

export declare const tap: {
  <E1, A, E2, _>(self: AsyncIterableEither<E1, A>, f: (a: A) => AsyncIterableEither<E2, _>): AsyncIterableEither<
    E1 | E2,
    A
  >
  <A, E2, _>(f: (a: A) => AsyncIterableEither<E2, _>): <E1>(
    self: AsyncIterableEither<E1, A>
  ) => AsyncIterableEither<E2 | E1, A>
}

Added in v1.0.0

tapEither

Signature

export declare const tapEither: {
  <A, E2, _>(f: (a: A) => E.Either<E2, _>): <E1>(self: AsyncIterableEither<E1, A>) => AsyncIterableEither<E2 | E1, A>
  <E1, A, E2, _>(self: AsyncIterableEither<E1, A>, f: (a: A) => E.Either<E2, _>): AsyncIterableEither<E1 | E2, A>
}

Added in v1.0.0

tapIO

Signature

export declare const tapIO: {
  <A, _>(f: (a: A) => IO<_>): <E>(self: AsyncIterableEither<E, A>) => AsyncIterableEither<E, A>
  <E, A, _>(self: AsyncIterableEither<E, A>, f: (a: A) => IO<_>): AsyncIterableEither<E, A>
}

Added in v1.0.0

tapTask

Signature

export declare const tapTask: {
  <A, _>(f: (a: A) => T.Task<_>): <E>(self: AsyncIterableEither<E, A>) => AsyncIterableEither<E, A>
  <E, A, _>(self: AsyncIterableEither<E, A>, f: (a: A) => T.Task<_>): AsyncIterableEither<E, A>
}

Added in v1.0.0

tapTaskEither

Signature

export declare const tapTaskEither: {
  <A, E2, _>(f: (a: A) => TE.TaskEither<E2, _>): <E1>(
    self: AsyncIterableEither<E1, A>
  ) => AsyncIterableEither<E2 | E1, A>
  <E1, A, E2, _>(self: AsyncIterableEither<E1, A>, f: (a: A) => TE.TaskEither<E2, _>): AsyncIterableEither<E1 | E2, A>
}

Added in v1.0.0

constructors

left

Signature

export declare const left: <E = never, A = never>(e: E) => AsyncIterableEither<E, A>

Added in v1.0.0

leftAsyncIterable

Signature

export declare const leftAsyncIterable: <E = never, A = never>(me: AsyncIterable<E>) => AsyncIterableEither<E, A>

Added in v1.0.0

leftIO

Signature

export declare const leftIO: <E = never, A = never>(me: IO<E>) => AsyncIterableEither<E, A>

Added in v1.0.0

leftIterable

Signature

export declare const leftIterable: <E = never, A = never>(ma: Iterable<E>) => AsyncIterableEither<E, A>

Added in v1.0.0

leftTask

Signature

export declare const leftTask: <E = never, A = never>(me: T.Task<E>) => AsyncIterableEither<E, A>

Added in v1.0.0

of

Signature

export declare const of: <E = never, A = never>(a: A) => AsyncIterableEither<E, A>

Added in v1.0.0

Signature

export declare const right: <E = never, A = never>(a: A) => AsyncIterableEither<E, A>

Added in v1.0.0

rightAsyncIterable

Signature

export declare const rightAsyncIterable: <E = never, A = never>(ma: AsyncIterable<A>) => AsyncIterableEither<E, A>

Added in v1.0.0

rightIO

Signature

export declare const rightIO: <E = never, A = never>(ma: IO<A>) => AsyncIterableEither<E, A>

Added in v1.0.0

rightIterable

Signature

export declare const rightIterable: <E = never, A = never>(ma: Iterable<A>) => AsyncIterableEither<E, A>

Added in v1.0.0

rightTask

Signature

export declare const rightTask: <E = never, A = never>(ma: T.Task<A>) => AsyncIterableEither<E, A>

Added in v1.0.0

conversions

fromAsyncIterable

Signature

export declare const fromAsyncIterable: <A, E = never>(fa: AsyncIterable<A>) => AsyncIterableEither<E, A>

Added in v1.0.0

fromAsyncIterableOption

Signature

export declare const fromAsyncIterableOption: <E>(
  onNone: LazyArg<E>
) => <A>(fa: AsyncIterableOption<A>) => AsyncIterableEither<E, A>

Added in v1.0.0

fromEither

Signature

export declare const fromEither: <E, A>(fa: E.Either<E, A>) => AsyncIterableEither<E, A>

Added in v1.0.0

fromIO

Signature

export declare const fromIO: <A, E = never>(fa: IO<A>) => AsyncIterableEither<E, A>

Added in v1.0.0

fromIOEither

Signature

export declare const fromIOEither: <E, A>(fa: IOEither<E, A>) => AsyncIterableEither<E, A>

Added in v1.0.0

fromIterable

Signature

export declare const fromIterable: <A, E = never>(fa: Iterable<A>) => AsyncIterableEither<E, A>

Added in v1.0.0

fromNullable

Signature

export declare const fromNullable: <E>(e: E) => <A>(a: A) => AsyncIterableEither<E, NonNullable<A>>

Added in v1.0.0

fromOption

Signature

export declare const fromOption: <E>(onNone: LazyArg<E>) => <A>(fa: O.Option<A>) => AsyncIterableEither<E, A>

Added in v1.0.0

fromTask

Signature

export declare const fromTask: <E, A>(fa: T.Task<A>) => AsyncIterableEither<E, A>

Added in v1.0.0

fromTaskEither

Signature

export declare const fromTaskEither: <E, A>(fa: TE.TaskEither<E, A>) => AsyncIterableEither<E, A>

Added in v1.0.0

fromTaskOption

Signature

export declare const fromTaskOption: <E, A>(onNone: LazyArg<E>) => (fa: TO.TaskOption<A>) => AsyncIterableEither<E, A>

Added in v1.0.0

toUnion

Signature

export declare const toUnion: <E, A>(fa: AsyncIterableEither<E, A>) => AsyncIterable<E | A>

Added in v1.0.0

do notation

Do

Signature

export declare const Do: AsyncIterableEither<never, {}>

Added in v1.0.0

apS

Signature

export declare const apS: <N, A, E, B>(
  name: Exclude<N, keyof A>,
  fb: AsyncIterableEither<E, B>
) => (
  fa: AsyncIterableEither<E, A>
) => AsyncIterableEither<E, { readonly [K in N | keyof A]: K extends keyof A ? A[K] : B }>

Added in v1.0.0

bind

Signature

export declare const bind: <N, A, E, B>(
  name: Exclude<N, keyof A>,
  f: (a: A) => AsyncIterableEither<E, B>
) => (
  ma: AsyncIterableEither<E, A>
) => AsyncIterableEither<E, { readonly [K in N | keyof A]: K extends keyof A ? A[K] : B }>

Added in v1.0.0

bindTo

Signature

export declare const bindTo: <N>(
  name: N
) => <E, A>(fa: AsyncIterableEither<E, A>) => AsyncIterableEither<E, { readonly [K in N]: A }>

Added in v1.0.0

let

Signature

export declare const let: <N, A, B>(
  name: Exclude<N, keyof A>,
  f: (a: A) => B
) => <E>(
  fa: AsyncIterableEither<E, A>
) => AsyncIterableEither<E, { readonly [K in N | keyof A]: K extends keyof A ? A[K] : B }>

Added in v1.0.0

error handling

getOrElse

Signature

export declare function getOrElse<E, A>(onLeft: (e: E) => A): (ma: AsyncIterableEither<E, A>) => AsyncIterable<A>

Added in v1.0.0

getOrElseW

Less strict version of getOrElse.

The W suffix (short for Widening) means that the handler return type will be merged.

Signature

export declare const getOrElseW: <E, B>(
  onLeft: (e: E) => B
) => <A>(ma: AsyncIterableEither<E, A>) => AsyncIterable<B | A>

Added in v1.0.0

mapBoth

Returns a AsyncIterableEither whose failure and success channels have been mapped by the specified pair of functions, f and g.

Signature

export declare const mapBoth: {
  <E, G, A, B>(f: (e: E) => G, g: (a: A) => B): (self: AsyncIterableEither<E, A>) => AsyncIterableEither<G, B>
  <E, A, G, B>(self: AsyncIterableEither<E, A>, f: (e: E) => G, g: (a: A) => B): AsyncIterableEither<G, B>
}

Added in v1.0.0

mapError

Returns a AsyncIterableEither with its error channel mapped using the specified function.

Signature

export declare const mapError: {
  <E, G>(f: (e: E) => G): <A>(self: AsyncIterableEither<E, A>) => AsyncIterableEither<G, A>
  <E, A, G>(self: AsyncIterableEither<E, A>, f: (e: E) => G): AsyncIterableEither<G, A>
}

Added in v1.0.0

tapError

Returns an effect that effectfully “peeks” at the failure of this effect.

Signature

export declare const tapError: {
  <E1, E2, _>(onLeft: (e: E1) => AsyncIterableEither<E2, _>): <A>(
    self: AsyncIterableEither<E1, A>
  ) => AsyncIterableEither<E1 | E2, A>
  <E1, A, E2, _>(self: AsyncIterableEither<E1, A>, onLeft: (e: E1) => AsyncIterableEither<E2, _>): AsyncIterableEither<
    E1 | E2,
    A
  >
}

Added in v1.0.0

tapErrorIO

Signature

export declare const tapErrorIO: <E, B>(
  onLeft: (e: E) => IO<B>
) => <A>(ma: AsyncIterableEither<E, A>) => AsyncIterableEither<E, A>

Added in v1.0.0

tapErrorTask

Signature

export declare const tapErrorTask: <E, B>(
  onLeft: (e: E) => T.Task<B>
) => <A>(ma: AsyncIterableEither<E, A>) => AsyncIterableEither<E, A>

Added in v1.0.0

tapErrorTaskEither

Signature

export declare const tapErrorTaskEither: <E1, E2, B>(
  onLeft: (e: E1) => TE.TaskEither<E2, B>
) => <A>(ma: AsyncIterableEither<E1, A>) => AsyncIterableEither<E1 | E2, A>

Added in v1.0.0

folding

toArrayLimited

preserves the order of elements coming from async iterator and corresponding results

Signature

export declare function toArrayLimited<E, A>(limit: number)

Added in v1.0.0

toArrayPar

Signature

export declare function toArrayPar<E, A>(limit: number)

Added in v1.0.0

toArraySeq

Signature

export declare function toArraySeq<E, A>()

Added in v1.0.0

toIterableLimited

the order of the results does not corresponds to the order of async iterator elements

Signature

export declare function toIterableLimited<E, A>(limit: number)

Added in v1.0.0

toIterablePar

Signature

export declare function toIterablePar<E, A>(limit: number)

Added in v1.0.0

toIterableSeq

Signature

export declare function toIterableSeq<E, A>()

Added in v1.0.0

instances

Applicative

Signature

export declare const Applicative: Applicative2<'AsyncIterableEither'>

Added in v1.0.0

Apply

Signature

export declare const Apply: Apply2<'AsyncIterableEither'>

Added in v1.0.0

Chain

Signature

export declare const Chain: chainable.Chain2<'AsyncIterableEither'>

Added in v1.0.0

FromEither

Signature

export declare const FromEither: FromEither2<'AsyncIterableEither'>

Added in v1.0.0

FromIO

Signature

export declare const FromIO: FromIO2<'AsyncIterableEither'>

Added in v1.0.0

FromTask

Signature

export declare const FromTask: FromTask2<'AsyncIterableEither'>

Added in v1.0.0

Functor

Signature

export declare const Functor: Functor2<'AsyncIterableEither'>

Added in v1.0.0

Monad

/**

Signature

export declare const Monad: Monad2<'AsyncIterableEither'>

Added in v1.0.0

MonadIO

Signature

export declare const MonadIO: MonadIO2<'AsyncIterableEither'>

Added in v1.0.0

MonadTask

Signature

export declare const MonadTask: MonadTask2<'AsyncIterableEither'>

Added in v1.0.0

MonadThrow

Signature

export declare const MonadThrow: MonadThrow2<'AsyncIterableEither'>

Added in v1.0.0

Pointed

Signature

export declare const Pointed: Pointed2<'AsyncIterableEither'>

Added in v1.0.0

throwError

Signature

export declare const throwError: <E, A>(e: E) => AsyncIterableEither<E, A>

Added in v1.0.0

interop

tryCatch

Signature

export declare function tryCatch<E, A>(onRejected: (cause: unknown) => E)

Added in v1.0.0

tryCatchToError

Signature

export declare function tryCatchToError<A>()

Added in v1.0.0 alias for tryCatch(E.toError)

lifting

fromEitherK

Signature

export declare const fromEitherK: <E, A extends readonly unknown[], B>(
  f: (...a: A) => E.Either<E, B>
) => (...a: A) => AsyncIterableEither<E, B>

Added in v1.0.0

fromIOK

Signature

export declare const fromIOK: <A extends readonly unknown[], B>(
  f: (...a: A) => IO<B>
) => <E = never>(...a: A) => AsyncIterableEither<E, B>

Added in v1.0.0

fromOptionK

Signature

export declare const fromOptionK: <E>(
  onNone: LazyArg<E>
) => <A extends readonly unknown[], B>(f: (...a: A) => O.Option<B>) => (...a: A) => AsyncIterableEither<E, B>

Added in v1.0.0

fromPredicate

Signature

export declare const fromPredicate: {
  <E, A, B extends A>(refinement: Refinement<A, B>, onFalse: (a: A) => E): (a: A) => AsyncIterableEither<E, B>
  <E, A>(predicate: Predicate<A>, onFalse: (a: A) => E): <B extends A>(b: B) => AsyncIterableEither<E, B>
  <E, A>(predicate: Predicate<A>, onFalse: (a: A) => E): (a: A) => AsyncIterableEither<E, A>
}

Added in v1.0.0

fromTaskEitherK

Signature

export declare const fromTaskEitherK: <E, A extends readonly unknown[], B>(
  f: (...a: A) => TE.TaskEither<E, B>
) => (...a: A) => AsyncIterableEither<E, B>

Added in v1.0.0

fromTaskK

Signature

export declare const fromTaskK: <A extends readonly unknown[], B>(
  f: (...a: A) => T.Task<B>
) => <E = never>(...a: A) => AsyncIterableEither<E, B>

Added in v1.0.0

mapping

as

Maps the value to the specified constant value.

Signature

export declare const as: {
  <A>(a: A): <E, _>(self: AsyncIterableEither<E, _>) => AsyncIterableEither<E, A>
  <E, _, A>(self: AsyncIterableEither<E, _>, a: A): AsyncIterableEither<E, A>
}

Added in v1.0.0

asUnit

Maps the value to the void constant value.

Signature

export declare const asUnit: <E, _>(self: AsyncIterableEither<E, _>) => AsyncIterableEither<E, void>

Added in v1.0.0

flap

Signature

export declare const flap: <A>(a: A) => <E, B>(fab: AsyncIterableEither<E, (a: A) => B>) => AsyncIterableEither<E, B>

Added in v1.0.0

map

map can be used to turn functions (a: A) => B into functions (fa: F<A>) => F<B> whose argument and return types use the type constructor F to represent some computational context.

Signature

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

Added in v1.0.0

model

AsyncIterableEither (interface)

Signature

export interface AsyncIterableEither<E, A> extends AsyncIterable<Either<E, A>> {}

Added in v1.0.0

pattern matching

match

Signature

export declare const match: <E, B, A>(
  onLeft: (e: E) => B,
  onRight: (a: A) => B
) => (ma: AsyncIterableEither<E, A>) => AsyncIterable<B>

Added in v1.0.0

matchE

The E suffix (short for Effect) means that the handlers return an AsyncIterable.

Signature

export declare function matchE<E, A, B>(onLeft: (e: E) => T.Task<B>, onRight: (a: A) => T.Task<B>)

Added in v1.0.0

matchEW

Less strict version of matchE.

The W suffix (short for Widening) means that the handler return types will be merged.

Signature

export declare const matchEW: <E, B, A, C>(
  onLeft: (e: E) => T.Task<B>,
  onRight: (a: A) => T.Task<C>
) => (ma: AsyncIterableEither<E, A>) => AsyncIterable<B | C>

Added in v1.0.0

matchW

Less strict version of match.

The W suffix (short for Widening) means that the handler return types will be merged.

Signature

export declare const matchW: <E, B, A, C>(
  onLeft: (e: E) => B,
  onRight: (a: A) => C
) => (ma: AsyncIterableEither<E, A>) => AsyncIterable<B | C>

Added in v1.0.0

sequencing

flatMap

Signature

export declare const flatMap: {
  <A, E2, B>(f: (a: A) => AsyncIterableEither<E2, B>): <E1>(
    ma: AsyncIterableEither<E1, A>
  ) => AsyncIterableEither<E2 | E1, B>
  <E1, A, E2, B>(ma: AsyncIterableEither<E1, A>, f: (a: A) => AsyncIterableEither<E2, B>): AsyncIterableEither<
    E1 | E2,
    B
  >
}

Added in v1.0.0

flatMapEither

Signature

export declare const flatMapEither: <E1, E2, A, B>(
  f: (a: A) => E.Either<E2, B>
) => (fa: AsyncIterableEither<E1, A>) => AsyncIterableEither<E1 | E2, B>

Added in v1.0.0

flatMapOption

Signature

export declare const flatMapOption: <E, A, B>(
  f: (a: A) => O.Option<B>,
  onNone: LazyArg<E>
) => (fa: AsyncIterableEither<E, A>) => AsyncIterableEither<E, B>

Added in v1.0.0

flatMapTask

Signature

export declare const flatMapTask: <E, A, B>(
  f: (a: A) => T.Task<B>
) => (fa: AsyncIterableEither<E, A>) => AsyncIterableEither<E, B>

Added in v1.0.0

flatMapTaskEither

Signature

export declare const flatMapTaskEither: <E1, E2, A, B>(
  f: (a: A) => TE.TaskEither<E2, B>
) => (fa: AsyncIterableEither<E1, A>) => AsyncIterableEither<E1 | E2, B>

Added in v1.0.0

flatMapTaskOption

Signature

export declare const flatMapTaskOption: <E, A, B>(
  f: (a: A) => TO.TaskOption<B>,
  onNone: LazyArg<E>
) => (fa: AsyncIterableEither<E, A>) => AsyncIterableEither<E, B>

Added in v1.0.0

flatten

Signature

export declare const flatten: <E, A>(
  mma: AsyncIterableEither<E, AsyncIterableEither<E, A>>
) => AsyncIterableEither<E, A>

Added in v1.0.0

flattenW

Less strict version of flatten.

The W suffix (short for Widening) means that the error types will be merged.

Signature

export declare const flattenW: <E1, E2, A>(
  mma: AsyncIterableEither<E1, AsyncIterableEither<E2, A>>
) => AsyncIterableEither<E1 | E2, A>

Added in v1.0.0

type lambdas

URI

Signature

export declare const URI: 'AsyncIterableEither'

Added in v1.0.0

URI (type alias)

Signature

export type URI = typeof URI

Added in v1.0.0

utils

swap

Signature

export declare const swap: <E, A>(ma: AsyncIterableEither<E, A>) => AsyncIterableEither<A, E>

Added in v1.0.0