{-# LANGUAGE TypeSynonymInstances #-}
module Text.XML.HaXml.Schema.PrimitiveTypes
  ( -- * Type class for parsing simpleTypes
    SimpleType(..)
  , module Text.Parse
  , -- * Primitive XSD datatypes
    XsdString(..)
  , Boolean(..)
  , Base64Binary(..)
  , HexBinary(..)
  , Float(..)
  , Decimal(..)
  , Double(..)
  , AnyURI(..)
  , QName(..)
  , NOTATION(..)
  , Duration(..)
  , DateTime(..)
  , Time(..)
  , Date(..)
  , GYearMonth(..)
  , GYear(..)
  , GMonthDay(..)
  , GDay(..)
  , GMonth(..)
  , -- * Derived, yet builtin, datatypes
    NormalizedString(..)
  , Token(..)
  , Language(..)
  , Name(..)
  , NCName(..)
  , ID(..)
  , IDREF(..)
  , IDREFS(..)
  , ENTITY(..)
  , ENTITIES(..)
  , NMTOKEN(..)
  , NMTOKENS(..)
  , Integer(..)
  , NonPositiveInteger(..)
  , NegativeInteger(..)
  , Long(..)
  , Int(..)
  , Short(..)
  , Byte(..)
  , NonNegativeInteger(..)
  , UnsignedLong(..)
  , UnsignedInt(..)
  , UnsignedShort(..)
  , UnsignedByte(..)
  , PositiveInteger(..)
  ) where

import Text.Parse
import Data.Char as Char
--import Data.Time.LocalTime -- for dates and times?
import Text.XML.HaXml.Types (QName(..))
import Data.Int
import Data.Word

-- | Ultimately, an XML parser will find some plain text as the content
--   of a simpleType, which will need to be parsed.  We use a TextParser,
--   because values of simpleTypes can also be given elsewhere, e.g. as
--   attribute values in an XSD definition, e.g. to restrict the permissible
--   values of the simpleType.  Such restrictions are therefore implemented
--   as layered parsers.
class SimpleType a where
  acceptingParser :: TextParser a
  simpleTypeText  :: a -> String

-- * Primitive types

type Boolean      = Bool
newtype XsdString = XsdString    String    deriving (XsdString -> XsdString -> Bool
(XsdString -> XsdString -> Bool)
-> (XsdString -> XsdString -> Bool) -> Eq XsdString
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: XsdString -> XsdString -> Bool
$c/= :: XsdString -> XsdString -> Bool
== :: XsdString -> XsdString -> Bool
$c== :: XsdString -> XsdString -> Bool
Eq,Int -> XsdString -> ShowS
[XsdString] -> ShowS
XsdString -> String
(Int -> XsdString -> ShowS)
-> (XsdString -> String)
-> ([XsdString] -> ShowS)
-> Show XsdString
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [XsdString] -> ShowS
$cshowList :: [XsdString] -> ShowS
show :: XsdString -> String
$cshow :: XsdString -> String
showsPrec :: Int -> XsdString -> ShowS
$cshowsPrec :: Int -> XsdString -> ShowS
Show)
data Base64Binary = Base64Binary String    deriving (Base64Binary -> Base64Binary -> Bool
(Base64Binary -> Base64Binary -> Bool)
-> (Base64Binary -> Base64Binary -> Bool) -> Eq Base64Binary
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Base64Binary -> Base64Binary -> Bool
$c/= :: Base64Binary -> Base64Binary -> Bool
== :: Base64Binary -> Base64Binary -> Bool
$c== :: Base64Binary -> Base64Binary -> Bool
Eq,Int -> Base64Binary -> ShowS
[Base64Binary] -> ShowS
Base64Binary -> String
(Int -> Base64Binary -> ShowS)
-> (Base64Binary -> String)
-> ([Base64Binary] -> ShowS)
-> Show Base64Binary
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Base64Binary] -> ShowS
$cshowList :: [Base64Binary] -> ShowS
show :: Base64Binary -> String
$cshow :: Base64Binary -> String
showsPrec :: Int -> Base64Binary -> ShowS
$cshowsPrec :: Int -> Base64Binary -> ShowS
Show)
data HexBinary    = HexBinary    String    deriving (HexBinary -> HexBinary -> Bool
(HexBinary -> HexBinary -> Bool)
-> (HexBinary -> HexBinary -> Bool) -> Eq HexBinary
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: HexBinary -> HexBinary -> Bool
$c/= :: HexBinary -> HexBinary -> Bool
== :: HexBinary -> HexBinary -> Bool
$c== :: HexBinary -> HexBinary -> Bool
Eq,Int -> HexBinary -> ShowS
[HexBinary] -> ShowS
HexBinary -> String
(Int -> HexBinary -> ShowS)
-> (HexBinary -> String)
-> ([HexBinary] -> ShowS)
-> Show HexBinary
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [HexBinary] -> ShowS
$cshowList :: [HexBinary] -> ShowS
show :: HexBinary -> String
$cshow :: HexBinary -> String
showsPrec :: Int -> HexBinary -> ShowS
$cshowsPrec :: Int -> HexBinary -> ShowS
Show)
data AnyURI       = AnyURI       String    deriving (AnyURI -> AnyURI -> Bool
(AnyURI -> AnyURI -> Bool)
-> (AnyURI -> AnyURI -> Bool) -> Eq AnyURI
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AnyURI -> AnyURI -> Bool
$c/= :: AnyURI -> AnyURI -> Bool
== :: AnyURI -> AnyURI -> Bool
$c== :: AnyURI -> AnyURI -> Bool
Eq,Int -> AnyURI -> ShowS
[AnyURI] -> ShowS
AnyURI -> String
(Int -> AnyURI -> ShowS)
-> (AnyURI -> String) -> ([AnyURI] -> ShowS) -> Show AnyURI
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AnyURI] -> ShowS
$cshowList :: [AnyURI] -> ShowS
show :: AnyURI -> String
$cshow :: AnyURI -> String
showsPrec :: Int -> AnyURI -> ShowS
$cshowsPrec :: Int -> AnyURI -> ShowS
Show)
--data QName
data NOTATION     = NOTATION String -- or re-use NOTATION from HaXml.Types?
                                           deriving (NOTATION -> NOTATION -> Bool
(NOTATION -> NOTATION -> Bool)
-> (NOTATION -> NOTATION -> Bool) -> Eq NOTATION
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: NOTATION -> NOTATION -> Bool
$c/= :: NOTATION -> NOTATION -> Bool
== :: NOTATION -> NOTATION -> Bool
$c== :: NOTATION -> NOTATION -> Bool
Eq,Int -> NOTATION -> ShowS
[NOTATION] -> ShowS
NOTATION -> String
(Int -> NOTATION -> ShowS)
-> (NOTATION -> String) -> ([NOTATION] -> ShowS) -> Show NOTATION
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [NOTATION] -> ShowS
$cshowList :: [NOTATION] -> ShowS
show :: NOTATION -> String
$cshow :: NOTATION -> String
showsPrec :: Int -> NOTATION -> ShowS
$cshowsPrec :: Int -> NOTATION -> ShowS
Show)
data Decimal      = Decimal Double         deriving (Decimal -> Decimal -> Bool
(Decimal -> Decimal -> Bool)
-> (Decimal -> Decimal -> Bool) -> Eq Decimal
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Decimal -> Decimal -> Bool
$c/= :: Decimal -> Decimal -> Bool
== :: Decimal -> Decimal -> Bool
$c== :: Decimal -> Decimal -> Bool
Eq,Int -> Decimal -> ShowS
[Decimal] -> ShowS
Decimal -> String
(Int -> Decimal -> ShowS)
-> (Decimal -> String) -> ([Decimal] -> ShowS) -> Show Decimal
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Decimal] -> ShowS
$cshowList :: [Decimal] -> ShowS
show :: Decimal -> String
$cshow :: Decimal -> String
showsPrec :: Int -> Decimal -> ShowS
$cshowsPrec :: Int -> Decimal -> ShowS
Show)
--data Float
--data Double
data Duration     = Duration Bool Int Int Int Int Int Float  deriving (Duration -> Duration -> Bool
(Duration -> Duration -> Bool)
-> (Duration -> Duration -> Bool) -> Eq Duration
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Duration -> Duration -> Bool
$c/= :: Duration -> Duration -> Bool
== :: Duration -> Duration -> Bool
$c== :: Duration -> Duration -> Bool
Eq,Int -> Duration -> ShowS
[Duration] -> ShowS
Duration -> String
(Int -> Duration -> ShowS)
-> (Duration -> String) -> ([Duration] -> ShowS) -> Show Duration
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Duration] -> ShowS
$cshowList :: [Duration] -> ShowS
show :: Duration -> String
$cshow :: Duration -> String
showsPrec :: Int -> Duration -> ShowS
$cshowsPrec :: Int -> Duration -> ShowS
Show)

