Link Search Menu Expand Document

ReaderTask overview

Added in v2.3.0


Table of contents


Apply

ap

Apply a function to an argument under a type constructor.

Signature

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

Added in v2.3.0

apW

Less strict version of ap.

Signature

export declare const apW: <R2, A>(
  fa: ReaderTask<R2, A>
) => <R1, B>(fab: ReaderTask<R1, (a: A) => B>) => ReaderTask<R1 & R2, B>

Added in v2.8.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>(fa: ReaderTask<R, A>) => ReaderTask<R, B>

Added in v2.3.0

Monad

chain

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

Signature

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

Added in v2.3.0

chainW

Less strict version of chain.

Signature

export declare const chainW: <R2, A, B>(
  f: (a: A) => ReaderTask<R2, B>
) => <R1>(ma: ReaderTask<R1, A>) => ReaderTask<R1 & R2, B>

Added in v2.6.7

Pointed

of

Signature

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

Added in v2.3.0

combinators

apFirst

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

Derivable from Apply.

Signature

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

Added in v2.3.0

apSecond

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

Derivable from Apply.

Signature

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

Added in v2.3.0

asksReaderTask

Effectfully accesses the environment.

Signature

export declare const asksReaderTask: <R, A>(f: (r: R) => ReaderTask<R, A>) => ReaderTask<R, A>

Added in v2.11.0

asksReaderTaskW

Less strict version of asksReaderTask.

Signature

export declare const asksReaderTaskW: <R1, R2, A>(f: (r1: R1) => ReaderTask<R2, A>) => ReaderTask<R1 & R2, A>

Added in v2.11.0

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: <A, E, B>(
  f: (a: A) => ReaderTask<E, B>
) => (first: ReaderTask<E, A>) => ReaderTask<E, A>

Added in v2.3.0

chainFirstIOK

Signature

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

Added in v2.10.0

chainFirstReaderK

Signature

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

Added in v2.11.0

chainFirstReaderKW

Less strict version of chainFirstReaderK.

Signature

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

Added in v2.11.0

chainFirstTaskK

Signature

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

Added in v2.10.0

chainFirstW

Less strict version of chainFirst.

Derivable from Chain.

Signature

export declare const chainFirstW: <R2, A, B>(
  f: (a: A) => ReaderTask<R2, B>
) => <R1>(ma: ReaderTask<R1, A>) => ReaderTask<R1 & R2, A>

Added in v2.11.0

chainIOK

Signature

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

Added in v2.4.0

chainReaderK

Signature

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

Added in v2.11.0

chainReaderKW

Less strict version of chainReaderK.

Signature

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

Added in v2.11.0

chainTaskK

Signature

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

Added in v2.4.0

flap

Derivable from Functor.

Signature

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

Added in v2.10.0

flatten

Derivable from Chain.

Signature

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

Added in v2.3.0

flattenW

Less strict version of flatten.

Signature

export declare const flattenW: <R1, R2, A>(mma: ReaderTask<R1, ReaderTask<R2, A>>) => ReaderTask<R1 & R2, A>

Added in v2.11.0

fromIOK

Signature

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

Added in v2.4.0

fromReaderK

Signature

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

Added in v2.11.0

fromTaskK

Signature

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

Added in v2.4.0

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) => <A>(ma: ReaderTask<R1, A>) => ReaderTask<R2, A>

Added in v2.3.0

constructors

ask

Reads the current context.

Signature

export declare const ask: <R>() => ReaderTask<R, R>

Added in v2.3.0

asks

Projects a value from the global context in a ReaderTask.

Signature

export declare const asks: <R, A>(f: (r: R) => A) => ReaderTask<R, A>

Added in v2.3.0

instances

ApplicativePar

Signature

export declare const ApplicativePar: Applicative2<'ReaderTask'>

Added in v2.7.0

ApplicativeSeq

Signature

export declare const ApplicativeSeq: Applicative2<'ReaderTask'>

Added in v2.7.0

ApplyPar

Signature

export declare const ApplyPar: Apply2<'ReaderTask'>

Added in v2.10.0

ApplySeq

Signature

export declare const ApplySeq: Apply2<'ReaderTask'>

Added in v2.10.0

Chain

Signature

export declare const Chain: Chain2<'ReaderTask'>

Added in v2.10.0

FromIO

Signature

export declare const FromIO: FromIO2<'ReaderTask'>

Added in v2.10.0

FromReader

Signature

export declare const FromReader: FromReader2<'ReaderTask'>

Added in v2.11.0

FromTask

Signature

export declare const FromTask: FromTask2<'ReaderTask'>

Added in v2.10.0

Functor

Signature

export declare const Functor: Functor2<'ReaderTask'>

