haddock suggestion -- %{FILE}

Conal Elliott conal at conal.net
Tue Jan 9 12:32:02 EST 2007

The only pre-processing is what's caused by using the cabal directive
"Extensions: CPP".   Using "./setup haddock --verbose ...", I get lines like

c:\ghc\ghc-6.6\bin\ghc.exe -E -cpp -optP-P -o
dist\build\tmp\src\Graphics\UI\TV\Input.hs src\Graphics\UI\TV\Input.hs
-Dmingw32_BUILD_OS -Dmingw32_HOST_OS -Di386_BUILD_ARCH -Di386_HOST_ARCH

When I try this preprocessing myself, I find that I *do not* get the Haskell
line pragma:

bash-3.2$ ghc -E -cpp -optP-P -o z src/Graphics/UI/TV/Input.hs
-Dmingw32_BUILD_OS -Dmingw32_HOST_OS -Di386_BUILD_ARCH -Di386_HOST_ARCH
-D__GLASGOW_HASKELL__=606 -D__HADDOCK__; head -3 z
{-# OPTIONS -fglasgow-exts -cpp #-}


Fiddling with flags, I see that -optP-P is the culprit.  Removing it:

bash-3.2$ ghc -E -cpp -o z src/Graphics/UI/TV/Input.hs -Dmingw32_BUILD_OS
-Dmingw32_HOST_OS -Di386_BUILD_ARCH -Di386_HOST_ARCH
-D__GLASGOW_HASKELL__=606 -D__HADDOCK__; head -3 z
# 1 "src/Graphics/UI/TV/Input.hs"
# 1 "<built-in>"
# 1 "<command line>"

Any ideas?  - Conal

On 1/9/07, Duncan Coutts <duncan.coutts at worc.ox.ac.uk> wrote:
> (oops, I meant to reply to the list as well as to Conal)
> On Mon, 2007-01-08 at 22:26 -0800, Conal Elliott wrote:
> > I pre-process my source code before handing to haddock.  The %{FILE}
> > directive for --source-comments etc uses the actual preprocessed file
> > name rather than the the original, which is not what I want.  Is this
> > just an oversight?
> If your pre-processor uses the C or Haskell line pragmas then haddock
> (as of version 0.8) will know the original file name and the links to
> source will work (I've tested it).
> So the question is, what pre-processor are you using, and how can we
> persuade it to emit C or Haskell line pragmas. cpp can do it, as can
> cpphs, hsc2hs, c2hs, alex, happy etc.
> It may be that they don't all do it by default at the moment, or that
> Cabal doesn't instruct them to do it by default. Previous versions of
> haddock didn't cope with C style line pragmas iirc so I think they used
> to be disabled for cpp/cpphs.
> Duncan
> _______________________________________________
> Libraries mailing list
> Libraries at haskell.org
> http://www.haskell.org/mailman/listinfo/libraries
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/libraries/attachments/20070109/d3a91c64/attachment-0001.htm

More information about the Libraries mailing list