packages feed

xml-enumerator 0.3.2 → 0.3.3

raw patch · 4 files changed

+35/−13 lines, 4 files

Files

Text/XML/Enumerator/Cursor.hs view
@@ -1,11 +1,14 @@ module Text.XML.Enumerator.Cursor     (+    -- * Type classes         Boolean(..)+    -- * Cursor and Axis       , Axis     , Cursor     , fromDocument     , fromNode     , cut+    -- * Axes     , parent     , precedingSibling     , followingSibling@@ -16,13 +19,6 @@     , ancestor     , descendant     , orSelf-    , (&/)-    , (&//)-    , (&.//)-    , ($|)-    , ($/)-    , ($//)-    , ($.//)     , check     , checkNode     , checkElement@@ -31,6 +27,15 @@     , element     , content     , attribute+    -- * Operators+    , (&|)+    , (&/)+    , (&//)+    , (&.//)+    , ($|)+    , ($/)+    , ($//)+    , ($.//)     , (>=>)     ) where @@ -48,9 +53,9 @@ -- Because Axis is just a type synonym for @Cursor -> [Cursor]@, it is possible to use -- other standard functions like '>>=' or 'concatMap' similarly. -- --- The operators '&/', '&//' and '&.//' can be used to combine axes so that the second--- axis works on the children, descendants, respectively the context node as well as its--- descendants of the results of the first axis.+-- The operators '&|', '&/', '&//' and '&.//' can be used to combine axes so that the second+-- axis works on the context nodes, children, descendants, respectively the context node as +-- well as its descendants of the results of the first axis. --  -- The operators '$|', '$/', '$//' and '$.//' can be used to apply an axis (right-hand side) -- to a cursor so that it is applied on the cursor itself, its children, its descendants,@@ -178,6 +183,7 @@ orSelf :: Axis -> Axis orSelf ax c = c : ax c +infixr 1 &| infixr 1 &/  infixr 1 &//  infixr 1 &.// @@ -186,6 +192,10 @@ infixr 1 $// infixr 1 $.// +-- | Apply a function to the result of an axis.+(&|) :: (Cursor -> [a]) -> (a -> b) -> (Cursor -> [b])+f &| g = map g . f+ -- | Combine two axes so that the second works on the children of the results -- of the first. (&/) :: Axis -> (Cursor -> [a]) -> (Cursor -> [a])@@ -202,7 +212,7 @@ f &.// g = f >=> orSelf descendant >=> g  -- | Apply an axis to a 'Cursor'.-($|) :: Cursor -> (Cursor -> [a]) -> [a]+($|) :: Cursor -> (Cursor -> a) -> a v $| f = f v  -- | Apply an axis to the children of a 'Cursor'.
Text/XML/Enumerator/Resolved.hs view
@@ -26,6 +26,8 @@     , writePrettyFile     , renderLBS     , prettyLBS+    , renderText+    , prettyText     , renderBytes     , prettyBytes       -- * Conversion@@ -71,6 +73,9 @@ import qualified Data.Set as Set import Data.Set (Set) +import qualified Data.Text.Lazy as TL+import qualified Data.Text.Lazy.Encoding as TLE+ data Document = Document     { documentPrologue :: Prologue     , documentRoot :: Element@@ -207,3 +212,10 @@ prettyLBS :: Document -> L.ByteString prettyLBS doc =     L.fromChunks $ unsafePerformIO $ lazyConsume $ prettyBytes doc++renderText :: Document -> TL.Text+renderText = TLE.decodeUtf8 . renderLBS++-- | Pretty prints via 'prettyBytes'.+prettyText :: Document -> TL.Text+prettyText = TLE.decodeUtf8 . prettyLBS
runtests.hs view
@@ -23,7 +23,7 @@ import qualified Text.XML.Enumerator.Parse as P import qualified Text.XML.Enumerator.Render as R import qualified Text.XML.Enumerator.Cursor as Cu-import Text.XML.Enumerator.Cursor ((&/), (&//), (&.//), ($|), ($/), ($//), ($.//))+import Text.XML.Enumerator.Cursor ((&|), (&/), (&//), (&.//), ($|), ($/), ($//), ($.//)) import qualified Data.Map as Map import qualified Data.ByteString.Lazy.Char8 as L import Control.Monad.IO.Class (liftIO)
xml-enumerator.cabal view
@@ -1,5 +1,5 @@ name:            xml-enumerator-version:         0.3.2+version:         0.3.3 license:         BSD3 license-file:    LICENSE author:          Michael Snoyman <michaels@suite-sol.com>, Aristid Breitkreuz <aristidb@googlemail.com>