mirror of
https://github.com/joshuaclayton/unused.git
synced 2024-09-11 04:45:28 +03:00
Remove unnecessary parens
This commit is contained in:
parent
50399ec4b1
commit
558c4ed2f4
@ -9,13 +9,13 @@ search t = do
|
|||||||
results <- ag t
|
results <- ag t
|
||||||
return $ linesMap prefixTerm results
|
return $ linesMap prefixTerm results
|
||||||
where
|
where
|
||||||
prefixTerm = ((++) t)
|
prefixTerm = (++ t)
|
||||||
|
|
||||||
linesMap :: (String -> String) -> String -> [String]
|
linesMap :: (String -> String) -> String -> [String]
|
||||||
linesMap f =
|
linesMap f =
|
||||||
filter empty . map f . lines
|
filter empty . map f . lines
|
||||||
where
|
where
|
||||||
empty = ((/=) 0) . length
|
empty = (/= 0) . length
|
||||||
|
|
||||||
ag :: String -> IO String
|
ag :: String -> IO String
|
||||||
ag t = do
|
ag t = do
|
||||||
|
@ -107,10 +107,10 @@ responseForPath s =
|
|||||||
filterVByPath . filterKVByPath
|
filterVByPath . filterKVByPath
|
||||||
where
|
where
|
||||||
filterVByPath = Map.map (updateMatchesWith newMatches)
|
filterVByPath = Map.map (updateMatchesWith newMatches)
|
||||||
filterKVByPath = Map.filterWithKey (\_ a -> s `elem` allPaths a)
|
filterKVByPath = Map.filterWithKey (const $ \a -> s `elem` allPaths a)
|
||||||
allPaths = fmap (fileNameGrouping . tmPath) . trMatches
|
allPaths = fmap (fileNameGrouping . tmPath) . trMatches
|
||||||
updateMatchesWith f tr = tr { trMatches = f tr }
|
updateMatchesWith f tr = tr { trMatches = f tr }
|
||||||
newMatches = (filter (((==) s) . fileNameGrouping . tmPath) . trMatches)
|
newMatches = (filter ((== s) . fileNameGrouping . tmPath) . trMatches)
|
||||||
|
|
||||||
fileNameGrouping :: String -> DirectoryPrefix
|
fileNameGrouping :: String -> DirectoryPrefix
|
||||||
fileNameGrouping =
|
fileNameGrouping =
|
||||||
|
@ -8,5 +8,5 @@ groupBy :: Eq b => (a -> b) -> [a] -> [(b, [a])]
|
|||||||
groupBy f l =
|
groupBy f l =
|
||||||
fmap (\t -> (t, byTerm t)) uniqueTerms
|
fmap (\t -> (t, byTerm t)) uniqueTerms
|
||||||
where
|
where
|
||||||
byTerm t = filter (((==) t) . f) l
|
byTerm t = filter ((== t) . f) l
|
||||||
uniqueTerms = nub $ fmap f l
|
uniqueTerms = nub $ fmap f l
|
||||||
|
Loading…
Reference in New Issue
Block a user