Combining GHC library and Platform documentation

Hi, I followed the instructions to install GHC from pre-compiled binaries and the Haskell Platform from source (http://www.vex.net/~trebla/haskell/haskell-platform.xhtml). It works fine (i.e. ghc, ghci, etc.), but the GHC and platform library documentation are in different directories, even when I give the same --prefix and --docdir argument to their respective configure scripts. Also, the GHC index.html file only refers to its own libraries; there's no mention of the other libraries included with the platform. Is there a simple way to create one index.html file with links to all the documentation? As a bonus, is it possible to do the same thing with libraries that I install with cabal? - Globules P.S. This is on Kubuntu. I'm installing it myself, rather than using apt-get, in order to get the most recent version of the platform.

On Tue, Jul 19, 2011 at 05:51:31AM +0000, Mister Globules wrote:
Hi,
I followed the instructions to install GHC from pre-compiled binaries and the Haskell Platform from source (http://www.vex.net/~trebla/haskell/haskell-platform.xhtml).
It works fine (i.e. ghc, ghci, etc.), but the GHC and platform library documentation are in different directories, even when I give the same --prefix and --docdir argument to their respective configure scripts. Also, the GHC index.html file only refers to its own libraries; there's no mention of the other libraries included with the platform.
Is there a simple way to create one index.html file with links to all the documentation?
As a bonus, is it possible to do the same thing with libraries that I install with cabal?
- Globules
P.S.
This is on Kubuntu. I'm installing it myself, rather than using apt-get, in order to get the most recent version of the platform.
Hopefully you have a script installed, as part of ghc itself, called gen_contents_index. It's what we in Arch use to update the index.html file when installing/removing Haskell packages. I'm not sure it already supports privately installed packages, but hopefully it won't be too difficult to modify. /M -- Magnus Therning OpenPGP: 0xAB4DFBA4 email: magnus@therning.org jabber: magnus@therning.org twitter: magthe http://therning.org/magnus I invented the term Object-Oriented, and I can tell you I did not have C++ in mind. -- Alan Kay

Magnus Therning
On Tue, Jul 19, 2011 at 05:51:31AM +0000, Mister Globules wrote:
[...] Is there a simple way to create one index.html file with links to all the documentation?
As a bonus, is it possible to do the same thing with libraries that I install with cabal?
- Globules [...]
Hopefully you have a script installed, as part of ghc itself, called gen_contents_index. It's what we in Arch use to update the index.html file when installing/removing Haskell packages. I'm not sure it already supports privately installed packages, but hopefully it won't be too difficult to modify.
/M
Thanks Magnus, I found the script. Based on its behaviour in the no-args case (I didn't look too closely at --inplace) I wrote a similar script that allows me to specify multiple directories on the command-line. So, I can specify the GHC, platform and my personal libraries. In case anyone finds it useful I've appended it below. (Hopefully, it will make it through relatively unscathed.) - Globules The following script is in the public domain. #!/bin/sh -eu # # Generate HTML contents and an index for Haskell libraries. # # WARNING: May not handle whitespace, etc. in paths. # # Run this command from the directory in which you want index.html created. The # package directory arguments can be relative or absolute paths. # # Usage: # # mkhaskellhtml pkg_dir ... # # Example - GHC and platform docs: # # cd /local/pkg/ghc-7.0.3/share/doc/ghc/html/libraries # mkhaskellhtml . /local/pkg/haskell-platform-2011.2.0.1/share/doc # # Example - GHC, platform and user package docs: # # cd /local/pkg/ghc-7.0.3/share/doc/ghc/html/libraries # mkhaskellhtml . /local/pkg/haskell-platform-2011.2.0.1/share/doc ~/.cabal/share/doc # # The default GHC home directory, if the GHC_HOME variable is not set. GHC_DFL=/local/pkg/ghc-7.0.3 # Exclude the GHC API. If you want the GHC API use cat instead. filter_ghc_api () { grep -v 'ghc\.haddock$' # cat } PATH=${GHC_HOME:-$GHC_DFL}/bin:/bin:/usr/bin if [ $# -lt 1 ]; then echo Too few arguments. 1>&2 echo Usage: $(basename $0) pkg_dir ... 1>&2 exit 1 fi ris=$(find "$@" -type f -name \*.haddock | filter_ghc_api | while read hdk ; do echo --read-interface=${hdk%/*.haddock},$hdk done) [ -z "$ris" ] && { echo 'No packages found!'; exit 0; } haddock \ --gen-index \ --gen-contents \ -o . \ -t "Haskell Hierarchical Libraries" \ -p prologue.txt \ $ris

You might also look into docidx[1], on github for a while and recently released on Hackage. It's a neat little tool. It does all the hard work for you. :D [1]http://hackage.haskell.org/package/docidx-1.0.1 On Jul 20, 2011, at 2:36 AM, Mister Globules wrote:
Magnus Therning
writes: On Tue, Jul 19, 2011 at 05:51:31AM +0000, Mister Globules wrote:
[...] Is there a simple way to create one index.html file with links to all the documentation?
As a bonus, is it possible to do the same thing with libraries that I install with cabal?
- Globules [...]
Hopefully you have a script installed, as part of ghc itself, called gen_contents_index. It's what we in Arch use to update the index.html file when installing/removing Haskell packages. I'm not sure it already supports privately installed packages, but hopefully it won't be too difficult to modify.
/M
Thanks Magnus, I found the script. Based on its behaviour in the no-args case (I didn't look too closely at --inplace) I wrote a similar script that allows me to specify multiple directories on the command-line. So, I can specify the GHC, platform and my personal libraries.
In case anyone finds it useful I've appended it below. (Hopefully, it will make it through relatively unscathed.)
- Globules
The following script is in the public domain.
#!/bin/sh -eu # # Generate HTML contents and an index for Haskell libraries. # # WARNING: May not handle whitespace, etc. in paths. # # Run this command from the directory in which you want index.html created. The # package directory arguments can be relative or absolute paths. # # Usage: # # mkhaskellhtml pkg_dir ... # # Example - GHC and platform docs: # # cd /local/pkg/ghc-7.0.3/share/doc/ghc/html/libraries # mkhaskellhtml . /local/pkg/haskell-platform-2011.2.0.1/share/doc # # Example - GHC, platform and user package docs: # # cd /local/pkg/ghc-7.0.3/share/doc/ghc/html/libraries # mkhaskellhtml . /local/pkg/haskell-platform-2011.2.0.1/share/doc ~/.cabal/share/doc #
# The default GHC home directory, if the GHC_HOME variable is not set. GHC_DFL=/local/pkg/ghc-7.0.3
# Exclude the GHC API. If you want the GHC API use cat instead. filter_ghc_api () { grep -v 'ghc\.haddock$' # cat }
PATH=${GHC_HOME:-$GHC_DFL}/bin:/bin:/usr/bin
if [ $# -lt 1 ]; then echo Too few arguments. 1>&2 echo Usage: $(basename $0) pkg_dir ... 1>&2 exit 1 fi
ris=$(find "$@" -type f -name \*.haddock | filter_ghc_api | while read hdk ; do echo --read-interface=${hdk%/*.haddock},$hdk done)
[ -z "$ris" ] && { echo 'No packages found!'; exit 0; }
haddock \ --gen-index \ --gen-contents \ -o . \ -t "Haskell Hierarchical Libraries" \ -p prologue.txt \ $ris
_______________________________________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/mailman/listinfo/beginners
Jack Henahan jhenahan@uvm.edu == Computer science is no more about computers than astronomy is about telescopes. -- Edsger Dijkstra ==
participants (3)
-
Jack Henahan
-
Magnus Therning
-
Mister Globules