summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authornoxx <noxx@noxx-inferno.(none)>2013-05-04 15:42:28 +0300
committernoxx <noxx@noxx-inferno.(none)>2013-05-04 15:42:28 +0300
commitf4ee3e7fcb0817098643c6b34cab92466584680a (patch)
treebfee8395df134a5263e6512a196bb42914f90948 /src
parent0f779a8c53039829030eb984528974d80372002d (diff)
downloadhakyll-f4ee3e7fcb0817098643c6b34cab92466584680a.tar.gz
Created tests and fixed isMember function
Diffstat (limited to 'src')
-rw-r--r--src/Hakyll/Core/Store.hs21
1 files changed, 10 insertions, 11 deletions
diff --git a/src/Hakyll/Core/Store.hs b/src/Hakyll/Core/Store.hs
index eb2d742..b2c61a0 100644
--- a/src/Hakyll/Core/Store.hs
+++ b/src/Hakyll/Core/Store.hs
@@ -102,13 +102,13 @@ cacheLookup (Store _ (Just lru)) key = do
--------------------------------------------------------------------------------
-cacheIsMember :: Store -> String -> Bool
-cacheIsMember (Store _ Nothing) _ = False
-cacheIsMember (Store _ (Just lru)) key =
- let res = Lru.lookup key lru in
- case Just res of
- Nothing -> False
- _ -> True
+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
--------------------------------------------------------------------------------
@@ -165,10 +165,9 @@ get store identifier = do
--------------------------------------------------------------------------------
-- | Strict function
isMember :: Store -> [String] -> IO Bool
-isMember store identifier
- | cacheIsMember store key = return True
- | otherwise = doesFileExist path
-
+isMember store identifier = do
+ inCache <- cacheIsMember store key
+ if inCache then return True else doesFileExist path
where
key = hash identifier
path = storeDirectory store </> key