diff options
author | David Waern <david.waern@gmail.com> | 2008-04-12 14:02:18 +0000 |
---|---|---|
committer | David Waern <david.waern@gmail.com> | 2008-04-12 14:02:18 +0000 |
commit | 732ec0cf87e799bd4b8d198ffac7bd9a1b2a1d73 (patch) | |
tree | d88a2c4d4ece01d7934c1f0514f7e0c8bfc79870 | |
parent | a75db99a9c2fb5b22a65c0a5b030c855dd1d8cba (diff) |
Fix printing of data binders
-rw-r--r-- | src/Haddock/Backends/Html.hs | 8 | ||||
-rw-r--r-- | src/Haddock/GHC/Utils.hs | 4 |
2 files changed, 9 insertions, 3 deletions
diff --git a/src/Haddock/Backends/Html.hs b/src/Haddock/Backends/Html.hs index 45bffdcd..2350839a 100644 --- a/src/Haddock/Backends/Html.hs +++ b/src/Haddock/Backends/Html.hs @@ -1292,7 +1292,7 @@ ppr_fun_ty ctxt_prec ty1 ty2 -- Names ppOccName :: OccName -> Html -ppOccName name = toHtml $ occNameString name +ppOccName = toHtml . occNameString ppRdrName :: RdrName -> Html ppRdrName = ppOccName . rdrNameOcc @@ -1311,16 +1311,18 @@ linkTarget n = namedAnchor (anchorNameStr n) << toHtml "" ppName :: Name -> Html ppName name = toHtml (getOccString name) + ppBinder :: Bool -> OccName -> Html -- The Bool indicates whether we are generating the summary, in which case -- the binder will be a link to the full definition. ppBinder True n = linkedAnchor (anchorNameStr n) << ppBinder' n ppBinder False n = linkTarget n +++ bold << ppBinder' n + ppBinder' :: OccName -> Html ppBinder' n - | isSymOcc n = parens $ toHtml (occNameString n) - | otherwise = toHtml (occNameString n) + | isVarSym n = parens $ ppOccName n + | otherwise = ppOccName n linkId mod mbName = linkIdOcc mod (fmap nameOccName mbName) diff --git a/src/Haddock/GHC/Utils.hs b/src/Haddock/GHC/Utils.hs index eae73597..843c11b8 100644 --- a/src/Haddock/GHC/Utils.hs +++ b/src/Haddock/GHC/Utils.hs @@ -39,6 +39,10 @@ isNameSym :: Name -> Bool isNameSym = isSymOcc . nameOccName +isVarSym :: OccName -> Bool +isVarSym = isLexVarSym . occNameFS + + getMainDeclBinder :: HsDecl name -> Maybe name getMainDeclBinder (TyClD d) = Just (tcdName d) getMainDeclBinder (ValD d) |