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

// src/Eq.ts
var Eq_exports = {};
__export(Eq_exports, {
  Contravariant: () => Contravariant,
  URI: () => URI,
  contramap: () => contramap,
  eq: () => eq,
  eqBoolean: () => eqBoolean,
  eqDate: () => eqDate,
  eqNumber: () => eqNumber,
  eqStrict: () => eqStrict,
  eqString: () => eqString,
  fromEquals: () => fromEquals,
  getMonoid: () => getMonoid,
  getSemigroup: () => getSemigroup,
  getStructEq: () => getStructEq,
  getTupleEq: () => getTupleEq,
  strictEqual: () => strictEqual,
  struct: () => struct,
  tuple: () => tuple
});
var fromEquals = (equals) => ({
  equals: (x, y) => x === y || equals(x, y)
});
var struct = (eqs) => fromEquals((first, second) => {
  for (const key in eqs) {
    if (!eqs[key].equals(first[key], second[key])) {
      return false;
    }
  }
  return true;
});
var tuple = (...eqs) => fromEquals((first, second) => eqs.every((E, i) => E.equals(first[i], second[i])));
var contramap_ = (fa, f) => pipe(fa, contramap(f));
var contramap = (f) => (fa) => fromEquals((x, y) => fa.equals(f(x), f(y)));
var URI = "Eq";
var eqStrict = {
  equals: (a, b) => a === b
};
var empty = {
  equals: () => true
};
var getSemigroup = () => ({
  concat: (x, y) => fromEquals((a, b) => x.equals(a, b) && y.equals(a, b))
});
var getMonoid = () => ({
  concat: getSemigroup().concat,
  empty
});
var Contravariant = {
  URI,
  contramap: contramap_
};
var getTupleEq = tuple;
var getStructEq = struct;
var strictEqual = eqStrict.equals;
var eq = Contravariant;
var eqBoolean = eqStrict;
var eqString = eqStrict;
var eqNumber = eqStrict;
var eqDate = {
  equals: (first, second) => first.valueOf() === second.valueOf()
};

export {
  fromEquals,
  struct,
  tuple,
  contramap,
  URI,
  eqStrict,
  getSemigroup,
  getMonoid,
  Contravariant,
  getTupleEq,
  getStructEq,
  strictEqual,
  eq,
  eqBoolean,
  eqString,
  eqNumber,
  eqDate,
  Eq_exports
};
