on master help sign in
Add getRouteFor
commitbd261e91511ab7cfdc60310a9150496d75465e91 authorJasper Van der Jeugt <jaspervdj@gmail.com> dateSun 6 Feb 2011, 18:32 (16 years ago) parentec9c1ec
1 file changed+7−2
src/Hakyll/Core/Compiler.hs+7−2
src/Hakyll/Core/Compiler.hs+7−2
@@ -6,6 +6,7 @@ module Hakyll.Core.Compiler
66 , runCompiler
77 , getIdentifier
88 , getRoute
9+ , getRouteFor
910 , getResourceString
1011 , fromDependency
1112 , require_
@@ -74,8 +75,12 @@ getIdentifier = fromJob $ const $ CompilerM $ compilerIdentifier <$> ask
7475-- | Get the route we are using for this item
7576--
7677getRoute :: Compiler a (Maybe FilePath)
77−getRoute = fromJob $ const $ CompilerM $ do
78− identifier <- compilerIdentifier <$> ask
78+getRoute = getIdentifier >>> getRouteFor
79+
80+-- | Get the route for a specified item
81+--
82+getRouteFor :: Compiler Identifier (Maybe FilePath)
83+getRouteFor = fromJob $ \identifier -> CompilerM $ do
7984 routes <- compilerRoutes <$> ask
8085 return $ runRoutes routes identifier
8186