@@ -109,7 +109,7 @@ main = topHandler $ do
109
109
" hackage-build build [packages] [options]" ,
110
110
" hackage-build stats" ,
111
111
" Options:" ]
112
- mapM_ putStrLn $ strs
112
+ mapM_ putStrLn strs
113
113
putStrLn $ usageInfo usageHeader buildFlagDescrs
114
114
unless (null strs) exitFailure
115
115
Init uri auxUris -> initialise opts uri auxUris
@@ -339,18 +339,18 @@ infoStats verbosity mDetailedStats pkgIdsHaveDocs = do
339
339
-- NOTE: Expects the same number of columns in every row!
340
340
printTable :: [[String ]] -> String
341
341
printTable xss = intercalate " \n "
342
- . map (intercalate " " )
342
+ . map unwords
343
343
. map padCols
344
344
$ xss
345
345
where
346
346
colWidths :: [[Int ]]
347
- colWidths = map (map length ) $ xss
347
+ colWidths = map (map length ) xss
348
348
349
349
maxColWidths :: [Int ]
350
- maxColWidths = foldr1 ( \ xs ys -> map ( uncurry max ) ( zip xs ys)) colWidths
350
+ maxColWidths = map maximum (transpose colWidths)
351
351
352
352
padCols :: [String ] -> [String ]
353
- padCols cols = map ( uncurry padTo) ( zip maxColWidths cols)
353
+ padCols cols = zipWith padTo maxColWidths cols
354
354
355
355
padTo :: Int -> String -> String
356
356
padTo len str = str ++ replicate (len - length str) ' '
@@ -401,7 +401,7 @@ getDocumentationStats verbosity opts config pkgs = do
401
401
False -> return Nothing
402
402
mPackages <- fmap parseJsonStats <$> requestGET' (packagesUri False curGhcVersion)
403
403
mCandidates <- fmap parseJsonStats <$> requestGET' (packagesUri True curGhcVersion)
404
- liftIO $ putStrLn $ show curGhcVersion
404
+ liftIO $ print curGhcVersion
405
405
case (mPackages, mCandidates) of
406
406
-- Download failure
407
407
(Nothing , _) -> fail $ " Could not download " ++ show (packagesUri False curGhcVersion)
@@ -426,9 +426,9 @@ getDocumentationStats verbosity opts config pkgs = do
426
426
hClose moutput
427
427
handler <- openFile dirloc ReadWriteMode
428
428
contents <- hGetContents handler
429
- let res = read contents :: [(String , String )]
430
- version' = fmap ( \ (_,b) -> b) $ find ( \ (a,_) -> a == " Project version" ) res
431
- return $ version'
429
+ let res = read contents :: [(String , String )]
430
+ version' = lookup " Project version" res
431
+ return version'
432
432
433
433
getQry :: [PackageIdentifier ] -> String
434
434
getQry [] = " "
@@ -576,7 +576,7 @@ processPkg verbosity opts config docInfo = do
576
576
coverageFile <- mapM (coveragePackage verbosity opts docInfo) hpcLoc
577
577
578
578
-- Modify test-outcome and rewrite report file.
579
- mapM (setTestStatus mRpt buildReport) testOutcome
579
+ mapM_ (setTestStatus mRpt buildReport) testOutcome
580
580
581
581
case bo_dryRun opts of
582
582
True -> return ()
@@ -610,7 +610,7 @@ processPkg verbosity opts config docInfo = do
610
610
let buildReport' = fmap (unlines . setTestOutcome testOutcome) $ fmap lines buildReport
611
611
rewriteRpt mRpt buildReport'
612
612
613
- coveragePackage :: Verbosity -> BuildOpts -> DocInfo -> FilePath -> IO ( FilePath )
613
+ coveragePackage :: Verbosity -> BuildOpts -> DocInfo -> FilePath -> IO FilePath
614
614
coveragePackage verbosity opts docInfo loc = do
615
615
let pkgid = docInfoPackage docInfo
616
616
dir = takeDirectory loc
@@ -886,7 +886,7 @@ putBuildFiles config docInfo reportFile buildLogFile coverageFile installOk = do
886
886
(_, response) <- request Request {
887
887
rqURI = uri,
888
888
rqMethod = PUT ,
889
- rqHeaders = [Header HdrContentType ( " application/json" ) ,
889
+ rqHeaders = [Header HdrContentType " application/json" ,
890
890
Header HdrContentLength (show (BS. length body))],
891
891
rqBody = body
892
892
}
0 commit comments