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

var _chunkS2Z5L3RBjs = require('./chunk-S2Z5L3RB.js');


var _chunkS3T27X3Ujs = require('./chunk-S3T27X3U.js');






var _chunk7K74W2G3js = require('./chunk-7K74W2G3.js');





var _chunkQ2LZCTWPjs = require('./chunk-Q2LZCTWP.js');



var _chunkEBISTSVAjs = require('./chunk-EBISTSVA.js');





var _chunkOTKMOSH2js = require('./chunk-OTKMOSH2.js');




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


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

// src/IO.ts
var IO_exports = {};
_chunk6C3VEZWHjs.__export.call(void 0, IO_exports, {
  ApT: () => ApT,
  Applicative: () => Applicative,
  Apply: () => Apply,
  Chain: () => Chain,
  ChainRec: () => ChainRec,
  Do: () => Do,
  FromIO: () => FromIO,
  Functor: () => Functor,
  Monad: () => Monad,
  MonadIO: () => MonadIO,
  Pointed: () => Pointed,
  URI: () => URI,
  ap: () => ap,
  apFirst: () => apFirst2,
  apS: () => apS2,
  apSecond: () => apSecond2,
  as: () => as2,
  asUnit: () => asUnit2,
  bind: () => bind2,
  bindTo: () => bindTo2,
  chain: () => chain,
  chainFirst: () => chainFirst,
  chainRec: () => chainRec,
  do: () => do_2,
  flap: () => flap2,
  flatMap: () => flatMap,
  flatten: () => flatten,
  fromIO: () => fromIO,
  getMonoid: () => getMonoid,
  getSemigroup: () => getSemigroup,
  io: () => io,
  let: () => let_2,
  map: () => map,
  of: () => of,
  sequenceArray: () => sequenceArray,
  tap: () => tap2,
  traverseArray: () => traverseArray,
  traverseArrayWithIndex: () => traverseArrayWithIndex,
  traverseReadonlyArrayWithIndex: () => traverseReadonlyArrayWithIndex,
  traverseReadonlyNonEmptyArrayWithIndex: () => traverseReadonlyNonEmptyArrayWithIndex
});
var _map = (ma, f) => () => f(ma());
var _ap = (mab, ma) => () => mab()(ma());
var map = (f) => (fa) => _map(fa, f);
var ap = (fa) => (fab) => _ap(fab, fa);
var of = _chunkSQA7G4TEjs.constant;
var flatMap = /* @__PURE__ */ _chunkSQA7G4TEjs.dual.call(void 0, 
  2,
  (ma, f) => () => f(ma())()
);
var flatten = /* @__PURE__ */ flatMap(_chunkSQA7G4TEjs.identity);
var URI = "IO";
var Functor = {
  URI,
  map: _map
};
var as2 = _chunkSQA7G4TEjs.dual.call(void 0, 2, _chunk7K74W2G3js.as.call(void 0, Functor));
var asUnit2 = _chunk7K74W2G3js.asUnit.call(void 0, Functor);
var flap2 = /* @__PURE__ */ _chunk7K74W2G3js.flap.call(void 0, Functor);
var Pointed = {
  URI,
  of
};
var Apply = {
  URI,
  map: _map,
  ap: _ap
};
var apFirst2 = /* @__PURE__ */ _chunkQ2LZCTWPjs.apFirst.call(void 0, Apply);
var apSecond2 = /* @__PURE__ */ _chunkQ2LZCTWPjs.apSecond.call(void 0, Apply);
var Applicative = {
  URI,
  map: _map,
  ap: _ap,
  of
};
var Chain = {
  URI,
  map: _map,
  ap: _ap,
  chain: flatMap
};
var Monad = {
  URI,
  map: _map,
  ap: _ap,
  of,
  chain: flatMap
};
var tap2 = /* @__PURE__ */ _chunkSQA7G4TEjs.dual.call(void 0, 2, _chunkEBISTSVAjs.tap.call(void 0, Chain));
var fromIO = _chunkSQA7G4TEjs.identity;
var MonadIO = {
  URI,
  map: _map,
  ap: _ap,
  of,
  chain: flatMap,
  fromIO
};
var chainRec = (a, f) => () => {
  let e = f(a)();
  while (e._tag === "Left") {
    e = f(e.left)();
  }
  return e.right;
};
var ChainRec = {
  URI,
  map: _map,
  ap: _ap,
  chain: flatMap,
  chainRec
};
var FromIO = {
  URI,
  fromIO: _chunkSQA7G4TEjs.identity
};
var Do = /* @__PURE__ */ of(_chunkOTKMOSH2js.emptyRecord);
var bindTo2 = /* @__PURE__ */ _chunk7K74W2G3js.bindTo.call(void 0, Functor);
var let_2 = /* @__PURE__ */ _chunk7K74W2G3js.let_.call(void 0, Functor);
var bind2 = /* @__PURE__ */ _chunkEBISTSVAjs.bind.call(void 0, Chain);
var apS2 = /* @__PURE__ */ _chunkQ2LZCTWPjs.apS.call(void 0, Apply);
var ApT = /* @__PURE__ */ of(_chunkOTKMOSH2js.emptyReadonlyArray);
var do_2 = _chunkS2Z5L3RBjs.do_3.call(void 0, Pointed, ChainRec);
var traverseReadonlyNonEmptyArrayWithIndex = (f) => (as3) => () => {
  const out = [f(0, _chunkOTKMOSH2js.head.call(void 0, as3))()];
  for (let i = 1; i < as3.length; i++) {
    out.push(f(i, as3[i])());
  }
  return out;
};
var traverseReadonlyArrayWithIndex = (f) => {
  const g = traverseReadonlyNonEmptyArrayWithIndex(f);
  return (as3) => _chunkOTKMOSH2js.isNonEmpty.call(void 0, as3) ? g(as3) : ApT;
};
var traverseArrayWithIndex = traverseReadonlyArrayWithIndex;
var traverseArray = (f) => traverseReadonlyArrayWithIndex((_, a) => f(a));
var sequenceArray = /* @__PURE__ */ traverseArray(_chunkSQA7G4TEjs.identity);
var chain = flatMap;
var chainFirst = tap2;
var io = {
  URI,
  map: _map,
  of,
  ap: _ap,
  chain: flatMap,
  fromIO,
  chainRec
};
var getSemigroup = /* @__PURE__ */ _chunkQ2LZCTWPjs.getApplySemigroup.call(void 0, Apply);
var getMonoid = /* @__PURE__ */ _chunkS3T27X3Ujs.getApplicativeMonoid.call(void 0, Applicative);











































