Safe Haskell | Safe-Infered |
---|
This module provides an API for resource providers. Resource providers allow Hakyll to get content from resources; the type of resource depends on the concrete instance.
A resource is represented by the Resource
type. This is basically just a
newtype wrapper around Identifier
-- but it has an important effect: it
guarantees that a resource with this identifier can be provided by one or
more resource providers.
Therefore, it is not recommended to read files directly -- you should use the
provided Resource
methods.
- data ResourceProvider = ResourceProvider {
- resourceList :: [Resource]
- resourceString :: Resource -> IO String
- resourceLBS :: Resource -> IO ByteString
- resourceModificationTime :: Resource -> IO UTCTime
- resourceModifiedCache :: MVar (Map Resource Bool)
- makeResourceProvider :: [Resource] -> (Resource -> IO String) -> (Resource -> IO ByteString) -> (Resource -> IO UTCTime) -> IO ResourceProvider
- resourceExists :: ResourceProvider -> Resource -> Bool
- resourceDigest :: ResourceProvider -> Resource -> IO ByteString
- resourceModified :: ResourceProvider -> Store -> Resource -> IO Bool
Documentation
data ResourceProvider Source
A value responsible for retrieving and listing resources
ResourceProvider | |
|
:: [Resource] | Resource list |
-> (Resource -> IO String) | String reader |
-> (Resource -> IO ByteString) | ByteString reader |
-> (Resource -> IO UTCTime) | Time checker |
-> IO ResourceProvider | Resulting provider |
Create a resource provider
resourceExists :: ResourceProvider -> Resource -> BoolSource
Check if a given identifier has a resource
resourceDigest :: ResourceProvider -> Resource -> IO ByteStringSource
Retrieve a digest for a given resource
resourceModified :: ResourceProvider -> Store -> Resource -> IO BoolSource
Check if a resource was modified