{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE DeriveDataTypeable #-}
{- |
   Module      : Text.Pandoc.XML.Light.Types
   Copyright   : Copyright (C) 2007 Galois, Inc., 2021 John MacFarlane
   License     : GNU GPL, version 2 or above

   Maintainer  : John MacFarlane <jgm@berkeley.edu>
   Stability   : alpha
   Portability : portable

   This code is taken from xml-light, released under the BSD3 license.
   It has been modified to use Text instead of String, and the fromXL*
   functions have been added.
-}
module Text.Pandoc.XML.Light.Types
  ( -- * Basic types, duplicating those from xml-light but with Text
    -- instead of String
    Line
  , Content(..)
  , Element(..)
  , Attr(..)
  , CData(..)
  , CDataKind(..)
  , QName(..)
  , Node(..)
  , unode
  , unqual
  , add_attr
  , add_attrs
  -- * Conversion functions from xml-light types
  , fromXLQName
  , fromXLCData
  , fromXLElement
  , fromXLAttr
  , fromXLContent
  ) where

import Data.Text (Text)
import qualified Data.Text as T
import Data.Data (Data)
import Data.Typeable (Typeable)
import qualified Text.XML.Light as XL

--
-- type definitions lightly modified from xml-light
--

-- | A line is an Integer
type Line     = Integer

-- | XML content
data Content  = Elem Element
              | Text CData
              | CRef Text
                deriving (Int -> Content -> ShowS
[Content] -> ShowS
Content -> String
(Int -> Content -> ShowS)
-> (Content -> String) -> ([Content] -> ShowS) -> Show Content
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Content] -> ShowS
$cshowList :: [Content] -> ShowS
show :: Content -> String
$cshow :: Content -> String
showsPrec :: Int -> Content -> ShowS
$cshowsPrec :: Int -> Content -> ShowS
Show, Typeable, Typeable Content
DataType
Constr
Typeable Content
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> Content -> c Content)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c Content)
-> (Content -> Constr)
-> (Content -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c Content))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Content))
-> ((forall b. Data b => b -> b) -> Content -> Content)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> Content -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> Content -> r)
-> (forall u. (forall d. Data d => d -> u) -> Content -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> Content -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> Content -> m Content)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> Content -> m Content)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> Content -> m Content)
-> Data Content
Content -> DataType
Content -> Constr
(forall b. Data b => b -> b) -> Content -> Content
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Content -> c Content
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Content
forall a.
Typeable a
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> Content -> u
forall u. (forall d. Data d => d -> u) -> Content -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Content -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Content -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Content -> m Content
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Content -> m Content
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Content
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Content -> c Content
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Content)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Content)
$cCRef :: Constr
$cText :: Constr
$cElem :: Constr
$tContent :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> Content -> m Content
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Content -> m Content
gmapMp :: (forall d. Data d => d -> m d) -> Content -> m Content
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Content -> m Content
gmapM :: (forall d. Data d => d -> m d) -> Content -> m Content
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Content -> m Content
gmapQi :: Int -> (forall d. Data d => d -> u) -> Content -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> Content -> u
gmapQ :: (forall d. Data d => d -> u) -> Content -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> Content -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Content -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Content -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Content -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Content -> r
gmapT :: (forall b. Data b => b -> b) -> Content -> Content
$cgmapT :: (forall b. Data b => b -> b) -> Content -> Content
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Content)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Content)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c Content)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Content)
dataTypeOf :: Content -> DataType
$cdataTypeOf :: Content -> DataType
toConstr :: Content -> Constr
$ctoConstr :: Content -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Content
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Content
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Content -> c Content
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Content -> c Content
$cp1Data :: Typeable Content
Data, Eq Content
Eq Content
-> (Content -> Content -> Ordering)
-> (Content -> Content -> Bool)
-> (Content -> Content -> Bool)
-> (Content -> Content -> Bool)
-> (Content -> Content -> Bool)
-> (Content -> Content -> Content)
-> (Content -> Content -> Content)
-> Ord Content
Content -> Content -> Bool
Content -> Content -> Ordering
Content -> Content -> Content
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: Content -> Content -> Content
$cmin :: Content -> Content -> Content
max :: Content -> Content -> Content
$cmax :: Content -> Content -> Content
>= :: Content -> Content -> Bool
$c>= :: Content -> Content -> Bool
> :: Content -> Content -> Bool
$c> :: Content -> Content -> Bool
<= :: Content -> Content -> Bool
$c<= :: Content -> Content -> Bool
< :: Content -> Content -> Bool
$c< :: Content -> Content -> Bool
compare :: Content -> Content -> Ordering
$ccompare :: Content -> Content -> Ordering
$cp1Ord :: Eq Content
Ord, Content -> Content -> Bool
(Content -> Content -> Bool)
-> (Content -> Content -> Bool) -> Eq Content
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Content -> Content -> Bool
$c/= :: Content -> Content -> Bool
== :: Content -> Content -> Bool
$c== :: Content -> Content -> Bool
Eq)

