Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .hlint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,6 @@
- ignore: {name: "Use fromMaybe"} # 5 hints
- ignore: {name: "Use fst"} # 2 hints
- ignore: {name: "Use infix"} # 20 hints
- ignore: {name: "Use isAsciiLower"} # 2 hints
- ignore: {name: "Use isAsciiUpper"} # 2 hints
- ignore: {name: "Use isDigit"} # 2 hints
- ignore: {name: "Use lambda-case"} # 58 hints
- ignore: {name: "Use list comprehension"} # 19 hints
- ignore: {name: "Use list literal"} # 3 hints
Expand Down
5 changes: 2 additions & 3 deletions Cabal-syntax/src/Distribution/Utils/Generic.hs
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ module Distribution.Utils.Generic
import Distribution.Compat.Prelude
import Prelude ()

import Data.Char (isAsciiLower, isAsciiUpper)
import Distribution.Utils.String

import Data.Bits (shiftL, (.&.), (.|.))
Expand Down Expand Up @@ -449,9 +450,7 @@ isAscii c = fromEnum c < 0x80

-- | Ascii letters.
isAsciiAlpha :: Char -> Bool
isAsciiAlpha c =
('a' <= c && c <= 'z')
|| ('A' <= c && c <= 'Z')
isAsciiAlpha c = (isAsciiLower c) || (isAsciiUpper c)

-- | Ascii letters and digits.
--
Expand Down
3 changes: 2 additions & 1 deletion Cabal/src/Distribution/Simple/FileMonitor/Types.hs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ import Distribution.Simple.Glob.Internal
import qualified Distribution.Compat.CharParsing as P
import Distribution.Parsec
import Distribution.Pretty
import Distribution.Utils.Generic (isAsciiAlpha)
import qualified Text.PrettyPrint as Disp

--------------------------------------------------------------------------------
Expand Down Expand Up @@ -211,7 +212,7 @@ instance Parsec FilePathRoot where
root = FilePathRoot "/" <$ P.char '/'
home = FilePathHomeDir <$ P.string "~/"
drive = do
dr <- P.satisfy $ \c -> (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')
dr <- P.satisfy isAsciiAlpha
_ <- P.char ':'
_ <- P.char '/' <|> P.char '\\'
return (FilePathRoot (toUpper dr : ":\\"))
8 changes: 3 additions & 5 deletions cabal-install/src/Distribution/Client/VCS.hs
Original file line number Diff line number Diff line change
Expand Up @@ -629,14 +629,13 @@ gitProgram =
-- or annoyingly "git version 2.17.1.windows.2" yes, really
(_ : _ : ver : _) ->
intercalate "."
. takeWhile (all isNum)
. takeWhile (all isDigit)
. split
$ ver
_ -> ""
}
where
isNum c = c >= '0' && c <= '9'
isTypical c = isNum c || c == '.'
isTypical c = isDigit c || c == '.'
split cs = case break (== '.') cs of
(chunk, []) -> chunk : []
(chunk, _ : rest) -> chunk : split rest
Expand Down Expand Up @@ -924,5 +923,4 @@ pijulProgram =
_ -> ""
}
where
isNum c = c >= '0' && c <= '9'
isTypical c = isNum c || c == '.'
isTypical c = isDigit c || c == '.'
Loading