Clarify a mapping over a Maybe for clearer syntax
This commit is contained in:
parent
f66d22af08
commit
f44bf6259e
1 changed files with 3 additions and 3 deletions
|
@ -63,9 +63,9 @@ rewind graph = graph {focus = root graph}
|
||||||
|
|
||||||
follow :: Ord edge => Graph edge label -> edge -> Maybe (Graph edge label)
|
follow :: Ord edge => Graph edge label -> edge -> Maybe (Graph edge label)
|
||||||
follow graph@(Graph {vertices, focus}) edge =
|
follow graph@(Graph {vertices, focus}) edge =
|
||||||
Map.lookup edge (edges $ vertices ! focus) >>= \vertexID -> Just $ graph {
|
setFocus <$> Map.lookup edge (edges $ vertices ! focus)
|
||||||
focus = vertexID
|
where
|
||||||
}
|
setFocus vertexID = graph {focus = vertexID}
|
||||||
|
|
||||||
stitch :: (Monoid label, Ord edge) => Graph edge label -> edge -> Graph edge label
|
stitch :: (Monoid label, Ord edge) => Graph edge label -> edge -> Graph edge label
|
||||||
stitch graph edge =
|
stitch graph edge =
|
||||||
|
|
Loading…
Reference in a new issue