Integrating tools with Cabal

Mikhail Glushenkov the.dead.shall.rise at
Fri Nov 9 08:57:30 CET 2012


On Fri, Nov 9, 2012 at 8:06 AM, Roman Cheplyaka <roma at> wrote:
> Hi,
> Suppose I have some kind of analysis tool that I want to run on a Cabal
> project.
> The analysis tool only deals with Haskell files, so I need Cabal to
> generate Haskell files from CPP-enabled Haskell files, .hsc files, alex
> and happy files etc.
> I see two possible ways to do that: use Cabal as a library, or my tool
> to be run by Cabal as a compiler.

I think that the path of least resistance is to make your analysis
tool command-line compatible with ghc. Then you can use it like this:

$ cabal configure --with-compiler=/path/to/my-ghc
$ cabal build

Since 'cabal build' usually just calls 'ghc --make Main.hs', you'll
need to do dependency chasing, but this can be implemented by parsing
the output of 'ghc -M'.

()  ascii ribbon campaign - against html e-mail
/\   - against proprietary attachments

More information about the cabal-devel mailing list