Structural Pattern Matching for Types

FWIW, I suggested something similar in Make `@overload` less verbose - #10 by jorenham, with a syntax like

Note sure if it’s better, but I thought I’d just throw it out there.

Unless I’m missing something, I think that this these “case type”'s or “type mappings” (whatever you want to call it), generalize overloads. Put differently, I think that all overloads could be rewritten in terms using these type-mappings. It’s even more DRY that way, because it allows you to recycle (parts of) you overload signatures, because it decouples the overloaded signature from the function definition. It also provides a natural way for composing these definitions, which allows you can re-use some of the overloads.