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

// src/Traced.ts
var Traced_exports = {};
__export(Traced_exports, {
  Functor: () => Functor,
  URI: () => URI,
  censor: () => censor,
  flap: () => flap2,
  getComonad: () => getComonad,
  listen: () => listen,
  listens: () => listens,
  map: () => map,
  traced: () => traced,
  tracks: () => tracks
});
function tracks(M, f) {
  return (wa) => wa(f(wa(M.empty)));
}
function listen(wa) {
  return (e) => [wa(e), e];
}
function listens(f) {
  return (wa) => (e) => [wa(e), f(e)];
}
function censor(f) {
  return (wa) => (e) => wa(f(e));
}
function getComonad(monoid) {
  function extend(wa, f) {
    return (p1) => f((p2) => wa(monoid.concat(p1, p2)));
  }
  function extract(wa) {
    return wa(monoid.empty);
  }
  return {
    URI,
    _E: void 0,
    map: _map,
    extend,
    extract
  };
}
var _map = (fa, f) => pipe(fa, map(f));
var map = (f) => (fa) => (p) => f(fa(p));
var URI = "Traced";
var Functor = {
  URI,
  map: _map
};
var flap2 = /* @__PURE__ */ flap(Functor);
var traced = Functor;

export {
  tracks,
  listen,
  listens,
  censor,
  getComonad,
  map,
  URI,
  Functor,
  flap2 as flap,
  traced,
  Traced_exports
};
