[Haskell] Re: Cabal and dynamically generated files

Simon Marlow simonmarhaskell at gmail.com
Fri May 26 06:28:11 EDT 2006


David House wrote:

> In order to compile the Main.hs for my program, you first need to
> compile the BuildMain.hs, then run it (it will create a Main.hs). This
> is easy with Makefiles, however, I'd quite like to use Cabal for its
> Windows support and dependency handling.
> 
> This might not be easy, but could it be done? How would I go about it?

It's certainly possible, but maybe not easy.  You'll have to provide a 
pre-build hook in your Setup.lhs script that builds and runs 
BuildMain.hs.  The problem is that the Cabal libraries don't provide a 
compiler-independent way to compile a haskell module, so you'll have to 
construct the command line and run it by hand, which means you'll 
probably end up being dependent on GHC.

Ideally we should have this functionality in Cabal.  If you felt like 
adding it, that would be great.

Cheers,
	Simon


More information about the Haskell mailing list