/** * @since 2.0.0 */ import { Alt3, Alt3C } from './Alt' import { Applicative3, Applicative3C } from './Applicative' import { Bifunctor3 } from './Bifunctor' import * as E from './Either' import { Predicate, Refinement } from './function' import { Functor3 } from './Functor' import { Monad3, Monad3C } from './Monad' import { MonadThrow3, MonadThrow3C } from './MonadThrow' import { Monoid } from './Monoid' import { Option } from './Option' import * as R from './Reader' import { Semigroup } from './Semigroup' import Either = E.Either import Reader = R.Reader /** * @category model * @since 2.0.0 */ export interface ReaderEither extends Reader> {} /** * @category constructors * @since 2.0.0 */ export declare const left: (e: E) => ReaderEither /** * @category constructors * @since 2.0.0 */ export declare const right: (a: A) => ReaderEither /** * @category constructors * @since 2.0.0 */ export declare const rightReader: (ma: Reader) => ReaderEither /** * @category constructors * @since 2.0.0 */ export declare const leftReader: (me: Reader) => ReaderEither /** * @category constructors * @since 2.0.0 */ export declare const ask: () => ReaderEither /** * @category constructors * @since 2.0.0 */ export declare const asks: (f: (r: R) => A) => ReaderEither /** * Derivable from `MonadThrow`. * * @category constructors * @since 2.0.0 */ export declare const fromEither: (ma: E.Either) => ReaderEither /** * Derivable from `MonadThrow`. * * @category constructors * @since 2.0.0 */ export declare const fromOption: (onNone: () => E) => (ma: Option) => ReaderEither /** * Derivable from `MonadThrow`. * * @category constructors * @since 2.0.0 */ export declare const fromPredicate: { (refinement: Refinement, onFalse: (a: A) => E): (a: A) => ReaderEither (predicate: Predicate, onFalse: (a: A) => E): (a: A) => ReaderEither } /** * @category destructors * @since 2.0.0 */ export declare const fold: ( onLeft: (e: E) => Reader, onRight: (a: A) => Reader ) => (ma: ReaderEither) => Reader /** * Less strict version of [`getOrElse`](#getOrElse). * * @category destructors * @since 2.6.0 */ export declare const getOrElseW: ( onLeft: (e: E) => R.Reader ) => (ma: ReaderEither) => R.Reader /** * @category destructors * @since 2.0.0 */ export declare const getOrElse: (onLeft: (e: E) => Reader) => (ma: ReaderEither) => Reader /** * @category combinators * @since 2.0.0 */ export declare const orElse: ( onLeft: (e: E) => ReaderEither ) => (ma: ReaderEither) => ReaderEither /** * @category combinators * @since 2.0.0 */ export declare const swap: (ma: ReaderEither) => ReaderEither /** * @category combinators * @since 2.0.0 */ export declare function local(f: (f: Q) => R): (ma: ReaderEither) => ReaderEither /** * @category combinators * @since 2.4.0 */ export declare function fromEitherK, B>( f: (...a: A) => Either ): (...a: A) => ReaderEither /** * Less strict version of [`chainEitherK`](#chainEitherK). * * @category combinators * @since 2.6.1 */ export declare const chainEitherKW: ( f: (a: A) => Either ) => (ma: ReaderEither) => ReaderEither /** * @category combinators * @since 2.4.0 */ export declare const chainEitherK: ( f: (a: A) => Either ) => (ma: ReaderEither) => ReaderEither /** * Less strict version of [`filterOrElse`](#filterOrElse). * * @since 2.9.0 */ export declare const filterOrElseW: { (refinement: Refinement, onFalse: (a: A) => E2): ( ma: ReaderEither ) => ReaderEither (predicate: Predicate, onFalse: (a: A) => E2): ( ma: ReaderEither ) => ReaderEither } /** * Derivable from `MonadThrow`. * * @category combinators * @since 2.0.0 */ export declare const filterOrElse: { (refinement: Refinement, onFalse: (a: A) => E): ( ma: ReaderEither ) => ReaderEither (predicate: Predicate, onFalse: (a: A) => E): (ma: ReaderEither) => ReaderEither } /** * `map` can be used to turn functions `(a: A) => B` into functions `(fa: F) => F` whose argument and return types * use the type constructor `F` to represent some computational context. * * @category Functor * @since 2.0.0 */ export declare const map: (f: (a: A) => B) => (fa: ReaderEither) => ReaderEither /** * Map a pair of functions over the two last type arguments of the bifunctor. * * @category Bifunctor * @since 2.0.0 */ export declare const bimap: ( f: (e: E) => G, g: (a: A) => B ) => (fa: ReaderEither) => ReaderEither /** * Map a function over the second type argument of a bifunctor. * * @category Bifunctor * @since 2.0.0 */ export declare const mapLeft: (f: (e: E) => G) => (fa: ReaderEither) => ReaderEither /** * Less strict version of [`ap`](#ap). * * @category Apply * @since 2.8.0 */ export declare const apW: ( fa: ReaderEither ) => (fab: ReaderEither B>) => ReaderEither /** * Apply a function to an argument under a type constructor. * * @category Apply * @since 2.0.0 */ export declare const ap: ( fa: ReaderEither ) => (fab: ReaderEither B>) => ReaderEither /** * Combine two effectful actions, keeping only the result of the first. * * Derivable from `Apply`. * * @category combinators * @since 2.0.0 */ export declare const apFirst: ( fb: ReaderEither ) => (fa: ReaderEither) => ReaderEither /** * Combine two effectful actions, keeping only the result of the second. * * Derivable from `Apply`. * * @category combinators * @since 2.0.0 */ export declare const apSecond: ( fb: ReaderEither ) => (fa: ReaderEither) => ReaderEither /** * Wrap a value into the type constructor. * * Equivalent to [`right`](#right). * * @category Applicative * @since 2.8.5 */ export declare const of: Applicative3['of'] /** * Less strict version of [`chain`](#chain). * * @category Monad * @since 2.6.0 */ export declare const chainW: ( f: (a: A) => ReaderEither ) => (ma: ReaderEither) => ReaderEither /** * Composes computations in sequence, using the return value of one computation to determine the next computation. * * @category Monad * @since 2.0.0 */ export declare const chain: ( f: (a: A) => ReaderEither ) => (ma: ReaderEither) => ReaderEither /** * Less strict version of [`chainFirst`](#chainFirst) * * Derivable from `Monad`. * * @category combinators * @since 2.8.0 */ export declare const chainFirstW: ( f: (a: A) => ReaderEither ) => (ma: ReaderEither) => ReaderEither /** * 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 `Monad`. * * @category combinators * @since 2.0.0 */ export declare const chainFirst: ( f: (a: A) => ReaderEither ) => (ma: ReaderEither) => ReaderEither /** * Derivable from `Monad`. * * @category combinators * @since 2.0.0 */ export declare const flatten: (mma: ReaderEither>) => ReaderEither /** * Less strict version of [`alt`](#alt). * * @category Alt * @since 2.9.0 */ export declare const altW: ( that: () => ReaderEither ) => (fa: ReaderEither) => ReaderEither /** * Identifies an associative operation on a type constructor. It is similar to `Semigroup`, except that it applies to * types of kind `* -> *`. * * @category Alt * @since 2.0.0 */ export declare const alt: ( that: () => ReaderEither ) => (fa: ReaderEither) => ReaderEither /** * @category MonadThrow * @since 2.7.0 */ export declare const throwError: MonadThrow3['throwError'] /** * @category instances * @since 2.0.0 */ export declare const URI = 'ReaderEither' /** * @category instances * @since 2.0.0 */ export declare type URI = typeof URI declare module './HKT' { interface URItoKind3 { readonly [URI]: ReaderEither } } /** * Semigroup returning the left-most non-`Left` value. If both operands are `Right`s then the inner values are * concatenated using the provided `Semigroup` * * @category instances * @since 2.0.0 */ export declare function getSemigroup(S: Semigroup): Semigroup> /** * Semigroup returning the left-most `Left` value. If both operands are `Right`s then the inner values * are concatenated using the provided `Semigroup` * * @category instances * @since 2.0.0 */ export declare function getApplySemigroup(S: Semigroup): Semigroup> /** * @category instances * @since 2.0.0 */ export declare function getApplyMonoid(M: Monoid): Monoid> /** * @category instances * @since 2.7.0 */ export declare function getApplicativeReaderValidation(SE: Semigroup): Applicative3C /** * @category instances * @since 2.7.0 */ export declare function getAltReaderValidation(SE: Semigroup): Alt3C /** * @category instances * @since 2.3.0 */ export declare function getReaderValidation( SE: Semigroup ): Monad3C & Bifunctor3 & Alt3C & MonadThrow3C /** * @category instances * @since 2.7.0 */ export declare const Functor: Functor3 /** * @category instances * @since 2.7.0 */ export declare const Applicative: Applicative3 /** * @category instances * @since 2.7.0 */ export declare const Monad: Monad3 /** * @category instances * @since 2.7.0 */ export declare const Bifunctor: Bifunctor3 /** * @category instances * @since 2.7.0 */ export declare const Alt: Alt3 /** * @category instances * @since 2.7.0 */ export declare const MonadThrow: MonadThrow3 /** * @category instances * @since 2.0.0 */ export declare const readerEither: Monad3 & Bifunctor3 & Alt3 & MonadThrow3 /** * @since 2.9.0 */ export declare const Do: ReaderEither /** * @since 2.8.0 */ export declare const bindTo: ( name: N ) => (fa: ReaderEither) => ReaderEither /** * @since 2.8.0 */ export declare const bindW: ( name: Exclude, f: (a: A) => ReaderEither ) => ( fa: ReaderEither ) => ReaderEither /** * @since 2.8.0 */ export declare const bind: ( name: Exclude, f: (a: A) => ReaderEither ) => ( fa: ReaderEither ) => ReaderEither< R, E, { [K in keyof A | N]: K extends keyof A ? A[K] : B } > /** * @since 2.8.0 */ export declare const apSW: ( name: Exclude, fb: ReaderEither ) => ( fa: ReaderEither ) => ReaderEither /** * @since 2.8.0 */ export declare const apS: ( name: Exclude, fb: ReaderEither ) => ( fa: ReaderEither ) => ReaderEither< R, E, { [K in keyof A | N]: K extends keyof A ? A[K] : B } > /** * @since 2.9.0 */ export declare const traverseArrayWithIndex: ( f: (index: number, a: A) => ReaderEither ) => (arr: ReadonlyArray) => ReaderEither> /** * @since 2.9.0 */ export declare const traverseArray: ( f: (a: A) => ReaderEither ) => (arr: ReadonlyArray) => ReaderEither> /** * @since 2.9.0 */ export declare const sequenceArray: ( arr: ReadonlyArray> ) => ReaderEither>