1-- | Internal structure of the DirectedGraph type. Not exported outside of the
4module Hakyll.Core.DirectedGraph.Internal
9import Prelude hiding (reverse, filter)
10import Data.Monoid (Monoid, mempty, mappend)
13import qualified Data.Map as M
14import qualified Data.Set as S
16-- | A node in the directed graph
19 { nodeTag :: a -- ^ Tag identifying the node
20 , nodeNeighbours :: Set a -- ^ Edges starting at this node
23-- | Append two nodes. Useful for joining graphs.
25appendNodes :: Ord a => Node a -> Node a -> Node a
26appendNodes (Node t1 n1) (Node t2 n2)
28 | otherwise = Node t1 (n1 `S.union` n2)
30 error' = error $ "Hakyll.Core.DirectedGraph.Internal.appendNodes: "
31 ++ "Appending differently tagged nodes"
33-- | Type used to represent a directed graph
35newtype DirectedGraph a = DirectedGraph {unDirectedGraph :: Map a (Node a)}
38-- | Allow users to concatenate different graphs
40instance Ord a => Monoid (DirectedGraph a) where
41 mempty = DirectedGraph M.empty
42 mappend (DirectedGraph m1) (DirectedGraph m2) = DirectedGraph $
43 M.unionWith appendNodes m1 m2
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