Added in v2.7.0

Monad

Signature

export declare const Monad: Monad2<'ReaderTask'>

Added in v2.10.0

MonadIO

Signature

export declare const MonadIO: MonadIO2<'ReaderTask'>

Added in v2.10.0

MonadTask

Signature

export declare const MonadTask: MonadTask2<'ReaderTask'>

Added in v2.10.0

Pointed

Signature

export declare const Pointed: Pointed2<'ReaderTask'>

Added in v2.10.0

URI

Signature

export declare const URI: 'ReaderTask'

Added in v2.3.0

URI (type alias)

Signature

export type URI = typeof URI

Added in v2.3.0

getMonoid

Use getApplicativeMonoid instead.

Signature

export declare const getMonoid: <R, A>(M: Monoid<A>) => Monoid<ReaderTask<R, A>>

Added in v2.3.0

getSemigroup

Use getApplySemigroup instead.

Signature

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

Added in v2.3.0

readerTaskSeq

Use small, specific instances instead.

Signature

export declare const readerTaskSeq: MonadTask2<'ReaderTask'>

Added in v2.3.0

readerTask

Use small, specific instances instead.

Signature

export declare const readerTask: MonadTask2<'ReaderTask'>

Added in v2.3.0

model

ReaderTask (interface)

Signature

export interface ReaderTask<R, A> {
  (r: R): Task<A>
}

Added in v2.3.0

natural transformations

fromIO

Signature

export declare const fromIO: NaturalTransformation12<'IO', 'ReaderTask'>

Added in v2.3.0

fromReader

Signature

export declare const fromReader: NaturalTransformation22<'Reader', 'ReaderTask'>

Added in v2.3.0

fromTask

Signature

export declare const fromTask: NaturalTransformation12<'Task', 'ReaderTask'>

Added in v2.3.0

utils

ApT

Signature

export declare const ApT: ReaderTask<unknown, readonly []>

Added in v2.11.0

Do

Signature

export declare const Do: ReaderTask<unknown, {}>

Added in v2.9.0

apS

Signature

export declare const apS: <N, A, E, B>(
  name: Exclude<N, keyof A>,
  fb: ReaderTask<E, B>
) => (fa: ReaderTask<E, A>) => ReaderTask<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, B>(
  name: Exclude<N, keyof A>,
  fb: ReaderTask<R2, B>
) => <R1>(fa: ReaderTask<R1, A>) => ReaderTask<R1 & R2, { 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, E, B>(
  name: Exclude<N, keyof A>,
  f: (a: A) => ReaderTask<E, B>
) => (ma: ReaderTask<E, A>) => ReaderTask<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) => <E, A>(fa: ReaderTask<E, A>) => ReaderTask<E, { readonly [K in N]: A }>

Added in v2.8.0

bindW

Signature

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

Added in v2.8.0

sequenceArray

Signature

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

Added in v2.9.0

traverseArray

Signature

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

Added in v2.9.0

traverseArrayWithIndex

Signature

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

Added in v2.9.0

traverseReadonlyArrayWithIndex

Equivalent to ReadonlyArray#traverseWithIndex(Applicative).

Signature

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

Added in v2.11.0

traverseReadonlyArrayWithIndexSeq

Equivalent to ReadonlyArray#traverseWithIndex(ApplicativeSeq).

Signature

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

Added in v2.11.0

traverseReadonlyNonEmptyArrayWithIndex

Equivalent to ReadonlyNonEmptyArray#traverseWithIndex(Applicative).

Signature

export declare const traverseReadonlyNonEmptyArrayWithIndex: <A, R, B>(
  f: (index: number, a: A) => ReaderTask<R, B>
) => (as: ReadonlyNonEmptyArray<A>) => ReaderTask<R, ReadonlyNonEmptyArray<B>>

Added in v2.11.0

traverseReadonlyNonEmptyArrayWithIndexSeq

Equivalent to ReadonlyNonEmptyArray#traverseWithIndex(ApplicativeSeq).

Signature

export declare const traverseReadonlyNonEmptyArrayWithIndexSeq: <R, A, B>(
  f: (index: number, a: A) => ReaderTask<R, B>
) => (as: ReadonlyNonEmptyArray<A>) => ReaderTask<R, ReadonlyNonEmptyArray<B>>

Added in v2.11.0

traverseSeqArray

Signature

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

Added in v2.10.0

traverseSeqArrayWithIndex

Signature

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

Added in v2.10.0

run

Signature

export declare function run<R, A>(ma: ReaderTask<R, A>, r: R): Promise<A>

Added in v2.4.0

sequenceSeqArray

Use traverseReadonlyArrayWithIndexSeq instead.

Signature

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

Added in v2.10.0