-- * All of the following temporal types are incompletely specified for now.
--   They should probably be mapped to something appropriate from the time
--   package?

data DateTime     = DateTime String        deriving (DateTime -> DateTime -> Bool
(DateTime -> DateTime -> Bool)
-> (DateTime -> DateTime -> Bool) -> Eq DateTime
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DateTime -> DateTime -> Bool
$c/= :: DateTime -> DateTime -> Bool
== :: DateTime -> DateTime -> Bool
$c== :: DateTime -> DateTime -> Bool
Eq,Int -> DateTime -> ShowS
[DateTime] -> ShowS
DateTime -> String
(Int -> DateTime -> ShowS)
-> (DateTime -> String) -> ([DateTime] -> ShowS) -> Show DateTime
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DateTime] -> ShowS
$cshowList :: [DateTime] -> ShowS
show :: DateTime -> String
$cshow :: DateTime -> String
showsPrec :: Int -> DateTime -> ShowS
$cshowsPrec :: Int -> DateTime -> ShowS
Show) -- LocalTime ?
data Time         = Time String            deriving (Time -> Time -> Bool
(Time -> Time -> Bool) -> (Time -> Time -> Bool) -> Eq Time
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Time -> Time -> Bool
$c/= :: Time -> Time -> Bool
== :: Time -> Time -> Bool
$c== :: Time -> Time -> Bool
Eq,Int -> Time -> ShowS
[Time] -> ShowS
Time -> String
(Int -> Time -> ShowS)
-> (Time -> String) -> ([Time] -> ShowS) -> Show Time
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Time] -> ShowS
$cshowList :: [Time] -> ShowS
show :: Time -> String
$cshow :: Time -> String
showsPrec :: Int -> Time -> ShowS
$cshowsPrec :: Int -> Time -> ShowS
Show) -- TimeOfDay ?
data Date         = Date String            deriving (Date -> Date -> Bool
(Date -> Date -> Bool) -> (Date -> Date -> Bool) -> Eq Date
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Date -> Date -> Bool
$c/= :: Date -> Date -> Bool
== :: Date -> Date -> Bool
$c== :: Date -> Date -> Bool
Eq,Int -> Date -> ShowS
[Date] -> ShowS
Date -> String
(Int -> Date -> ShowS)
-> (Date -> String) -> ([Date] -> ShowS) -> Show Date
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Date] -> ShowS
$cshowList :: [Date] -> ShowS
show :: Date -> String
$cshow :: Date -> String
showsPrec :: Int -> Date -> ShowS
$cshowsPrec :: Int -> Date -> ShowS
Show) -- Day ?
data GYearMonth   = GYearMonth String      deriving (GYearMonth -> GYearMonth -> Bool
(GYearMonth -> GYearMonth -> Bool)
-> (GYearMonth -> GYearMonth -> Bool) -> Eq GYearMonth
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GYearMonth -> GYearMonth -> Bool
$c/= :: GYearMonth -> GYearMonth -> Bool
== :: GYearMonth -> GYearMonth -> Bool
$c== :: GYearMonth -> GYearMonth -> Bool
Eq,Int -> GYearMonth -> ShowS
[GYearMonth] -> ShowS
GYearMonth -> String
(Int -> GYearMonth -> ShowS)
-> (GYearMonth -> String)
-> ([GYearMonth] -> ShowS)
-> Show GYearMonth
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GYearMonth] -> ShowS
$cshowList :: [GYearMonth] -> ShowS
show :: GYearMonth -> String
$cshow :: GYearMonth -> String
showsPrec :: Int -> GYearMonth -> ShowS
$cshowsPrec :: Int -> GYearMonth -> ShowS
Show) -- ??
data GYear        = GYear String           deriving (GYear -> GYear -> Bool
(GYear -> GYear -> Bool) -> (GYear -> GYear -> Bool) -> Eq GYear
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GYear -> GYear -> Bool
$c/= :: GYear -> GYear -> Bool
== :: GYear -> GYear -> Bool
$c== :: GYear -> GYear -> Bool
Eq,Int -> GYear -> ShowS
[GYear] -> ShowS
GYear -> String
(Int -> GYear -> ShowS)
-> (GYear -> String) -> ([GYear] -> ShowS) -> Show GYear
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GYear] -> ShowS
$cshowList :: [GYear] -> ShowS
show :: GYear -> String
$cshow :: GYear -> String
showsPrec :: Int -> GYear -> ShowS
$cshowsPrec :: Int -> GYear -> ShowS
Show) -- ??
data GMonthDay    = GMonthDay String       deriving (GMonthDay -> GMonthDay -> Bool
(GMonthDay -> GMonthDay -> Bool)
-> (GMonthDay -> GMonthDay -> Bool) -> Eq GMonthDay
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GMonthDay -> GMonthDay -> Bool
$c/= :: GMonthDay -> GMonthDay -> Bool
== :: GMonthDay -> GMonthDay -> Bool
$c== :: GMonthDay -> GMonthDay -> Bool
Eq,Int -> GMonthDay -> ShowS
[GMonthDay] -> ShowS
GMonthDay -> String
(Int -> GMonthDay -> ShowS)
-> (GMonthDay -> String)
-> ([GMonthDay] -> ShowS)
-> Show GMonthDay
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GMonthDay] -> ShowS
$cshowList :: [GMonthDay] -> ShowS
show :: GMonthDay -> String
$cshow :: GMonthDay -> String
showsPrec :: Int -> GMonthDay -> ShowS
$cshowsPrec :: Int -> GMonthDay -> ShowS
Show) -- ??
data GDay         = GDay String            deriving (GDay -> GDay -> Bool
(GDay -> GDay -> Bool) -> (GDay -> GDay -> Bool) -> Eq GDay
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GDay -> GDay -> Bool
$c/= :: GDay -> GDay -> Bool
== :: GDay -> GDay -> Bool
$c== :: GDay -> GDay -> Bool
Eq,Int -> GDay -> ShowS
[GDay] -> ShowS
GDay -> String
(Int -> GDay -> ShowS)
-> (GDay -> String) -> ([GDay] -> ShowS) -> Show GDay
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GDay] -> ShowS
$cshowList :: [GDay] -> ShowS
show :: GDay -> String
$cshow :: GDay -> String
showsPrec :: Int -> GDay -> ShowS
$cshowsPrec :: Int -> GDay -> ShowS
Show) -- ??
data GMonth       = GMonth String          deriving (GMonth -> GMonth -> Bool
(GMonth -> GMonth -> Bool)
-> (GMonth -> GMonth -> Bool) -> Eq GMonth
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GMonth -> GMonth -> Bool
$c/= :: GMonth -> GMonth -> Bool
== :: GMonth -> GMonth -> Bool
$c== :: GMonth -> GMonth -> Bool
Eq,Int -> GMonth -> ShowS
[GMonth] -> ShowS
GMonth -> String
(Int -> GMonth -> ShowS)
-> (GMonth -> String) -> ([GMonth] -> ShowS) -> Show GMonth
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GMonth] -> ShowS
$cshowList :: [GMonth] -> ShowS
show :: GMonth -> String
$cshow :: GMonth -> String
showsPrec :: Int -> GMonth -> ShowS
$cshowsPrec :: Int -> GMonth -> ShowS
Show) -- ??

isNext :: Char -> TextParser Char
isNext :: Char -> TextParser Char
isNext Char
c = do Char
d <- TextParser Char
forall t. Parser t t
next
              if Char
cChar -> Char -> Bool
forall a. Eq a => a -> a -> Bool
==Char
d then Char -> TextParser Char
forall (m :: * -> *) a. Monad m => a -> m a
return Char
c else String -> TextParser Char
forall (m :: * -> *) a. MonadFail m => String -> m a
fail (String
"expected "String -> ShowS
forall a. [a] -> [a] -> [a]
++Char
cChar -> ShowS
forall a. a -> [a] -> [a]
:String
", got "String -> ShowS
forall a. [a] -> [a] -> [a]
++Char
dChar -> ShowS
forall a. a -> [a] -> [a]
:String
".")

instance SimpleType Bool where
    acceptingParser :: TextParser Bool
acceptingParser = do String
w <- TextParser String
word
                         case String
w of String
"true"  -> Bool -> TextParser Bool
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
True;
                                   String
"false" -> Bool -> TextParser Bool
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
False
                                   String
"0"     -> Bool -> TextParser Bool
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
False;
                                   String
"1"     -> Bool -> TextParser Bool
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
True
                                   String
_       -> String -> TextParser Bool
forall (m :: * -> *) a. MonadFail m => String -> m a
fail (String
"Not a bool: "String -> ShowS
forall a. [a] -> [a] -> [a]
++String
w)
    simpleTypeText :: Bool -> String
