[commit: haddock] wip/ast-prepare-annotations, wip/ast-prepare-annotations-final: Only print as a list when it is a list of names (c209a37)

git at git.haskell.org git at git.haskell.org
Wed Jul 8 08:32:52 UTC 2015


Repository : ssh://git@git.haskell.org/haddock

On branches: wip/ast-prepare-annotations,wip/ast-prepare-annotations-final
Link       : http://git.haskell.org/haddock.git/commitdiff/c209a37e001f5df4de584b7fa109abecf2d345d9

>---------------------------------------------------------------

commit c209a37e001f5df4de584b7fa109abecf2d345d9
Author: Alan Zimmerman <alan.zimm at gmail.com>
Date:   Sat Nov 8 19:08:22 2014 +0200

    Only print as a list when it is a list of names


>---------------------------------------------------------------

c209a37e001f5df4de584b7fa109abecf2d345d9
 src/Haddock/Backends/LaTeX.hs      |  4 +++-
 src/Haddock/Backends/Xhtml/Decl.hs | 20 ++++++++++++++++----
 2 files changed, 19 insertions(+), 5 deletions(-)

diff --git a/src/Haddock/Backends/LaTeX.hs b/src/Haddock/Backends/LaTeX.hs
index 458e484..b0bb3da 100644
--- a/src/Haddock/Backends/LaTeX.hs
+++ b/src/Haddock/Backends/LaTeX.hs
@@ -671,7 +671,9 @@ ppSideBySideConstr subdocs unicode leader (L _ con) =
 
     header_ = ppConstrHdr forall tyVars context
     occ     = map (nameOccName . getName . unLoc) $ con_name con
-    ppOcc   = cat (punctuate comma (map ppBinder occ))
+    ppOcc   = case occ of
+      [one] -> ppBinder one
+      _     -> cat (punctuate comma (map ppBinder occ))
     ltvs    = con_qvars con
     tyVars  = tyvarNames (con_qvars con)
     context = unLoc (con_cxt con)
diff --git a/src/Haddock/Backends/Xhtml/Decl.hs b/src/Haddock/Backends/Xhtml/Decl.hs
index 92f2052..9189846 100644
--- a/src/Haddock/Backends/Xhtml/Decl.hs
+++ b/src/Haddock/Backends/Xhtml/Decl.hs
@@ -634,8 +634,14 @@ ppShortConstrParts summary dataInst con unicode qual = case con_res con of
 
     header_  = ppConstrHdr forall_ tyVars context
     occ        = map (nameOccName . getName . unLoc) $ con_name con
-    ppOcc      = hsep (punctuate comma (map (ppBinder summary) occ))
-    ppOccInfix = hsep (punctuate comma (map (ppBinderInfix summary) occ))
+
+    ppOcc      = case occ of
+      [one] -> ppBinder summary one
+      _     -> hsep (punctuate comma (map (ppBinder summary) occ))
+
+    ppOccInfix = case occ of
+      [one] -> ppBinderInfix summary one
+      _     -> hsep (punctuate comma (map (ppBinderInfix summary) occ))
 
     ltvs     = con_qvars con
     tyVars   = tyvarNames ltvs
@@ -701,8 +707,14 @@ ppSideBySideConstr subdocs fixities unicode qual (L _ con) = (decl, mbDoc, field
     fixity  = ppFixities fixities qual
     header_ = ppConstrHdr forall_ tyVars context unicode qual
     occ        = map (nameOccName . getName . unLoc) $ con_name con
-    ppOcc      = hsep (punctuate comma (map (ppBinder False) occ))
-    ppOccInfix = hsep (punctuate comma (map (ppBinderInfix False) occ))
+
+    ppOcc      = case occ of
+      [one] -> ppBinder False one
+      _     -> hsep (punctuate comma (map (ppBinder False) occ))
+
+    ppOccInfix = case occ of
+      [one] -> ppBinderInfix False one
+      _     -> hsep (punctuate comma (map (ppBinderInfix False) occ))
 
     ltvs    = con_qvars con
     tyVars  = tyvarNames (con_qvars con)



More information about the ghc-commits mailing list