{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE ExistentialQuantification #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE UndecidableInstances #-}
module Text.RSS.Types where
import Control.Exception.Safe
import Data.Semigroup
import Data.Set
import Data.Text (Text, unpack)
import Data.Time.Clock
import Data.Time.LocalTime ()
import Data.Version
import GHC.Generics hiding ((:+:))
import Text.Read
import URI.ByteString
data = InvalidBool Text
| InvalidDay Text
| InvalidHour Int
| InvalidInt Text
| InvalidURI URIParseError
| InvalidVersion Text
| InvalidProtocol Text
| InvalidTime Text
| MissingElement Text
deriving instance Eq RssException
deriving instance Generic RssException
deriving instance Read RssException
deriving instance Show RssException
instance Exception RssException where
displayException :: RssException -> String
displayException (InvalidBool Text
t) = String
"Invalid bool: " String -> ShowS
forall a. [a] -> [a] -> [a]
++ Text -> String
unpack Text
t
displayException (InvalidDay Text
t) = String
"Invalid day: " String -> ShowS
forall a. [a] -> [a] -> [a]
++ Text -> String
unpack Text
t
displayException (InvalidHour Int
i) = String
"Invalid hour: " String -> ShowS
forall a. [a] -> [a] -> [a]
++ Int -> String
forall a. Show a => a -> String
show Int
i
displayException (InvalidInt Text
t) = String
"Invalid int: " String -> ShowS
forall a. [a] -> [a] -> [a]
++ Text -> String
unpack Text
t
displayException (InvalidURI URIParseError
t) = String
"Invalid URI reference: " String -> ShowS
forall a. [a] -> [a] -> [a]
++ URIParseError -> String
forall a. Show a => a -> String
show URIParseError
t
displayException (InvalidVersion Text
t) = String
"Invalid version: " String -> ShowS
forall a. [a] -> [a] -> [a]
++ Text -> String
unpack Text
t
displayException (InvalidProtocol Text
t) = String
"Invalid Protocol: expected \"xml-rpc\", \"soap\" or \"http-post\", got \"" String -> ShowS
forall a. [a] -> [a] -> [a]
++ Text -> String
unpack Text
t String -> ShowS
forall a. [a] -> [a] -> [a]
++ String
"\""
displayException (InvalidTime Text
t) = String
"Invalid time: " String -> ShowS
forall a. [a] -> [a] -> [a]
++ Text -> String
unpack Text
t
displayException (MissingElement Text
t) = String
"Missing element: " String -> ShowS
forall a. [a] -> [a] -> [a]
++ Text -> String
unpack Text
t
data = forall a . (URIRef a)
instance Eq RssURI where
RssURI a :: URIRef a
a@URI{} == :: RssURI -> RssURI -> Bool
== RssURI b :: URIRef a
b@URI{} = URIRef a
a URIRef a -> URIRef a -> Bool
forall a. Eq a => a -> a -> Bool
== URIRef a
URIRef a
b
RssURI a :: URIRef a
a@RelativeRef{} == RssURI b :: URIRef a
b@RelativeRef{} = URIRef a
a URIRef a -> URIRef a -> Bool
forall a. Eq a => a -> a -> Bool
== URIRef a
URIRef a
b
RssURI
_ == RssURI
_ = Bool
False
instance Ord RssURI where
RssURI a :: URIRef a
a@URI{} compare :: RssURI -> RssURI -> Ordering
`compare` RssURI b :: URIRef a
b@URI{} = URIRef a
a URIRef a -> URIRef a -> Ordering
forall a. Ord a => a -> a -> Ordering
`compare` URIRef a
URIRef a
b
RssURI a :: URIRef a
a@RelativeRef{} `compare` RssURI b :: URIRef a
b@RelativeRef{} = URIRef a
a URIRef a -> URIRef a -> Ordering
forall a. Ord a => a -> a -> Ordering
`compare` URIRef a
URIRef a
b
RssURI a :: URIRef a
a@RelativeRef{} `compare` RssURI b :: URIRef a
b@URI{} = Ordering
LT
RssURI
_ `compare` RssURI
_ = Ordering
GT
instance Show RssURI where
show :: RssURI -> String
show (RssURI a :: URIRef a
a@URI{}) = URIRef a -> String
forall a. Show a => a -> String
show URIRef a
a
show (RssURI a :: URIRef a
a@RelativeRef{}) = URIRef a -> String
forall a. Show a => a -> String
show URIRef a
a
withRssURI :: (forall a . URIRef a -> b) -> RssURI -> b
forall a. URIRef a -> b
f (RssURI URIRef a
a) = URIRef a -> b
forall a. URIRef a -> b
f URIRef a
a
data =
{ RssCategory -> Text
categoryDomain :: Text
, RssCategory -> Text
categoryName :: Text
}
deriving instance Eq RssCategory
deriving instance Generic RssCategory
deriving instance Ord RssCategory
deriving instance Show RssCategory
data =
{ RssEnclosure -> RssURI
enclosureUrl :: RssURI
, RssEnclosure -> Int
enclosureLength :: Int
, RssEnclosure -> Text
enclosureType :: Text
}
deriving instance Eq RssEnclosure
deriving instance Generic RssEnclosure
deriving instance Ord RssEnclosure
deriving instance Show RssEnclosure
data =
{ RssSource -> RssURI
sourceUrl :: RssURI
, RssSource -> Text
sourceName :: Text
}
deriving instance Eq RssSource
deriving instance Generic RssSource
deriving instance Ord RssSource
deriving instance Show RssSource
data = GuidText Text | GuidUri RssURI
deriving(RssGuid -> RssGuid -> Bool
(RssGuid -> RssGuid -> Bool)
-> (RssGuid -> RssGuid -> Bool) -> Eq RssGuid
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RssGuid -> RssGuid -> Bool
$c/= :: RssGuid -> RssGuid -> Bool
== :: RssGuid -> RssGuid -> Bool
$c== :: RssGuid -> RssGuid -> Bool
Eq, (forall x. RssGuid -> Rep RssGuid x)
-> (forall x. Rep RssGuid x -> RssGuid) -> Generic RssGuid
forall x. Rep RssGuid x -> RssGuid
forall x. RssGuid -> Rep RssGuid x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RssGuid x -> RssGuid
$cfrom :: forall x. RssGuid -> Rep RssGuid x
Generic, Eq RssGuid
Eq RssGuid
-> (RssGuid -> RssGuid -> Ordering)
-> (RssGuid -> RssGuid -> Bool)
-> (RssGuid -> RssGuid -> Bool)
-> (RssGuid -> RssGuid -> Bool)
-> (RssGuid -> RssGuid -> Bool)
-> (RssGuid -> RssGuid -> RssGuid)
-> (RssGuid -> RssGuid -> RssGuid)
-> Ord RssGuid
RssGuid -> RssGuid -> Bool
RssGuid -> RssGuid -> Ordering
RssGuid -> RssGuid -> RssGuid
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 :: RssGuid -> RssGuid -> RssGuid
$cmin :: RssGuid -> RssGuid -> RssGuid
max :: RssGuid -> RssGuid -> RssGuid
$cmax :: RssGuid -> RssGuid -> RssGuid
>= :: RssGuid -> RssGuid -> Bool
$c>= :: RssGuid -> RssGuid -> Bool
> :: RssGuid -> RssGuid -> Bool
$c> :: RssGuid -> RssGuid -> Bool
<= :: RssGuid -> RssGuid -> Bool
$c<= :: RssGuid -> RssGuid -> Bool
< :: RssGuid -> RssGuid -> Bool
$c< :: RssGuid -> RssGuid -> Bool
compare :: RssGuid -> RssGuid -> Ordering
$ccompare :: RssGuid -> RssGuid -> Ordering
$cp1Ord :: Eq RssGuid
Ord, Int -> RssGuid -> ShowS
[RssGuid] -> ShowS
RssGuid -> String
(Int -> RssGuid -> ShowS)
-> (RssGuid -> String) -> ([RssGuid] -> ShowS) -> Show RssGuid
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RssGuid] -> ShowS
$cshowList :: [RssGuid] -> ShowS
show :: RssGuid -> String
$cshow :: RssGuid -> String
showsPrec :: Int -> RssGuid -> ShowS
$cshowsPrec :: Int -> RssGuid -> ShowS
Show)
data extensions =
{ RssItem extensions -> Text
itemTitle :: Text
, RssItem extensions -> Maybe RssURI
itemLink :: Maybe RssURI
, RssItem extensions -> Text
itemDescription :: Text
, RssItem extensions -> Text
itemAuthor :: Text
, RssItem extensions -> [RssCategory]
itemCategories :: [RssCategory]
, :: Maybe RssURI
, RssItem extensions -> [RssEnclosure]
itemEnclosure :: [RssEnclosure]
, RssItem extensions -> Maybe RssGuid
itemGuid :: Maybe RssGuid
, RssItem extensions -> Maybe UTCTime
itemPubDate :: Maybe UTCTime
, RssItem extensions -> Maybe RssSource
itemSource :: Maybe RssSource
, RssItem extensions -> RssItemExtension extensions
itemExtensions :: RssItemExtension extensions
}
deriving instance (Eq (RssItemExtension e)) => Eq (RssItem e)
deriving instance (Generic (RssItemExtension e)) => Generic (RssItem e)
deriving instance (Ord (RssItemExtension e)) => Ord (RssItem e)
deriving instance (Show (RssItemExtension e)) => Show (RssItem e)
type = RssItem NoExtensions
data =
{ RssTextInput -> Text
textInputTitle :: Text
, RssTextInput -> Text
textInputDescription :: Text
, RssTextInput -> Text
textInputName :: Text
, RssTextInput -> RssURI
textInputLink :: RssURI
}
deriving instance Eq RssTextInput
deriving instance Generic RssTextInput
deriving instance Ord RssTextInput
deriving instance Show RssTextInput
data CloudProtocol = ProtocolXmlRpc | ProtocolSoap | ProtocolHttpPost
deriving(CloudProtocol -> CloudProtocol -> Bool
(CloudProtocol -> CloudProtocol -> Bool)
-> (CloudProtocol -> CloudProtocol -> Bool) -> Eq CloudProtocol
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CloudProtocol -> CloudProtocol -> Bool
$c/= :: CloudProtocol -> CloudProtocol -> Bool
== :: CloudProtocol -> CloudProtocol -> Bool
$c== :: CloudProtocol -> CloudProtocol -> Bool
Eq, (forall x. CloudProtocol -> Rep CloudProtocol x)
-> (forall x. Rep CloudProtocol x -> CloudProtocol)
-> Generic CloudProtocol
forall x. Rep CloudProtocol x -> CloudProtocol
forall x. CloudProtocol -> Rep CloudProtocol x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CloudProtocol x -> CloudProtocol
$cfrom :: forall x. CloudProtocol -> Rep CloudProtocol x
Generic, Eq CloudProtocol
Eq CloudProtocol
-> (CloudProtocol -> CloudProtocol -> Ordering)
-> (CloudProtocol -> CloudProtocol -> Bool)
-> (CloudProtocol -> CloudProtocol -> Bool)
-> (CloudProtocol -> CloudProtocol -> Bool)
-> (CloudProtocol -> CloudProtocol -> Bool)
-> (CloudProtocol -> CloudProtocol -> CloudProtocol)
-> (CloudProtocol -> CloudProtocol -> CloudProtocol)
-> Ord CloudProtocol
CloudProtocol -> CloudProtocol -> Bool
CloudProtocol -> CloudProtocol -> Ordering
CloudProtocol -> CloudProtocol -> CloudProtocol
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 :: CloudProtocol -> CloudProtocol -> CloudProtocol
$cmin :: CloudProtocol -> CloudProtocol -> CloudProtocol
max :: CloudProtocol -> CloudProtocol -> CloudProtocol
$cmax :: CloudProtocol -> CloudProtocol -> CloudProtocol
>= :: CloudProtocol -> CloudProtocol -> Bool
$c>= :: CloudProtocol -> CloudProtocol -> Bool
> :: CloudProtocol -> CloudProtocol -> Bool
$c> :: CloudProtocol -> CloudProtocol -> Bool
<= :: CloudProtocol -> CloudProtocol -> Bool
$c<= :: CloudProtocol -> CloudProtocol -> Bool
< :: CloudProtocol -> CloudProtocol -> Bool
$c< :: CloudProtocol -> CloudProtocol -> Bool
compare :: CloudProtocol -> CloudProtocol -> Ordering
$ccompare :: CloudProtocol -> CloudProtocol -> Ordering
$cp1Ord :: Eq CloudProtocol
Ord, ReadPrec [CloudProtocol]
ReadPrec CloudProtocol
Int -> ReadS CloudProtocol
ReadS [CloudProtocol]
(Int -> ReadS CloudProtocol)
-> ReadS [CloudProtocol]
-> ReadPrec CloudProtocol
-> ReadPrec [CloudProtocol]
-> Read CloudProtocol
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CloudProtocol]
$creadListPrec :: ReadPrec [CloudProtocol]
readPrec :: ReadPrec CloudProtocol
$creadPrec :: ReadPrec CloudProtocol
readList :: ReadS [CloudProtocol]
$creadList :: ReadS [CloudProtocol]
readsPrec :: Int -> ReadS CloudProtocol
$creadsPrec :: Int -> ReadS CloudProtocol
Read, Int -> CloudProtocol -> ShowS
[CloudProtocol] -> ShowS
CloudProtocol -> String
(Int -> CloudProtocol -> ShowS)
-> (CloudProtocol -> String)
-> ([CloudProtocol] -> ShowS)
-> Show CloudProtocol
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CloudProtocol] -> ShowS
$cshowList :: [CloudProtocol] -> ShowS
show :: CloudProtocol -> String
$cshow :: CloudProtocol -> String
showsPrec :: Int -> CloudProtocol -> ShowS
$cshowsPrec :: Int -> CloudProtocol -> ShowS
Show)
data =
{ RssCloud -> RssURI
cloudUri :: RssURI
, RssCloud -> Text
cloudRegisterProcedure :: Text
, RssCloud -> CloudProtocol
cloudProtocol :: CloudProtocol
}
deriving instance Eq RssCloud
deriving instance Generic RssCloud
deriving instance Ord RssCloud
deriving instance Show RssCloud
data =
{ RssImage -> RssURI
imageUri :: RssURI
, RssImage -> Text
imageTitle :: Text
, RssImage -> RssURI
imageLink :: RssURI
, RssImage -> Maybe Int
imageWidth :: Maybe Int
, RssImage -> Maybe Int
imageHeight :: Maybe Int
, RssImage -> Text
imageDescription :: Text
}
deriving instance Eq RssImage
deriving instance Generic RssImage
deriving instance Ord RssImage
deriving instance Show RssImage
newtype Hour = Hour Int
deriving(Hour -> Hour -> Bool
(Hour -> Hour -> Bool) -> (Hour -> Hour -> Bool) -> Eq Hour
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Hour -> Hour -> Bool
$c/= :: Hour -> Hour -> Bool
== :: Hour -> Hour -> Bool
$c== :: Hour -> Hour -> Bool
Eq, (forall x. Hour -> Rep Hour x)
-> (forall x. Rep Hour x -> Hour) -> Generic Hour
forall x. Rep Hour x -> Hour
forall x. Hour -> Rep Hour x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Hour x -> Hour
$cfrom :: forall x. Hour -> Rep Hour x
Generic, Eq Hour
Eq Hour
-> (Hour -> Hour -> Ordering)
-> (Hour -> Hour -> Bool)
-> (Hour -> Hour -> Bool)
-> (Hour -> Hour -> Bool)
-> (Hour -> Hour -> Bool)
-> (Hour -> Hour -> Hour)
-> (Hour -> Hour -> Hour)
-> Ord Hour
Hour -> Hour -> Bool
Hour -> Hour -> Ordering
Hour -> Hour -> Hour
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 :: Hour -> Hour -> Hour
$cmin :: Hour -> Hour -> Hour
max :: Hour -> Hour -> Hour
$cmax :: Hour -> Hour -> Hour
>= :: Hour -> Hour -> Bool
$c>= :: Hour -> Hour -> Bool
> :: Hour -> Hour -> Bool
$c> :: Hour -> Hour -> Bool
<= :: Hour -> Hour -> Bool
$c<= :: Hour -> Hour -> Bool
< :: Hour -> Hour -> Bool
$c< :: Hour -> Hour -> Bool
compare :: Hour -> Hour -> Ordering
$ccompare :: Hour -> Hour -> Ordering
$cp1Ord :: Eq Hour
Ord, ReadPrec [Hour]
ReadPrec Hour
Int -> ReadS Hour
ReadS [Hour]
(Int -> ReadS Hour)
-> ReadS [Hour] -> ReadPrec Hour -> ReadPrec [Hour] -> Read Hour
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Hour]
$creadListPrec :: ReadPrec [Hour]
readPrec :: ReadPrec Hour
$creadPrec :: ReadPrec Hour
readList :: ReadS [Hour]
$creadList :: ReadS [Hour]
readsPrec :: Int -> ReadS Hour
$creadsPrec :: Int -> ReadS Hour
Read, Int -> Hour -> ShowS
[Hour] -> ShowS
Hour -> String
(Int -> Hour -> ShowS)
-> (Hour -> String) -> ([Hour] -> ShowS) -> Show Hour
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Hour] -> ShowS
$cshowList :: [Hour] -> ShowS
show :: Hour -> String
$cshow :: Hour -> String
showsPrec :: Int -> Hour -> ShowS
$cshowsPrec :: Int -> Hour -> ShowS
Show)
instance Bounded Hour where
minBound :: Hour
minBound = Int -> Hour
Hour Int
0
maxBound :: Hour
maxBound = Int -> Hour
Hour Int
23
instance Enum Hour where
fromEnum :: Hour -> Int
fromEnum (Hour Int
h) = Int -> Int
forall a. Enum a => a -> Int
fromEnum Int
h
toEnum :: Int -> Hour
toEnum Int
i = if Int
i Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
>= Int
0 Bool -> Bool -> Bool
&& Int
i Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
< Int
24 then Int -> Hour
Hour Int
i else String -> Hour
forall a. HasCallStack => String -> a
error (String -> Hour) -> String -> Hour
forall a b. (a -> b) -> a -> b
$ String
"Invalid hour: " String -> ShowS
forall a. Semigroup a => a -> a -> a
<> Int -> String
forall a. Show a => a -> String
show Int
i
asHour :: MonadThrow m => Int -> m Hour
asHour :: Int -> m Hour
asHour Int
i
| Int
i Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
>= Int
0 Bool -> Bool -> Bool
&& Int
i Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
< Int
24 = Hour -> m Hour
forall (m :: * -> *) a. Monad m => a -> m a
return (Hour -> m Hour) -> Hour -> m Hour
forall a b. (a -> b) -> a -> b
$ Int -> Hour
Hour Int
i
| Bool
otherwise = RssException -> m Hour
forall (m :: * -> *) e a. (MonadThrow m, Exception e) => e -> m a
throwM (RssException -> m Hour) -> RssException -> m Hour
forall a b. (a -> b) -> a -> b
$ Int -> RssException
InvalidHour Int
i
data Day = Monday | Tuesday | Wednesday | Thursday | Friday | Saturday | Sunday
deriving(Day
Day -> Day -> Bounded Day
forall a. a -> a -> Bounded a
maxBound :: Day
$cmaxBound :: Day
minBound :: Day
$cminBound :: Day
Bounded, Int -> Day
Day -> Int
Day -> [Day]
Day -> Day
Day -> Day -> [Day]
Day -> Day -> Day -> [Day]
(Day -> Day)
-> (Day -> Day)
-> (Int -> Day)
-> (Day -> Int)
-> (Day -> [Day])
-> (Day -> Day -> [Day])
-> (Day -> Day -> [Day])
-> (Day -> Day -> Day -> [Day])
-> Enum Day
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
enumFromThenTo :: Day -> Day -> Day -> [Day]
$cenumFromThenTo :: Day -> Day -> Day -> [Day]
enumFromTo :: Day -> Day -> [Day]
$cenumFromTo :: Day -> Day -> [Day]
enumFromThen :: Day -> Day -> [Day]
$cenumFromThen :: Day -> Day -> [Day]
enumFrom :: Day -> [Day]
$cenumFrom :: Day -> [Day]
fromEnum :: Day -> Int
$cfromEnum :: Day -> Int
toEnum :: Int -> Day
$ctoEnum :: Int -> Day
pred :: Day -> Day
$cpred :: Day -> Day
succ :: Day -> Day
$csucc :: Day -> Day
Enum, Day -> Day -> Bool
(Day -> Day -> Bool) -> (Day -> Day -> Bool) -> Eq Day
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Day -> Day -> Bool
$c/= :: Day -> Day -> Bool
== :: Day -> Day -> Bool
$c== :: Day -> Day -> Bool
Eq, (forall x. Day -> Rep Day x)
-> (forall x. Rep Day x -> Day) -> Generic Day
forall x. Rep Day x -> Day
forall x. Day -> Rep Day x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Day x -> Day
$cfrom :: forall x. Day -> Rep Day x
Generic, Eq Day
Eq Day
-> (Day -> Day -> Ordering)
-> (Day -> Day -> Bool)
-> (Day -> Day -> Bool)
-> (Day -> Day -> Bool)
-> (Day -> Day -> Bool)
-> (Day -> Day -> Day)
-> (Day -> Day -> Day)
-> Ord Day
Day -> Day -> Bool
Day -> Day -> Ordering
Day -> Day -> Day
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 :: Day -> Day -> Day
$cmin :: Day -> Day -> Day
max :: Day -> Day -> Day
$cmax :: Day -> Day -> Day
>= :: Day -> Day -> Bool
$c>= :: Day -> Day -> Bool
> :: Day -> Day -> Bool
$c> :: Day -> Day -> Bool
<= :: Day -> Day -> Bool
$c<= :: Day -> Day -> Bool
< :: Day -> Day -> Bool
$c< :: Day -> Day -> Bool
compare :: Day -> Day -> Ordering
$ccompare :: Day -> Day -> Ordering
$cp1Ord :: Eq Day
Ord, ReadPrec [Day]
ReadPrec Day
Int -> ReadS Day
ReadS [Day]
(Int -> ReadS Day)
-> ReadS [Day] -> ReadPrec Day -> ReadPrec [Day] -> Read Day
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Day]
$creadListPrec :: ReadPrec [Day]
readPrec :: ReadPrec Day
$creadPrec :: ReadPrec Day
readList :: ReadS [Day]
$creadList :: ReadS [Day]
readsPrec :: Int -> ReadS Day
$creadsPrec :: Int -> ReadS Day
Read, Int -> Day -> ShowS
[Day] -> ShowS
Day -> String
(Int -> Day -> ShowS)
-> (Day -> String) -> ([Day] -> ShowS) -> Show Day
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Day] -> ShowS
$cshowList :: [Day] -> ShowS
show :: Day -> String
$cshow :: Day -> String
showsPrec :: Int -> Day -> ShowS
$cshowsPrec :: Int -> Day -> ShowS
Show)
asDay :: MonadThrow m => Text -> m Day
asDay :: Text -> m Day
asDay Text
t = m Day -> (Day -> m Day) -> Maybe Day -> m Day
forall b a. b -> (a -> b) -> Maybe a -> b
maybe (RssException -> m Day
forall (m :: * -> *) e a. (MonadThrow m, Exception e) => e -> m a
throwM (RssException -> m Day) -> RssException -> m Day
forall a b. (a -> b) -> a -> b
$ Text -> RssException
InvalidDay Text
t) Day -> m Day
forall (m :: * -> *) a. Monad m => a -> m a
return (Maybe Day -> m Day) -> (String -> Maybe Day) -> String -> m Day
forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> Maybe Day
forall a. Read a => String -> Maybe a
readMaybe (String -> m Day) -> String -> m Day
forall a b. (a -> b) -> a -> b
$ Text -> String
unpack Text
t
data extensions =
{ RssDocument extensions -> Version
documentVersion :: Version
, RssDocument extensions -> Text
channelTitle :: Text
, RssDocument extensions -> RssURI
channelLink :: RssURI
, RssDocument extensions -> Text
channelDescription :: Text
, RssDocument extensions -> [RssItem extensions]
channelItems :: [RssItem extensions]
, RssDocument extensions -> Text
channelLanguage :: Text
, RssDocument extensions -> Text
channelCopyright :: Text
, RssDocument extensions -> Text
channelManagingEditor :: Text
, RssDocument extensions -> Text
channelWebmaster :: Text
, RssDocument extensions -> Maybe UTCTime
channelPubDate :: Maybe UTCTime
, RssDocument extensions -> Maybe UTCTime
channelLastBuildDate :: Maybe UTCTime
, RssDocument extensions -> [RssCategory]
channelCategories :: [RssCategory]
, RssDocument extensions -> Text
channelGenerator :: Text
, RssDocument extensions -> Maybe RssURI
channelDocs :: Maybe RssURI
, RssDocument extensions -> Maybe RssCloud
channelCloud :: Maybe RssCloud
, RssDocument extensions -> Maybe Int
channelTtl :: Maybe Int
, RssDocument extensions -> Maybe RssImage
channelImage :: Maybe RssImage
, RssDocument extensions -> Text
channelRating :: Text
, RssDocument extensions -> Maybe RssTextInput
channelTextInput :: Maybe RssTextInput
, RssDocument extensions -> Set Hour
channelSkipHours :: Set Hour
, RssDocument extensions -> Set Day
channelSkipDays :: Set Day
, RssDocument extensions -> RssChannelExtension extensions
channelExtensions :: RssChannelExtension extensions
}
deriving instance (Eq (RssChannelExtension e), Eq (RssItemExtension e)) => Eq (RssDocument e)
deriving instance (Generic (RssChannelExtension e), Generic (RssItemExtension e)) => Generic (RssDocument e)
deriving instance (Ord (RssChannelExtension e), Ord (RssItemExtension e)) => Ord (RssDocument e)
deriving instance (Show (RssChannelExtension e), Show (RssItemExtension e)) => Show (RssDocument e)
type = RssDocument NoExtensions
data family extensionTag :: *
data family extensionTag :: *
data NoExtensions = NoExtensions
deriving(NoExtensions -> NoExtensions -> Bool
(NoExtensions -> NoExtensions -> Bool)
-> (NoExtensions -> NoExtensions -> Bool) -> Eq NoExtensions
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: NoExtensions -> NoExtensions -> Bool
$c/= :: NoExtensions -> NoExtensions -> Bool
== :: NoExtensions -> NoExtensions -> Bool
$c== :: NoExtensions -> NoExtensions -> Bool
Eq, (forall x. NoExtensions -> Rep NoExtensions x)
-> (forall x. Rep NoExtensions x -> NoExtensions)
-> Generic NoExtensions
forall x. Rep NoExtensions x -> NoExtensions
forall x. NoExtensions -> Rep NoExtensions x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep NoExtensions x -> NoExtensions
$cfrom :: forall x. NoExtensions -> Rep NoExtensions x
Generic, Eq NoExtensions
Eq NoExtensions
-> (NoExtensions -> NoExtensions -> Ordering)
-> (NoExtensions -> NoExtensions -> Bool)
-> (NoExtensions -> NoExtensions -> Bool)
-> (NoExtensions -> NoExtensions -> Bool)
-> (NoExtensions -> NoExtensions -> Bool)
-> (NoExtensions -> NoExtensions -> NoExtensions)
-> (NoExtensions -> NoExtensions -> NoExtensions)
-> Ord NoExtensions
NoExtensions -> NoExtensions -> Bool
NoExtensions -> NoExtensions -> Ordering
NoExtensions -> NoExtensions -> NoExtensions
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 :: NoExtensions -> NoExtensions -> NoExtensions
$cmin :: NoExtensions -> NoExtensions -> NoExtensions
max :: NoExtensions -> NoExtensions -> NoExtensions
$cmax :: NoExtensions -> NoExtensions -> NoExtensions
>= :: NoExtensions -> NoExtensions -> Bool
$c>= :: NoExtensions -> NoExtensions -> Bool
> :: NoExtensions -> NoExtensions -> Bool
$c> :: NoExtensions -> NoExtensions -> Bool
<= :: NoExtensions -> NoExtensions -> Bool
$c<= :: NoExtensions -> NoExtensions -> Bool
< :: NoExtensions -> NoExtensions -> Bool
$c< :: NoExtensions -> NoExtensions -> Bool
compare :: NoExtensions -> NoExtensions -> Ordering
$ccompare :: NoExtensions -> NoExtensions -> Ordering
$cp1Ord :: Eq NoExtensions
Ord, ReadPrec [NoExtensions]
ReadPrec NoExtensions
Int -> ReadS NoExtensions
ReadS [NoExtensions]
(Int -> ReadS NoExtensions)
-> ReadS [NoExtensions]
-> ReadPrec NoExtensions
-> ReadPrec [NoExtensions]
-> Read NoExtensions
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [NoExtensions]
$creadListPrec :: ReadPrec [NoExtensions]
readPrec :: ReadPrec NoExtensions
$creadPrec :: ReadPrec NoExtensions
readList :: ReadS [NoExtensions]
$creadList :: ReadS [NoExtensions]
readsPrec :: Int -> ReadS NoExtensions
$creadsPrec :: Int -> ReadS NoExtensions
Read, Int -> NoExtensions -> ShowS
[NoExtensions] -> ShowS
NoExtensions -> String
(Int -> NoExtensions -> ShowS)
-> (NoExtensions -> String)
-> ([NoExtensions] -> ShowS)
-> Show NoExtensions
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [NoExtensions] -> ShowS
$cshowList :: [NoExtensions] -> ShowS
show :: NoExtensions -> String
$cshow :: NoExtensions -> String
showsPrec :: Int -> NoExtensions -> ShowS
$cshowsPrec :: Int -> NoExtensions -> ShowS
Show)
data instance NoExtensions = NoChannelExtensions
deriving(RssChannelExtension NoExtensions
-> RssChannelExtension NoExtensions -> Bool
(RssChannelExtension NoExtensions
-> RssChannelExtension NoExtensions -> Bool)
-> (RssChannelExtension NoExtensions
-> RssChannelExtension NoExtensions -> Bool)
-> Eq (RssChannelExtension NoExtensions)
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RssChannelExtension NoExtensions
-> RssChannelExtension NoExtensions -> Bool
$c/= :: RssChannelExtension NoExtensions
-> RssChannelExtension NoExtensions -> Bool
== :: RssChannelExtension NoExtensions
-> RssChannelExtension NoExtensions -> Bool
$c== :: RssChannelExtension NoExtensions
-> RssChannelExtension NoExtensions -> Bool
Eq, (forall x.
RssChannelExtension NoExtensions
-> Rep (RssChannelExtension NoExtensions) x)
-> (forall x.
Rep (RssChannelExtension NoExtensions) x
-> RssChannelExtension NoExtensions)
-> Generic (RssChannelExtension NoExtensions)
forall x.
Rep (RssChannelExtension NoExtensions) x
-> RssChannelExtension NoExtensions
forall x.
RssChannelExtension NoExtensions
-> Rep (RssChannelExtension NoExtensions) x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep (RssChannelExtension NoExtensions) x
-> RssChannelExtension NoExtensions
$cfrom :: forall x.
RssChannelExtension NoExtensions
-> Rep (RssChannelExtension NoExtensions) x
Generic, Eq (RssChannelExtension NoExtensions)
Eq (RssChannelExtension NoExtensions)
-> (RssChannelExtension NoExtensions
-> RssChannelExtension NoExtensions -> Ordering)
-> (RssChannelExtension NoExtensions
-> RssChannelExtension NoExtensions -> Bool)
-> (RssChannelExtension NoExtensions
-> RssChannelExtension NoExtensions -> Bool)
-> (RssChannelExtension NoExtensions
-> RssChannelExtension NoExtensions -> Bool)
-> (RssChannelExtension NoExtensions
-> RssChannelExtension NoExtensions -> Bool)
-> (RssChannelExtension NoExtensions
-> RssChannelExtension NoExtensions
-> RssChannelExtension NoExtensions)
-> (RssChannelExtension NoExtensions
-> RssChannelExtension NoExtensions
-> RssChannelExtension NoExtensions)
-> Ord (RssChannelExtension NoExtensions)
RssChannelExtension NoExtensions
-> RssChannelExtension NoExtensions -> Bool
RssChannelExtension NoExtensions
-> RssChannelExtension NoExtensions -> Ordering
RssChannelExtension NoExtensions
-> RssChannelExtension NoExtensions
-> RssChannelExtension NoExtensions
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 :: RssChannelExtension NoExtensions
-> RssChannelExtension NoExtensions
-> RssChannelExtension NoExtensions
$cmin :: RssChannelExtension NoExtensions
-> RssChannelExtension NoExtensions
-> RssChannelExtension NoExtensions
max :: RssChannelExtension NoExtensions
-> RssChannelExtension NoExtensions
-> RssChannelExtension NoExtensions
$cmax :: RssChannelExtension NoExtensions
-> RssChannelExtension NoExtensions
-> RssChannelExtension NoExtensions
>= :: RssChannelExtension NoExtensions
-> RssChannelExtension NoExtensions -> Bool
$c>= :: RssChannelExtension NoExtensions
-> RssChannelExtension NoExtensions -> Bool
> :: RssChannelExtension NoExtensions
-> RssChannelExtension NoExtensions -> Bool
$c> :: RssChannelExtension NoExtensions
-> RssChannelExtension NoExtensions -> Bool
<= :: RssChannelExtension NoExtensions
-> RssChannelExtension NoExtensions -> Bool
$c<= :: RssChannelExtension NoExtensions
-> RssChannelExtension NoExtensions -> Bool
< :: RssChannelExtension NoExtensions
-> RssChannelExtension NoExtensions -> Bool
$c< :: RssChannelExtension NoExtensions
-> RssChannelExtension NoExtensions -> Bool
compare :: RssChannelExtension NoExtensions
-> RssChannelExtension NoExtensions -> Ordering
$ccompare :: RssChannelExtension NoExtensions
-> RssChannelExtension NoExtensions -> Ordering
$cp1Ord :: Eq (RssChannelExtension NoExtensions)
Ord, ReadPrec [RssChannelExtension NoExtensions]
ReadPrec (RssChannelExtension NoExtensions)
Int -> ReadS (RssChannelExtension NoExtensions)
ReadS [RssChannelExtension NoExtensions]
(Int -> ReadS (RssChannelExtension NoExtensions))
-> ReadS [RssChannelExtension NoExtensions]
-> ReadPrec (RssChannelExtension NoExtensions)
-> ReadPrec [RssChannelExtension NoExtensions]
-> Read (RssChannelExtension NoExtensions)
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RssChannelExtension NoExtensions]
$creadListPrec :: ReadPrec [RssChannelExtension NoExtensions]
readPrec :: ReadPrec (RssChannelExtension NoExtensions)
$creadPrec :: ReadPrec (RssChannelExtension NoExtensions)
readList :: ReadS [RssChannelExtension NoExtensions]
$creadList :: ReadS [RssChannelExtension NoExtensions]
readsPrec :: Int -> ReadS (RssChannelExtension NoExtensions)
$creadsPrec :: Int -> ReadS (RssChannelExtension NoExtensions)
Read, Int -> RssChannelExtension NoExtensions -> ShowS
[RssChannelExtension NoExtensions] -> ShowS
RssChannelExtension NoExtensions -> String
(Int -> RssChannelExtension NoExtensions -> ShowS)
-> (RssChannelExtension NoExtensions -> String)
-> ([RssChannelExtension NoExtensions] -> ShowS)
-> Show (RssChannelExtension NoExtensions)
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RssChannelExtension NoExtensions] -> ShowS
$cshowList :: [RssChannelExtension NoExtensions] -> ShowS
show :: RssChannelExtension NoExtensions -> String
$cshow :: RssChannelExtension NoExtensions -> String
showsPrec :: Int -> RssChannelExtension NoExtensions -> ShowS
$cshowsPrec :: Int -> RssChannelExtension NoExtensions -> ShowS
Show)
data instance NoExtensions = NoItemExtensions
deriving(RssItemExtension NoExtensions
-> RssItemExtension NoExtensions -> Bool
(RssItemExtension NoExtensions
-> RssItemExtension NoExtensions -> Bool)
-> (RssItemExtension NoExtensions
-> RssItemExtension NoExtensions -> Bool)
-> Eq (RssItemExtension NoExtensions)
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RssItemExtension NoExtensions
-> RssItemExtension NoExtensions -> Bool
$c/= :: RssItemExtension NoExtensions
-> RssItemExtension NoExtensions -> Bool
== :: RssItemExtension NoExtensions
-> RssItemExtension NoExtensions -> Bool
$c== :: RssItemExtension NoExtensions
-> RssItemExtension NoExtensions -> Bool
Eq, (forall x.
RssItemExtension NoExtensions
-> Rep (RssItemExtension NoExtensions) x)
-> (forall x.
Rep (RssItemExtension NoExtensions) x
-> RssItemExtension NoExtensions)
-> Generic (RssItemExtension NoExtensions)
forall x.
Rep (RssItemExtension NoExtensions) x
-> RssItemExtension NoExtensions
forall x.
RssItemExtension NoExtensions
-> Rep (RssItemExtension NoExtensions) x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep (RssItemExtension NoExtensions) x
-> RssItemExtension NoExtensions
$cfrom :: forall x.
RssItemExtension NoExtensions
-> Rep (RssItemExtension NoExtensions) x
Generic, Eq (RssItemExtension NoExtensions)
Eq (RssItemExtension NoExtensions)
-> (RssItemExtension NoExtensions
-> RssItemExtension NoExtensions -> Ordering)
-> (RssItemExtension NoExtensions
-> RssItemExtension NoExtensions -> Bool)
-> (RssItemExtension NoExtensions
-> RssItemExtension NoExtensions -> Bool)
-> (RssItemExtension NoExtensions
-> RssItemExtension NoExtensions -> Bool)
-> (RssItemExtension NoExtensions
-> RssItemExtension NoExtensions -> Bool)
-> (RssItemExtension NoExtensions
-> RssItemExtension NoExtensions -> RssItemExtension NoExtensions)
-> (RssItemExtension NoExtensions
-> RssItemExtension NoExtensions -> RssItemExtension NoExtensions)
-> Ord (RssItemExtension NoExtensions)
RssItemExtension NoExtensions
-> RssItemExtension NoExtensions -> Bool
RssItemExtension NoExtensions
-> RssItemExtension NoExtensions -> Ordering
RssItemExtension NoExtensions
-> RssItemExtension NoExtensions -> RssItemExtension NoExtensions
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 :: RssItemExtension NoExtensions
-> RssItemExtension NoExtensions -> RssItemExtension NoExtensions
$cmin :: RssItemExtension NoExtensions
-> RssItemExtension NoExtensions -> RssItemExtension NoExtensions
max :: RssItemExtension NoExtensions
-> RssItemExtension NoExtensions -> RssItemExtension NoExtensions
$cmax :: RssItemExtension NoExtensions
-> RssItemExtension NoExtensions -> RssItemExtension NoExtensions
>= :: RssItemExtension NoExtensions
-> RssItemExtension NoExtensions -> Bool
$c>= :: RssItemExtension NoExtensions
-> RssItemExtension NoExtensions -> Bool
> :: RssItemExtension NoExtensions
-> RssItemExtension NoExtensions -> Bool
$c> :: RssItemExtension NoExtensions
-> RssItemExtension NoExtensions -> Bool
<= :: RssItemExtension NoExtensions
-> RssItemExtension NoExtensions -> Bool
$c<= :: RssItemExtension NoExtensions
-> RssItemExtension NoExtensions -> Bool
< :: RssItemExtension NoExtensions
-> RssItemExtension NoExtensions -> Bool
$c< :: RssItemExtension NoExtensions
-> RssItemExtension NoExtensions -> Bool
compare :: RssItemExtension NoExtensions
-> RssItemExtension NoExtensions -> Ordering
$ccompare :: RssItemExtension NoExtensions
-> RssItemExtension NoExtensions -> Ordering
$cp1Ord :: Eq (RssItemExtension NoExtensions)
Ord, ReadPrec [RssItemExtension NoExtensions]
ReadPrec (RssItemExtension NoExtensions)
Int -> ReadS (RssItemExtension NoExtensions)
ReadS [RssItemExtension NoExtensions]
(Int -> ReadS (RssItemExtension NoExtensions))
-> ReadS [RssItemExtension NoExtensions]
-> ReadPrec (RssItemExtension NoExtensions)
-> ReadPrec [RssItemExtension NoExtensions]
-> Read (RssItemExtension NoExtensions)
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RssItemExtension NoExtensions]
$creadListPrec :: ReadPrec [RssItemExtension NoExtensions]
readPrec :: ReadPrec (RssItemExtension NoExtensions)
$creadPrec :: ReadPrec (RssItemExtension NoExtensions)
readList :: ReadS [RssItemExtension NoExtensions]
$creadList :: ReadS [RssItemExtension NoExtensions]
readsPrec :: Int -> ReadS (RssItemExtension NoExtensions)
$creadsPrec :: Int -> ReadS (RssItemExtension NoExtensions)
Read, Int -> RssItemExtension NoExtensions -> ShowS
[RssItemExtension NoExtensions] -> ShowS
RssItemExtension NoExtensions -> String
(Int -> RssItemExtension NoExtensions -> ShowS)
-> (RssItemExtension NoExtensions -> String)
-> ([RssItemExtension NoExtensions] -> ShowS)
-> Show (RssItemExtension NoExtensions)
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RssItemExtension NoExtensions] -> ShowS
$cshowList :: [RssItemExtension NoExtensions] -> ShowS
show :: RssItemExtension NoExtensions -> String
$cshow :: RssItemExtension NoExtensions -> String
showsPrec :: Int -> RssItemExtension NoExtensions -> ShowS
$cshowsPrec :: Int -> RssItemExtension NoExtensions -> ShowS
Show)