
Marc Weber wrote:
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 -> ...
Hoogle unfortunately doesn't do that very well, although that would be a great feature. But I think that Text.XML.HaXml isn't indexed by Hoogle anyway?
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)
Eh? These two are different types, you have to pack and unpack to convert between. But note that this most likely voids the performance gains from ByteString . In other words, if a library function needs a String , there's not much you can do. However, Henning Thielemann reported that his use of HaXml (I think) for the parallel web (see http://haskell.org/haskellwiki/Monad#Fun) works well with Strings. Regards, apfelmus