hoogle icon indicating copy to clipboard operation
hoogle copied to clipboard

doing --d wrong?

Open jfeltz opened this issue 11 years ago • 18 comments

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

jfeltz avatar Aug 08 '14 06:08 jfeltz

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

ndmitchell avatar Aug 08 '14 07:08 ndmitchell

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

jfeltz avatar Aug 08 '14 16:08 jfeltz

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.

ndmitchell avatar Aug 08 '14 16:08 ndmitchell

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.

jfeltz avatar Aug 08 '14 16:08 jfeltz

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

ndmitchell avatar Aug 08 '14 16:08 ndmitchell

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.

jfeltz avatar Aug 08 '14 16:08 jfeltz

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.

ndmitchell avatar Aug 08 '14 16:08 ndmitchell

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 avatar Aug 08 '14 17:08 jfeltz

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 avatar Aug 08 '14 17:08 jfeltz

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.

jfeltz avatar Aug 08 '14 17:08 jfeltz

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 ~.

ndmitchell avatar Aug 08 '14 18:08 ndmitchell

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)

jfeltz avatar Aug 08 '14 18:08 jfeltz

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

ndmitchell avatar Aug 08 '14 18:08 ndmitchell

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.

ndmitchell avatar Jul 19 '15 12:07 ndmitchell

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

hseg avatar Jan 23 '20 20:01 hseg

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

ndmitchell avatar Jan 24 '20 10:01 ndmitchell

This is on Hoogle 5.0.17.13

hseg avatar Jan 25 '20 18:01 hseg

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 [email protected] 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.

hseg avatar Feb 02 '20 11:02 hseg