1
1
mirror of https://github.com/github/semantic.git synced 2024-11-27 12:57:49 +03:00

introduce pattern synonym for matching on Success and Prj

This commit is contained in:
Ayman Nadeem 2020-05-07 15:26:42 -04:00
parent 9157a5257a
commit f75a056fbb

View File

@ -22,6 +22,14 @@ pattern Prj :: Element sub sup => sub a -> sup a
pattern Prj sub <- (prj -> Just sub)
-- A pattern synonym that combines matching on @Success@ and @Prj@
eprj :: Element sub sup => Parse.Err (sup a) -> Maybe (sub a)
eprj (Parse.Success x) = prj x
eprj _ = Nothing
pattern EPrj :: Element sub sup => sub a -> Parse.Err (sup a)
pattern EPrj sub <- (eprj -> Just sub)
-- | Where does the element occur in the tree?
data Side = None | Here | L | R