1--------------------------------------------------------------------------------
2-- | Dump a directed graph in dot format. Used for debugging purposes
3module Hakyll.Core.DirectedGraph.Dot
9--------------------------------------------------------------------------------
10import qualified Data.Set as S
11import Hakyll.Core.DirectedGraph
14--------------------------------------------------------------------------------
15-- | Convert a directed graph into dot format for debugging purposes
17 => (a -> String) -- ^ Convert nodes to dot names
18 -> DirectedGraph a -- ^ Graph to dump
19 -> String -- ^ Resulting string
20toDot showTag graph = unlines $ concat
21 [ return "digraph dependencies {"
22 , map showNode (S.toList $ nodes graph)
23 , concatMap showEdges (S.toList $ nodes graph)
27 showNode node = " \"" ++ showTag node ++ "\";"
28 showEdges node = map (showEdge node) $ neighbours node graph
29 showEdge x y = " \"" ++ showTag x ++ "\" -> \"" ++ showTag y ++ "\";"
32--------------------------------------------------------------------------------
33-- | Write out the @.dot@ file to a given file path. See 'toDot' for more
35writeDot :: Ord a => FilePath -> (a -> String) -> DirectedGraph a -> IO ()
36writeDot path showTag = writeFile path . toDot showTag
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list