Extracting type metadata from Elm code?

About the “extraction Route type”, my idea is even a bit more general: for a given type T in a module M , have a fuzzer generating value of this type using all the functions available in M.

This way you can easily check invariants about T and this “parsing issue” for routes is then a trivial sub-issue of that.

Generating unbounded types is the role of the fuzzers (there is even a complete “theory” about how to “shrink” values).

Warning: trying to have a “perfect solution” sometimes leads to nightmare. We don’t launch spatial rockets, we don’t need 100% safety. Roughly speaking, I’d say with elm we have “95% safety” (by comparison of “50% safety” in JS) which is quite enough for web sites.

Honestly, my hand-written fuzzers work fine, adding totally new a route is pretty a rare. However, modifying the url parameters is pretty frequent and is well caught! So, yes, sometimes I could have some url-related bug (ergo “5% unsafe”), but I don’t need to mess up with additional tool or abstraction.