-- | XML elements
data Element  = Element {
                  Element -> QName
elName      :: QName,
                  Element -> [Attr]
elAttribs   :: [Attr],
                  Element -> [Content]
elContent   :: [Content],
                  Element -> Maybe Line
elLine      :: Maybe Line
                } deriving (Int -> Element -> ShowS
[Element] -> ShowS
Element -> String
(Int -> Element -> ShowS)
-> (Element -> String) -> ([Element] -> ShowS) -> Show Element
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Element] -> ShowS
$cshowList :: [Element] -> ShowS
show :: Element -> String
$cshow :: Element -> String
showsPrec :: Int -> Element -> ShowS
$cshowsPrec :: Int -> Element -> ShowS
Show, Typeable, Typeable Element
DataType
Constr
Typeable Element
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> Element -> c Element)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c Element)
-> (Element -> Constr)
-> (Element -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c Element))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Element))
-> ((forall b. Data b => b -> b) -> Element -> Element)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> Element -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> Element -> r)
-> (forall u. (forall d. Data d => d -> u) -> Element -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> Element -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> Element -> m Element)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> Element -> m Element)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> Element -> m Element)
-> Data Element
Element -> DataType
Element -> Constr
(forall b. Data b => b -> b) -> Element -> Element
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Element -> c Element
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Element
forall a.
Typeable a
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> Element -> u
forall u. (forall d. Data d => d -> u) -> Element -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Element -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Element -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Element -> m Element
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Element -> m Element
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Element
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Element -> c Element
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Element)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Element)
$cElement :: Constr
$tElement :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> Element -> m Element
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Element -> m Element
gmapMp :: (forall d. Data d => d -> m d) -> Element -> m Element
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Element -> m Element
gmapM :: (forall d. Data d => d -> m d) -> Element -> m Element
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Element -> m Element
gmapQi :: Int -> (forall d. Data d => d -> u) -> Element -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> Element -> u
gmapQ :: (forall d. Data d => d -> u) -> Element -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> Element -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Element -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Element -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Element -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Element -> r
gmapT :: (forall b. Data b => b -> b) -> Element -> Element
$cgmapT :: (forall b. Data b => b -> b) -> Element -> Element
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Element)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Element)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c Element)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Element)
dataTypeOf :: Element -> DataType
$cdataTypeOf :: Element -> DataType
toConstr :: Element -> Constr
$ctoConstr :: Element -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Element
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Element
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Element -> c Element
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Element -> c Element
$cp1Data :: Typeable Element
Data, Eq Element
Eq Element
-> (Element -> Element -> Ordering)
-> (Element -> Element -> Bool)
-> (Element -> Element -> Bool)
-> (Element -> Element -> Bool)
-> (Element -> Element -> Bool)
-> (Element -> Element -> Element)
-> (Element -> Element -> Element)
-> Ord Element
Element -> Element -> Bool
Element -> Element -> Ordering
Element -> Element -> Element
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: Element -> Element -> Element
$cmin :: Element -> Element -> Element
max :: Element -> Element -> Element
$cmax :: Element -> Element -> Element
>= :: Element -> Element -> Bool
$c>= :: Element -> Element -> Bool
> :: Element -> Element -> Bool
$c> :: Element -> Element -> Bool
<= :: Element -> Element -> Bool
$c<= :: Element -> Element -> Bool
< :: Element -> Element -> Bool
$c< :: Element -> Element -> Bool
compare :: Element -> Element -> Ordering
$ccompare :: Element -> Element -> Ordering
$cp1Ord :: Eq Element
Ord, Element -> Element -> Bool
(Element -> Element -> Bool)
-> (Element -> Element -> Bool) -> Eq Element
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Element -> Element -> Bool
$c/= :: Element -> Element -> Bool
== :: Element -> Element -> Bool
$c== :: Element -> Element -> Bool
Eq)

