summaryrefslogtreecommitdiff
path: root/src/Hakyll/Core
diff options
context:
space:
mode:
authorJasper Van der Jeugt <jaspervdj@gmail.com>2011-01-07 10:14:36 +0100
committerJasper Van der Jeugt <jaspervdj@gmail.com>2011-01-07 10:14:36 +0100
commit70fa0c2ff1b50ec905d96b6bfb66546b354b1c01 (patch)
treefd5d682c3d82b9f19a88ddde054fea02027855af /src/Hakyll/Core
parent664648c5f9693fa5160a5c67aeabe8a9d38df03d (diff)
downloadhakyll-70fa0c2ff1b50ec905d96b6bfb66546b354b1c01.tar.gz
Add waitFor directive
Diffstat (limited to 'src/Hakyll/Core')
-rw-r--r--src/Hakyll/Core/Compiler.hs8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/Hakyll/Core/Compiler.hs b/src/Hakyll/Core/Compiler.hs
index e862dd8..ed38b12 100644
--- a/src/Hakyll/Core/Compiler.hs
+++ b/src/Hakyll/Core/Compiler.hs
@@ -7,6 +7,7 @@ module Hakyll.Core.Compiler
, getIdentifier
, getRoute
, getResourceString
+ , waitFor
, require
, requireAll
, cached
@@ -82,6 +83,11 @@ getDependency identifier = CompilerM $ do
++ show identifier
++ " not found in the cache, the cache might be corrupted"
+-- | Wait until another compiler has finished before running this compiler
+--
+waitFor :: Identifier -> Compiler a a
+waitFor = fromDependencies . const . return
+
-- | Require another target. Using this function ensures automatic handling of
-- dependencies
--
@@ -90,7 +96,7 @@ require :: (Binary a, Typeable a, Writable a)
-> (b -> a -> c)
-> Compiler b c
require identifier f =
- fromDependencies (const [identifier]) >>> fromJob require'
+ waitFor identifier >>> fromJob require'
where
require' x = do
y <- getDependency identifier