Link Search Menu Expand Document

ReaderTaskEither overview

Added in v2.0.0


Table of contents


Alt

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: () => ReaderTaskEither<R, E, A>
) => (fa: ReaderTaskEither<R, E, A>) => ReaderTaskEither<R, E, A>

Added in v2.0.0

altW

Less strict version of alt.

Signature

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

Added in v2.9.0

Apply

ap

Apply a function to an argument under a type constructor.

Signature

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

Added in v2.0.0

apW

Less strict version of ap.

Signature

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

Added in v2.8.0

Bifunctor

bimap

Map a pair of functions over the two last type arguments of the bifunctor.

Signature

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

Added in v2.0.0

mapLeft

Map a function over the second type argument of a bifunctor.

Signature

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

Added in v2.0.0

Functor

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: ReaderTaskEither<R, E, A>) => ReaderTaskEither<R, E, B>

Added in v2.0.0

Monad

chain

Composes computations in sequence, using the return value of one computation to determine the next computation.

Signature

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

Added in v2.0.0

chainW

Less strict version of chain.

Signature

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

Added in v2.6.0

MonadThrow

throwError

Signature

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

Added in v2.0.0

Pointed

of

Signature

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

Added in v2.7.0

combinators

apFirst

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

Derivable from Apply.

Signature

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

Added in v2.0.0

apSecond

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

Derivable from Apply.

Signature

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

Added in v2.0.0

chainEitherK

Signature

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

Added in v2.4.0

chainEitherKW

Less strict version of chainEitherK.

Signature

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

Added in v2.6.1

chainFirst

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

Derivable from Chain.

Signature

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

Added in v2.0.0

chainFirstIOK

Signature

export declare const chainFirstIOK: <A, B>(
  f: (a: A) => IO<B>
) => <R, E>(first: ReaderTaskEither<R, E, A>) => ReaderTaskEither<R, E, A>

Added in v2.10.0

chainFirstTaskK

Signature

export declare const chainFirstTaskK: <A, B>(
  f: (a: A) => T.Task<B>
) => <R, E>(first: ReaderTaskEither<R, E, A>) => ReaderTaskEither<R, E, A>

Added in v2.10.0

chainFirstW

Less strict version of chainFirst.

Derivable from Chain.

Signature

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

Added in v2.8.0

chainIOEitherK

Signature

export declare const chainIOEitherK: <E, A, B>(
  f: (a: A) => IOEither<E, B>
) => <R>(ma: ReaderTaskEither<R, E, A>) => ReaderTaskEither<R, E, B>

Added in v2.4.0

chainIOEitherKW

Less strict version of chainIOEitherK.

Signature

export declare const chainIOEitherKW: <E2, A, B>(
  f: (a: A) => IOEither<E2, B>
) => <R, E1>(ma: ReaderTaskEither<R, E1, A>) => ReaderTaskEither<R, E2 | E1, B>

Added in v2.6.1

chainIOK

Signature

export declare const chainIOK: <A, B>(
  f: (a: A) => IO<B>
) => <R, E>(first: ReaderTaskEither<R, E, A>) => ReaderTaskEither<R, E, B>

Added in v2.10.0

chainOptionK

Signature

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

Added in v2.10.0

chainTaskEitherK

Signature

export declare const chainTaskEitherK: <E, A, B>(
  f: (a: A) => TE.TaskEither<E, B>
) => <R>(ma: ReaderTaskEither<R, E, A>) => ReaderTaskEither<R, E, B>

Added in v2.4.0

chainTaskEitherKW

Less strict version of chainTaskEitherK.

Signature

export declare const chainTaskEitherKW: <E2, A, B>(
  f: (a: A) => TE.TaskEither<E2, B>
) => <R, E1>(ma: ReaderTaskEither<R, E1, A>) => ReaderTaskEither<R, E2 | E1, B>

Added in v2.6.1

chainTaskK

Signature

export declare const chainTaskK: <A, B>(
  f: (a: A) => T.Task<B>
) => <R, E>(first: ReaderTaskEither<R, E, A>) => ReaderTaskEither<R, E, B>

Added in v2.10.0

filterOrElse

Signature

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

Added in v2.0.0

filterOrElseW

Less strict version of filterOrElse.

Signature

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

Added in v2.9.0

flap

Derivable from Functor.

Signature

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

Added in v2.10.0

flatten

Derivable from Chain.

Signature

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

Added in v2.0.0

fromEitherK

Signature

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

Added in v2.4.0

