Suppose I have a Haskell module named MyModule
that imports an external module like this:
import ModuleA hiding (a, b, c)
And I cannot modify this import statement, because the program is not exactly mine.
I wish to link to ModuleA.external_function
in the documentation for ModuleA
, in the comments above a function called my_function
. So the code looks something like this:
-- | my_function makes use of 'ModuleA.external_function'
my_function :: Int -> Int
Using haddock 2.10.0, and running cabal haddock
, the link to ModuleA.external_function
is generated as dist/doc/html/MyModule/ModuleA.html#v:external_function
. However, the problem is that the dist/doc/html/MyModule/ModuleA.html
file does not exist.
How can I generate a link to the docs for ModuleA
instead, like module-A-package/docs/ModuleA.html#v:external_function
. In other words, something similar to what http://hackage.haskell.org/package/text-0.11.2.0/docs/Data-Text.html has for its links to the String
type (they link to http://hackage.haskell.org/package/base-4.5.0.0/docs/Data-String.html#t:String)? Bear in mind that I cannot modify the import
statement.
Thank you.
ModuleA.someFunction
in scope then'ModuleA.someFunction'
should work just fine. Looking at your generated path, it seems thatModuleA
is in its own directory and in fact you're probably not exporting it. If it's not being exported, Haddock won't generate documentation for it. Not all is lost with that case as you can pass--ignore-all-exports
to Haddock. When usingcabal haddock
, you can use--haddock-options
to pass it in. Alternatively, put{-# OPTIONS_HADDOCK ignore-exports #-}
inMyModule
and see if that does it. – Mateusz Kowalczyk