-- | XML attributes
data Attr     = Attr {
                  Attr -> QName
attrKey :: QName,
                  Attr -> Text
attrVal :: Text
                } deriving (Attr -> Attr -> Bool
(Attr -> Attr -> Bool) -> (Attr -> Attr -> Bool) -> Eq Attr
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Attr -> Attr -> Bool
$c/= :: Attr -> Attr -> Bool
== :: Attr -> Attr -> Bool
$c== :: Attr -> Attr -> Bool
Eq, Eq Attr
Eq Attr
-> (Attr -> Attr -> Ordering)
-> (Attr -> Attr -> Bool)
-> (Attr -> Attr -> Bool)
-> (Attr -> Attr -> Bool)
-> (Attr -> Attr -> Bool)
-> (Attr -> Attr -> Attr)
-> (Attr -> Attr -> Attr)
-> Ord Attr
Attr -> Attr -> Bool
Attr -> Attr -> Ordering
Attr -> Attr -> Attr
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: Attr -> Attr -> Attr
$cmin :: Attr -> Attr -> Attr
max :: Attr -> Attr -> Attr
$cmax :: Attr -> Attr -> Attr
>= :: Attr -> Attr -> Bool
$c>= :: Attr -> Attr -> Bool
> :: Attr -> Attr -> Bool
$c> :: Attr -> Attr -> Bool
<= :: Attr -> Attr -> Bool
$c<= :: Attr -> Attr -> Bool
< :: Attr -> Attr -> Bool
$c< :: Attr -> Attr -> Bool
compare :: Attr -> Attr -> Ordering
$ccompare :: Attr -> Attr -> Ordering
$cp1Ord :: Eq Attr
Ord, Int -> Attr -> ShowS
[Attr] -> ShowS
Attr -> String
(Int -> Attr -> ShowS)
-> (Attr -> String) -> ([Attr] -> ShowS) -> Show Attr
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Attr] -> ShowS
$cshowList :: [Attr] -> ShowS
show :: Attr -> String
$cshow :: Attr -> String
showsPrec :: Int -> Attr -> ShowS
$cshowsPrec :: Int -> Attr -> ShowS
Show, Typeable, Typeable Attr
DataType
Constr
Typeable Attr
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> Attr -> c Attr)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c Attr)
-> (Attr -> Constr)
-> (Attr -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c Attr))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Attr))
-> ((forall b. Data b => b -> b) -> Attr -> Attr)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Attr -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Attr -> r)
-> (forall u. (forall d. Data d => d -> u) -> Attr -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> Attr -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> Attr -> m Attr)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> Attr -> m Attr)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> Attr -> m Attr)
-> Data Attr
Attr -> DataType
Attr -> Constr
(forall b. Data b => b -> b) -> Attr -> Attr
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Attr -> c Attr
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Attr
forall a.
Typeable a
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> Attr -> u
forall u. (forall d. Data d => d -> u) -> Attr -> [u]
forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Attr -> r
forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Attr -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Attr -> m Attr
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Attr -> m Attr
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Attr
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Attr -> c Attr
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Attr)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Attr)
$cAttr :: Constr
$tAttr :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> Attr -> m Attr
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Attr -> m Attr
gmapMp :: (forall d. Data d => d -> m d) -> Attr -> m Attr
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Attr -> m Attr
gmapM :: (forall d. Data d => d -> m d) -> Attr -> m Attr
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Attr -> m Attr
gmapQi :: Int -> (forall d. Data d => d -> u) -> Attr -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> Attr -> u
gmapQ :: (forall d. Data d => d -> u) -> Attr -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> Attr -> [u]
gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Attr -> r
$cgmapQr :: forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Attr -> r
gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Attr -> r
$cgmapQl :: forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Attr -> r
gmapT :: (forall b. Data b => b -> b) -> Attr -> Attr
$cgmapT :: (forall b. Data b => b -> b) -> Attr -> Attr
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Attr)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Attr)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c Attr)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Attr)
dataTypeOf :: Attr -> DataType
$cdataTypeOf :: Attr -> DataType
toConstr :: Attr -> Constr
$ctoConstr :: Attr -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Attr
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Attr
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Attr -> c Attr
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Attr -> c Attr
$cp1Data :: Typeable Attr
Data)

