diff options
Diffstat (limited to 'src/RSS.hs')
-rw-r--r-- | src/RSS.hs | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/RSS.hs b/src/RSS.hs index 50531c3f8065..045702ece443 100644 --- a/src/RSS.hs +++ b/src/RSS.hs @@ -2,14 +2,15 @@ module RSS (renderFeed) where -import qualified Data.Text as T +import qualified Data.Text as T -import Data.Maybe (fromMaybe) -import Data.Time (UTCTime, getCurrentTime) +import Control.Monad (liftM) +import Data.Maybe (fromMaybe) +import Data.Time (UTCTime, getCurrentTime) import Network.URI import Text.RSS -import BlogDB hiding (Title) +import BlogDB hiding (Title) import Locales createChannel :: BlogLang -> UTCTime -> [ChannelElem] @@ -20,7 +21,7 @@ createChannel l now = [ Language $ show l ] createRSS :: BlogLang -> UTCTime -> [Item] -> RSS -createRSS l t i = RSS (rssTitle l) (rssLink l) (rssDesc l) (createChannel l t) i +createRSS l t = RSS (rssTitle l) (rssLink l) (rssDesc l) (createChannel l t) createItem :: Entry -> Item createItem Entry{..} = [ Title $ T.unpack title @@ -39,4 +40,4 @@ createFeed :: BlogLang -> [Entry] -> IO RSS createFeed l e = getCurrentTime >>= (\t -> return $ createRSS l t $ createItems e ) renderFeed :: BlogLang -> [Entry] -> IO String -renderFeed l e = createFeed l e >>= (\feed -> return $ showXML $ rssToXML feed) +renderFeed l e = liftM (showXML . rssToXML) (createFeed l e) |