"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.TExit = exports.Succeed = exports.Retry = exports.Interrupt = exports.Fail = exports.Die = void 0;
exports.die = die;
exports.fail = fail;
exports.interrupt = interrupt;
exports.retry = void 0;
exports.succeed = succeed;
exports.unifyTExit = unifyTExit;
exports.unit = void 0;

var tsplus_module_1 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@tsplus/stdlib/structure/Hash"));

var tsplus_module_2 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@tsplus/stdlib/structure/Equals"));

function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }

function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

const TExit = {
  $: {}
};
/**
 * @tsplus unify ets/TExit
 */

exports.TExit = TExit;

function unifyTExit(self) {
  return self;
}

class Fail {
  constructor(value) {
    this.value = value;
    this._tag = "Fail";
  }

  [tsplus_module_1.Hash.sym]() {
    return tsplus_module_1.hashUnknown(this.value);
  }

  [tsplus_module_2.Equals.sym](that) {
    return that instanceof Fail && tsplus_module_2.equals(this.value, that.value);
  }

}

exports.Fail = Fail;

class Die {
  constructor(value) {
    this.value = value;
    this._tag = "Die";
  }

  [tsplus_module_1.Hash.sym]() {
    return tsplus_module_1.hashUnknown(this.value);
  }

  [tsplus_module_2.Equals.sym](that) {
    return that instanceof Die && tsplus_module_2.equals(this.value, that.value);
  }

}

exports.Die = Die;

class Interrupt {
  constructor(fiberId) {
    this.fiberId = fiberId;
    this._tag = "Interrupt";
  }

  [tsplus_module_1.Hash.sym]() {
    return tsplus_module_1.hashUnknown(this.fiberId);
  }

  [tsplus_module_2.Equals.sym](that) {
    return that instanceof Interrupt && tsplus_module_2.equals(this.fiberId, that.fiberId);
  }

}

exports.Interrupt = Interrupt;

class Succeed {
  constructor(value) {
    this.value = value;
    this._tag = "Succeed";
  }

  [tsplus_module_1.Hash.sym]() {
    return tsplus_module_1.hashUnknown(this.value);
  }

  [tsplus_module_2.Equals.sym](that) {
    return that instanceof Succeed && tsplus_module_2.equals(this.value, that.value);
  }

}

exports.Succeed = Succeed;

const _retryHash = /*#__PURE__*/tsplus_module_1.hashRandom();

class Retry {
  constructor() {
    this._tag = "Retry";
  }

  [tsplus_module_1.Hash.sym]() {
    return tsplus_module_1.optimize(_retryHash);
  }

  [tsplus_module_2.Equals.sym](that) {
    return that instanceof Retry;
  }

}
/**
 * @tsplus static ets/TExit/Ops unit
 */


exports.Retry = Retry;
const unit = /*#__PURE__*/new Succeed(undefined);
/**
 * @tsplus static ets/TExit/Ops succeed
 */

exports.unit = unit;

function succeed(a) {
  return new Succeed(a);
}
/**
 * @tsplus static ets/TExit/Ops fail
 */


function fail(e) {
  return new Fail(e);
}
/**
 * @tsplus static ets/TExit/Ops die
 */


function die(e) {
  return new Die(e);
}
/**
 * @tsplus static ets/TExit/Ops interrupt
 */


function interrupt(fiberId) {
  return new Interrupt(fiberId);
}
/**
 * @tsplus static ets/TExit/Ops retry
 */


const retry = /*#__PURE__*/new Retry();
exports.retry = retry;
//# sourceMappingURL=definition.js.map