rss-conduit-0.4.1.0: Streaming parser/renderer for the RSS standard.

Safe HaskellNone
LanguageHaskell2010

Text.RSS.Types

Contents

Description

RSS is an XML dialect for Web content syndication.

Example:

<?xml version="1.0"?>
<rss version="2.0">
   <channel>
      <title>Liftoff News</title>
      <link>http://liftoff.msfc.nasa.gov/</link>
      <description>Liftoff to Space Exploration.</description>
      <language>en-us</language>
      <pubDate>Tue, 10 Jun 2003 04:00:00 GMT</pubDate>
      <lastBuildDate>Tue, 10 Jun 2003 09:41:01 GMT</lastBuildDate>
      <docs>http://blogs.law.harvard.edu/tech/rss</docs>
      <generator>Weblog Editor 2.0</generator>
      <managingEditor>editor@example.com</managingEditor>
      <webMaster>webmaster@example.com</webMaster>
      <item>
         <title>Star City</title>
         <link>http://liftoff.msfc.nasa.gov/news/2003/news-starcity.asp</link>
         <description>How do Americans get ready to work with Russians aboard the International Space Station? They take a crash course in culture, language and protocol at Russia's &lt;a href="http://howe.iki.rssi.ru/GCTC/gctc_e.htm"&gt;Star City&lt;/a&gt;.</description>
         <pubDate>Tue, 03 Jun 2003 09:39:21 GMT</pubDate>
         <guid>http://liftoff.msfc.nasa.gov/2003/06/03.html#item573</guid>
      </item>
   </channel>
</rss>

Synopsis

RSS core

data RssException Source #

Instances

Eq RssException Source # 
Show RssException Source # 
Generic RssException Source # 

Associated Types

type Rep RssException :: * -> * #

Exception RssException Source # 
type Rep RssException Source # 

data RssURI Source #

Constructors

RssURI (URIRef a) 

withRssURI :: (forall a. URIRef a -> b) -> RssURI -> b Source #

data RssEnclosure Source #

The <enclosure> element.

data RssSource Source #

The <source> element.

Constructors

RssSource 

data RssGuid Source #

The <guid> element.

Constructors

GuidText Text 
GuidUri RssURI 

data RssItem extensions Source #

The <item> element.

This type is open to extensions.

Instances

Eq (RssItemExtensions e) => Eq (RssItem e) Source # 

Methods

(==) :: RssItem e -> RssItem e -> Bool #

(/=) :: RssItem e -> RssItem e -> Bool #

Ord (RssItemExtensions e) => Ord (RssItem e) Source # 

Methods

compare :: RssItem e -> RssItem e -> Ordering #

(<) :: RssItem e -> RssItem e -> Bool #

(<=) :: RssItem e -> RssItem e -> Bool #

(>) :: RssItem e -> RssItem e -> Bool #

(>=) :: RssItem e -> RssItem e -> Bool #

max :: RssItem e -> RssItem e -> RssItem e #

min :: RssItem e -> RssItem e -> RssItem e #

Show (RssItemExtensions e) => Show (RssItem e) Source # 

Methods

showsPrec :: Int -> RssItem e -> ShowS #

show :: RssItem e -> String #

showList :: [RssItem e] -> ShowS #

Generic (RssItemExtensions e) => Generic (RssItem e) Source # 

Associated Types

type Rep (RssItem e) :: * -> * #

Methods

from :: RssItem e -> Rep (RssItem e) x #

to :: Rep (RssItem e) x -> RssItem e #