simpleTypeText Bool
False = String
"false"
    simpleTypeText Bool
True  = String
"true"
instance SimpleType XsdString where
    acceptingParser :: TextParser XsdString
acceptingParser = (String -> XsdString) -> TextParser String -> TextParser XsdString
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap String -> XsdString
XsdString (TextParser Char -> TextParser String
forall (f :: * -> *) a. Alternative f => f a -> f [a]
many TextParser Char
forall t. Parser t t
next)
    simpleTypeText :: XsdString -> String
simpleTypeText (XsdString String
s) = String
s
instance SimpleType Base64Binary where
    acceptingParser :: TextParser Base64Binary
acceptingParser = (String -> Base64Binary)
-> TextParser String -> TextParser Base64Binary
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap String -> Base64Binary
Base64Binary (TextParser Char -> TextParser String
forall (f :: * -> *) a. Alternative f => f a -> f [a]
many ((Char -> Bool) -> TextParser Char
forall t. (t -> Bool) -> Parser t t
satisfy Char -> Bool
isAlphaNum TextParser Char -> TextParser Char -> TextParser Char
forall t a. Parser t a -> Parser t a -> Parser t a
`onFail`
                                               (Char -> Bool) -> TextParser Char
forall t. (t -> Bool) -> Parser t t
satisfy Char -> Bool
isSpace TextParser Char -> TextParser Char -> TextParser Char
forall t a. Parser t a -> Parser t a -> Parser t a
`onFail`
                                               (Char -> Bool) -> TextParser Char
forall t. (t -> Bool) -> Parser t t
satisfy (Char -> String -> Bool
forall (t :: * -> *) a. (Foldable t, Eq a) => a -> t a -> Bool
`elem`String
"+/=")))
    simpleTypeText :: Base64Binary -> String
simpleTypeText (Base64Binary String
s) = String
s
instance SimpleType HexBinary where
    acceptingParser :: TextParser HexBinary
acceptingParser = (String -> HexBinary) -> TextParser String -> TextParser HexBinary
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap String -> HexBinary
HexBinary (TextParser Char -> TextParser String
forall (f :: * -> *) a. Alternative f => f a -> f [a]
many ((Char -> Bool) -> TextParser Char
forall t. (t -> Bool) -> Parser t t
satisfy Char -> Bool
Char.isHexDigit))
    simpleTypeText :: HexBinary -> String
simpleTypeText (HexBinary String
s) = String
s
instance SimpleType AnyURI where
    acceptingParser :: TextParser AnyURI
acceptingParser = (String -> AnyURI) -> TextParser String -> TextParser AnyURI
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap String -> AnyURI
AnyURI (TextParser Char -> TextParser String
forall (f :: * -> *) a. Alternative f => f a -> f [a]
many TextParser Char
forall t. Parser t t
next) -- not very satisfactory
    simpleTypeText :: AnyURI -> String
simpleTypeText (AnyURI String
s) = String
s
instance SimpleType NOTATION where
    acceptingParser :: TextParser NOTATION
acceptingParser = (String -> NOTATION) -> TextParser String -> TextParser NOTATION
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap String -> NOTATION
NOTATION (TextParser Char -> TextParser String
forall (f :: * -> *) a. Alternative f => f a -> f [a]
many TextParser Char
forall t. Parser t t
next) -- not very satisfactory
    simpleTypeText :: NOTATION -> String
simpleTypeText (NOTATION String
s) = String
s

instance SimpleType Decimal where
    acceptingParser :: TextParser Decimal
acceptingParser = (Double -> Decimal) -> Parser Char Double -> TextParser Decimal
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Double -> Decimal
Decimal Parser Char Double
forall a. Parse a => TextParser a
parse
    simpleTypeText :: Decimal -> String
simpleTypeText (Decimal Double
s) = Double -> String
forall a. Show a => a -> String
show Double
s -- XXX FIXME: showGFloat?
instance SimpleType Float where
    acceptingParser :: TextParser Float
acceptingParser  = TextParser Float
forall a. Parse a => TextParser a
parse
    simpleTypeText :: Float -> String
simpleTypeText Float
x = Float -> String
forall a. Show a => a -> String
show Float
x           -- XXX FIXME: showGFloat?
instance SimpleType Double where
    acceptingParser :: Parser Char Double
acceptingParser  = Parser Char Double
forall a. Parse a => TextParser a
parse
    simpleTypeText :: Double -> String
simpleTypeText Double
x = Double -> String
forall a. Show a => a -> String
show Double
x           -- XXX FIXME: showGFloat?

instance SimpleType Duration where
    acceptingParser :: TextParser Duration
acceptingParser = (Bool -> Int -> Int -> Int -> Int -> Int -> Float -> Duration)
-> Parser
     Char (Bool -> Int -> Int -> Int -> Int -> Int -> Float -> Duration)
forall (m :: * -> *) a. Monad m => a -> m a
return Bool -> Int -> Int -> Int -> Int -> Int -> Float -> Duration
Duration Parser
  Char (Bool -> Int -> Int -> Int -> Int -> Int -> Float -> Duration)
-> TextParser Bool
-> Parser
     Char (Int -> Int -> Int -> Int -> Int -> Float -> Duration)
forall (p :: * -> *) a b. PolyParse p => p (a -> b) -> p a -> p b
`apply` (do Char -> TextParser Char
isNext Char
'-'; Bool -> TextParser Bool
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
False
                                               TextParser Bool -> TextParser Bool -> TextParser Bool
forall t a. Parser t a -> Parser t a -> Parser t a
`onFail` Bool -> TextParser Bool
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
True)
                                      Parser Char (Int -> Int -> Int -> Int -> Int -> Float -> Duration)
-> TextParser Char
-> Parser
     Char (Int -> Int -> Int -> Int -> Int -> Float -> Duration)
forall (p :: * -> *) a b. PolyParse p => p a -> p b -> p a
`discard` Char -> TextParser Char
isNext Char
'P'
                                      Parser Char (Int -> Int -> Int -> Int -> Int -> Float -> Duration)
-> Parser Char Int
-> Parser Char (Int -> Int -> Int -> Int -> Float -> Duration)
forall (p :: * -> *) a b. PolyParse p => p (a -> b) -> p a -> p b
`apply` ((Parser Char Int
forall a. Integral a => TextParser a
parseDec Parser Char Int -> TextParser Char -> Parser Char Int
forall (p :: * -> *) a b. PolyParse p => p a -> p b -> p a
`discard` Char -> TextParser Char
isNext Char
'Y')
                                               Parser Char Int -> Parser Char Int -> Parser Char Int
forall t a. Parser t a -> Parser t a -> Parser t a
`onFail` Int -> Parser Char Int
forall (m :: * -> *) a. Monad m => a -> m a
return Int
0)
                                      Parser Char (Int -> Int -> Int -> Int -> Float -> Duration)
-> Parser Char Int
-> Parser Char (Int -> Int -> Int -> Float -> Duration)
forall (p :: * -> *) a b. PolyParse p => p (a -> b) -> p a -> p b
`apply` ((Parser Char Int
forall a. Integral a => TextParser a
parseDec Parser Char Int -> TextParser Char -> Parser Char Int
forall (p :: * -> *) a b. PolyParse p => p a -> p b -> p a
`discard` Char -> TextParser Char
isNext Char
'M')
                                               Parser Char Int -> Parser Char Int -> Parser Char Int
forall t a. Parser t a -> Parser t a -> Parser t a
`onFail` Int -> Parser Char Int
forall (m :: * -> *) a. Monad m => a -> m a
return Int
0)
                                      Parser Char (Int -> Int -> Int -> Float -> Duration)
-> Parser Char Int -> Parser Char (Int -> Int -> Float -> Duration)
forall (p :: * -> *) a b. PolyParse p => p (a -> b) -> p a -> p b
`apply` ((Parser Char Int
forall a. Integral a => TextParser a
parseDec Parser Char Int -> TextParser Char -> Parser Char Int
forall (p :: * -> *) a b. PolyParse p => p a -> p b -> p a
`discard` Char -> TextParser Char
isNext Char
'D')
                                               Parser Char Int -> Parser Char Int -> Parser Char Int
forall t a. Parser t a -> Parser t a -> Parser t a
`onFail` Int -> Parser Char Int
forall (m :: * -> *) a. Monad m => a -> m a
return Int
0)
                                      Parser Char (Int -> Int -> Float -> Duration)
-> TextParser Char -> Parser Char (Int -> Int -> Float -> Duration)
forall (p :: * -> *) a b. PolyParse p => p a -> p b -> p a
`discard` (Char -> TextParser Char
isNext Char
'T'TextParser Char -> TextParser Char -> TextParser Char
forall t a. Parser t a -> Parser t a -> Parser t a
`onFail`Char -> TextParser Char
forall (m :: * -> *) a. Monad m => a -> m a
return Char
'T')
                                      -- fix: T absent iff H:M:S absent also
                                      Parser Char (Int -> Int -> Float -> Duration)
