[Haskell-cafe] Cabal and autogenerated files

John Millikin jmillikin at gmail.com
Thu Nov 12 13:56:23 EST 2009

I've had some luck with two techniques for this:

1. Create "stub" files, associated with a custom preprocessor which
knows how to parse them and generate a Haskell module. For example,
you might have "Foo.wx-stub" contain:


and then parse it into parameters for wxdirect. That allows Cabal to
generate the appropriate files automatically.

Downside: I've not figured out how to get proper dependency resolution
for this, so occasionally a clean and rebuild is required.

2. Use a Makefile to generate the files, placing them in a
subdirectory added to Cabal's search path. This works well for pretty
much anything, since Make is a bit more mature than Cabal's build
system, but having to remember the pre-processing step is annoying.

On Thu, Nov 12, 2009 at 09:54, Jeremy O'Donoghue
<jeremy.odonoghue at gmail.com> wrote:
> Hi all,
> Another, probably simple, question regarding cabalization.
> Part of wxcore, the low level abstraction in wxHaskell, consists of
> haskell modules which are generated automatically by parsing C headers
> using another tool, wxdirect.
> When trying to create an sdist package, we run into the problem that
> because we export modules which are automatically generated, after a
> 'clean', they do not exist, so the sdist package generation fails.
> We have tried using 'extra-tmp-files' to list the modules which are
> autogenerated, but this isn't working.
> Is this because we are generating the autogen modules in an autogen
> directory, or is this approach likely to fail wherever we put the
> autogenerated files? Our use case seems a reasonable one, as it could
> reasonably exist for any project which relies on automatically
> generated code.
> Thanks for any suggestions.
> Jeremy
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe

More information about the Haskell-Cafe mailing list