// Generated by purs version 0.14.5
"use strict";
var $foreign = require("./foreign.js");
var Data_Either = require("../Data.Either/index.js");
var Data_Maybe = require("../Data.Maybe/index.js");
var Killed = (function () {
    function Killed(value0) {
        this.value0 = value0;
    };
    Killed.create = function (value0) {
        return new Killed(value0);
    };
    return Killed;
})();
var Filled = (function () {
    function Filled(value0) {
        this.value0 = value0;
    };
    Filled.create = function (value0) {
        return new Filled(value0);
    };
    return Filled;
})();
var Empty = (function () {
    function Empty() {

    };
    Empty.value = new Empty();
    return Empty;
})();
var $$new = $foreign["_newVar"];
var isKilled = function (v) {
    if (v instanceof Killed) {
        return true;
    };
    return false;
};
var isFilled = function (v) {
    if (v instanceof Filled) {
        return true;
    };
    return false;
};
var isEmpty = function (v) {
    if (v instanceof Empty) {
        return true;
    };
    return false;
};
var ffiUtil = {
    left: Data_Either.Left.create,
    right: Data_Either.Right.create,
    nothing: Data_Maybe.Nothing.value,
    just: Data_Maybe.Just.create,
    killed: Killed.create,
    filled: Filled.create,
    empty: Empty.value
};
var kill = function (err) {
    return function (avar) {
        return $foreign["_killVar"](ffiUtil, err, avar);
    };
};
var put = function (value) {
    return function (avar) {
        return function (cb) {
            return $foreign["_putVar"](ffiUtil, value, avar, cb);
        };
    };
};
var read = function (avar) {
    return function (cb) {
        return $foreign["_readVar"](ffiUtil, avar, cb);
    };
};
var status = function (avar) {
    return $foreign["_status"](ffiUtil, avar);
};
var take = function (avar) {
    return function (cb) {
        return $foreign["_takeVar"](ffiUtil, avar, cb);
    };
};
var tryPut = function (value) {
    return function (avar) {
        return $foreign["_tryPutVar"](ffiUtil, value, avar);
    };
};
var tryRead = function (avar) {
    return $foreign["_tryReadVar"](ffiUtil, avar);
};
var tryTake = function (avar) {
    return $foreign["_tryTakeVar"](ffiUtil, avar);
};
module.exports = {
    Killed: Killed,
    Filled: Filled,
    Empty: Empty,
    "new": $$new,
    take: take,
    tryTake: tryTake,
    put: put,
    tryPut: tryPut,
    read: read,
    tryRead: tryRead,
    kill: kill,
    status: status,
    isEmpty: isEmpty,
    isFilled: isFilled,
    isKilled: isKilled,
    empty: $foreign.empty
};
