
On Sat, Aug 19, 2006 at 09:21:34AM +0100, Brian Hulley wrote:
Therefore I think the desugaring would need to take place in the compiler so the compiler could avoid exporting the compiler-generated instances when the fields are not present in the module export list.
I'm not entirely sure I understand you here, but something to consider is how well the sytem can be handled by something which is not a compiler, but a code transformer. Something like Hat or buddha. For tools like these, it is important that a desugared program is still a valid (source level) program. (Haskell 98 is close to this, but not 100% - unfortunately). Desugaring sometimes introduces new code into a program (for instance the deriving rules), a program transforming tool will most likely have to apply its transformation to that introduced code. Therefore, to transform a Haskell program you have to desugar it (somewhat) first. We want the result to remain a valid Haskell program, so it can be accepted by an ordinary compiler. (Please forgive me if your scheme already allows this). Cheers, Bernie.