diff options
author | David Waern <davve@dtek.chalmers.se> | 2007-09-29 14:15:37 +0000 |
---|---|---|
committer | David Waern <davve@dtek.chalmers.se> | 2007-09-29 14:15:37 +0000 |
commit | 3f683df722c3c2b7aba70d15daf95593fd6be96d (patch) | |
tree | 01d370d2e8323cf4089fba653923a9f1abb7db3b | |
parent | e390c635fc817df5da56c67a72988fe77f2b0318 (diff) |
Use isLexConSym/isLexVarSym from OccName
-rw-r--r-- | src/Haddock/Backends/Html.hs | 8 | ||||
-rw-r--r-- | src/Haddock/GHC/Utils.hs | 9 |
2 files changed, 7 insertions, 10 deletions
diff --git a/src/Haddock/Backends/Html.hs b/src/Haddock/Backends/Html.hs index e0bf0d20..734f408e 100644 --- a/src/Haddock/Backends/Html.hs +++ b/src/Haddock/Backends/Html.hs @@ -1125,10 +1125,10 @@ ppDataHead :: Bool -> Name -> [Name] -> Html ppDataHead summary name tyvars -- (a :+: b) c d - | isNameSymOcc name && length tyvars > 2 = parens first2 <+> rest + | isNameConSym name && length tyvars > 2 = parens first2 <+> rest -- a :+: b - | isNameSymOcc name = first2 + | isNameConSym name = first2 -- Would like a case for: -- a `O` b @@ -1243,7 +1243,7 @@ ppr_mono_ty ctxt_prec (HsOpTy ty1 op ty2) = maybeParen ctxt_prec pREC_OP $ ppr_mono_lty pREC_OP ty1 <+> ppr_op <+> ppr_mono_lty pREC_OP ty2 where - ppr_op = if not (isNameSymOcc name) then quote (ppLDocName op) else ppLDocName op + ppr_op = if not (isNameConSym name) then quote (ppLDocName op) else ppLDocName op name = lDocLinkName op ppr_mono_ty ctxt_prec (HsParTy ty) @@ -1288,7 +1288,7 @@ ppBinder False nm = linkTarget nm +++ bold << ppBinder' nm ppBinder' :: Name -> Html ppBinder' name - | isVarSym name = parens $ toHtml (getOccString name) + | isNameVarSym name = parens $ toHtml (getOccString name) | otherwise = toHtml (getOccString name) linkId :: Module -> Maybe Name -> Html -> Html diff --git a/src/Haddock/GHC/Utils.hs b/src/Haddock/GHC/Utils.hs index 26860116..5e8142e5 100644 --- a/src/Haddock/GHC/Utils.hs +++ b/src/Haddock/GHC/Utils.hs @@ -52,13 +52,10 @@ modulePkgStr = packageIdString . modulePackageId -- misc -isNameSymOcc = isSymOcc . nameOccName - --- there should be a better way to check this using the GHC API -isConSym n = head (nameOccString n) == ':' -isVarSym n = fstChar /= '_' && not (isConSym n) && (not . isLetter) fstChar - where fstChar = head (nameOccString n) +isNameSym = isSymOcc . nameOccName +isNameVarSym = isLexVarSym . occNameFS . nameOccName +isNameConSym = isLexConSym . occNameFS . nameOccName getMainDeclBinder :: HsDecl name -> Maybe name |