diff --git a/src/Graph.hs b/src/Graph.hs index 88f9a67..313530d 100644 --- a/src/Graph.hs +++ b/src/Graph.hs @@ -3,14 +3,15 @@ module Graph ( Graph(..) , editLabel + , follow , open , rewind , singleton , weave ) where -import Data.Map (Map, (!?)) -import qualified Data.Map as Map (delete, empty, insert, toList) +import Data.Map (Map) +import qualified Data.Map as Map (delete, empty, insert, lookup, toList) import Tree (Tree(..), Structure(..)) data Vertex edge label = Vertex { @@ -63,7 +64,7 @@ rewind = open . zipUp follow :: Ord edge => Graph edge label -> edge -> Maybe (Graph edge label) follow (Graph {focus, context}) edge = - edges focus !? edge >>= \vertex -> Just $ Graph { + Map.lookup edge (edges focus) >>= \vertex -> Just $ Graph { focus = vertex , context = Zipper { origin = context