Ability to get export list of TH reified module
After using reifyModule, I'd like to be able to inspect the list of exports from that module.
At first I thought that this could perhaps be done by changing from
data ModuleInfo = -- | Contains the import list of the module. ModuleInfo [Module]
data ModuleInfo = -- | Contains the import list and export list of the module. ModuleInfo [Module] [Name]
but I now wonder if this is the best plan, because
thisModule >>= reifyModule might be expected to function as a time machine, allowing us to see declarations that may not have been made yet (in the case where this module's export list is implicit).
Can anyone propose a type that would allow us to perform this inspection for modules that have already been baked, but not for "this" module?
An intended use case would be in our dimensional types library. We have several modules that define a whole bunch of units. It's useful for the unit name parser to have access to a dictionary with all of those units in it, but maintaining the definition of such a dictionary is redundant. If this feature existed, a module in the parser could import the modules where units are defined, examine the export lists, reify the names in the export lists, determine which represent unit definitions, and emit a declaration of a dictionary that contains them all.
(This is in some ways similar to #9699, though perhaps more difficult?)