
From the cabal autogen path file, I can access the location of the
Hi guys, I'd like to access, from within my program, the program own haddock documentation. program's data file, binaries etc. (getBinDir, getLibDir, getDataDir) but not the location of the doc. How to do that? For example on my machine: datadir = "/home/kau/.cabal/share/i386-linux-ghc-7.6.3/Nomyx-0.4.1" The documentation is generated in "/home/kau/.cabal/share/doc/i386-linux-ghc-7.6.3/Nomyx-0.4.1", but it depends on the configuration. Thanks, Corentin

Hi Corentin,
One way is to call `ghc-pkg describe Nomyx-0.4.1` and look for the
line starting with haddock-html. Or maybe look at how ghc-pkg does it
https://github.com/ghc/ghc/blob/master/utils/ghc-pkg/Main.hs.
This can fail sometimes (though perhaps not for documentation), since
you can have multiple packages with the same name and version
installed, and I don't know how you can get the ABI hash of a
dependency into a program.
Regards,
Adam
On Sun, Jan 12, 2014 at 1:11 PM, Corentin Dupont
Hi guys, I'd like to access, from within my program, the program own haddock documentation. From the cabal autogen path file, I can access the location of the program's data file, binaries etc. (getBinDir, getLibDir, getDataDir) but not the location of the doc. How to do that? For example on my machine:
datadir = "/home/kau/.cabal/share/i386-linux-ghc-7.6.3/Nomyx-0.4.1"
The documentation is generated in "/home/kau/.cabal/share/doc/i386-linux-ghc-7.6.3/Nomyx-0.4.1", but it depends on the configuration.
Thanks, Corentin
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Except Nomyx is a pure executable[1] and thus won't have a ghc package db entry.
[1]: http://hackage.haskell.org/package/Nomyx-0.4.1/Nomyx.cabal
* adam vogt
Hi Corentin,
One way is to call `ghc-pkg describe Nomyx-0.4.1` and look for the line starting with haddock-html. Or maybe look at how ghc-pkg does it https://github.com/ghc/ghc/blob/master/utils/ghc-pkg/Main.hs.
This can fail sometimes (though perhaps not for documentation), since you can have multiple packages with the same name and version installed, and I don't know how you can get the ABI hash of a dependency into a program.
Regards, Adam
On Sun, Jan 12, 2014 at 1:11 PM, Corentin Dupont
wrote: Hi guys, I'd like to access, from within my program, the program own haddock documentation. From the cabal autogen path file, I can access the location of the program's data file, binaries etc. (getBinDir, getLibDir, getDataDir) but not the location of the doc. How to do that? For example on my machine:
datadir = "/home/kau/.cabal/share/i386-linux-ghc-7.6.3/Nomyx-0.4.1"
The documentation is generated in "/home/kau/.cabal/share/doc/i386-linux-ghc-7.6.3/Nomyx-0.4.1", but it depends on the configuration.
Thanks, Corentin
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

In fact, the documentation location I am interrested in is a library
(Nomyx-Language). Sorry, I should have mentionned that!
I want to access the documentation of Nomyx-Language from Nomyx.
On Sun, Jan 12, 2014 at 10:46 PM, Roman Cheplyaka
Except Nomyx is a pure executable[1] and thus won't have a ghc package db entry.
[1]: http://hackage.haskell.org/package/Nomyx-0.4.1/Nomyx.cabal
Hi Corentin,
One way is to call `ghc-pkg describe Nomyx-0.4.1` and look for the line starting with haddock-html. Or maybe look at how ghc-pkg does it https://github.com/ghc/ghc/blob/master/utils/ghc-pkg/Main.hs.
This can fail sometimes (though perhaps not for documentation), since you can have multiple packages with the same name and version installed, and I don't know how you can get the ABI hash of a dependency into a program.
Regards, Adam
On Sun, Jan 12, 2014 at 1:11 PM, Corentin Dupont
wrote: Hi guys, I'd like to access, from within my program, the program own haddock documentation. From the cabal autogen path file, I can access the location of the
* adam vogt
[2014-01-12 14:45:48-0500] program's data file, binaries etc. (getBinDir, getLibDir, getDataDir) but not the location of the doc. How to do that? For example on my machine:
datadir = "/home/kau/.cabal/share/i386-linux-ghc-7.6.3/Nomyx-0.4.1"
The documentation is generated in "/home/kau/.cabal/share/doc/i386-linux-ghc-7.6.3/Nomyx-0.4.1", but it depends on the configuration.
Thanks, Corentin
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

On 12/01/14 22:52, Corentin Dupont wrote:
In fact, the documentation location I am interrested in is a library (Nomyx-Language). Sorry, I should have mentionned that! I want to access the documentation of Nomyx-Language from Nomyx.
If you use "ghc-pkg field somepackage haddock-html" then you have to deal with a few cases: * somepackage is a system package (e.g. installed with apt-get on Linux). * somepackage is a user cabal package (in ~/.cabal). * somepackage is in a cabal sandbox (could be anywhere). * what else? I found this page helpful: http://www.vex.net/~trebla/haskell/sicp.xhtml http://www.vex.net/%7Etrebla/haskell/sicp.xhtml Cheers, -- Carlo Hamalainen http://carlo-hamalainen.net

On Sun, Jan 12, 2014 at 4:46 PM, Roman Cheplyaka
Except Nomyx is a pure executable[1] and thus won't have a ghc package db entry.
Are we at the point where pure executables should be refactored into (possibly dummy) libraries just to get around this weakness of cabal? -- brandon s allbery kf8nh sine nomine associates allbery.b@gmail.com ballbery@sinenomine.net unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net
participants (5)
-
adam vogt
-
Brandon Allbery
-
Carlo Hamalainen
-
Corentin Dupont
-
Roman Cheplyaka