# 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: {
<R1, E1, A, R2, E2, _>(self: ReaderEither<R1, E1, A>, f: (a: A) => ReaderEither<R2, E2, _>): ReaderEither<
R1 & R2,
E1 | E2,
A
>
<A, R2, E2, _>(f: (a: A) => ReaderEither<R2, E2, _>): <R1, E1>(
) => ReaderEither<R1 & R2, E2 | E1, A>
}
``````

## tapEither

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 tapEither: {
<A, E2, _>(f: (a: A) => E.Either<E2, _>): <R1, E1>(self: ReaderEither<R1, E1, A>) => ReaderEither<R1, E2 | E1, A>
<R1, E1, A, E2, _>(self: ReaderEither<R1, E1, A>, f: (a: A) => E.Either<E2, _>): ReaderEither<R1, E1 | E2, A>
}
``````

Example

``````import * as E from 'fp-ts/Either'
import { pipe } from 'fp-ts/function'
import * as RE from 'fp-ts/ReaderEither'

const checkString = (value: string) =>
pipe(
RE.tapEither((minLength) => (value.length > minLength ? E.right('ok') : E.left('error')))
)

assert.deepStrictEqual(checkString('')(1), E.left('error'))
assert.deepStrictEqual(checkString('fp-ts')(2), E.right(2))
``````

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 tapReader: {
<R2, A, E, _>(f: (a: A) => R.Reader<R2, _>): <R1>(self: ReaderEither<R1, E, A>) => ReaderEither<R1 & R2, E, A>
<R1, R2, E, A, _>(self: ReaderEither<R1, E, A>, f: (a: A) => R.Reader<R2, _>): ReaderEither<R1 & R2, E, A>
}
``````

# constructors

Signature

``````export declare const ask: <R, E = never>() => ReaderEither<R, E, R>
``````

Projects a value from the global context in a `ReaderEither`.

Signature

``````export declare const asks: <R, A, E = never>(f: (r: R) => A) => ReaderEither<R, E, A>
``````

Effectfully accesses the environment.

Signature

``````export declare const asksReaderEither: <R, E, A>(f: (r: R) => ReaderEither<R, E, A>) => ReaderEither<R, E, A>
``````

Less strict version of `asksReaderEither`.

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

Signature

``````export declare const asksReaderEitherW: <R1, R2, E, A>(
f: (r1: R1) => ReaderEither<R2, E, A>
) => ReaderEither<R1 & R2, E, A>
``````

## left

Signature

``````export declare const left: <R, E = never, A = never>(e: E) => ReaderEither<R, E, A>
``````

Signature

``````export declare const leftReader: <R, E = never, A = never>(me: R.Reader<R, E>) => ReaderEither<R, E, A>
``````

## of

Signature

``````export declare const of: <R = unknown, E = never, A = never>(a: A) => ReaderEither<R, E, A>
``````

Signature

``````export declare const right: <R, E = never, A = never>(a: A) => ReaderEither<R, E, A>
``````

Signature

``````export declare const rightReader: <R, E = never, A = never>(ma: R.Reader<R, A>) => ReaderEither<R, E, A>
``````

# conversions

## fromEither

Signature

``````export declare const fromEither: <E, A, R = unknown>(fa: E.Either<E, A>) => ReaderEither<R, E, A>
``````

## fromOption

Signature

``````export declare const fromOption: <E>(onNone: LazyArg<E>) => <A, R = unknown>(fa: Option<A>) => ReaderEither<R, E, A>
``````

Signature

``````export declare const fromReader: <R, A, E = never>(fa: R.Reader<R, A>) => ReaderEither<R, E, A>
``````

## toUnion

Signature

``````export declare const toUnion: <R, E, A>(fa: ReaderEither<R, E, A>) => R.Reader<R, E | A>
``````

# do notation

## Do

Signature

``````export declare const Do: ReaderEither<unknown, never, {}>
``````

## apS

Signature

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

## apSW

Less strict version of `apS`.

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

Signature

``````export declare const apSW: <A, N extends string, R2, E2, B>(
name: Exclude<N, keyof A>,
) => <R1, E1>(
) => ReaderEither<R1 & R2, E2 | E1, { readonly [K in N | keyof A]: K extends keyof A ? A[K] : B }>
``````

