aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Waern <david.waern@gmail.com>2010-10-16 18:47:07 +0000
committerDavid Waern <david.waern@gmail.com>2010-10-16 18:47:07 +0000
commit1bd03d283f98d7841efd2ce4b75900f558e26c83 (patch)
treeecee6085e910967e08f15a2dd688a364602066d2
parent52a3bdb03333ef97f7d81a9b058eb07002b7909c (diff)
Style police
-rw-r--r--src/Haddock/Backends/Xhtml/Names.hs4
-rw-r--r--src/Haddock/Options.hs16
-rw-r--r--src/Main.hs2
3 files changed, 13 insertions, 9 deletions
diff --git a/src/Haddock/Backends/Xhtml/Names.hs b/src/Haddock/Backends/Xhtml/Names.hs
index d1423fc7..4d9f0739 100644
--- a/src/Haddock/Backends/Xhtml/Names.hs
+++ b/src/Haddock/Backends/Xhtml/Names.hs
@@ -42,6 +42,7 @@ ppRdrName = ppOccName . rdrNameOcc
ppLDocName :: Qualification -> Located DocName -> Html
ppLDocName qual (L _ d) = ppDocName qual d
+
-- | Render a name depending on the selected qualification mode
qualifyName :: Qualification -> DocName -> Html
qualifyName qual docName@(Documented name mdl) = case qual of
@@ -69,6 +70,7 @@ qualifyName qual docName@(Documented name mdl) = case qual of
-- this is just for exhaustiveness, but already handled by ppDocName
qualifyName _ (Undocumented name) = ppName name
+
ppDocName :: Qualification -> DocName -> Html
ppDocName qual docName@(Documented name mdl) =
linkIdOcc mdl (Just occName) << qualifyName qual docName
@@ -76,9 +78,11 @@ ppDocName qual docName@(Documented name mdl) =
ppDocName _ (Undocumented name) = ppName name
+
ppFullQualName :: Module -> Name -> Html
ppFullQualName mdl name = toHtml $ moduleString mdl ++ '.' : getOccString name
+
ppName :: Name -> Html
ppName name = toHtml (getOccString name)
diff --git a/src/Haddock/Options.hs b/src/Haddock/Options.hs
index 71be8f2e..f9c86811 100644
--- a/src/Haddock/Options.hs
+++ b/src/Haddock/Options.hs
@@ -24,7 +24,7 @@ module Haddock.Options (
wikiUrls,
optDumpInterfaceFile,
optLaTeXStyle,
- optQualification,
+ qualification,
verbosity,
ghcFlags,
readIfaceArgs
@@ -223,13 +223,13 @@ optLaTeXStyle :: [Flag] -> Maybe String
optLaTeXStyle flags = optLast [ str | Flag_LaTeXStyle str <- flags ]
-optQualification :: [Flag] -> Qualification
-optQualification flags =
- case map (map Char.toLower) [ str | Flag_Qualification str <- flags ] of
- "full":_ -> FullQual
- "local":_ -> LocalQual Nothing
- "relative":_ -> RelativeQual Nothing
- _ -> NoQual
+qualification :: [Flag] -> Qualification
+qualification flags =
+ case map (map Char.toLower) [ str | Flag_Qualification str <- flags ] of
+ "full":_ -> FullQual
+ "local":_ -> LocalQual Nothing
+ "relative":_ -> RelativeQual Nothing
+ _ -> NoQual
verbosity :: [Flag] -> Verbosity
diff --git a/src/Main.hs b/src/Main.hs
index 8cd6f169..2cf070de 100644
--- a/src/Main.hs
+++ b/src/Main.hs
@@ -192,7 +192,7 @@ render flags ifaces installedIfaces srcMap = do
opt_index_url = optIndexUrl flags
odir = outputDir flags
opt_latex_style = optLaTeXStyle flags
- opt_qualification = optQualification flags
+ opt_qualification = qualification flags
visibleIfaces = [ i | i <- ifaces, OptHide `notElem` ifaceOptions i ]