import * as A from "fp-ts-esm/Array";
import * as E from "fp-ts-esm/Either";
import { identity, pipe } from "fp-ts-esm/function";
import * as S from "fp-ts-esm/Semigroup";
const firstRight = (candidate, defaultT, resolvers) => {
  const firstRightSemi = E.getSemigroup(S.first());
  const concatFirstRightSemi = S.concatAll(firstRightSemi)(E.left(defaultT));
  return pipe(
    concatFirstRightSemi(
      pipe(
        resolvers,
        A.map(
          (r) => pipe(
            candidate,
            E.fromPredicate(r[0], () => defaultT),
            E.map(r[1])
          )
        )
      )
    ),
    E.fold(identity, identity)
  );
};
export {
  firstRight
};
//# sourceMappingURL=utils.js.map
