summaryrefslogtreecommitdiff
path: root/src/Hakyll
diff options
context:
space:
mode:
Diffstat (limited to 'src/Hakyll')
-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