Why some functions are not visible in Hoogle? Example: ppTopElement
ppTopElement :: Element -> String
-- Defined in `Text.XML.Light.Output'
Is it a bug?
Workaround: go to FPcomplete instead.
haskell.org's Hoogle (http://www.haskell.org/hoogle/) is quite selective about what it searches, whereas FP Complete's hoogle at https://www.fpcomplete.com/hoogle searches more fully:
Search more widely than haskell.org's hoogle
https://www.fpcomplete.com/hoogle?q=ppTopElement&env=ghc-7.4.2-stable-13.09
Searched for: ppTopElement
ppTopElement :: Element -> String
xml Text.XML.Light.Output
Pretty printing renders XML documents faithfully, with the exception that whitespace may be added/removed in non-verbatim character data.
Search more flexibly than hayoo
Being a hoogle rather than a hayoo, you can search by type, partial type, partial name, misordered type etc. For instance, searching for Element -> String gives lots of functions, some showing, some pretty printing, some just doing the top element.
Aside: there's a lovely online IDE
BTW, Their online IDE is superb (click on the homepage https://www.fpcomplete.com/ and scroll down to Start a Project). It's slick, pretty, and you can add dependencies easily without tedious cabal install problems. I've been tempted to even use it at home where I have ghc installed!
You may want to try Hayoo for that.
Hayoo will search all packages from Hackage, including all function and type definitions. Hoogle only searches on standard Haskell libraries.
Also Hayoo can be queried from Emacs in haskell-mode.
Related
Hackage is great and always be the first place to study how function to be defined and used of specific package.
However, frequently, we need refers multi-packages simultaneously, e.g. Control.Monad, Data.List and ... so on, and switches among of them. The easy way to do that is open mulit-tabs in chrome, but as the number of tabs grow, there are many tabs be opened and the name of package on the tab cannot be showed fully.
So, Are there exist some web sites organize Haskell packages documents like javadoc style, we can browse and select packages in right frame and show the content of document in left frame. Furthermore, it is more appreciated if it can save and list frequent use package document in another frame.
I tend to use Dash but technically that's just downloading it from Hackage, you can also build docs locally (if library has them) but I find those a little cumbersome.
I've attempted to comb the repository (oh the joys of globally used single character names) without luck, but maybe I'm looking for the wrong things.
Seeing documentation for SDL.P would probably also work.
For future reference, is there a good way to go about finding data constructors in Haskell (as they seem to be difficult to grep for in the single-character case)?
Hackage has haddocks for the sdl2 package. If you click the "Index" link, then click "P", you can find a list of all identifiers that start with that letter -- including the P data type.
http://hackage.haskell.org/package/sdl2-2.4.1.0/docs/doc-index-P.html
Is this it? It’s all I could find using stackage search within the “sdl2” package.
https://www.stackage.org/haddock/lts-12.13/sdl2-2.4.1.0/SDL-Internal-Vect.html#v:P
Edit, how I did it:
You can limit the search offered by Stackage to a single package, using the URL: https://www.stackage.org/package/PACKAGE_NAME, so in this case https://www.stackage.org/package/sdl2.
Searching for operators, put them in parentheses, such as "(.)". For your question, search for "P" like so: https://www.stackage.org/lts-12.13/hoogle?q=P&package=sdl2
In the CDT there is an "Open Element" to search for global symbols, but not in JDT.
only uses "Java search" to search, obviously not very convenient, why JDT does not provide a function like this?
Anywhere in Eclipse you can use the general File Search to search for words regardless their position in text. This search can be limited to *.java files; also the Whole word option may be relevant for this question.
If you want more precise search results, JDT offers language-aware search, but for this added precision you need to specify the kind of symbol you are interested in (Search For). Without specifying the kind, search would be very similar to plain text search.
Both CDT and JDT use an index for search. The CDT index is said to be faster, because it is more complete, whereas JDT search needs to operate in two phases: index based match candidates plus exact matching using resolved AST. In fact, efforts have started, to port the concept of the more complete CDT index also to JDT for improved search speed. As of Oxygen, however, this effort has not been completed.
Anyone seeing substantial benefit in allowing to search for more than one kind at a time is invited to chime in at Bug 221081.
I’m running racket as a repl (with xrepl), and I’m able to use ,doc to see some relevant documentation (almost awesome), but it fires up a web browser to see the documentation. I’d like to be able to see the docs right in the repl, similarly to how it’s presented in other repls (R, Clojure, ipython, pry, etc). Is this possible?
E.g., in Clojure’s lein repl, one can do:
user=> (doc map)
-------------------------
clojure.core/map
([f coll] [f c1 c2] [f c1 c2 c3] [f c1 c2 c3 & colls])
Returns a lazy sequence consisting of the result of applying ...
It would also be great to be able to see source ((source map) in clojure), but I haven’t seen any hints of this being available.
I happen to be using Vim (with slime/tmux), so any Vim-based solution would also work, probably tied to its K built-in help.
I'm not sure this is practical given the nature of Racket documentation.
The help deliverable is HTML.
Unlike Clojure (or Emacs Lisp), Racket doesn't have doc strings in the function definition source.
Racket docs don't have a convention like the one that the first line of a doc string should be a summary (a short-version to use in situations like a list of commands or in a REPL).
You can try xrepl's ,desc <id> command. Starting in Racket 6.1.1, if the function has installed documentation, it will print a rendering of the "blue box" -- the function signature with contracts and/or types. In many cases that's all you need, say to jog your memory. However there is no text describing the item. And if there is no installed help for a function, it won't attempt to show you anything based on the function's definition source.
So for example in racket-mode for Emacs, there is a racket-describe command and it does not fire up a browser -- but it shows the full HTML help (if any) using shr in a separate Emacs buffer. If there is no help, it does try to find the source and extract a contract/type and signature to show you. But again, there is no doc string in that source, to find, much less a one-line summary to show neatly in a REPL.
There are vim fans using Racket; the ones I know are use evil-mode in Emacs and feel it's the best of both worlds. However I appreciate that's not your current workflow using multiple languages, so I'm not proposing that as the solution for you.
I put together VROD, a solution that parses the reference documentation into something that Vim can work with. This provides essentially what you can get from clojure's doc built-in help, but through Vim’s K-help. And it also does some highlighting and shows examples.
(It also happens to do auto-completion of functions.)
everyone, i'm pretty new to haskell. i was a c++ programmer.
how to find a detailed list of functions in a particular module such like in the default "prelude" module? and how to find out how these functions work in ghci environment?
ie. is there a command to find out all functions in "Prelude"?
Thanks.
how to find a detailed list of
functions in a particular module such
like in the default "prelude" module?
Typing :browse <Module> into GHCi will produce a list of all (exported) functions in a module with their type signatures. For the Prelude and other standard modules such as Data.List or Control.Monad, the names and type signatures should provide good insight into the functionality you can squeeze out of it. Second, you can browse the standard library and source on hackage.haskell.org. Third, GHCi on Acid (an extension to GHCi which you can cabal-install) gives you commands like :source and :doc, providing a direct link to the source code and documentation for a module; and :hoogle, which performs a Hoogle search on a given argument.
and how to find out how these
functions work in ghci environment
Try them out and study the source code. Since you can evaluate functions interactively in GHCi, you can get a feel for how functions behave; since you can read their source, you can get an exact definition of their behavior.
A nice starting point for this is Hoogle. http://haskell.org/hoogle/ Just type Prelude in the search box for example, it's a quite good resource with a lot of examples on using Haskell's features.