diff options
author | 2012-12-13 00:24:19 -0400 | |
---|---|---|
committer | 2012-12-13 00:24:19 -0400 | |
commit | 94554782894ec6c26da3b46312d5d1d16d596458 (patch) | |
tree | 78746106bfb153945ccbfd2bbae536081c005e91 /Git/AutoCorrect.hs | |
parent | 55bd61d8c42aaf36a3c57f8444c493f6b045f4cd (diff) |
finished where indentation changes
Diffstat (limited to 'Git/AutoCorrect.hs')
-rw-r--r-- | Git/AutoCorrect.hs | 50 |
1 files changed, 25 insertions, 25 deletions
diff --git a/Git/AutoCorrect.hs b/Git/AutoCorrect.hs index a1ef14779..325632de9 100644 --- a/Git/AutoCorrect.hs +++ b/Git/AutoCorrect.hs @@ -33,11 +33,11 @@ similarityFloor = 7 fuzzymatches :: String -> (c -> String) -> [c] -> [c] fuzzymatches input showchoice choices = fst $ unzip $ sortBy comparecost $ filter similarEnough $ zip choices costs - where - distance = restrictedDamerauLevenshteinDistance gitEditCosts input - costs = map (distance . showchoice) choices - comparecost a b = compare (snd a) (snd b) - similarEnough (_, cst) = cst < similarityFloor + where + distance = restrictedDamerauLevenshteinDistance gitEditCosts input + costs = map (distance . showchoice) choices + comparecost a b = compare (snd a) (snd b) + similarEnough (_, cst) = cst < similarityFloor {- Takes action based on git's autocorrect configuration, in preparation for - an autocorrected command being run. -} @@ -49,23 +49,23 @@ prepare input showmatch matches r = | n < 0 -> warn | otherwise -> sleep n Nothing -> list - where - list = error $ unlines $ - [ "Unknown command '" ++ input ++ "'" - , "" - , "Did you mean one of these?" - ] ++ map (\m -> "\t" ++ showmatch m) matches - warn = - hPutStr stderr $ unlines - [ "WARNING: You called a command named '" ++ - input ++ "', which does not exist." - , "Continuing under the assumption that you meant '" ++ - showmatch (Prelude.head matches) ++ "'" - ] - sleep n = do - warn - hPutStrLn stderr $ unwords - [ "in" - , show (fromIntegral n / 10 :: Float) - , "seconds automatically..."] - threadDelay (n * 100000) -- deciseconds to microseconds + where + list = error $ unlines $ + [ "Unknown command '" ++ input ++ "'" + , "" + , "Did you mean one of these?" + ] ++ map (\m -> "\t" ++ showmatch m) matches + warn = + hPutStr stderr $ unlines + [ "WARNING: You called a command named '" ++ + input ++ "', which does not exist." + , "Continuing under the assumption that you meant '" ++ + showmatch (Prelude.head matches) ++ "'" + ] + sleep n = do + warn + hPutStrLn stderr $ unwords + [ "in" + , show (fromIntegral n / 10 :: Float) + , "seconds automatically..."] + threadDelay (n * 100000) -- deciseconds to microseconds |