hlint.
This commit is contained in:
parent
9af4a74abe
commit
efd71c5d81
@ -27,7 +27,7 @@ getSyntax opt mname = do
|
||||
hPutStrLn inp ":set prompt \"Prelude>\""
|
||||
hPutStrLn inp ":quit"
|
||||
cs <- hGetContents out
|
||||
return $ unlines $ dropTailer $ dropHeader $ lines $ cs
|
||||
return . unlines . dropTailer . dropHeader . lines $ cs
|
||||
where
|
||||
isNotPrefixOf x y = not (x `isPrefixOf` y)
|
||||
dropHeader xs = tail $ dropWhile (isNotPrefixOf "Prelude>") xs
|
||||
@ -53,7 +53,7 @@ preprocess cs = case parse remove "remove" cs of
|
||||
Left e -> error $ show e
|
||||
|
||||
modName :: Parser String
|
||||
modName = (:) <$> (oneOf ['A'..'Z'])
|
||||
modName = (:) <$> oneOf ['A'..'Z']
|
||||
<*> (many . oneOf $ ['A'..'Z'] ++ ['a'..'z'] ++ ['0'..'9'] ++ "_'#")
|
||||
|
||||
anyName :: Parser String
|
||||
@ -102,8 +102,8 @@ identifiers (Module _ _ _ _ _ _ x) = filter hid $ concatMap decl x
|
||||
|
||||
decl :: Decl -> [String]
|
||||
decl (TypeSig _ [x] _) = [name x]
|
||||
decl (DataDecl _ _ _ x _ y _) = name x : (map qualConDecl y)
|
||||
decl (ClassDecl _ _ x _ _ y) = name x : (map classDecl y)
|
||||
decl (DataDecl _ _ _ x _ y _) = name x : map qualConDecl y
|
||||
decl (ClassDecl _ _ x _ _ y) = name x : map classDecl y
|
||||
decl (TypeDecl _ x _ _) = [name x]
|
||||
decl x = [show x]
|
||||
|
||||
|
2
Check.hs
2
Check.hs
@ -37,7 +37,7 @@ unfoldLines (x:xs) = x ++ unfold xs
|
||||
unfold [] = "\n"
|
||||
unfold (l:ls)
|
||||
| isAlpha (head l) = ('\n':l) ++ unfold ls
|
||||
| otherwise = (drop 4 l) ++ "\0" ++ unfold ls
|
||||
| otherwise = drop 4 l ++ "\0" ++ unfold ls
|
||||
|
||||
----------------------------------------------------------------
|
||||
|
||||
|
12
GHCMod.hs
12
GHCMod.hs
@ -32,19 +32,19 @@ defaultOptions = Options { convert = toPlain
|
||||
}
|
||||
|
||||
argspec :: [OptDescr (Options -> Options)]
|
||||
argspec = [ Option ['l'] ["tolisp"]
|
||||
argspec = [ Option "l" ["tolisp"]
|
||||
(NoArg (\opts -> opts { convert = toLisp }))
|
||||
"print as a list of Lisp"
|
||||
, Option ['g'] ["ghc"]
|
||||
, Option "g" ["ghc"]
|
||||
(ReqArg (\str opts -> opts { ghc = str }) "ghc")
|
||||
"GHC path"
|
||||
, Option ['i'] ["ghci"]
|
||||
, Option "i" ["ghci"]
|
||||
(ReqArg (\str opts -> opts { ghci = str }) "ghci")
|
||||
"ghci path"
|
||||
, Option ['p'] ["ghc-pkg"]
|
||||
, Option "p" ["ghc-pkg"]
|
||||
(ReqArg (\str opts -> opts { ghcPkg = str }) "ghc-pkg")
|
||||
"ghc-pkg path"
|
||||
, Option ['o'] ["output-dir"]
|
||||
, Option "o" ["output-dir"]
|
||||
(ReqArg (\str opts -> opts { outDir = str }) "dist/flymake")
|
||||
"output directory"
|
||||
]
|
||||
@ -61,7 +61,7 @@ main :: IO ()
|
||||
main = flip catch handler $ do
|
||||
args <- getArgs
|
||||
let (opt,cmdArg) = parseArgs argspec args
|
||||
res <- case cmdArg !! 0 of
|
||||
res <- case head cmdArg of
|
||||
"browse" -> browseModule opt (cmdArg !! 1)
|
||||
"list" -> listModules opt
|
||||
"check" -> checkSyntax opt (cmdArg !! 1)
|
||||
|
Loading…
Reference in New Issue
Block a user