"use strict"
var __createBinding =
  (this && this.__createBinding) ||
  (Object.create
    ? function (o, m, k, k2) {
        if (k2 === undefined) k2 = k
        Object.defineProperty(o, k2, {
          enumerable: true,
          get: function () {
            return m[k]
          }
        })
      }
    : function (o, m, k, k2) {
        if (k2 === undefined) k2 = k
        o[k2] = m[k]
      })
var __exportStar =
  (this && this.__exportStar) ||
  function (m, exports) {
    for (var p in m)
      if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p))
        __createBinding(exports, m, p)
  }
Object.defineProperty(exports, "__esModule", { value: true })
exports.onGenericAdtElement =
  exports.onAdtElement =
  exports.isGenericAdtElement =
  exports.isAdtElement =
  exports.isSync =
  exports.isTag =
  exports.isOption =
  exports.isEither =
  exports.matchTagFor =
  exports.patternFor =
  exports.matchTag_ =
  exports.pattern_ =
  exports.matchTag =
  exports.pattern =
  exports.intersect =
    void 0
// tracing: off
require("../Operator")
const Option_1 = require("../Option")
function intersect(...as) {
  return as.reduce((a, b) => ({ ...a, ...b }))
}
exports.intersect = intersect
const pattern = (n) => (_, d) => (m) => {
  return _[m[n]] ? _[m[n]](m, m) : d(m, m)
}
exports.pattern = pattern
exports.matchTag = (0, exports.pattern)("_tag")
const pattern_ = (n) => (m, _, d) => {
  return _[m[n]] ? _[m[n]](m, m) : d(m, m)
}
exports.pattern_ = pattern_
exports.matchTag_ = (0, exports.pattern_)("_tag")
const patternFor = (n) => () => (_, d) => (m) => {
  return _[m[n]] ? _[m[n]](m, m) : d(m, m)
}
exports.patternFor = patternFor
exports.matchTagFor = (0, exports.patternFor)("_tag")
__exportStar(require("./tool"), exports)
function isEither(u) {
  return (
    typeof u === "object" &&
    u != null &&
    "_tag" in u &&
    (u["_tag"] === "Left" || u["_tag"] === "Right")
  )
}
exports.isEither = isEither
function isOption(u) {
  return (
    typeof u === "object" &&
    u != null &&
    "_tag" in u &&
    (u["_tag"] === "Some" || u["_tag"] === "None")
  )
}
exports.isOption = isOption
function isTag(u) {
  return typeof u === "object" && u != null && "_tag" in u && u["_tag"] === "Tag"
}
exports.isTag = isTag
function isSync(u) {
  return typeof u === "object" && u != null && "_tag" in u && u["_tag"] === "XPure"
}
exports.isSync = isSync
function isAdtElement(tag) {
  return (adt) => adt["_tag"] === tag
}
exports.isAdtElement = isAdtElement
function isGenericAdtElement(_t) {
  return (tag) => (adt) => adt[_t] === tag
}
exports.isGenericAdtElement = isGenericAdtElement
function onAdtElement(tag, f) {
  return (adt) => {
    if (adt["_tag"] === tag) {
      return (0, Option_1.some)(f(adt))
    }
    return Option_1.none
  }
}
exports.onAdtElement = onAdtElement
function onGenericAdtElement(_t) {
  return (tag, f) => (adt) => {
    if (adt[_t] === tag) {
      return (0, Option_1.some)(f(adt))
    }
    return Option_1.none
  }
}
exports.onGenericAdtElement = onGenericAdtElement
__exportStar(require("./lazy"), exports)
__exportStar(require("./union"), exports)
__exportStar(require("./equal"), exports)
//# sourceMappingURL=index.js.map
