[#757] Classified instructions (GADT version)
I spent more on this than was probably necessary, however the result is somewhat not terrible. How useful is it beyond
Morley.Michelson.Typed.Util
is debatable, however.
Further work (like #807) can perhaps expand on this.
Description
Problem: we often want to match on a typed instruction that has a certain property. To do that, we either have to match on all 'Instr' constructors, which is an ungodly amount of boilerplate, or use wildcard matches and thus introduce maintainability issues.
Solution: Introduce GADT-based machinery for classifying 'Instr' constructors in a few different ways and matching against those. Defining new classifications isn't much fun, but this seems better than doing the corresponding pattern-matches ad-hoc each time. Apply this machinery where appropriate, where it's not enough use TH (sparingly).
Related issue(s)
Resolves #757 (closed)
✅ Checklist for your Merge Request
Related changes (conditional)
-
Tests (see short guidelines)
-
If I added new functionality, I added tests covering it. -
If I fixed a bug, I added a regression test to prevent the bug from silently reappearing again.
-
-
Documentation
Stylistic guide (mandatory)
-
My commits comply with the following policy. -
My code complies with the style guide.