effect-ts-laws
Version:
effect-ts law testing using fast-check.
12 lines • 595 B
JavaScript
import { Law } from '#law';
import { defineConcreteLaws } from './given.js';
import { semigroupLaws } from './Semigroup.js';
/**
* Build typeclass laws for `Monoid` and its requirement `Semigroup` laws.
* @category typeclass laws
*/
export const monoidLaws = given => {
const { F, equalsA, a, suffix } = given;
return defineConcreteLaws('Monoid', Law('left identity', '∅ ⊕ a = a', a)((a) => equalsA(F.combine(F.empty, a), a)), Law('right identity', 'a = a ⊕ ∅', a)((a) => equalsA(F.combine(a, F.empty), a)))(suffix, semigroupLaws(given));
};
//# sourceMappingURL=Monoid.js.map