summaryrefslogtreecommitdiff
path: root/src/Hakyll/Core/DirectedGraph.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Hakyll/Core/DirectedGraph.hs')
-rw-r--r--src/Hakyll/Core/DirectedGraph.hs9
1 files changed, 9 insertions, 0 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