Remove unnecessary uses of head

This commit is contained in:
Joseph C. Sible 2020-02-09 22:51:10 -05:00
parent c95914f9b3
commit 6d06103cab
5 changed files with 14 additions and 15 deletions

View file

@ -279,10 +279,10 @@ checkGrepRe = CommandCheck (Basename "grep") check where
grepGlobFlags = ["fixed-strings", "F", "include", "exclude", "exclude-dir", "o", "only-matching"]
wordStartingWith c =
head . filter ([c] `isPrefixOf`) $ candidates
headOrDefault (c:"test") . filter ([c] `isPrefixOf`) $ candidates
where
candidates =
sampleWords ++ map (\(x:r) -> toUpper x : r) sampleWords ++ [c:"test"]
sampleWords ++ map (\(x:r) -> toUpper x : r) sampleWords
getSuspiciousRegexWildcard str =
if not $ str `matches` contra