StateReaderTaskEither overview

Added in v2.0.0


Table of contents


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

Added in v2.15.0

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

Added in v2.16.0

tapIO

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 tapIO: {
  <A, _>(f: (a: A) => IO<_>): <S, R, E>(self: StateReaderTaskEither<S, R, E, A>) => StateReaderTaskEither<S, R, E, A>
  <S, R, E, A, _>(self: StateReaderTaskEither<S, R, E, A>, f: (a: A) => IO<_>): StateReaderTaskEither<S, R, E, A>
}

Added in v2.16.0

tapReader

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

Added in v2.16.0

tapTask

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 tapTask: {
  <A, _>(f: (a: A) => Task<_>): <S, R, E>(self: StateReaderTaskEither<S, R, E, A>) => StateReaderTaskEither<S, R, E, A>
  <S, R, E, A, _>(self: StateReaderTaskEither<S, R, E, A>, f: (a: A) => Task<_>): StateReaderTaskEither<S, R, E, A>
}

Added in v2.16.0

constructors

ask

Reads the current context.

Signature

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

Added in v2.11.0

asks

Projects a value from the global context in a ReaderEither.

Signature

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

Added in v2.11.0

asksStateReaderTaskEither

Effectfully accesses the environment.

Signature

export declare const asksStateReaderTaskEither: <R, S, E, A>(
  f: (r: R) => StateReaderTaskEither<S, R, E, A>
) => StateReaderTaskEither<S, R, E, A>

Added in v2.11.0

asksStateReaderTaskEitherW

Less strict version of asksStateReaderTaskEither.

Signature

export declare const asksStateReaderTaskEitherW: <R1, S, R2, E, A>(
  f: (r1: R1) => StateReaderTaskEither<S, R2, E, A>
) => StateReaderTaskEither<S, R1 & R2, E, A>

Added in v2.11.0

fromReaderTaskEither

Signature

export declare const fromReaderTaskEither: <R, E, A, S>(
  fa: RTE.ReaderTaskEither<R, E, A>
) => StateReaderTaskEither<S, R, E, A>

Added in v2.0.0

get

Get the current state

Signature

export declare const get: <S, R, E = never>() => StateReaderTaskEither<S, R, E, S>

Added in v2.0.0

gets

Get a value which depends on the current state

Signature

export declare const gets: <S, R, E = never, A = never>(f: (s: S) => A) => StateReaderTaskEither<S, R, E, A>

Added in v2.0.0

left

Signature

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

Added in v2.0.0

leftIO

Signature

export declare function leftIO<S, R, E, A = never>(me: IO<E>): StateReaderTaskEither<S, R, E, A>

Added in v2.0.0

leftReader

Signature

export declare function leftReader<S, R, E, A = never>(me: Reader<R, E>): StateReaderTaskEither<S, R, E, A>

Added in v2.0.0

leftState

Signature

export declare const leftState: <S, R, E, A = never>(me: State<S, E>) => StateReaderTaskEither<S, R, E, A>

Added in v2.0.0

leftTask

Signature

export declare function leftTask<S, R, E, A = never>(me: Task<E>): StateReaderTaskEither<S, R, E, A>

Added in v2.0.0

modify

Modify the state by applying a function to the current state

Signature

export declare const modify: <S, R, E = never>(f: Endomorphism<S>) => StateReaderTaskEither<S, R, E, void>

Added in v2.0.0

of

Signature

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

Added in v2.7.0

put

Set the state

Signature

export declare const put: <S, R, E = never>(s: S) => StateReaderTaskEither<S, R, E, void>

Added in v2.0.0

Signature

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

Added in v2.0.0

rightIO

Signature

export declare function rightIO<S, R, E = never, A = never>(ma: IO<A>): StateReaderTaskEither<S, R, E, A>

Added in v2.0.0

rightReader

Signature

export declare function rightReader<S, R, E = never, A = never>(ma: Reader<R, A>): StateReaderTaskEither<S, R, E, A>

Added in v2.0.0

rightState

Signature

export declare const rightState: <S, R, E = never, A = never>(ma: State<S, A>) => StateReaderTaskEither<S, R, E, A>

Added in v2.0.0

rightTask

Signature

