well-typed / generics-sop

Generic Programming using True Sums of Products
BSD 3-Clause "New" or "Revised" License
157 stars 48 forks source link

Allow using qualified names in TH #141

Closed Yuliosity closed 3 years ago

Yuliosity commented 3 years ago

Currently Generics.SOP.TH loses the qualification of the type name, e.g. deriveGeneric ''Foo.Bar generates the code just for Bar, which leads to name clashes when Foo imports another Bar. This is solved by using the passed type name instead of re-extracting it from the type definition.

phadej commented 3 years ago

This breaks data-family definitions (which use name of constructor to get hand of the type).

phadej commented 3 years ago

@RyanGlScott do you have an idea how this can be solved?

kosmikus commented 3 years ago

I'm trying to find a minimal test case for the problem this is supposed to fix. It looks to me as if reifyDatatype produces a qualified name if needed.

RyanGlScott commented 3 years ago

I can't recommend a solution because I don't yet understand what the problem is. The PR description is too vague for me to make a judgment one way or the other. A minimal example of the issue would be helpful.

Yuliosity commented 3 years ago

I'm sorry, @kosmikus is right and the problem with name clashes in our module was not caused by generics-sop at all. I'll close the PR, sorry for taking your time again 🙏