[Haskell-cafe] Hackage/Cabal/Haddock question

Robert Greayer robgreayer at yahoo.com
Fri Nov 21 12:31:24 EST 2008

How does Hackage run 'haddock' on uploaded packages?  I had assumed it directly runs the cabal 'haddock' target, e.g.

runhaskell Setup.hs haddock

but it appears to perhaps be more complex than that.

Some backrgound --

haddock doesn't seem to like quasiquotation - running haddock on a source tree that includes quasiquotations eventually results in:

haddock: internal Haddock or GHC error: Maybe.fromJust: Nothing

(eliminating the code that contains [$xxx|....] constructs gets rid of the error.)

so "runhaskell Setup.hs haddock" ends up not generating any documentation.  I worked around this problem by using a 'UserHook' and adding in an extra path element to the source path prior to running haddock via Cabal:

> main = defaultMainWithHooks (simpleUserHooks {
>     preHaddock = \_ _ -> return (Just $ emptyBuildInfo { hsSourceDirs = ["noqqsrc"]},[]) })

The additional directory contains an alternate version of modules that don't contain quasiquotation (just types and stubs), which seems to hide the versions that do.  This works fine locally, but not on hackage (still get the same behavior in the build failure log).  Of course, I'd prefer not to have to do this at all, so if anyone knows a way around the problem (or if its purely my problem -- I'm doing something wrong), I'd appreciate hearing about it.

I'm using GHC 6.10.1, and have tried setup haddock with both the shipped-with-ghc version of haddock and the latest version.



More information about the Haskell-Cafe mailing list