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