import { Alt3, Alt3C } from 'fp-ts/lib/Alt'; import { Applicative3, Applicative3C } from 'fp-ts/lib/Applicative'; import { Apply1 } from 'fp-ts/lib/Apply'; import { Bifunctor3 } from 'fp-ts/lib/Bifunctor'; import * as E from 'fp-ts/lib/Either'; import { Lazy, Predicate, Refinement } from 'fp-ts/lib/function'; import { Functor3 } from 'fp-ts/lib/Functor'; import * as I from 'fp-ts/lib/IO'; import * as IE from 'fp-ts/lib/IOEither'; import { Monad3, Monad3C } from 'fp-ts/lib/Monad'; import { MonadIO3, MonadIO3C } from 'fp-ts/lib/MonadIO'; import { MonadThrow3, MonadThrow3C } from 'fp-ts/lib/MonadThrow'; import { Monoid } from 'fp-ts/lib/Monoid'; import { Option } from 'fp-ts/lib/Option'; import * as R from 'fp-ts/lib/Reader'; import * as RE from 'fp-ts/lib/ReaderEither'; import * as S from 'fp-ts/lib/Semigroup'; import * as RI from 'fp-ts-contrib/lib/ReaderIO'; import { EmptyEnv, Subtract } from '@monorail/sharedHelpers/fp-ts-ext/effectsUtils'; export interface ReaderIOEither { (r: R): IE.IOEither; } export declare const bind_: (a: A, name: Exclude, b: B) => { [K in N | keyof A]: K extends keyof A ? A[K] : B; }; /** * @internal */ export declare const bindTo_: (name: N) => (b: B) => { [K in N]: B; }; /** * @category constructors */ export declare const fromIOEither: (ma: IE.IOEither) => ReaderIOEither; /** * @category constructors */ export declare const left: (e: E) => ReaderIOEither; /** * @category constructors */ export declare const right: (a: A) => ReaderIOEither; /** * @category constructors */ export declare const rightIO: (ma: I.IO) => ReaderIOEither; /** * @category constructors */ export declare const leftIO: (me: I.IO) => ReaderIOEither; /** * @category constructors */ export declare const rightReader: (ma: R.Reader) => ReaderIOEither; /** * @category constructors */ export declare const leftReader: (me: R.Reader) => ReaderIOEither; /** * @category constructors */ export declare const rightReaderIO: (ma: RI.ReaderIO) => ReaderIOEither; /** * @category constructors */ export declare const leftReaderIO: (me: RI.ReaderIO) => ReaderIOEither; /** * @category constructors */ export declare const fromReaderEither: (ma: RE.ReaderEither) => ReaderIOEither; /** * @category constructors */ export declare const ask: () => ReaderIOEither; /** * @category constructors */ export declare const asks: (f: (r: R) => A) => ReaderIOEither; /** * Derivable from `MonadThrow`. * * @category constructors */ export declare const fromEither: (ma: E.Either) => ReaderIOEither; /** * Derivable from `MonadThrow`. * * @category constructors */ export declare const fromOption: (onNone: Lazy) => (ma: Option) => ReaderIOEither; /** * Derivable from `MonadThrow`. * * @category constructors */ export declare const fromPredicate: { (refinement: Refinement, onFalse: (a: A) => E): (a: A) => ReaderIOEither; (predicate: Predicate, onFalse: (a: A) => E): (a: A) => ReaderIOEither; }; /** * @category destructors */ export declare function fold(onLeft: (e: E) => RI.ReaderIO, onRight: (a: A) => RI.ReaderIO): (ma: ReaderIOEither) => RI.ReaderIO; /** * Less strict version of [`getOrElse`](#getOrElse). * * @category destructors */ export declare const getOrElseW: (onLeft: (e: E) => any) => (ma: ReaderIOEither) => any; /** * @category destructors */ export declare const getOrElse: (onLeft: (e: E) => RI.ReaderIO) => (ma: ReaderIOEither) => RI.ReaderIO; /** * @category combinators */ export declare function orElse(onLeft: (e: E) => ReaderIOEither): (ma: ReaderIOEither) => ReaderIOEither; /** * @category combinators */ export declare const swap: (ma: ReaderIOEither) => ReaderIOEither; /** * @category combinators * * NOTE: The equivalent of this for ReaderTaskEither is being removed in fp-ts version 3.0. */ export declare const local: (f: (f: Q) => R) => (ma: ReaderIOEither) => ReaderIOEither; /** * Less strict version of [`filterOrElse`](#filterOrElse). * * @category combinators */ export declare const filterOrElseW: { (refinement: Refinement, onFalse: (a: A) => E2): (ma: ReaderIOEither) => ReaderIOEither; (predicate: Predicate, onFalse: (a: A) => E2): (ma: ReaderIOEither) => ReaderIOEither; }; /** * Derivable from `MonadThrow`. * * @category combinators */ export declare const filterOrElse: { (refinement: Refinement, onFalse: (a: A) => E): (ma: ReaderIOEither) => ReaderIOEither; (predicate: Predicate, onFalse: (a: A) => E): (ma: ReaderIOEither) => ReaderIOEither; }; /** * @category combinators */ export declare function fromEitherK, B>(f: (...a: A) => E.Either): (...a: A) => ReaderIOEither; /** * Less strict version of [`chainEitherK`](#chainEitherK). * * @category combinators */ export declare const chainEitherKW: (f: (a: A) => E.Either) => (ma: ReaderIOEither) => ReaderIOEither; /** * @category combinators */ export declare const chainEitherK: (f: (a: A) => E.Either) => (ma: ReaderIOEither) => ReaderIOEither; /** * @category combinators */ export declare function fromIOEitherK, B>(f: (...a: A) => IE.IOEither): (...a: A) => ReaderIOEither; /** * Less strict version of [`chainIOEitherK`](#chainIOEitherK). * * @category combinators */ export declare const chainIOEitherKW: (f: (a: A) => IE.IOEither) => (ma: ReaderIOEither) => ReaderIOEither; /** * @category combinators */ export declare const chainIOEitherK: (f: (a: A) => IE.IOEither) => (ma: ReaderIOEither) => ReaderIOEither; export declare const map: (f: (a: A) => B) => (fa: ReaderIOEither) => ReaderIOEither; /** * Map a pair of functions over the two last type arguments of the bifunctor. * * @category Bifunctor */ export declare const bimap: (f: (e: E) => G, g: (a: A) => B) => (fa: ReaderIOEither) => ReaderIOEither; /** * Map a function over the second type argument of a bifunctor. * * @category Bifunctor */ export declare const mapLeft: (f: (e: E) => G) => (fa: ReaderIOEither) => ReaderIOEither; /** * Less strict version of [`ap`](#ap). * * @category Apply */ export declare const apW: (fa: ReaderIOEither) => (fab: ReaderIOEither B>) => ReaderIOEither; /** * Apply a function to an argument under a type constructor. * * @category Apply */ export declare const ap: (fa: ReaderIOEither) => (fab: ReaderIOEither B>) => ReaderIOEither; /** * Combine two effectful actions, keeping only the result of the first. * * Derivable from `Apply`. * * @category combinators */ export declare const apFirst: (fb: ReaderIOEither) => (fa: ReaderIOEither) => ReaderIOEither; /** * Combine two effectful actions, keeping only the result of the second. * * Derivable from `Apply`. * * @category combinators */ export declare const apSecond: (fb: ReaderIOEither) => (fa: ReaderIOEither) => ReaderIOEither; /** * Wrap a value into the type constructor. * * Equivalent to [`right`](#right). * * @category Applicative */ export declare const of: Applicative3['of']; /** * Less strict version of [`chain`](#chain). * * @category Monad */ export declare const chainW: (f: (a: A) => ReaderIOEither) => (ma: ReaderIOEither) => ReaderIOEither; /** * Composes computations in sequence, using the return value of one computation to determine the next computation. * * @category Monad */ export declare const chain: (f: (a: A) => ReaderIOEither) => (ma: ReaderIOEither) => ReaderIOEither; /** * Less strict version of [`chainFirst`](#chainFirst). * * Derivable from `Monad`. * * @category combinators */ export declare const chainFirstW: (f: (a: A) => ReaderIOEither) => (ma: ReaderIOEither) => ReaderIOEither; /** * 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 */ export declare const chainFirst: (f: (a: A) => ReaderIOEither) => (ma: ReaderIOEither) => ReaderIOEither; /** * Derivable from `Monad`. * * @category combinators */ export declare const flatten: (mma: ReaderIOEither>) => ReaderIOEither; /** * Less strict version of [`alt`](#alt). * * @category Alt */ export declare const altW: (that: () => ReaderIOEither) => (fa: ReaderIOEither) => ReaderIOEither; /** * Identifies an associative operation on a type constructor. It is similar to `Semigroup`, except that it applies to * types of kind `* -> *`. * * @category Alt */ export declare const alt: (that: () => ReaderIOEither) => (fa: ReaderIOEither) => ReaderIOEither; /** * @category MonadIO */ export declare const fromIO: MonadIO3['fromIO']; /** * @category MonadThrow */ export declare const throwError: MonadThrow3['throwError']; export declare const URI = "ReaderIOEither"; export declare type URI = typeof URI; declare module 'fp-ts/lib/HKT' { interface URItoKind3 { readonly [URI]: ReaderIOEither; } } /** * 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 */ export declare function getSemigroup(S: S.Semigroup): S.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 */ export declare function getApplySemigroup(S: S.Semigroup): S.Semigroup>; /** * @category instances */ export declare function getApplyMonoid(M: Monoid): Monoid>; /** * @category instances */ export declare function getApplicativeReaderIOValidation(A: Apply1, SE: S.Semigroup): Applicative3C; /** * @category instances */ export declare function getAltReaderIOValidation(SE: S.Semigroup): Alt3C; /** * @category instances * * NOTE: This is just for convenience. This style of exporting the full set of type class instances is being removed in fp-ts version 3. */ export declare function getReaderIOValidation(SE: S.Semigroup): Monad3C & Bifunctor3 & Alt3C & MonadIO3C & MonadThrow3C; /** * @category instances */ export declare const Functor: Functor3; /** * @category instances * @since 2.8.4 */ export declare const ApplicativePar: Applicative3; /** * @category instances * @since 2.8.4 */ export declare const ApplicativeSeq: Applicative3; /** * @category instances */ export declare const Bifunctor: Bifunctor3; /** * @category instances */ export declare const Alt: Alt3; /** * @category instances * * NOTE: This is just for convenience. This style of exporting the full set of * type class instances is being removed in fp-ts version 3. */ export declare const readerIOEither: Monad3 & Bifunctor3 & Alt3 & MonadIO3 & MonadThrow3; /** * @category instances * * NOTE: This is just for convenience. This style of exporting the full set of * type class instances is being removed in fp-ts version 3. */ export declare const readerIOEitherSeq: typeof readerIOEither; /** * NOTE: The equivalent of this for ReaderTaskEither is being removed in fp-ts version 3.0. */ export declare function run(ma: ReaderIOEither, r: R): E.Either; /** * 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` * * Derivable from `MonadThrow`. */ export declare function bracket(aquire: ReaderIOEither, use: (a: A) => ReaderIOEither, release: (a: A, e: E.Either) => ReaderIOEither): ReaderIOEither; export declare const Do: ReaderIOEither; export declare const bindTo: (name: N) => (fa: ReaderIOEither) => ReaderIOEither; export declare const bindW: (name: Exclude, f: (a: A) => ReaderIOEither) => (fa: ReaderIOEither) => ReaderIOEither; export declare const bind: (name: Exclude, f: (a: A) => ReaderIOEither) => (fa: ReaderIOEither) => ReaderIOEither; export declare const apSW: (name: Exclude, fb: ReaderIOEither) => (fa: ReaderIOEither) => ReaderIOEither; export declare const apS: (name: Exclude, fb: ReaderIOEither) => (fa: ReaderIOEither) => ReaderIOEither; export declare const traverseArrayWithIndex: (f: (index: number, a: A) => ReaderIOEither) => (arr: ReadonlyArray) => ReaderIOEither>; export declare const traverseArray: (f: (a: A) => ReaderIOEither) => (arr: ReadonlyArray) => ReaderIOEither>; export declare const sequenceArray: (arr: ReadonlyArray>) => ReaderIOEither>; export declare const traverseSeqArrayWithIndex: (f: (index: number, a: A) => ReaderIOEither) => (arr: ReadonlyArray) => ReaderIOEither>; export declare const traverseSeqArray: (f: (a: A) => ReaderIOEither) => (arr: ReadonlyArray) => ReaderIOEither>; export declare const sequenceSeqArray: (arr: ReadonlyArray>) => ReaderIOEither>; export declare const orElseW: (f: (e: E) => ReaderIOEither) => (rie: ReaderIOEither) => ReaderIOEither; export declare const chainWFirst: (f: (a: A) => ReaderIOEither) => (ma: ReaderIOEither) => ReaderIOEither; export declare const withEnv: () => (r: ReaderIOEither) => ReaderIOEither; export declare const toLeft: (riea: ReaderIOEither) => ReaderIOEither; export declare const onLeft: (f: (e: E) => ReaderIOEither) => (rie: ReaderIOEither) => ReaderIOEither; export declare const runP: (r: R) => (rie: ReaderIOEither) => E.Either; /** * A ReaderIOEither that performs a noOp computation * * It uses an empty environment and cannot fail. */ export declare const noOpRIE: ReaderIOEither; /** * Provides the required environment to a ReaderIOEither, * converting it into a TaskEither. * * Similar to `runP` but delays execution. */ export declare const provide: (r: R) => (rie: ReaderIOEither) => IE.IOEither; /** * Provides a subset of a ReaderIOEither's required environment, * returning a new ReaderIOEither with a narrowed environment requirement. * * Similar to `provide` but does not completely fulfill the RIE's requirements. * Think of this as partial application for RIE dependencies. */ export declare const providePartial: (q: Q) => (rie: ReaderIOEither) => ReaderIOEither>, E, A>;