aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--html/haddock-util.js37
-rw-r--r--src/Haddock/Backends/Xhtml.hs7
-rw-r--r--src/Haddock/Interface.hs9
-rw-r--r--src/Main.hs2
4 files changed, 45 insertions, 10 deletions
diff --git a/html/haddock-util.js b/html/haddock-util.js
index 4a7e4255..9a6fccf7 100644
--- a/html/haddock-util.js
+++ b/html/haddock-util.js
@@ -50,11 +50,43 @@ toggleCollapser = makeClassToggle("collapser", "expander");
function toggleSection(id)
{
- var b = toggleShow(document.getElementById("section." + id))
- toggleCollapser(document.getElementById("control." + id), b)
+ var b = toggleShow(document.getElementById("section." + id));
+ toggleCollapser(document.getElementById("control." + id), b);
+ rememberCollapsed(id, b);
return b;
}
+var collapsed = {};
+function rememberCollapsed(id, b)
+{
+ if(b)
+ delete collapsed[id]
+ else
+ collapsed[id] = null;
+
+ var sections = [];
+ for(var i in collapsed)
+ {
+ if(collapsed.hasOwnProperty(i))
+ sections.push(i);
+ }
+ // cookie specific to this page; don't use setCookie which sets path=/
+ document.cookie = "collapsed=" + escape(sections.join('+'));
+}
+
+function restoreCollapsed()
+{
+ var cookie = getCookie("collapsed");
+ if(!cookie)
+ return;
+
+ var ids = cookie.split('+');
+ for(var i in ids)
+ {
+ if(document.getElementById("section." + ids[i]))
+ toggleSection(ids[i]);
+ }
+}
function setCookie(name, value) {
document.cookie = name + "=" + escape(value) + ";path=/;";
@@ -307,5 +339,6 @@ function pageLoad() {
addStyleMenu();
adjustForFrames();
resetStyle();
+ restoreCollapsed();
}
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) =
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
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.