ndmitchell / hoogle

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

doing --d wrong? #82

Open jfeltz opened 10 years ago

jfeltz commented 10 years ago

Puzzled by hoogle:

hoogle dump .hoogle/hoogle.hoo returns:
.. ("flag_ignoreallexports",ctor Flag) ..

hoogle --d=~/.hoogle/haddock.hoo Flag_IgnoreAllExports
No results found

hoogle --d=~/.hoogle/haddock.hoo "haddock :: [String] -> IO ()"
No results found

Hoogle v4.2.34

ndmitchell commented 10 years ago

I notice you are calling dump on hoogle.hoo then searching with haddock.hoo. Is that intentional?

jfeltz commented 10 years ago

Yes, I was trying to diagnose my problem, and I assumed it was a read only op.

ndmitchell commented 10 years ago

What did you assume was read only? All those commands are indeed read only, but they are operating on different databases, so finding something in the dump of one database, then looking for it in another, doesn't shed much light.

jfeltz commented 10 years ago

Oh ya, I see what you mean, sorry, late night I guess. Let me try this again: The first output is from:

hoogle dump .hoogle/haddock.hoo

The rest still holds. Also, the function haddock appears in the dump as well.

ndmitchell commented 10 years ago

Can you send me the .hoo file? Either attach it here (not sure if that is possible) or email to ndmitchell @ gmail.com.

jfeltz commented 10 years ago

Emailed, also just for some probably unrelated context, I'm trying to pipe my cabal config through a script that creates a hoogle db specific to cabal project dependencies.

ndmitchell commented 10 years ago

So -d takes a directory in which to search, not a database. You can find what you want with:

C:\Neil\temp>hoogle +haddock flag_ignoreallexports
Documentation.Haddock Flag_IgnoreAllExports :: Flag

C:\Neil\temp>hoogle +haddock "haddock :: [String] -> IO ()"
Documentation.Haddock haddock :: [String] -> IO ()

In your case, you might want to pass --d=~/.hoogle to say look for haddock.hoo (which you specified with +haddock) in the ~/.hoogle directory.

jfeltz commented 10 years ago

Thanks. Is there a comprehensive, accurate reference/guide to flags anywhere? This is the closest thing I've found: https://github.com/ndmitchell/hoogle/blob/974e1ea43234b3fab9edbc1346714052014abe8c/misc/hoogle.1

jfeltz commented 10 years ago

Okay, Sorry, I'm still not sure if --d is working:

jpf@dev3:~$ hoogle --d=~/.hoogle +haddock flag
Could not find some databases: haddock
Searching in:
  .
  ~/.hoogle
  /home/jpf/.cabal/share/x86_64-linux-ghc-7.8.3/hoogle-4.2.34/databases

Either the package does not exist or has not been generated
Generate more databases with: hoogle data all
Found 42 databases, including: array base bytestring cgi containers

But it does work when ran within .hoogle directory, with and without --d.

jfeltz commented 10 years ago

Also works with:

jpf@dev3:~$ hoogle --d=/home/jpf/.hoogle +haddock flag

When ran outside of .hoogle. It seems that --d doesn't like ~/ style paths.

ndmitchell commented 10 years ago

I wouldn't expect Hoogle to deal with ~/., but I would expect your shell to translate ~ to your home directory before passing it to Hoogle. If you do echo ~, echo --d=~/.hoogle and echo ~/.hoogle does it expand the ~.

jfeltz commented 10 years ago

jpf@dev3:~/.hoogle$ echo --d=~/ --d=~/

jpf@dev3:~/.hoogle$ echo ~ /home/jpf

jpf@dev3:~/.hoogle$ echo ~/.hoogle /home/jpf/.hoogle

jpf@dev3:~/.hoogle$ bash --version GNU bash, version 4.3.11(1)-release (x86_64-pc-linux-gnu)

ndmitchell commented 10 years ago

Typing --d ~/.hoogle might be a way around that then.

ndmitchell commented 9 years ago

Looking back, I don't know what I was thinking - those flags are semantics are insane - sorry! I've made the new version take a single flag for the name of the database, and it doesn't monkey around with the name, its just a file.

hseg commented 4 years ago

Still unclear how to use a custom directory - -d and --d both fail to work with a moved directory.

ndmitchell commented 4 years ago

I'd recommend using Hoogle 5, which operates entirely differently - Hoogle 4 is now unsupported.

hseg commented 4 years ago

This is on Hoogle 5.0.17.13

hseg commented 4 years ago

By the fact the issue is still open, thought it was still relevant to Hoogle 5. Can't find relevant docs though.

On 24 January 2020 12:45:16 GMT+02:00, Neil Mitchell notifications@github.com wrote:

I'd recommend using Hoogle 5, which operates entirely differently - Hoogle 4 is now unsupported.

-- You are receiving this because you commented. Reply to this email directly or view it on GitHub: https://github.com/ndmitchell/hoogle/issues/82#issuecomment-578079870

-- Sent from my Android device with K-9 Mail. Please excuse my brevity.