-- | XML CData
data CData    = CData {
                  CData -> CDataKind
cdVerbatim  :: CDataKind,
                  CData -> Text
cdData      :: Text,
                  CData -> Maybe Line
cdLine      :: Maybe Line
                } deriving (Int -> CData -> ShowS
[CData] -> ShowS
CData -> String
(Int -> CData -> ShowS)
-> (CData -> String) -> ([CData] -> ShowS) -> Show CData
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CData] -> ShowS
$cshowList :: [CData] -> ShowS
show :: CData -> String
$cshow :: CData -> String
showsPrec :: Int -> CData -> ShowS
$cshowsPrec :: Int -> CData -> ShowS
Show, Typeable, Typeable CData
DataType
Constr
Typeable CData
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> CData -> c CData)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c CData)
-> (CData -> Constr)
-> (CData -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c CData))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c CData))
-> ((forall b. Data b => b -> b) -> CData -> CData)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> CData -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> CData -> r)
-> (forall u. (forall d. Data d => d -> u) -> CData -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> CData -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> CData -> m CData)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> CData -> m CData)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> CData -> m CData)
-> Data CData
CData -> DataType
CData -> Constr
(forall b. Data b => b -> b) -> CData -> CData
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> CData -> c CData
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c CData
forall a.
Typeable a
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> CData -> u
forall u. (forall d. Data d => d -> u) -> CData -> [u]
forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> CData -> r
forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> CData -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> CData -> m CData
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> CData -> m CData
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c CData
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> CData -> c CData
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c CData)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c CData)
$cCData :: Constr
$tCData :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> CData -> m CData
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> CData -> m CData
gmapMp :: (forall d. Data d => d -> m d) -> CData -> m CData
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> CData -> m CData
gmapM :: (forall d. Data d => d -> m d) -> CData -> m CData
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> CData -> m CData
gmapQi :: Int -> (forall d. Data d => d -> u) -> CData -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> CData -> u
gmapQ :: (forall d. Data d => d -> u) -> CData -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> CData -> [u]
gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> CData -> r
$cgmapQr :: forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> CData -> r
gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> CData -> r
$cgmapQl :: forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> CData -> r
gmapT :: (forall b. Data b => b -> b) -> CData -> CData
$cgmapT :: (forall b. Data b => b -> b) -> CData -> CData
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c CData)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c CData)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c CData)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c CData)
dataTypeOf :: CData -> DataType
$cdataTypeOf :: CData -> DataType
toConstr :: CData -> Constr
$ctoConstr :: CData -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c CData
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c CData
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> CData -> c CData
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> CData -> c CData
$cp1Data :: Typeable CData
Data, Eq CData
Eq CData
-> (CData -> CData -> Ordering)
-> (CData -> CData -> Bool)
-> (CData -> CData -> Bool)
-> (CData -> CData -> Bool)
-> (CData -> CData -> Bool)
-> (CData -> CData -> CData)
-> (CData -> CData -> CData)
-> Ord CData
CData -> CData -> Bool
CData -> CData -> Ordering
CData -> CData -> CData
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: CData -> CData -> CData
$cmin :: CData -> CData -> CData
max :: CData -> CData -> CData
$cmax :: CData -> CData -> CData
>= :: CData -> CData -> Bool
$c>= :: CData -> CData -> Bool
> :: CData -> CData -> Bool
$c> :: CData -> CData -> Bool
<= :: CData -> CData -> Bool
$c<= :: CData -> CData -> Bool
< :: CData -> CData -> Bool
$c< :: CData -> CData -> Bool
compare :: CData -> CData -> Ordering
$ccompare :: CData -> CData -> Ordering
$cp1Ord :: Eq CData
Ord, CData -> CData -> Bool
(CData -> CData -> Bool) -> (CData -> CData -> Bool) -> Eq CData
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CData -> CData -> Bool
$c/= :: CData -> CData -> Bool
== :: CData -> CData -> Bool
$c== :: CData -> CData -> Bool
Eq)

data CDataKind
 = CDataText      -- ^ Ordinary character data; pretty printer escapes &, < etc.
 | CDataVerbatim  -- ^ Unescaped character data; pretty printer embeds it in <![CDATA[..
 | CDataRaw       -- ^ As-is character data; pretty printer passes it along without any escaping or CDATA wrap-up.
   deriving ( CDataKind -> CDataKind -> Bool
(CDataKind -> CDataKind -> Bool)
-> (CDataKind -> CDataKind -> Bool) -> Eq CDataKind
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CDataKind -> CDataKind -> Bool
$c/= :: CDataKind -> CDataKind -> Bool
== :: CDataKind -> CDataKind -> Bool
$c== :: CDataKind -> CDataKind -> Bool
Eq, Eq CDataKind
Eq CDataKind
-> (CDataKind -> CDataKind -> Ordering)
-> (CDataKind -> CDataKind -> Bool)
-> (CDataKind -> CDataKind -> Bool)
-> (CDataKind -> CDataKind -> Bool)
-> (CDataKind -> CDataKind -> Bool)
-> (CDataKind -> CDataKind -> CDataKind)
-> (CDataKind -> CDataKind -> CDataKind)
-> Ord CDataKind
CDataKind -> CDataKind -> Bool
CDataKind -> CDataKind -> Ordering
CDataKind -> CDataKind -> CDataKind
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: CDataKind -> CDataKind -> CDataKind
$cmin :: CDataKind -> CDataKind -> CDataKind
max :: CDataKind -> CDataKind -> CDataKind
$cmax :: CDataKind -> CDataKind -> CDataKind
>= :: CDataKind -> CDataKind -> Bool
$c>= :: CDataKind -> CDataKind -> Bool
> :: CDataKind -> CDataKind -> Bool
$c> :: CDataKind -> CDataKind -> Bool
<= :: CDataKind -> CDataKind -> Bool
$c<= :: CDataKind -> CDataKind -> Bool
< :: CDataKind -> CDataKind -> Bool
$c< :: CDataKind -> CDataKind -> Bool
compare :: CDataKind -> CDataKind -> Ordering
$ccompare :: CDataKind -> CDataKind -> Ordering
$cp1Ord :: Eq CDataKind
Ord, Int -> CDataKind -> ShowS
[CDataKind] -> ShowS
CDataKind -> String
(Int -> CDataKind -> ShowS)
-> (CDataKind -> String)
-> ([CDataKind] -> ShowS)
-> Show CDataKind
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CDataKind] -> ShowS
$cshowList :: [CDataKind] -> ShowS
show :: CDataKind -> String
$cshow :: CDataKind -> String
showsPrec :: Int -> CDataKind -> ShowS
$cshowsPrec :: Int -> CDataKind -> ShowS
Show, Typeable, Typeable CDataKind
DataType
Constr
Typeable CDataKind
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> CDataKind -> c CDataKind)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c CDataKind)
-> (CDataKind -> Constr)
-> (CDataKind -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c CDataKind))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c CDataKind))
-> ((forall b. Data b => b -> b) -> CDataKind -> CDataKind)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> CDataKind -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> CDataKind -> r)
-> (forall u. (forall d. Data d => d -> u) -> CDataKind -> [u])
-> (forall u.
    Int -> (forall d. Data d => d -> u) -> CDataKind -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> CDataKind -> m CDataKind)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> CDataKind -> m CDataKind)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> CDataKind -> m CDataKind)
