[Haskell-cafe] Combining databases from packages installed with cabal install

Marco Túlio Pimenta Gontijo marcotmarcot at gmail.com
Tue Aug 21 17:55:51 CEST 2012


Hi.

I'm configuring haddock via cabal install (see [0]) to build the
hoogle database.  The database is being installed in
~/.cabal/share/doc/$package-$version/html/$package.txt, but is not
being combined with the default database.  That is, if right after the
installation I try to search with the hoogle command for some a
function, it will not work.  I wrote the following script, which I
called cabal-install:

    #!/bin/sh

    set -e
    set -x

    cabal \
        install \
        --enable-documentation \
        --enable-library-profiling \
        --haddock-hyperlink-source \
        --haddock-hoogle \
        --haddock-html \
        "$@"

    cd ~/.cabal/share/hoogle-4.2.13/databases/
    for file in ~/.cabal/share/doc/*/html/*.txt
    do
        hoo=`echo $file | sed 's/.txt$/.hoo/;s#.*/##'`
        if [ ! -f $hoo ]
        then
            hoogle convert $file $hoo || true
            hoogle combine default.hoo $hoo -o /tmp/cabal-install-$$.hoo
            mv /tmp/cabal-install-$$.hoo default.hoo
        fi
    done

Basically, it searches for .txt hoogle databases installed that were not
combined yet with the default database, and combines them.  I think it would be
good if this was the default behaviour of cabal install when called with
--haddock-hoogle.  Is this a bug?

Greetings.

0: http://hackage.haskell.org/trac/hackage/ticket/517

-- 
marcot
http://marcot.eti.br/



More information about the Haskell-Cafe mailing list