exports.map = map; exports.ap = ap; exports.of = of; exports.flatMap = flatMap; exports.flatten = flatten; exports.URI = URI; exports.Functor = Functor; exports.as = as2; exports.asUnit = asUnit2; exports.flap = flap2; exports.Pointed = Pointed; exports.Apply = Apply; exports.apFirst = apFirst2; exports.apSecond = apSecond2; exports.Applicative = Applicative; exports.Chain = Chain; exports.Monad = Monad; exports.tap = tap2; exports.fromIO = fromIO; exports.MonadIO = MonadIO; exports.chainRec = chainRec; exports.ChainRec = ChainRec; exports.FromIO = FromIO; exports.Do = Do; exports.bindTo = bindTo2; exports.let_ = let_2; exports.bind = bind2; exports.apS = apS2; exports.ApT = ApT; exports.do_ = do_2; exports.traverseReadonlyNonEmptyArrayWithIndex = traverseReadonlyNonEmptyArrayWithIndex; exports.traverseReadonlyArrayWithIndex = traverseReadonlyArrayWithIndex; exports.traverseArrayWithIndex = traverseArrayWithIndex; exports.traverseArray = traverseArray; exports.sequenceArray = sequenceArray; exports.chain = chain; exports.chainFirst = chainFirst; exports.io = io; exports.getSemigroup = getSemigroup; exports.getMonoid = getMonoid; exports.IO_exports = IO_exports;
