[Haskell-cafe] Navigating Haddock

Marc Weber marco-oweber at gmx.de
Sun Aug 5 19:12:41 EDT 2007


On Sun, Aug 05, 2007 at 03:19:25PM -0700, David Pollak wrote:
>    Howdy,
>    As I'm starting to learn the Haskell libraries, I'm having a less than
>    fun time trying to figure out what functions operate on what types.
>    For example, in the documentation for HaXml, there's a description of
>    Document:
>    [1]http://www.cs.york.ac.uk/fp/HaXml/HaXml/Text-XML-HaXml-Types.html#4
>    However, I can't find any links to what functions accept document as a
>    parameter.  Am I missing some magic?
There might be better answers. Some ways to achieve what you want:
a) use hoogle (haskell.org/hoogle). You can use hoogle to find functions by types. But I don't
know haw to create a query such as ... -> Document -> ...
b) Use a file search by content tool (grep ...) to either grep the haddock
documentation or the source files.
c) Use ghci and the :browse command .. (again grep will help)
  (eg  
   $ghci -package HaXml
   :browse Text.XML.HaXml.Combinators )
  but you need to invoke this command for each module..
  You can get a list of exposed modules by querying ghc-pkg..

This kind of references might make sense on special types such as
Document, but not on types such as Int (there would be too many matches)

>    A couple of other questions...
>    Can ByteStrings be substituted anywhere that takes a String (e.g.,
>    HaXml xmlParse)?
In general yes, you should be able to use ByteStrings wherever a String
is used..
But remember that a String has some syntactic suggar becuase it's
treated as list. Thus the : operator won't work with ByteStrings (I'm
sure the module does define functions providing the same functionality)
>    Is there a way to deal with UTF-8 encoded byte arrays converting them
>    to Strings other than [2]http://www.gatago.org/fa/haskell/52409638.html
Don't know.

Marc Weber

PS:
you wrote: "accept document as a parameter"
Be careful with upper /lower case. You want the type *D*ocument here, not the argument
named document.


More information about the Haskell-Cafe mailing list