@@ -6,7 +6,7 @@ module Hakyll.Core.Runtime
66
77--------------------------------------------------------------------------------
88import Control.Applicative ((<$>))
9−import Control.Monad (filterM)
9+import Control.Monad (filterM, unless)
1010import Control.Monad.Error (ErrorT, runErrorT, throwError)
1111import Control.Monad.Reader (ask)
1212import Control.Monad.RWS (RWST, runRWST)
@@ -27,6 +27,7 @@ import Hakyll.Core.Compiler.Require
2727import Hakyll.Core.Configuration
2828import Hakyll.Core.Dependencies
2929import Hakyll.Core.Identifier
30+import Hakyll.Core.Item
3031import Hakyll.Core.Item.SomeItem
3132import Hakyll.Core.Logger (Logger, Verbosity)
3233import qualified Hakyll.Core.Logger as Logger
@@ -200,15 +201,20 @@ chase trail id'
200201
201202 -- Huge success
202203 CompilerDone (SomeItem item) cwrite -> do
203− -- TODO: Sanity check on itemIdentifier?
204− let facts = compilerDependencies cwrite
204+ -- Print some info
205+ let facts = compilerDependencies cwrite
205206 cacheHits
206207 | compilerCacheHits cwrite <= 0 = "updated"
207208 | otherwise = "cached "
208−
209− -- Print some info
210209 Logger.message logger $ cacheHits ++ " " ++ show id'
211210
211+ -- Sanity check
212+ unless (itemIdentifier item == id') $ throwError $
213+ "The compiler yielded an Item with Identifier " ++
214+ show (itemIdentifier item) ++ ", but we were expecting " ++
215+ "an Item with Identifier " ++ show id' ++ " " ++
216+ "(you probably want to call makeItem to solve this problem)"
217+
212218 -- Write if necessary
213219 case runRoutes routes id' of
214220 Nothing -> return ()