mirror of
https://github.com/github/semantic.git
synced 2024-11-28 10:15:55 +03:00
Add a TermContainer typeclass.
It’s like a lens, but terrible and ad hoc.
This commit is contained in:
parent
465b3e5207
commit
b738163094
@ -101,6 +101,10 @@ splitDiffByLines diff (prevLeft, prevRight) sources = case diff of
|
||||
where categories (Info _ left, Info _ right) = (left, right)
|
||||
ranges (Info left _, Info right _) = (left, right)
|
||||
|
||||
class TermContainer a where
|
||||
toTerm :: a -> Term String Info
|
||||
setTerm :: a -> Term String Info -> a
|
||||
|
||||
-- | Takes a term and a source and returns a list of lines and their range within source.
|
||||
splitTermByLines :: Eq a => Term a Info -> Source Char -> ([Line (Term a Info)], Range)
|
||||
splitTermByLines (Info range categories :< syntax) source = flip (,) range $ case syntax of
|
||||
|
Loading…
Reference in New Issue
Block a user