UNPKG

fp-ts-std

Version:

The missing pseudo-standard library for fp-ts.

45 lines 1.06 kB
/** * Utility functions to accommodate `fp-ts/ReaderIO`. * * @since 0.16.0 */ import type { IO } from "fp-ts/IO"; import type { ReaderIO } from "fp-ts/ReaderIO"; /** * Runs a `ReaderIO` and extracts the final `IO` from it. * * @example * import { runReaderIO } from 'fp-ts-std/ReaderIO' * import { pipe } from "fp-ts/function" * import * as RIO from "fp-ts/ReaderIO" * * assert.strictEqual( * pipe( * RIO.of<string, number>(123), * runReaderIO("env"), * )(), * 123, * ) * * @category 3 Functions * @since 0.16.0 */ export declare const runReaderIO: <R, A>(r: R) => (m: ReaderIO<R, A>) => IO<A>; /** * Effectfully accesses the environment outside of the `Reader` layer. * * @example * import { asksIO } from 'fp-ts-std/ReaderIO' * * const lucky = asksIO<number, boolean>(n => () => n === Date.now()) * * assert.strictEqual( * lucky(42)(), * false, * ) * * @category 3 Functions * @since 0.16.0 */ export declare const asksIO: <R, A>(f: (r: R) => IO<A>) => ReaderIO<R, A>; //# sourceMappingURL=ReaderIO.d.ts.map