summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJasper Van der Jeugt <jaspervdj@gmail.com>2010-12-26 12:31:15 +0100
committerJasper Van der Jeugt <jaspervdj@gmail.com>2010-12-26 12:31:15 +0100
commit7f4b5e542c3f96bc05e329f846b80661b394be90 (patch)
tree97cfc09be864b7421ae91e9c2f5f749a126fe6c8 /src
parent36ec2c15b8dece790e4a5e02dc9a4bd1782c7a5f (diff)
downloadhakyll-7f4b5e542c3f96bc05e329f846b80661b394be90.tar.gz
Add getIdentifier function in target
Diffstat (limited to 'src')
-rw-r--r--src/Hakyll/Core/Target.hs9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/Hakyll/Core/Target.hs b/src/Hakyll/Core/Target.hs
index 215a53b..b8740bc 100644
--- a/src/Hakyll/Core/Target.hs
+++ b/src/Hakyll/Core/Target.hs
@@ -6,6 +6,7 @@ module Hakyll.Core.Target
, TargetM
, Target
, runTarget
+ , getIdentifier
, getResourceString
) where
@@ -13,13 +14,19 @@ 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 a Identifier
+getIdentifier = TargetM $ targetIdentifier <$> ask
+
-- | Get the resource content as a string
--
getResourceString :: TargetM a String
getResourceString = TargetM $ do
provider <- targetResourceProvider <$> ask
- identifier <- targetIdentifier <$> ask
+ identifier <- unTargetM getIdentifier
liftIO $ resourceString provider identifier