By: Tom Sydney Kerckhove <syd@cs-syd.eu>
Report a JSON type its gen package never roundtrips TestJsonSpecPerJsonType, at the project level: a type in a package's library with both a ToJSON and a FromJSON instance obliges jsonSpec @T in the test suite of that package's gen package. Both classes rather than either, because what jsonSpec asserts is a claim about the pair jointly, and a type with only one of them cannot make it. So an obligation is now a set of classes rather than one, and TestGenValidSpecPerGenValid is the set of one. That makes the two rules the same engine, and it is now written once. The engine, the tables and the two questions put to the compiler move to Hopinion.Check.Obligation; each rule is the classes, the combinator and the sentences, at thirty lines. The rule id becomes a column, so a row still belongs to exactly one rule and no rule can read another's, which is the one place a rule does not own its own table and is written down in the plan as the family exception it is. One behaviour change falls out of the class set: a finding is now per type rather than per instance. One call meets the obligation of every instance of a type, so a second finding about the same type would be one whose suppression a reader could only write by making the first answer for nothing. Zero findings in this repository, which is where the one suppression comes from: persistent's quasi-quoter writes both instances for the Key of every table it makes, and a Key is a row number that never leaves the store.