module Text.XML.HXT.Arrow.XmlArrow
( module Text.XML.HXT.Arrow.XmlArrow )
where
import Control.Arrow
import Control.Arrow.ArrowList
import Control.Arrow.ArrowIf
import Control.Arrow.ArrowTree
import Control.Arrow.ListArrow
import Control.Arrow.StateListArrow
import Control.Arrow.IOListArrow
import Control.Arrow.IOStateListArrow
import Data.Char.Properties.XMLCharProps ( isXmlSpaceChar )
import Data.Maybe
import Text.XML.HXT.DOM.Interface
import qualified Text.XML.HXT.DOM.XmlNode as XN
import qualified Text.XML.HXT.DOM.ShowXml as XS
infixl 7 +=
class (Arrow a, ArrowList a, ArrowTree a) => ArrowXml a where
isText :: a XmlTree XmlTree
isText = (XmlTree -> Bool) -> a XmlTree XmlTree
forall b. (b -> Bool) -> a b b
forall (a :: * -> * -> *) b. ArrowList a => (b -> Bool) -> a b b
isA XmlTree -> Bool
forall a. XmlNode a => a -> Bool
XN.isText
{-# INLINE isText #-}
isBlob :: a XmlTree XmlTree
isBlob = (XmlTree -> Bool) -> a XmlTree XmlTree
forall b. (b -> Bool) -> a b b
forall (a :: * -> * -> *) b. ArrowList a => (b -> Bool) -> a b b
isA XmlTree -> Bool
forall a. XmlNode a => a -> Bool
XN.isBlob
{-# INLINE isBlob #-}
isCharRef :: a XmlTree XmlTree
isCharRef = (XmlTree -> Bool) -> a XmlTree XmlTree
forall b. (b -> Bool) -> a b b
forall (a :: * -> * -> *) b. ArrowList a => (b -> Bool) -> a b b
isA XmlTree -> Bool
forall a. XmlNode a => a -> Bool
XN.isCharRef
{-# INLINE isCharRef #-}
isEntityRef :: a XmlTree XmlTree
isEntityRef = (XmlTree -> Bool) -> a XmlTree XmlTree
forall b. (b -> Bool) -> a b b
forall (a :: * -> * -> *) b. ArrowList a => (b -> Bool) -> a b b
isA XmlTree -> Bool
forall a. XmlNode a => a -> Bool
XN.isEntityRef
{-# INLINE isEntityRef #-}
isCmt :: a XmlTree XmlTree
isCmt = (XmlTree -> Bool) -> a XmlTree XmlTree
forall b. (b -> Bool) -> a b b
forall (a :: * -> * -> *) b. ArrowList a => (b -> Bool) -> a b b
isA XmlTree -> Bool
forall a. XmlNode a => a -> Bool
XN.isCmt
{-# INLINE isCmt #-}
isCdata :: a XmlTree XmlTree
isCdata = (XmlTree -> Bool) -> a XmlTree XmlTree
forall b. (b -> Bool) -> a b b
forall (a :: * -> * -> *) b. ArrowList a => (b -> Bool) -> a b b
isA XmlTree -> Bool
forall a. XmlNode a => a -> Bool
XN.isCdata
{-# INLINE isCdata #-}
isPi :: a XmlTree XmlTree
isPi = (XmlTree -> Bool) -> a XmlTree XmlTree
forall b. (b -> Bool) -> a b b
forall (a :: * -> * -> *) b. ArrowList a => (b -> Bool) -> a b b
isA XmlTree -> Bool
forall a. XmlNode a => a -> Bool
XN.isPi
{-# INLINE isPi #-}
isXmlPi :: a XmlTree XmlTree
isXmlPi = a XmlTree XmlTree
forall (a :: * -> * -> *). ArrowXml a => a XmlTree XmlTree
isPi a XmlTree XmlTree -> a XmlTree XmlTree -> a XmlTree XmlTree
forall {k} (cat :: k -> k -> *) (a :: k) (b :: k) (c :: k).
Category cat =>
cat a b -> cat b c -> cat a c
>>> String -> a XmlTree XmlTree
forall (a :: * -> * -> *).
ArrowXml a =>
String -> a XmlTree XmlTree
hasName String
"xml"
isElem :: a XmlTree XmlTree
isElem = (XmlTree -> Bool) -> a XmlTree XmlTree
forall b. (b -> Bool) -> a b b
forall (a :: * -> * -> *) b. ArrowList a => (b -> Bool) -> a b b
isA XmlTree -> Bool
forall a. XmlNode a => a -> Bool
XN.isElem
{-# INLINE isElem #-}
isDTD :: a XmlTree XmlTree
isDTD = (XmlTree -> Bool) -> a XmlTree XmlTree
forall b. (b -> Bool) -> a b b
forall (a :: * -> * -> *) b. ArrowList a => (b -> Bool) -> a b b
isA XmlTree -> Bool
forall a. XmlNode a => a -> Bool
XN.isDTD
{-# INLINE isDTD #-}
isAttr :: a XmlTree XmlTree
isAttr = (XmlTree -> Bool) -> a XmlTree XmlTree
forall b. (b -> Bool) -> a b b
forall (a :: * -> * -> *) b. ArrowList a => (b -> Bool) -> a b b
isA XmlTree -> Bool
forall a. XmlNode a => a -> Bool
XN.isAttr
{-# INLINE isAttr #-}
isError :: a XmlTree XmlTree
isError = (XmlTree -> Bool) -> a XmlTree XmlTree
forall b. (b -> Bool) -> a b b
forall (a :: * -> * -> *) b. ArrowList a => (b -> Bool) -> a b b
isA XmlTree -> Bool
forall a. XmlNode a => a -> Bool
XN.isError
{-# INLINE isError #-}
isRoot :: a XmlTree XmlTree
isRoot = (XmlTree -> Bool) -> a XmlTree XmlTree
forall b. (b -> Bool) -> a b b
forall (a :: * -> * -> *) b. ArrowList a => (b -> Bool) -> a b b
isA XmlTree -> Bool
forall a. XmlNode a => a -> Bool
XN.isRoot
{-# INLINE isRoot #-}
hasText :: (String -> Bool) -> a XmlTree XmlTree
hasText String -> Bool
p = (a XmlTree XmlTree
forall (a :: * -> * -> *). ArrowXml a => a XmlTree XmlTree
isText a XmlTree XmlTree -> a XmlTree String -> a XmlTree String
forall {k} (cat :: k -> k -> *) (a :: k) (b :: k) (c :: k).
Category cat =>
cat a b -> cat b c -> cat a c
>>> a XmlTree String
forall (a :: * -> * -> *). ArrowXml a => a XmlTree String
getText a XmlTree String -> a String String -> a XmlTree String
forall {k} (cat :: k -> k -> *) (a :: k) (b :: k) (c :: k).
Category cat =>
cat a b -> cat b c -> cat a c
>>> (String -> Bool) -> a String String
forall b. (b -> Bool) -> a b b
forall (a :: * -> * -> *) b. ArrowList a => (b -> Bool) -> a b b
isA String -> Bool
p) a XmlTree String -> a XmlTree XmlTree -> a XmlTree XmlTree
forall b c d. a b c -> a b d -> a b d
forall (a :: * -> * -> *) b c d.
ArrowIf a =>
a b c -> a b d -> a b d
`guards` a XmlTree XmlTree
forall b. a b b
forall (a :: * -> * -> *) b. ArrowList a => a b b
this
isWhiteSpace :: a XmlTree XmlTree
isWhiteSpace = (String -> Bool) -> a XmlTree XmlTree
forall (a :: * -> * -> *).
ArrowXml a =>
(String -> Bool) -> a XmlTree XmlTree
hasText ((Char -> Bool) -> String -> Bool
forall (t :: * -> *) a. Foldable t => (a -> Bool) -> t a -> Bool
all Char -> Bool
isXmlSpaceChar)
{-# INLINE isWhiteSpace #-}
hasNameWith :: (QName -> Bool) -> a XmlTree XmlTree
hasNameWith QName -> Bool
p = (a XmlTree QName
forall (a :: * -> * -> *). ArrowXml a => a XmlTree QName
getQName a XmlTree QName -> a QName QName -> a XmlTree QName
forall {k} (cat :: k -> k -> *) (a :: k) (b :: k) (c :: k).
Category cat =>
cat a b -> cat b c -> cat a c
>>> (QName -> Bool) -> a QName QName
forall b. (b -> Bool) -> a b b
forall (a :: * -> * -> *) b. ArrowList a => (b -> Bool) -> a b b
isA QName -> Bool
p) a XmlTree QName -> a XmlTree XmlTree -> a XmlTree XmlTree
forall b c d. a b c -> a b d -> a b d
forall (a :: * -> * -> *) b c d.
ArrowIf a =>
a b c -> a b d -> a b d
`guards` a XmlTree XmlTree
forall b. a b b
forall (a :: * -> * -> *) b. ArrowList a => a b b
this
{-# INLINE hasNameWith #-}
hasQName :: QName -> a XmlTree XmlTree
hasQName QName
n = (a XmlTree QName
forall (a :: * -> * -> *). ArrowXml a => a XmlTree QName
getQName a XmlTree QName -> a QName QName -> a XmlTree QName
forall {k} (cat :: k -> k -> *) (a :: k) (b :: k) (c :: k).
Category cat =>
cat a b -> cat b c -> cat a c
>>> (QName -> Bool) -> a QName QName
forall b. (b -> Bool) -> a b b
forall (a :: * -> * -> *) b. ArrowList a => (b -> Bool) -> a b b
isA (QName -> QName -> Bool
forall a. Eq a => a -> a -> Bool
== QName
n)) a XmlTree QName -> a XmlTree XmlTree -> a XmlTree XmlTree
forall b c d. a b c -> a b d -> a b d
forall (a :: * -> * -> *) b c d.
ArrowIf a =>
a b c -> a b d -> a b d
`guards` a XmlTree XmlTree
forall b. a b b
forall (a :: * -> * -> *) b. ArrowList a => a b b
this
{-# INLINE hasQName #-}
hasName :: String -> a XmlTree XmlTree
hasName String
n = (a XmlTree String
forall (a :: * -> * -> *). ArrowXml a => a XmlTree String
getName a XmlTree String -> a String String -> a XmlTree String
forall {k} (cat :: k -> k -> *) (a :: k) (b :: k) (c :: k).
Category cat =>
cat a b -> cat b c -> cat a c
>>> (String -> Bool) -> a String String
forall b. (b -> Bool) -> a b b
forall (a :: * -> * -> *) b. ArrowList a => (b -> Bool) -> a b b
isA (String -> String -> Bool
forall a. Eq a => a -> a -> Bool
== String
n)) a XmlTree String -> a XmlTree XmlTree -> a XmlTree XmlTree
forall b c d. a b c -> a b d -> a b d
forall (a :: * -> * -> *) b c d.
ArrowIf a =>
a b c -> a b d -> a b d
`guards` a XmlTree XmlTree
forall b. a b b
forall (a :: * -> * -> *) b. ArrowList a => a b b
this
{-# INLINE hasName #-}
hasLocalPart :: String -> a XmlTree XmlTree
hasLocalPart String
n = (a XmlTree String
forall (a :: * -> * -> *). ArrowXml a => a XmlTree String
getLocalPart a XmlTree String -> a String String -> a XmlTree String
forall {k} (cat :: k -> k -> *) (a :: k) (b :: k) (c :: k).
Category cat =>
cat a b -> cat b c -> cat a c
>>> (String -> Bool) -> a String String
forall b. (b -> Bool) -> a b b
forall (a :: * -> * -> *) b. ArrowList a => (b -> Bool) -> a b b
isA (String -> String -> Bool
forall a. Eq a => a -> a -> Bool
== String
n)) a XmlTree String -> a XmlTree XmlTree -> a XmlTree XmlTree
forall b c d. a b c -> a b d -> a b d
forall (a :: * -> * -> *) b c d.
ArrowIf a =>
a b c -> a b d -> a b d
`guards` a XmlTree XmlTree
forall b. a b b
forall (a :: * -> * -> *) b. ArrowList a => a b b
this
{-# INLINE hasLocalPart #-}
hasNamePrefix :: String -> a XmlTree XmlTree
hasNamePrefix String
n = (a XmlTree String
forall (a :: * -> * -> *). ArrowXml a => a XmlTree String
getNamePrefix a XmlTree String -> a String String -> a XmlTree String
forall {k} (cat :: k -> k -> *) (a :: k) (b :: k) (c :: k).
Category cat =>
cat a b -> cat b c -> cat a c
>>> (String -> Bool) -> a String String
forall b. (b -> Bool) -> a b b
forall (a :: * -> * -> *) b. ArrowList a => (b -> Bool) -> a b b
isA (String -> String -> Bool
forall a. Eq a => a -> a -> Bool
== String
n)) a XmlTree String -> a XmlTree XmlTree -> a XmlTree XmlTree
forall b c d. a b c -> a b d -> a b d
forall (a :: * -> * -> *) b c d.
ArrowIf a =>
a b c -> a b d -> a b d
`guards` a XmlTree XmlTree
forall b. a b b
forall (a :: * -> * -> *) b. ArrowList a => a b b
this
{-# INLINE hasNamePrefix #-}
hasNamespaceUri :: String -> a XmlTree XmlTree
hasNamespaceUri String
n = (a XmlTree String
forall (a :: * -> * -> *). ArrowXml a => a XmlTree String
getNamespaceUri a XmlTree String -> a String String -> a XmlTree String
forall {k} (cat :: k -> k -> *) (a :: k) (b :: k) (c :: k).
Category cat =>
cat a b -> cat b c -> cat a c
>>> (String -> Bool) -> a String String
forall b. (b -> Bool) -> a b b
forall (a :: * -> * -> *) b. ArrowList a => (b -> Bool) -> a b b
isA (String -> String -> Bool
forall a. Eq a => a -> a -> Bool
== String
n)) a XmlTree String -> a XmlTree XmlTree -> a XmlTree XmlTree
forall b c d. a b c -> a b d -> a b d
forall (a :: * -> * -> *) b c d.
ArrowIf a =>
a b c -> a b d -> a b d
`guards` a XmlTree XmlTree
forall b. a b b
forall (a :: * -> * -> *) b. ArrowList a => a b b
this
{-# INLINE hasNamespaceUri #-}
hasAttr :: String -> a XmlTree XmlTree
hasAttr String
n = (a XmlTree XmlTree
forall (a :: * -> * -> *). ArrowXml a => a XmlTree XmlTree
getAttrl a XmlTree XmlTree -> a XmlTree XmlTree -> a XmlTree XmlTree
forall {k} (cat :: k -> k -> *) (a :: k) (b :: k) (c :: k).
Category cat =>
cat a b -> cat b c -> cat a c
>>> String -> a XmlTree XmlTree
forall (a :: * -> * -> *).
ArrowXml a =>
String -> a XmlTree XmlTree
hasName String
n) a XmlTree XmlTree -> a XmlTree XmlTree -> a XmlTree XmlTree
forall b c d. a b c -> a b d -> a b d
forall (a :: * -> * -> *) b c d.
ArrowIf a =>
a b c -> a b d -> a b d
`guards` a XmlTree XmlTree
forall b. a b b
forall (a :: * -> * -> *) b. ArrowList a => a b b
this
{-# INLINE hasAttr #-}
hasQAttr :: QName -> a XmlTree XmlTree
hasQAttr QName
n = (a XmlTree XmlTree
forall (a :: * -> * -> *). ArrowXml a => a XmlTree XmlTree
getAttrl a XmlTree XmlTree -> a XmlTree XmlTree -> a XmlTree XmlTree
forall {k} (cat :: k -> k -> *) (a :: k) (b :: k) (c :: k).
Category cat =>
cat a b -> cat b c -> cat a c
>>> QName -> a XmlTree XmlTree
forall (a :: * -> * -> *). ArrowXml a => QName -> a XmlTree XmlTree
hasQName QName
n) a XmlTree XmlTree -> a XmlTree XmlTree -> a XmlTree XmlTree
forall b c d. a b c -> a b d -> a b d
forall (a :: * -> * -> *) b c d.
ArrowIf a =>
a b c -> a b d -> a b d
`guards` a XmlTree XmlTree
forall b. a b b
forall (a :: * -> * -> *) b. ArrowList a => a b b
this
{-# INLINE hasQAttr #-}
hasAttrValue :: String -> (String -> Bool) -> a XmlTree XmlTree
hasAttrValue String
n String -> Bool
p = (a XmlTree XmlTree
forall (a :: * -> * -> *). ArrowXml a => a XmlTree XmlTree
getAttrl a XmlTree XmlTree -> a XmlTree String -> a XmlTree String
forall {k} (cat :: k -> k -> *) (a :: k) (b :: k) (c :: k).
Category cat =>
cat a b -> cat b c -> cat a c
>>> String -> a XmlTree XmlTree
forall (a :: * -> * -> *).
ArrowXml a =>
String -> a XmlTree XmlTree
hasName String
n a XmlTree XmlTree -> a XmlTree String -> a XmlTree String
forall {k} (cat :: k -> k -> *) (a :: k) (b :: k) (c :: k).
Category cat =>
cat a b -> cat b c -> cat a c
>>> a XmlTree XmlTree -> a XmlTree String
forall n. a n XmlTree -> a n String
forall (a :: * -> * -> *) n.
ArrowXml a =>
a n XmlTree -> a n String
xshow a XmlTree XmlTree
forall (t :: * -> *) b. Tree t => a (t b) (t b)
forall (a :: * -> * -> *) (t :: * -> *) b.
(ArrowTree a, Tree t) =>
a (t b) (t b)
getChildren a XmlTree String -> a String String -> a XmlTree String
forall {k} (cat :: k -> k -> *) (a :: k) (b :: k) (c :: k).
Category cat =>
cat a b -> cat b c -> cat a c
>>> (String -> Bool) -> a String String
forall b. (b -> Bool) -> a b b
forall (a :: * -> * -> *) b. ArrowList a => (b -> Bool) -> a b b
isA String -> Bool
p) a XmlTree String -> a XmlTree XmlTree -> a XmlTree XmlTree
forall b c d. a b c -> a b d -> a b d
forall (a :: * -> * -> *) b c d.
ArrowIf a =>
a b c -> a b d -> a b d
`guards` a XmlTree XmlTree
forall b. a b b
forall (a :: * -> * -> *) b. ArrowList a => a b b
this
hasQAttrValue :: QName -> (String -> Bool) -> a XmlTree XmlTree
hasQAttrValue QName
n String -> Bool
p = (a XmlTree XmlTree
forall (a :: * -> * -> *). ArrowXml a => a XmlTree XmlTree
getAttrl a XmlTree XmlTree -> a XmlTree String -> a XmlTree String
forall {k} (cat :: k -> k -> *) (a :: k) (b :: k) (c :: k).
Category cat =>
cat a b -> cat b c -> cat a c
>>> QName -> a XmlTree XmlTree
forall (a :: * -> * -> *). ArrowXml a => QName -> a XmlTree XmlTree
hasQName QName
n a XmlTree XmlTree -> a XmlTree String -> a XmlTree String
forall {k} (cat :: k -> k -> *) (a :: k) (b :: k) (c :: k).
Category cat =>
cat a b -> cat b c -> cat a c
>>> a XmlTree XmlTree -> a XmlTree String
forall n. a n XmlTree -> a n String
forall (a :: * -> * -> *) n.
ArrowXml a =>
a n XmlTree -> a n String
xshow a XmlTree XmlTree
forall (t :: * -> *) b. Tree t => a (t b) (t b)
forall (a :: * -> * -> *) (t :: * -> *) b.
(ArrowTree a, Tree t) =>
a (t b) (t b)
getChildren a XmlTree String -> a String String -> a XmlTree String
forall {k} (cat :: k -> k -> *) (a :: k) (b :: k) (c :: k).
Category cat =>
cat a b -> cat b c -> cat a c
>>> (String -> Bool) -> a String String
forall b. (b -> Bool) -> a b b
forall (a :: * -> * -> *) b. ArrowList a => (b -> Bool) -> a b b
isA String -> Bool
p) a XmlTree String -> a XmlTree XmlTree -> a XmlTree XmlTree
forall b c d. a b c -> a b d -> a b d
forall (a :: * -> * -> *) b c d.
ArrowIf a =>
a b c -> a b d -> a b d
`guards` a XmlTree XmlTree
forall b. a b b
forall (a :: * -> * -> *) b. ArrowList a => a b b
this
mkText :: a String XmlTree
mkText = (String -> XmlTree) -> a String XmlTree
forall b c. (b -> c) -> a b c
forall (a :: * -> * -> *) b c. Arrow a => (b -> c) -> a b c
arr String -> XmlTree
forall a. XmlNode a => String -> a
XN.mkText
{-# INLINE mkText #-}
mkBlob :: a Blob XmlTree
mkBlob = (Blob -> XmlTree) -> a Blob XmlTree
forall b c. (b -> c) -> a b c
forall (a :: * -> * -> *) b c. Arrow a => (b -> c) -> a b c
arr Blob -> XmlTree
forall a. XmlNode a => Blob -> a
XN.mkBlob
{-# INLINE mkBlob #-}
mkCharRef :: a Int XmlTree
mkCharRef = (Int -> XmlTree) -> a Int XmlTree
forall b c. (b -> c) -> a b c
forall (a :: * -> * -> *) b c. Arrow a => (b -> c) -> a b c
arr Int -> XmlTree
forall a. XmlNode a => Int -> a
XN.mkCharRef
{-# INLINE mkCharRef #-}
mkEntityRef :: a String XmlTree
mkEntityRef = (String -> XmlTree) -> a String XmlTree
forall b c. (b -> c) -> a b c
forall (a :: * -> * -> *) b c. Arrow a => (b -> c) -> a b c
arr String -> XmlTree
forall a. XmlNode a => String -> a
XN.mkEntityRef
{-# INLINE mkEntityRef #-}
mkCmt :: a String XmlTree
mkCmt = (String -> XmlTree) -> a String XmlTree
forall b c. (b -> c) -> a b c
forall (a :: * -> * -> *) b c. Arrow a => (b -> c) -> a b c
arr String -> XmlTree
forall a. XmlNode a => String -> a
XN.mkCmt
{-# INLINE mkCmt #-}
mkCdata :: a String XmlTree
mkCdata = (String -> XmlTree) -> a String XmlTree
forall b c. (b -> c) -> a b c
forall (a :: * -> * -> *) b c. Arrow a => (b -> c) -> a b c
arr String -> XmlTree
forall a. XmlNode a => String -> a
XN.mkCdata
{-# INLINE mkCdata #-}
mkError :: Int -> a String XmlTree
mkError Int
level = (String -> XmlTree) -> a String XmlTree
forall b c. (b -> c) -> a b c
forall (a :: * -> * -> *) b c. Arrow a => (b -> c) -> a b c
arr (Int -> String -> XmlTree
forall a. XmlNode a => Int -> String -> a
XN.mkError Int
level)
mkElement :: QName -> a n XmlTree -> a n XmlTree -> a n XmlTree
mkElement QName
n a n XmlTree
af a n XmlTree
cf = (a n XmlTree -> a n [XmlTree]
forall b c. a b c -> a b [c]
forall (a :: * -> * -> *) b c. ArrowList a => a b c -> a b [c]
listA a n XmlTree
af a n [XmlTree] -> a n [XmlTree] -> a n ([XmlTree], [XmlTree])
forall b c c'. a b c -> a b c' -> a b (c, c')
forall (a :: * -> * -> *) b c c'.
Arrow a =>
a b c -> a b c' -> a b (c, c')
&&& a n XmlTree -> a n [XmlTree]
forall b c. a b c -> a b [c]
forall (a :: * -> * -> *) b c. ArrowList a => a b c -> a b [c]
listA a n XmlTree
cf)
a n ([XmlTree], [XmlTree])
-> a ([XmlTree], [XmlTree]) XmlTree -> a n XmlTree
forall {k} (cat :: k -> k -> *) (a :: k) (b :: k) (c :: k).
Category cat =>
cat a b -> cat b c -> cat a c
>>>
([XmlTree] -> [XmlTree] -> XmlTree)
-> a ([XmlTree], [XmlTree]) XmlTree
forall b1 b2 c. (b1 -> b2 -> c) -> a (b1, b2) c
forall (a :: * -> * -> *) b1 b2 c.
ArrowList a =>
(b1 -> b2 -> c) -> a (b1, b2) c
arr2 (\ [XmlTree]
al [XmlTree]
cl -> QName -> [XmlTree] -> [XmlTree] -> XmlTree
XN.mkElement QName
n [XmlTree]
al [XmlTree]
cl)
mkAttr :: QName -> a n XmlTree -> a n XmlTree
mkAttr QName
qn a n XmlTree
f = a n XmlTree -> a n [XmlTree]
forall b c. a b c -> a b [c]
forall (a :: * -> * -> *) b c. ArrowList a => a b c -> a b [c]
listA a n XmlTree
f a n [XmlTree] -> a [XmlTree] XmlTree -> a n XmlTree
forall {k} (cat :: k -> k -> *) (a :: k) (b :: k) (c :: k).
Category cat =>
cat a b -> cat b c -> cat a c
>>> ([XmlTree] -> XmlTree) -> a [XmlTree] XmlTree
forall b c. (b -> c) -> a b c
forall (a :: * -> * -> *) b c. Arrow a => (b -> c) -> a b c
arr (QName -> [XmlTree] -> XmlTree
XN.mkAttr QName
qn)
mkPi :: QName -> a n XmlTree -> a n XmlTree
mkPi QName
qn a n XmlTree
f = a n XmlTree -> a n [XmlTree]
forall b c. a b c -> a b [c]
forall (a :: * -> * -> *) b c. ArrowList a => a b c -> a b [c]
listA a n XmlTree
f a n [XmlTree] -> a [XmlTree] XmlTree -> a n XmlTree
forall {k} (cat :: k -> k -> *) (a :: k) (b :: k) (c :: k).
Category cat =>
cat a b -> cat b c -> cat a c
>>> ([XmlTree] -> XmlTree) -> a [XmlTree] XmlTree
forall b c. (b -> c) -> a b c
forall (a :: * -> * -> *) b c. Arrow a => (b -> c) -> a b c
arr (QName -> [XmlTree] -> XmlTree
forall a. XmlNode a => QName -> [XmlTree] -> a
XN.mkPi QName
qn)
mkqelem :: QName -> [a n XmlTree] -> [a n XmlTree] -> a n XmlTree
mkqelem QName
n [a n XmlTree]
afs [a n XmlTree]
cfs = QName -> a n XmlTree -> a n XmlTree -> a n XmlTree
forall n. QName -> a n XmlTree -> a n XmlTree -> a n XmlTree
forall (a :: * -> * -> *) n.
ArrowXml a =>
QName -> a n XmlTree -> a n XmlTree -> a n XmlTree
mkElement QName
n ([a n XmlTree] -> a n XmlTree
forall b c. [a b c] -> a b c
forall (a :: * -> * -> *) b c. ArrowList a => [a b c] -> a b c
catA [a n XmlTree]
afs) ([a n XmlTree] -> a n XmlTree
forall b c. [a b c] -> a b c
forall (a :: * -> * -> *) b c. ArrowList a => [a b c] -> a b c
catA [a n XmlTree]
cfs)
{-# INLINE mkqelem #-}
mkelem :: String -> [a n XmlTree] -> [a n XmlTree] -> a n XmlTree
mkelem String
n [a n XmlTree]
afs [a n XmlTree]
cfs = QName -> a n XmlTree -> a n XmlTree -> a n XmlTree
forall n. QName -> a n XmlTree -> a n XmlTree -> a n XmlTree
forall (a :: * -> * -> *) n.
ArrowXml a =>
QName -> a n XmlTree -> a n XmlTree -> a n XmlTree
mkElement (String -> QName
mkName String
n) ([a n XmlTree] -> a n XmlTree
forall b c. [a b c] -> a b c
forall (a :: * -> * -> *) b c. ArrowList a => [a b c] -> a b c
catA [a n XmlTree]
afs) ([a n XmlTree] -> a n XmlTree
forall b c. [a b c] -> a b c
forall (a :: * -> * -> *) b c. ArrowList a => [a b c] -> a b c
catA [a n XmlTree]
cfs)
{-# INLINE mkelem #-}
aelem :: String -> [a n XmlTree] -> a n XmlTree
aelem String
n [a n XmlTree]
afs = [a n XmlTree] -> a n XmlTree
forall b c. [a b c] -> a b c
forall (a :: * -> * -> *) b c. ArrowList a => [a b c] -> a b c
catA [a n XmlTree]
afs a n XmlTree -> ([XmlTree] -> XmlTree) -> a n XmlTree
forall b c d. a b c -> ([c] -> d) -> a b d
forall (a :: * -> * -> *) b c d.
ArrowList a =>
a b c -> ([c] -> d) -> a b d
>. \ [XmlTree]
al -> QName -> [XmlTree] -> [XmlTree] -> XmlTree
XN.mkElement (String -> QName
mkName String
n) [XmlTree]
al []
{-# INLINE aelem #-}
selem :: String -> [a n XmlTree] -> a n XmlTree
selem String
n [a n XmlTree]
cfs = [a n XmlTree] -> a n XmlTree
forall b c. [a b c] -> a b c
forall (a :: * -> * -> *) b c. ArrowList a => [a b c] -> a b c
catA [a n XmlTree]
cfs a n XmlTree -> ([XmlTree] -> XmlTree) -> a n XmlTree
forall b c d. a b c -> ([c] -> d) -> a b d
forall (a :: * -> * -> *) b c d.
ArrowList a =>
a b c -> ([c] -> d) -> a b d
>. QName -> [XmlTree] -> [XmlTree] -> XmlTree
XN.mkElement (String -> QName
mkName String
n) []
{-# INLINE selem #-}
eelem :: String -> a n XmlTree
eelem String
n = XmlTree -> a n XmlTree
forall c b. c -> a b c
forall (a :: * -> * -> *) c b. ArrowList a => c -> a b c
constA (QName -> [XmlTree] -> [XmlTree] -> XmlTree
XN.mkElement (String -> QName
mkName String
n) [] [])
{-# INLINE eelem #-}
root :: [a n XmlTree] -> [a n XmlTree] -> a n XmlTree
root = String -> [a n XmlTree] -> [a n XmlTree] -> a n XmlTree
forall n. String -> [a n XmlTree] -> [a n XmlTree] -> a n XmlTree
forall (a :: * -> * -> *) n.
ArrowXml a =>
String -> [a n XmlTree] -> [a n XmlTree] -> a n XmlTree
mkelem String
t_root
{-# INLINE root #-}
qattr :: QName -> a n XmlTree -> a n XmlTree
qattr = QName -> a n XmlTree -> a n XmlTree
forall n. QName -> a n XmlTree -> a n XmlTree
forall (a :: * -> * -> *) n.
ArrowXml a =>
QName -> a n XmlTree -> a n XmlTree
mkAttr
{-# INLINE qattr #-}
attr :: String -> a n XmlTree -> a n XmlTree
attr = QName -> a n XmlTree -> a n XmlTree
forall n. QName -> a n XmlTree -> a n XmlTree
forall (a :: * -> * -> *) n.
ArrowXml a =>
QName -> a n XmlTree -> a n XmlTree
mkAttr (QName -> a n XmlTree -> a n XmlTree)
-> (String -> QName) -> String -> a n XmlTree -> a n XmlTree
forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> QName
mkName
{-# INLINE attr #-}
txt :: String -> a n XmlTree
txt = XmlTree -> a n XmlTree
forall c b. c -> a b c
forall (a :: * -> * -> *) c b. ArrowList a => c -> a b c
constA (XmlTree -> a n XmlTree)
-> (String -> XmlTree) -> String -> a n XmlTree
forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> XmlTree
forall a. XmlNode a => String -> a
XN.mkText
{-# INLINE txt #-}
blb :: Blob -> a n XmlTree
blb = XmlTree -> a n XmlTree
forall c b. c -> a b c
forall (a :: * -> * -> *) c b. ArrowList a => c -> a b c
constA (XmlTree -> a n XmlTree)
-> (Blob -> XmlTree) -> Blob -> a n XmlTree
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Blob -> XmlTree
forall a. XmlNode a => Blob -> a
XN.mkBlob
{-# INLINE blb #-}
charRef :: Int -> a n XmlTree
charRef = XmlTree -> a n XmlTree
forall c b. c -> a b c
forall (a :: * -> * -> *) c b. ArrowList a => c -> a b c
constA (XmlTree -> a n XmlTree) -> (Int -> XmlTree) -> Int -> a n XmlTree
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> XmlTree
forall a. XmlNode a => Int -> a
XN.mkCharRef
{-# INLINE charRef #-}
entityRef :: String -> a n XmlTree
entityRef = XmlTree -> a n XmlTree
forall c b. c -> a b c
forall (a :: * -> * -> *) c b. ArrowList a => c -> a b c
constA (XmlTree -> a n XmlTree)
-> (String -> XmlTree) -> String -> a n XmlTree
forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> XmlTree
forall a. XmlNode a => String -> a
XN.mkEntityRef
{-# INLINE entityRef #-}
cmt :: String -> a n XmlTree
cmt = XmlTree -> a n XmlTree
forall c b. c -> a b c
forall (a :: * -> * -> *) c b. ArrowList a => c -> a b c
constA (XmlTree -> a n XmlTree)
-> (String -> XmlTree) -> String -> a n XmlTree
forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> XmlTree
forall a. XmlNode a => String -> a
XN.mkCmt
{-# INLINE cmt #-}
warn :: String -> a n XmlTree
warn = XmlTree -> a n XmlTree
forall c b. c -> a b c
forall (a :: * -> * -> *) c b. ArrowList a => c -> a b c
constA (XmlTree -> a n XmlTree)
-> (String -> XmlTree) -> String -> a n XmlTree
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Int -> String -> XmlTree
forall a. XmlNode a => Int -> String -> a
XN.mkError Int
c_warn)
{-# INLINE warn #-}
err :: String -> a n XmlTree
err = XmlTree -> a n XmlTree
forall c b. c -> a b c
forall (a :: * -> * -> *) c b. ArrowList a => c -> a b c
constA (XmlTree -> a n XmlTree)
-> (String -> XmlTree) -> String -> a n XmlTree
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Int -> String -> XmlTree
forall a. XmlNode a => Int -> String -> a
XN.mkError Int
c_err)
{-# INLINE err #-}
fatal :: String -> a n XmlTree
fatal = XmlTree -> a n XmlTree
forall c b. c -> a b c
forall (a :: * -> * -> *) c b. ArrowList a => c -> a b c
constA (XmlTree -> a n XmlTree)
-> (String -> XmlTree) -> String -> a n XmlTree
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Int -> String -> XmlTree
forall a. XmlNode a => Int -> String -> a
XN.mkError Int
c_fatal)
{-# INLINE fatal #-}
spi :: String -> String -> a n XmlTree
spi String
piName String
piCont = XmlTree -> a n XmlTree
forall c b. c -> a b c
forall (a :: * -> * -> *) c b. ArrowList a => c -> a b c
constA (QName -> [XmlTree] -> XmlTree
forall a. XmlNode a => QName -> [XmlTree] -> a
XN.mkPi (String -> QName
mkName String
piName) [QName -> [XmlTree] -> XmlTree
XN.mkAttr (String -> QName
mkName String
a_value) [String -> XmlTree
forall a. XmlNode a => String -> a
XN.mkText String
piCont]])
{-# INLINE spi #-}
sqattr :: QName -> String -> a n XmlTree
sqattr QName
an String
av = XmlTree -> a n XmlTree
forall c b. c -> a b c
forall (a :: * -> * -> *) c b. ArrowList a => c -> a b c
constA (QName -> [XmlTree] -> XmlTree
XN.mkAttr QName
an [String -> XmlTree
forall a. XmlNode a => String -> a
XN.mkText String
av])
{-# INLINE sqattr #-}
sattr :: String -> String -> a n XmlTree
sattr String
an String
av = XmlTree -> a n XmlTree
forall c b. c -> a b c
forall (a :: * -> * -> *) c b. ArrowList a => c -> a b c
constA (QName -> [XmlTree] -> XmlTree
XN.mkAttr (String -> QName
mkName String
an) [String -> XmlTree
forall a. XmlNode a => String -> a
XN.mkText String
av])
{-# INLINE sattr #-}
getText :: a XmlTree String
getText = (XmlTree -> [String]) -> a XmlTree String
forall b c. (b -> [c]) -> a b c
forall (a :: * -> * -> *) b c. ArrowList a => (b -> [c]) -> a b c
arrL (Maybe String -> [String]
forall a. Maybe a -> [a]
maybeToList (Maybe String -> [String])
-> (XmlTree -> Maybe String) -> XmlTree -> [String]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. XmlTree -> Maybe String
forall a. XmlNode a => a -> Maybe String
XN.getText)
{-# INLINE getText #-}
getCharRef :: a XmlTree Int
getCharRef = (XmlTree -> [Int]) -> a XmlTree Int
forall b c. (b -> [c]) -> a b c
forall (a :: * -> * -> *) b c. ArrowList a => (b -> [c]) -> a b c
arrL (Maybe Int -> [Int]
forall a. Maybe a -> [a]
maybeToList (Maybe Int -> [Int]) -> (XmlTree -> Maybe Int) -> XmlTree -> [Int]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. XmlTree -> Maybe Int
forall a. XmlNode a => a -> Maybe Int
XN.getCharRef)
{-# INLINE getCharRef #-}
getEntityRef :: a XmlTree String
getEntityRef = (XmlTree -> [String]) -> a XmlTree String
forall b c. (b -> [c]) -> a b c
forall (a :: * -> * -> *) b c. ArrowList a => (b -> [c]) -> a b c
arrL (Maybe String -> [String]
forall a. Maybe a -> [a]
maybeToList (Maybe String -> [String])
-> (XmlTree -> Maybe String) -> XmlTree -> [String]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. XmlTree -> Maybe String
forall a. XmlNode a => a -> Maybe String
XN.getEntityRef)
{-# INLINE getEntityRef #-}
getCmt :: a XmlTree String
getCmt = (XmlTree -> [String]) -> a XmlTree String
forall b c. (b -> [c]) -> a b c
forall (a :: * -> * -> *) b c. ArrowList a => (b -> [c]) -> a b c
arrL (Maybe String -> [String]
forall a. Maybe a -> [a]
maybeToList (Maybe String -> [String])
-> (XmlTree -> Maybe String) -> XmlTree -> [String]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. XmlTree -> Maybe String
forall a. XmlNode a => a -> Maybe String
XN.getCmt)
{-# INLINE getCmt #-}
getCdata :: a XmlTree String
getCdata = (XmlTree -> [String]) -> a XmlTree String
forall b c. (b -> [c]) -> a b c
forall (a :: * -> * -> *) b c. ArrowList a => (b -> [c]) -> a b c
arrL (Maybe String -> [String]
forall a. Maybe a -> [a]
maybeToList (Maybe String -> [String])
-> (XmlTree -> Maybe String) -> XmlTree -> [String]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. XmlTree -> Maybe String
forall a. XmlNode a => a -> Maybe String
XN.getCdata)
{-# INLINE getCdata #-}
getPiName :: a XmlTree QName
getPiName = (XmlTree -> [QName]) -> a XmlTree QName
forall b c. (b -> [c]) -> a b c
forall (a :: * -> * -> *) b c. ArrowList a => (b -> [c]) -> a b c
arrL (Maybe QName -> [QName]
forall a. Maybe a -> [a]
maybeToList (Maybe QName -> [QName])
-> (XmlTree -> Maybe QName) -> XmlTree -> [QName]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. XmlTree -> Maybe QName
forall a. XmlNode a => a -> Maybe QName
XN.getPiName)
{-# INLINE getPiName #-}
getPiContent :: a XmlTree XmlTree
getPiContent = (XmlTree -> [XmlTree]) -> a XmlTree XmlTree
forall b c. (b -> [c]) -> a b c
forall (a :: * -> * -> *) b c. ArrowList a => (b -> [c]) -> a b c
arrL ([XmlTree] -> Maybe [XmlTree] -> [XmlTree]
forall a. a -> Maybe a -> a
fromMaybe [] (Maybe [XmlTree] -> [XmlTree])
-> (XmlTree -> Maybe [XmlTree]) -> XmlTree -> [XmlTree]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. XmlTree -> Maybe [XmlTree]
forall a. XmlNode a => a -> Maybe [XmlTree]
XN.getPiContent)
{-# INLINE getPiContent #-}
getElemName :: a XmlTree QName
getElemName = (XmlTree -> [QName]) -> a XmlTree QName
forall b c. (b -> [c]) -> a b c
forall (a :: * -> * -> *) b c. ArrowList a => (b -> [c]) -> a b c
arrL (Maybe QName -> [QName]
forall a. Maybe a -> [a]
maybeToList (Maybe QName -> [QName])
-> (XmlTree -> Maybe QName) -> XmlTree -> [QName]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. XmlTree -> Maybe QName
forall a. XmlNode a => a -> Maybe QName
XN.getElemName)
{-# INLINE getElemName #-}
getAttrl :: a XmlTree XmlTree
getAttrl = (XmlTree -> [XmlTree]) -> a XmlTree XmlTree
forall b c. (b -> [c]) -> a b c
forall (a :: * -> * -> *) b c. ArrowList a => (b -> [c]) -> a b c
arrL ([XmlTree] -> Maybe [XmlTree] -> [XmlTree]
forall a. a -> Maybe a -> a
fromMaybe [] (Maybe [XmlTree] -> [XmlTree])
-> (XmlTree -> Maybe [XmlTree]) -> XmlTree -> [XmlTree]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. XmlTree -> Maybe [XmlTree]
forall a. XmlNode a => a -> Maybe [XmlTree]
XN.getAttrl)
{-# INLINE getAttrl #-}
getDTDPart :: a XmlTree DTDElem
getDTDPart = (XmlTree -> [DTDElem]) -> a XmlTree DTDElem
forall b c. (b -> [c]) -> a b c
forall (a :: * -> * -> *) b c. ArrowList a => (b -> [c]) -> a b c
arrL (Maybe DTDElem -> [DTDElem]
forall a. Maybe a -> [a]
maybeToList (Maybe DTDElem -> [DTDElem])
-> (XmlTree -> Maybe DTDElem) -> XmlTree -> [DTDElem]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. XmlTree -> Maybe DTDElem
forall a. XmlNode a => a -> Maybe DTDElem
XN.getDTDPart)
{-# INLINE getDTDPart #-}
getDTDAttrl :: a XmlTree Attributes
getDTDAttrl = (XmlTree -> [Attributes]) -> a XmlTree Attributes
forall b c. (b -> [c]) -> a b c
forall (a :: * -> * -> *) b c. ArrowList a => (b -> [c]) -> a b c
arrL (Maybe Attributes -> [Attributes]
forall a. Maybe a -> [a]
maybeToList (Maybe Attributes -> [Attributes])
-> (XmlTree -> Maybe Attributes) -> XmlTree -> [Attributes]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. XmlTree -> Maybe Attributes
forall a. XmlNode a => a -> Maybe Attributes
XN.getDTDAttrl)
{-# INLINE getDTDAttrl #-}
getAttrName :: a XmlTree QName
getAttrName = (XmlTree -> [QName]) -> a XmlTree QName
forall b c. (b -> [c]) -> a b c
forall (a :: * -> * -> *) b c. ArrowList a => (b -> [c]) -> a b c
arrL (Maybe QName -> [QName]
forall a. Maybe a -> [a]
maybeToList (Maybe QName -> [QName])
-> (XmlTree -> Maybe QName) -> XmlTree -> [QName]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. XmlTree -> Maybe QName
forall a. XmlNode a => a -> Maybe QName
XN.getAttrName)
{-# INLINE getAttrName #-}
getErrorLevel :: a XmlTree Int
getErrorLevel = (XmlTree -> [Int]) -> a XmlTree Int
forall b c. (b -> [c]) -> a b c
forall (a :: * -> * -> *) b c. ArrowList a => (b -> [c]) -> a b c
arrL (Maybe Int -> [Int]
forall a. Maybe a -> [a]
maybeToList (Maybe Int -> [Int]) -> (XmlTree -> Maybe Int) -> XmlTree -> [Int]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. XmlTree -> Maybe Int
forall a. XmlNode a => a -> Maybe Int
XN.getErrorLevel)
{-# INLINE getErrorLevel #-}
getErrorMsg :: a XmlTree String
getErrorMsg = (XmlTree -> [String]) -> a XmlTree String
forall b c. (b -> [c]) -> a b c
forall (a :: * -> * -> *) b c. ArrowList a => (b -> [c]) -> a b c
arrL (Maybe String -> [String]
forall a. Maybe a -> [a]
maybeToList (Maybe String -> [String])
-> (XmlTree -> Maybe String) -> XmlTree -> [String]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. XmlTree -> Maybe String
forall a. XmlNode a => a -> Maybe String
XN.getErrorMsg)
{-# INLINE getErrorMsg #-}
getQName :: a XmlTree QName
getQName = (XmlTree -> [QName]) -> a XmlTree QName
forall b c. (b -> [c]) -> a b c
forall (a :: * -> * -> *) b c. ArrowList a => (b -> [c]) -> a b c
arrL (Maybe QName -> [QName]
forall a. Maybe a -> [a]
maybeToList (Maybe QName -> [QName])
-> (XmlTree -> Maybe QName) -> XmlTree -> [QName]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. XmlTree -> Maybe QName
forall a. XmlNode a => a -> Maybe QName
XN.getName)
{-# INLINE getQName #-}
getName :: a XmlTree String
getName = (XmlTree -> [String]) -> a XmlTree String
forall b c. (b -> [c]) -> a b c
forall (a :: * -> * -> *) b c. ArrowList a => (b -> [c]) -> a b c
arrL (Maybe String -> [String]
forall a. Maybe a -> [a]
maybeToList (Maybe String -> [String])
-> (XmlTree -> Maybe String) -> XmlTree -> [String]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. XmlTree -> Maybe String
forall a. XmlNode a => a -> Maybe String
XN.getQualifiedName)
{-# INLINE getName #-}
getUniversalName :: a XmlTree String
getUniversalName = (XmlTree -> [String]) -> a XmlTree String
forall b c. (b -> [c]) -> a b c
forall (a :: * -> * -> *) b c. ArrowList a => (b -> [c]) -> a b c
arrL (Maybe String -> [String]
forall a. Maybe a -> [a]
maybeToList (Maybe String -> [String])
-> (XmlTree -> Maybe String) -> XmlTree -> [String]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. XmlTree -> Maybe String
forall a. XmlNode a => a -> Maybe String
XN.getUniversalName)
{-# INLINE getUniversalName #-}
getUniversalUri :: a XmlTree String
getUniversalUri = (XmlTree -> [String]) -> a XmlTree String
forall b c. (b -> [c]) -> a b c
forall (a :: * -> * -> *) b c. ArrowList a => (b -> [c]) -> a b c
arrL (Maybe String -> [String]
forall a. Maybe a -> [a]
maybeToList (Maybe String -> [String])
-> (XmlTree -> Maybe String) -> XmlTree -> [String]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. XmlTree -> Maybe String
forall a. XmlNode a => a -> Maybe String
XN.getUniversalUri)
{-# INLINE getUniversalUri #-}
getLocalPart :: a XmlTree String
getLocalPart = (XmlTree -> [String]) -> a XmlTree String
forall b c. (b -> [c]) -> a b c
forall (a :: * -> * -> *) b c. ArrowList a => (b -> [c]) -> a b c
arrL (Maybe String -> [String]
forall a. Maybe a -> [a]
maybeToList (Maybe String -> [String])
-> (XmlTree -> Maybe String) -> XmlTree -> [String]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. XmlTree -> Maybe String
forall a. XmlNode a => a -> Maybe String
XN.getLocalPart)
{-# INLINE getLocalPart #-}
getNamePrefix :: a XmlTree String
getNamePrefix = (XmlTree -> [String]) -> a XmlTree String
forall b c. (b -> [c]) -> a b c
forall (a :: * -> * -> *) b c. ArrowList a => (b -> [c]) -> a b c
arrL (Maybe String -> [String]
forall a. Maybe a -> [a]
maybeToList (Maybe String -> [String])
-> (XmlTree -> Maybe String) -> XmlTree -> [String]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. XmlTree -> Maybe String
forall a. XmlNode a => a -> Maybe String
XN.getNamePrefix)
{-# INLINE getNamePrefix #-}
getNamespaceUri :: a XmlTree String
getNamespaceUri = (XmlTree -> [String]) -> a XmlTree String
forall b c. (b -> [c]) -> a b c
forall (a :: * -> * -> *) b c. ArrowList a => (b -> [c]) -> a b c
arrL (Maybe String -> [String]
forall a. Maybe a -> [a]
maybeToList (Maybe String -> [String])
-> (XmlTree -> Maybe String) -> XmlTree -> [String]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. XmlTree -> Maybe String
forall a. XmlNode a => a -> Maybe String
XN.getNamespaceUri)
{-# INLINE getNamespaceUri #-}
getAttrValue :: String -> a XmlTree String
getAttrValue String
n = a XmlTree XmlTree -> a XmlTree String
forall n. a n XmlTree -> a n String
forall (a :: * -> * -> *) n.
ArrowXml a =>
a n XmlTree -> a n String
xshow (a XmlTree XmlTree
forall (a :: * -> * -> *). ArrowXml a => a XmlTree XmlTree
getAttrl a XmlTree XmlTree -> a XmlTree XmlTree -> a XmlTree XmlTree
forall {k} (cat :: k -> k -> *) (a :: k) (b :: k) (c :: k).
Category cat =>
cat a b -> cat b c -> cat a c
>>> String -> a XmlTree XmlTree
forall (a :: * -> * -> *).
ArrowXml a =>
String -> a XmlTree XmlTree
hasName String
n a XmlTree XmlTree -> a XmlTree XmlTree -> a XmlTree XmlTree
forall {k} (cat :: k -> k -> *) (a :: k) (b :: k) (c :: k).
Category cat =>
cat a b -> cat b c -> cat a c
>>> a XmlTree XmlTree
forall (t :: * -> *) b. Tree t => a (t b) (t b)
forall (a :: * -> * -> *) (t :: * -> *) b.
(ArrowTree a, Tree t) =>
a (t b) (t b)
getChildren)
getAttrValue0 :: String -> a XmlTree String
getAttrValue0 String
n = a XmlTree XmlTree
forall (a :: * -> * -> *). ArrowXml a => a XmlTree XmlTree
getAttrl a XmlTree XmlTree -> a XmlTree String -> a XmlTree String
forall {k} (cat :: k -> k -> *) (a :: k) (b :: k) (c :: k).
Category cat =>
cat a b -> cat b c -> cat a c
>>> String -> a XmlTree XmlTree
forall (a :: * -> * -> *).
ArrowXml a =>
String -> a XmlTree XmlTree
hasName String
n a XmlTree XmlTree -> a XmlTree String -> a XmlTree String
forall {k} (cat :: k -> k -> *) (a :: k) (b :: k) (c :: k).
Category cat =>
cat a b -> cat b c -> cat a c
>>> a XmlTree XmlTree -> a XmlTree String
forall n. a n XmlTree -> a n String
forall (a :: * -> * -> *) n.
ArrowXml a =>
a n XmlTree -> a n String
xshow a XmlTree XmlTree
forall (t :: * -> *) b. Tree t => a (t b) (t b)
forall (a :: * -> * -> *) (t :: * -> *) b.
(ArrowTree a, Tree t) =>
a (t b) (t b)
getChildren
getQAttrValue :: QName -> a XmlTree String
getQAttrValue QName
n = a XmlTree XmlTree -> a XmlTree String
forall n. a n XmlTree -> a n String
forall (a :: * -> * -> *) n.
ArrowXml a =>
a n XmlTree -> a n String
xshow (a XmlTree XmlTree
forall (a :: * -> * -> *). ArrowXml a => a XmlTree XmlTree
getAttrl a XmlTree XmlTree -> a XmlTree XmlTree -> a XmlTree XmlTree
forall {k} (cat :: k -> k -> *) (a :: k) (b :: k) (c :: k).
Category cat =>
cat a b -> cat b c -> cat a c
>>> QName -> a XmlTree XmlTree
forall (a :: * -> * -> *). ArrowXml a => QName -> a XmlTree XmlTree
hasQName QName
n a XmlTree XmlTree -> a XmlTree XmlTree -> a XmlTree XmlTree
forall {k} (cat :: k -> k -> *) (a :: k) (b :: k) (c :: k).
Category cat =>
cat a b -> cat b c -> cat a c
>>> a XmlTree XmlTree
forall (t :: * -> *) b. Tree t => a (t b) (t b)
forall (a :: * -> * -> *) (t :: * -> *) b.
(ArrowTree a, Tree t) =>
a (t b) (t b)
getChildren)
getQAttrValue0 :: QName -> a XmlTree String
getQAttrValue0 QName
n = a XmlTree XmlTree
forall (a :: * -> * -> *). ArrowXml a => a XmlTree XmlTree
getAttrl a XmlTree XmlTree -> a XmlTree String -> a XmlTree String
forall {k} (cat :: k -> k -> *) (a :: k) (b :: k) (c :: k).
Category cat =>
cat a b -> cat b c -> cat a c
>>> QName -> a XmlTree XmlTree
forall (a :: * -> * -> *). ArrowXml a => QName -> a XmlTree XmlTree
hasQName QName
n a XmlTree XmlTree -> a XmlTree String -> a XmlTree String
forall {k} (cat :: k -> k -> *) (a :: k) (b :: k) (c :: k).
Category cat =>
cat a b -> cat b c -> cat a c
>>> a XmlTree XmlTree -> a XmlTree String
forall n. a n XmlTree -> a n String
forall (a :: * -> * -> *) n.
ArrowXml a =>
a n XmlTree -> a n String
xshow a XmlTree XmlTree
forall (t :: * -> *) b. Tree t => a (t b) (t b)
forall (a :: * -> * -> *) (t :: * -> *) b.
(ArrowTree a, Tree t) =>
a (t b) (t b)
getChildren
changeText :: (String -> String) -> a XmlTree XmlTree
changeText String -> String
cf = (XmlTree -> XmlTree) -> a XmlTree XmlTree
forall b c. (b -> c) -> a b c
forall (a :: * -> * -> *) b c. Arrow a => (b -> c) -> a b c
arr ((String -> String) -> XmlTree -> XmlTree
forall a. XmlNode a => (String -> String) -> a -> a
XN.changeText String -> String
cf) a XmlTree XmlTree -> a XmlTree XmlTree -> a XmlTree XmlTree
forall b c. a b b -> a b c -> a b b
forall (a :: * -> * -> *) b c. ArrowIf a => a b b -> a b c -> a b b
`when` a XmlTree XmlTree
forall (a :: * -> * -> *). ArrowXml a => a XmlTree XmlTree
isText
changeBlob :: (Blob -> Blob) -> a XmlTree XmlTree
changeBlob Blob -> Blob
cf = (XmlTree -> XmlTree) -> a XmlTree XmlTree
forall b c. (b -> c) -> a b c
forall (a :: * -> * -> *) b c. Arrow a => (b -> c) -> a b c
arr ((Blob -> Blob) -> XmlTree -> XmlTree
forall a. XmlNode a => (Blob -> Blob) -> a -> a
XN.changeBlob Blob -> Blob
cf) a XmlTree XmlTree -> a XmlTree XmlTree -> a XmlTree XmlTree
forall b c. a b b -> a b c -> a b b
forall (a :: * -> * -> *) b c. ArrowIf a => a b b -> a b c -> a b b
`when` a XmlTree XmlTree
forall (a :: * -> * -> *). ArrowXml a => a XmlTree XmlTree
isBlob
changeCmt :: (String -> String) -> a XmlTree XmlTree
changeCmt String -> String
cf = (XmlTree -> XmlTree) -> a XmlTree XmlTree
forall b c. (b -> c) -> a b c
forall (a :: * -> * -> *) b c. Arrow a => (b -> c) -> a b c
arr ((String -> String) -> XmlTree -> XmlTree
forall a. XmlNode a => (String -> String) -> a -> a
XN.changeCmt String -> String
cf) a XmlTree XmlTree -> a XmlTree XmlTree -> a XmlTree XmlTree
forall b c. a b b -> a b c -> a b b
forall (a :: * -> * -> *) b c. ArrowIf a => a b b -> a b c -> a b b
`when` a XmlTree XmlTree
forall (a :: * -> * -> *). ArrowXml a => a XmlTree XmlTree
isCmt
changeQName :: (QName -> QName) -> a XmlTree XmlTree
changeQName QName -> QName
cf = (XmlTree -> XmlTree) -> a XmlTree XmlTree
forall b c. (b -> c) -> a b c
forall (a :: * -> * -> *) b c. Arrow a => (b -> c) -> a b c
arr ((QName -> QName) -> XmlTree -> XmlTree
forall a. XmlNode a => (QName -> QName) -> a -> a
XN.changeName QName -> QName
cf) a XmlTree XmlTree -> a XmlTree QName -> a XmlTree XmlTree
forall b c. a b b -> a b c -> a b b
forall (a :: * -> * -> *) b c. ArrowIf a => a b b -> a b c -> a b b
`when` a XmlTree QName
forall (a :: * -> * -> *). ArrowXml a => a XmlTree QName
getQName
changeElemName :: (QName -> QName) -> a XmlTree XmlTree
changeElemName QName -> QName
cf = (XmlTree -> XmlTree) -> a XmlTree XmlTree
forall b c. (b -> c) -> a b c
forall (a :: * -> * -> *) b c. Arrow a => (b -> c) -> a b c
arr ((QName -> QName) -> XmlTree -> XmlTree
forall a. XmlNode a => (QName -> QName) -> a -> a
XN.changeElemName QName -> QName
cf) a XmlTree XmlTree -> a XmlTree XmlTree -> a XmlTree XmlTree
forall b c. a b b -> a b c -> a b b
forall (a :: * -> * -> *) b c. ArrowIf a => a b b -> a b c -> a b b
`when` a XmlTree XmlTree
forall (a :: * -> * -> *). ArrowXml a => a XmlTree XmlTree
isElem
changeAttrName :: (QName -> QName) -> a XmlTree XmlTree
changeAttrName QName -> QName
cf = (XmlTree -> XmlTree) -> a XmlTree XmlTree
forall b c. (b -> c) -> a b c
forall (a :: * -> * -> *) b c. Arrow a => (b -> c) -> a b c
arr ((QName -> QName) -> XmlTree -> XmlTree
forall a. XmlNode a => (QName -> QName) -> a -> a
XN.changeAttrName QName -> QName
cf) a XmlTree XmlTree -> a XmlTree XmlTree -> a XmlTree XmlTree
forall b c. a b b -> a b c -> a b b
forall (a :: * -> * -> *) b c. ArrowIf a => a b b -> a b c -> a b b
`when` a XmlTree XmlTree
forall (a :: * -> * -> *). ArrowXml a => a XmlTree XmlTree
isAttr
changePiName :: (QName -> QName) -> a XmlTree XmlTree
changePiName QName -> QName
cf = (XmlTree -> XmlTree) -> a XmlTree XmlTree
forall b c. (b -> c) -> a b c
forall (a :: * -> * -> *) b c. Arrow a => (b -> c) -> a b c
arr ((QName -> QName) -> XmlTree -> XmlTree
forall a. XmlNode a => (QName -> QName) -> a -> a
XN.changePiName QName -> QName
cf) a XmlTree XmlTree -> a XmlTree XmlTree -> a XmlTree XmlTree
forall b c. a b b -> a b c -> a b b
forall (a :: * -> * -> *) b c. ArrowIf a => a b b -> a b c -> a b b
`when` a XmlTree XmlTree
forall (a :: * -> * -> *). ArrowXml a => a XmlTree XmlTree
isPi
changeAttrValue :: (String -> String) -> a XmlTree XmlTree
changeAttrValue String -> String
cf = a XmlTree XmlTree -> a XmlTree XmlTree
forall (t :: * -> *) b. Tree t => a (t b) (t b) -> a (t b) (t b)
forall (a :: * -> * -> *) (t :: * -> *) b.
(ArrowTree a, Tree t) =>
a (t b) (t b) -> a (t b) (t b)
replaceChildren ( a XmlTree XmlTree -> a XmlTree String
forall n. a n XmlTree -> a n String
forall (a :: * -> * -> *) n.
ArrowXml a =>
a n XmlTree -> a n String
xshow a XmlTree XmlTree
forall (t :: * -> *) b. Tree t => a (t b) (t b)
forall (a :: * -> * -> *) (t :: * -> *) b.
(ArrowTree a, Tree t) =>
a (t b) (t b)
getChildren
a XmlTree String -> a String XmlTree -> a XmlTree XmlTree
forall {k} (cat :: k -> k -> *) (a :: k) (b :: k) (c :: k).
Category cat =>
cat a b -> cat b c -> cat a c
>>> (String -> String) -> a String String
forall b c. (b -> c) -> a b c
forall (a :: * -> * -> *) b c. Arrow a => (b -> c) -> a b c
arr String -> String
cf
a String String -> a String XmlTree -> a String XmlTree
forall {k} (cat :: k -> k -> *) (a :: k) (b :: k) (c :: k).
Category cat =>
cat a b -> cat b c -> cat a c
>>> a String XmlTree
forall (a :: * -> * -> *). ArrowXml a => a String XmlTree
mkText
)
a XmlTree XmlTree -> a XmlTree XmlTree -> a XmlTree XmlTree
forall b c. a b b -> a b c -> a b b
forall (a :: * -> * -> *) b c. ArrowIf a => a b b -> a b c -> a b b
`when` a XmlTree XmlTree
forall (a :: * -> * -> *). ArrowXml a => a XmlTree XmlTree
isAttr
changeAttrl :: (XmlTrees -> XmlTrees -> XmlTrees) -> a XmlTree XmlTree -> a XmlTree XmlTree
changeAttrl [XmlTree] -> [XmlTree] -> [XmlTree]
cf a XmlTree XmlTree
f = ( ( a XmlTree XmlTree -> a XmlTree [XmlTree]
forall b c. a b c -> a b [c]
forall (a :: * -> * -> *) b c. ArrowList a => a b c -> a b [c]
listA a XmlTree XmlTree
f a XmlTree [XmlTree]
-> a XmlTree XmlTree -> a XmlTree ([XmlTree], XmlTree)
forall b c c'. a b c -> a b c' -> a b (c, c')
forall (a :: * -> * -> *) b c c'.
Arrow a =>
a b c -> a b c' -> a b (c, c')
&&& a XmlTree XmlTree
forall b. a b b
forall (a :: * -> * -> *) b. ArrowList a => a b b
this )
a XmlTree ([XmlTree], XmlTree)
-> a ([XmlTree], XmlTree) XmlTree -> a XmlTree XmlTree
forall {k} (cat :: k -> k -> *) (a :: k) (b :: k) (c :: k).
Category cat =>
cat a b -> cat b c -> cat a c
>>>
([XmlTree] -> XmlTree -> XmlTree) -> a ([XmlTree], XmlTree) XmlTree
forall b1 b2 c. (b1 -> b2 -> c) -> a (b1, b2) c
forall (a :: * -> * -> *) b1 b2 c.
ArrowList a =>
(b1 -> b2 -> c) -> a (b1, b2) c
arr2 [XmlTree] -> XmlTree -> XmlTree
forall {a}. XmlNode a => [XmlTree] -> a -> a
changeAL
)
a XmlTree XmlTree -> a XmlTree XmlTree -> a XmlTree XmlTree
forall b c. a b b -> a b c -> a b b
forall (a :: * -> * -> *) b c. ArrowIf a => a b b -> a b c -> a b b
`when`
( a XmlTree XmlTree
forall (a :: * -> * -> *). ArrowXml a => a XmlTree XmlTree
isElem a XmlTree XmlTree -> a XmlTree XmlTree -> a XmlTree XmlTree
forall b c. a b c -> a b c -> a b c
forall (a :: * -> * -> *) b c.
ArrowPlus a =>
a b c -> a b c -> a b c
<+> a XmlTree XmlTree
forall (a :: * -> * -> *). ArrowXml a => a XmlTree XmlTree
isPi )
where
changeAL :: [XmlTree] -> a -> a
changeAL [XmlTree]
as a
x = ([XmlTree] -> [XmlTree]) -> a -> a
forall a. XmlNode a => ([XmlTree] -> [XmlTree]) -> a -> a
XN.changeAttrl (\ [XmlTree]
xs -> [XmlTree] -> [XmlTree] -> [XmlTree]
cf [XmlTree]
xs [XmlTree]
as) a
x
setQName :: QName -> a XmlTree XmlTree
setQName QName
n = (QName -> QName) -> a XmlTree XmlTree
forall (a :: * -> * -> *).
ArrowXml a =>
(QName -> QName) -> a XmlTree XmlTree
changeQName (QName -> QName -> QName
forall a b. a -> b -> a
const QName
n)
{-# INLINE setQName #-}
setElemName :: QName -> a XmlTree XmlTree
setElemName QName
n = (QName -> QName) -> a XmlTree XmlTree
forall (a :: * -> * -> *).
ArrowXml a =>
(QName -> QName) -> a XmlTree XmlTree
changeElemName (QName -> QName -> QName
forall a b. a -> b -> a
const QName
n)
{-# INLINE setElemName #-}
setAttrName :: QName -> a XmlTree XmlTree
setAttrName QName
n = (QName -> QName) -> a XmlTree XmlTree
forall (a :: * -> * -> *).
ArrowXml a =>
(QName -> QName) -> a XmlTree XmlTree
changeAttrName (QName -> QName -> QName
forall a b. a -> b -> a
const QName
n)
{-# INLINE setAttrName #-}
setPiName :: QName -> a XmlTree XmlTree
setPiName QName
n = (QName -> QName) -> a XmlTree XmlTree
forall (a :: * -> * -> *).
ArrowXml a =>
(QName -> QName) -> a XmlTree XmlTree
changePiName (QName -> QName -> QName
forall a b. a -> b -> a
const QName
n)
{-# INLINE setPiName #-}
setAttrl :: a XmlTree XmlTree -> a XmlTree XmlTree
setAttrl = ([XmlTree] -> [XmlTree] -> [XmlTree])
-> a XmlTree XmlTree -> a XmlTree XmlTree
forall (a :: * -> * -> *).
ArrowXml a =>
([XmlTree] -> [XmlTree] -> [XmlTree])
-> a XmlTree XmlTree -> a XmlTree XmlTree
changeAttrl (([XmlTree] -> [XmlTree]) -> [XmlTree] -> [XmlTree] -> [XmlTree]
forall a b. a -> b -> a
const [XmlTree] -> [XmlTree]
forall a. a -> a
id)
{-# INLINE setAttrl #-}
addAttrl :: a XmlTree XmlTree -> a XmlTree XmlTree
addAttrl = ([XmlTree] -> [XmlTree] -> [XmlTree])
-> a XmlTree XmlTree -> a XmlTree XmlTree
forall (a :: * -> * -> *).
ArrowXml a =>
([XmlTree] -> [XmlTree] -> [XmlTree])
-> a XmlTree XmlTree -> a XmlTree XmlTree
changeAttrl ([XmlTree] -> [XmlTree] -> [XmlTree]
XN.mergeAttrl)
{-# INLINE addAttrl #-}
addAttr :: String -> String -> a XmlTree XmlTree
addAttr String
an String
av = a XmlTree XmlTree -> a XmlTree XmlTree
forall (a :: * -> * -> *).
ArrowXml a =>
a XmlTree XmlTree -> a XmlTree XmlTree
addAttrl (String -> String -> a XmlTree XmlTree
forall n. String -> String -> a n XmlTree
forall (a :: * -> * -> *) n.
ArrowXml a =>
String -> String -> a n XmlTree
sattr String
an String
av)
{-# INLINE addAttr #-}
removeAttr :: String -> a XmlTree XmlTree
removeAttr String
an = a XmlTree XmlTree -> a XmlTree XmlTree
forall (a :: * -> * -> *).
ArrowXml a =>
a XmlTree XmlTree -> a XmlTree XmlTree
processAttrl (a XmlTree XmlTree
forall b c. a b c
forall (a :: * -> * -> *) b c. ArrowList a => a b c
none a XmlTree XmlTree -> a XmlTree XmlTree -> a XmlTree XmlTree
forall b c. a b b -> a b c -> a b b
forall (a :: * -> * -> *) b c. ArrowIf a => a b b -> a b c -> a b b
`when` String -> a XmlTree XmlTree
forall (a :: * -> * -> *).
ArrowXml a =>
String -> a XmlTree XmlTree
hasName String
an)
removeQAttr :: QName -> a XmlTree XmlTree
removeQAttr QName
an = a XmlTree XmlTree -> a XmlTree XmlTree
forall (a :: * -> * -> *).
ArrowXml a =>
a XmlTree XmlTree -> a XmlTree XmlTree
processAttrl (a XmlTree XmlTree
forall b c. a b c
forall (a :: * -> * -> *) b c. ArrowList a => a b c
none a XmlTree XmlTree -> a XmlTree XmlTree -> a XmlTree XmlTree
forall b c. a b b -> a b c -> a b b
forall (a :: * -> * -> *) b c. ArrowIf a => a b b -> a b c -> a b b
`when` QName -> a XmlTree XmlTree
forall (a :: * -> * -> *). ArrowXml a => QName -> a XmlTree XmlTree
hasQName QName
an)
processAttrl :: a XmlTree XmlTree -> a XmlTree XmlTree
processAttrl a XmlTree XmlTree
f = a XmlTree XmlTree -> a XmlTree XmlTree
forall (a :: * -> * -> *).
ArrowXml a =>
a XmlTree XmlTree -> a XmlTree XmlTree
setAttrl (a XmlTree XmlTree
forall (a :: * -> * -> *). ArrowXml a => a XmlTree XmlTree
getAttrl a XmlTree XmlTree -> a XmlTree XmlTree -> a XmlTree XmlTree
forall {k} (cat :: k -> k -> *) (a :: k) (b :: k) (c :: k).
Category cat =>
cat a b -> cat b c -> cat a c
>>> a XmlTree XmlTree
f)
processTopDownWithAttrl :: a XmlTree XmlTree -> a XmlTree XmlTree
processTopDownWithAttrl a XmlTree XmlTree
f = a XmlTree XmlTree -> a XmlTree XmlTree
forall (t :: * -> *) b. Tree t => a (t b) (t b) -> a (t b) (t b)
forall (a :: * -> * -> *) (t :: * -> *) b.
(ArrowTree a, Tree t) =>
a (t b) (t b) -> a (t b) (t b)
processTopDown ( a XmlTree XmlTree
f a XmlTree XmlTree -> a XmlTree XmlTree -> a XmlTree XmlTree
forall {k} (cat :: k -> k -> *) (a :: k) (b :: k) (c :: k).
Category cat =>
cat a b -> cat b c -> cat a c
>>> ( a XmlTree XmlTree -> a XmlTree XmlTree
forall (a :: * -> * -> *).
ArrowXml a =>
a XmlTree XmlTree -> a XmlTree XmlTree
processAttrl (a XmlTree XmlTree -> a XmlTree XmlTree
forall (t :: * -> *) b. Tree t => a (t b) (t b) -> a (t b) (t b)
forall (a :: * -> * -> *) (t :: * -> *) b.
(ArrowTree a, Tree t) =>
a (t b) (t b) -> a (t b) (t b)
processTopDown a XmlTree XmlTree
f) a XmlTree XmlTree -> a XmlTree XmlTree -> a XmlTree XmlTree
forall b c. a b b -> a b c -> a b b
forall (a :: * -> * -> *) b c. ArrowIf a => a b b -> a b c -> a b b
`when` a XmlTree XmlTree
forall (a :: * -> * -> *). ArrowXml a => a XmlTree XmlTree
isElem))
(+=) :: a b XmlTree -> a b XmlTree -> a b XmlTree
a b XmlTree
tf += a b XmlTree
cf = (a b XmlTree
tf a b XmlTree -> a b [XmlTree] -> a b (XmlTree, [XmlTree])
forall b c c'. a b c -> a b c' -> a b (c, c')
forall (a :: * -> * -> *) b c c'.
Arrow a =>
a b c -> a b c' -> a b (c, c')
&&& a b XmlTree -> a b [XmlTree]
forall b c. a b c -> a b [c]
forall (a :: * -> * -> *) b c. ArrowList a => a b c -> a b [c]
listA a b XmlTree
cf) a b (XmlTree, [XmlTree])
-> a (XmlTree, [XmlTree]) XmlTree -> a b XmlTree
forall {k} (cat :: k -> k -> *) (a :: k) (b :: k) (c :: k).
Category cat =>
cat a b -> cat b c -> cat a c
>>> (XmlTree -> [XmlTree] -> XmlTree) -> a (XmlTree, [XmlTree]) XmlTree
forall b1 b2 c. (b1 -> b2 -> c) -> a (b1, b2) c
forall (a :: * -> * -> *) b1 b2 c.
ArrowList a =>
(b1 -> b2 -> c) -> a (b1, b2) c
arr2 XmlTree -> [XmlTree] -> XmlTree
addChildren
where
addChildren :: XmlTree -> XmlTrees -> XmlTree
addChildren :: XmlTree -> [XmlTree] -> XmlTree
addChildren XmlTree
t [XmlTree]
cs
= (XmlTree -> XmlTree -> XmlTree) -> XmlTree -> [XmlTree] -> XmlTree
forall b a. (b -> a -> b) -> b -> [a] -> b
forall (t :: * -> *) b a.
Foldable t =>
(b -> a -> b) -> b -> t a -> b
foldl XmlTree -> XmlTree -> XmlTree
addChild XmlTree
t [XmlTree]
cs
addChild :: XmlTree -> XmlTree -> XmlTree
addChild :: XmlTree -> XmlTree -> XmlTree
addChild XmlTree
t XmlTree
c
| Bool -> Bool
not (XmlTree -> Bool
forall a. XmlNode a => a -> Bool
XN.isElem XmlTree
t)
= XmlTree
t
| XmlTree -> Bool
forall a. XmlNode a => a -> Bool
XN.isAttr XmlTree
c
= ([XmlTree] -> [XmlTree]) -> XmlTree -> XmlTree
forall a. XmlNode a => ([XmlTree] -> [XmlTree]) -> a -> a
XN.changeAttrl (XmlTree -> [XmlTree] -> [XmlTree]
XN.addAttr XmlTree
c) XmlTree
t
| Bool
otherwise
= ([XmlTree] -> [XmlTree]) -> XmlTree -> XmlTree
forall a. ([NTree a] -> [NTree a]) -> NTree a -> NTree a
forall (t :: * -> *) a. Tree t => ([t a] -> [t a]) -> t a -> t a
XN.changeChildren ([XmlTree] -> [XmlTree] -> [XmlTree]
forall a. [a] -> [a] -> [a]
++ [XmlTree
c]) XmlTree
t
xshow :: a n XmlTree -> a n String
xshow a n XmlTree
f = a n XmlTree
f a n XmlTree -> ([XmlTree] -> String) -> a n String
forall b c d. a b c -> ([c] -> d) -> a b d
forall (a :: * -> * -> *) b c d.
ArrowList a =>
a b c -> ([c] -> d) -> a b d
>. [XmlTree] -> String
XS.xshow
{-# INLINE xshow #-}
xshowBlob :: a n XmlTree -> a n Blob
xshowBlob a n XmlTree
f = a n XmlTree
f a n XmlTree -> ([XmlTree] -> Blob) -> a n Blob
forall b c d. a b c -> ([c] -> d) -> a b d
forall (a :: * -> * -> *) b c d.
ArrowList a =>
a b c -> ([c] -> d) -> a b d
>. [XmlTree] -> Blob
XS.xshowBlob
{-# INLINE xshowBlob #-}
class (ArrowXml a) => ArrowDTD a where
isDTDDoctype :: a XmlTree XmlTree
isDTDDoctype = (XmlTree -> Bool) -> a XmlTree XmlTree
forall b. (b -> Bool) -> a b b
forall (a :: * -> * -> *) b. ArrowList a => (b -> Bool) -> a b b
isA (Bool -> (DTDElem -> Bool) -> Maybe DTDElem -> Bool
forall b a. b -> (a -> b) -> Maybe a -> b
maybe Bool
False (DTDElem -> DTDElem -> Bool
forall a. Eq a => a -> a -> Bool
== DTDElem
DOCTYPE ) (Maybe DTDElem -> Bool)
-> (XmlTree -> Maybe DTDElem) -> XmlTree -> Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. XmlTree -> Maybe DTDElem
forall a. XmlNode a => a -> Maybe DTDElem
XN.getDTDPart)
isDTDElement :: a XmlTree XmlTree
isDTDElement = (XmlTree -> Bool) -> a XmlTree XmlTree
forall b. (b -> Bool) -> a b b
forall (a :: * -> * -> *) b. ArrowList a => (b -> Bool) -> a b b
isA (Bool -> (DTDElem -> Bool) -> Maybe DTDElem -> Bool
forall b a. b -> (a -> b) -> Maybe a -> b
maybe Bool
False (DTDElem -> DTDElem -> Bool
forall a. Eq a => a -> a -> Bool
== DTDElem
ELEMENT ) (Maybe DTDElem -> Bool)
-> (XmlTree -> Maybe DTDElem) -> XmlTree -> Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. XmlTree -> Maybe DTDElem
forall a. XmlNode a => a -> Maybe DTDElem
XN.getDTDPart)
isDTDContent :: a XmlTree XmlTree
isDTDContent = (XmlTree -> Bool) -> a XmlTree XmlTree
forall b. (b -> Bool) -> a b b
forall (a :: * -> * -> *) b. ArrowList a => (b -> Bool) -> a b b
isA (Bool -> (DTDElem -> Bool) -> Maybe DTDElem -> Bool
forall b a. b -> (a -> b) -> Maybe a -> b
maybe Bool
False (DTDElem -> DTDElem -> Bool
forall a. Eq a => a -> a -> Bool
== DTDElem
CONTENT ) (Maybe DTDElem -> Bool)
-> (XmlTree -> Maybe DTDElem) -> XmlTree -> Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. XmlTree -> Maybe DTDElem
forall a. XmlNode a => a -> Maybe DTDElem
XN.getDTDPart)
isDTDAttlist :: a XmlTree XmlTree
isDTDAttlist = (XmlTree -> Bool) -> a XmlTree XmlTree
forall b. (b -> Bool) -> a b b
forall (a :: * -> * -> *) b. ArrowList a => (b -> Bool) -> a b b
isA (Bool -> (DTDElem -> Bool) -> Maybe DTDElem -> Bool
forall b a. b -> (a -> b) -> Maybe a -> b
maybe Bool
False (DTDElem -> DTDElem -> Bool
forall a. Eq a => a -> a -> Bool
== DTDElem
ATTLIST ) (Maybe DTDElem -> Bool)
-> (XmlTree -> Maybe DTDElem) -> XmlTree -> Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. XmlTree -> Maybe DTDElem
forall a. XmlNode a => a -> Maybe DTDElem
XN.getDTDPart)
isDTDEntity :: a XmlTree XmlTree
isDTDEntity = (XmlTree -> Bool) -> a XmlTree XmlTree
forall b. (b -> Bool) -> a b b
forall (a :: * -> * -> *) b. ArrowList a => (b -> Bool) -> a b b
isA (Bool -> (DTDElem -> Bool) -> Maybe DTDElem -> Bool
forall b a. b -> (a -> b) -> Maybe a -> b
maybe Bool
False (DTDElem -> DTDElem -> Bool
forall a. Eq a => a -> a -> Bool
== DTDElem
ENTITY ) (Maybe DTDElem -> Bool)
-> (XmlTree -> Maybe DTDElem) -> XmlTree -> Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. XmlTree -> Maybe DTDElem
forall a. XmlNode a => a -> Maybe DTDElem
XN.getDTDPart)
isDTDPEntity :: a XmlTree XmlTree
isDTDPEntity = (XmlTree -> Bool) -> a XmlTree XmlTree
forall b. (b -> Bool) -> a b b
forall (a :: * -> * -> *) b. ArrowList a => (b -> Bool) -> a b b
isA (Bool -> (DTDElem -> Bool) -> Maybe DTDElem -> Bool
forall b a. b -> (a -> b) -> Maybe a -> b
maybe Bool
False (DTDElem -> DTDElem -> Bool
forall a. Eq a => a -> a -> Bool
== DTDElem
PENTITY ) (Maybe DTDElem -> Bool)
-> (XmlTree -> Maybe DTDElem) -> XmlTree -> Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. XmlTree -> Maybe DTDElem
forall a. XmlNode a => a -> Maybe DTDElem
XN.getDTDPart)
isDTDNotation :: a XmlTree XmlTree
isDTDNotation = (XmlTree -> Bool) -> a XmlTree XmlTree
forall b. (b -> Bool) -> a b b
forall (a :: * -> * -> *) b. ArrowList a => (b -> Bool) -> a b b
isA (Bool -> (DTDElem -> Bool) -> Maybe DTDElem -> Bool
forall b a. b -> (a -> b) -> Maybe a -> b
maybe Bool
False (DTDElem -> DTDElem -> Bool
forall a. Eq a => a -> a -> Bool
== DTDElem
NOTATION) (Maybe DTDElem -> Bool)
-> (XmlTree -> Maybe DTDElem) -> XmlTree -> Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. XmlTree -> Maybe DTDElem
forall a. XmlNode a => a -> Maybe DTDElem
XN.getDTDPart)
isDTDCondSect :: a XmlTree XmlTree
isDTDCondSect = (XmlTree -> Bool) -> a XmlTree XmlTree
forall b. (b -> Bool) -> a b b
forall (a :: * -> * -> *) b. ArrowList a => (b -> Bool) -> a b b
isA (Bool -> (DTDElem -> Bool) -> Maybe DTDElem -> Bool
forall b a. b -> (a -> b) -> Maybe a -> b
maybe Bool
False (DTDElem -> DTDElem -> Bool
forall a. Eq a => a -> a -> Bool
== DTDElem
CONDSECT) (Maybe DTDElem -> Bool)
-> (XmlTree -> Maybe DTDElem) -> XmlTree -> Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. XmlTree -> Maybe DTDElem
forall a. XmlNode a => a -> Maybe DTDElem
XN.getDTDPart)
isDTDName :: a XmlTree XmlTree
isDTDName = (XmlTree -> Bool) -> a XmlTree XmlTree
forall b. (b -> Bool) -> a b b
forall (a :: * -> * -> *) b. ArrowList a => (b -> Bool) -> a b b
isA (Bool -> (DTDElem -> Bool) -> Maybe DTDElem -> Bool
forall b a. b -> (a -> b) -> Maybe a -> b
maybe Bool
False (DTDElem -> DTDElem -> Bool
forall a. Eq a => a -> a -> Bool
== DTDElem
NAME ) (Maybe DTDElem -> Bool)
-> (XmlTree -> Maybe DTDElem) -> XmlTree -> Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. XmlTree -> Maybe DTDElem
forall a. XmlNode a => a -> Maybe DTDElem
XN.getDTDPart)
isDTDPERef :: a XmlTree XmlTree
isDTDPERef = (XmlTree -> Bool) -> a XmlTree XmlTree
forall b. (b -> Bool) -> a b b
forall (a :: * -> * -> *) b. ArrowList a => (b -> Bool) -> a b b
isA (Bool -> (DTDElem -> Bool) -> Maybe DTDElem -> Bool
forall b a. b -> (a -> b) -> Maybe a -> b
maybe Bool
False (DTDElem -> DTDElem -> Bool
forall a. Eq a => a -> a -> Bool
== DTDElem
PEREF ) (Maybe DTDElem -> Bool)
-> (XmlTree -> Maybe DTDElem) -> XmlTree -> Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. XmlTree -> Maybe DTDElem
forall a. XmlNode a => a -> Maybe DTDElem
XN.getDTDPart)
hasDTDAttr :: String -> a XmlTree XmlTree
hasDTDAttr String
n = (XmlTree -> Bool) -> a XmlTree XmlTree
forall b. (b -> Bool) -> a b b
forall (a :: * -> * -> *) b. ArrowList a => (b -> Bool) -> a b b
isA (Maybe String -> Bool
forall a. Maybe a -> Bool
isJust (Maybe String -> Bool)
-> (XmlTree -> Maybe String) -> XmlTree -> Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> Attributes -> Maybe String
forall a b. Eq a => a -> [(a, b)] -> Maybe b
lookup String
n (Attributes -> Maybe String)
-> (XmlTree -> Attributes) -> XmlTree -> Maybe String
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Attributes -> Maybe Attributes -> Attributes
forall a. a -> Maybe a -> a
fromMaybe [] (Maybe Attributes -> Attributes)
-> (XmlTree -> Maybe Attributes) -> XmlTree -> Attributes
forall b c a. (b -> c) -> (a -> b) -> a -> c
. XmlTree -> Maybe Attributes
forall a. XmlNode a => a -> Maybe Attributes
XN.getDTDAttrl)
getDTDAttrValue :: String -> a XmlTree String
getDTDAttrValue String
n = (XmlTree -> [String]) -> a XmlTree String
forall b c. (b -> [c]) -> a b c
forall (a :: * -> * -> *) b c. ArrowList a => (b -> [c]) -> a b c
arrL (Maybe String -> [String]
forall a. Maybe a -> [a]
maybeToList (Maybe String -> [String])
-> (XmlTree -> Maybe String) -> XmlTree -> [String]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> Attributes -> Maybe String
forall a b. Eq a => a -> [(a, b)] -> Maybe b
lookup String
n (Attributes -> Maybe String)
-> (XmlTree -> Attributes) -> XmlTree -> Maybe String
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Attributes -> Maybe Attributes -> Attributes
forall a. a -> Maybe a -> a
fromMaybe [] (Maybe Attributes -> Attributes)
-> (XmlTree -> Maybe Attributes) -> XmlTree -> Attributes
forall b c a. (b -> c) -> (a -> b) -> a -> c
. XmlTree -> Maybe Attributes
forall a. XmlNode a => a -> Maybe Attributes
XN.getDTDAttrl)
setDTDAttrValue :: String -> String -> a XmlTree XmlTree
setDTDAttrValue String
n String
v = (XmlTree -> XmlTree) -> a XmlTree XmlTree
forall b c. (b -> c) -> a b c
forall (a :: * -> * -> *) b c. Arrow a => (b -> c) -> a b c
arr ((Attributes -> Attributes) -> XmlTree -> XmlTree
forall a. XmlNode a => (Attributes -> Attributes) -> a -> a
XN.changeDTDAttrl (String -> String -> Attributes -> Attributes
forall k v. Eq k => k -> v -> AssocList k v -> AssocList k v
addEntry String
n String
v)) a XmlTree XmlTree -> a XmlTree XmlTree -> a XmlTree XmlTree
forall b c. a b b -> a b c -> a b b
forall (a :: * -> * -> *) b c. ArrowIf a => a b b -> a b c -> a b b
`when` a XmlTree XmlTree
forall (a :: * -> * -> *). ArrowXml a => a XmlTree XmlTree
isDTD
mkDTDElem :: DTDElem -> Attributes -> a n XmlTree -> a n XmlTree
mkDTDElem DTDElem
e Attributes
al a n XmlTree
cf = a n XmlTree -> a n [XmlTree]
forall b c. a b c -> a b [c]
forall (a :: * -> * -> *) b c. ArrowList a => a b c -> a b [c]
listA a n XmlTree
cf a n [XmlTree] -> a [XmlTree] XmlTree -> a n XmlTree
forall {k} (cat :: k -> k -> *) (a :: k) (b :: k) (c :: k).
Category cat =>
cat a b -> cat b c -> cat a c
>>> ([XmlTree] -> XmlTree) -> a [XmlTree] XmlTree
forall b c. (b -> c) -> a b c
forall (a :: * -> * -> *) b c. Arrow a => (b -> c) -> a b c
arr (DTDElem -> Attributes -> [XmlTree] -> XmlTree
XN.mkDTDElem DTDElem
e Attributes
al)
mkDTDDoctype :: Attributes -> a n XmlTree -> a n XmlTree
mkDTDDoctype = DTDElem -> Attributes -> a n XmlTree -> a n XmlTree
forall n. DTDElem -> Attributes -> a n XmlTree -> a n XmlTree
forall (a :: * -> * -> *) n.
ArrowDTD a =>
DTDElem -> Attributes -> a n XmlTree -> a n XmlTree
mkDTDElem DTDElem
DOCTYPE
mkDTDElement :: Attributes -> a n XmlTree
mkDTDElement Attributes
al = DTDElem -> Attributes -> a n XmlTree -> a n XmlTree
forall n. DTDElem -> Attributes -> a n XmlTree -> a n XmlTree
forall (a :: * -> * -> *) n.
ArrowDTD a =>
DTDElem -> Attributes -> a n XmlTree -> a n XmlTree
mkDTDElem DTDElem
ELEMENT Attributes
al a n XmlTree
forall b c. a b c
forall (a :: * -> * -> *) b c. ArrowList a => a b c
none
mkDTDEntity :: Attributes -> a n XmlTree
mkDTDEntity Attributes
al = DTDElem -> Attributes -> a n XmlTree -> a n XmlTree
forall n. DTDElem -> Attributes -> a n XmlTree -> a n XmlTree
forall (a :: * -> * -> *) n.
ArrowDTD a =>
DTDElem -> Attributes -> a n XmlTree -> a n XmlTree
mkDTDElem DTDElem
ENTITY Attributes
al a n XmlTree
forall b c. a b c
forall (a :: * -> * -> *) b c. ArrowList a => a b c
none
mkDTDPEntity :: Attributes -> a n XmlTree
mkDTDPEntity Attributes
al = DTDElem -> Attributes -> a n XmlTree -> a n XmlTree
forall n. DTDElem -> Attributes -> a n XmlTree -> a n XmlTree
forall (a :: * -> * -> *) n.
ArrowDTD a =>
DTDElem -> Attributes -> a n XmlTree -> a n XmlTree
mkDTDElem DTDElem
PENTITY Attributes
al a n XmlTree
forall b c. a b c
forall (a :: * -> * -> *) b c. ArrowList a => a b c
none
instance ArrowXml LA
instance ArrowXml (SLA s)
instance ArrowXml IOLA
instance ArrowXml (IOSLA s)
instance ArrowDTD LA
instance ArrowDTD (SLA s)
instance ArrowDTD IOLA
instance ArrowDTD (IOSLA s)