xml-html-conduit-lens 0.1.0.1 → 0.2.0.0
raw patch · 3 files changed
+32/−23 lines, 3 filesdep ~hspec-expectations-lensdep ~lens
Dependency ranges changed: hspec-expectations-lens, lens
Files
- CHANGELOG.md +5/−0
- src/Text/Xml/Lens.hs +17/−18
- xml-html-conduit-lens.cabal +10/−5
CHANGELOG.md view
@@ -1,3 +1,8 @@+0.2.0.0+=======++ * Update to `lens-4.0`+ 0.1.0.1 =======
src/Text/Xml/Lens.hs view
@@ -55,7 +55,6 @@ , module Text.Xml.Lens.LowLevel ) where -import Control.Applicative import Control.Exception (SomeException) import Control.Exception.Lens (exception) import Control.Lens@@ -139,10 +138,10 @@ -- -- >>> let quasiXml = "<html><br><br></html>" :: BL.ByteString ----- >>> quasiXml ^.. html.plate.name+-- >>> quasiXml ^.. html...name -- ["br","br"] ----- >>> quasiXml ^? xml.plate.name+-- >>> quasiXml ^? xml...name -- Nothing html :: AsHtmlDocument t => Fold t Element html = _HtmlDocument . documentRoot@@ -226,7 +225,7 @@ at n = elementAttributes . at n {-# INLINE at #-} -instance Applicative f => Ixed f Element where+instance Ixed Element where ix n = elementAttributes . ix n {-# INLINE ix #-} @@ -234,10 +233,10 @@ -- -- >>> let doc = "<root><foo>4</foo><foo>7</foo><bar>11</bar></root>" :: TL.Text ----- >>> doc ^.. xml.plate.name+-- >>> doc ^.. xml...name -- ["foo","foo","bar"] ----- >>> doc & partsOf (root.plate.name) .~ ["boo", "hoo", "moo"]+-- >>> doc & partsOf (root...name) .~ ["boo", "hoo", "moo"] -- "<?xml version=\"1.0\" encoding=\"UTF-8\"?><root><boo>4</boo><hoo>7</hoo><moo>11</moo></root>" instance Plated Element where plate = elementNodes . traverse . _NodeElement@@ -263,13 +262,13 @@ -- -- >>> let doc = "<root><foo>4</foo><foo>7</foo><bar>11</bar><bar xmlns=\"zap\">28</bar></root>" :: TL.Text ----- >>> doc ^.. xml.plate.named (only "foo").name+-- >>> doc ^.. xml...named (only "foo").name -- ["foo","foo"] ----- >>> doc ^? xml.plate.named (namespace.traverse.only "zap").text+-- >>> doc ^? xml...named (namespace.traverse.only "zap").text -- Just "28" ----- >>> doc ^? xml.plate.named (only "baz").name+-- >>> doc ^? xml...named (only "baz").name -- Nothing named :: Fold Name a -> Traversal' Element Element named l = filtered (has (elementName . l))@@ -279,10 +278,10 @@ -- -- >>> let doc = "<root><foo bar=\"baz\" qux=\"zap\"/><foo quux=\"xyzzy\"/></root>" :: TL.Text ----- >>> doc ^.. xml.plate.attrs.indices (has (name.unpacked.prefixed "qu"))+-- >>> doc ^.. xml...attrs.indices (has (name.unpacked.prefixed "qu")) -- ["zap","xyzzy"] ----- >>> doc & xml.plate.attrs %~ Text.toUpper+-- >>> doc & xml...attrs %~ Text.toUpper -- "<?xml version=\"1.0\" encoding=\"UTF-8\"?><root><foo bar=\"BAZ\" qux=\"ZAP\"/><foo quux=\"XYZZY\"/></root>" attrs :: IndexedTraversal' Name Element Text attrs = elementAttributes . itraversed@@ -292,15 +291,15 @@ -- -- >>> let doc = "<root><foo bar=\"baz\" qux=\"quux\"/><foo qux=\"xyzzy\"/></root>" :: TL.Text ----- >>> doc ^.. xml.plate.attr "qux"+-- >>> doc ^.. xml...attr "qux" -- ["quux","xyzzy"] ----- >>> doc ^.. xml.plate.attr "bar"+-- >>> doc ^.. xml...attr "bar" -- ["baz"] ----- >>> doc & xml.plate.attr "qux" %~ Text.reverse+-- >>> doc & xml...attr "qux" %~ Text.reverse -- "<?xml version=\"1.0\" encoding=\"UTF-8\"?><root><foo bar=\"baz\" qux=\"xuuq\"/><foo qux=\"yzzyx\"/></root>"-attr :: Name -> IndexedTraversal' Name Element Text+attr :: Name -> Traversal' Element Text attr n = elementAttributes . ix n {-# INLINE attr #-} @@ -308,10 +307,10 @@ -- -- >>> let doc = "<root><foo bar=\"baz\">4</foo><foo bar=\"quux\">7</foo><bar bar=\"baz\">11</bar></root>" :: TL.Text ----- >>> doc ^.. xml.plate.attributed (ix "bar".only "baz").text+-- >>> doc ^.. xml...attributed (ix "bar".only "baz").text -- ["4","11"] ----- >>> doc ^? xml.plate.attributed (folded.to Text.length.only 4).text+-- >>> doc ^? xml...attributed (folded.to Text.length.only 4).text -- Just "7" attributed :: Fold (Map Name Text) a -> Traversal' Element Element attributed p = filtered (has (elementAttributes . p))@@ -417,7 +416,7 @@ -- >>> ("<root/>" :: TL.Text) ^. xml.name -- "root" ----- >>> ("<root><foo/><bar/><baz/></root>" :: TL.Text) ^.. xml.plate.name+-- >>> ("<root><foo/><bar/><baz/></root>" :: TL.Text) ^.. xml...name -- ["foo","bar","baz"] -- -- >>> ("<root><foo/><bar/><baz></root>" :: TL.Text) & xml.partsOf (plate.name) .~ ["boo", "hoo", "moo"]
xml-html-conduit-lens.cabal view
@@ -1,5 +1,5 @@ name: xml-html-conduit-lens-version: 0.1.0.1+version: 0.2.0.0 synopsis: Optics for xml-conduit and html-conduit description: Optics for xml-conduit and html-conduit homepage: https://github.com/supki/xml-html-conduit-lens#readme@@ -17,15 +17,20 @@ source-repository head type: git- location: https://github.com/supki/xml-html-conduit-lens.git+ location: https://github.com/supki/xml-html-conduit-lens +source-repository this+ type: git+ tag: 0.2.0.0+ location: https://github.com/supki/xml-html-conduit-lens+ library default-language: Haskell2010 build-depends: base >= 4 && < 5 , bytestring- , lens >= 3.9 && < 4.0+ , lens >= 4.0 , containers >= 0.4.0 && < 0.6 , text >= 0.11 && < 1.2 , xml-conduit >= 1.1 && < 1.3@@ -55,8 +60,8 @@ build-depends: base == 4.* , hspec- , hspec-expectations-lens >= 0.2- , lens >= 3.8 && < 4.0+ , hspec-expectations-lens >= 0.3+ , lens >= 4.0 , xml-conduit >= 1.1 && < 1.3 , xml-html-conduit-lens other-modules: