How to use the fantasy-land/laws/setoid.reflexivity function in fantasy-land

To help you get started, we’ve selected a few fantasy-land examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github fantasyland / fantasy-monoids / test / ord.js View on Github external
const {adapters: {nodeunit: λ}} = require('fantasy-check');
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])
};
github fantasyland / fantasy-monoids / test / additive.js View on Github external
exports.monoid = {

    '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)
};
github fantasyland / fantasy-monoids / test / multiplicative.js View on Github external
exports.monoid = {

    '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)
};
github fantasyland / fantasy-monoids / test / min.js View on Github external
exports.monoid = {

    '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(
github fantasyland / fantasy-monoids / test / disjunction.js View on Github external
exports.monoid = {

    '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)
};
github fantasyland / fantasy-monoids / test / dual.js View on Github external
exports.monoid = {

    '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])
};
github fantasyland / fantasy-monoids / test / conjunction.js View on Github external
exports.monoid = {

    '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)
};
github fantasyland / fantasy-monoids / test / max.js View on Github external
exports.monoid = {

    '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(