mirror of
https://github.com/github/semantic.git
synced 2024-12-11 08:45:48 +03:00
Uncurry go.
This commit is contained in:
parent
2523d60b2c
commit
ce0866dc1b
@ -90,13 +90,12 @@ newtype DedupeKey = DedupeKey (T.Text, T.Text) deriving (Eq, Ord)
|
||||
-- identifiers) are in the list.
|
||||
-- Action: Combine them into a single Replaced entry.
|
||||
dedupe :: [(Entry, Declaration)] -> [(Entry, Declaration)]
|
||||
dedupe = map snd . sortOn fst . Map.elems . snd . foldl' (uncurry . go) (0, Map.empty)
|
||||
dedupe = map snd . sortOn fst . Map.elems . snd . foldl' go (0, Map.empty)
|
||||
where
|
||||
go :: (Int, Map.Map DedupeKey (Int, (Entry, Declaration)))
|
||||
-> Entry
|
||||
-> Declaration
|
||||
-> (Entry, Declaration)
|
||||
-> (Int, Map.Map DedupeKey (Int, (Entry, Declaration)))
|
||||
go (index, m) entry decl
|
||||
go (index, m) (entry, decl)
|
||||
| Just (_, (_, similar)) <- Map.lookup (dedupeKey decl) m
|
||||
= (succ index,) $ if similar == decl then
|
||||
m
|
||||
|
Loading…
Reference in New Issue
Block a user