Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
test ('Alternative', () => {
eq (Z.Alternative.test (Left ([]))) (false);
eq (Z.Alternative.test (Right ([]))) (false);
});
test ('Alternative', () => {
eq (Z.Alternative.test (Nothing)) (true);
eq (Z.Alternative.test (Just (Useless))) (true);
});
test ('Alternative', () => {
eq (Z.Alternative.test (Left ([]))) (false);
eq (Z.Alternative.test (Right ([]))) (false);
});
test ('Alternative', () => {
eq (Z.Alternative.test (Identity ([]))) (false);
});
test ('Alternative', () => {
eq (Z.Alternative.test (Nothing)) (true);
eq (Z.Alternative.test (Just (Useless))) (true);
});
distributivity: assert.forall3 (function(x, f, g) {
return Z.Alternative.test (x) &&
Z.Alternative.test (f) &&
Z.Alternative.test (g) &&
equals (ap (alt (f) (g)) (x),
alt (ap (f) (x)) (ap (g) (x)));
}),
annihilation: assert.forall1 (function(x) {
return Z.Alternative.test (x) &&
Z.Alternative.test (zero) &&
equals (ap (zero) (x),
zero);
})