diff options
author | Jasper Van der Jeugt <jaspervdj@gmail.com> | 2011-01-07 10:14:36 +0100 |
---|---|---|
committer | Jasper Van der Jeugt <jaspervdj@gmail.com> | 2011-01-07 10:14:36 +0100 |
commit | 70fa0c2ff1b50ec905d96b6bfb66546b354b1c01 (patch) | |
tree | fd5d682c3d82b9f19a88ddde054fea02027855af /src/Hakyll/Core | |
parent | 664648c5f9693fa5160a5c67aeabe8a9d38df03d (diff) | |
download | hakyll-70fa0c2ff1b50ec905d96b6bfb66546b354b1c01.tar.gz |
Add waitFor directive
Diffstat (limited to 'src/Hakyll/Core')
-rw-r--r-- | src/Hakyll/Core/Compiler.hs | 8 |
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 |