mirror of
https://github.com/github/semantic.git
synced 2024-12-22 06:11:49 +03:00
Generalize termToDiffInfo over records.
This commit is contained in:
parent
fa44ef74d8
commit
13d2dfc24f
@ -145,7 +145,7 @@ diffSummary = cata $ \case
|
|||||||
(Pure (Delete term)) -> (\info -> DiffSummary (Delete info) []) <$> termToDiffInfo term
|
(Pure (Delete term)) -> (\info -> DiffSummary (Delete info) []) <$> termToDiffInfo term
|
||||||
(Pure (Replace t1 t2)) -> (\(info1, info2) -> DiffSummary (Replace info1 info2) []) <$> zip (termToDiffInfo t1) (termToDiffInfo t2)
|
(Pure (Replace t1 t2)) -> (\(info1, info2) -> DiffSummary (Replace info1 info2) []) <$> zip (termToDiffInfo t1) (termToDiffInfo t2)
|
||||||
|
|
||||||
termToDiffInfo :: HasCategory leaf => Term leaf Info -> [DiffInfo]
|
termToDiffInfo :: (HasCategory leaf, HasField fields Category) => Term leaf (Record fields) -> [DiffInfo]
|
||||||
termToDiffInfo term = case runCofree term of
|
termToDiffInfo term = case runCofree term of
|
||||||
(_ :< Leaf _) -> [ DiffInfo (toCategoryName term) (toTermName term) ]
|
(_ :< Leaf _) -> [ DiffInfo (toCategoryName term) (toTermName term) ]
|
||||||
(_ :< Indexed children) -> join $ termToDiffInfo <$> children
|
(_ :< Indexed children) -> join $ termToDiffInfo <$> children
|
||||||
|
Loading…
Reference in New Issue
Block a user