-> Parser Char Int -> Parser Char (Int -> Float -> Duration)
forall (p :: * -> *) a b. PolyParse p => p (a -> b) -> p a -> p b
`apply` ((Parser Char Int
forall a. Integral a => TextParser a
parseDec Parser Char Int -> TextParser Char -> Parser Char Int
forall (p :: * -> *) a b. PolyParse p => p a -> p b -> p a
`discard` Char -> TextParser Char
isNext Char
'H')
                                               Parser Char Int -> Parser Char Int -> Parser Char Int
forall t a. Parser t a -> Parser t a -> Parser t a
`onFail` Int -> Parser Char Int
forall (m :: * -> *) a. Monad m => a -> m a
return Int
0)
                                      Parser Char (Int -> Float -> Duration)
-> Parser Char Int -> Parser Char (Float -> Duration)
forall (p :: * -> *) a b. PolyParse p => p (a -> b) -> p a -> p b
`apply` ((Parser Char Int
forall a. Integral a => TextParser a
parseDec Parser Char Int -> TextParser Char -> Parser Char Int
forall (p :: * -> *) a b. PolyParse p => p a -> p b -> p a
`discard` Char -> TextParser Char
isNext Char
'M')
                                               Parser Char Int -> Parser Char Int -> Parser Char Int
forall t a. Parser t a -> Parser t a -> Parser t a
`onFail` Int -> Parser Char Int
forall (m :: * -> *) a. Monad m => a -> m a
return Int
0)
                                      Parser Char (Float -> Duration)
-> TextParser Float -> TextParser Duration
forall (p :: * -> *) a b. PolyParse p => p (a -> b) -> p a -> p b
`apply` ((TextParser Float
forall a. RealFrac a => TextParser a
parseFloat TextParser Float -> TextParser Char -> TextParser Float
forall (p :: * -> *) a b. PolyParse p => p a -> p b -> p a
`discard` Char -> TextParser Char
isNext Char
'S')
                                               TextParser Float -> TextParser Float -> TextParser Float
forall t a. Parser t a -> Parser t a -> Parser t a
`onFail` Float -> TextParser Float
forall (m :: * -> *) a. Monad m => a -> m a
return Float
0)
    simpleTypeText :: Duration -> String
simpleTypeText (Duration Bool
pos Int
0 Int
0 Int
0 Int
0 Int
0 Float
0) = (if Bool
pos then String
"" else String
"-")String -> ShowS
forall a. [a] -> [a] -> [a]
++String
"P0S"
    simpleTypeText (Duration Bool
pos Int
y Int
m Int
d Int
h Int
n Float
s) =
        (if Bool
pos then String
"" else String
"-")String -> ShowS
forall a. [a] -> [a] -> [a]
++String
"P"String -> ShowS
forall a. [a] -> [a] -> [a]
++Int -> Char -> String
forall a. (Num a, Eq a, Show a) => a -> Char -> String
showUnit Int
y Char
'Y'String -> ShowS
forall a. [a] -> [a] -> [a]
++Int -> Char -> String
forall a. (Num a, Eq a, Show a) => a -> Char -> String
showUnit Int
m Char
'M'String -> ShowS
forall a. [a] -> [a] -> [a]
++Int -> Char -> String
forall a. (Num a, Eq a, Show a) => a -> Char -> String
showUnit Int
d Char
'D'String -> ShowS
forall a. [a] -> [a] -> [a]
++String
showTime
      where
        showUnit :: (Num a,Eq a,Show a) => a -> Char -> String
        showUnit :: a -> Char -> String
showUnit a
n Char
u = if a
n a -> a -> Bool
forall a. Eq a => a -> a -> Bool
== a
0 then String
"" else a -> String
forall a. Show a => a -> String
show a
n String -> ShowS
forall a. [a] -> [a] -> [a]
++ [Char
u]
        showTime :: String
showTime = if (Int
h,Int
n,Float
s) (Int, Int, Float) -> (Int, Int, Float) -> Bool
forall a. Eq a => a -> a -> Bool
== (Int
0,Int
0,Float
0) then String
"" else String
"T"String -> ShowS
forall a. [a] -> [a] -> [a]
++Int -> Char -> String
forall a. (Num a, Eq a, Show a) => a -> Char -> String
showUnit Int
h Char
'H'String -> ShowS
forall a. [a] -> [a] -> [a]
++Int -> Char -> String
forall a. (Num a, Eq a, Show a) => a -> Char -> String
showUnit Int
n Char
'M'String -> ShowS
forall a. [a] -> [a] -> [a]
++Float -> Char -> String
forall a. (Num a, Eq a, Show a) => a -> Char -> String
showUnit Float
s Char
'S'
instance SimpleType DateTime where
    acceptingParser :: TextParser DateTime
acceptingParser = (String -> DateTime) -> TextParser String -> TextParser DateTime
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap String -> DateTime
DateTime (TextParser Char -> TextParser String
forall (f :: * -> *) a. Alternative f => f a -> f [a]
many TextParser Char
forall t. Parser t t
next)
 -- acceptingParser = fail "not implemented: simpletype parser for DateTime"
    simpleTypeText :: DateTime -> String
simpleTypeText (DateTime String
x) = String
x
instance SimpleType Time where
    acceptingParser :: TextParser Time
acceptingParser = (String -> Time) -> TextParser String -> TextParser Time
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap String -> Time
Time (TextParser Char -> TextParser String
forall (f :: * -> *) a. Alternative f => f a -> f [a]
many TextParser Char
forall t. Parser t t
next)
 -- acceptingParser = fail "not implemented: simpletype parser for Time"
    simpleTypeText :: Time -> String
simpleTypeText (Time String
x) = String
x
instance SimpleType Date where
    acceptingParser :: TextParser Date
acceptingParser = (String -> Date) -> TextParser String -> TextParser Date
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap String -> Date
Date (TextParser Char -> TextParser String
forall (f :: * -> *) a. Alternative f => f a -> f [a]
many TextParser Char
forall t. Parser t t
next)
 -- acceptingParser = fail "not implemented: simpletype parser for Date"
    simpleTypeText :: Date -> String
simpleTypeText (Date String
x) = String
x
instance SimpleType GYearMonth where
    acceptingParser :: TextParser GYearMonth
acceptingParser = (String -> GYearMonth)
-> TextParser String -> TextParser GYearMonth
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap String -> GYearMonth
GYearMonth (TextParser Char -> TextParser String
forall (f :: * -> *) a. Alternative f => f a -> f [a]
many TextParser Char
forall t. Parser t t
next)
 -- acceptingParser = fail "not implemented: simpletype parser for GYearMonth"
    simpleTypeText :: GYearMonth -> String
simpleTypeText (GYearMonth String
x) = String
x
instance SimpleType GYear where
    acceptingParser :: TextParser GYear
acceptingParser = (String -> GYear) -> TextParser String -> TextParser GYear
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap String -> GYear
GYear (TextParser Char -> TextParser String
forall (f :: * -> *) a. Alternative f => f a -> f [a]
many TextParser Char
forall t. Parser t t
next)
 -- acceptingParser = fail "not implemented: simpletype parser for GYear"
    simpleTypeText :: GYear -> String
simpleTypeText (GYear String
x) = String
x
instance SimpleType GMonthDay where
    acceptingParser :: TextParser GMonthDay
acceptingParser = (String -> GMonthDay) -> TextParser String -> TextParser GMonthDay
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap String -> GMonthDay
GMonthDay (TextParser Char -> TextParser String
forall (f :: * -> *) a. Alternative f => f a -> f [a]
many TextParser Char
forall t. Parser t t
next)
 -- acceptingParser = fail "not implemented: simpletype parser for GMonthDay"
    simpleTypeText :: GMonthDay -> String
simpleTypeText (GMonthDay String
x) = String
x
instance SimpleType GDay where
    acceptingParser :: TextParser GDay
acceptingParser = (String -> GDay) -> TextParser String -> TextParser GDay
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap String -> GDay
GDay (TextParser Char -> TextParser String
forall (f :: * -> *) a. Alternative f => f a -> f [a]
many TextParser Char
forall t. Parser t t
next)
 -- acceptingParser = fail "not implemented: simpletype parser for GDay"
    simpleTypeText :: GDay -> String
simpleTypeText (GDay String
x) = String
x
instance SimpleType GMonth where
    acceptingParser :: TextParser GMonth
acceptingParser = (String -> GMonth) -> TextParser String -> TextParser GMonth
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap String -> GMonth
GMonth (TextParser Char -> TextParser String
forall (f :: * -> *) a. Alternative f => f a -> f [a]
many TextParser Char
forall t. Parser t t
next)
 -- acceptingParser = fail "not implemented: simpletype parser for GMonth"
    simpleTypeText :: GMonth -> String
