git.iko.soy/typeable/xml-lens
on master help sign in
remove deprecated functions
commit59333677ee7890c41aadb6cb7964183816277320 authorFumiaki Kinoshita <fumiexcel@gmail.com> dateTue 5 Jan 2021, 21:28 (6 years ago) parentb8fced0
2 files changed+5−26
README.md+4−4 Text/XML/Lens.hs+1−22
README.md+4−4
@@ -9,16 +9,16 @@ Example
99```haskell
1010> doc <- Text.XML.readFile def "examples/books.xml"
1111
12−> doc ^.. root . el "books" ./ el "book" . attributeIs "category" "Textbooks" ./ el "title" . text
12+> doc ^.. root . named "books" ... named "book" . attributeIs "category" "Textbooks" ... named "title" . text
1313["Learn You a Haskell for Great Good!","Programming in Haskell","Real World Haskell"]
1414
15−> lengthOf ?? doc $ root . el "books" ./ el "book"
15+> lengthOf ?? doc $ root . named "books" ... named "book"
16167
1717
18−> doc ^? root . el "books" ./ attributeIs "category" "Joke" ./ el "title" . text
18+> doc ^? root . named "books" ... attributeIs "category" "Joke" ... named "title" . text
1919Just "Functional Ikamusume"
2020
21−> doc & root . el "books" ./ el "book" ./ el "pages" . text <>~ " pages" & renderLBS def & BL.putStrLn
21+> doc & root . named "books" ... named "book" ... named "pages" . text <>~ " pages" & renderLBS def & BL.putStrLn
2222```
2323
2424```xml
Text/XML/Lens.hs+1−22
@@ -14,7 +14,6 @@
1414module Text.XML.Lens (
1515 -- * Lenses, traversals for 'Element'
1616 Element(..)
17− , (./)
1817 , (...)
1918 -- ** Names
2019 , name
@@ -34,7 +33,6 @@ module Text.XML.Lens (
3433 , text
3534 , comment
3635 -- ** Children
37− , entire
3836 , nodes
3937 -- * Prisms for 'Node'
4038 , Node(..)
@@ -62,12 +60,9 @@ import Text.XML
6260import Control.Lens
6361import Data.Text (Text)
6462import Data.Map (Map)
65−import Control.Applicative
6663import qualified Data.CaseInsensitive as CI
6764import Data.Maybe (isNothing)
6865
69−infixr 9 ./
70−
7166prologue :: Lens' Document Prologue
7267prologue f doc = fmap (\p -> doc { documentPrologue = p} ) $ f $ documentPrologue doc
7368
@@ -151,12 +146,6 @@ attr n = attrs . ix n
151146attribute :: Name -> Lens' Element (Maybe Text)
152147attribute n = attrs . at n
153148
154−-- | Traverse itself with its all children. Rewriting subnodes of each children will break a traversal law.
155−entire :: Traversal' Element Element
156−entire f e@(Element _ _ ns) = com <$> f e <*> traverse (_Element (entire f)) ns where
157− com (Element n a _) = Element n a
158−{-# DEPRECATED entire "Use cosmos or deep instead" #-}
159−
160149-- | Traverse elements which has the specified *local* name (case-insensitive).
161150named :: CI.CI Text -> Traversal' Element Element
162151named n f s
@@ -172,6 +161,7 @@ el :: Name -> Traversal' Element Element
172161el n f s
173162 | elementName s == n = f s
174163 | otherwise = pure s
164+{-# DEPRECATED el "Use named instead" #-}
175165
176166attributeSatisfies :: Name -> (Text -> Bool) -> Traversal' Element Element
177167attributeSatisfies n p = attributeSatisfies' n (maybe False p)
@@ -196,14 +186,3 @@ comment = nodes . traverse . _Comment
196186-- | 'plate' traverses over its sub-elements.
197187instance Plated Element where
198188 plate = nodes . traverse . _Element
199−
200−-- | Combine two 'Traversal's just like XPath's slash. Identical to ('...').
201−--
202−-- @
203−-- l ./ m ≡ l . 'plate' . m
204−-- @
205−(./) :: (Applicative f, Plated c) => LensLike f s t c c -> Over p f c c a b -> Over p f s t a b
206−(./) = (...)
207−{-# INLINE (./) #-}
208−
209−{-# DEPRECATED (./) "Use (...) instead" #-}