"use strict";
var __assign = (this && this.__assign) || Object.assign || function(t) {
    for (var s, i = 1, n = arguments.length; i < n; i++) {
        s = arguments[i];
        for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
            t[p] = s[p];
    }
    return t;
};
Object.defineProperty(exports, "__esModule", { value: true });
var Applicative_1 = require("./Applicative");
var option = require("./Option");
var Ops = /** @class */ (function () {
    function Ops() {
    }
    Ops.prototype.chain = function (F) {
        return function (f, fa) { return F.chain(function (o) { return o.fold(function () { return F.of(option.none); }, function (a) { return f(a); }); }, fa); };
    };
    Ops.prototype.some = function (F) {
        return function (a) { return F.of(option.some(a)); };
    };
    Ops.prototype.none = function (F) {
        return function () { return F.of(option.none); };
    };
    Ops.prototype.fromOption = function (F) {
        return function (oa) { return F.of(oa); };
    };
    Ops.prototype.liftF = function (F) {
        return function (fa) { return F.map(function (a) { return option.some(a); }, fa); };
    };
    Ops.prototype.fold = function (F) {
        return function (none, some, fa) { return F.map(function (o) { return o.fold(none, some); }, fa); };
    };
    Ops.prototype.getOrElse = function (F) {
        return function (f) { return function (fa) { return F.map(function (o) { return o.getOrElse(f); }, fa); }; };
    };
    Ops.prototype.getOrElseValue = function (F) {
        return function (value) { return function (fa) { return F.map(function (o) { return o.getOrElseValue(value); }, fa); }; };
    };
    Ops.prototype.getOptionT = function (M) {
        var applicativeComposition = Applicative_1.getApplicativeComposition(M, option);
        return __assign({}, applicativeComposition, { chain: this.chain(M) });
    };
    return Ops;
}());
exports.Ops = Ops;
var ops = new Ops();
exports.chain = ops.chain;
exports.none = ops.none;
exports.some = ops.some;
exports.fromOption = ops.fromOption;
exports.liftF = ops.liftF;
exports.fold = ops.fold;
exports.getOrElse = ops.getOrElse;
exports.getOrElseValue = ops.getOrElseValue;
exports.getOptionT = ops.getOptionT;
//# sourceMappingURL=OptionT.js.map