From e84389633276e343cfb26c30c76c01d2ab433e3d Mon Sep 17 00:00:00 2001
From: Hans-Peter Deifel <hpd@hpdeifel.de>
Date: Sun, 19 Mar 2017 21:42:18 +0100
Subject: [PATCH] Rename and document function 'emptyGraph'

---
 src/Compare/Types.hs | 8 ++++----
 src/Search/Search.hs | 2 +-
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/Compare/Types.hs b/src/Compare/Types.hs
index 3c3b3d1..362e660 100644
--- a/src/Compare/Types.hs
+++ b/src/Compare/Types.hs
@@ -4,7 +4,7 @@ module Compare.Types
   ( Graph(..)
   , _graph
   , _point
-  , emptyGraph
+  , singletonGraph
   , insEdges'
   ) where
 
@@ -21,9 +21,9 @@ data Graph node edge = Graph
 
 makeLensesFor [("graph", "_graph"), ("point", "_point")] ''Graph
 
--- TODO Document (especially 0)
-emptyGraph :: node -> Graph node edge
-emptyGraph n = Graph (G.insNode (0, n) G.empty) 0
+-- | Create 'Graph' with just a single node, which is also the 'point'.
+singletonGraph :: G.Node -> node -> Graph node edge
+singletonGraph n label = Graph (G.insNode (n, label) G.empty) n
 
 instance (Show node, Show edge) => Show (Graph node edge) where
   show (Graph g p) = show g ++ "\nentry = " ++ show p
diff --git a/src/Search/Search.hs b/src/Search/Search.hs
index bcc1702..668df8e 100644
--- a/src/Search/Search.hs
+++ b/src/Search/Search.hs
@@ -97,7 +97,7 @@ driver' :: EliminateEpsilons -> FilePath -> VertexLabel -> IO (Graph Text Text)
 driver' elimEpsis prog startVertex = do
   let startOS = Just (EdgeLabel "startOS" "noABB")  -- first edge
   state <- newIORef $ State
-    { _foundGraph = emptyGraph startVertex
+    { _foundGraph = singletonGraph 0 startVertex
     , _vertices = M.singleton startVertex 0
     , _currentVertex = 0
     , _decisions = M.empty
-- 
GitLab