blob: 452fb577d0c9a6da8d65314b16c0bfe82bb3d00b (
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
|
-- | A target represents one compilation unit, e.g. a blog post, a CSS file...
--
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
module Hakyll.Core.Target
( DependencyLookup
, TargetM
, runTarget
, getIdentifier
, getResourceString
) where
import Control.Applicative ((<$>))
import Control.Monad.Reader (ask)
import Control.Monad.Trans (liftIO)
import Hakyll.Core.Identifier
import Hakyll.Core.Target.Internal
import Hakyll.Core.ResourceProvider
-- | Get the current identifier
--
getIdentifier :: TargetM Identifier
getIdentifier = TargetM $ targetIdentifier <$> ask
-- | Get the resource content as a string
--
getResourceString :: TargetM String
getResourceString = TargetM $ do
provider <- targetResourceProvider <$> ask
identifier <- unTargetM getIdentifier
liftIO $ resourceString provider identifier
|