## bind

Signature

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

## bindTo

Signature

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

## bindW

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

Signature

``````export declare const bindW: <N extends string, A, R2, E2, B>(
name: Exclude<N, keyof A>,
f: (a: A) => ReaderEither<R2, E2, B>
) => <R1, E1>(
) => ReaderEither<R1 & R2, E2 | E1, { readonly [K in N | keyof A]: K extends keyof A ? A[K] : B }>
``````

## let

Signature

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

# error handling

## alt

Identifies an associative operation on a type constructor. It is similar to `Semigroup`, except that it applies to types of kind `* -> *`.

Signature

``````export declare const alt: <R, E, A>(
that: () => ReaderEither<R, E, A>
``````

## altW

Less strict version of `alt`.

The `W` suffix (short for Widening) means that the environment, the error and the return types will be merged.

Signature

``````export declare const altW: <R2, E2, B>(
that: () => ReaderEither<R2, E2, B>
) => <R1, E1, A>(fa: ReaderEither<R1, E1, A>) => ReaderEither<R1 & R2, E2, B | A>
``````

The default `Alt` instance returns the last error, if you want to get all errors you need to provide a way to concatenate them via a `Semigroup`.

Signature

``````export declare function getAltReaderValidation<E>(S: Semigroup<E>): Alt3C<URI, E>
``````

The default `Applicative` instance returns the first error, if you want to get all errors you need to provide a way to concatenate them via a `Semigroup`.

Signature

``````export declare function getApplicativeReaderValidation<E>(S: Semigroup<E>): Applicative3C<URI, E>
``````

## getOrElse

Signature

``````export declare const getOrElse: <E, R, A>(
onLeft: (e: E) => R.Reader<R, A>
``````

## 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: <R2, E, B>(
onLeft: (e: E) => R.Reader<R2, B>
) => <R1, A>(ma: ReaderEither<R1, E, A>) => R.Reader<R1 & R2, B | A>
``````

## mapBoth

Returns a `ReaderEither` 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): <R>(self: ReaderEither<R, E, A>) => ReaderEither<R, G, B>
<R, E, A, G, B>(self: ReaderEither<R, E, A>, f: (e: E) => G, g: (a: A) => B): ReaderEither<R, G, B>
}
``````

Example

``````import * as ReaderEither from 'fp-ts/ReaderEither'
import * as Either from 'fp-ts/Either'

const f = (s: string) => new Error(s)
const g = (n: number) => n * 2

``````

## mapError

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

Signature

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

Example

``````import * as ReaderEither from 'fp-ts/ReaderEither'
import * as Either from 'fp-ts/Either'

const f = (s: string) => new Error(s)

``````

## orElse

Signature