fromIOEitherK

Signature

export declare const fromIOEitherK: <E, A extends readonly unknown[], B>(
  f: (...a: A) => IOEither<E, B>
) => <R>(...a: A) => ReaderTaskEither<R, E, B>

Added in v2.4.0

fromIOK

Signature

export declare const fromIOK: <A, B>(f: (...a: A) => IO<B>) => <R, E>(...a: A) => ReaderTaskEither<R, E, B>

Added in v2.10.0

fromOptionK

Signature

export declare const fromOptionK: <E>(
  onNone: Lazy<E>
) => <A, B>(f: (...a: A) => Option<B>) => <R>(...a: A) => ReaderTaskEither<R, E, B>

Added in v2.10.0

fromTaskEitherK

Signature

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

Added in v2.4.0

fromTaskK

Signature

export declare const fromTaskK: <A, B>(f: (...a: A) => T.Task<B>) => <R, E>(...a: A) => ReaderTaskEither<R, E, B>

Added in v2.10.0

orElse

Signature

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

Added in v2.0.0

orElseW

Less strict version of orElse.

Signature

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

Added in v2.10.0

swap

Signature

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

Added in v2.0.0

local

Use local instead.

Signature

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

Added in v2.0.0

constructors

ask

Signature

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

Added in v2.0.0

asks

Signature

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

Added in v2.0.0

fromEither

Signature

export declare const fromEither: <R, E, A>(e: E.Either<E, A>) => ReaderTaskEither<R, E, A>

Added in v2.0.0

fromIO

Signature

export declare const fromIO: <R, E, A>(fa: IO<A>) => ReaderTaskEither<R, E, A>

Added in v2.0.0

fromIOEither

Signature

export declare const fromIOEither: <R, E, A>(ma: IOEither<E, A>) => ReaderTaskEither<R, E, A>

Added in v2.0.0

fromOption

Signature

export declare const fromOption: <E>(onNone: Lazy<E>) => <R, A>(ma: Option<A>) => ReaderTaskEither<R, E, A>

Added in v2.0.0

fromPredicate

Signature

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

Added in v2.0.0

fromReaderEither

Signature

export declare const fromReaderEither: <R, E, A>(ma: ReaderEither<R, E, A>) => ReaderTaskEither<R, E, A>

Added in v2.0.0

fromTask

Signature

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

Added in v2.0.0

fromTaskEither

Signature

export declare const fromTaskEither: <R, E, A>(ma: TE.TaskEither<E, A>) => ReaderTaskEither<R, E, A>

Added in v2.0.0

left

Signature

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

Added in v2.0.0

leftIO

Signature

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

Added in v2.0.0

leftReader

Signature

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

Added in v2.0.0

leftReaderTask

Signature

export declare const leftReaderTask: <R, E = never, A = never>(me: RT.ReaderTask<R, E>) => ReaderTaskEither<R, E, A>

Added in v2.5.0

leftTask

Signature

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

Added in v2.0.0

Signature

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

Added in v2.0.0

rightIO

Signature

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

Added in v2.0.0

rightReader

Signature

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

Added in v2.0.0

rightReaderTask

Signature

export declare const rightReaderTask: <R, E = never, A = never>(ma: RT.ReaderTask<R, A>) => ReaderTaskEither<R, E, A>

Added in v2.5.0

rightTask

Signature

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

Added in v2.0.0

destructors

fold

Alias of matchE.

Signature

export declare const fold: <R, E, A, B>(
  onLeft: (e: E) => RT.ReaderTask<R, B>,
  onRight: (a: A) => RT.ReaderTask<R, B>
) => (ma: ReaderTaskEither<R, E, A>) => RT.ReaderTask<R, B>

Added in v2.0.0

foldW

Alias of matchEW.

Signature

export declare const foldW: <E, R2, B, A, R3, C>(
  onLeft: (e: E) => RT.ReaderTask<R2, B>,
  onRight: (a: A) => RT.ReaderTask<R3, C>
) => <R1>(ma: ReaderTaskEither<R1, E, A>) => RT.ReaderTask<R1 & R2 & R3, B | C>

Added in v2.10.0

getOrElse

Signature

export declare const getOrElse: <R, E, A>(
  onLeft: (e: E) => RT.ReaderTask<R, A>
) => (ma: ReaderTaskEither<R, E, A>) => RT.ReaderTask<R, A>

Added in v2.0.0

getOrElseW

Less strict version of getOrElse.

Signature