simpleTypeText (GMonth String
x) = String
x

-- * Derived builtin types

newtype NormalizedString = Normalized String    deriving (NormalizedString -> NormalizedString -> Bool
(NormalizedString -> NormalizedString -> Bool)
-> (NormalizedString -> NormalizedString -> Bool)
-> Eq NormalizedString
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: NormalizedString -> NormalizedString -> Bool
$c/= :: NormalizedString -> NormalizedString -> Bool
== :: NormalizedString -> NormalizedString -> Bool
$c== :: NormalizedString -> NormalizedString -> Bool
Eq,Int -> NormalizedString -> ShowS
[NormalizedString] -> ShowS
NormalizedString -> String
(Int -> NormalizedString -> ShowS)
-> (NormalizedString -> String)
-> ([NormalizedString] -> ShowS)
-> Show NormalizedString
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [NormalizedString] -> ShowS
$cshowList :: [NormalizedString] -> ShowS
show :: NormalizedString -> String
$cshow :: NormalizedString -> String
showsPrec :: Int -> NormalizedString -> ShowS
$cshowsPrec :: Int -> NormalizedString -> ShowS
Show)
newtype Token    = Token    String              deriving (Token -> Token -> Bool
(Token -> Token -> Bool) -> (Token -> Token -> Bool) -> Eq Token
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Token -> Token -> Bool
$c/= :: Token -> Token -> Bool
== :: Token -> Token -> Bool
$c== :: Token -> Token -> Bool
Eq,Int -> Token -> ShowS
[Token] -> ShowS
Token -> String
(Int -> Token -> ShowS)
-> (Token -> String) -> ([Token] -> ShowS) -> Show Token
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Token] -> ShowS
$cshowList :: [Token] -> ShowS
show :: Token -> String
$cshow :: Token -> String
showsPrec :: Int -> Token -> ShowS
$cshowsPrec :: Int -> Token -> ShowS
Show)
newtype Language = Language String              deriving (Language -> Language -> Bool
(Language -> Language -> Bool)
-> (Language -> Language -> Bool) -> Eq Language
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Language -> Language -> Bool
$c/= :: Language -> Language -> Bool
== :: Language -> Language -> Bool
$c== :: Language -> Language -> Bool
Eq,Int -> Language -> ShowS
[Language] -> ShowS
Language -> String
(Int -> Language -> ShowS)
-> (Language -> String) -> ([Language] -> ShowS) -> Show Language
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Language] -> ShowS
$cshowList :: [Language] -> ShowS
show :: Language -> String
$cshow :: Language -> String
showsPrec :: Int -> Language -> ShowS
$cshowsPrec :: Int -> Language -> ShowS
Show)
newtype Name     = Name     String              deriving (Name -> Name -> Bool
(Name -> Name -> Bool) -> (Name -> Name -> Bool) -> Eq Name
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Name -> Name -> Bool
$c/= :: Name -> Name -> Bool
== :: Name -> Name -> Bool
$c== :: Name -> Name -> Bool
Eq,Int -> Name -> ShowS
[Name] -> ShowS
Name -> String
(Int -> Name -> ShowS)
-> (Name -> String) -> ([Name] -> ShowS) -> Show Name
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Name] -> ShowS
$cshowList :: [Name] -> ShowS
show :: Name -> String
$cshow :: Name -> String
showsPrec :: Int -> Name -> ShowS
$cshowsPrec :: Int -> Name -> ShowS
Show)
newtype NCName   = NCName   String              deriving (NCName -> NCName -> Bool
(NCName -> NCName -> Bool)
-> (NCName -> NCName -> Bool) -> Eq NCName
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: NCName -> NCName -> Bool
$c/= :: NCName -> NCName -> Bool
== :: NCName -> NCName -> Bool
$c== :: NCName -> NCName -> Bool
Eq,Int -> NCName -> ShowS
[NCName] -> ShowS
NCName -> String
(Int -> NCName -> ShowS)
-> (NCName -> String) -> ([NCName] -> ShowS) -> Show NCName
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [NCName] -> ShowS
$cshowList :: [NCName] -> ShowS
show :: NCName -> String
$cshow :: NCName -> String
showsPrec :: Int -> NCName -> ShowS
$cshowsPrec :: Int -> NCName -> ShowS
Show)
newtype ID       = ID       String              deriving (ID -> ID -> Bool
(ID -> ID -> Bool) -> (ID -> ID -> Bool) -> Eq ID
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ID -> ID -> Bool
$c/= :: ID -> ID -> Bool
== :: ID -> ID -> Bool
$c== :: ID -> ID -> Bool
Eq,Int -> ID -> ShowS
[ID] -> ShowS
ID -> String
(Int -> ID -> ShowS)
-> (ID -> String) -> ([ID] -> ShowS) -> Show ID
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ID] -> ShowS
$cshowList :: [ID] -> ShowS
show :: ID -> String
$cshow :: ID -> String
showsPrec :: Int -> ID -> ShowS
$cshowsPrec :: Int -> ID -> ShowS
Show)
newtype IDREF    = IDREF    String              deriving (IDREF -> IDREF -> Bool
(IDREF -> IDREF -> Bool) -> (IDREF -> IDREF -> Bool) -> Eq IDREF
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: IDREF -> IDREF -> Bool
$c/= :: IDREF -> IDREF -> Bool
== :: IDREF -> IDREF -> Bool
$c== :: IDREF -> IDREF -> Bool
Eq,Int -> IDREF -> ShowS
[IDREF] -> ShowS
IDREF -> String
(Int -> IDREF -> ShowS)
-> (IDREF -> String) -> ([IDREF] -> ShowS) -> Show IDREF
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [IDREF] -> ShowS
$cshowList :: [IDREF] -> ShowS
show :: IDREF -> String
$cshow :: IDREF -> String
showsPrec :: Int -> IDREF -> ShowS
$cshowsPrec :: Int -> IDREF -> ShowS
Show)
newtype IDREFS   = IDREFS   String              deriving (IDREFS -> IDREFS -> Bool
(IDREFS -> IDREFS -> Bool)
-> (IDREFS -> IDREFS -> Bool) -> Eq IDREFS
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: IDREFS -> IDREFS -> Bool
$c/= :: IDREFS -> IDREFS -> Bool
== :: IDREFS -> IDREFS -> Bool
$c== :: IDREFS -> IDREFS -> Bool
Eq,Int -> IDREFS -> ShowS
[IDREFS] -> ShowS
IDREFS -> String
(Int -> IDREFS -> ShowS)
-> (IDREFS -> String) -> ([IDREFS] -> ShowS) -> Show IDREFS
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [IDREFS] -> ShowS
$cshowList :: [IDREFS] -> ShowS
show :: IDREFS -> String
$cshow :: IDREFS -> String
showsPrec :: Int -> IDREFS -> ShowS
$cshowsPrec :: Int -> IDREFS -> ShowS
Show)
newtype ENTITY   = ENTITY   String              deriving (ENTITY -> ENTITY -> Bool
(ENTITY -> ENTITY -> Bool)
-> (ENTITY -> ENTITY -> Bool) -> Eq ENTITY
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ENTITY -> ENTITY -> Bool
$c/= :: ENTITY -> ENTITY -> Bool
== :: ENTITY -> ENTITY -> Bool
$c== :: ENTITY -> ENTITY -> Bool
Eq,Int -> ENTITY -> ShowS
[ENTITY] -> ShowS
ENTITY -> String
(Int -> ENTITY -> ShowS)
-> (ENTITY -> String) -> ([ENTITY] -> ShowS) -> Show ENTITY
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ENTITY] -> ShowS
$cshowList :: [ENTITY] -> ShowS
show :: ENTITY -> String
$cshow :: ENTITY -> String
showsPrec :: Int -> ENTITY -> ShowS
$cshowsPrec :: Int -> ENTITY -> ShowS
Show)
newtype ENTITIES = ENTITIES String              deriving (ENTITIES -> ENTITIES -> Bool
(ENTITIES -> ENTITIES -> Bool)
-> (ENTITIES -> ENTITIES -> Bool) -> Eq ENTITIES
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ENTITIES -> ENTITIES -> Bool
$c/= :: ENTITIES -> ENTITIES -> Bool
== :: ENTITIES -> ENTITIES -> Bool
$c== :: ENTITIES -> ENTITIES -> Bool
Eq,Int -> ENTITIES -> ShowS
[ENTITIES] -> ShowS
ENTITIES -> String
(Int -> ENTITIES -> ShowS)
-> (ENTITIES -> String) -> ([ENTITIES] -> ShowS) -> Show ENTITIES
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ENTITIES] -> ShowS
$cshowList :: [ENTITIES] -> ShowS
show :: ENTITIES -> String
$cshow :: ENTITIES -> String
showsPrec :: Int -> ENTITIES -> ShowS
$cshowsPrec :: Int -> ENTITIES -> ShowS
Show)
newtype NMTOKEN  = NMTOKEN  String              deriving (NMTOKEN -> NMTOKEN -> Bool
(NMTOKEN -> NMTOKEN -> Bool)
-> (NMTOKEN -> NMTOKEN -> Bool) -> Eq NMTOKEN
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: NMTOKEN -> NMTOKEN -> Bool
$c/= :: NMTOKEN -> NMTOKEN -> Bool
== :: NMTOKEN -> NMTOKEN -> Bool
$c== :: NMTOKEN -> NMTOKEN -> Bool
Eq,Int -> NMTOKEN -> ShowS
[NMTOKEN] -> ShowS
NMTOKEN -> String
(Int -> NMTOKEN -> ShowS)
-> (NMTOKEN -> String) -> ([NMTOKEN] -> ShowS) -> Show NMTOKEN
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [NMTOKEN] -> ShowS
$cshowList :: [NMTOKEN] -> ShowS
show :: NMTOKEN -> String
$cshow :: NMTOKEN -> String
showsPrec :: Int -> NMTOKEN -> ShowS
$cshowsPrec :: Int -> NMTOKEN -> ShowS
Show)
newtype NMTOKENS = NMTOKENS String              deriving (NMTOKENS -> NMTOKENS -> Bool
(NMTOKENS -> NMTOKENS -> Bool)
-> (NMTOKENS -> NMTOKENS -> Bool) -> Eq NMTOKENS
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: NMTOKENS -> NMTOKENS -> Bool
$c/= :: NMTOKENS -> NMTOKENS -> Bool
== :: NMTOKENS -> NMTOKENS -> Bool
$c== :: NMTOKENS -> NMTOKENS -> Bool
Eq,Int -> NMTOKENS -> ShowS
[NMTOKENS] -> ShowS
NMTOKENS -> String
(Int -> NMTOKENS -> ShowS)
-> (NMTOKENS -> String) -> ([NMTOKENS] -> ShowS) -> Show NMTOKENS
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [NMTOKENS] -> ShowS
$cshowList :: [NMTOKENS] -> ShowS
show :: NMTOKENS -> String
$cshow :: NMTOKENS -> String
showsPrec :: Int -> NMTOKENS -> ShowS
$cshowsPrec :: Int -> NMTOKENS -> ShowS
Show)

