[Haskell-beginners] Combining GHC library and Platform documentation

Jack Henahan jhenahan at uvm.edu
Sat Jul 23 05:09:37 CEST 2011


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 <magnus <at> therning.org> 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 at haskell.org
> http://www.haskell.org/mailman/listinfo/beginners

Jack Henahan
jhenahan at uvm.edu
==
Computer science is no more about computers than astronomy is about telescopes.
-- Edsger Dijkstra
==
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 398E692F.gpg
Type: application/x-apple-msg-attachment
Size: 17822 bytes
Desc: not available
URL: <http://www.haskell.org/pipermail/beginners/attachments/20110722/4445a6de/attachment-0001.bin>
-------------- next part --------------


-------------- next part --------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 881 bytes
Desc: This is a digitally signed message part
URL: <http://www.haskell.org/pipermail/beginners/attachments/20110722/4445a6de/attachment-0001.pgp>


More information about the Beginners mailing list