From 7e2264730d6c05eceb9309fced1d6a3116edc233 Mon Sep 17 00:00:00 2001 From: David Waern Date: Sat, 29 Sep 2007 15:17:40 +0000 Subject: Take care when pp tyvars - add parens on syms --- src/Haddock/Backends/Html.hs | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'src/Haddock') 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 -- cgit v1.2.3