The basic abstractions of effect-ts-laws
are Law
and LawSet
.
A Law
is a paper-thin wrapper of the
fast-check
property,
and a LawSet
is a recursive data structure composed of a list of
Law
and their dependencies encoded in a list of LawSet
.
Everything exported here can be directly imported from effect-ts-laws
.
import {Law, negateLaw} from 'effect-ts-laws'
// Law and negateLaw are in scope
import {checkLaw, Law, negateLaw} from 'effect-ts-laws'
const law: Law<[number, number]> = Law(
'sum of positives is greater or equal to both',
'∀n₁,n₂ ∈ ℕ, sum=n₁+n₂: sum ≥ n₁ ∧ sum ≥ n₂',
tinyPositive,
tinyPositive,
)((x, y) => x + y >= x && x + y >= y)
const lawSet: LawSet = lawTests('sums', lawA, ...otherLaws)