
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: 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? A couple of other questions... Can ByteStrings be substituted anywhere that takes a String (e.g., HaXml xmlParse)? Is there a way to deal with UTF-8 encoded byte arrays converting them to Strings other than http://www.gatago.org/fa/haskell/52409638.html ? Thanks, David -- lift, the fast, powerful, easy web framework http://liftweb.net

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

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

Hi
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.
Wait for version 4 :-) - I've added _ 's for wildcard types, _ -> Document -> _ would give you what you want. I've also made it so a search for "Document" can give you all the types which involve document in any way.
But I think that Text.XML.HaXml isn't indexed by Hoogle anyway?
Version 4 will be capable of indexing all of hackage, so hopefully that can be done. Thanks Neil
participants (4)
-
apfelmus
-
David Pollak
-
Marc Weber
-
Neil Mitchell