diff options
author | Jasper Van der Jeugt <jaspervdj@gmail.com> | 2011-04-12 11:43:12 +0200 |
---|---|---|
committer | Jasper Van der Jeugt <jaspervdj@gmail.com> | 2011-04-12 11:43:12 +0200 |
commit | edcd3151ee54f3f71d2ffe0a60348f6641909ce7 (patch) | |
tree | 6d8c56a45d4e2c9f736ee62d727c1d2721984421 /src/Hakyll/Core/Resource/Provider | |
parent | b37da38d3911bbc8381a39fe526e69599d9ddcf1 (diff) | |
download | hakyll-edcd3151ee54f3f71d2ffe0a60348f6641909ce7.tar.gz |
Refactor resource provider creation
Diffstat (limited to 'src/Hakyll/Core/Resource/Provider')
-rw-r--r-- | src/Hakyll/Core/Resource/Provider/File.hs | 17 |
1 files changed, 3 insertions, 14 deletions
diff --git a/src/Hakyll/Core/Resource/Provider/File.hs b/src/Hakyll/Core/Resource/Provider/File.hs index 5383b51..8365a5d 100644 --- a/src/Hakyll/Core/Resource/Provider/File.hs +++ b/src/Hakyll/Core/Resource/Provider/File.hs @@ -5,8 +5,6 @@ module Hakyll.Core.Resource.Provider.File ) where import Control.Applicative ((<$>)) -import Control.Concurrent (newMVar) -import qualified Data.Map as M import qualified Data.ByteString.Lazy as LB @@ -20,16 +18,7 @@ import Hakyll.Core.Configuration fileResourceProvider :: HakyllConfiguration -> IO ResourceProvider fileResourceProvider configuration = do -- Retrieve a list of paths - list <- filter (not . ignoreFile configuration) <$> + list <- map Resource . filter (not . ignoreFile configuration) <$> getRecursiveContents False "." - - -- MVar for the cache - mvar <- newMVar M.empty - - -- Construct a resource provider - return ResourceProvider - { resourceList = map Resource list - , resourceString = readFile . unResource - , resourceLazyByteString = LB.readFile . unResource - , resourceModifiedCache = mvar - } + makeResourceProvider list (readFile . unResource) + (LB.readFile . unResource) |