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








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


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


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




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


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

// src/OptionT.ts
var OptionT_exports = {};
_chunk6C3VEZWHjs.__export.call(void 0, OptionT_exports, {
  alt: () => alt,
  ap: () => ap2,
  chain: () => chain,
  chainNullableK: () => chainNullableK,
  chainOptionK: () => chainOptionK,
  flatMap: () => flatMap,
  fromEither: () => fromEither2,
  fromF: () => fromF,
  fromNullable: () => fromNullable2,
  fromNullableK: () => fromNullableK,
  fromOptionK: () => fromOptionK,
  fromPredicate: () => fromPredicate2,
  getOptionM: () => getOptionM,
  getOrElse: () => getOrElse,
  map: () => map2,
  match: () => match2,
  matchE: () => matchE,
  some: () => some2,
  zero: () => zero
});
function some2(F) {
  return _chunkSQA7G4TEjs.flow.call(void 0, _chunkS2Z5L3RBjs.some, F.of);
}
function zero(F) {
  return _chunkSQA7G4TEjs.constant.call(void 0, F.of(_chunkS2Z5L3RBjs.none));
}
function fromF(F) {
  return (ma) => F.map(ma, _chunkS2Z5L3RBjs.some);
}
function fromNullable2(F) {
  return _chunkSQA7G4TEjs.flow.call(void 0, _chunkS2Z5L3RBjs.fromNullable2, F.of);
}
function fromNullableK(F) {
  const fromNullableF = fromNullable2(F);
  return (f) => _chunkSQA7G4TEjs.flow.call(void 0, f, fromNullableF);
}
function chainNullableK(M) {
  const chainM = chain(M);
  const fromNullableKM = fromNullableK(M);
  return (f) => chainM(fromNullableKM(f));
}
function fromOptionK(F) {
  return (f) => _chunkSQA7G4TEjs.flow.call(void 0, f, F.of);
}
function chainOptionK(M) {
  const chainM = chain(M);
  const fromOptionKM = fromOptionK(M);
  return (f) => chainM(fromOptionKM(f));
}
function fromPredicate2(F) {
  return (predicate) => (a) => F.of(_chunkS2Z5L3RBjs.fromPredicate2.call(void 0, predicate)(a));
}
function fromEither2(F) {
  return _chunkSQA7G4TEjs.flow.call(void 0, _chunkS2Z5L3RBjs.fromEither, F.of);
}
function match2(F) {
  return (onNone, onSome) => (ma) => F.map(ma, _chunkS2Z5L3RBjs.match2.call(void 0, onNone, onSome));
}
function matchE(M) {
  return (onNone, onSome) => (ma) => M.chain(ma, _chunkS2Z5L3RBjs.match2.call(void 0, onNone, onSome));
}
function getOrElse(M) {
  return (onNone) => (fa) => M.chain(fa, _chunkS2Z5L3RBjs.match2.call(void 0, onNone, M.of));
}
function map2(F) {
  return _chunk7K74W2G3js.map.call(void 0, F, _chunkS2Z5L3RBjs.Functor2);
}
function ap2(F) {
  return _chunkQ2LZCTWPjs.ap.call(void 0, F, _chunkS2Z5L3RBjs.Apply2);
}
function chain(M) {
  const flatMapM = flatMap(M);
  return (f) => (ma) => flatMapM(ma, f);
}
function flatMap(M) {
  const zeroM = zero(M);
  return (ma, f) => M.chain(
    ma,
    _chunkS2Z5L3RBjs.match2.call(void 0, () => zeroM(), f)
  );
}
function alt(M) {
  const _some = some2(M);
  return (second) => (first) => M.chain(first, _chunkS2Z5L3RBjs.match2.call(void 0, second, _some));
}
function getOptionM(M) {
  const apM = ap2(M);
  const mapM = map2(M);
  const chainM = chain(M);
  const altM = alt(M);
  const foldM = matchE(M);
  const getOrElseM = getOrElse(M);
  const zeroM = zero(M);
  return {
    map: (fa, f) => _chunkSQA7G4TEjs.pipe.call(void 0, fa, mapM(f)),
    ap: (fab, fa) => _chunkSQA7G4TEjs.pipe.call(void 0, fab, apM(fa)),
    of: some2(M),
    chain: (ma, f) => _chunkSQA7G4TEjs.pipe.call(void 0, ma, chainM(f)),
    alt: (fa, that) => _chunkSQA7G4TEjs.pipe.call(void 0, fa, altM(that)),
    fold: (fa, onNone, onSome) => _chunkSQA7G4TEjs.pipe.call(void 0, fa, foldM(onNone, onSome)),
    getOrElse: (fa, onNone) => _chunkSQA7G4TEjs.pipe.call(void 0, fa, getOrElseM(onNone)),
    fromM: fromF(M),
    none: () => zeroM()
  };
}






















exports.some = some2; exports.zero = zero; exports.fromF = fromF; exports.fromNullable = fromNullable2; exports.fromNullableK = fromNullableK; exports.chainNullableK = chainNullableK; exports.fromOptionK = fromOptionK; exports.chainOptionK = chainOptionK; exports.fromPredicate = fromPredicate2; exports.fromEither = fromEither2; exports.match = match2; exports.matchE = matchE; exports.getOrElse = getOrElse; exports.map = map2; exports.ap = ap2; exports.chain = chain; exports.flatMap = flatMap; exports.alt = alt; exports.getOptionM = getOptionM; exports.OptionT_exports = OptionT_exports;
