summaryrefslogtreecommitdiff
path: root/src/Hakyll/Core/Resource
diff options
context:
space:
mode:
Diffstat (limited to 'src/Hakyll/Core/Resource')
-rw-r--r--src/Hakyll/Core/Resource/Provider.hs16
-rw-r--r--src/Hakyll/Core/Resource/Provider/Dummy.hs2
-rw-r--r--src/Hakyll/Core/Resource/Provider/File.hs6
3 files changed, 12 insertions, 12 deletions
diff --git a/src/Hakyll/Core/Resource/Provider.hs b/src/Hakyll/Core/Resource/Provider.hs
index c3bc9ab..d91c374 100644
--- a/src/Hakyll/Core/Resource/Provider.hs
+++ b/src/Hakyll/Core/Resource/Provider.hs
@@ -68,17 +68,17 @@ resourceDigest provider = fmap MD5.hashlazy . resourceLBS provider
-- | Check if a resource was modified
--
resourceModified :: ResourceProvider -> Store -> Resource -> IO Bool
-resourceModified provider store resource = do
+resourceModified provider store r = do
cache <- readMVar mvar
- case M.lookup resource cache of
+ case M.lookup r cache of
-- Already in the cache
Just m -> return m
-- Not yet in the cache, check digests (if it exists)
Nothing -> do
- m <- if resourceExists provider resource
- then digestModified provider store resource
+ m <- if resourceExists provider r
+ then digestModified provider store r
else return False
- modifyMVar_ mvar (return . M.insert resource m)
+ modifyMVar_ mvar (return . M.insert r m)
return m
where
mvar = resourceModifiedCache provider
@@ -86,11 +86,11 @@ resourceModified provider store resource = do
-- | Check if a resource digest was modified
--
digestModified :: ResourceProvider -> Store -> Resource -> IO Bool
-digestModified provider store resource = do
+digestModified provider store r = do
-- Get the latest seen digest from the store
lastDigest <- storeGet store itemName identifier
-- Calculate the digest for the resource
- newDigest <- resourceDigest provider resource
+ newDigest <- resourceDigest provider r
-- Check digests
if Found newDigest == lastDigest
-- All is fine, not modified
@@ -99,5 +99,5 @@ digestModified provider store resource = do
else do storeSet store itemName identifier newDigest
return True
where
- identifier = toIdentifier resource
+ identifier = toIdentifier r
itemName = "Hakyll.Core.ResourceProvider.digestModified"
diff --git a/src/Hakyll/Core/Resource/Provider/Dummy.hs b/src/Hakyll/Core/Resource/Provider/Dummy.hs
index dad7b0b..548f845 100644
--- a/src/Hakyll/Core/Resource/Provider/Dummy.hs
+++ b/src/Hakyll/Core/Resource/Provider/Dummy.hs
@@ -19,7 +19,7 @@ import Hakyll.Core.Resource.Provider
--
dummyResourceProvider :: Map String ByteString -> IO ResourceProvider
dummyResourceProvider vfs = makeResourceProvider
- (map Resource (M.keys vfs))
+ (map resource (M.keys vfs))
(return . TL.unpack . TL.decodeUtf8 . (vfs M.!) . unResource)
(return . (vfs M.!) . unResource)
(const getCurrentTime)
diff --git a/src/Hakyll/Core/Resource/Provider/File.hs b/src/Hakyll/Core/Resource/Provider/File.hs
index abb7ebe..b2172b8 100644
--- a/src/Hakyll/Core/Resource/Provider/File.hs
+++ b/src/Hakyll/Core/Resource/Provider/File.hs
@@ -22,13 +22,13 @@ import Hakyll.Core.Configuration
fileResourceProvider :: HakyllConfiguration -> IO ResourceProvider
fileResourceProvider configuration = do
-- Retrieve a list of paths
- list <- map Resource . filter (not . shouldIgnoreFile configuration) <$>
+ list <- map resource . filter (not . shouldIgnoreFile configuration) <$>
getRecursiveContents False "."
makeResourceProvider list (readFile . unResource)
(LB.readFile . unResource)
- mtime
+ (mtime . unResource)
where
- mtime (Resource r) = do
+ mtime r = do
ct <- toCalendarTime =<< getModificationTime r
let str = formatCalendarTime defaultTimeLocale "%s" ct
return $ readTime defaultTimeLocale "%s" str