summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJasper Van der Jeugt <jaspervdj@gmail.com>2011-02-06 18:32:09 +0100
committerJasper Van der Jeugt <jaspervdj@gmail.com>2011-02-06 18:32:09 +0100
commitbd261e91511ab7cfdc60310a9150496d75465e91 (patch)
tree7fc39c89c2da0c986b55af57976a39000b339efb
parentec9c1ec0db7a7dfc4650b9d1d68069b3bb32bdc4 (diff)
downloadhakyll-bd261e91511ab7cfdc60310a9150496d75465e91.tar.gz
Add getRouteFor
-rw-r--r--src/Hakyll/Core/Compiler.hs9
1 files changed, 7 insertions, 2 deletions
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