"use strict";Object.defineProperty(exports, "__esModule", {value: true});


var _chunkSQA7G4TEjs = require('./chunk-SQA7G4TE.js');


var _chunk6C3VEZWHjs = require('./chunk-6C3VEZWH.js');

// src/ReaderT.ts
var ReaderT_exports = {};
_chunk6C3VEZWHjs.__export.call(void 0, ReaderT_exports, {
  ap: () => ap,
  chain: () => chain,
  flatMap: () => flatMap,
  fromNaturalTransformation: () => fromNaturalTransformation,
  fromReader: () => fromReader,
  getReaderM: () => getReaderM,
  map: () => map,
  of: () => of
});
function of(F) {
  return (a) => () => F.of(a);
}
function map(F) {
  return (f) => (fa) => (r) => F.map(fa(r), f);
}
function ap(F) {
  return (fa) => (fab) => (r) => F.ap(fab(r), fa(r));
}
function chain(M) {
  const flatMapM = flatMap(M);
  return (f) => (ma) => flatMapM(ma, f);
}
function flatMap(M) {
  return (ma, f) => (r) => M.chain(ma(r), (a) => f(a)(r));
}
function fromReader(F) {
  return (ma) => _chunkSQA7G4TEjs.flow.call(void 0, ma, F.of);
}
function fromNaturalTransformation(nt) {
  return (f) => _chunkSQA7G4TEjs.flow.call(void 0, f, nt);
}
function getReaderM(M) {
  const _ap = ap(M);
  const _map = map(M);
  const _chain = chain(M);
  return {
    map: (fa, f) => _chunkSQA7G4TEjs.pipe.call(void 0, fa, _map(f)),
    ap: (fab, fa) => _chunkSQA7G4TEjs.pipe.call(void 0, fab, _ap(fa)),
    of: of(M),
    chain: (ma, f) => _chunkSQA7G4TEjs.pipe.call(void 0, ma, _chain(f)),
    ask: () => M.of,
    asks: (f) => _chunkSQA7G4TEjs.flow.call(void 0, f, M.of),
    local: (ma, f) => (q) => ma(f(q)),
    fromReader: fromReader(M),
    fromM: (ma) => () => ma
  };
}











exports.of = of; exports.map = map; exports.ap = ap; exports.chain = chain; exports.flatMap = flatMap; exports.fromReader = fromReader; exports.fromNaturalTransformation = fromNaturalTransformation; exports.getReaderM = getReaderM; exports.ReaderT_exports = ReaderT_exports;
