new target ./setup plain_source?

Simon Marlow simonmarhaskell at
Tue Jul 24 04:06:20 EDT 2007

Ian Lynagh wrote:
> Hi Marc,
> On Sat, Jul 21, 2007 at 02:26:47AM +0200, Marc Weber wrote:
>> What about adding another target ./setup plain_source which should
>> preprocess everything (including cpp) and output the files to an extra
>> directory?
>> Why?
>> This could be used for haddock documentation generation (Not sure how
>> this is done)
> "Setup haddock" preprocesses the files itself if necessary.
>> and perhaps to be read by future IDE's to provide compiler
>> independent completion etc?
>> eg ./setup haddock on haddock sources itself fails on line
>>   #if defined(mingw32_HOST_OS)
>> ...
> I suspect that haddock wasn't designed to be haddocked, as it's not a
> library. If you put a "extensions: CPP" line in the top section of the
> Cabal file then you get a bit further, to a parse error in
> src/BlockTable.hs; I'm not sure what the problem is there, but it's
> certainly not pre-processor related.
> I'm also not sure why Cabal is is running haddock on modules that are
> only used in an executable, or if it's meant to do that then why it
> isn't taking into account the CPP extension of the executable.

I ran into this recently while making 'setup haddock' work on XMonad for 
Simon PJ.  The 'extensions: CPP' needs to be put in the library part of the 
.cabal file, in addition to the executable part.  And then Cabal runs 
Haddock twice: once for the (non-existent) library, and once for the 
executable.  Probably something needs to be fixed here; I guess not many 
people use 'setup haddock' on executables.


More information about the cabal-devel mailing list