On Thu, 2009-10-08 at 17:28 +0200, Bernd Brassel wrote:
> 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
> After reading the User's Guide I had the impression that I should
> write something like
> But this leads to a parse error.
It is a list of modules, not files.
> Adding a
> to the heading, on the other hand, does not seem to do anything.
Right, those are for files that will be installed with the app and used
> 2. Question: How to add the preprocessor? I have tried
> main =
> transformation :: BuildInfo -> LocalBuildInfo -> PreProcessor
That looks right. Here's how to complete it (example taken from the
Cabal haddock docs for the PreProcess module):
> But under which circumstances will this function be called? Up to now
> I have not succeeded in making cabal call this function.
It calls it when it goes and looks for the module Abc (ie Abc.hs
or .lhs), and since if does not find it, it'll check through the list of
preprocessors and go looking for the corresponding files, ie Abc.foo.