ndmitchell / hoogle

Haskell API search engine
http://hoogle.haskell.org/
Other
738 stars 134 forks source link

'hoogle generate' wants me to run 'hoogle generate' first #204

Closed ExpHP closed 7 years ago

ExpHP commented 7 years ago

I am running into a curious issue, where hoogle generate appears to be demanding the impossible!

$ hoogle generate
Error, database does not exist (run 'hoogle generate' first)
    Filename: /home/lampam/.hoogle/default-haskell-5.0.9.hoo

Acknowledged, the potential for PEBKAC here is high, as I find it hard to believe I'm the first to report this if this were a real issue affecting multiple users.

Things I tried

~/.hoogle

This directory does not exist, but creating it makes no difference.

rtfm || google fu

Reinstalling all cabal packages

Since I got hoogle through cabal, I tried reinstalling all cabal packages. Due to PEBKAC potential, I am including the exact steps I performed (in particular, I installed other packages alongside hoogle):

Details on purge and reinstall ``` $ rm -rf ~/.ghc $ cabal update $ # NOTE: cabal is aliased to "cabal: --require-sandbox" $ cabal --no-require-sandbox install alex idris hoogle pointful threadscope hlint (~90 minutes later, it finishes with errors installing idris) $ cabal --no-require-sandbox install hoogle Resolving dependencies... All the requested packages are already installed: hoogle-5.0.9 Use --reinstall if you want to reinstall anyway. $ ls -l `which hoogle` (timestamp was about 20 minutes old; clearly created during the reinstall) $ hoogle generate Error, database does not exist (run 'hoogle generate' first) Filename: /home/lampam/.hoogle/default-haskell-5.0.9.hoo ```


I may try again later with a more thorough purge and a more minimal reinstall.

Versions

(these versions are after the reinstall mentioned above)

$ readlink -f $(which ghc) && ghc --version
/opt/ghc/8.0.2/bin/ghc-8.0.2
# NOTE: the above comes from https://launchpad.net/~hvr/+archive/ubuntu/ghc
The Glorious Glasgow Haskell Compilation System, version 8.0.2

$ readlink -f $(which cabal) && cabal --version
/home/lampam/.cabal/bin/cabal
cabal-install version 1.24.0.1
compiled using version 1.24.1.0 of the Cabal library 

$ readlink -f $(which hoogle) && hoogle --version
/home/lampam/.cabal/bin/hoogle
Hoogle 5.0.9, http://hoogle.haskell.org/
ndmitchell commented 7 years ago

Do you have a shell alias for hoogle, which is doing something like hoogle --color when expanded? If you type hoogle generate ... then it gets treated as a command to generate - but if you do hoogle --flag generate then it expands implicitly to hoogle search --flag generate, and does a search for generate.

ExpHP commented 7 years ago

You are spot on! I set one and completely forgot about it:

$ type hoogle
hoogle is aliased to `hoogle --color --count=10'
$ \hoogle generate
Starting generate
Downloading https://www.stackage.org/lts/cabal.config... 0.85s
[...]

So I take it this behavior is working as designed? Sorry then for the issue that basically amounted to tech support (but also, thanks for the help!)

ndmitchell commented 7 years ago

No problem - it actually seems to be something a lot of people have done - you are far from the first.