1
1
mirror of https://github.com/github/semantic.git synced 2024-11-29 02:44:36 +03:00

📝 Find.

This commit is contained in:
Rob Rix 2019-10-08 15:40:34 -04:00
parent abb6eff40f
commit 83bead5840
No known key found for this signature in database
GPG Key ID: F188A01508EA1CF7

View File

@ -24,6 +24,7 @@ pattern Prj sub <- (prj -> Just sub)
-- | Where does the element occur in the tree? -- | Where does the element occur in the tree?
data Side = None | Here | L | R data Side = None | Here | L | R
-- | Find where in a tree an element occurs.
type family Find sub sup :: Side where type family Find sub sup :: Side where
Find t t = 'Here Find t t = 'Here
Find t (l :+: r) = Find' 'L t l <> Find' 'R t r Find t (l :+: r) = Find' 'L t l <> Find' 'R t r