diff --git a/src/Graph.hs b/src/Graph.hs index 09a2f7d..891ce4d 100644 --- a/src/Graph.hs +++ b/src/Graph.hs @@ -63,9 +63,9 @@ rewind graph = graph {focus = root graph} follow :: Ord edge => Graph edge label -> edge -> Maybe (Graph edge label) follow graph@(Graph {vertices, focus}) edge = - Map.lookup edge (edges $ vertices ! focus) >>= \vertexID -> Just $ graph { - focus = vertexID - } + setFocus <$> Map.lookup edge (edges $ vertices ! focus) + where + setFocus vertexID = graph {focus = vertexID} stitch :: (Monoid label, Ord edge) => Graph edge label -> edge -> Graph edge label stitch graph edge =