export declare const getOrElseW: <R2, E, B>(
  onLeft: (e: E) => RT.ReaderTask<R2, B>
) => <R1, A>(ma: ReaderTaskEither<R1, E, A>) => RT.ReaderTask<R1 & R2, B | A>

Added in v2.6.0

match

Signature

export declare const match: <E, B, A>(
  onLeft: (e: E) => B,
  onRight: (a: A) => B
) => <R>(ma: ReaderTaskEither<R, E, A>) => RT.ReaderTask<R, B>

Added in v2.10.0

matchE

Signature

export declare const matchE: <R, E, A, B>(
  onLeft: (e: E) => RT.ReaderTask<R, B>,
  onRight: (a: A) => RT.ReaderTask<R, B>
) => (ma: ReaderTaskEither<R, E, A>) => RT.ReaderTask<R, B>

Added in v2.10.0

matchEW

Less strict version of matchE.

Signature

export declare const matchEW: <E, R2, B, A, R3, C>(
  onLeft: (e: E) => RT.ReaderTask<R2, B>,
  onRight: (a: A) => RT.ReaderTask<R3, C>
) => <R1>(ma: ReaderTaskEither<R1, E, A>) => RT.ReaderTask<R1 & R2 & R3, B | C>

Added in v2.10.0

matchW

Less strict version of match.

Signature

export declare const matchW: <E, B, A, C>(
  onLeft: (e: E) => B,
  onRight: (a: A) => C
) => <R>(ma: ReaderTaskEither<R, E, A>) => RT.ReaderTask<R, B | C>

Added in v2.10.0

instances

Alt

Signature

export declare const Alt: Alt3<'ReaderTaskEither'>

Added in v2.7.0

ApplicativePar

Signature

export declare const ApplicativePar: Applicative3<'ReaderTaskEither'>

Added in v2.7.0

ApplicativeSeq

Signature

export declare const ApplicativeSeq: Applicative3<'ReaderTaskEither'>

Added in v2.7.0

ApplyPar

Signature

export declare const ApplyPar: Apply3<'ReaderTaskEither'>

Added in v2.10.0

ApplySeq

Signature

export declare const ApplySeq: Apply3<'ReaderTaskEither'>

Added in v2.10.0

Bifunctor

Signature

export declare const Bifunctor: Bifunctor3<'ReaderTaskEither'>

Added in v2.7.0

Chain

Signature

export declare const Chain: Chain3<'ReaderTaskEither'>

Added in v2.10.0

FromEither

Signature

export declare const FromEither: FromEither3<'ReaderTaskEither'>

Added in v2.10.0

FromIO

Signature

export declare const FromIO: FromIO3<'ReaderTaskEither'>

Added in v2.10.0

FromTask

Signature

export declare const FromTask: FromTask3<'ReaderTaskEither'>

Added in v2.10.0

Functor

Signature

export declare const Functor: Functor3<'ReaderTaskEither'>

Added in v2.7.0

Monad

Signature

export declare const Monad: Monad3<'ReaderTaskEither'>

Added in v2.10.0

MonadIO

Signature

export declare const MonadIO: MonadIO3<'ReaderTaskEither'>

Added in v2.10.0

MonadTask

Signature

export declare const MonadTask: MonadTask3<'ReaderTaskEither'>

Added in v2.10.0

MonadThrow

Signature

export declare const MonadThrow: MonadThrow3<'ReaderTaskEither'>

Added in v2.10.0

Pointed

Signature

export declare const Pointed: Pointed3<'ReaderTaskEither'>

Added in v2.10.0

URI

Signature

export declare const URI: 'ReaderTaskEither'

Added in v2.0.0

URI (type alias)

Signature

export type URI = typeof URI

Added in v2.0.0

getAltReaderTaskValidation

Signature

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

Added in v2.7.0

getApplicativeReaderTaskValidation

Signature

export declare function getApplicativeReaderTaskValidation<E>(A: Apply1<T.URI>, S: Semigroup<E>): Applicative3C<URI, E>

Added in v2.7.0

getCompactable

Signature

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

Added in v2.10.0

getFilterable

Signature

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

Added in v2.10.0

getApplyMonoid

Use getApplicativeMonoid instead.

Signature

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

Added in v2.0.0

getApplySemigroup

Use getApplySemigroup instead.

Semigroup returning the left-most Left value. If both operands are Rights then the inner values are concatenated using the provided Semigroup

Signature

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

Added in v2.0.0

getReaderTaskValidation

