mirror of
https://github.com/github/semantic.git
synced 2024-12-01 09:15:01 +03:00
Reformat dedupe.
This commit is contained in:
parent
fbfcdd8985
commit
8a3c49f3df
@ -101,7 +101,12 @@ data Dedupe = Dedupe
|
||||
-- identifiers) are in the list.
|
||||
-- Action: Combine them into a single Replaced entry.
|
||||
dedupe :: [(Change, Declaration)] -> [(Change, Declaration)]
|
||||
dedupe = map ((change :: Dedupe -> Change) &&& decl) . sortOn index . Map.elems . foldl' go Map.empty . zipWith (uncurry . Dedupe) [0..] where
|
||||
dedupe
|
||||
= map ((change :: Dedupe -> Change) &&& decl) -- extract the changes and decls
|
||||
. sortOn index -- after sorting
|
||||
. Map.elems -- the elements of the map
|
||||
. foldl' go Map.empty -- produced by deduping
|
||||
. zipWith (uncurry . Dedupe) [0..] where -- the indexed inputs
|
||||
go m d@(Dedupe _ _ decl) = let key = dedupeKey decl in case Map.lookup key m of
|
||||
Just (Dedupe _ _ similar)
|
||||
| similar == decl -> m
|
||||
|
Loading…
Reference in New Issue
Block a user