    -------------------------------------------------------------------------------
    --
    -- Module        : Yesod.Feed
    -- Copyright     : Patrick Brisbin
    -- License       : as-is
    --
    -- Maintainer    : Patrick Brisbin <me@pbrisbin.com>
    -- Stability     : Stable
    -- Portability   : Portable
    --
    -- Generic Feed and Feed Entry data types that can be used as either an
    -- Rss feed or an Atom feed (or both, or other).
    --
    -- Atom spec: <http://en.wikipedia.org/wiki/Atom_(standard)>
    -- Rss spec:  <http://www.rssboard.org/rss-specification>
    --
    -------------------------------------------------------------------------------
    module Yesod.Feed
        ( newsFeed
        , newsFeedText
        , module Yesod.FeedTypes
        ) where

    import Yesod.FeedTypes
    import Yesod.AtomFeed
    import Yesod.RssFeed
    import Yesod.Core

    import Data.Text

    newsFeed :: MonadHandler m => Feed (Route (HandlerSite m)) -> m TypedContent
    newsFeed :: forall (m :: * -> *).
    MonadHandler m =>
    Feed (Route (HandlerSite m)) -> m TypedContent
    newsFeed Feed (Route (HandlerSite m))
    f = Writer (Endo [ProvidedRep m]) () -> m TypedContent
    forall (m :: * -> *).
    MonadHandler m =>
    Writer (Endo [ProvidedRep m]) () -> m TypedContent
    selectRep (Writer (Endo [ProvidedRep m]) () -> m TypedContent)
    -> Writer (Endo [ProvidedRep m]) () -> m TypedContent
    forall a b. (a -> b) -> a -> b
    $ do
        m RepAtom -> Writer (Endo [ProvidedRep m]) ()
    forall (m :: * -> *) a.
    (Monad m, HasContentType a) =>
    m a -> Writer (Endo [ProvidedRep m]) ()
    provideRep (m RepAtom -> Writer (Endo [ProvidedRep m]) ())
    -> m RepAtom -> Writer (Endo [ProvidedRep m]) ()
    forall a b. (a -> b) -> a -> b
    $ Feed (Route (HandlerSite m)) -> m RepAtom
    forall (m :: * -> *).
    MonadHandler m =>
    Feed (Route (HandlerSite m)) -> m RepAtom
    atomFeed Feed (Route (HandlerSite m))
    f
        m RepRss -> Writer (Endo [ProvidedRep m]) ()
    forall (m :: * -> *) a.
    (Monad m, HasContentType a) =>
    m a -> Writer (Endo [ProvidedRep m]) ()
    provideRep (m RepRss -> Writer (Endo [ProvidedRep m]) ())
    -> m RepRss -> Writer (Endo [ProvidedRep m]) ()
    forall a b. (a -> b) -> a -> b
    $ Feed (Route (HandlerSite m)) -> m RepRss
    forall (m :: * -> *).
    MonadHandler m =>
    Feed (Route (HandlerSite m)) -> m RepRss
    rssFeed Feed (Route (HandlerSite m))
    f

    -- | Same as @'newsFeed'@ but for @'Feed Text'@. Useful for cases where you are
    --   generating a feed of external links.
    newsFeedText :: MonadHandler m => Feed Text -> m TypedContent
    newsFeedText :: forall (m :: * -> *). MonadHandler m => Feed Text -> m TypedContent
    newsFeedText Feed Text
    f = Writer (Endo [ProvidedRep m]) () -> m TypedContent
    forall (m :: * -> *).
    MonadHandler m =>
    Writer (Endo [ProvidedRep m]) () -> m TypedContent
    selectRep (Writer (Endo [ProvidedRep m]) () -> m TypedContent)
    -> Writer (Endo [ProvidedRep m]) () -> m TypedContent
    forall a b. (a -> b) -> a -> b
    $ do
        m RepAtom -> Writer (Endo [ProvidedRep m]) ()
    forall (m :: * -> *) a.
    (Monad m, HasContentType a) =>
    m a -> Writer (Endo [ProvidedRep m]) ()
    provideRep (m RepAtom -> Writer (Endo [ProvidedRep m]) ())
    -> m RepAtom -> Writer (Endo [ProvidedRep m]) ()
    forall a b. (a -> b) -> a -> b
    $ Feed Text -> m RepAtom
    forall (m :: * -> *). MonadHandler m => Feed Text -> m RepAtom
    atomFeedText Feed Text
    f
        m RepRss -> Writer (Endo [ProvidedRep m]) ()
    forall (m :: * -> *) a.
    (Monad m, HasContentType a) =>
    m a -> Writer (Endo [ProvidedRep m]) ()
    provideRep (m RepRss -> Writer (Endo [ProvidedRep m]) ())
    -> m RepRss -> Writer (Endo [ProvidedRep m]) ()
    forall a b. (a -> b) -> a -> b
    $ Feed Text -> m RepRss
    forall (m :: * -> *). MonadHandler m => Feed Text -> m RepRss
    rssFeedText Feed Text
    f