import {
  pipe
} from "./chunk-ZI34HWXZ.mjs";
import {
  __export
} from "./chunk-QK4PKNB3.mjs";

// src/Functor.ts
var Functor_exports = {};
__export(Functor_exports, {
  as: () => as,
  asUnit: () => asUnit,
  bindTo: () => bindTo,
  flap: () => flap,
  getFunctorComposition: () => getFunctorComposition,
  let: () => let_,
  map: () => map
});
function map(F, G) {
  return (f) => (fa) => F.map(fa, (ga) => G.map(ga, f));
}
function flap(F) {
  return (a) => (fab) => F.map(fab, (f) => f(a));
}
function bindTo(F) {
  return (name) => (fa) => F.map(fa, (a) => ({ [name]: a }));
}
function let_(F) {
  return (name, f) => (fa) => F.map(fa, (a) => Object.assign({}, a, { [name]: f(a) }));
}
function getFunctorComposition(F, G) {
  const _map = map(F, G);
  return {
    map: (fga, f) => pipe(fga, _map(f))
  };
}
function as(F) {
  return (self, b) => F.map(self, () => b);
}
function asUnit(F) {
  const asM = as(F);
  return (self) => asM(self, void 0);
}

export {
  map,
  flap,
  bindTo,
  let_,
  getFunctorComposition,
  as,
  asUnit,
  Functor_exports
};
