/** * Utility functions to accommodate `fp-ts/ReaderTaskEither`. * * @since 0.15.0 */ import type { Either } from "fp-ts/Either"; import type * as RTE from "fp-ts/ReaderTaskEither"; import type { Task } from "fp-ts/Task"; import type { TaskEither } from "fp-ts/TaskEither"; /** * Runs a ReaderTaskEither and extracts the final TaskEither from it. * * @example * import { runReaderTaskEither } from 'fp-ts-std/ReaderTaskEither' * import { pipe } from "fp-ts/function" * import * as RTE from "fp-ts/ReaderTaskEither" * import * as E from "fp-ts/Either" * * type Env = { dependency: string } * const env: Env = { dependency: "dependency" } * pipe( * E.right(1), * RTE.fromEither, * runReaderTaskEither(env) * )().then(extractedValue => assert.deepStrictEqual(extractedValue, E.right(1))) * * @category 3 Functions * @since 0.15.0 */ export declare const runReaderTaskEither: (r: R) => (reader: RTE.ReaderTaskEither) => TaskEither; /** * Unwrap the promise from within a `ReaderTaskEither`, rejecting with the inner * value of `Left` if `Left`. * * @example * import { unsafeUnwrap } from 'fp-ts-std/ReaderTaskEither' * import * as RTE from 'fp-ts/ReaderTaskEither' * * unsafeUnwrap(RTE.right(5))({}).then((x) => { * assert.strictEqual(x, 5) * }) * * @category 3 Functions * @since 0.15.0 */ export declare const unsafeUnwrap: (rte: RTE.ReaderTaskEither) => (r: R) => Promise; /** * Unwrap the promise from within a `ReaderTaskEither`, throwing the inner * value of `Right` if `Right`. * * @example * import { unsafeUnwrapLeft } from 'fp-ts-std/ReaderTaskEither' * import * as RTE from 'fp-ts/ReaderTaskEither' * * unsafeUnwrapLeft(RTE.left(5))({}).then((x) => { * assert.strictEqual(x, 5) * }) * * @category 3 Functions * @since 0.15.0 */ export declare const unsafeUnwrapLeft: (rte: RTE.ReaderTaskEither) => (r: R) => Promise; /** * Effectfully accesses the environment outside of the `Reader` and `Task` * layers. * * @example * import { asksEither } from 'fp-ts-std/ReaderTaskEither' * import * as E from 'fp-ts/Either' * * const lucky = asksEither(n => E.right(n === Date.now())) * * assert.deepEqual( * lucky(42)(), * Promise.resolve(E.right(false)), * ) * * @category 3 Functions * @since 0.16.0 */ export declare const asksEither: (f: (r: R) => Either) => RTE.ReaderTaskEither; /** * Effectfully accesses the environment outside of the `Reader` and `Either` * layers. * * @example * import { asksTask } from 'fp-ts-std/ReaderTaskEither' * import * as E from 'fp-ts/Either' * * const lucky = asksTask(n => () => Promise.resolve(n === Date.now())) * * assert.deepEqual( * lucky(42)(), * Promise.resolve(E.right(false)), * ) * * @category 3 Functions * @since 0.16.0 */ export declare const asksTask: (f: (r: R) => Task) => RTE.ReaderTaskEither; /** * Effectfully accesses the environment outside of the `Reader` layer. * * @example * import { asksTaskEither } from 'fp-ts-std/ReaderTaskEither' * import * as E from 'fp-ts/Either' * * const lucky = asksTaskEither(n => () => Promise.resolve(E.right(n === Date.now()))) * * assert.deepEqual( * lucky(42)(), * Promise.resolve(E.right(false)), * ) * * @category 3 Functions * @since 0.16.0 */ export declare const asksTaskEither: (f: (r: R) => TaskEither) => RTE.ReaderTaskEither; //# sourceMappingURL=ReaderTaskEither.d.ts.map