[Haskell-cafe] How to add use custom preprocessor in cabal

Bernd Brassel bbr at informatik.uni-kiel.de
Thu Oct 8 11:28:42 EDT 2009


Hi folks,

I am trying to integrate my own preprocessor into a cabal build  
process. But there are several points that I get stuck with. Could  
someone help me, please?

A simplification of my problem:
I have files "Abc.foo" and each of them should be transformed into  
"Abc.hs" by calling function "transform". The resulting "Abc.hs" files  
should then be exposed as Haskell library modules.

1. Question: How do I tell cabal that the file Abc.foo belongs to the  
package?
After reading the User's Guide I had the impression that I should  
write something like

Library
   Eposed-Modules:
       Abc.foo

But this leads to a parse error.

Adding a

Data-Files:
   Abc.foo

to the heading, on the other hand, does not seem to do anything.

2. Question: How to add the preprocessor? I have tried

main =
   defaultMainWithHooks
          simpleUserHooks{hookedPreProcessors=[("foo",transformation)]}

transformation :: BuildInfo -> LocalBuildInfo -> PreProcessor

But under which circumstances will this function be called? Up to now  
I have not succeeded in making cabal call this function.

Thanks for your time!
Bernd




More information about the Haskell-Cafe mailing list