diff --git a/src/Unused/Types.hs b/src/Unused/Types.hs index 853a635..20d9555 100644 --- a/src/Unused/Types.hs +++ b/src/Unused/Types.hs @@ -106,9 +106,11 @@ responseForPath :: DirectoryPrefix -> TermMatchSet -> TermMatchSet responseForPath s = filterVByPath . filterKVByPath where - filterVByPath = Map.map (resultsFromMatches . filter (((==) s) . fileNameGrouping . tmPath) . trMatches) + filterVByPath = Map.map (updateMatchesWith newMatches) filterKVByPath = Map.filterWithKey (\_ a -> s `elem` allPaths a) allPaths = fmap (fileNameGrouping . tmPath) . trMatches + updateMatchesWith f tr = tr { trMatches = f tr } + newMatches = (filter (((==) s) . fileNameGrouping . tmPath) . trMatches) fileNameGrouping :: String -> DirectoryPrefix fileNameGrouping =