summaryrefslogtreecommitdiff
path: root/src/Hakyll/Core/DirectedGraph
diff options
context:
space:
mode:
authorJasper Van der Jeugt <m@jaspervdj.be>2012-11-10 16:30:38 +0100
committerJasper Van der Jeugt <m@jaspervdj.be>2012-11-10 16:30:38 +0100
commit260e4e2e8936f756d2f3a2e6e788f05ca28e4324 (patch)
tree03c4c7e07f53ac5800fc5255f84465a17d0e5bb7 /src/Hakyll/Core/DirectedGraph
parent6078e699bbfa8ef131a03c900174edfdd21db000 (diff)
downloadhakyll-260e4e2e8936f756d2f3a2e6e788f05ca28e4324.tar.gz
Context?
Diffstat (limited to 'src/Hakyll/Core/DirectedGraph')
-rw-r--r--src/Hakyll/Core/DirectedGraph/Dot.hs14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/Hakyll/Core/DirectedGraph/Dot.hs b/src/Hakyll/Core/DirectedGraph/Dot.hs
index 58f375c..94e2444 100644
--- a/src/Hakyll/Core/DirectedGraph/Dot.hs
+++ b/src/Hakyll/Core/DirectedGraph/Dot.hs
@@ -1,15 +1,18 @@
+--------------------------------------------------------------------------------
-- | Dump a directed graph in dot format. Used for debugging purposes
---
module Hakyll.Core.DirectedGraph.Dot
( toDot
, writeDot
) where
-import Hakyll.Core.DirectedGraph
-import qualified Data.Set as S
+--------------------------------------------------------------------------------
+import qualified Data.Set as S
+import Hakyll.Core.DirectedGraph
+
+
+--------------------------------------------------------------------------------
-- | Convert a directed graph into dot format for debugging purposes
---
toDot :: Ord a
=> (a -> String) -- ^ Convert nodes to dot names
-> DirectedGraph a -- ^ Graph to dump
@@ -25,8 +28,9 @@ toDot showTag graph = unlines $ concat
showEdges node = map (showEdge node) $ S.toList $ neighbours node graph
showEdge x y = " \"" ++ showTag x ++ "\" -> \"" ++ showTag y ++ "\";"
+
+--------------------------------------------------------------------------------
-- | Write out the @.dot@ file to a given file path. See 'toDot' for more
-- information.
---
writeDot :: Ord a => FilePath -> (a -> String) -> DirectedGraph a -> IO ()
writeDot path showTag = writeFile path . toDot showTag