Permalink
Browse files

hlint hack.

  • Loading branch information...
1 parent 86c16e5 commit f0c8f0cba50aa955fa8cc1713bf7db7262764867 @kazu-yamamoto committed Aug 3, 2012
Showing with 13 additions and 18 deletions.
  1. +5 −8 Commands.hs
  2. +1 −1 Main.hs
  3. +5 −4 PkgDB.hs
  4. +1 −1 VerDB.hs
  5. +1 −4 cab.cabal
View
13 Commands.hs
@@ -86,7 +86,7 @@ unregister doit opts (name,ver) =
if doit then do
putStrLn $ "Deleting " ++ name ++ " " ++ ver
pkgconf <- pkgConfOpt opts
- when doit $ system (script pkgconf) >> return ()
+ when doit $ void . system $ script pkgconf
else
putStrLn $ name ++ " " ++ ver
where
@@ -109,8 +109,7 @@ genpaths _ _ _ = genPaths
check :: FunctionCommand
check _ _ opts = do
pkgconf <- pkgConfOpt opts
- system (script pkgconf)
- return ()
+ void . system $ script pkgconf
where
script pkgconf = "ghc-pkg check -v " ++ pkgconf
@@ -190,16 +189,14 @@ add :: FunctionCommand
add _ params opts = case getSandbox opts of
Nothing -> hPutStrLn stderr "A sandbox must be specified with \"-s\" option."
Just sbox -> case params of
- [src] -> do
- system $ "cabal-dev add-source " ++ src ++ " -s " ++ sbox
- return ()
- _ -> hPutStrLn stderr "A source path be specified."
+ [src] -> void . system $ "cabal-dev add-source " ++ src ++ " -s " ++ sbox
+ _ -> hPutStrLn stderr "A source path be specified."
----------------------------------------------------------------
ghci :: FunctionCommand
ghci _ _ opts = case getSandbox opts of
Nothing -> hPutStrLn stderr "A sandbox must be specified with \"-s\" option."
Just sbox -> do
- system $ "cabal-dev -s " ++ sbox ++ " ghci"
+ _ <- system $ "cabal-dev -s " ++ sbox ++ " ghci"
return ()
View
2 Main.hs
@@ -85,7 +85,7 @@ run cmdspec params opts = case routing cmdspec of
sws = switches cmdspec
callProcess :: String -> [String] -> [Arg] -> [Option] -> [SwitchSpec] -> IO ()
-callProcess pro args0 args1 opts sws = system script >> return ()
+callProcess pro args0 args1 opts sws = void . system $ script
where
swchs = optionsToString opts sws
script = joinBy " " $ pro : args0 ++ cat args1 ++ swchs
View
9 PkgDB.hs
@@ -1,10 +1,11 @@
module PkgDB where
import Control.Monad
+import Data.Function
import Data.List
import Data.Map (Map)
-import Data.Maybe (isNothing)
import qualified Data.Map as M
+import Data.Maybe (isNothing)
import Distribution.Compiler
(CompilerId(..))
import Distribution.License
@@ -128,7 +129,7 @@ printDeps rec info db n pkgi = mapM_ (printDep rec info db n) $ depends pkgi
printDep :: Bool -> Bool -> PkgDB -> Int -> InstalledPackageId -> IO ()
printDep rec info db n pid = case lookupInstalledPackageId db pid of
- Nothing -> return ()
+ Nothing -> return ()
Just pkgi -> do
putStr $ prefix ++ fullNameOfPkgInfo pkgi
extraInfo info pkgi
@@ -161,7 +162,7 @@ printRevDeps' rec info db revdb n pkgi = case M.lookup pkgid revdb of
printRevDep' :: Bool -> Bool -> PkgDB -> RevDB -> Int -> InstalledPackageId -> IO ()
printRevDep' rec info db revdb n pid = case lookupInstalledPackageId db pid of
- Nothing -> return ()
+ Nothing -> return ()
Just pkgi -> do
putStr $ prefix ++ fullNameOfPkgInfo pkgi
extraInfo info pkgi
@@ -182,7 +183,7 @@ makeRevDepDB db = M.fromList revdeps
idDeps pkg = (installedPackageId pkg, depends pkg)
kvs = sort $ concatMap decomp deps
decomp (k,vs) = map (\v -> (v,k)) vs
- kvss = groupBy (\x y -> fst x == fst y) kvs
+ kvss = groupBy ((==) `on` fst) kvs
comp xs = (fst (head xs), map snd xs)
revdeps = map comp kvss
View
2 VerDB.hs
@@ -51,7 +51,7 @@ verinfo = do
name <- string "* " *> nonEols <* endOfLine
synpsis
lat <- latestLabel *> latest <* endOfLine
- many skip
+ _ <- many skip
endOfLine
return (name, lat)
where
View
5 cab.cabal
@@ -19,10 +19,7 @@ Build-Type: Simple
Executable cab
Main-Is: Main.hs
- if impl(ghc >= 6.12)
- GHC-Options: -Wall -fno-warn-unused-do-bind
- else
- GHC-Options: -Wall
+ GHC-Options: -Wall
Build-Depends: base >= 4.0 && < 5
, Cabal
, attoparsec >= 0.10

0 comments on commit f0c8f0c

Please sign in to comment.