type Rep (RssItem e) Source # 
type Rep (RssItem e) = D1 (MetaData "RssItem" "Text.RSS.Types" "rss-conduit-0.4.1.0-Ar4KHmamFtvHzX77HbQzIf" False) (C1 (MetaCons "RssItem" PrefixI True) ((:*:) ((:*:) ((:*:) (S1 (MetaSel (Just Symbol "itemTitle") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Text)) (S1 (MetaSel (Just Symbol "itemLink") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Maybe RssURI)))) ((:*:) (S1 (MetaSel (Just Symbol "itemDescription") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Text)) ((:*:) (S1 (MetaSel (Just Symbol "itemAuthor") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Text)) (S1 (MetaSel (Just Symbol "itemCategories") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 [RssCategory]))))) ((:*:) ((:*:) (S1 (MetaSel (Just Symbol "itemComments") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Maybe RssURI))) ((:*:) (S1 (MetaSel (Just Symbol "itemEnclosure") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 [RssEnclosure])) (S1 (MetaSel (Just Symbol "itemGuid") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Maybe RssGuid))))) ((:*:) (S1 (MetaSel (Just Symbol "itemPubDate") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Maybe UTCTime))) ((:*:) (S1 (MetaSel (Just Symbol "itemSource") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Maybe RssSource))) (S1 (MetaSel (Just Symbol "itemExtensions") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (RssItemExtensions e))))))))

type RssItem' = RssItem '[] Source #

Alias for RssItem with no RSS extensions.

data RssTextInput Source #

The <textInput> element.

Instances

data RssImage Source #

The <image> element.

Instances

Eq RssImage Source # 
Ord RssImage Source # 
Show RssImage Source # 
Generic RssImage Source # 

Associated Types

type Rep RssImage :: * -> * #

Methods

from :: RssImage -> Rep RssImage x #

to :: Rep RssImage x -> RssImage #

type Rep RssImage Source # 

newtype Hour Source #

Constructors

Hour Int 

Instances

Bounded Hour Source # 
Enum Hour Source # 

Methods

succ :: Hour -> Hour #

pred :: Hour -> Hour #

toEnum :: Int -> Hour #

fromEnum :: Hour -> Int #

enumFrom :: Hour -> [Hour] #

enumFromThen :: Hour -> Hour -> [Hour] #

enumFromTo :: Hour -> Hour -> [Hour] #

enumFromThenTo :: Hour -> Hour -> Hour -> [Hour] #

Eq Hour Source # 

Methods

(==) :: Hour -> Hour -> Bool #

(/=) :: Hour -> Hour -> Bool #

Ord Hour Source # 

Methods

compare :: Hour -> Hour -> Ordering #

(<) :: Hour -> Hour -> Bool #

(<=) :: Hour -> Hour -> Bool #

(>) :: Hour -> Hour -> Bool #

(>=) :: Hour -> Hour -> Bool #

max :: Hour -> Hour -> Hour #

min :: Hour -> Hour -> Hour #

Read Hour Source # 
Show Hour Source # 

Methods

showsPrec :: Int -> Hour -> ShowS #

show :: Hour -> String #

showList :: [Hour] -> ShowS #

Generic Hour Source # 

Associated Types

type Rep Hour :: * -> * #

Methods

from :: Hour -> Rep Hour x #

to :: Rep Hour x -> Hour #

type Rep Hour Source # 
type Rep Hour = D1 (MetaData "Hour" "Text.RSS.Types" "rss-conduit-0.4.1.0-Ar4KHmamFtvHzX77HbQzIf" True) (C1 (MetaCons "Hour" PrefixI False) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Int)))

asHour :: MonadThrow m => Int -> m Hour Source #

Smart constructor for Hour

data Day Source #

Instances

Bounded Day Source # 

Methods

minBound :: Day #

maxBound :: Day #

Enum Day Source # 

Methods

succ :: Day -> Day #

pred :: Day -> Day #

toEnum :: Int -> Day #

fromEnum :: Day -> Int #

enumFrom :: Day -> [Day] #

enumFromThen :: Day -> Day -> [Day] #

enumFromTo :: Day -> Day -> [Day] #

enumFromThenTo :: Day -> Day -> Day -> [Day] #

Eq Day Source # 

Methods

(==) :: Day -> Day -> Bool #

(/=) :: Day -> Day -> Bool #

Ord Day Source # 

Methods

compare :: Day -> Day -> Ordering #

(<) :: Day -> Day -> Bool #

(<=) :: Day -> Day -> Bool #

(>) :: Day -> Day -> Bool #

(>=) :: Day -> Day -> Bool #

max :: Day -> Day -> Day #

min :: Day -> Day -> Day #

Read Day Source # 
Show Day Source # 

Methods

showsPrec :: Int -> Day -> ShowS #

show :: Day -> String #

