summaryrefslogtreecommitdiff
path: root/src/Hakyll/Core/Run.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Hakyll/Core/Run.hs')
-rw-r--r--src/Hakyll/Core/Run.hs13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/Hakyll/Core/Run.hs b/src/Hakyll/Core/Run.hs
index b076cb0..e2cab3c 100644
--- a/src/Hakyll/Core/Run.hs
+++ b/src/Hakyll/Core/Run.hs
@@ -6,7 +6,7 @@ module Hakyll.Core.Run
) where
import Prelude hiding (reverse)
-import Control.Monad (filterM)
+import Control.Monad (filterM, forM_)
import Control.Monad.Trans (liftIO)
import Control.Applicative (Applicative, (<$>))
import Control.Monad.Reader (ReaderT, runReaderT, ask)
@@ -147,9 +147,18 @@ stepAnalyzer = Runtime $ do
put $ state { hakyllAnalyzer = analyzer' }
case signal of Done -> return ()
- Cycle _ -> return ()
+ Cycle c -> unRuntime $ dumpCycle c
Build id' -> unRuntime $ build id'
+-- | Dump cyclic error and quit
+--
+dumpCycle :: [Identifier] -> Runtime ()
+dumpCycle cycle' = Runtime $ do
+ logger <- hakyllLogger <$> ask
+ section logger "Dependency cycle detected! Conflict:"
+ forM_ (zip cycle' $ drop 1 cycle') $ \(x, y) ->
+ report logger $ show x ++ " -> " ++ show y
+
build :: Identifier -> Runtime ()
build id' = Runtime $ do
logger <- hakyllLogger <$> ask