From 70fa0c2ff1b50ec905d96b6bfb66546b354b1c01 Mon Sep 17 00:00:00 2001 From: Jasper Van der Jeugt Date: Fri, 7 Jan 2011 10:14:36 +0100 Subject: Add waitFor directive --- src/Hakyll/Core/Compiler.hs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/Hakyll/Core') 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 -- cgit v1.2.3