export declare function rightTask<S, R, E = never, A = never>(ma: Task<A>): StateReaderTaskEither<S, R, E, A>

Added in v2.0.0

conversions

fromEither

Signature

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

Added in v2.0.0

fromIO

Signature

export declare const fromIO: <A, S, R = unknown, E = never>(fa: IO<A>) => StateReaderTaskEither<S, R, E, A>

Added in v2.7.0

fromIOEither

Signature

export declare const fromIOEither: <E, A, S, R = unknown>(fa: IOEither<E, A>) => StateReaderTaskEither<S, R, E, A>

Added in v2.0.0

fromOption

Signature

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

Added in v2.0.0

fromReader

Signature

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

Added in v2.11.0

fromReaderEither

Signature

export declare const fromReaderEither: <R, E, A, S>(fa: ReaderEither<R, E, A>) => StateReaderTaskEither<S, R, E, A>

Added in v2.0.0

fromState

Signature

export declare const fromState: <S, A, R = unknown, E = never>(fa: State<S, A>) => StateReaderTaskEither<S, R, E, A>

Added in v2.10.0

fromTask

Signature

export declare const fromTask: <A, S, R = unknown, E = never>(fa: Task<A>) => StateReaderTaskEither<S, R, E, A>

Added in v2.7.0

fromTaskEither

Signature

export declare const fromTaskEither: <E, A, S, R = unknown>(fa: TaskEither<E, A>) => StateReaderTaskEither<S, R, E, A>

Added in v2.0.0

do notation

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, S, R2, E2, B>(
  name: Exclude<N, keyof A>,
  fb: StateReaderTaskEither<S, R2, E2, B>
) => <R1, E1>(
  fa: StateReaderTaskEither<S, R1, E1, A>
) => StateReaderTaskEither<S, R1 & R2, E2 | E1, { readonly [K in N | keyof A]: K extends keyof A ? A[K] : B }>

Added in v2.8.0

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: <S, R, E, A>(
  that: LazyArg<StateReaderTaskEither<S, R, E, A>>
) => (fa: StateReaderTaskEither<S, R, E, A>) => StateReaderTaskEither<S, R, E, A>

Added in v2.6.2

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: <S, R2, E2, B>(
  that: () => StateReaderTaskEither<S, R2, E2, B>
) => <R1, E1, A>(fa: StateReaderTaskEither<S, R1, E1, A>) => StateReaderTaskEither<S, R1 & R2, E2, B | A>

Added in v2.9.0

mapLeft

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

Signature

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

Added in v2.6.2

filtering

filterOrElse

Signature

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

Added in v2.4.4

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): <S, R, E1>(
    ma: StateReaderTaskEither<S, R, E1, A>
  ) => StateReaderTaskEither<S, R, E2 | E1, B>
  <A, E2>(predicate: Predicate<A>, onFalse: (a: A) => E2): <S, R, E1, B extends A>(
    mb: StateReaderTaskEither<S, R, E1, B>
  ) => StateReaderTaskEither<S, R, E2 | E1, B>
  <A, E2>(predicate: Predicate<A>, onFalse: (a: A) => E2): <S, R, E1>(
    ma: StateReaderTaskEither<S, R, E1, A>
  ) => StateReaderTaskEither<S, R, E2 | E1, A>
}

Added in v2.9.0

instances

Alt

Signature

export declare const Alt: Alt4<'StateReaderTaskEither'>

Added in v2.7.0

Applicative

Signature

export declare const Applicative: Applicative4<'StateReaderTaskEither'>

Added in v2.7.0

Apply

Signature

export declare const Apply: Apply4<'StateReaderTaskEither'>

Added in v2.10.0

Bifunctor

Signature

export declare const Bifunctor: Bifunctor4<'StateReaderTaskEither'>

Added in v2.7.0

Chain

Signature

export declare const Chain: chainable.Chain4<'StateReaderTaskEither'>

Added in v2.10.0

FromEither

Signature

export declare const FromEither: FromEither4<'StateReaderTaskEither'>

Added in v2.10.0

FromIO

Signature

export declare const FromIO: FromIO4<'StateReaderTaskEither'>

Added in v2.10.0

FromReader

Signature

export declare const FromReader: FromReader4<'StateReaderTaskEither'>

Added in v2.11.0

FromState

Signature

