import * as tsplus_module_1 from "@tsplus/stdlib/data/Maybe/definition";
import * as tsplus_module_2 from "@effect/core/stm/STM/operations/succeedNow";
import * as tsplus_module_3 from "@effect/core/stm/STM/operations/failNow";
import * as tsplus_module_4 from "@tsplus/stdlib/data/Maybe/fold";
import * as tsplus_module_5 from "@effect/core/stm/STM/operations/foldSTM";
/**
 * Converts an option on errors into an option on values.
 *
 * @tsplus getter ets/STM unsome
 */

export function unsome(self) {
  return tsplus_module_5.foldSTM_(self, option => tsplus_module_4.fold_(option, () => tsplus_module_2.succeedNow(tsplus_module_1.emptyOf()), tsplus_module_3.failNow), a => tsplus_module_2.succeedNow(tsplus_module_1.some(a)));
}
//# sourceMappingURL=unsome.mjs.map