aboutsummaryrefslogtreecommitdiff
path: root/haddock-api/src/Haddock/Backends
diff options
context:
space:
mode:
Diffstat (limited to 'haddock-api/src/Haddock/Backends')
-rw-r--r--haddock-api/src/Haddock/Backends/LaTeX.hs15
-rw-r--r--haddock-api/src/Haddock/Backends/Xhtml.hs7
-rw-r--r--haddock-api/src/Haddock/Backends/Xhtml/Decl.hs2
3 files changed, 9 insertions, 15 deletions
diff --git a/haddock-api/src/Haddock/Backends/LaTeX.hs b/haddock-api/src/Haddock/Backends/LaTeX.hs
index b66116bb..1222b3f1 100644
--- a/haddock-api/src/Haddock/Backends/LaTeX.hs
+++ b/haddock-api/src/Haddock/Backends/LaTeX.hs
@@ -1049,8 +1049,8 @@ ppr_mono_ty (HsAppTy _ fun_ty arg_ty) unicode
ppr_mono_ty (HsOpTy _ ty1 op ty2) unicode
= ppr_mono_lty ty1 unicode <+> ppr_op <+> ppr_mono_lty ty2 unicode
where
- ppr_op = if not (isSymOcc occName) then char '`' <> ppLDocName op <> char '`' else ppLDocName op
- occName = nameOccName . getName . unLoc $ op
+ ppr_op | isSymOcc (getOccName op) = ppLDocName op
+ | otherwise = char '`' <> ppLDocName op <> char '`'
ppr_mono_ty (HsParTy _ ty) unicode
= parens (ppr_mono_lty ty unicode)
@@ -1079,16 +1079,13 @@ ppr_tylit (HsStrTy _ s) _ = text (show s)
ppBinder :: OccName -> LaTeX
ppBinder n
- | isInfixName n = parens $ ppOccName n
- | otherwise = ppOccName n
+ | isSymOcc n = parens $ ppOccName n
+ | otherwise = ppOccName n
ppBinderInfix :: OccName -> LaTeX
ppBinderInfix n
- | isInfixName n = ppOccName n
- | otherwise = cat [ char '`', ppOccName n, char '`' ]
-
-isInfixName :: OccName -> Bool
-isInfixName n = isVarSym n || isConSym n
+ | isSymOcc n = ppOccName n
+ | otherwise = cat [ char '`', ppOccName n, char '`' ]
ppSymName :: Name -> LaTeX
ppSymName name
diff --git a/haddock-api/src/Haddock/Backends/Xhtml.hs b/haddock-api/src/Haddock/Backends/Xhtml.hs
index da8f7a53..9add4cae 100644
--- a/haddock-api/src/Haddock/Backends/Xhtml.hs
+++ b/haddock-api/src/Haddock/Backends/Xhtml.hs
@@ -39,7 +39,7 @@ import Haddock.GhcUtils
import Control.Monad ( when, unless )
import qualified Data.ByteString.Builder as Builder
import Data.Char ( toUpper, isSpace )
-import Data.List ( sortBy, isPrefixOf, intercalate, intersperse )
+import Data.List ( sortBy, isPrefixOf, intersperse )
import Data.Maybe
import System.Directory
import System.FilePath hiding ( (</>) )
@@ -388,7 +388,7 @@ ppJsonIndex odir maybe_source_url maybe_wiki_url unicode pkg qual_opt ifaces = d
| Just item_html <- processExport True links_info unicode pkg qual item
= [ Object
[ "display_html" .= String (showHtmlFragment item_html)
- , "name" .= String (intercalate " " (map nameString names))
+ , "name" .= String (unwords (map getOccString names))
, "module" .= String (moduleString mdl)
, "link" .= String (fromMaybe "" (listToMaybe (map (nameLink mdl) names)))
]
@@ -406,9 +406,6 @@ ppJsonIndex odir maybe_source_url maybe_wiki_url unicode pkg qual_opt ifaces = d
exportName ExportNoDecl { expItemName } = [expItemName]
exportName _ = []
- nameString :: NamedThing name => name -> String
- nameString = occNameString . nameOccName . getName
-
nameLink :: NamedThing name => Module -> name -> String
nameLink mdl = moduleNameUrl' (moduleName mdl) . nameOccName . getName
diff --git a/haddock-api/src/Haddock/Backends/Xhtml/Decl.hs b/haddock-api/src/Haddock/Backends/Xhtml/Decl.hs
index 395c0837..4492739b 100644
--- a/haddock-api/src/Haddock/Backends/Xhtml/Decl.hs
+++ b/haddock-api/src/Haddock/Backends/Xhtml/Decl.hs
@@ -696,7 +696,7 @@ instanceId origin no orphan ihd = concat $
[ "o:" | orphan ] ++
[ qual origin
, ":" ++ getOccString origin
- , ":" ++ (occNameString . getOccName . ihdClsName) ihd
+ , ":" ++ getOccString (ihdClsName ihd)
, ":" ++ show no
]
where