getting cabal to pass more info to haddock

I want Cabal to pass the source-module and source-entity flags to haddock. I can probably figure out how to add these flags into the Cabal source (following the example of --hoogle), but I wonder if there's a better way. Any suggestions? If source mod, is there a process for me to follow? To whom would I send the patch? Thanks, - Conal

On Sun, 2007-01-07 at 10:42 -0800, Conal Elliott wrote:
I want Cabal to pass the source-module and source-entity flags to haddock. I can probably figure out how to add these flags into the Cabal source (following the example of --hoogle), but I wonder if there's a better way. Any suggestions?
runhaskell Setup.hs configure --haddock-args="--source-module=..."
If source mod, is there a process for me to follow? To whom would I send the patch?
If you use 'darcs send' to send in your patch then it should just work, the address has already been set. If darcs send doesn't work for you (eg if you've not got local mail working) then you can email it to the cabal-devel@haskell.org mailing list. Duncan

Thanks. Looks simple enough, and I compiled up a version that works this
way. I don't know how to get ghc to use it. When I "./setup install", I
get Cabal-1.1.7 registered, but my ghc-6.6 wants to use Cabal-1.1.6instead.
Worse, I unregistered 1.1.6, and now I can't use cabal at all with ghc. Do
you know how get 1.1.6 back short of re-installing ghc?
BTW, I noticed in the function "haddock" in Distribution.Simple, the line
"++ programArgs confHaddock", which leads me to suspect that there's an
approach getting extra Haddock arguments passed by tweaking my Setup.lhs.
Is that so?
Cheers, - Conal
On 1/7/07, Duncan Coutts
On Sun, 2007-01-07 at 10:42 -0800, Conal Elliott wrote:
I want Cabal to pass the source-module and source-entity flags to haddock. I can probably figure out how to add these flags into the Cabal source (following the example of --hoogle), but I wonder if there's a better way. Any suggestions?
runhaskell Setup.hs configure --haddock-args="--source-module=..."
If source mod, is there a process for me to follow? To whom would I send the patch?
If you use 'darcs send' to send in your patch then it should just work, the address has already been set. If darcs send doesn't work for you (eg if you've not got local mail working) then you can email it to the cabal-devel@haskell.org mailing list.
Duncan

On Sun, 2007-01-07 at 12:32 -0800, Conal Elliott wrote:
Thanks. Looks simple enough, and I compiled up a version that works this way. I don't know how to get ghc to use it. When I "./setup install", I get Cabal-1.1.7 registered, but my ghc-6.6 wants to use Cabal-1.1.6 instead.
Try cleaning and rebuilding your prog, you've probably got existing .hi files that refer to the older package version. That or perhaps you are using other packages that were built against Cabal-1.1.6, eg the ghc api package. You can force ghc to use a specific version using "ghc -package Cabal-1.1.7" and see what it complains about.
Worse, I unregistered 1.1.6, and now I can't use cabal at all with ghc. Do you know how get 1.1.6 back short of re-installing ghc?
You can re-register the old version, though I'm not sure where you can get the right package.conf file from. If you built from source you can grab the file from the build tree. If you installed from a distro package then re-installing that should be easy.
BTW, I noticed in the function "haddock" in Distribution.Simple , the line "++ programArgs confHaddock", which leads me to suspect that there's an approach getting extra Haddock arguments passed by tweaking my Setup.lhs. Is that so?
Ask on the cabal-devel list, I'm not sure without delving into the code. Duncan

It was indeed an old .hi file. Thanks! - Conal
On 1/7/07, Duncan Coutts
On Sun, 2007-01-07 at 12:32 -0800, Conal Elliott wrote:
Thanks. Looks simple enough, and I compiled up a version that works this way. I don't know how to get ghc to use it. When I "./setup install", I get Cabal-1.1.7 registered, but my ghc-6.6 wants to use Cabal-1.1.6 instead.
Try cleaning and rebuilding your prog, you've probably got existing .hi files that refer to the older package version. That or perhaps you are using other packages that were built against Cabal-1.1.6, eg the ghc api package. You can force ghc to use a specific version using "ghc -package Cabal-1.1.7" and see what it complains about.
Worse, I unregistered 1.1.6, and now I can't use cabal at all with ghc. Do you know how get 1.1.6 back short of re-installing ghc?
You can re-register the old version, though I'm not sure where you can get the right package.conf file from. If you built from source you can grab the file from the build tree. If you installed from a distro package then re-installing that should be easy.
BTW, I noticed in the function "haddock" in Distribution.Simple , the line "++ programArgs confHaddock", which leads me to suspect that there's an approach getting extra Haddock arguments passed by tweaking my Setup.lhs. Is that so?
Ask on the cabal-devel list, I'm not sure without delving into the code.
Duncan

I gave Cabal a --haddock-arg flag (use one per haddock argument), so now I
can have a make rule like:
haddock: config
./setup haddock --haddock-arg="--source-base=
http://darcs.haskell.org/packages/TV"
--haddock-arg='--source-module=src/%{MODULE/.//}.html'
--haddock-arg='--source-entity=src/%{MODULE/.//}.html#%{NAME}'
Works fine so far. I'd like feedback on the interface before darcs-sending
the patch.
I started with a --haddock-args flag to hold any number of haddock options,
but the arguments then got passed as a single argument to haddock, which
then couldn't make sense of them. So instead, you use one --haddock-arg
flag per haddock flag.
I'd also like some suggestions on the following:
For syntax coloring and anchoring, I use this rule, gleaned Malcolm's
hscolour page (http://www.cs.york.ac.uk/fp/darcs/hscolour):
hscolour:
for file in $(sources); \
do HsColour -anchorHTML $$file >$(doc)/`dirname $$file`/`basename
$$file .hs`.html; \
done
It's a pain, though, as I have to make sure the required directories are all
present. For that purpose, I have this rule:
# Make the doc directories we need.
colorPrep:
if [ ! -d $(doc)/src/Graphics/UI/TV ]; then mkdir
$(doc)/src{,/Graphics{,/UI{,/TV}}}; fi
And I have to remember to do "make colorPrep" before "make hscolour". Not
very convenient especially if my package's module hierarchy branches.
Comments?
- Conal
On 1/7/07, Duncan Coutts
On Sun, 2007-01-07 at 10:42 -0800, Conal Elliott wrote:
I want Cabal to pass the source-module and source-entity flags to haddock. I can probably figure out how to add these flags into the Cabal source (following the example of --hoogle), but I wonder if there's a better way. Any suggestions?
runhaskell Setup.hs configure --haddock-args="--source-module=..."
If source mod, is there a process for me to follow? To whom would I send the patch?
If you use 'darcs send' to send in your patch then it should just work, the address has already been set. If darcs send doesn't work for you (eg if you've not got local mail working) then you can email it to the cabal-devel@haskell.org mailing list.
Duncan
participants (2)
-
Conal Elliott
-
Duncan Coutts