From 4d6b343127aa3d545473fe9e80821b8d4587f6a1 Mon Sep 17 00:00:00 2001 From: David Waern Date: Sat, 1 Oct 2011 01:25:39 +0200 Subject: Merge in darcs patch from Simon Meier: Wed Jun 1 19:41:16 CEST 2011 iridcode@gmail.com * prettier haddock coverage info The new coverage info rendering uses less horizontal space. This reduces the number of unnecessary line-wrappings. Moreover, the most important information, how much has been documented already, is now put up front. Hopefully, this makes it more likely that a library author is bothered by the low coverage of his modules and fixes that issue ;-) --- src/Haddock/Interface.hs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/Haddock/Interface.hs b/src/Haddock/Interface.hs index 276621d2..09f01883 100644 --- a/src/Haddock/Interface.hs +++ b/src/Haddock/Interface.hs @@ -142,6 +142,7 @@ createIfaces0 verbosity modules flags instIfaceMap = createIfaces :: Verbosity -> [Flag] -> InstIfaceMap -> ModuleGraph -> Ghc [Interface] createIfaces verbosity flags instIfaceMap mods = do let sortedMods = flattenSCCs $ topSortModuleGraph False mods Nothing + out verbosity normal "Haddock coverage:" (ifaces, _) <- foldM f ([], Map.empty) sortedMods return (reverse ifaces) where @@ -162,11 +163,9 @@ processModule verbosity modsum flags modMap instIfaceMap = do liftIO $ mapM_ putStrLn msg let (haddockable, haddocked) = ifaceHaddockCoverage interface percentage = round (fromIntegral haddocked * 100 / fromIntegral haddockable :: Double) :: Int - coveragemsg = printf "haddock coverage for %s: %7s %3d%%" - (ifaceOrigFilename interface) - (printf "%d/%d" haddocked haddockable :: String) - percentage - out verbosity normal coveragemsg + modString = moduleString (ifaceMod interface) + coverageMsg = printf " %3d%% (%3d /%3d) in '%s'" percentage haddocked haddockable modString + out verbosity normal coverageMsg interface' <- liftIO $ evaluate interface return (Just interface') else -- cgit v1.2.3 From 73a6ed218c59fb778da9b830db1283e005ff2245 Mon Sep 17 00:00:00 2001 From: David Waern Date: Sat, 1 Oct 2011 01:34:10 +0200 Subject: Use printException instead of deprecated printExceptionAndWarnings --- src/Main.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/Main.hs b/src/Main.hs index b49fc6e4..f21bde5e 100644 --- a/src/Main.hs +++ b/src/Main.hs @@ -157,7 +157,7 @@ readPackagesAndProcessModules flags files = do -- Catches all GHC source errors, then prints and re-throws them. let handleSrcErrors action' = flip handleSourceError action' $ \err -> do - printExceptionAndWarnings err + printException err liftIO exitFailure -- Initialize GHC. -- cgit v1.2.3 From b50695a86358fd02b9a0ececbc107bf5274d5f95 Mon Sep 17 00:00:00 2001 From: David Waern Date: Sat, 1 Oct 2011 01:55:45 +0200 Subject: Merge in darcs patch: Joachim Breitner **20110619201645 Ignore-this: f6c51228205b0902ad5bfad5040b989a As reported on http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=578301, generating the global index takes much too long if type-level (with lots of auto-generated types) is installed. The patch avoids a quadratic runtime in the subfunction getIfaceIndex of ppHtmlIndex by using a temporary set. Runtime improvement observed here from 25.36s to 2.86s. --- src/Haddock/Backends/Xhtml.hs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/Haddock/Backends/Xhtml.hs b/src/Haddock/Backends/Xhtml.hs index 600a5362..b639760d 100644 --- a/src/Haddock/Backends/Xhtml.hs +++ b/src/Haddock/Backends/Xhtml.hs @@ -41,6 +41,7 @@ import System.FilePath hiding ( () ) import System.Directory import Data.Map ( Map ) import qualified Data.Map as Map hiding ( Map ) +import qualified Data.Set as Set hiding ( Set ) import Data.Function import Data.Ord ( comparing ) @@ -415,9 +416,11 @@ ppHtmlIndex odir doctitle _maybe_package themes getIfaceIndex iface = [ (getOccString name - , Map.fromList [(name, [(mdl, name `elem` instVisibleExports iface)])]) + , Map.fromList [(name, [(mdl, name `Set.member` visible)])]) | name <- instExports iface ] - where mdl = instMod iface + where + mdl = instMod iface + visible = Set.fromList (instVisibleExports iface) indexElt :: (String, Map GHC.Name [(Module,Bool)]) -> HtmlTable indexElt (str, entities) = -- cgit v1.2.3