T.P.XML.Light - add Eq, Ord instances...

for Content, Element, Attr, CDataKind.
[API change]
This commit is contained in:
John MacFarlane 2021-05-11 09:01:36 -06:00
parent 2bd5d0cafb
commit a66e50840b

View file

@ -53,7 +53,7 @@ type Line = Integer
data Content = Elem Element data Content = Elem Element
| Text CData | Text CData
| CRef Text | CRef Text
deriving (Show, Typeable, Data) deriving (Show, Typeable, Data, Ord, Eq)
-- | XML elements -- | XML elements
data Element = Element { data Element = Element {
@ -61,7 +61,7 @@ data Element = Element {
elAttribs :: [Attr], elAttribs :: [Attr],
elContent :: [Content], elContent :: [Content],
elLine :: Maybe Line elLine :: Maybe Line
} deriving (Show, Typeable, Data) } deriving (Show, Typeable, Data, Ord, Eq)
-- | XML attributes -- | XML attributes
data Attr = Attr { data Attr = Attr {
@ -74,13 +74,13 @@ data CData = CData {
cdVerbatim :: CDataKind, cdVerbatim :: CDataKind,
cdData :: Text, cdData :: Text,
cdLine :: Maybe Line cdLine :: Maybe Line
} deriving (Show, Typeable, Data) } deriving (Show, Typeable, Data, Ord, Eq)
data CDataKind data CDataKind
= CDataText -- ^ Ordinary character data; pretty printer escapes &, < etc. = CDataText -- ^ Ordinary character data; pretty printer escapes &, < etc.
| CDataVerbatim -- ^ Unescaped character data; pretty printer embeds it in <![CDATA[.. | 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. | CDataRaw -- ^ As-is character data; pretty printer passes it along without any escaping or CDATA wrap-up.
deriving ( Eq, Show, Typeable, Data ) deriving ( Eq, Ord, Show, Typeable, Data )
-- | XML qualified names -- | XML qualified names
data QName = QName { data QName = QName {