From bd261e91511ab7cfdc60310a9150496d75465e91 Mon Sep 17 00:00:00 2001 From: Jasper Van der Jeugt Date: Sun, 6 Feb 2011 18:32:09 +0100 Subject: Add getRouteFor --- src/Hakyll/Core/Compiler.hs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src/Hakyll/Core') diff --git a/src/Hakyll/Core/Compiler.hs b/src/Hakyll/Core/Compiler.hs index 7cfc61f..53daa75 100644 --- a/src/Hakyll/Core/Compiler.hs +++ b/src/Hakyll/Core/Compiler.hs @@ -6,6 +6,7 @@ module Hakyll.Core.Compiler , runCompiler , getIdentifier , getRoute + , getRouteFor , getResourceString , fromDependency , require_ @@ -74,8 +75,12 @@ getIdentifier = fromJob $ const $ CompilerM $ compilerIdentifier <$> ask -- | Get the route we are using for this item -- getRoute :: Compiler a (Maybe FilePath) -getRoute = fromJob $ const $ CompilerM $ do - identifier <- compilerIdentifier <$> ask +getRoute = getIdentifier >>> getRouteFor + +-- | Get the route for a specified item +-- +getRouteFor :: Compiler Identifier (Maybe FilePath) +getRouteFor = fromJob $ \identifier -> CompilerM $ do routes <- compilerRoutes <$> ask return $ runRoutes routes identifier -- cgit v1.2.3