Innovenergy_trunk/frontend/node_modules/fp-ts/lib/BooleanAlgebra.js

71 lines
2.3 KiB
JavaScript
Raw Permalink Normal View History

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getFunctionBooleanAlgebra = exports.booleanAlgebraBoolean = exports.getDualBooleanAlgebra = exports.booleanAlgebraVoid = exports.reverse = void 0;
var function_1 = require("./function");
// -------------------------------------------------------------------------------------
// combinators
// -------------------------------------------------------------------------------------
/**
* Every boolean algebras has a dual algebra, which involves reversing one/zero as well as join/meet.
*
* @since 2.10.0
*/
var reverse = function (B) { return ({
meet: function (x, y) { return B.join(x, y); },
join: function (x, y) { return B.meet(x, y); },
zero: B.one,
one: B.zero,
implies: function (x, y) { return B.join(B.not(x), y); },
not: B.not
}); };
exports.reverse = reverse;
// -------------------------------------------------------------------------------------
// instances
// -------------------------------------------------------------------------------------
/**
* @category instances
* @since 2.0.0
*/
exports.booleanAlgebraVoid = {
meet: function () { return undefined; },
join: function () { return undefined; },
zero: undefined,
one: undefined,
implies: function () { return undefined; },
not: function () { return undefined; }
};
// -------------------------------------------------------------------------------------
// deprecated
// -------------------------------------------------------------------------------------
/**
* Use [`reverse`](#reverse) instead.
*
* @category zone of death
* @since 2.0.0
* @deprecated
*/
exports.getDualBooleanAlgebra = exports.reverse;
/**
* Use [`BooleanAlgebra`](./boolean.ts.html#booleanalgebra) instead.
*
* @category zone of death
* @since 2.0.0
* @deprecated
*/
exports.booleanAlgebraBoolean = {
meet: function (x, y) { return x && y; },
join: function (x, y) { return x || y; },
zero: false,
one: true,
implies: function (x, y) { return !x || y; },
not: function (x) { return !x; }
};
/**
* Use [`getBooleanAlgebra`](./function.ts.html#getbooleanalgebra) instead.
*
* @category zone of death
* @since 2.0.0
* @deprecated
*/
exports.getFunctionBooleanAlgebra = function_1.getBooleanAlgebra;