import {
  getApplicativeValidation
} from "./chunk-3AL4EMTU.mjs";
import {
  getApplicativeComposition
} from "./chunk-LN4UQKIO.mjs";
import {
  isLeft,
  isRight,
  left
} from "./chunk-WPJQNT3M.mjs";
import {
  __export
} from "./chunk-QK4PKNB3.mjs";

// src/ValidationT.ts
var ValidationT_exports = {};
__export(ValidationT_exports, {
  getValidationM: () => getValidationM
});
function getValidationM(S, M) {
  const A = getApplicativeComposition(M, getApplicativeValidation(S));
  return {
    map: A.map,
    ap: A.ap,
    of: A.of,
    chain: (ma, f) => M.chain(ma, (e) => isLeft(e) ? M.of(left(e.left)) : f(e.right)),
    alt: (me, that) => M.chain(
      me,
      (e1) => isRight(e1) ? M.of(e1) : M.map(that(), (e2) => isLeft(e2) ? left(S.concat(e1.left, e2.left)) : e2)
    )
  };
}

export {
  getValidationM,
  ValidationT_exports
};
