about summary refs log tree commit diff
path: root/services/tazblog/src/RSS.hs
diff options
context:
space:
mode:
authorVincent Ambo <tazjin@google.com>2019-08-25T19·15+0100
committerVincent Ambo <tazjin@google.com>2019-08-25T19·15+0100
commit1747df418e8cdd5d9de1a643354d7ac28591ed14 (patch)
treed2d2ff27374bd40f5c3bcdf366343b1b76297a1c /services/tazblog/src/RSS.hs
parent2fdc87222871e6b68ba2d7ee1c634cfa0d75c572 (diff)
chore(tazblog): Format source files with ormolu r/60
Ormolu's formatting is quite annoying (it uses a lot of unnecessary
vertical space and doesn't align elements), but I can't be bothered to
do manual formatting - especially because whatever formatting
haskell-mode in Emacs produces seems to depend on an opaque state
machine or something.
Diffstat (limited to 'services/tazblog/src/RSS.hs')
-rw-r--r--services/tazblog/src/RSS.hs44
1 files changed, 25 insertions, 19 deletions
diff --git a/services/tazblog/src/RSS.hs b/services/tazblog/src/RSS.hs
index 02a2aafda969..d3e78ba0fb85 100644
--- a/services/tazblog/src/RSS.hs
+++ b/services/tazblog/src/RSS.hs
@@ -1,42 +1,48 @@
 {-# LANGUAGE RecordWildCards #-}
-module RSS (renderFeed) where
 
-import qualified Data.Text as T
+module RSS
+  ( renderFeed
+    )
+where
 
+import BlogStore
 import Control.Monad (liftM)
-import Data.Maybe    (fromMaybe)
-import Data.Time     (UTCTime(..), getCurrentTime, secondsToDiffTime)
+import Data.Maybe (fromMaybe)
+import qualified Data.Text as T
+import Data.Time (UTCTime (..), getCurrentTime, secondsToDiffTime)
+import Locales
 import Network.URI
 import Text.RSS
 
-import BlogStore
-import Locales
-
 createChannel :: BlogLang -> UTCTime -> [ChannelElem]
-createChannel l now = [ Language $ show l
-                      , Copyright "Vincent Ambo"
-                      , WebMaster "tazjin@gmail.com"
-                      , ChannelPubDate now
-                      ]
+createChannel l now =
+  [ Language $ show l,
+    Copyright "Vincent Ambo",
+    WebMaster "mail@tazj.in",
+    ChannelPubDate now
+    ]
 
 createRSS :: BlogLang -> UTCTime -> [Item] -> RSS
 createRSS l t = RSS (rssTitle l) (rssLink l) (rssDesc l) (createChannel l t)
 
 createItem :: Entry -> Item
-createItem Entry{..} = [ Title $ T.unpack title
-                       , Link $ makeLink lang entryId
-                       , Description $ T.unpack btext
-                       , PubDate $ UTCTime edate $ secondsToDiffTime 0 ]
+createItem Entry {..} =
+  [ Title $ T.unpack title,
+    Link $ makeLink lang entryId,
+    Description $ T.unpack btext,
+    PubDate $ UTCTime edate $ secondsToDiffTime 0
+    ]
 
 makeLink :: BlogLang -> EntryId -> URI
-makeLink l i = let url = "http://tazj.in/" ++ show l ++ "/" ++ show i
-               in fromMaybe nullURI $ parseURI url
+makeLink l i =
+  let url = "http://tazj.in/" ++ show l ++ "/" ++ show i
+   in fromMaybe nullURI $ parseURI url
 
 createItems :: [Entry] -> [Item]
 createItems = map createItem
 
 createFeed :: BlogLang -> [Entry] -> IO RSS
-createFeed l e = getCurrentTime >>= (\t -> return $ createRSS l t $ createItems e )
+createFeed l e = getCurrentTime >>= (\t -> return $ createRSS l t $ createItems e)
 
 renderFeed :: BlogLang -> [Entry] -> IO String
 renderFeed l e = liftM (showXML . rssToXML) (createFeed l e)