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:
parent
9157a5257a
commit
f75a056fbb
@ -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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user