From 060f1e3499525799b14862577bf21ccf640c829d Mon Sep 17 00:00:00 2001 From: Joshua Clayton Date: Tue, 19 Jul 2016 16:22:54 -0400 Subject: [PATCH] Fix naming and pattern-matching --- src/Unused/Types.hs | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/Unused/Types.hs b/src/Unused/Types.hs index 63c01e2..d235542 100644 --- a/src/Unused/Types.hs +++ b/src/Unused/Types.hs @@ -98,11 +98,11 @@ tmDisplayTerm :: TermMatch -> String tmDisplayTerm = liftM2 M.fromMaybe tmTerm tmAlias resultsFromMatches :: [TermMatch] -> TermResults -resultsFromMatches m = +resultsFromMatches tms = TermResults { trTerm = resultTerm terms , trTerms = L.sort $ L.nub terms - , trMatches = m + , trMatches = tms , trAppOccurrences = appOccurrence , trTestOccurrences = testOccurrence , trTotalOccurrences = Occurrences (sum $ map oFiles [appOccurrence, testOccurrence]) (sum $ map oOccurrences [appOccurrence, testOccurrence]) @@ -110,9 +110,9 @@ resultsFromMatches m = , trGitContext = Nothing } where - testOccurrence = testOccurrences m - appOccurrence = appOccurrences m - terms = map tmDisplayTerm m + testOccurrence = testOccurrences tms + appOccurrence = appOccurrences tms + terms = map tmDisplayTerm tms resultTerm (x:_) = x resultTerm _ = "" @@ -144,7 +144,5 @@ testCamelCaseFilename :: String -> Bool testCamelCaseFilename = R.matchRegex ".*(Spec|Test)\\." termMatchIsTest :: TermMatch -> Bool -termMatchIsTest m = +termMatchIsTest TermMatch{tmPath = path} = testDir path || testSnakeCaseFilename path || testCamelCaseFilename path - where - path = tmPath m