blob: f18d4623594d93bdab5403f66c2dc57f57dd41af (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
--------------------------------------------------------------------------------
-- | This module provides an wrapper API around the file system which does some
-- caching.
module Hakyll.Core.ResourceProvider
( -- * Constructing resource providers
ResourceProvider
, newResourceProvider
-- * Querying resource properties
, resourceList
, resourceExists
, resourceModified
, resourceModificationTime
-- * Access to raw resource content
, resourceString
, resourceLBS
-- * Access to metadata and body content
, resourceMetadata
, resourceBody
) where
--------------------------------------------------------------------------------
import Hakyll.Core.Identifier
import Hakyll.Core.Metadata
import Hakyll.Core.ResourceProvider.Internal
import qualified Hakyll.Core.ResourceProvider.MetadataCache as Internal
import Hakyll.Core.ResourceProvider.Modified
--------------------------------------------------------------------------------
-- | Wrapper to ensure metadata cache is invalidated if necessary
resourceMetadata :: ResourceProvider -> Identifier a -> IO Metadata
resourceMetadata rp r = do
_ <- resourceModified rp r
Internal.resourceMetadata rp r
--------------------------------------------------------------------------------
-- | Wrapper to ensure metadata cache is invalidated if necessary
resourceBody :: ResourceProvider -> Identifier a -> IO String
resourceBody rp r = do
_ <- resourceModified rp r
Internal.resourceBody rp r
|