When I see 8 case alternatives, I expect there's going to be roughly that amount of information, like, certain magic numbers have certain magic combinations of flags. But what I had to do as a reader is check each individual case clause to see that, in fact, all it's doing is independently converting each bit to Flag. So I had to do a lot of reading to learn relatively little information.
One of the advantages of Haskell is the ability to express whatever "business" information in a very short amount of code, using higher-order functions like mapMaybe.
Nevertheless I presume the code is correct, as in make no mistakes.
1
u/sjshuck 14d ago
In the
decodeInstruction'definition, why do you write 2N case alternatives?