    -- ------------------------------------------------------------

    {- |
       Module     : Text.XML.HXT.Arrow.XmlArrow
       Copyright  : Copyright (C) 2011 Uwe Schmidt
       License    : MIT

       Maintainer : Uwe Schmidt (uwe@fh-wedel.de)
       Stability  : experimental
       Portability: portable

       Basic arrows for processing XML documents

       All arrows use IO and a global state for options, errorhandling, ...

    -}

    -- ------------------------------------------------------------

    module Text.XML.HXT.Arrow.XmlArrow
        ( module Text.XML.HXT.Arrow.XmlArrow )
    where

    import           Control.Arrow                  -- classes
    import           Control.Arrow.ArrowList
    import           Control.Arrow.ArrowIf
    import           Control.Arrow.ArrowTree

    import           Control.Arrow.ListArrow                -- arrow types
    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

    -- ------------------------------------------------------------

    {- | Arrows for processing 'Text.XML.HXT.DOM.TypeDefs.XmlTree's

    These arrows can be grouped into predicates, selectors, constructors, and transformers.

    All predicates (tests) act like 'Control.Arrow.ArrowIf.none' for failure and 'Control.Arrow.ArrowIf.this' for success.
    A logical and can be formed by @ a1 >>> a2 @, a locical or by @ a1 \<+\> a2 @.

    Selector arrows will fail, when applied to wrong input, e.g. selecting the text of a node with 'getText'
    will fail when applied to a none text node.

    Edit arrows will remain the input unchanged, when applied to wrong argument, e.g. editing the content of a text node
    with 'changeText' applied to an element node will return the unchanged element node.
    -}

    infixl 7 +=

    class (Arrow a, ArrowList a, ArrowTree a) => ArrowXml a where

        -- discriminating predicates

        -- | test for text nodes
        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 #-}

        -- | test for char reference, used during parsing
        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 #-}

        -- | test for entity reference, used during parsing
        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 #-}

        -- | test for comment
        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 #-}

        -- | test for CDATA section, used during parsing
        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 #-}

        -- | test for processing instruction
        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 #-}

        -- | test for processing instruction \<?xml ...\>
        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"

        -- | test for element
        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 #-}

        -- | test for DTD part, used during parsing
        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 #-}

        -- | test for attribute tree
        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 #-}

        -- | test for error message
        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 #-}

        -- | test for root node (element with name \"\/\")
        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 #-}

        -- | test for text nodes with text, for which a predicate holds
        --
        -- example: @hasText (all (\`elem\` \" \\t\\n\"))@ check for text nodes with only whitespace content

        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

        -- | test for text nodes with only white space
        --
        -- implemented with 'hasTest'

        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 #-}

        -- |
        -- test whether a node (element, attribute, pi) has a name with a special property

        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 #-}

        -- |
        -- test whether a node (element, attribute, pi) has a specific qualified name
        -- useful only after namespace propagation
        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 #-}

        -- |
        -- test whether a node has a specific name (prefix:localPart or localPart),
        -- generally useful, even without namespace handling
        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 #-}

        -- |
        -- test whether a node has a specific name as local part,
        -- useful only after namespace propagation
        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 #-}

        -- |
        -- test whether a node has a specific name prefix,
        -- useful only after namespace propagation
        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 #-}

        -- |
        -- test whether a node has a specific namespace URI
        -- useful only after namespace propagation
        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 #-}

        -- |
        -- test whether an element node has an attribute node with a specific name
        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 #-}

        -- |
        -- test whether an element node has an attribute node with a specific qualified name
        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 #-}

        -- |
        -- test whether an element node has an attribute with a specific value
        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

        -- |
        -- test whether an element node has an attribute with a qualified name and a specific value
        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

        -- constructor arrows ------------------------------------------------------------

        -- | text node construction arrow
        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 #-}

        -- | blob node construction arrow
        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 #-}

        -- | char reference construction arrow, useful for document output
        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 #-}

        -- | entity reference construction arrow, useful for document output
        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 #-}

        -- | comment node construction, useful for document output
        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 #-}

        -- | CDATA construction, useful for document output
        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 #-}

        -- | error node construction, useful only internally
        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)

        -- | element construction:
        -- | the attributes and the content of the element are computed by applying arrows
        -- to the input
        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)

        -- | attribute node construction:
        -- | the attribute value is computed by applying an arrow to the input
        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)

        -- | processing instruction construction:
        -- | the content of the processing instruction is computed by applying an arrow to the input
        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)

        -- convenient arrows for constructors --------------------------------------------------

        -- | convenient arrow for element construction, more comfortable variant of 'mkElement'
        --
        -- example for simplifying 'mkElement' :
        --
        -- > mkElement qn (a1 <+> ... <+> ai) (c1 <+> ... <+> cj)
        --
        -- equals
        --
        -- > mkqelem qn [a1,...,ai] [c1,...,cj]

        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 #-}

        -- | convenient arrow for element construction with strings instead of qualified names as element names, see also 'mkElement' and 'mkelem'
        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 #-}

        -- | convenient arrow for element construction with attributes but without content, simple variant of 'mkelem' and 'mkElement'
        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 #-}

        -- | convenient arrow for simple element construction without attributes, simple variant of 'mkelem' and 'mkElement'
        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 #-}

        -- | convenient arrow for construction of empty elements without attributes, simple variant of 'mkelem' and 'mkElement'
        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 #-}

        -- | construction of an element node with name \"\/\" for document roots
        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 #-}

        -- | alias for 'mkAttr'
        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 #-}

        -- | convenient arrow for attribute construction, simple variant of 'mkAttr'
        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 #-}

        -- constant arrows (ignoring the input) for tree construction ------------------------------

        -- | constant arrow for text nodes
        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 #-}

        -- | constant arrow for blob nodes
        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 #-}

        -- | constant arrow for char reference nodes
        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 #-}

        -- | constant arrow for entity reference nodes
        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 #-}

        -- | constant arrow for comment
        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 #-}

        -- | constant arrow for warning
        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 #-}

        -- | constant arrow for errors
        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 #-}

        -- | constant arrow for fatal errors
        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 #-}

        -- | constant arrow for simple processing instructions, see 'mkPi'
        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 #-}

        -- | constant arrow for attribute nodes, attribute name is a qualified name and value is a text,
        -- | see also 'mkAttr', 'qattr', 'attr'
        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 #-}

        -- | constant arrow for attribute nodes, attribute name and value are
        -- | given by parameters, see 'mkAttr'
        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 #-}

        -- selector arrows --------------------------------------------------

        -- | select the text of a text node
        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 #-}

        -- | select the value of a char reference
        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 #-}

        -- | select the name of a entity reference node
        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 #-}

        -- | select the comment of a comment node
        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 #-}

        -- | select the content of a CDATA node
        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 #-}

        -- | select the name of a processing instruction
        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 #-}

        -- | select the content of a processing instruction
        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 #-}

        -- | select the name of an element node
        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 #-}

        -- | select the attribute list of an element node
        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 #-}

        -- | select the DTD type of a DTD node
        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 #-}

        -- | select the DTD attributes of a DTD node
        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 #-}

        -- | select the name of an attribute
        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 #-}

        -- | select the error level (c_warn, c_err, c_fatal) from an error node
        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 #-}

        -- | select the error message from an error node
        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 #-}

        -- | select the qualified name from an element, attribute or pi
        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 #-}

        -- | select the prefix:localPart or localPart from an element, attribute or pi
        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 #-}

        -- | select the univeral name ({namespace URI} ++ localPart)
        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 #-}

        -- | select the univeral name (namespace URI ++ localPart)
        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 #-}

        -- | select the local part
        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 #-}

        -- | select the name prefix
        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 #-}

        -- | select the namespace URI
        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 #-}

        -- | select the value of an attribute of an element node,
        -- always succeeds with empty string as default value \"\"
        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)

        -- | like 'getAttrValue', but fails if the attribute does not exist
        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

        -- | like 'getAttrValue', but select the value of an attribute given by a qualified name,
        -- always succeeds with empty string as default value \"\"
        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)

        -- | like 'getQAttrValue', but fails if attribute does not exist
        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

        -- edit arrows --------------------------------------------------

        -- | edit the string of a text node
        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

        -- | edit the blob of a blob node
        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

        -- | edit the comment string of a comment node
        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

        -- | edit an element-, attribute- or pi- name
        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

        -- | edit an element name
        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

        -- | edit an attribute name
        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

        -- | edit a pi name
        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

        -- | edit an attribute value
        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

        -- | edit an attribute list of an element node
        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

        -- | replace an element, attribute or pi name
        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 #-}

        -- | replace an element name
        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 #-}

        -- | replace an attribute name
        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 #-}

        -- | replace an element name
        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 #-}

        -- | replace an atribute list of an element node
        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)                -- (\ x y -> y)
        {-# INLINE setAttrl #-}

        -- | add a list of attributes to an element
        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 #-}

        -- | add (or replace) an attribute
        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 #-}

        -- | remove an attribute
        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)

        -- | remove an attribute with a qualified name
        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)

        -- | process the attributes of an element node with an arrow
        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)

        -- | process a whole tree inclusive attribute list of element nodes
        -- see also: 'Control.Arrow.ArrowTree.processTopDown'

        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))

        -- | convenient op for adding attributes or children to a node
        --
        -- usage: @ tf += cf @
        --
        -- the @tf@ arrow computes an element node, and all trees computed by @cf@ are
        -- added to this node, if a tree is an attribute, it is inserted in the attribute list
        -- else it is appended to the content list.
        --
        -- attention: do not build long content list this way because '+=' is implemented by ++
        --
        -- examples:
        --
        -- > eelem "a"
        -- >   += sattr "href" "page.html"
        -- >   += sattr "name" "here"
        -- >   += txt "look here"
        --
        -- is the same as
        --
        -- > mkelem [ sattr "href" "page.html"
        -- >        , sattr "name" "here"
        -- >        ]
        -- >        [ txt "look here" ]
        --
        -- and results in the XML fragment: \<a href=\"page.html\" name=\"here\"\>look here\<\/a\>
        --
        -- advantage of the '+=' operator is, that attributes and content can be added
        -- any time step by step.
        -- if @tf@ computes a whole list of trees, e.g. a list of \"td\" or \"tr\" elements,
        -- the attributes or content is added to all trees. useful for adding \"class\" or \"style\" attributes
        -- to table elements.

        (+=)                :: 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

        -- | apply an arrow to the input and convert the resulting XML trees into a string representation

        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 #-}

        -- | apply an arrow to the input and convert the resulting XML trees into a string representation

        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 #-}

    {- | Document Type Definition arrows

    These are separated, because they are not needed for document processing,
    only when processing the DTD, e.g. for generating access funtions for the toolbox
    from a DTD (se example DTDtoHaskell in the examples directory)
    -}

    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)

    -- ------------------------------------------------------------