summaryrefslogtreecommitdiff
path: root/src/Hakyll/Core/Target.hs
blob: 215a53b31dda454610d51332e3528a595903d3a9 (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
-- | A target represents one compilation unit, e.g. a blog post, a CSS file...
--
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
module Hakyll.Core.Target
    ( DependencyLookup
    , TargetM
    , Target
    , runTarget
    , getResourceString
    ) where

import Control.Applicative ((<$>))
import Control.Monad.Reader (ask)
import Control.Monad.Trans (liftIO)

import Hakyll.Core.Target.Internal
import Hakyll.Core.ResourceProvider

-- | Get the resource content as a string
--
getResourceString :: TargetM a String
getResourceString = TargetM $ do
    provider <- targetResourceProvider <$> ask
    identifier <- targetIdentifier <$> ask
    liftIO $ resourceString provider identifier