diff options
author | Jasper Van der Jeugt <jaspervdj@gmail.com> | 2010-12-26 16:22:05 +0100 |
---|---|---|
committer | Jasper Van der Jeugt <jaspervdj@gmail.com> | 2010-12-26 16:22:05 +0100 |
commit | bc92f7fea561a3f9ae69fd499e817f9244fcb206 (patch) | |
tree | 473aa8fab8de28621548d1433a56e4222bc58f1c | |
parent | 95f59be5a0be65c4eccdd020fc7938cd9afd7dde (diff) | |
download | hakyll-bc92f7fea561a3f9ae69fd499e817f9244fcb206.tar.gz |
Add resourceDigest function
-rw-r--r-- | src/Hakyll/Core/ResourceProvider.hs | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/Hakyll/Core/ResourceProvider.hs b/src/Hakyll/Core/ResourceProvider.hs index 94dda5b..ba249ca 100644 --- a/src/Hakyll/Core/ResourceProvider.hs +++ b/src/Hakyll/Core/ResourceProvider.hs @@ -4,11 +4,17 @@ -- module Hakyll.Core.ResourceProvider ( ResourceProvider (..) + , resourceDigest ) where -import Hakyll.Core.Identifier +import Control.Monad ((<=<)) +import Data.Word (Word8) import qualified Data.ByteString.Lazy as LB +import OpenSSL.Digest.ByteString.Lazy (digest) +import OpenSSL.Digest (MessageDigest (MD5)) + +import Hakyll.Core.Identifier -- | A value responsible for retrieving and listing resources -- @@ -20,3 +26,8 @@ data ResourceProvider = ResourceProvider , -- | Retrieve a certain resource as lazy bytestring resourceLazyByteString :: Identifier -> IO LB.ByteString } + +-- | Retrieve a digest for a given resource +-- +resourceDigest :: ResourceProvider -> Identifier -> IO [Word8] +resourceDigest provider = digest MD5 <=< resourceLazyByteString provider |