Clarify a mapping over a Maybe for clearer syntax

This commit is contained in:
Tissevert 2019-05-13 18:27:49 +02:00
parent f66d22af08
commit f44bf6259e

View file

@ -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 =