export declare const FromState: FromState4<'StateReaderTaskEither'>

Added in v2.11.0

FromTask

Signature

export declare const FromTask: FromTask4<'StateReaderTaskEither'>

Added in v2.10.0

Functor

Signature

export declare const Functor: Functor4<'StateReaderTaskEither'>

Added in v2.7.0

Monad

Signature

export declare const Monad: Monad4<'StateReaderTaskEither'>

Added in v2.10.0

MonadIO

Signature

export declare const MonadIO: MonadIO4<'StateReaderTaskEither'>

Added in v2.10.0

MonadTask

Signature

export declare const MonadTask: MonadTask4<'StateReaderTaskEither'>

Added in v2.10.0

MonadThrow

Signature

export declare const MonadThrow: MonadThrow4<'StateReaderTaskEither'>

Added in v2.10.0

Pointed

Signature

export declare const Pointed: Pointed4<'StateReaderTaskEither'>

Added in v2.10.0

legacy

chain

Alias of flatMap.

Signature

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

Added in v2.0.0

chainEitherK

Alias of flatMapEither.

Signature

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

Added in v2.4.0

chainEitherKW

Alias of flatMapEither.

Less strict version of chainEitherK.

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

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

Signature

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

Added in v2.6.1

chainFirst

Alias of tap.

Signature

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

Added in v2.0.0

chainFirstEitherK

Alias of tapEither.

Signature

export declare const chainFirstEitherK: <A, E, B>(
  f: (a: A) => E.Either<E, B>
) => <S, R>(ma: StateReaderTaskEither<S, R, E, A>) => StateReaderTaskEither<S, R, E, A>

Added in v2.12.0

chainFirstEitherKW

Alias of tapEither.

Less strict version of chainFirstEitherK.

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

Signature

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

Added in v2.12.0

chainFirstIOK

Alias of tapIO.

Signature

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

Added in v2.10.0

chainFirstReaderK

Alias of tapReader.

Signature

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

Added in v2.11.0

chainFirstReaderKW

Alias of tapReader.

Less strict version of chainFirstReaderK.

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

Signature

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

Added in v2.11.0

chainFirstTaskK

Alias of tapTask.

Signature

export declare const chainFirstTaskK: <A, B>(
  f: (a: A) => Task<B>
) => <S, R, E>(first: StateReaderTaskEither<S, R, E, A>) => StateReaderTaskEither<S, R, E, A>

Added in v2.10.0

chainFirstW

Alias of tap.

Signature

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

Added in v2.8.0

chainIOEitherK

Alias of flatMapIOEither.

Signature

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

Added in v2.4.0

chainIOEitherKW

Alias of flatMapIOEither.

Less strict version of chainIOEitherK.

Signature

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

Added in v2.6.1

chainIOK

Alias of flatMapIO.

Signature

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

Added in v2.10.0

chainOptionK

Use flatMapOption.

Signature

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

Added in v2.10.0

chainOptionKW

Use flatMapOption.

Less strict version of chainOptionK.

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

Signature

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

Added in v2.13.2

chainReaderK

Alias of flatMapReader.

Signature

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

Added in v2.11.0

chainReaderKW

Alias of flatMapReader.

Less strict version of chainReaderK.

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

Signature

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

Added in v2.11.0

chainReaderTaskEitherK

Alias of flatMapReaderTaskEither.

Signature

export declare const chainReaderTaskEitherK: <R, E, A, B>(
  f: (a: A) => RTE.ReaderTaskEither<R, E, B>
) => <S>(ma: StateReaderTaskEither<S, R, E, A>) => StateReaderTaskEither<S, R, E, B>

Added in v2.4.0

chainReaderTaskEitherKW

Alias of flatMapReaderTaskEither.

Less strict version of chainReaderTaskEitherK.

Signature

export declare const chainReaderTaskEitherKW: <R, E2, A, B>(
  f: (a: A) => RTE.ReaderTaskEither<R, E2, B>
) => <S, E1>(ma: StateReaderTaskEither<S, R, E1, A>) => StateReaderTaskEither<S, R, E2 | E1, B>

Added in v2.6.1

chainStateK

Alias of flatMapState.

Signature

