aboutsummaryrefslogtreecommitdiff
path: root/src/HaddockHtml.hs
diff options
context:
space:
mode:
authordavve <davve@dtek.chalmers.se>2007-02-04 17:37:08 +0000
committerdavve <davve@dtek.chalmers.se>2007-02-04 17:37:08 +0000
commit357bc99bb13c68ffb6e1b10f6739fe5f753b9fe3 (patch)
tree4a5d4715f79bb4ffd86d370b3d404ca9c567acd4 /src/HaddockHtml.hs
parente93d48aff9e9b13f393e168e01b10de0bfd290f2 (diff)
Insert spaces around infix function names
Diffstat (limited to 'src/HaddockHtml.hs')
-rw-r--r--src/HaddockHtml.hs15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/HaddockHtml.hs b/src/HaddockHtml.hs
index 59ca8501..2ade78b9 100644
--- a/src/HaddockHtml.hs
+++ b/src/HaddockHtml.hs
@@ -1077,12 +1077,11 @@ expandField (HsFieldDecl ns ty doc) = [ HsFieldDecl [n] ty doc | n <- ns ]
ppDataHeader :: Bool -> NewOrData -> Name -> [Name] -> Html
ppDataHeader summary newOrData name tyvars =
- (if newOrData == NewType then keyword "newtype" else keyword "data") <+>
- (if infixConstr then ppName (tyvars!!0) <+> ppBinder summary name <+> ppName (tyvars!!1)
- else ppBinder summary name <+> hsep (map ppName tyvars))
- where
- -- there should be a better way to check this using the GHC API
- infixConstr = (head (nameOccString name) == ':') && (length tyvars == 2)
+ (if newOrData == NewType then keyword "newtype" else keyword "data")
+ <+>
+ (if isConSym name
+ then ppName (tyvars!!0) <+> ppBinder summary name <+> ppName (tyvars!!1)
+ else ppBinder summary name <+> hsep (map ppName tyvars))
-- ----------------------------------------------------------------------------
-- Types and contexts
@@ -1224,7 +1223,9 @@ ppBinder True nm = linkedAnchor (anchorNameStr nm) << ppBinder' nm
ppBinder False nm = linkTarget nm +++ bold << ppBinder' nm
ppBinder' :: Name -> Html
-ppBinder' name = toHtml (getOccString name)
+ppBinder' name
+ | isVarSym name = parens $ toHtml (getOccString name)
+ | otherwise = toHtml (getOccString name)
linkId :: Module -> Maybe Name -> Html -> Html
linkId mod mbName = anchor ! [href hr]