-> Data CDataKind
CDataKind -> DataType
CDataKind -> Constr
(forall b. Data b => b -> b) -> CDataKind -> CDataKind
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> CDataKind -> c CDataKind
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c CDataKind
forall a.
Typeable a
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> CDataKind -> u
forall u. (forall d. Data d => d -> u) -> CDataKind -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> CDataKind -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> CDataKind -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> CDataKind -> m CDataKind
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> CDataKind -> m CDataKind
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c CDataKind
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> CDataKind -> c CDataKind
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c CDataKind)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c CDataKind)
$cCDataRaw :: Constr
$cCDataVerbatim :: Constr
$cCDataText :: Constr
$tCDataKind :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> CDataKind -> m CDataKind
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> CDataKind -> m CDataKind
gmapMp :: (forall d. Data d => d -> m d) -> CDataKind -> m CDataKind
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> CDataKind -> m CDataKind
gmapM :: (forall d. Data d => d -> m d) -> CDataKind -> m CDataKind
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> CDataKind -> m CDataKind
gmapQi :: Int -> (forall d. Data d => d -> u) -> CDataKind -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> CDataKind -> u
gmapQ :: (forall d. Data d => d -> u) -> CDataKind -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> CDataKind -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> CDataKind -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> CDataKind -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> CDataKind -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> CDataKind -> r
gmapT :: (forall b. Data b => b -> b) -> CDataKind -> CDataKind
$cgmapT :: (forall b. Data b => b -> b) -> CDataKind -> CDataKind
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c CDataKind)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c CDataKind)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c CDataKind)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c CDataKind)
dataTypeOf :: CDataKind -> DataType
$cdataTypeOf :: CDataKind -> DataType
toConstr :: CDataKind -> Constr
$ctoConstr :: CDataKind -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c CDataKind
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c CDataKind
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> CDataKind -> c CDataKind
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> CDataKind -> c CDataKind
$cp1Data :: Typeable CDataKind
Data )

