From 8a3c49f3dfc8c275f1974766122153459e487fdc Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Thu, 17 Oct 2019 22:03:02 -0400 Subject: [PATCH] Reformat dedupe. --- src/Rendering/TOC.hs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Rendering/TOC.hs b/src/Rendering/TOC.hs index 6a32f2a6a..30616c479 100644 --- a/src/Rendering/TOC.hs +++ b/src/Rendering/TOC.hs @@ -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