Dynamically generate typespecs from module attribute list

Great points!

With respect to documenting types declared with this kind of code, one could add a @typedoc attribute, or, possibly even better, add a ‘types’ section-comment for the relevant module.

I’m pretty satisfied with all of the identified options now.

But I’m still curious as to whether it’s possible (somehow) to write a union_type/1 macro that would work like this:

@type key :: union_type(@keys)

It did seem tricky and maybe because we’re passing a module attribute to the macro instead of literals.