-- | XML qualified names
data QName    = QName {
                  QName -> Text
qName   :: Text,
                  QName -> Maybe Text
qURI    :: Maybe Text,
                  QName -> Maybe Text
qPrefix :: Maybe Text
                } deriving (Int -> QName -> ShowS
[QName] -> ShowS
QName -> String
(Int -> QName -> ShowS)
-> (QName -> String) -> ([QName] -> ShowS) -> Show QName
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [QName] -> ShowS
$cshowList :: [QName] -> ShowS
show :: QName -> String
$cshow :: QName -> String
showsPrec :: Int -> QName -> ShowS
$cshowsPrec :: Int -> QName -> ShowS
Show, Typeable, Typeable QName
DataType
Constr
Typeable QName
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> QName -> c QName)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c QName)
-> (QName -> Constr)
-> (QName -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c QName))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c QName))
-> ((forall b. Data b => b -> b) -> QName -> QName)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> QName -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> QName -> r)
-> (forall u. (forall d. Data d => d -> u) -> QName -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> QName -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> QName -> m QName)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> QName -> m QName)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> QName -> m QName)
-> Data QName
QName -> DataType
QName -> Constr
(forall b. Data b => b -> b) -> QName -> QName
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> QName -> c QName
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c QName
forall a.
Typeable a
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> QName -> u
forall u. (forall d. Data d => d -> u) -> QName -> [u]
forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> QName -> r
forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> QName -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> QName -> m QName
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> QName -> m QName
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c QName
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> QName -> c QName
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c QName)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c QName)
$cQName :: Constr
$tQName :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> QName -> m QName
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> QName -> m QName
gmapMp :: (forall d. Data d => d -> m d) -> QName -> m QName
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> QName -> m QName
gmapM :: (forall d. Data d => d -> m d) -> QName -> m QName
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> QName -> m QName
gmapQi :: Int -> (forall d. Data d => d -> u) -> QName -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> QName -> u
gmapQ :: (forall d. Data d => d -> u) -> QName -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> QName -> [u]
gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> QName -> r
$cgmapQr :: forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> QName -> r
gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> QName -> r
$cgmapQl :: forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> QName -> r
gmapT :: (forall b. Data b => b -> b) -> QName -> QName
$cgmapT :: (forall b. Data b => b -> b) -> QName -> QName
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c QName)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c QName)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c QName)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c QName)
dataTypeOf :: QName -> DataType
$cdataTypeOf :: QName -> DataType
toConstr :: QName -> Constr
$ctoConstr :: QName -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c QName
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c QName
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> QName -> c QName
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> QName -> c QName
$cp1Data :: Typeable QName
Data)


instance Eq QName where
  QName
q1 == :: QName -> QName -> Bool
== QName
q2  = QName -> QName -> Ordering
forall a. Ord a => a -> a -> Ordering
compare QName
q1 QName
q2 Ordering -> Ordering -> Bool
forall a. Eq a => a -> a -> Bool
== Ordering
EQ

instance Ord QName where
  compare :: QName -> QName -> Ordering
compare QName
q1 QName
q2 =
    case Text -> Text -> Ordering
forall a. Ord a => a -> a -> Ordering
compare (QName -> Text
qName QName
q1) (QName -> Text
qName QName
q2) of
      Ordering
EQ  -> case (QName -> Maybe Text
qURI QName
q1, QName -> Maybe Text
qURI QName
q2) of
               (Maybe Text
Nothing,Maybe Text
Nothing) -> Maybe Text -> Maybe Text -> Ordering
forall a. Ord a => a -> a -> Ordering
compare (QName -> Maybe Text
qPrefix QName
q1) (QName -> Maybe Text
qPrefix QName
q2)
               (Maybe Text
u1,Maybe Text
u2)           -> Maybe Text -> Maybe Text -> Ordering
forall a. Ord a => a -> a -> Ordering
compare Maybe Text
u1 Maybe Text
u2
      Ordering
x   -> Ordering
x

class Node t where
 node :: QName -> t -> Element

instance Node ([Attr],[Content]) where
  node :: QName -> ([Attr], [Content]) -> Element
node QName
n ([Attr]
attrs,[Content]
cont) = Element :: QName -> [Attr] -> [Content] -> Maybe Line -> Element
Element { elName :: QName
elName     = QName
n
                                , elAttribs :: [Attr]
elAttribs  = [Attr]
attrs
                                , elContent :: [Content]
elContent  = [Content]
cont
                                , elLine :: Maybe Line
elLine     = Maybe Line
forall a. Maybe a
Nothing
                                }

instance Node [Attr]             where node :: QName -> [Attr] -> Element
node QName
n [Attr]
as   = QName -> ([Attr], [Content]) -> Element
forall t. Node t => QName -> t -> Element
node QName
n ([Attr]
as,[]::[Content])
instance Node Attr               where node :: QName -> Attr -> Element
node QName
n Attr
a    = QName -> [Attr] -> Element
forall t. Node t => QName -> t -> Element
node QName
n [Attr
a]
instance Node ()                 where node :: QName -> () -> Element
node QName
n ()   = QName -> [Attr] -> Element
forall t. Node t => QName -> t -> Element
node QName
n ([]::[Attr])

instance Node [Content]          where node :: QName -> [Content] -> Element
node QName
n [Content]
cs     = QName -> ([Attr], [Content]) -> Element
forall t. Node t => QName -> t -> Element
node QName
n ([]::[Attr],[Content]
cs)
instance Node Content            where node :: QName -> Content -> Element
node QName
n Content
c      = QName -> [Content] -> Element
forall t. Node t => QName -> t -> Element
node QName
n [Content
c]
instance Node ([Attr],Content)   where node :: QName -> ([Attr], Content) -> Element
node QName
n ([Attr]
as,Content
c) = QName -> ([Attr], [Content]) -> Element
forall t. Node t => QName -> t -> Element
node QName
n ([Attr]
as,[Content
c])
instance Node (Attr,Content)     where node :: QName -> (Attr, Content) -> Element
node QName
n (Attr
a,Content
c)  = QName -> ([Attr], [Content]) -> Element
forall t. Node t => QName -> t -> Element
node QName
n ([Attr
a],[Content
c])

