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)
27 | t1 /= t2 = error "appendNodes: Appending differently tagged nodes"
28 | otherwise = Node t1 (n1 `S.union` n2)
30-- | Type used to represent a directed graph
32newtype DirectedGraph a = DirectedGraph {unDirectedGraph :: Map a (Node a)}
35-- | Allow users to concatenate different graphs
37instance Ord a => Monoid (DirectedGraph a) where
38 mempty = DirectedGraph M.empty
39 mappend (DirectedGraph m1) (DirectedGraph m2) = DirectedGraph $
40 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