From 0f8e38017cbb981ea07e52d5a4a7f4736c30718b Mon Sep 17 00:00:00 2001 From: Simon Michael Date: Wed, 22 Sep 2010 17:58:06 +0000 Subject: print haddock coverage info on stdout when generating docs A module's haddockable items are its exports and the module itself. The output is lightly formatted so you can align the :'s and sort for readability. --- src/Haddock/Interface/Create.hs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src/Haddock/Interface') diff --git a/src/Haddock/Interface/Create.hs b/src/Haddock/Interface/Create.hs index b6215a34..db2ec05c 100644 --- a/src/Haddock/Interface/Create.hs +++ b/src/Haddock/Interface/Create.hs @@ -79,11 +79,18 @@ createInterface tm flags modMap instIfaceMap = do let visibleNames = mkVisibleNames exportItems opts + -- measure haddock documentation coverage. + let + prunedExportItems0 = pruneExportItems exportItems + haddockable = 1 + length exportItems -- module + exports + haddocked = (if isJust mbDoc then 1 else 0) + length prunedExportItems0 + coverage = (haddockable, haddocked) + -- prune the export list to just those declarations that have -- documentation, if the 'prune' option is on. let prunedExportItems - | OptPrune `elem` opts = pruneExportItems exportItems + | OptPrune `elem` opts = prunedExportItems0 | otherwise = exportItems return Interface { @@ -101,7 +108,8 @@ createInterface tm flags modMap instIfaceMap = do ifaceDeclMap = declMap, ifaceSubMap = mkSubMap declMap exportedNames, ifaceInstances = instances, - ifaceInstanceDocMap = instanceDocMap + ifaceInstanceDocMap = instanceDocMap, + ifaceHaddockCoverage = coverage } -- cgit v1.2.3