instance Node ([Attr],[Element]) where
  node :: QName -> ([Attr], [Element]) -> Element
node QName
n ([Attr]
as,[Element]
cs) = QName -> ([Attr], [Content]) -> Element
forall t. Node t => QName -> t -> Element
node QName
n ([Attr]
as,(Element -> Content) -> [Element] -> [Content]
forall a b. (a -> b) -> [a] -> [b]
map Element -> Content
Elem [Element]
cs)

instance Node ([Attr],Element)   where node :: QName -> ([Attr], Element) -> Element
node QName
n ([Attr]
as,Element
c) = QName -> ([Attr], [Element]) -> Element
forall t. Node t => QName -> t -> Element
node QName
n ([Attr]
as,[Element
c])
instance Node (Attr,Element)     where node :: QName -> (Attr, Element) -> Element
node QName
n (Attr
a,Element
c)  = QName -> ([Attr], Element) -> Element
forall t. Node t => QName -> t -> Element
node QName
n ([Attr
a],Element
c)
instance Node [Element]          where node :: QName -> [Element] -> Element
node QName
n [Element]
es     = QName -> ([Attr], [Element]) -> Element
forall t. Node t => QName -> t -> Element
node QName
n ([]::[Attr],[Element]
es)
instance Node Element            where node :: QName -> Element -> Element
node QName
n Element
e      = QName -> [Element] -> Element
forall t. Node t => QName -> t -> Element
node QName
n [Element
e]

instance Node ([Attr],[CData])   where
  node :: QName -> ([Attr], [CData]) -> Element
node QName
n ([Attr]
as,[CData]
cs) = QName -> ([Attr], [Content]) -> Element
forall t. Node t => QName -> t -> Element
node QName
n ([Attr]
as,(CData -> Content) -> [CData] -> [Content]
forall a b. (a -> b) -> [a] -> [b]
map CData -> Content
Text [CData]
cs)

instance Node ([Attr],CData)     where node :: QName -> ([Attr], CData) -> Element
node QName
n ([Attr]
as,CData
c) = QName -> ([Attr], [CData]) -> Element
forall t. Node t => QName -> t -> Element
node QName
n ([Attr]
as,[CData
c])
instance Node (Attr,CData)       where node :: QName -> (Attr, CData) -> Element
node QName
n (Attr
a,CData
c)  = QName -> ([Attr], CData) -> Element
forall t. Node t => QName -> t -> Element
node QName
n ([Attr
a],CData
c)
instance Node [CData]            where node :: QName -> [CData] -> Element
node QName
n [CData]
es     = QName -> ([Attr], [CData]) -> Element
forall t. Node t => QName -> t -> Element
node QName
n ([]::[Attr],[CData]
es)
instance Node CData              where node :: QName -> CData -> Element
node QName
n CData
e      = QName -> [CData] -> Element
forall t. Node t => QName -> t -> Element
node QName
n [CData
e]

instance Node ([Attr],Text)      where
  node :: QName -> ([Attr], Text) -> Element
node QName
n ([Attr]
as,Text
t) = QName -> ([Attr], CData) -> Element
forall t. Node t => QName -> t -> Element
node QName
n ([Attr]
as, CData :: CDataKind -> Text -> Maybe Line -> CData
CData { cdVerbatim :: CDataKind
cdVerbatim = CDataKind
CDataText
                                    , cdData :: Text
cdData = Text
t
                                    , cdLine :: Maybe Line
cdLine = Maybe Line
forall a. Maybe a
Nothing })

instance Node (Attr,Text )       where node :: QName -> (Attr, Text) -> Element
node QName
n (Attr
a,Text
t)  = QName -> ([Attr], Text) -> Element
forall t. Node t => QName -> t -> Element
node QName
n ([Attr
a],Text
t)
instance Node Text               where node :: QName -> Text -> Element
node QName
n Text
t      = QName -> ([Attr], Text) -> Element
forall t. Node t => QName -> t -> Element
node QName
n ([]::[Attr],Text
t)

-- | Create node with unqualified name
unode :: Node t => Text -> t -> Element
unode :: Text -> t -> Element
unode = QName -> t -> Element
forall t. Node t => QName -> t -> Element
node (QName -> t -> Element) -> (Text -> QName) -> Text -> t -> Element
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Text -> QName
unqual