showList :: [Day] -> ShowS #

Generic Day Source # 

Associated Types

type Rep Day :: * -> * #

Methods

from :: Day -> Rep Day x #

to :: Rep Day x -> Day #

type Rep Day Source # 
type Rep Day = D1 (MetaData "Day" "Text.RSS.Types" "rss-conduit-0.4.1.0-Ar4KHmamFtvHzX77HbQzIf" False) ((:+:) ((:+:) (C1 (MetaCons "Monday" PrefixI False) U1) ((:+:) (C1 (MetaCons "Tuesday" PrefixI False) U1) (C1 (MetaCons "Wednesday" PrefixI False) U1))) ((:+:) ((:+:) (C1 (MetaCons "Thursday" PrefixI False) U1) (C1 (MetaCons "Friday" PrefixI False) U1)) ((:+:) (C1 (MetaCons "Saturday" PrefixI False) U1) (C1 (MetaCons "Sunday" PrefixI False) U1))))

asDay :: MonadThrow m => Text -> m Day Source #

Basic parser for Day.

data RssDocument extensions Source #

The <rss> element.

This type is open to extensions.

Instances

(Eq (RssChannelExtensions e), Eq (RssItemExtensions e)) => Eq (RssDocument e) Source # 
(Ord (RssChannelExtensions e), Ord (RssItemExtensions e)) => Ord (RssDocument e) Source # 
(Show (RssChannelExtensions e), Show (RssItemExtensions e)) => Show (RssDocument e) Source # 
(Generic (RssChannelExtensions e), Generic (RssItemExtensions e)) => Generic (RssDocument e) Source # 

Associated Types

type Rep (RssDocument e) :: * -> * #

Methods

from :: RssDocument e -> Rep (RssDocument e) x #

to :: Rep (RssDocument e) x -> RssDocument e #

type Rep (RssDocument e) Source # 
type Rep (RssDocument e) = D1 (MetaData "RssDocument" "Text.RSS.Types" "rss-conduit-0.4.1.0-Ar4KHmamFtvHzX77HbQzIf" False) (C1 (MetaCons "RssDocument" PrefixI True) ((:*:) ((:*:) ((:*:) ((:*:) (S1 (MetaSel (Just Symbol "documentVersion") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Version)) (S1 (MetaSel (Just Symbol "channelTitle") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Text))) ((:*:) (S1 (MetaSel (Just Symbol "channelLink") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 RssURI)) ((:*:) (S1 (MetaSel (Just Symbol "channelDescription") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Text)) (S1 (MetaSel (Just Symbol "channelItems") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 [RssItem e]))))) ((:*:) ((:*:) (S1 (MetaSel (Just Symbol "channelLanguage") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Text)) ((:*:) (S1 (MetaSel (Just Symbol "channelCopyright") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Text)) (S1 (MetaSel (Just Symbol "channelManagingEditor") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Text)))) ((:*:) (S1 (MetaSel (Just Symbol "channelWebmaster") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Text)) ((:*:) (S1 (MetaSel (Just Symbol "channelPubDate") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Maybe UTCTime))) (S1 (MetaSel (Just Symbol "channelLastBuildDate") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Maybe UTCTime))))))) ((:*:) ((:*:) ((:*:) (S1 (MetaSel (Just Symbol "channelCategories") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 [RssCategory])) (S1 (MetaSel (Just Symbol "channelGenerator") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Text))) ((:*:) (S1 (MetaSel (Just Symbol "channelDocs") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Maybe RssURI))) ((:*:) (S1 (MetaSel (Just Symbol "channelCloud") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Maybe RssCloud))) (S1 (MetaSel (Just Symbol "channelTtl") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Maybe Int)))))) ((:*:) ((:*:) (S1 (MetaSel (Just Symbol "channelImage") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Maybe RssImage))) ((:*:) (S1 (MetaSel (Just Symbol "channelRating") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Text)) (S1 (MetaSel (Just Symbol "channelTextInput") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Maybe RssTextInput))))) ((:*:) (S1 (MetaSel (Just Symbol "channelSkipHours") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Set Hour))) ((:*:) (S1 (MetaSel (Just Symbol "channelSkipDays") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Set Day))) (S1 (MetaSel (Just Symbol "channelExtensions") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (RssChannelExtensions e)))))))))

