diff options
Diffstat (limited to 'src/Hakyll')
-rw-r--r-- | src/Hakyll/Core/ResourceProvider.hs | 8 | ||||
-rw-r--r-- | src/Hakyll/Core/ResourceProvider/FileResourceProvider.hs | 7 |
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 } |