summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJasper Van der Jeugt <jaspervdj@gmail.com>2010-12-26 16:12:24 +0100
committerJasper Van der Jeugt <jaspervdj@gmail.com>2010-12-26 16:12:48 +0100
commitb30123f93cd7aa2deadd079e071899ac8f351993 (patch)
tree300dc104736320c17a3f6f98ad6ffa05915d2479
parent515968716f6eaf6915d4fd5ec16aa569bdb5b6da (diff)
downloadhakyll-b30123f93cd7aa2deadd079e071899ac8f351993.tar.gz
Add resourceLazyByteString function
-rw-r--r--src/Hakyll/Core/ResourceProvider.hs8
-rw-r--r--src/Hakyll/Core/ResourceProvider/FileResourceProvider.hs7
2 files changed, 11 insertions, 4 deletions
diff --git a/src/Hakyll/Core/ResourceProvider.hs b/src/Hakyll/Core/ResourceProvider.hs
index 7b4f94a..94dda5b 100644
--- a/src/Hakyll/Core/ResourceProvider.hs
+++ b/src/Hakyll/Core/ResourceProvider.hs
@@ -8,11 +8,15 @@ module Hakyll.Core.ResourceProvider
import Hakyll.Core.Identifier
+import qualified Data.ByteString.Lazy as LB
+
-- | A value responsible for retrieving and listing resources
--
data ResourceProvider = ResourceProvider
{ -- | A list of all resources this provider is able to provide
- resourceList :: [Identifier]
+ resourceList :: [Identifier]
, -- | Retrieve a certain resource as string
- resourceString :: Identifier -> IO String
+ resourceString :: Identifier -> IO String
+ , -- | Retrieve a certain resource as lazy bytestring
+ resourceLazyByteString :: Identifier -> IO LB.ByteString
}
diff --git a/src/Hakyll/Core/ResourceProvider/FileResourceProvider.hs b/src/Hakyll/Core/ResourceProvider/FileResourceProvider.hs
index 442ae9a..72d38be 100644
--- a/src/Hakyll/Core/ResourceProvider/FileResourceProvider.hs
+++ b/src/Hakyll/Core/ResourceProvider/FileResourceProvider.hs
@@ -6,6 +6,8 @@ module Hakyll.Core.ResourceProvider.FileResourceProvider
import Control.Applicative ((<$>))
+import qualified Data.ByteString.Lazy as LB
+
import Hakyll.Core.ResourceProvider
import Hakyll.Core.Identifier
import Hakyll.Core.Util.File
@@ -16,6 +18,7 @@ fileResourceProvider :: IO ResourceProvider
fileResourceProvider = do
list <- map parseIdentifier <$> getRecursiveContents "."
return $ ResourceProvider
- { resourceList = list
- , resourceString = readFile . toFilePath
+ { resourceList = list
+ , resourceString = readFile . toFilePath
+ , resourceLazyByteString = LB.readFile . toFilePath
}