Skip to content
This repository has been archived by the owner on Jul 25, 2018. It is now read-only.

Fixed disjunctions #14

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion fantasy-monoids.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

const Additive = require('./src/additive');
const Conjunction = require('./src/conjunction');
const Disjunction = require('./src/conjunction');
const Disjunction = require('./src/disjunction');
const Dual = require('./src/dual');
const Endo = require('./src/endo');
const Multiplicative = require('./src/multiplicative');
Expand All @@ -13,9 +13,17 @@ const Max = require('./src/max');
const concat = require('./src/concat');
const mconcat = require('./src/mconcat');

// Alias
const Sum = Additive;
const All = Conjunction;
const Any = Disjunction;

module.exports = { Additive
, Sum
, Conjunction
, All
, Disjunction
, Any
, Dual
, Endo
, Multiplicative
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"nodeunit": "0.9.x"
},
"scripts": {
"test": "node --harmony_destructuring node_modules/.bin/nodeunit test/*.js"
"test": "node node_modules/.bin/nodeunit test/*.js"
},
"files": [
"fantasy-monoids.js",
Expand Down
25 changes: 25 additions & 0 deletions test/disjunction.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

const {adapters: {nodeunit: λ}} = require('fantasy-check');
const {identity} = require('fantasy-combinators');
const {of, concat, empty} = require('fantasy-land')

const m = require('fantasy-land/laws/monoid');
const s = require('fantasy-land/laws/semigroup');
Expand All @@ -28,3 +29,27 @@ exports.setoid = {
'symmetry': λ.law(sʹ.symmetry)(Disjunction),
'transitivity': λ.law(sʹ.transitivity)(Disjunction)
};

exports.basicUsage = test => {
const expected = { x: true };
const expected2 = { x: false };

test.deepEqual(
Disjunction(false)
[concat](Disjunction(false))
[concat](Disjunction(false))
[concat](Disjunction(false))
[concat](Disjunction(true))
, expected
)

test.deepEqual(
Disjunction(false)
[concat](Disjunction(false))
[concat](Disjunction(false))
[concat](Disjunction(false))
, expected2
)

test.done();
};