From 7f4b5e542c3f96bc05e329f846b80661b394be90 Mon Sep 17 00:00:00 2001 From: Jasper Van der Jeugt Date: Sun, 26 Dec 2010 12:31:15 +0100 Subject: Add getIdentifier function in target --- src/Hakyll/Core/Target.hs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src/Hakyll/Core/Target.hs') 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 -- cgit v1.2.3