export declare const chainStateK: <A, S, B>(
  f: (a: A) => State<S, B>
) => <R, E>(ma: StateReaderTaskEither<S, R, E, A>) => StateReaderTaskEither<S, R, E, B>

Added in v2.11.0

chainTaskEitherK

Alias of flatMapTaskEither.

Signature

export declare const chainTaskEitherK: <E, A, B>(
  f: (a: A) => TaskEither<E, B>
) => <S, R>(ma: StateReaderTaskEither<S, R, E, A>) => StateReaderTaskEither<S, R, E, B>

Added in v2.4.0

chainTaskEitherKW

Alias of flatMapTaskEither.

Less strict version of chainTaskEitherK.

Signature

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

Added in v2.6.1

chainTaskK

Alias of flatMapTask.

Signature

export declare const chainTaskK: <A, B>(
  f: (a: A) => Task<B>
) => <S, R, E>(first: StateReaderTaskEither<S, R, E, A>) => StateReaderTaskEither<S, R, E, B>

Added in v2.10.0

chainW

Alias of flatMap.

Signature

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

Added in v2.6.0

lifting

fromEitherK

Signature

export declare const fromEitherK: <E, A extends readonly unknown[], B>(
  f: (...a: A) => E.Either<E, B>
) => <S, R = unknown>(...a: A) => StateReaderTaskEither<S, 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>
) => <S, R = unknown>(...a: A) => StateReaderTaskEither<S, R, E, B>

Added in v2.4.0

fromIOK

Signature

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

Added in v2.10.0

fromOptionK

Signature

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

Added in v2.10.0

fromPredicate

Signature

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

Added in v2.4.4

fromReaderK

Signature

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

Added in v2.11.0

fromReaderTaskEitherK

Signature

export declare const fromReaderTaskEitherK: <R, E, A extends readonly unknown[], B>(
  f: (...a: A) => RTE.ReaderTaskEither<R, E, B>
) => <S>(...a: A) => StateReaderTaskEither<S, R, E, B>

Added in v2.4.0

fromStateK

Signature

export declare const fromStateK: <A extends readonly unknown[], S, B>(
  f: (...a: A) => State<S, B>
) => <R = unknown, E = never>(...a: A) => StateReaderTaskEither<S, R, E, B>

Added in v2.11.0

fromTaskEitherK

Signature

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

Added in v2.4.0

fromTaskK

Signature

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

Added in v2.10.0

mapping

as

Maps the Right value of this StateReaderTaskEither to the specified constant value.

Signature

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

Added in v2.16.0

asUnit

Maps the Right value of this StateReaderTaskEither to the void constant value.

Signature

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

Added in v2.16.0

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
) => <S, R>(fa: StateReaderTaskEither<S, R, E, A>) => StateReaderTaskEither<S, R, G, B>

Added in v2.6.2

flap

Signature

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

Added in v2.10.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
) => <S, R, E>(fa: StateReaderTaskEither<S, R, E, A>) => StateReaderTaskEither<S, R, E, B>

Added in v2.0.0

model

StateReaderTaskEither (interface)

Signature

export interface StateReaderTaskEither<S, R, E, A> {
  (s: S): ReaderTaskEither<R, E, [A, S]>
}

Added in v2.0.0

sequencing

flatMap

Signature

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

Added in v2.14.0

flatMapEither

Signature

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

Added in v2.16.0

flatMapIO

Signature

export declare const flatMapIO: {
  <A, B>(f: (a: A) => IO<B>): <S, R, E>(self: StateReaderTaskEither<S, R, E, A>) => StateReaderTaskEither<S, R, E, B>
  <S, R, E, A, B>(self: StateReaderTaskEither<S, R, E, A>, f: (a: A) => IO<B>): StateReaderTaskEither<S, R, E, B>
}

Added in v2.16.0

flatMapIOEither

Signature

export declare const flatMapIOEither: {
  <A, E2, B>(f: (a: A) => IOEither<E2, B>): <S, R, E1>(
    self: StateReaderTaskEither<S, R, E1, A>
  ) => StateReaderTaskEither<S, R, E2 | E1, B>
  <S, R, E1, A, E2, B>(self: StateReaderTaskEither<S, R, E1, A>, f: (a: A) => IOEither<E2, B>): StateReaderTaskEither<
    S,
    R,
    E1 | E2,
    B
  >
}