unqual :: Text -> QName
unqual :: Text -> QName
unqual Text
x = Text -> Maybe Text -> Maybe Text -> QName
QName Text
x Maybe Text
forall a. Maybe a
Nothing Maybe Text
forall a. Maybe a
Nothing

-- | Add an attribute to an element.
add_attr :: Attr -> Element -> Element
add_attr :: Attr -> Element -> Element
add_attr Attr
a Element
e = [Attr] -> Element -> Element
add_attrs [Attr
a] Element
e

-- | Add some attributes to an element.
add_attrs :: [Attr] -> Element -> Element
add_attrs :: [Attr] -> Element -> Element
add_attrs [Attr]
as Element
e = Element
e { elAttribs :: [Attr]
elAttribs = [Attr]
as [Attr] -> [Attr] -> [Attr]
forall a. [a] -> [a] -> [a]
++ Element -> [Attr]
elAttribs Element
e }

--
-- conversion from xml-light
--

fromXLQName :: XL.QName -> QName
fromXLQName :: QName -> QName
fromXLQName QName
qn = QName :: Text -> Maybe Text -> Maybe Text -> QName
QName { qName :: Text
qName = String -> Text
T.pack (String -> Text) -> String -> Text
forall a b. (a -> b) -> a -> b
$ QName -> String
XL.qName QName
qn
                       , qURI :: Maybe Text
qURI = String -> Text
T.pack (String -> Text) -> Maybe String -> Maybe Text
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> QName -> Maybe String
XL.qURI QName
qn
                       , qPrefix :: Maybe Text
qPrefix = String -> Text
T.pack (String -> Text) -> Maybe String -> Maybe Text
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> QName -> Maybe String
XL.qPrefix QName
qn }

fromXLCData :: XL.CData -> CData
fromXLCData :: CData -> CData
fromXLCData CData
cd = CData :: CDataKind -> Text -> Maybe Line -> CData
CData { cdVerbatim :: CDataKind
cdVerbatim = case CData -> CDataKind
XL.cdVerbatim CData
cd of
                                        CDataKind
XL.CDataText -> CDataKind
CDataText
                                        CDataKind
XL.CDataVerbatim -> CDataKind
CDataVerbatim
                                        CDataKind
XL.CDataRaw -> CDataKind
CDataRaw
                       , cdData :: Text
cdData = String -> Text
T.pack (String -> Text) -> String -> Text
forall a b. (a -> b) -> a -> b
$ CData -> String
XL.cdData CData
cd
                       , cdLine :: Maybe Line
cdLine = CData -> Maybe Line
XL.cdLine CData
cd }

fromXLElement :: XL.Element -> Element
fromXLElement :: Element -> Element
fromXLElement Element
el = Element :: QName -> [Attr] -> [Content] -> Maybe Line -> Element
Element { elName :: QName
elName = QName -> QName
fromXLQName (QName -> QName) -> QName -> QName
forall a b. (a -> b) -> a -> b
$ Element -> QName
XL.elName Element
el
                           , elAttribs :: [Attr]
elAttribs = (Attr -> Attr) -> [Attr] -> [Attr]
forall a b. (a -> b) -> [a] -> [b]
map Attr -> Attr
fromXLAttr ([Attr] -> [Attr]) -> [Attr] -> [Attr]
forall a b. (a -> b) -> a -> b
$ Element -> [Attr]
XL.elAttribs Element
el
                           , elContent :: [Content]
elContent = (Content -> Content) -> [Content] -> [Content]
forall a b. (a -> b) -> [a] -> [b]
map Content -> Content
fromXLContent ([Content] -> [Content]) -> [Content] -> [Content]
forall a b. (a -> b) -> a -> b
$ Element -> [Content]
XL.elContent Element
el
                           , elLine :: Maybe Line
elLine = Element -> Maybe Line
XL.elLine Element
el }

fromXLAttr :: XL.Attr -> Attr
fromXLAttr :: Attr -> Attr
fromXLAttr (XL.Attr QName
qn String
s) = QName -> Text -> Attr
Attr (QName -> QName
fromXLQName QName
qn) (String -> Text
T.pack String
s)

fromXLContent :: XL.Content -> Content
fromXLContent :: Content -> Content
fromXLContent (XL.Elem Element
el) = Element -> Content
Elem (Element -> Content) -> Element -> Content
forall a b. (a -> b) -> a -> b
$ Element -> Element
fromXLElement Element
el
fromXLContent (XL.Text CData
cd) = CData -> Content
Text (CData -> Content) -> CData -> Content
forall a b. (a -> b) -> a -> b
$ CData -> CData
fromXLCData CData
cd
fromXLContent (XL.CRef String
s)  = Text -> Content
CRef (String -> Text
T.pack String
s)