Use getApplicativeReaderTaskValidation and getAltReaderTaskValidation instead.

Signature

export declare function getReaderTaskValidation<E>(
  SE: Semigroup<E>
): Monad3C<URI, E> & Bifunctor3<URI> & Alt3C<URI, E> & MonadTask3C<URI, E> & MonadThrow3C<URI, E>

Added in v2.3.0

getSemigroup

Use getApplySemigroup instead.

Signature

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

Added in v2.0.0

readerTaskEitherSeq

Use small, specific instances instead.

Signature

export declare const readerTaskEitherSeq: Monad3<'ReaderTaskEither'> &
  Bifunctor3<'ReaderTaskEither'> &
  Alt3<'ReaderTaskEither'> &
  MonadTask3<'ReaderTaskEither'> &
  MonadThrow3<'ReaderTaskEither'>

Added in v2.0.0

readerTaskEither

Use small, specific instances instead.

Signature

export declare const readerTaskEither: Monad3<'ReaderTaskEither'> &
  Bifunctor3<'ReaderTaskEither'> &
  Alt3<'ReaderTaskEither'> &
  MonadTask3<'ReaderTaskEither'> &
  MonadThrow3<'ReaderTaskEither'>

Added in v2.0.0

interop

toUnion

Signature

export declare const toUnion: <R, E, A>(fa: ReaderTaskEither<R, E, A>) => RT.ReaderTask<R, E | A>

Added in v2.10.0

model

ReaderTaskEither (interface)

Signature

export interface ReaderTaskEither<R, E, A> {
  (r: R): TaskEither<E, A>
}

Added in v2.0.0

utils

Do

Signature

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

Added in v2.9.0

apS

Signature

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

Added in v2.8.0

apSW

Signature

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

Added in v2.8.0

bind

Signature

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

Added in v2.8.0

bindTo

Signature

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

Added in v2.8.0

bindW

Signature

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

Added in v2.8.0

bracket

Make sure that a resource is cleaned up in the event of an exception (*). The release action is called regardless of whether the body action throws (*) or returns.

(*) i.e. returns a Left

Signature

export declare function bracket<R, E, A, B>(
  aquire: ReaderTaskEither<R, E, A>,
  use: (a: A) => ReaderTaskEither<R, E, B>,
  release: (a: A, e: Either<E, B>) => ReaderTaskEither<R, E, void>
): ReaderTaskEither<R, E, B>

Added in v2.0.4

sequenceArray

Equivalent to ReadonlyArray#sequence(ApplicativePar).

Signature

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

Added in v2.9.0

sequenceSeqArray

Equivalent to ReadonlyArray#sequence(ApplicativeSeq).

Signature

export declare const sequenceSeqArray: <R, E, A>(
  arr: readonly ReaderTaskEither<R, E, A>[]
) => ReaderTaskEither<R, E, readonly A[]>

Added in v2.9.0

traverseArray

Equivalent to ReadonlyArray#traverse(ApplicativePar).

Signature

export declare const traverseArray: <R, E, A, B>(
  f: (a: A) => ReaderTaskEither<R, E, B>
) => (as: readonly A[]) => ReaderTaskEither<R, E, readonly B[]>

Added in v2.9.0

traverseArrayWithIndex

Equivalent to ReadonlyArray#traverseWithIndex(ApplicativePar).

Signature

export declare const traverseArrayWithIndex: <R, E, A, B>(
  f: (index: number, a: A) => ReaderTaskEither<R, E, B>
) => (as: readonly A[]) => ReaderTaskEither<R, E, readonly B[]>

Added in v2.9.0

traverseSeqArray

Equivalent to ReadonlyArray#traverse(ApplicativeSeq).

Signature

export declare const traverseSeqArray: <R, E, A, B>(
  f: (a: A) => ReaderTaskEither<R, E, B>
) => (as: readonly A[]) => ReaderTaskEither<R, E, readonly B[]>

Added in v2.9.0

traverseSeqArrayWithIndex

Equivalent to ReadonlyArray#traverseWithIndex(ApplicativeSeq).

Signature

export declare const traverseSeqArrayWithIndex: <R, E, A, B>(
  f: (index: number, a: A) => ReaderTaskEither<R, E, B>
) => (as: readonly A[]) => ReaderTaskEither<R, E, readonly B[]>

Added in v2.9.0

run

Signature

export declare function run<R, E, A>(ma: ReaderTaskEither<R, E, A>, r: R): Promise<Either<E, A>>

Added in v2.0.0