diff options
author | Dr. ERDI Gergo <gergo@erdi.hu> | 2014-01-31 00:55:50 +0800 |
---|---|---|
committer | Dr. ERDI Gergo <gergo@erdi.hu> | 2014-01-31 01:03:17 +0800 |
commit | 039b2346cd7a9998135636146ea234eb9cc0fbab (patch) | |
tree | 79312a767c40b3ba2c35148184e3702fa41afe2b /src/Haddock/Backends/Xhtml.hs | |
parent | 18e9417edcda21dd23edf675b41f46ab336d773f (diff) |
Handle infix vs prefix names correctly everywhere, by explicitly specifying the context
The basic idea is that "a" and "+" are either pretty-printed as "a" and "(+)" or "`a`" and "+"
Diffstat (limited to 'src/Haddock/Backends/Xhtml.hs')
-rw-r--r-- | src/Haddock/Backends/Xhtml.hs | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/Haddock/Backends/Xhtml.hs b/src/Haddock/Backends/Xhtml.hs index 567abced..ac4282fb 100644 --- a/src/Haddock/Backends/Xhtml.hs +++ b/src/Haddock/Backends/Xhtml.hs @@ -587,25 +587,25 @@ processForMiniSynopsis mdl unicode qual (ExportDecl (L _loc decl0) _doc _ _insts (ClassDecl {}) -> [keyword "class" <+> b] _ -> [] SigD (TypeSig lnames (L _ _)) -> - map (ppNameMini mdl . nameOccName . getName . unLoc) lnames + map (ppNameMini False mdl . nameOccName . getName . unLoc) lnames _ -> [] processForMiniSynopsis _ _ qual (ExportGroup lvl _id txt) = [groupTag lvl << docToHtml qual txt] processForMiniSynopsis _ _ _ _ = [] -ppNameMini :: Module -> OccName -> Html -ppNameMini mdl nm = +ppNameMini :: Bool -> Module -> OccName -> Html +ppNameMini is_infix mdl nm = anchor ! [ href (moduleNameUrl mdl nm) , target mainFrameName ] - << ppBinder' False nm + << ppBinder' is_infix nm ppTyClBinderWithVarsMini :: Module -> TyClDecl DocName -> Html ppTyClBinderWithVarsMini mdl decl = let n = tcdName decl ns = tyvarNames $ tcdTyVars decl -- it's safe to use tcdTyVars, see code above - in ppTypeApp n ns (ppNameMini mdl . nameOccName . getName) ppTyName + in ppTypeApp n ns (\is_infix -> ppNameMini is_infix mdl . nameOccName . getName) ppTyName ppModuleContents :: Qualification -> [ExportItem DocName] -> Html @@ -653,10 +653,10 @@ processExport summary _ _ qual (ExportGroup lev id0 doc) processExport summary links unicode qual (ExportDecl decl doc subdocs insts) = processDecl summary $ ppDecl summary links decl doc insts subdocs unicode qual processExport summary _ _ qual (ExportNoDecl y []) - = processDeclOneLiner summary $ ppDocName qual y + = processDeclOneLiner summary $ ppDocName qual (Just False) y processExport summary _ _ qual (ExportNoDecl y subs) = processDeclOneLiner summary $ - ppDocName qual y +++ parenList (map (ppDocName qual) subs) + ppDocName qual (Just False) y +++ parenList (map (ppDocName qual (Just False)) subs) processExport summary _ _ qual (ExportDoc doc) = nothingIf summary $ docSection_ qual doc processExport summary _ _ _ (ExportModule mdl) |