hakyll-3.3.0.1: A static website compiler library

Safe HaskellSafe-Infered

Hakyll.Core.Resource.Provider

Description

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.

Synopsis

Documentation

data ResourceProvider Source

A value responsible for retrieving and listing resources

Constructors

ResourceProvider 

Fields

resourceList :: [Resource]

A list of all resources this provider is able to provide

resourceString :: Resource -> IO String

Retrieve a certain resource as string

resourceLBS :: Resource -> IO ByteString

Retrieve a certain resource as lazy bytestring

resourceModificationTime :: Resource -> IO UTCTime

Check when a resource was last modified

resourceModifiedCache :: MVar (Map Resource Bool)

Cache keeping track of modified items

makeResourceProviderSource

Arguments

:: [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