title: Logical OR in HXT without duplicating results
body: <p>I'm having a little trouble with <a href="http://hackage.haskell.org/package/hxt" rel="nofollow">HXT</a>: I am trying to locate all the nodes in a document that match some criteria, and I'm trying to combine the lenses/XPaths as predicates in an OR-like fashion, using <code>Control.Arrow.&lt;+&gt;</code>, as <a href="http://adit.io/posts/2012-04-14-working_with_HTML_in_haskell.html#get-multiple-values-at-once" rel="nofollow">this guide</a> suggests. However, when I try to "run" the arrow on my document, I am getting duplicate results. Is there an easy way to remove the duplicates, or to combine the tests in a more meaningful way? Here is my code:</p>
  
  <pre><code>run :: App -&gt; IO ()
  run a = do
    inputContents &lt;- readFile (input a)
    let doc = readString [withParseHTML yes, withWarnings no] inputContents
    links &lt;- runX . xshow $ doc &gt;&gt;&gt; indentDoc //&gt; cssLinks
    mapM_ putStrLn links
  
  cssLinks = links &gt;&gt;&gt; (rels &lt;+&gt; hrefs &lt;+&gt; types)
    where
      links = hasName "link"
      rels = hasAttrValue "rel" (isInfixOf "stylesheet")
      hrefs = hasAttrValue "href" (endswith ".css")
      types = hasAttrValue "type" (== "text/css")
  </code></pre>
  
  <p>Yet every time I run this (on any web page), I get duplicated results / nodes. I noticed that <code>&lt;+&gt;</code> is part of the <a href="https://hackage.haskell.org/package/base-4.7.0.0/docs/Control-Arrow.html#t%3aArrowPlus" rel="nofollow">ArrowPlus typeclass</a>, which mimics a monoid, and <a href="http://hackage.haskell.org/package/hxt-9.3.1.4/docs/Text-XML-HXT-Arrow-XmlArrow.html" rel="nofollow">ArrowXML</a> is an instance of both <a href="http://hackage.haskell.org/package/hxt-9.3.1.4/docs/Control-Arrow-ArrowList.html" rel="nofollow">ArrowList</a> and <a href="http://hackage.haskell.org/package/hxt-9.3.1.4/docs/Control-Arrow-ArrowTree.html" rel="nofollow">ArrowTree</a>, which gives me a lot to work with. Would I have to construct <a href="http://hackage.haskell.org/package/hxt-9.3.1.4/docs/Control-Arrow-ArrowIf.html" rel="nofollow">ArrowIf</a> predicates? Any help with this would be wonderful :)</p>