``````export declare const orElse: <E1, R, E2, A>(
onLeft: (e: E1) => ReaderEither<R, E2, A>
``````

## orElseW

Less strict version of `orElse`.

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

Signature

``````export declare const orElseW: <E1, R1, E2, B>(
onLeft: (e: E1) => ReaderEither<R1, E2, B>
) => <R2, A>(ma: ReaderEither<R2, E1, A>) => ReaderEither<R1 & R2, E2, B | A>
``````

## orLeft

Signature

``````export declare const orLeft: <E1, R, E2>(
onLeft: (e: E1) => R.Reader<R, E2>
``````

## orLeftW

Signature

``````export declare const orLeftW: <E1, R2, E2>(
onLeft: (e: E1) => R.Reader<R2, E2>
) => <R1, A>(fa: ReaderEither<R1, E1, A>) => ReaderEither<R1 & R2, E2, A>
``````

## tapError

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

Signature

``````export declare const tapError: {
<E1, R2, E2, _>(onLeft: (e: E1) => ReaderEither<R2, E2, _>): <R1, A>(
) => ReaderEither<R1 & R2, E1 | E2, A>
<R1, E1, A, R2, E2, _>(self: ReaderEither<R1, E1, A>, onLeft: (e: E1) => ReaderEither<R2, E2, _>): ReaderEither<
R1 & R2,
E1 | E2,
A
>
}
``````

# filtering

## filterOrElse

Signature

``````export declare const filterOrElse: {
<E, A, B extends A>(refinement: Refinement<A, B>, onFalse: (a: A) => E): <R>(
<E, A>(predicate: Predicate<A>, onFalse: (a: A) => E): <R, B extends A>(
<E, A>(predicate: Predicate<A>, onFalse: (a: A) => E): <R>(ma: ReaderEither<R, E, A>) => ReaderEither<R, E, A>
}
``````

## filterOrElseW

Less strict version of `filterOrElse`.

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

Signature

``````export declare const filterOrElseW: {
<A, B extends A, E2>(refinement: Refinement<A, B>, onFalse: (a: A) => E2): <R, E1>(
) => ReaderEither<R, E2 | E1, B>
<A, E2>(predicate: Predicate<A>, onFalse: (a: A) => E2): <R, E1, B extends A>(
) => ReaderEither<R, E2 | E1, B>
<A, E2>(predicate: Predicate<A>, onFalse: (a: A) => E2): <R, E1>(
) => ReaderEither<R, E2 | E1, A>
}
``````

## getCompactable

Signature

``````export declare const getCompactable: <E>(M: Monoid<E>) => Compactable3C<'ReaderEither', E>
``````

## getFilterable

Signature

``````export declare function getFilterable<E>(M: Monoid<E>): Filterable3C<URI, E>
``````

# instances

## Alt

Signature

``````export declare const Alt: Alt3<'ReaderEither'>
``````

## Applicative

Signature

``````export declare const Applicative: Applicative3<'ReaderEither'>
``````

## Apply

Signature

``````export declare const Apply: Apply3<'ReaderEither'>
``````

## Bifunctor

Signature

``````export declare const Bifunctor: Bifunctor3<'ReaderEither'>
``````

## Chain

Signature

``````export declare const Chain: chainable.Chain3<'ReaderEither'>
``````

## FromEither

Signature

``````export declare const FromEither: FromEither3<'ReaderEither'>
``````

Signature

``````export declare const FromReader: FromReader3<'ReaderEither'>
``````

## Functor

Signature

``````export declare const Functor: Functor3<'ReaderEither'>
``````

Signature

``````export declare const Monad: Monad3<'ReaderEither'>
``````

Signature

``````export declare const MonadThrow: MonadThrow3<'ReaderEither'>
``````

## Pointed

Signature

``````export declare const Pointed: Pointed3<'ReaderEither'>
``````

# legacy

## bimap

Alias of `mapBoth`.

Signature

``````export declare const bimap: <E, G, A, B>(
f: (e: E) => G,
g: (a: A) => B
``````

## chain

Alias of `flatMap`.

Signature

``````export declare const chain: <R, E, A, B>(
f: (a: A) => ReaderEither<R, E, B>
``````

## chainEitherK

Alias of `flatMapEither`.

Signature

``````export declare const chainEitherK: <E, A, B>(
f: (a: A) => E.Either<E, B>
``````

## chainEitherKW

Alias of `flatMapEither`.

Signature

``````export declare const chainEitherKW: <E2, A, B>(
f: (a: A) => E.Either<E2, B>
) => <R, E1>(ma: ReaderEither<R, E1, A>) => ReaderEither<R, E2 | E1, B>
``````

## chainFirst

Alias of `tap`.

Signature

``````export declare const chainFirst: <R, E, A, B>(
f: (a: A) => ReaderEither<R, E, B>
``````

## chainFirstEitherK

Alias of `tapEither`.

Signature

``````export declare const chainFirstEitherK: <A, E, B>(
f: (a: A) => E.Either<E, B>
``````

## chainFirstEitherKW

Alias of `tapEither`.

Less strict version of `chainFirstEitherK`.

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

Signature

``````export declare const chainFirstEitherKW: <A, E2, B>(
f: (a: A) => E.Either<E2, B>
) => <R, E1>(ma: ReaderEither<R, E1, A>) => ReaderEither<R, E2 | E1, A>
``````

Alias of `tapReader`.

Signature

``````export declare const chainFirstReaderK: <A, R, B>(
f: (a: A) => R.Reader<R, B>
``````

Alias of `tapReader`.

Less strict version of `chainReaderK`.

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

Signature

``````export declare const chainFirstReaderKW: <A, R1, B>(
f: (a: A) => R.Reader<R1, B>
) => <R2, E>(ma: ReaderEither<R2, E, A>) => ReaderEither<R1 & R2, E, A>
``````

## chainFirstW

Alias of `tap`.

Signature

``````export declare const chainFirstW: <R2, E2, A, B>(
f: (a: A) => ReaderEither<R2, E2, B>
) => <R1, E1>(ma: ReaderEither<R1, E1, A>) => ReaderEither<R1 & R2, E2 | E1, A>
``````

## chainOptionK

Use `flatMapOption`.

Signature

``````export declare const chainOptionK: <E>(
onNone: LazyArg<E>
) => <A, B>(f: (a: A) => Option<B>) => <R>(ma: ReaderEither<R, E, A>) => ReaderEither<R, E, B>
``````

## chainOptionKW

Use `flatMapOption`.

Signature

``````export declare const chainOptionKW: <E2>(
onNone: LazyArg<E2>
) => <A, B>(f: (a: A) => Option<B>) => <R, E1>(ma: ReaderEither<R, E1, A>) => ReaderEither<R, E2 | E1, B>
``````

Alias of `flatMapReader`.

Signature

``````export declare const chainReaderK: <A, R, B>(
f: (a: A) => R.Reader<R, B>
``````

Alias of `flatMapReader`.

Less strict version of `chainReaderK`.

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

Signature

``````export declare const chainReaderKW: <A, R2, B>(
f: (a: A) => R.Reader<R2, B>
) => <R1, E>(ma: ReaderEither<R1, E, A>) => ReaderEither<R1 & R2, E, B>
``````

## chainW

Alias of `flatMap`.

Signature

``````export declare const chainW: <R2, E2, A, B>(
f: (a: A) => ReaderEither<R2, E2, B>
) => <R1, E1>(ma: ReaderEither<R1, E1, A>) => ReaderEither<R1 & R2, E2 | E1, B>
``````

## fromOptionK

Use `liftOption`.

Signature

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

## mapLeft

Alias of `mapError`.

Signature

``````export declare const mapLeft: <E, G>(f: (e: E) => G) => <R, A>(fa: ReaderEither<R, E, A>) => ReaderEither<R, G, A>
``````

## orElseFirst

Alias of `tapError`.

Signature

``````export declare const orElseFirst: <E, R, B>(
onLeft: (e: E) => ReaderEither<R, E, B>
``````

## orElseFirstW

Alias of `tapError`.

Signature

``````export declare const orElseFirstW: <E1, R2, E2, B>(
onLeft: (e: E1) => ReaderEither<R2, E2, B>
) => <R1, A>(ma: ReaderEither<R1, E1, A>) => ReaderEither<R1 & R2, E1 | E2, A>
``````

# lifting

## fromEitherK

Signature

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

## fromPredicate

Signature

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

Signature

``````export declare const fromReaderK: <A extends readonly unknown[], R, B>(
f: (...a: A) => R.Reader<R, B>
) => <E = never>(...a: A) => ReaderEither<R, E, B>
``````

## liftNullable

Signature

``````export declare const liftNullable: <A extends readonly unknown[], B, E>(
f: (...a: A) => B | null | undefined,
onNullable: (...a: A) => E
) => <R>(...a: A) => ReaderEither<R, E, NonNullable<B>>
``````

## liftOption

Signature

``````export declare const liftOption: <A extends readonly unknown[], B, E>(
f: (...a: A) => Option<B>,
onNone: (...a: A) => E
) => <R>(...a: A) => ReaderEither<R, E, B>
``````

# mapping

## as

Maps the `Right` value of this `ReaderEither` to the specified constant value.

Signature

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

## asUnit

Maps the `Right` value of this `ReaderEither` to the void constant value.

Signature

``````export declare const asUnit: <R, E, _>(self: ReaderEither<R, E, _>) => ReaderEither<R, E, void>
``````

## flap

Signature

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

## 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) => <R, E>(fa: ReaderEither<R, E, A>) => ReaderEither<R, E, B>
``````

# model

Signature

``````export interface ReaderEither<R, E, A> extends Reader<R, Either<E, A>> {}
``````

# pattern matching

## fold

Alias of `matchE`.

Signature

``````export declare const fold: <R, E, A, B>(
onLeft: (e: E) => R.Reader<R, B>,
onRight: (a: A) => R.Reader<R, B>
``````

## foldW

Alias of `matchEW`.

Signature

``````export declare const foldW: <E, R2, B, A, R3, C>(
onLeft: (e: E) => R.Reader<R2, B>,
onRight: (a: A) => R.Reader<R3, C>
) => <R1>(ma: ReaderEither<R1, E, A>) => R.Reader<R1 & R2 & R3, B | C>
``````

## match

Signature

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

## matchE

The `E` suffix (short for Effect) means that the handlers return an effect (`Reader`).

Signature

``````export declare const matchE: <R, E, A, B>(
onLeft: (e: E) => R.Reader<R, B>,
onRight: (a: A) => R.Reader<R, B>
``````

## 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, R2, B, A, R3, C>(
onLeft: (e: E) => R.Reader<R2, B>,
onRight: (a: A) => R.Reader<R3, C>
) => <R1>(ma: ReaderEither<R1, E, A>) => R.Reader<R1 & R2 & R3, B | C>
``````

## 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
``````

# sequencing

## flatMap

Signature

``````export declare const flatMap: {
<A, R2, E2, B>(f: (a: A) => ReaderEither<R2, E2, B>): <R1, E1>(
) => ReaderEither<R1 & R2, E2 | E1, B>
<R1, E1, A, R2, E2, B>(ma: ReaderEither<R1, E1, A>, f: (a: A) => ReaderEither<R2, E2, B>): ReaderEither<
R1 & R2,
E1 | E2,
B
>
}
``````

## flatMapEither

Signature

``````export declare const flatMapEither: {
<A, E2, B>(f: (a: A) => E.Either<E2, B>): <R, E1>(self: ReaderEither<R, E1, A>) => ReaderEither<R, E2 | E1, B>
<R, E1, A, E2, B>(self: ReaderEither<R, E1, A>, f: (a: A) => E.Either<E2, B>): ReaderEither<R, E1 | E2, B>
}
``````

## flatMapNullable

Signature

``````export declare const flatMapNullable: {
<A, B, E2>(f: (a: A) => B | null | undefined, onNullable: (a: A) => E2): <R, E1>(
) => ReaderEither<R, E2 | E1, NonNullable<B>>
<R, E1, A, B, E2>(
f: (a: A) => B | null | undefined,
onNullable: (a: A) => E2
): ReaderEither<R, E1 | E2, NonNullable<B>>
}
``````

## flatMapOption

Signature

``````export declare const flatMapOption: {
<A, B, E2>(f: (a: A) => Option<B>, onNone: (a: A) => E2): <R, E1>(
) => ReaderEither<R, E2 | E1, B>
<R, E1, A, B, E2>(self: ReaderEither<R, E1, A>, f: (a: A) => Option<B>, onNone: (a: A) => E2): ReaderEither<
R,
E1 | E2,
B
>
}
``````

Signature

``````export declare const flatMapReader: {
<A, R2, B>(f: (a: A) => R.Reader<R2, B>): <R1, E>(self: ReaderEither<R1, E, A>) => ReaderEither<R1 & R2, E, B>
<R1, E, A, R2, B>(self: ReaderEither<R1, E, A>, f: (a: A) => R.Reader<R2, B>): ReaderEither<R1 & R2, E, B>
}
``````

## flatten

Signature

``````export declare const flatten: <R, E, A>(mma: ReaderEither<R, E, ReaderEither<R, E, A>>) => ReaderEither<R, E, A>
``````

## flattenW

Less strict version of `flatten`.

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

Signature

``````export declare const flattenW: <R1, R2, E1, E2, A>(
) => ReaderEither<R1 & R2, E1 | E2, A>
``````

# traversing

## sequenceArray

Equivalent to `ReadonlyArray#sequence(Applicative)`.

Signature

``````export declare const sequenceArray: <R, E, A>(arr: readonly ReaderEither<R, E, A>[]) => ReaderEither<R, E, readonly A[]>
``````

## traverseArray

Equivalent to `ReadonlyArray#traverse(Applicative)`.

Signature

``````export declare const traverseArray: <R, E, A, B>(
f: (a: A) => ReaderEither<R, E, B>
``````

## traverseArrayWithIndex

Equivalent to `ReadonlyArray#traverseWithIndex(Applicative)`.

Signature

``````export declare const traverseArrayWithIndex: <R, E, A, B>(
f: (index: number, a: A) => ReaderEither<R, E, B>
``````

Equivalent to `ReadonlyArray#traverseWithIndex(Applicative)`.

Signature

``````export declare const traverseReadonlyArrayWithIndex: <A, R, E, B>(
f: (index: number, a: A) => ReaderEither<R, E, B>
``````

Equivalent to `ReadonlyNonEmptyArray#traverseWithIndex(Applicative)`.

Signature

``````export declare const traverseReadonlyNonEmptyArrayWithIndex: <A, R, E, B>(
f: (index: number, a: A) => ReaderEither<R, E, B>
``````

# type lambdas

## URI

Signature

``````export declare const URI: 'ReaderEither'
``````

## URI (type alias)

Signature

``````export type URI = typeof URI
``````

# utils

## ApT

Signature

``````export declare const ApT: ReaderEither<unknown, never, readonly []>
``````

## ap

Signature

``````export declare const ap: <R, E, A>(
) => <B>(fab: ReaderEither<R, E, (a: A) => B>) => ReaderEither<R, E, B>
``````

## apFirst

Combine two effectful actions, keeping only the result of the first.

Signature

``````export declare const apFirst: <R, E, B>(
``````

## apFirstW

Less strict version of `apFirst`

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

Signature

``````export declare const apFirstW: <R2, E2, B>(
) => <R1, E1, A>(first: ReaderEither<R1, E1, A>) => ReaderEither<R1 & R2, E2 | E1, A>
``````

## apSecond

Combine two effectful actions, keeping only the result of the second.

Signature

``````export declare const apSecond: <R, E, B>(
``````

## apSecondW

Less strict version of `apSecond`

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

Signature

``````export declare const apSecondW: <R2, E2, B>(
) => <R1, E1, A>(first: ReaderEither<R1, E1, A>) => ReaderEither<R1 & R2, E2 | E1, B>
``````

## apW

Less strict version of `ap`.

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

Signature

``````export declare const apW: <R2, E2, A>(
) => <R1, E1, B>(fab: ReaderEither<R1, E1, (a: A) => B>) => ReaderEither<R1 & R2, E2 | E1, B>
``````

## local

Changes the value of the local context during the execution of the action `ma` (similar to `Contravariant`’s `contramap`).

Signature

``````export declare const local: <R2, R1>(f: (r2: R2) => R1) => <E, A>(ma: ReaderEither<R1, E, A>) => ReaderEither<R2, E, A>
``````

## swap

Signature

``````export declare const swap: <R, E, A>(ma: ReaderEither<R, E, A>) => ReaderEither<R, A, E>
``````

## throwError

Signature

``````export declare const throwError: <R, E, A>(e: E) => ReaderEither<R, E, A>
``````

# zone of death

## getApplyMonoid

Use `getApplicativeMonoid` instead.

Signature

``````export declare const getApplyMonoid: <R, E, A>(M: Monoid<A>) => Monoid<ReaderEither<R, E, A>>
``````

## getApplySemigroup

Use `getApplySemigroup` instead.

Signature

``````export declare const getApplySemigroup: <R, E, A>(S: Semigroup<A>) => Semigroup<ReaderEither<R, E, A>>
``````

Signature

``````export declare function getReaderValidation<E>(
SE: Semigroup<E>
``````

## getSemigroup

Use `getApplySemigroup` instead.

Signature

``````export declare const getSemigroup: <R, E, A>(S: Semigroup<A>) => Semigroup<ReaderEither<R, E, A>>
``````

This instance is deprecated, use small, specific instances instead. For example if a function needs a `Functor` instance, pass `RE.Functor` instead of `RE.readerEither` (where `R` is from `import R from 'fp-ts/ReaderEither'`)
``````export declare const readerEither: Monad3<'ReaderEither'> &