instance SimpleType NormalizedString where
    acceptingParser :: TextParser NormalizedString
acceptingParser = (String -> NormalizedString)
-> TextParser String -> TextParser NormalizedString
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap String -> NormalizedString
Normalized (TextParser Char -> TextParser String
forall (f :: * -> *) a. Alternative f => f a -> f [a]
many TextParser Char
forall t. Parser t t
next)
    simpleTypeText :: NormalizedString -> String
simpleTypeText (Normalized String
x) = String
x
instance SimpleType Token where
    acceptingParser :: TextParser Token
acceptingParser = (String -> Token) -> TextParser String -> TextParser Token
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap String -> Token
Token (TextParser Char -> TextParser String
forall (f :: * -> *) a. Alternative f => f a -> f [a]
many TextParser Char
forall t. Parser t t
next)
    simpleTypeText :: Token -> String
simpleTypeText (Token String
x) = String
x
instance SimpleType Language where
    acceptingParser :: TextParser Language
acceptingParser = (String -> Language) -> TextParser String -> TextParser Language
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap String -> Language
Language (TextParser Char -> TextParser String
forall (f :: * -> *) a. Alternative f => f a -> f [a]
many TextParser Char
forall t. Parser t t
next)
    simpleTypeText :: Language -> String
simpleTypeText (Language String
x) = String
x
instance SimpleType Name where
    acceptingParser :: TextParser Name
acceptingParser = (String -> Name) -> TextParser String -> TextParser Name
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap String -> Name
Name (TextParser Char -> TextParser String
forall (f :: * -> *) a. Alternative f => f a -> f [a]
many TextParser Char
forall t. Parser t t
next)
    simpleTypeText :: Name -> String
simpleTypeText (Name String
x) = String
x
instance SimpleType NCName where
    acceptingParser :: TextParser NCName
acceptingParser = (String -> NCName) -> TextParser String -> TextParser NCName
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap String -> NCName
NCName (TextParser Char -> TextParser String
forall (f :: * -> *) a. Alternative f => f a -> f [a]
many TextParser Char
forall t. Parser t t
next)
    simpleTypeText :: NCName -> String
simpleTypeText (NCName String
x) = String
x
instance SimpleType ID where
    acceptingParser :: TextParser ID
acceptingParser = (String -> ID) -> TextParser String -> TextParser ID
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap String -> ID
ID (TextParser Char -> TextParser String
forall (f :: * -> *) a. Alternative f => f a -> f [a]
many TextParser Char
forall t. Parser t t
next)
    simpleTypeText :: ID -> String
simpleTypeText (ID String
x) = String
x
instance SimpleType IDREF where
    acceptingParser :: TextParser IDREF
acceptingParser = (String -> IDREF) -> TextParser String -> TextParser IDREF
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap String -> IDREF
IDREF (TextParser Char -> TextParser String
forall (f :: * -> *) a. Alternative f => f a -> f [a]
many TextParser Char
forall t. Parser t t
next)
    simpleTypeText :: IDREF -> String
simpleTypeText (IDREF String
x) = String
x
instance SimpleType IDREFS where
    acceptingParser :: TextParser IDREFS
acceptingParser = (String -> IDREFS) -> TextParser String -> TextParser IDREFS
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap String -> IDREFS
IDREFS (TextParser Char -> TextParser String
forall (f :: * -> *) a. Alternative f => f a -> f [a]
many TextParser Char
forall t. Parser t t
next)
    simpleTypeText :: IDREFS -> String
simpleTypeText (IDREFS String
x) = String
x
instance SimpleType ENTITY where
    acceptingParser :: TextParser ENTITY
acceptingParser = (String -> ENTITY) -> TextParser String -> TextParser ENTITY
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap String -> ENTITY
ENTITY (TextParser Char -> TextParser String
forall (f :: * -> *) a. Alternative f => f a -> f [a]
many TextParser Char
forall t. Parser t t
next)
    simpleTypeText :: ENTITY -> String
simpleTypeText (ENTITY String
x) = String
x
instance SimpleType ENTITIES where
    acceptingParser :: TextParser ENTITIES
acceptingParser = (String -> ENTITIES) -> TextParser String -> TextParser ENTITIES
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap String -> ENTITIES
ENTITIES (TextParser Char -> TextParser String
forall (f :: * -> *) a. Alternative f => f a -> f [a]
many TextParser Char
forall t. Parser t t
next)
    simpleTypeText :: ENTITIES -> String
simpleTypeText (ENTITIES String
x) = String
x
instance SimpleType NMTOKEN where
    acceptingParser :: TextParser NMTOKEN
acceptingParser = (String -> NMTOKEN) -> TextParser String -> TextParser NMTOKEN
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap String -> NMTOKEN
NMTOKEN (TextParser Char -> TextParser String
forall (f :: * -> *) a. Alternative f => f a -> f [a]
many TextParser Char
forall t. Parser t t
next)
    simpleTypeText :: NMTOKEN -> String
simpleTypeText (NMTOKEN String
x) = String
x
instance SimpleType NMTOKENS where
    acceptingParser :: TextParser NMTOKENS
acceptingParser = (String -> NMTOKENS) -> TextParser String -> TextParser NMTOKENS
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap String -> NMTOKENS
NMTOKENS (TextParser Char -> TextParser String
forall (f :: * -> *) a. Alternative f => f a -> f [a]
many TextParser Char
forall t. Parser t t
next)
    simpleTypeText :: NMTOKENS -> String
simpleTypeText (NMTOKENS String
x) = String
x

