summaryrefslogtreecommitdiff
path: root/src/Hakyll
diff options
context:
space:
mode:
Diffstat (limited to 'src/Hakyll')
-rw-r--r--src/Hakyll/Core/DirectedGraph.hs9
-rw-r--r--src/Hakyll/Core/Run.hs7
2 files changed, 11 insertions, 5 deletions
diff --git a/src/Hakyll/Core/DirectedGraph.hs b/src/Hakyll/Core/DirectedGraph.hs
index a81868e..76a030b 100644
--- a/src/Hakyll/Core/DirectedGraph.hs
+++ b/src/Hakyll/Core/DirectedGraph.hs
@@ -4,6 +4,7 @@
module Hakyll.Core.DirectedGraph
( DirectedGraph
, fromList
+ , member
, nodes
, neighbours
, reverse
@@ -27,6 +28,14 @@ fromList :: Ord a
-> DirectedGraph a -- ^ Resulting directed graph
fromList = DirectedGraph . M.fromList . map (\(t, d) -> (t, Node t d))
+-- | Check if a node lies in the given graph
+--
+member :: Ord a
+ => a -- ^ Node to check for
+ -> DirectedGraph a -- ^ Directed graph to check in
+ -> Bool -- ^ If the node lies in the graph
+member n = M.member n . unDirectedGraph
+
-- | Get all nodes in the graph
--
nodes :: Ord a
diff --git a/src/Hakyll/Core/Run.hs b/src/Hakyll/Core/Run.hs
index c81a5ff..7e428ae 100644
--- a/src/Hakyll/Core/Run.hs
+++ b/src/Hakyll/Core/Run.hs
@@ -95,10 +95,7 @@ addNewCompilers oldCompilers newCompilers = Hakyll $ do
provider <- hakyllResourceProvider <$> ask
store <- hakyllStore <$> ask
- let -- Create a set of new compilers
- newCompilerIdentifiers = S.fromList $ map fst newCompilers
-
- -- All compilers
+ let -- All compilers
compilers = oldCompilers ++ newCompilers
-- Get all dependencies for the compilers
@@ -128,7 +125,7 @@ addNewCompilers oldCompilers newCompilers = Hakyll $ do
-- Find obsolete items. Every item that is reachable from a modified
-- item is considered obsolete. From these obsolete items, we are only
-- interested in ones that are in the current subgraph.
- obsolete = S.filter (`S.member` newCompilerIdentifiers)
+ obsolete = S.filter (`member` currentGraph)
$ reachableNodes modified' $ reverse completeGraph
-- Solve the graph and retain only the obsolete items