aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWillem Van Onsem <3482343+KommuSoft@users.noreply.github.com>2020-05-25 18:23:01 +0200
committerGitHub <noreply@github.com>2020-05-25 12:23:01 -0400
commit8551fcd2e3e0d1a34fc09233f35a62d537df7cc1 (patch)
treecf70548ef41faf777264931a1bc0217fbabdc851
parent3c9e8081228ffcc38c760a6d9501a626071a5105 (diff)
Use floor over round to calculate the percentage (#1195)
If we compile documentation where only a small fraction is undocumented, it is misleading to see 100% coverage - 99% is more intuitive. Fixes #1194
-rw-r--r--haddock-api/src/Haddock/Interface.hs2
1 files changed, 1 insertions, 1 deletions
diff --git a/haddock-api/src/Haddock/Interface.hs b/haddock-api/src/Haddock/Interface.hs
index 6775cf2b..66e0bedc 100644
--- a/haddock-api/src/Haddock/Interface.hs
+++ b/haddock-api/src/Haddock/Interface.hs
@@ -182,7 +182,7 @@ processModule verbosity modsum flags modMap instIfaceMap = do
liftIO $ mapM_ putStrLn (nub msgs)
dflags <- getDynFlags
let (haddockable, haddocked) = ifaceHaddockCoverage interface
- percentage = round (fromIntegral haddocked * 100 / fromIntegral haddockable :: Double) :: Int
+ percentage = floor (fromIntegral haddocked * 100 / fromIntegral haddockable :: Double) :: Int
modString = moduleString (ifaceMod interface)
coverageMsg = printf " %3d%% (%3d /%3d) in '%s'" percentage haddocked haddockable modString
header = case ifaceDoc interface of