diff options
author | Jasper Van der Jeugt <m@jaspervdj.be> | 2013-05-04 15:18:26 +0200 |
---|---|---|
committer | Jasper Van der Jeugt <m@jaspervdj.be> | 2013-05-04 15:18:26 +0200 |
commit | ca80171caf1328bc869c61d2f51b1fd657779532 (patch) | |
tree | 0d48ac5bd8c4b61d5f845005cbf9894f0099c237 /src | |
parent | 3ac3037ec9f93a7bd368e4a135ce65d7590c7f37 (diff) | |
download | hakyll-ca80171caf1328bc869c61d2f51b1fd657779532.tar.gz |
Minor style changes
Diffstat (limited to 'src')
-rw-r--r-- | src/Hakyll/Core/Provider/MetadataCache.hs | 8 | ||||
-rw-r--r-- | src/Hakyll/Core/Store.hs | 16 |
2 files changed, 11 insertions, 13 deletions
diff --git a/src/Hakyll/Core/Provider/MetadataCache.hs b/src/Hakyll/Core/Provider/MetadataCache.hs index 031960c..28d2bd5 100644 --- a/src/Hakyll/Core/Provider/MetadataCache.hs +++ b/src/Hakyll/Core/Provider/MetadataCache.hs @@ -7,8 +7,8 @@ module Hakyll.Core.Provider.MetadataCache -------------------------------------------------------------------------------- +import Control.Monad (unless) import qualified Data.Map as M -import Control.Monad (unless) -------------------------------------------------------------------------------- import Hakyll.Core.Identifier @@ -51,9 +51,9 @@ load :: Provider -> Identifier -> IO () load p r = do mmof <- Store.isMember store mdk unless mmof $ do - (md, body) <- loadMetadata p r - Store.set store mdk md - Store.set store bk body + (md, body) <- loadMetadata p r + Store.set store mdk md + Store.set store bk body where store = providerStore p mdk = [name, toFilePath r, "metadata"] diff --git a/src/Hakyll/Core/Store.hs b/src/Hakyll/Core/Store.hs index b2c61a0..74d9d2f 100644 --- a/src/Hakyll/Core/Store.hs +++ b/src/Hakyll/Core/Store.hs @@ -24,6 +24,7 @@ import qualified Data.ByteString as B import qualified Data.ByteString.Lazy as BL import qualified Data.Cache.LRU.IO as Lru import Data.List (intercalate) +import Data.Maybe (isJust) import qualified Data.Text as T import qualified Data.Text.Encoding as T import Data.Typeable (TypeRep, Typeable, cast, typeOf) @@ -103,12 +104,8 @@ cacheLookup (Store _ (Just lru)) key = do -------------------------------------------------------------------------------- cacheIsMember :: Store -> String -> IO Bool -cacheIsMember (Store _ Nothing) _ = return False -cacheIsMember (Store _ (Just lru)) key = do - res <- Lru.lookup key lru - case res of - Nothing -> return False - _ -> return True +cacheIsMember (Store _ Nothing) _ = return False +cacheIsMember (Store _ (Just lru)) key = isJust <$> Lru.lookup key lru -------------------------------------------------------------------------------- @@ -168,9 +165,10 @@ isMember :: Store -> [String] -> IO Bool isMember store identifier = do inCache <- cacheIsMember store key if inCache then return True else doesFileExist path - where - key = hash identifier - path = storeDirectory store </> key + where + key = hash identifier + path = storeDirectory store </> key + -------------------------------------------------------------------------------- -- | Delete an item |