summaryrefslogtreecommitdiff
path: root/src/Hakyll/Core/DirectedGraph/Internal.hs
diff options
context:
space:
mode:
authorJasper Van der Jeugt <m@jaspervdj.be>2012-11-10 20:42:23 +0100
committerJasper Van der Jeugt <m@jaspervdj.be>2012-11-10 20:42:23 +0100
commit9aa11b26cdba009fe268f874c07f9037250bf2c6 (patch)
tree5c97d953049a1a916d86126db6a6646b3a9a8cd3 /src/Hakyll/Core/DirectedGraph/Internal.hs
parent9eda3425a3153e0f226cc0e32b38c82cc7c806ef (diff)
downloadhakyll-9aa11b26cdba009fe268f874c07f9037250bf2c6.tar.gz
Pick dependency analyzer from old develop branch
Diffstat (limited to 'src/Hakyll/Core/DirectedGraph/Internal.hs')
-rw-r--r--src/Hakyll/Core/DirectedGraph/Internal.hs52
1 files changed, 0 insertions, 52 deletions
diff --git a/src/Hakyll/Core/DirectedGraph/Internal.hs b/src/Hakyll/Core/DirectedGraph/Internal.hs
deleted file mode 100644
index b836d6d..0000000
--- a/src/Hakyll/Core/DirectedGraph/Internal.hs
+++ /dev/null
@@ -1,52 +0,0 @@
--- | Internal structure of the DirectedGraph type. Not exported outside of the
--- library.
---
-{-# LANGUAGE GeneralizedNewtypeDeriving, DeriveDataTypeable #-}
-module Hakyll.Core.DirectedGraph.Internal
- ( Node (..)
- , DirectedGraph (..)
- ) where
-
-import Prelude hiding (reverse, filter)
-import Control.Applicative ((<$>), (<*>))
-import Data.Monoid (Monoid, mempty, mappend)
-import Data.Set (Set)
-import Data.Map (Map)
-import qualified Data.Map as M
-import qualified Data.Set as S
-
-import Data.Binary (Binary, put, get)
-import Data.Typeable (Typeable)
-
--- | A node in the directed graph
---
-data Node a = Node
- { nodeTag :: a -- ^ Tag identifying the node
- , nodeNeighbours :: Set a -- ^ Edges starting at this node
- } deriving (Show, Typeable)
-
-instance (Binary a, Ord a) => Binary (Node a) where
- put (Node t n) = put t >> put n
- get = Node <$> get <*> get
-
--- | Append two nodes. Useful for joining graphs.
---
-appendNodes :: Ord a => Node a -> Node a -> Node a
-appendNodes (Node t1 n1) (Node t2 n2)
- | t1 /= t2 = error'
- | otherwise = Node t1 (n1 `S.union` n2)
- where
- error' = error $ "Hakyll.Core.DirectedGraph.Internal.appendNodes: "
- ++ "Appending differently tagged nodes"
-
--- | Type used to represent a directed graph
---
-newtype DirectedGraph a = DirectedGraph {unDirectedGraph :: Map a (Node a)}
- deriving (Show, Binary, Typeable)
-
--- | Allow users to concatenate different graphs
---
-instance Ord a => Monoid (DirectedGraph a) where
- mempty = DirectedGraph M.empty
- mappend (DirectedGraph m1) (DirectedGraph m2) = DirectedGraph $
- M.unionWith appendNodes m1 m2