type RssDocument' = RssDocument '[] Source #

Alias for RssDocument with no RSS extensions.

RSS extensions

To implement an RSS extension:

  • Create a void data-type, that will be used as a tag to identify the extension:
data MyExtension :: *
  • Implement extension types for <channel> and <item> elements:
data instance RssChannelExtension MyExtension = MyExtensionChannel { {- ... fields -} }
data instance RssItemExtension MyExtension = MyExtensionItem { {- ... fields -} }

data family RssChannelExtension extensionTag :: * Source #

<channel> extension type.

Instances

Eq (RssChannelExtension AtomModule) # 
Eq (RssChannelExtension ContentModule) # 
Eq (RssChannelExtension DublinCoreModule) # 
Eq (RssChannelExtension SyndicationModule) # 
Ord (RssChannelExtension ContentModule) # 
Ord (RssChannelExtension DublinCoreModule) # 
Ord (RssChannelExtension SyndicationModule) # 
Show (RssChannelExtension AtomModule) # 
Show (RssChannelExtension ContentModule) # 
Show (RssChannelExtension DublinCoreModule) # 
Show (RssChannelExtension SyndicationModule) # 
Generic (RssChannelExtension AtomModule) # 
Generic (RssChannelExtension ContentModule) # 
Generic (RssChannelExtension DublinCoreModule) # 
Generic (RssChannelExtension SyndicationModule) # 
data RssChannelExtension AtomModule Source # 
data RssChannelExtension ContentModule Source # 
data RssChannelExtension DublinCoreModule Source # 
data RssChannelExtension SyndicationModule Source # 
type Rep (RssChannelExtension AtomModule) # 
type Rep (RssChannelExtension AtomModule) = D1 (MetaData "RssChannelExtension" "Text.RSS.Extensions.Atom" "rss-conduit-0.4.1.0-Ar4KHmamFtvHzX77HbQzIf" False) (C1 (MetaCons "AtomChannel" PrefixI True) (S1 (MetaSel (Just Symbol "channelAtomLink") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Maybe AtomLink))))
type Rep (RssChannelExtension ContentModule) # 
type Rep (RssChannelExtension ContentModule) = D1 (MetaData "RssChannelExtension" "Text.RSS.Extensions.Content" "rss-conduit-0.4.1.0-Ar4KHmamFtvHzX77HbQzIf" False) (C1 (MetaCons "ContentChannel" PrefixI False) U1)
type Rep (RssChannelExtension DublinCoreModule) # 
type Rep (RssChannelExtension DublinCoreModule) = D1 (MetaData "RssChannelExtension" "Text.RSS.Extensions.DublinCore" "rss-conduit-0.4.1.0-Ar4KHmamFtvHzX77HbQzIf" False) (C1 (MetaCons "DublinCoreChannel" PrefixI True) (S1 (MetaSel (Just Symbol "channelDcMetaData") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 DcMetaData)))
type Rep (RssChannelExtension SyndicationModule) # 
type Rep (RssChannelExtension SyndicationModule) = D1 (MetaData "RssChannelExtension" "Text.RSS.Extensions.Syndication" "rss-conduit-0.4.1.0-Ar4KHmamFtvHzX77HbQzIf" False) (C1 (MetaCons "SyndicationChannel" PrefixI True) (S1 (MetaSel (Just Symbol "channelSyndicationInfo") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 SyndicationInfo)))

data family RssItemExtension extensionTag :: * Source #

<item> extension type.

Instances

