How to use the fantasy-land/laws/monoid.rightIdentity 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 / max.js View on Github external
const {of, concat, empty} = require('fantasy-land')
const m = require('fantasy-land/laws/monoid');
const s = require('fantasy-land/laws/semigroup');
const sʹ = require('fantasy-land/laws/setoid');

const {Max, Ord, mconcat} = require('../fantasy-monoids');
const Ordʹ = Ord({ min: () => Ordʹ(Number.MIN_NUMBER)
                 , max: () => Ordʹ(Number.MAX_NUMBER)
                 , compare: (x, y) => x === y ? Ord.EQ : x < y ? Ord.LT : Ord.GT
                 });
const Maxʹ = Max(Ordʹ);

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])
};
github fantasyland / fantasy-monoids / test / multiplicative.js View on Github external
'use strict';

const {adapters: {nodeunit: λ}} = require('fantasy-check');
const {identity} = require('fantasy-combinators');

const m = require('fantasy-land/laws/monoid');
const s = require('fantasy-land/laws/semigroup');
const sʹ = require('fantasy-land/laws/setoid');

const {Multiplicative} = require('../fantasy-monoids');

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 / additive.js View on Github external
'use strict';

const {adapters: {nodeunit: λ}} = require('fantasy-check');
const {identity} = require('fantasy-combinators');

const m = require('fantasy-land/laws/monoid');
const s = require('fantasy-land/laws/semigroup');
const sʹ = require('fantasy-land/laws/setoid');

const {Additive} = require('../fantasy-monoids');

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 / conjunction.js View on Github external
'use strict';

const {adapters: {nodeunit: λ}} = require('fantasy-check');
const {identity} = require('fantasy-combinators');

const m = require('fantasy-land/laws/monoid');
const s = require('fantasy-land/laws/semigroup');
const sʹ = require('fantasy-land/laws/setoid');

const {Conjunction} = require('../fantasy-monoids');

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 / disjunction.js View on Github external
'use strict';

const {adapters: {nodeunit: λ}} = require('fantasy-check');
const {identity} = require('fantasy-combinators');

const m = require('fantasy-land/laws/monoid');
const s = require('fantasy-land/laws/semigroup');
const sʹ = require('fantasy-land/laws/setoid');

const {Disjunction} = require('../fantasy-monoids');

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 / min.js View on Github external
const {identity} = require('fantasy-combinators');

const m = require('fantasy-land/laws/monoid');
const s = require('fantasy-land/laws/semigroup');
const sʹ = require('fantasy-land/laws/setoid');

const {Min, Ord, mconcat} = require('../fantasy-monoids');
const Ordʹ = Ord({ min: () => Ordʹ(Number.MIN_NUMBER)
                 , max: () => Ordʹ(Number.MAX_NUMBER)
                 , compare: (x, y) => x === y ? Ord.EQ : x < y ? Ord.LT : Ord.GT
                 });
const Minʹ = Min(Ordʹ);

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

const {of} = require('fantasy-land')
const m = require('fantasy-land/laws/monoid');
const s = require('fantasy-land/laws/semigroup');
const sʹ = require('fantasy-land/laws/setoid');

const {Additive, Dual} = require('../fantasy-monoids');

const Dualʹ = Dual(Additive);

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])
};