summaryrefslogtreecommitdiff
path: root/src/Hakyll/Core/Compiler
diff options
context:
space:
mode:
authorJasper Van der Jeugt <jaspervdj@gmail.com>2010-12-31 15:15:35 +0100
committerJasper Van der Jeugt <jaspervdj@gmail.com>2010-12-31 15:15:35 +0100
commite54834f4448f4bcc6fb55fb338ffcfd4390fd356 (patch)
tree6a3e0bb03ed73c82e11eb96caafb49bf6bd42af5 /src/Hakyll/Core/Compiler
parent8bb4ea5c83fb96842f85d2d167e96c4eae09d4ea (diff)
downloadhakyll-e54834f4448f4bcc6fb55fb338ffcfd4390fd356.tar.gz
Check modification only once
Diffstat (limited to 'src/Hakyll/Core/Compiler')
-rw-r--r--src/Hakyll/Core/Compiler/Internal.hs21
1 files changed, 15 insertions, 6 deletions
diff --git a/src/Hakyll/Core/Compiler/Internal.hs b/src/Hakyll/Core/Compiler/Internal.hs
index 4209bdc..a4dd695 100644
--- a/src/Hakyll/Core/Compiler/Internal.hs
+++ b/src/Hakyll/Core/Compiler/Internal.hs
@@ -37,11 +37,18 @@ type DependencyLookup = Identifier -> CompiledItem
-- | Environment in which a compiler runs
--
data CompilerEnvironment = CompilerEnvironment
- { compilerIdentifier :: Identifier -- ^ Target identifier
- , compilerResourceProvider :: ResourceProvider -- ^ Resource provider
- , compilerDependencyLookup :: DependencyLookup -- ^ Dependency lookup
- , compilerRoute :: Maybe FilePath -- ^ Site route
- , compilerStore :: Store -- ^ Compiler store
+ { -- | Target identifier
+ compilerIdentifier :: Identifier
+ , -- | Resource provider
+ compilerResourceProvider :: ResourceProvider
+ , -- | Dependency lookup
+ compilerDependencyLookup :: DependencyLookup
+ , -- | Site route
+ compilerRoute :: Maybe FilePath
+ , -- | Compiler store
+ compilerStore :: Store
+ , -- | Flag indicating if the underlying resource was modified
+ compilerResourceModified :: Bool
}
-- | The compiler monad
@@ -76,8 +83,9 @@ runCompilerJob :: Compiler () a -- ^ Compiler to run
-> DependencyLookup -- ^ Dependency lookup table
-> Maybe FilePath -- ^ Route
-> Store -- ^ Store
+ -> Bool -- ^ Was the resource modified?
-> IO a
-runCompilerJob compiler identifier provider lookup' route store =
+runCompilerJob compiler identifier provider lookup' route store modified =
runReaderT (unCompilerM $ compilerJob compiler ()) env
where
env = CompilerEnvironment
@@ -86,6 +94,7 @@ runCompilerJob compiler identifier provider lookup' route store =
, compilerDependencyLookup = lookup'
, compilerRoute = route
, compilerStore = store
+ , compilerResourceModified = modified
}
runCompilerDependencies :: Compiler () a