heliaxdev / extensible-data

Generate the boilerplate for the Trees That Grow pattern
https://heliaxdev.github.io/extensible-data/Extensible.html
5 stars 0 forks source link

Make qualified names robust to `import..as` #3

Closed andy-morris closed 4 years ago

andy-morris commented 4 years ago

The data types passed into extensible have all their names unqualified, so the code generated by extendFoo does too, which means it breaks if names are imported qualified.

andy-morris commented 4 years ago

Urgh, I thought that import qualified Mod as M brought the module into scope as both M and Mod, but it doesn't, so they also have to be qualified with the right thing...

andy-morris commented 4 years ago

Currently the generated code uses the original fully-qualified name. Which might mean a duplicated import, but at least it works for now

andy-morris commented 4 years ago

Building a NameG manually to point to the module might work? location contains all the required info.