about summary refs log tree commit diff
path: root/services/tazblog/src/BlogStore.hs
diff options
context:
space:
mode:
authorVincent Ambo <tazjin@google.com>2019-08-25T22·06+0100
committerVincent Ambo <tazjin@google.com>2019-08-25T22·07+0100
commit1247848d76712bad1e47b2b67969db3456f04e75 (patch)
tree6f10329c2e2eec1ac4284dfec70676b1c5080031 /services/tazblog/src/BlogStore.hs
parent561ed1fbbb624ddc51f5a97f4a81354e458e64cd (diff)
refactor(tazblog): Implement HLint lints in all files r/64
Diffstat (limited to 'services/tazblog/src/BlogStore.hs')
-rw-r--r--services/tazblog/src/BlogStore.hs12
1 files changed, 6 insertions, 6 deletions
diff --git a/services/tazblog/src/BlogStore.hs b/services/tazblog/src/BlogStore.hs
index 195bcca0c0eb..60ccd0b5a003 100644
--- a/services/tazblog/src/BlogStore.hs
+++ b/services/tazblog/src/BlogStore.hs
@@ -85,7 +85,7 @@ withCache zone f = do
             R.resolvConcurrent = True
             }
   seed <- R.makeResolvSeed conf
-  R.withResolver seed $ (\r -> f $ BlogCache r zone)
+  R.withResolver seed (\r -> f $ BlogCache r zone)
 
 listEntries :: MonadIO m => BlogCache -> Offset -> Count -> m [Entry]
 listEntries cache offset count = liftIO $ do
@@ -97,7 +97,7 @@ listEntries cache offset count = liftIO $ do
     $ sequence entries
 
 getEntry :: MonadIO m => BlogCache -> EntryId -> m (Maybe Entry)
-getEntry cache eid = liftIO $ (entryFromDNS cache eid) >>= \case
+getEntry cache eid = liftIO $ entryFromDNS cache eid >>= \case
   Left _ -> return Nothing -- TODO: ??
   Right entry -> return $ Just entry
 
@@ -150,7 +150,7 @@ entryChunk (BlogCache r z) (EntryId eid) c =
 fetchAssembleChunks :: BlogCache -> EntryId -> Meta -> IO (Either StoreError Text)
 fetchAssembleChunks cache eid (Meta n _ _) = do
   chunks <- mapM (entryChunk cache eid) [0 .. (n - 1)]
-  return $ either Left (Right . T.concat) $ sequence chunks
+  return $ fmap T.concat $ sequence chunks
 
 entryFromDNS :: BlogCache -> EntryId -> IO (Either StoreError Entry)
 entryFromDNS cache eid = do
@@ -177,6 +177,6 @@ postList (BlogCache r z) =
   let domain = encodeUtf8 ("_posts." <> z)
       record = lookupTXT r domain
       toPosts =
-        fmap (sortBy (flip compare)) . sequence
-          . map (\r -> maybe (Left InvalidPosts) Right (decodeStrict r))
-   in record >>= return . either (Left . DNS) toPosts
+        fmap (sortBy (flip compare))
+          . mapM (maybe (Left InvalidPosts) Right . decodeStrict)
+   in either (Left . DNS) toPosts <$> record