qwfy / doc-browser

A documentation browser with support for DevDocs, Dash and Hoogle, written in Haskell and QML

Repository from Github https://github.comqwfy/doc-browserRepository from Github https://github.comqwfy/doc-browser

Ask any questions you may have about Hoogle

ndmitchell opened this issue · comments

I see you are planning Hoogle integration. Please feel free to reach out with any questions about it.

Similarly, once it's done, let me know and I can put a link from the Hoogle repo.

Wow, Thanks for the great Hoogle :)

I do have a few questions about hoogle.

A. The biggest question is that, is hoogle 5 suitable for daily use? I get mixed information about this:

I see this big warning on hoogle.haskell.org:

image

I presume that this warning is only for the web interface and not for the command line interface, since hoogle '[a] -> Int -> [a]' does work, am I correct?

Also there is a warning in the project's readme says something like "this is the development version of hoogle 5", and a few OSes ships hoogle 5 already.

B. If I download this archive, (found at https://www.stackage.org/lts-10.8), and unpack it to a directory, say /some-directory/lts-10.8, which will have a structure like this:

lts-10.8
├── abstract-deque-0.3
│   ├── abstract-deque.haddock
│   ├── abstract-deque.txt
│   ├── Data-Concurrent-Deque-Class.html
│   ├── Data-Concurrent-Deque-Debugger.html
│   ├── Data-Concurrent-Deque-Reference-DequeInstance.html
│   ├── Data-Concurrent-Deque-Reference.html
│   ├── doc-index.html
│   ├── haddock-util.js
│   ├── hslogo-16.png
│   ├── index.html
│   ├── LICENSE
│   ├── minus.gif
│   ├── ocean.css
│   ├── plus.gif
│   ├── src
│   │   ├── Data.Concurrent.Deque.Class.html
│   │   ├── Data.Concurrent.Deque.Debugger.html
│   │   ├── Data.Concurrent.Deque.Reference.DequeInstance.html
│   │   ├── Data.Concurrent.Deque.Reference.html
│   │   ├── highlight.js
│   │   └── style.css
│   └── synopsis.png
├── abstract-deque-tests-0.3
│   ├── abstract-deque-tests.haddock
│   ├── abstract-deque-tests.txt
│   ├── Data-Concurrent-Deque-Tests.html
│   ├── doc-index.html
│   ├── haddock-util.js
│   ├── hslogo-16.png
│   ├── index.html
│   ├── LICENSE
│   ├── minus.gif
│   ├── ocean.css
│   ├── plus.gif
│   ├── src
│   │   ├── Data.Concurrent.Deque.Tests.html
│   │   ├── highlight.js
│   │   └── style.css
...omitted

and generate a database with

hoogle generate --database lts-10.8.hoo --local=lts-10.8

and then query with Hoogle.searchDatabase, which will give results like this:

[ Target { targetURL = "file:///some-directory/lts-10.8/base-4.10.1.0/Prelude.html#v:id"
         , targetPackage = Just ("base","file:///some-directory/lts-10.8/base-4.10.1.0/")
         , targetModule = Just ("Prelude","file:///some-directory/lts-10.8/base-4.10.1.0/Prelude.html")
         , targetType = ""
         , targetItem = "<span class=name><0>id</0></span> :: a -&gt; a"
         , targetDocs = "Identity function.\n"
         }]

Should I consider this (the behaviour that prefixing url with file:///some-directory) a documented behaviour or an implementation detail?

Can I rely on the format of the targetItem? Ideally I want to parse it to an ADT, so I can display it differently (from the html format).

  • Hoogle 5 is the future and I'd recommend it. It has a few rough edges relative to Hoogle 4. I suggest you integrate with Hoogle 5.
  • Yes, prefixing the somedirectory is documented behaviour (it has to work that way so it can display documentation when run from toher directories).
  • For TargetItem, you can rely on the data type - it's public and intended for consumption. It may change in the future, but I have no plans to do so.

The Hoogle has landed. A screenshot is available here

Awesome! I've added a link to the Hoogle README at https://github.com/ndmitchell/hoogle#others. The readme is a bit of a mess, so it is more making sure there is a placeholder so I don't forget about it when I give the manual a rewrite.