--data Integer
newtype NonPositiveInteger = NonPos   Integer   deriving (NonPositiveInteger -> NonPositiveInteger -> Bool
(NonPositiveInteger -> NonPositiveInteger -> Bool)
-> (NonPositiveInteger -> NonPositiveInteger -> Bool)
-> Eq NonPositiveInteger
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: NonPositiveInteger -> NonPositiveInteger -> Bool
$c/= :: NonPositiveInteger -> NonPositiveInteger -> Bool
== :: NonPositiveInteger -> NonPositiveInteger -> Bool
$c== :: NonPositiveInteger -> NonPositiveInteger -> Bool
Eq,Int -> NonPositiveInteger -> ShowS
[NonPositiveInteger] -> ShowS
NonPositiveInteger -> String
(Int -> NonPositiveInteger -> ShowS)
-> (NonPositiveInteger -> String)
-> ([NonPositiveInteger] -> ShowS)
-> Show NonPositiveInteger
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [NonPositiveInteger] -> ShowS
$cshowList :: [NonPositiveInteger] -> ShowS
show :: NonPositiveInteger -> String
$cshow :: NonPositiveInteger -> String
showsPrec :: Int -> NonPositiveInteger -> ShowS
$cshowsPrec :: Int -> NonPositiveInteger -> ShowS
Show)
newtype NegativeInteger    = Negative Integer   deriving (NegativeInteger -> NegativeInteger -> Bool
(NegativeInteger -> NegativeInteger -> Bool)
-> (NegativeInteger -> NegativeInteger -> Bool)
-> Eq NegativeInteger
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: NegativeInteger -> NegativeInteger -> Bool
$c/= :: NegativeInteger -> NegativeInteger -> Bool
== :: NegativeInteger -> NegativeInteger -> Bool
$c== :: NegativeInteger -> NegativeInteger -> Bool
Eq,Int -> NegativeInteger -> ShowS
[NegativeInteger] -> ShowS
NegativeInteger -> String
(Int -> NegativeInteger -> ShowS)
-> (NegativeInteger -> String)
-> ([NegativeInteger] -> ShowS)
-> Show NegativeInteger
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [NegativeInteger] -> ShowS
$cshowList :: [NegativeInteger] -> ShowS
show :: NegativeInteger -> String
$cshow :: NegativeInteger -> String
showsPrec :: Int -> NegativeInteger -> ShowS
$cshowsPrec :: Int -> NegativeInteger -> ShowS
Show)
newtype Long               = Long     Int64     deriving (Long -> Long -> Bool
(Long -> Long -> Bool) -> (Long -> Long -> Bool) -> Eq Long
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Long -> Long -> Bool
$c/= :: Long -> Long -> Bool
== :: Long -> Long -> Bool
$c== :: Long -> Long -> Bool
Eq,Int -> Long -> ShowS
[Long] -> ShowS
Long -> String
(Int -> Long -> ShowS)
-> (Long -> String) -> ([Long] -> ShowS) -> Show Long
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Long] -> ShowS
$cshowList :: [Long] -> ShowS
show :: Long -> String
$cshow :: Long -> String
showsPrec :: Int -> Long -> ShowS
$cshowsPrec :: Int -> Long -> ShowS
Show)
--data Int
newtype Short              = Short    Int16     deriving (Short -> Short -> Bool
(Short -> Short -> Bool) -> (Short -> Short -> Bool) -> Eq Short
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Short -> Short -> Bool
$c/= :: Short -> Short -> Bool
== :: Short -> Short -> Bool
$c== :: Short -> Short -> Bool
Eq,Int -> Short -> ShowS
[Short] -> ShowS
Short -> String
(Int -> Short -> ShowS)
-> (Short -> String) -> ([Short] -> ShowS) -> Show Short
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Short] -> ShowS
$cshowList :: [Short] -> ShowS
show :: Short -> String
$cshow :: Short -> String
showsPrec :: Int -> Short -> ShowS
$cshowsPrec :: Int -> Short -> ShowS
Show)
newtype Byte               = Byte     Int8      deriving (Byte -> Byte -> Bool
(Byte -> Byte -> Bool) -> (Byte -> Byte -> Bool) -> Eq Byte
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Byte -> Byte -> Bool
$c/= :: Byte -> Byte -> Bool
== :: Byte -> Byte -> Bool
$c== :: Byte -> Byte -> Bool
Eq,Int -> Byte -> ShowS
[Byte] -> ShowS
Byte -> String
(Int -> Byte -> ShowS)
-> (Byte -> String) -> ([Byte] -> ShowS) -> Show Byte
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Byte] -> ShowS
$cshowList :: [Byte] -> ShowS
show :: Byte -> String
$cshow :: Byte -> String
showsPrec :: Int -> Byte -> ShowS
$cshowsPrec :: Int -> Byte -> ShowS
Show)
newtype NonNegativeInteger = NonNeg   Integer   deriving (NonNegativeInteger -> NonNegativeInteger -> Bool
(NonNegativeInteger -> NonNegativeInteger -> Bool)
-> (NonNegativeInteger -> NonNegativeInteger -> Bool)
-> Eq NonNegativeInteger
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: NonNegativeInteger -> NonNegativeInteger -> Bool
$c/= :: NonNegativeInteger -> NonNegativeInteger -> Bool
== :: NonNegativeInteger -> NonNegativeInteger -> Bool
$c== :: NonNegativeInteger -> NonNegativeInteger -> Bool
Eq,Int -> NonNegativeInteger -> ShowS
[NonNegativeInteger] -> ShowS
NonNegativeInteger -> String
(Int -> NonNegativeInteger -> ShowS)
-> (NonNegativeInteger -> String)
-> ([NonNegativeInteger] -> ShowS)
-> Show NonNegativeInteger
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [NonNegativeInteger] -> ShowS
$cshowList :: [NonNegativeInteger] -> ShowS
show :: NonNegativeInteger -> String
$cshow :: NonNegativeInteger -> String
showsPrec :: Int -> NonNegativeInteger -> ShowS
$cshowsPrec :: Int -> NonNegativeInteger -> ShowS
Show)
newtype UnsignedLong       = ULong    Word64    deriving (UnsignedLong -> UnsignedLong -> Bool
(UnsignedLong -> UnsignedLong -> Bool)
-> (UnsignedLong -> UnsignedLong -> Bool) -> Eq UnsignedLong
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UnsignedLong -> UnsignedLong -> Bool
$c/= :: UnsignedLong -> UnsignedLong -> Bool
== :: UnsignedLong -> UnsignedLong -> Bool
$c== :: UnsignedLong -> UnsignedLong -> Bool
Eq,Int -> UnsignedLong -> ShowS
[UnsignedLong] -> ShowS
UnsignedLong -> String
(Int -> UnsignedLong -> ShowS)
-> (UnsignedLong -> String)
-> ([UnsignedLong] -> ShowS)
-> Show UnsignedLong
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UnsignedLong] -> ShowS
$cshowList :: [UnsignedLong] -> ShowS
show :: UnsignedLong -> String
$cshow :: UnsignedLong -> String
showsPrec :: Int -> UnsignedLong -> ShowS
$cshowsPrec :: Int -> UnsignedLong -> ShowS
Show)
newtype UnsignedInt        = UInt     Word32    deriving (UnsignedInt -> UnsignedInt -> Bool
(UnsignedInt -> UnsignedInt -> Bool)
-> (UnsignedInt -> UnsignedInt -> Bool) -> Eq UnsignedInt
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UnsignedInt -> UnsignedInt -> Bool
$c/= :: UnsignedInt -> UnsignedInt -> Bool
== :: UnsignedInt -> UnsignedInt -> Bool
$c== :: UnsignedInt -> UnsignedInt -> Bool
Eq,Int -> UnsignedInt -> ShowS
[UnsignedInt] -> ShowS
UnsignedInt -> String
(Int -> UnsignedInt -> ShowS)
-> (UnsignedInt -> String)
-> ([UnsignedInt] -> ShowS)
-> Show UnsignedInt
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UnsignedInt] -> ShowS
$cshowList :: [UnsignedInt] -> ShowS
show :: UnsignedInt -> String
$cshow :: UnsignedInt -> String
showsPrec :: Int -> UnsignedInt -> ShowS
$cshowsPrec :: Int -> UnsignedInt -> ShowS
Show)
newtype UnsignedShort      = UShort   Word16    deriving (UnsignedShort -> UnsignedShort -> Bool
(UnsignedShort -> UnsignedShort -> Bool)
-> (UnsignedShort -> UnsignedShort -> Bool) -> Eq UnsignedShort
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UnsignedShort -> UnsignedShort -> Bool
$c/= :: UnsignedShort -> UnsignedShort -> Bool
== :: UnsignedShort -> UnsignedShort -> Bool
$c== :: UnsignedShort -> UnsignedShort -> Bool
Eq,Int -> UnsignedShort -> ShowS
[UnsignedShort] -> ShowS
UnsignedShort -> String
(Int -> UnsignedShort -> ShowS)
-> (UnsignedShort -> String)
-> ([UnsignedShort] -> ShowS)
-> Show UnsignedShort
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UnsignedShort] -> ShowS
$cshowList :: [UnsignedShort] -> ShowS
show :: UnsignedShort -> String
$cshow :: UnsignedShort -> String
showsPrec :: Int -> UnsignedShort -> ShowS
$cshowsPrec :: Int -> UnsignedShort -> ShowS
Show)
newtype UnsignedByte       = UByte    Word8     deriving (UnsignedByte -> UnsignedByte -> Bool
(UnsignedByte -> UnsignedByte -> Bool)
-> (UnsignedByte -> UnsignedByte -> Bool) -> Eq UnsignedByte
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UnsignedByte -> UnsignedByte -> Bool
$c/= :: UnsignedByte -> UnsignedByte -> Bool
== :: UnsignedByte -> UnsignedByte -> Bool
$c== :: UnsignedByte -> UnsignedByte -> Bool
Eq,Int -> UnsignedByte -> ShowS
[UnsignedByte] -> ShowS
UnsignedByte -> String
(Int -> UnsignedByte -> ShowS)
-> (UnsignedByte -> String)
-> ([UnsignedByte] -> ShowS)
-> Show UnsignedByte
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UnsignedByte] -> ShowS
$cshowList :: [UnsignedByte] -> ShowS
show :: UnsignedByte -> String
$cshow :: UnsignedByte -> String
showsPrec :: Int -> UnsignedByte -> ShowS
$cshowsPrec :: Int -> UnsignedByte -> ShowS
Show)
newtype PositiveInteger    = Positive Integer   deriving (PositiveInteger -> PositiveInteger -> Bool
(PositiveInteger -> PositiveInteger -> Bool)
-> (PositiveInteger -> PositiveInteger -> Bool)
-> Eq PositiveInteger
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PositiveInteger -> PositiveInteger -> Bool
$c/= :: PositiveInteger -> PositiveInteger -> Bool
== :: PositiveInteger -> PositiveInteger -> Bool
$c== :: PositiveInteger -> PositiveInteger -> Bool
Eq,Int -> PositiveInteger -> ShowS
[PositiveInteger] -> ShowS
PositiveInteger -> String
(Int -> PositiveInteger -> ShowS)
-> (PositiveInteger -> String)
-> ([PositiveInteger] -> ShowS)
-> Show PositiveInteger
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PositiveInteger] -> ShowS
$cshowList :: [PositiveInteger] -> ShowS
show :: PositiveInteger -> String
$cshow :: PositiveInteger -> String
showsPrec :: Int -> PositiveInteger -> ShowS
$cshowsPrec :: Int -> PositiveInteger -> ShowS
Show)