Added in v2.16.0

flatMapOption

Signature

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

Added in v2.16.0

flatMapReader

Signature

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

Added in v2.16.0

flatMapReaderTaskEither

Signature

export declare const flatMapReaderTaskEither: {
  <A, R2, E2, B>(f: (a: A) => RTE.ReaderTaskEither<R2, E2, B>): <S, R1, E1>(
    self: StateReaderTaskEither<S, R1, E1, A>
  ) => StateReaderTaskEither<S, R1 & R2, E2 | E1, B>
  <S, R1, E1, A, R2, E2, B>(
    self: StateReaderTaskEither<S, R1, E1, A>,
    f: (a: A) => RTE.ReaderTaskEither<R2, E2, B>
  ): StateReaderTaskEither<S, R1 & R2, E1 | E2, B>
}

Added in v2.16.0

flatMapState

Signature

export declare const flatMapState: {
  <S, A, B>(f: (a: A) => State<S, B>): <R, E>(
    self: StateReaderTaskEither<S, R, E, A>
  ) => StateReaderTaskEither<S, R, E, B>
  <S, R, E, A, B>(self: StateReaderTaskEither<S, R, E, A>, f: (a: A) => State<S, B>): StateReaderTaskEither<S, R, E, B>
}

Added in v2.16.0

flatMapTask

Signature

export declare const flatMapTask: {
  <A, B>(f: (a: A) => Task<B>): <S, R, E>(self: StateReaderTaskEither<S, R, E, A>) => StateReaderTaskEither<S, R, E, B>
  <S, R, E, A, B>(self: StateReaderTaskEither<S, R, E, A>, f: (a: A) => Task<B>): StateReaderTaskEither<S, R, E, B>
}

Added in v2.16.0

flatMapTaskEither

Signature

export declare const flatMapTaskEither: {
  <A, E2, B>(f: (a: A) => TaskEither<E2, B>): <S, R, E1>(
    self: StateReaderTaskEither<S, R, E1, A>
  ) => StateReaderTaskEither<S, R, E2 | E1, B>
  <S, R, E1, A, E2, B>(self: StateReaderTaskEither<S, R, E1, A>, f: (a: A) => TaskEither<E2, B>): StateReaderTaskEither<
    S,
    R,
    E1 | E2,
    B
  >
}

Added in v2.16.0

flatten

Signature

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

Added in v2.0.0

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: <S, R1, E1, R2, E2, A>(
  mma: StateReaderTaskEither<S, R1, E1, StateReaderTaskEither<S, R2, E2, A>>
) => StateReaderTaskEither<S, R1 & R2, E1 | E2, A>

Added in v2.11.0

traversing

sequenceArray

Equivalent to ReadonlyArray#sequence(Applicative).

Signature

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

Added in v2.9.0

traverseArray

Equivalent to ReadonlyArray#traverse(Applicative).

Signature

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

Added in v2.9.0

traverseArrayWithIndex

Equivalent to ReadonlyArray#traverseWithIndex(Applicative).

Signature

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

Added in v2.9.0

traverseReadonlyArrayWithIndex

Equivalent to ReadonlyArray#traverseWithIndex(Applicative).

Signature

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

Added in v2.11.0

traverseReadonlyNonEmptyArrayWithIndex

Equivalent to ReadonlyNonEmptyArray#traverseWithIndex(Applicative).

Signature

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

Added in v2.11.0

type lambdas

URI

Signature

export declare const URI: 'StateReaderTaskEither'

Added in v2.0.0

URI (type alias)

Signature

export type URI = typeof URI

Added in v2.0.0

utils

ap

Signature

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

Added in v2.0.0

apFirst

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

Signature

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

Added in v2.0.0

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: <S, R2, E2, A, B>(
  second: StateReaderTaskEither<S, R2, E2, B>
) => <R1, E1>(first: StateReaderTaskEither<S, R1, E1, A>) => StateReaderTaskEither<S, R1 & R2, E2 | E1, A>

Added in v2.12.0

apS

Signature

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

Added in v2.8.0

apSecond

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

Signature

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

