Malcolm Wallace wrote:
Heinrich Apfelmus wrote:

Personally, I would be much happier with the slogan "HXT = XML
transformations with filters". Browsing through Manuel's thesis, I
discover that your combinators are quite slick ( >>> , choiceA , when,
guards ), it's just that they are a very specialized subset of the
general arrow combinators. I think that dropping the arrows and
rebranding your nice set of combinators as "filter combinators" would
greatly improve the library.

But then, HXT's filter combinators would return to being rather like HaXml's filter combinators, where the concept was first introduced. Personally, I'm very happy that customers avoid HXT (due to the complexity of the arrow interface), because that means more customers for HaXml... :-)

Well, having seen some HXT code, the old HaXml filters appear somewhat dusty to me. ;-)

For example, Nikiti Dimitriy's code

data MyAttr = MyAttr String String

getAttrs = deep (isElem >>> hasName "SomeTag") >>>
proc x -> do
aname <- getAttrValue "Name" -< x
atype <- getAttrValue "Type" -< x
returnA -< MyAttr aname atype

illustrates that there is no obvious way to extract non-XML values, like a pair of attribute values. I'm not keen on the proc syntax; this is best modeled as an applicative functor.

Other useful innovations that I think are worth incorporating into HaXml in some form:

*  choiceA , a nifty case statement for filters, generalizing "if then else"
* listA , a filter that returns the list of results as a single element. This is pretty much the only way to process XML files that use positional information as well (compared to nesting alone). For instance, the (old) Apple .plist format works like that

   <key>Caption</key>                 -- key
   <string>Haskell Logo</string>      -- value
   <key>Thumbnail</key>
   <string>/Volumes/Macintosh HD/</string>

(This is similar to the purpose of the + selector in CSS, e.g.  h2 + p   )


Oh, and last but not least, I think the Haddock documentation for Text.XML.HaXml.Combinators is a bit sparse. The paper should be hyperlinked from the docs, and I would very much like to see documentation for the individual filters, with laws and implementation and all.


Regards,
Heinrich Apfelmus

--
http://apfelmus.nfshost.com

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to