aboutsummaryrefslogtreecommitdiff
path: root/src/Haddock/Interface/Create.hs
diff options
context:
space:
mode:
authorSimon Michael <simon@joyful.com>2010-09-22 17:58:06 +0000
committerSimon Michael <simon@joyful.com>2010-09-22 17:58:06 +0000
commit0f8e38017cbb981ea07e52d5a4a7f4736c30718b (patch)
treeb753d4d8317cf3f13323a8db6dbf2493fd460168 /src/Haddock/Interface/Create.hs
parenta419044739b732030c6ba8ad7767a802e449026a (diff)
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.
Diffstat (limited to 'src/Haddock/Interface/Create.hs')
-rw-r--r--src/Haddock/Interface/Create.hs12
1 files changed, 10 insertions, 2 deletions
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
}