hlint rules

This commit is contained in:
2019-03-21 22:26:47 +02:00
parent c3d5eaed3e
commit 5041d5bf99
5 changed files with 14 additions and 12 deletions

View File

@ -10,7 +10,7 @@ import XMonad.Core
import XMonad.Prompt
import XMonad.Util.Run (runProcessWithInput)
data Pass = Pass { passLabel :: String }
newtype Pass = Pass { passLabel :: String }
-- Rosetta code levenshtein
levenshtein :: String -> String -> Int
@ -37,7 +37,7 @@ mkPassPrompt label f conf = do
-- I'm just sorting here, but could use some kind of fuzzy matching instead, but it requires a bit more effort
passwords <- sort <$> liftIO getPasswords
-- Other change, use infixof instead of prefixof
mkXPrompt (Pass label) conf (\input -> pure (sortBy (compare `on` (levenshtein input)) . filter (consumes input) $ passwords)) f
mkXPrompt (Pass label) conf (\input -> pure (sortBy (compare `on` levenshtein input) . filter (consumes input) $ passwords)) f
where
consumes [] _ = True -- everything consumed
consumes (_:_) [] = False -- all not consumed