UNPKG

@typed/fp

Version:

Data Structures and Resources for fp-ts

43 lines 1.61 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.useAllWithEnv = exports.useSomeWithEnv = exports.provideAllWithEnv = exports.provideSomeWithEnv = exports.chainFirstEnvK = exports.chainEnvK = exports.fromEnvK = void 0; const tslib_1 = require("tslib"); /** * FromEnv is a Typeclass which represents the Natural Transformation from an Env into another * effect. * * @since 0.9.2 */ const Chain_1 = require("fp-ts/Chain"); const function_1 = require("fp-ts/function"); const Provide = (0, tslib_1.__importStar)(require("./Provide")); function fromEnvK(F) { return (f) => (...args) => F.fromEnv(f(...args)); } exports.fromEnvK = fromEnvK; function chainEnvK(F, C) { return (f) => C.chain((0, function_1.flow)(f, F.fromEnv)); } exports.chainEnvK = chainEnvK; function chainFirstEnvK(F, C) { const chainF = (0, Chain_1.chainFirst)(C); return (f) => chainF((0, function_1.flow)(f, F.fromEnv)); } exports.chainFirstEnvK = chainFirstEnvK; function provideSomeWithEnv(F) { return (0, function_1.flow)(F.fromEnv, Provide.provideSomeWith(F)); } exports.provideSomeWithEnv = provideSomeWithEnv; function provideAllWithEnv(F) { return (0, function_1.flow)(F.fromEnv, Provide.provideAllWith(F)); } exports.provideAllWithEnv = provideAllWithEnv; function useSomeWithEnv(F) { return (0, function_1.flow)(F.fromEnv, Provide.useSomeWith(F)); } exports.useSomeWithEnv = useSomeWithEnv; function useAllWithEnv(F) { return (0, function_1.flow)(F.fromEnv, Provide.useAllWith(F)); } exports.useAllWithEnv = useAllWithEnv; //# sourceMappingURL=FromEnv.js.map