Eq (RssItemExtension AtomModule) # 
Eq (RssItemExtension ContentModule) # 
Eq (RssItemExtension DublinCoreModule) # 
Eq (RssItemExtension SyndicationModule) # 
Ord (RssItemExtension ContentModule) # 
Ord (RssItemExtension DublinCoreModule) # 
Ord (RssItemExtension SyndicationModule) # 
Show (RssItemExtension AtomModule) # 
Show (RssItemExtension ContentModule) # 
Show (RssItemExtension DublinCoreModule) # 
Show (RssItemExtension SyndicationModule) # 
Generic (RssItemExtension AtomModule) # 
Generic (RssItemExtension ContentModule) # 
Generic (RssItemExtension DublinCoreModule) # 
Generic (RssItemExtension SyndicationModule) # 
data RssItemExtension AtomModule Source # 
data RssItemExtension ContentModule Source # 
data RssItemExtension DublinCoreModule Source # 
data RssItemExtension SyndicationModule Source # 
type Rep (RssItemExtension AtomModule) # 
type Rep (RssItemExtension AtomModule) = D1 (MetaData "RssItemExtension" "Text.RSS.Extensions.Atom" "rss-conduit-0.4.1.0-Ar4KHmamFtvHzX77HbQzIf" False) (C1 (MetaCons "AtomItem" PrefixI True) (S1 (MetaSel (Just Symbol "itemAtomLink") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Maybe AtomLink))))
type Rep (RssItemExtension ContentModule) # 
type Rep (RssItemExtension ContentModule) = D1 (MetaData "RssItemExtension" "Text.RSS.Extensions.Content" "rss-conduit-0.4.1.0-Ar4KHmamFtvHzX77HbQzIf" False) (C1 (MetaCons "ContentItem" PrefixI True) (S1 (MetaSel (Just Symbol "itemContent") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Text)))
type Rep (RssItemExtension DublinCoreModule) # 
type Rep (RssItemExtension DublinCoreModule) = D1 (MetaData "RssItemExtension" "Text.RSS.Extensions.DublinCore" "rss-conduit-0.4.1.0-Ar4KHmamFtvHzX77HbQzIf" False) (C1 (MetaCons "DublinCoreItem" PrefixI True) (S1 (MetaSel (Just Symbol "itemDcMetaData") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 DcMetaData)))
type Rep (RssItemExtension SyndicationModule) # 
type Rep (RssItemExtension SyndicationModule) = D1 (MetaData "RssItemExtension" "Text.RSS.Extensions.Syndication" "rss-conduit-0.4.1.0-Ar4KHmamFtvHzX77HbQzIf" False) (C1 (MetaCons "SyndicationItem" PrefixI False) U1)

data family RssChannelExtensions (extensionTags :: [*]) :: * Source #

Combination of multiple <channel> extensions.

Instances

Eq (Rec * RssChannelExtension a) => Eq (RssChannelExtensions a) Source # 
Ord (Rec * RssChannelExtension a) => Ord (RssChannelExtensions a) Source # 
Show (Rec * RssChannelExtension a) => Show (RssChannelExtensions a) Source # 
Generic (Rec * RssChannelExtension a) => Generic (RssChannelExtensions a) Source # 
data RssChannelExtensions Source # 
type Rep (RssChannelExtensions a) Source # 
type Rep (RssChannelExtensions a) = D1 (MetaData "RssChannelExtensions" "Text.RSS.Types" "rss-conduit-0.4.1.0-Ar4KHmamFtvHzX77HbQzIf" False) (C1 (MetaCons "RssChannelExtensions" PrefixI True) (S1 (MetaSel (Just Symbol "rssChannelExtension") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Rec * RssChannelExtension a))))

data family RssItemExtensions (extensionTags :: [*]) :: * Source #

Combination of multiple <item> extensions.

Instances

Eq (Rec * RssItemExtension a) => Eq (RssItemExtensions a) Source # 
Ord (Rec * RssItemExtension a) => Ord (RssItemExtensions a) Source # 
Show (Rec * RssItemExtension a) => Show (RssItemExtensions a) Source # 
Generic (Rec * RssItemExtension a) => Generic (RssItemExtensions a) Source # 

Associated Types

type Rep (RssItemExtensions a) :: * -> * #

data RssItemExtensions Source # 
type Rep (RssItemExtensions a) Source # 
type Rep (RssItemExtensions a) = D1 (MetaData "RssItemExtensions" "Text.RSS.Types" "rss-conduit-0.4.1.0-Ar4KHmamFtvHzX77HbQzIf" False) (C1 (MetaCons "RssItemExtensions" PrefixI True) (S1 (MetaSel (Just Symbol "rssItemExtension") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Rec * RssItemExtension a))))