With enough sugar, some would say that this is the basis of a data
serialization DSL... I just call it redundancy encoding.

This looks much better, but the case type ... still feels wrong. Reminds
me of the explicit switch statement vs. polymorphism, and the solution is
very similar: let's turn that into a "polymorphic lambda call".