UweSchmidt/hxt — pull request #19 by m0davis (2014-03-22 01:38:27+00:00)
Title: Using (the more generic) XmlNode in place of XmlTree

Consider the situation of walking a NavXmlTree and filtering on nodes having certain properties (say, in their names). The current type signatures require sprinkling ```withoutNav``` throughout the code:

```haskell
withNav $ returnA
>>> someMovementArrows
>>> filterA (withoutNav $ hasName "somename")
>>> someMoreMovementArrows
```

By changing the type signature of ```hasName``` from ```String -> a XmlTree XmlTree``` to ```XmlNode xn => String -> a xn xn```, we avoid the need for the ```withoutNav``` call. This patch generalizes ```hasName``` as well as many others.

Most of the changes to ```Text.XML.HXT.Arrow.XmlArrow``` are pretty simple. The generalization of ```changeAttrValue``` was more complex. To get it to work on an arrow of ```XmlNode```s, I needed to make xshow accept such an arrow, which in turn required generalizing ```Text.XML.HXT.DOM.ShowXml.xshow```. I chose to go about this by creating a ```ToXmlTree``` class for use in place of XmlTree (when conversion from an ```XmlNavTree``` is desired).

This is admittedly a bit too specific: why not a ```ToNTree``` class instead? Simply because it would have required adding a ```ToXNode``` class and I was tired of adding classes. If this patch is well-received, I'll have a look at further generalizations.