[Template-haskell] RE: Template Haskell...
sseefried at cse.unsw.edu.au
Sat Nov 1 09:09:56 EST 2003
I realise that the following request might not, for good reasons, get
implemented in Template Haskell either, but I think the ability to
reify entire modules or reify functions from any module (including
standard libraries) would be very useful to any person interested in
However, I realise that there are philosophical and implementation
oriented problems with the idea. Firstly, being able to reify code
from another module means that all .hi files would bloat to many times
their size as they now have to contain reified versions of the
declarations in the modules and all this just in case someone happens
to want to reify the declaration somewhere else.
Also, I realise that this partially breaks the abstraction mechanism of
modules. One reason that we have modules and interfaces is so that we
don't have to (or even *can't*) look inside the implementation of a
So how do I justify this feature being added?
Well as for the implementation difficulty I can't say that I've thought
of a solution to this problem, but I think there is a philosophical
difference between the user who is snooping around in modules they
shouldn't be and the hard-working, honest meta-programmer who is using
a program (not doing it themselves!) to manipulate code in another
module. In many cases they will be performing the arduous task of
language extensions which is not exactly a task for beginners. Should
they not have extra rights?
I will write a more reasoned proposal soon.
More information about the template-haskell