1-- | Internal structure of the DirectedGraph type. Not exported in the library.
3module Hakyll.Core.DirectedGraph.Internal
8import Prelude hiding (reverse, filter)
9import Data.Monoid (Monoid, mempty, mappend)
12import qualified Data.Map as M
13import qualified Data.Set as S
15-- | A node in the directed graph
18 { nodeTag :: a -- ^ Tag identifying the node
19 , nodeNeighbours :: (Set a) -- ^ Edges starting at this node
22-- | Append two nodes. Useful for joining graphs.
24appendNodes :: Ord a => Node a -> Node a -> Node a
25appendNodes (Node t1 n1) (Node t2 n2)
26 | t1 /= t2 = error "appendNodes: Appending differently tagged nodes"
27 | otherwise = Node t1 (n1 `S.union` n2)
29-- | Type used to represent a directed graph
31newtype DirectedGraph a = DirectedGraph {unDirectedGraph :: Map a (Node a)}
34-- | Allow users to concatenate different graphs
36instance Ord a => Monoid (DirectedGraph a) where
37 mempty = DirectedGraph M.empty
38 mappend (DirectedGraph m1) (DirectedGraph m2) = DirectedGraph $
39 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