aboutsummaryrefslogtreecommitdiff
path: root/haddock-api
diff options
context:
space:
mode:
authorWillem Van Onsem <3482343+KommuSoft@users.noreply.github.com>2020-12-08 18:26:55 +0100
committeralexbiehl <alexbiehl@gmail.com>2021-02-07 18:25:30 +0100
commit04da98934ad1c083d21ffc6a83a834c6c4b555d4 (patch)
tree9ab05e60afe92216991c5c5f3a39ca6a3fce8ae7 /haddock-api
parentd20dcc3a61ec61860560216fe88e8dc26097fb35 (diff)
simplify calculating percentages fixing #1194 (#1236)
Diffstat (limited to 'haddock-api')
-rw-r--r--haddock-api/src/Haddock/Interface.hs3
1 files changed, 1 insertions, 2 deletions
diff --git a/haddock-api/src/Haddock/Interface.hs b/haddock-api/src/Haddock/Interface.hs
index 1501919b..b68cc4a9 100644
--- a/haddock-api/src/Haddock/Interface.hs
+++ b/haddock-api/src/Haddock/Interface.hs
@@ -186,7 +186,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 = div (haddocked * 100) haddockable
modString = moduleString (ifaceMod interface)
coverageMsg = printf " %3d%% (%3d /%3d) in '%s'" percentage haddocked haddockable modString
header = case ifaceDoc interface of
@@ -245,4 +245,3 @@ buildHomeLinks ifaces = foldl upd Map.empty (reverse ifaces)
mdl = ifaceMod iface
keep_old env n = Map.insertWith (\_ old -> old) n mdl env
keep_new env n = Map.insert n mdl env
-