// Generated by purs version 0.14.5
"use strict";
var Control_Monad_Cont_Class = require("../Control.Monad.Cont.Class/index.js");
var Control_Monad_Cont_Trans = require("../Control.Monad.Cont.Trans/index.js");
var Control_Semigroupoid = require("../Control.Semigroupoid/index.js");
var Data_Identity = require("../Data.Identity/index.js");
var Data_Newtype = require("../Data.Newtype/index.js");
var withCont = function (f) {
    return Control_Monad_Cont_Trans.withContT((function () {
        var $0 = Control_Semigroupoid.compose(Control_Semigroupoid.semigroupoidFn)(Data_Identity.Identity);
        var $1 = Control_Semigroupoid.compose(Control_Semigroupoid.semigroupoidFn)(Data_Newtype.unwrap());
        return function ($2) {
            return $0(f($1($2)));
        };
    })());
};
var runCont = function (cc) {
    return function (k) {
        return Data_Newtype.unwrap()(Control_Monad_Cont_Trans.runContT(cc)(function ($3) {
            return Data_Identity.Identity(k($3));
        }));
    };
};
var mapCont = function (f) {
    return Control_Monad_Cont_Trans.mapContT((function () {
        var $4 = Data_Newtype.unwrap();
        return function ($5) {
            return Data_Identity.Identity(f($4($5)));
        };
    })());
};
var cont = function (f) {
    return function (c) {
        return f((function () {
            var $6 = Data_Newtype.unwrap();
            return function ($7) {
                return $6(c($7));
            };
        })());
    };
};
module.exports = {
    cont: cont,
    runCont: runCont,
    mapCont: mapCont,
    withCont: withCont,
    callCC: Control_Monad_Cont_Class.callCC,
    ContT: Control_Monad_Cont_Trans.ContT,
    lift: Control_Monad_Cont_Trans.lift,
    mapContT: Control_Monad_Cont_Trans.mapContT,
    runContT: Control_Monad_Cont_Trans.runContT,
    withContT: Control_Monad_Cont_Trans.withContT
};
