TH libraries and linking.

Lemmih lemmih at
Mon Mar 14 11:07:15 EST 2005


I've recently been playing around with using TH to generate FFI
bindings. The resulting code is in general very concise, more
maintainable and far less error-prone than the hand-written
counterpart. But increased code bloat ascends out of all this
happiness. The binding is required to link with both template-haskell
and the library which generates the FFI code, so any binary using the
generated binding would get a few hundred kilobytes added which
strictly aren't necessary (am I wrong here?). This can be unacceptable
for small bindings.
One could perhaps get around this cheap by changing the TH pretty
printer to output valid Haskell instead of just pretty Haskell (I'm
specifically talking about a misplaced 'where' in instance
declarations). Then one could use the TH library just like a normal

I'm no expert so there's probably difficulties which I can't see.


More information about the Glasgow-haskell-users mailing list