instance SimpleType Integer where
    acceptingParser :: TextParser Integer
acceptingParser = TextParser Integer
forall a. Parse a => TextParser a
parse
    simpleTypeText :: Integer -> String
simpleTypeText  = Integer -> String
forall a. Show a => a -> String
show
instance SimpleType NonPositiveInteger where
    acceptingParser :: TextParser NonPositiveInteger
acceptingParser = (Integer -> NonPositiveInteger)
-> TextParser Integer -> TextParser NonPositiveInteger
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Integer -> NonPositiveInteger
NonPos TextParser Integer
forall a. Parse a => TextParser a
parse
    simpleTypeText :: NonPositiveInteger -> String
simpleTypeText (NonPos Integer
x) = Integer -> String
forall a. Show a => a -> String
show Integer
x
instance SimpleType NegativeInteger where
    acceptingParser :: TextParser NegativeInteger
acceptingParser = (Integer -> NegativeInteger)
-> TextParser Integer -> TextParser NegativeInteger
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Integer -> NegativeInteger
Negative TextParser Integer
forall a. Parse a => TextParser a
parse
    simpleTypeText :: NegativeInteger -> String
simpleTypeText (Negative Integer
x) = Integer -> String
forall a. Show a => a -> String
show Integer
x
instance SimpleType Long where
    acceptingParser :: TextParser Long
acceptingParser = (Integer -> Long) -> TextParser Integer -> TextParser Long
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (Int64 -> Long
Long (Int64 -> Long) -> (Integer -> Int64) -> Integer -> Long
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Integer -> Int64
forall a. Num a => Integer -> a
fromInteger) TextParser Integer
forall a. Parse a => TextParser a
parse
    simpleTypeText :: Long -> String
simpleTypeText (Long Int64
x) = Int64 -> String
forall a. Show a => a -> String
show Int64
x
instance SimpleType Int where
    acceptingParser :: Parser Char Int
acceptingParser = Parser Char Int
forall a. Parse a => TextParser a
parse
    simpleTypeText :: Int -> String
simpleTypeText  = Int -> String
forall a. Show a => a -> String
show
instance SimpleType Short where
    acceptingParser :: TextParser Short
acceptingParser = (Integer -> Short) -> TextParser Integer -> TextParser Short
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (Int16 -> Short
Short (Int16 -> Short) -> (Integer -> Int16) -> Integer -> Short
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Integer -> Int16
forall a. Num a => Integer -> a
fromInteger) TextParser Integer
forall a. Parse a => TextParser a
parse
    simpleTypeText :: Short -> String
simpleTypeText (Short Int16
x) = Int16 -> String
forall a. Show a => a -> String
show Int16
x
instance SimpleType Byte where
    acceptingParser :: TextParser Byte
acceptingParser = (Integer -> Byte) -> TextParser Integer -> TextParser Byte
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (Int8 -> Byte
Byte (Int8 -> Byte) -> (Integer -> Int8) -> Integer -> Byte
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Integer -> Int8
forall a. Num a => Integer -> a
fromInteger) TextParser Integer
forall a. Parse a => TextParser a
parse
    simpleTypeText :: Byte -> String
simpleTypeText (Byte Int8
x) = Int8 -> String
forall a. Show a => a -> String
show Int8
x
instance SimpleType NonNegativeInteger where
    acceptingParser :: TextParser NonNegativeInteger
acceptingParser = (Integer -> NonNegativeInteger)
-> TextParser Integer -> TextParser NonNegativeInteger
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Integer -> NonNegativeInteger
NonNeg TextParser Integer
forall a. Parse a => TextParser a
parse
    simpleTypeText :: NonNegativeInteger -> String
simpleTypeText (NonNeg Integer
x) = Integer -> String
forall a. Show a => a -> String
show Integer
x
instance SimpleType UnsignedLong where
    acceptingParser :: TextParser UnsignedLong
acceptingParser = (Integer -> UnsignedLong)
-> TextParser Integer -> TextParser UnsignedLong
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (Word64 -> UnsignedLong
ULong (Word64 -> UnsignedLong)
-> (Integer -> Word64) -> Integer -> UnsignedLong
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Integer -> Word64
forall a. Num a => Integer -> a
fromInteger) TextParser Integer
forall a. Parse a => TextParser a
parse
    simpleTypeText :: UnsignedLong -> String
simpleTypeText (ULong Word64
x) = Word64 -> String
forall a. Show a => a -> String
show Word64
x
instance SimpleType UnsignedInt where
    acceptingParser :: TextParser UnsignedInt
acceptingParser = (Integer -> UnsignedInt)
-> TextParser Integer -> TextParser UnsignedInt
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (Word32 -> UnsignedInt
UInt (Word32 -> UnsignedInt)
-> (Integer -> Word32) -> Integer -> UnsignedInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Integer -> Word32
forall a. Num a => Integer -> a
fromInteger) TextParser Integer
forall a. Parse a => TextParser a
parse
    simpleTypeText :: UnsignedInt -> String
simpleTypeText (UInt Word32
x) = Word32 -> String
forall a. Show a => a -> String
show Word32
x
instance SimpleType UnsignedShort where
    acceptingParser :: TextParser UnsignedShort
acceptingParser = (Integer -> UnsignedShort)
-> TextParser Integer -> TextParser UnsignedShort
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (Word16 -> UnsignedShort
UShort (Word16 -> UnsignedShort)
-> (Integer -> Word16) -> Integer -> UnsignedShort
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Integer -> Word16
forall a. Num a => Integer -> a
fromInteger) TextParser Integer
forall a. Parse a => TextParser a
parse
    simpleTypeText :: UnsignedShort -> String
simpleTypeText (UShort Word16
x) = Word16 -> String
forall a. Show a => a -> String
show Word16
x
instance SimpleType UnsignedByte where
    acceptingParser :: TextParser UnsignedByte
acceptingParser = (Integer -> UnsignedByte)
-> TextParser Integer -> TextParser UnsignedByte
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (Word8 -> UnsignedByte
UByte (Word8 -> UnsignedByte)
-> (Integer -> Word8) -> Integer -> UnsignedByte
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Integer -> Word8
forall a. Num a => Integer -> a
fromInteger) TextParser Integer
forall a. Parse a => TextParser a
parse
    simpleTypeText :: UnsignedByte -> String
simpleTypeText (UByte Word8
x) = Word8 -> String
forall a. Show a => a -> String
show Word8
x
instance SimpleType PositiveInteger where
    acceptingParser :: TextParser PositiveInteger
acceptingParser = (Integer -> PositiveInteger)
-> TextParser Integer -> TextParser PositiveInteger
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Integer -> PositiveInteger
Positive TextParser Integer
forall a. Parse a => TextParser a
parse
    simpleTypeText :: PositiveInteger -> String
simpleTypeText (Positive Integer
x) = Integer -> String
forall a. Show a => a -> String
show Integer
x