Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
'rightIdentity': λ.law(m.rightIdentity)(Dualʹ),
'leftIdentity': λ.law(m.leftIdentity)(Dualʹ)
};
exports.semigroup = {
'associativity': λ.law(s.associativity)(Dualʹ[of])
};
exports.setoid = {
'reflexivity': λ.law(sʹ.reflexivity)(Dualʹ[of]),
'symmetry': λ.law(sʹ.symmetry)(Dualʹ[of]),
'transitivity': λ.law(sʹ.transitivity)(Dualʹ[of])
};
const {identity} = require('fantasy-combinators');
const sʹ = require('fantasy-land/laws/setoid');
const {Ord} = require('../fantasy-monoids');
const Ordʹ = Ord({ min: () => undefined
, max: () => undefined
, compare: (x, y) => x === y ? Ord.EQ: x < y ? Ord.LT: Ord.GT
});
exports.setoid = {
'reflexivity': λ.law(sʹ.reflexivity)(Ordʹ[of]),
'symmetry': λ.law(sʹ.symmetry)(Ordʹ[of]),
'transitivity': λ.law(sʹ.transitivity)(Ordʹ[of])
};
'rightIdentity': λ.law(m.rightIdentity)(Disjunction),
'leftIdentity': λ.law(m.leftIdentity)(Disjunction)
};
exports.semigroup = {
'associativity': λ.law(s.associativity)(Disjunction)
};
exports.setoid = {
'reflexivity': λ.law(sʹ.reflexivity)(Disjunction),
'symmetry': λ.law(sʹ.symmetry)(Disjunction),
'transitivity': λ.law(sʹ.transitivity)(Disjunction)
};
'rightIdentity': λ.law(m.rightIdentity)(Minʹ),
'leftIdentity': λ.law(m.leftIdentity)(Minʹ)
};
exports.semigroup = {
'associativity': λ.law(s.associativity)(Minʹ[of])
};
exports.setoid = {
'reflexivity': λ.law(sʹ.reflexivity)(Minʹ[of]),
'symmetry': λ.law(sʹ.symmetry)(Minʹ[of]),
'transitivity': λ.law(sʹ.transitivity)(Minʹ[of])
};
exports.basicUsage = test => {
const expected = { x: { x: 1 } };
test.deepEqual(
Minʹ(Ordʹ(3))
[concat](Minʹ(Ordʹ(6)))
[concat](Minʹ(Ordʹ(8)))
[concat](Minʹ(Ordʹ(9)))
[concat](Minʹ(Ordʹ(1)))
, expected
)
test.deepEqual(
mconcat([ Minʹ(Ordʹ(3))
'rightIdentity': λ.law(m.rightIdentity)(Maxʹ),
'leftIdentity': λ.law(m.leftIdentity)(Maxʹ)
};
exports.semigroup = {
'associativity': λ.law(s.associativity)(Maxʹ[of])
};
exports.setoid = {
'reflexivity': λ.law(sʹ.reflexivity)(Maxʹ[of]),
'symmetry': λ.law(sʹ.symmetry)(Maxʹ[of]),
'transitivity': λ.law(sʹ.transitivity)(Maxʹ[of])
};
exports.basicUsage = test => {
const expected = { x: { x: 9 } };
test.deepEqual(
Maxʹ(Ordʹ(3))
[concat](Maxʹ(Ordʹ(6)))
[concat](Maxʹ(Ordʹ(8)))
[concat](Maxʹ(Ordʹ(9)))
[concat](Maxʹ(Ordʹ(1)))
, expected
)
test.deepEqual(
mconcat([ Maxʹ(Ordʹ(3))
'rightIdentity': λ.law(m.rightIdentity)(Multiplicative),
'leftIdentity': λ.law(m.leftIdentity)(Multiplicative)
};
exports.semigroup = {
'associativity': λ.law(s.associativity)(Multiplicative)
};
exports.setoid = {
'reflexivity': λ.law(sʹ.reflexivity)(Multiplicative),
'symmetry': λ.law(sʹ.symmetry)(Multiplicative),
'transitivity': λ.law(sʹ.transitivity)(Multiplicative)
};
'rightIdentity': λ.law(m.rightIdentity)(Additive),
'leftIdentity': λ.law(m.leftIdentity)(Additive)
};
exports.semigroup = {
'associativity': λ.law(s.associativity)(Additive)
};
exports.setoid = {
'reflexivity': λ.law(sʹ.reflexivity)(Additive),
'symmetry': λ.law(sʹ.symmetry)(Additive),
'transitivity': λ.law(sʹ.transitivity)(Additive)
};
'rightIdentity': λ.law(m.rightIdentity)(Conjunction),
'leftIdentity': λ.law(m.leftIdentity)(Conjunction)
};
exports.semigroup = {
'associativity': λ.law(s.associativity)(Conjunction)
};
exports.setoid = {
'reflexivity': λ.law(sʹ.reflexivity)(Conjunction),
'symmetry': λ.law(sʹ.symmetry)(Conjunction),
'transitivity': λ.law(sʹ.transitivity)(Conjunction)
};