aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Waern <davve@dtek.chalmers.se>2007-09-29 15:17:40 +0000
committerDavid Waern <davve@dtek.chalmers.se>2007-09-29 15:17:40 +0000
commit7e2264730d6c05eceb9309fced1d6a3116edc233 (patch)
tree5ace8354934bb86816650a26dc4ceca1723dc6ac
parente8408a72e48ff49f857cc48e18e2b9b24cf847d6 (diff)
Take care when pp tyvars - add parens on syms
-rw-r--r--src/Haddock/Backends/Html.hs17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/Haddock/Backends/Html.hs b/src/Haddock/Backends/Html.hs
index a8caef72..84d68f2e 100644
--- a/src/Haddock/Backends/Html.hs
+++ b/src/Haddock/Backends/Html.hs
@@ -716,7 +716,7 @@ ppSig summary links loc mbDoc (TypeSig lname ltype)
do_args leader t
= argBox (leader <+> ppType t) <-> rdocBox (noHtml)
-ppTyVars tvs = map ppName (tyvarNames tvs)
+ppTyVars tvs = ppTyNames (tyvarNames tvs)
tyvarNames = map f
where f x = let NoLink n = hsTyVarName (unLoc x) in n
@@ -737,6 +737,15 @@ ppLType (L _ t) = ppType t
ppTypeSig :: Bool -> Name -> (HsType DocName) -> Html
ppTypeSig summary nm ty = ppBinder summary nm <+> dcolon <+> ppType ty
+
+ppTyName name
+ | isNameSym name = parens (ppName name)
+ | otherwise = ppName name
+
+
+ppTyNames = map ppTyName
+
+
--------------------------------------------------------------------------------
-- Contexts
--------------------------------------------------------------------------------
@@ -1136,11 +1145,11 @@ ppDataHead summary name tyvars
-- but GHC doesn't keep this information
-- T a b c
- | otherwise = ppBinder summary name <+> hsep (map ppName tyvars)
+ | otherwise = ppBinder summary name <+> hsep (ppTyNames tyvars)
where
- first2 = ppName a <+> ppBinder summary name <+> ppName b
- rest = hsep $ map ppName restTypes
+ first2 = ppTyName a <+> ppBinder summary name <+> ppTyName b
+ rest = hsep $ ppTyNames restTypes
a:b:restTypes = tyvars