Added in v2.0.0

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: <S, R2, E2, A, B>(
  second: StateReaderTaskEither<S, R2, E2, B>
) => <R1, E1>(first: StateReaderTaskEither<S, R1, E1, A>) => StateReaderTaskEither<S, R1 & R2, E2 | E1, B>

Added in v2.12.0

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: <S, R2, E2, A>(
  fa: StateReaderTaskEither<S, R2, E2, A>
) => <R1, E1, B>(fab: StateReaderTaskEither<S, R1, E1, (a: A) => B>) => StateReaderTaskEither<S, R1 & R2, E2 | E1, B>

Added in v2.8.0

bind

Signature

export declare const bind: <N, A, S, R, E, B>(
  name: Exclude<N, keyof A>,
  f: (a: A) => StateReaderTaskEither<S, R, E, B>
) => (
  ma: StateReaderTaskEither<S, R, E, A>
) => StateReaderTaskEither<S, 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
) => <S, R, E, A>(fa: StateReaderTaskEither<S, R, E, A>) => StateReaderTaskEither<S, R, E, { readonly [K in N]: A }>

Added in v2.8.0

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, S, R2, E2, B>(
  name: Exclude<N, keyof A>,
  f: (a: A) => StateReaderTaskEither<S, R2, E2, B>
) => <R1, E1>(
  fa: StateReaderTaskEither<S, R1, E1, A>
) => StateReaderTaskEither<S, R1 & R2, E2 | E1, { readonly [K in N | keyof A]: K extends keyof A ? A[K] : B }>

Added in v2.8.0

evaluate

Run a computation in the StateReaderTaskEither monad, discarding the final state

Signature

export declare const evaluate: <S>(
  s: S
) => <R, E, A>(ma: StateReaderTaskEither<S, R, E, A>) => RTE.ReaderTaskEither<R, E, A>

Added in v2.8.0

execute

Run a computation in the StateReaderTaskEither monad discarding the result

Signature

export declare const execute: <S>(
  s: S
) => <R, E, A>(ma: StateReaderTaskEither<S, R, E, A>) => RTE.ReaderTaskEither<R, E, S>

Added in v2.8.0

let

Signature

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

Added in v2.13.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
) => <S, E, A>(ma: StateReaderTaskEither<S, R1, E, A>) => StateReaderTaskEither<S, R2, E, A>

Added in v2.11.0

throwError

Signature

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

Added in v2.7.0

zone of death

evalState

Use evaluate instead

Signature

export declare const evalState: <S, R, E, A>(
  ma: StateReaderTaskEither<S, R, E, A>,
  s: S
) => RTE.ReaderTaskEither<R, E, A>

Added in v2.0.0

execState

Use execute instead

Signature

export declare const execState: <S, R, E, A>(
  ma: StateReaderTaskEither<S, R, E, A>,
  s: S
) => RTE.ReaderTaskEither<R, E, S>

Added in v2.0.0

run

Signature

export declare function run<S, R, E, A>(ma: StateReaderTaskEither<S, R, E, A>, s: S, r: R): Promise<Either<E, [A, S]>>

Added in v2.0.0

stateReaderTaskEitherSeq

This instance is deprecated, use small, specific instances instead. For example if a function needs a Functor instance, pass SRTE.Functor instead of SRTE.stateReaderTaskEitherSeq (where SRTE is from import SRTE from 'fp-ts/StateReaderTaskEither')

Signature

export declare const stateReaderTaskEitherSeq: Monad4<'StateReaderTaskEither'> &
  Bifunctor4<'StateReaderTaskEither'> &
  Alt4<'StateReaderTaskEither'> &
  MonadTask4<'StateReaderTaskEither'> &
  MonadThrow4<'StateReaderTaskEither'>

Added in v2.0.0

stateReaderTaskEither

This instance is deprecated, use small, specific instances instead. For example if a function needs a Functor instance, pass SRTE.Functor instead of SRTE.stateReaderTaskEither (where SRTE is from import SRTE from 'fp-ts/StateReaderTaskEither')

Signature

export declare const stateReaderTaskEither: Monad4<'StateReaderTaskEither'> &
  Bifunctor4<'StateReaderTaskEither'> &
  Alt4<'StateReaderTaskEither'> &
  MonadTask4<'StateReaderTaskEither'> &
  MonadThrow4<'StateReaderTaskEither'>

Added in v2.0.0