// Generated by purs version 0.14.5
"use strict";
var $foreign = require("./foreign.js");
var Control_Applicative = require("../Control.Applicative/index.js");
var Control_Monad_Except_Trans = require("../Control.Monad.Except.Trans/index.js");
var Data_Boolean = require("../Data.Boolean/index.js");
var Foreign = require("../Foreign/index.js");
var keys = function (dictMonad) {
    return function (value) {
        if (Foreign.isNull(value)) {
            return Foreign.fail(dictMonad)(new Foreign.TypeMismatch("object", "null"));
        };
        if (Foreign.isUndefined(value)) {
            return Foreign.fail(dictMonad)(new Foreign.TypeMismatch("object", "undefined"));
        };
        if (Foreign.typeOf(value) === "object") {
            return Control_Applicative.pure(Control_Monad_Except_Trans.applicativeExceptT(dictMonad))($foreign.unsafeKeys(value));
        };
        if (Data_Boolean.otherwise) {
            return Foreign.fail(dictMonad)(new Foreign.TypeMismatch("object", Foreign.typeOf(value)));
        };
        throw new Error("Failed pattern match at Foreign.Keys (line 15, column 1 - line 15, column 60): " + [ value.constructor.name ]);
    };
};
module.exports = {
    keys: keys
};
