diff --git a/src/Compare/Types.hs b/src/Compare/Types.hs index 3c3b3d140c985cb3221ee919018f718c7a5a9982..362e660c3d571bfbbf820fb1cdfbcd92fca68c6d 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 bcc170225c4c69a7bb57b5edc52259eec567a60e..668df8e9abcf1410c7e4bf76a2b2dfd8e18ea26a 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