[commit: haddock] wip/ast-prepare-annotations-final5: Replace head with case/panic (0d6891a)

git at git.haskell.org git at git.haskell.org
Wed Jul 8 08:33:34 UTC 2015


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

On branch  : wip/ast-prepare-annotations-final5
Link       : http://git.haskell.org/haddock.git/commitdiff/0d6891a57ba43faba3995bce6a1a0a02889a21ed

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

commit 0d6891a57ba43faba3995bce6a1a0a02889a21ed
Author: Alan Zimmerman <alan.zimm at gmail.com>
Date:   Tue Nov 18 21:49:28 2014 +0200

    Replace head with case/panic


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

0d6891a57ba43faba3995bce6a1a0a02889a21ed
 src/Haddock/Backends/LaTeX.hs | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/Haddock/Backends/LaTeX.hs b/src/Haddock/Backends/LaTeX.hs
index d7469c9..ec3ea8d 100644
--- a/src/Haddock/Backends/LaTeX.hs
+++ b/src/Haddock/Backends/LaTeX.hs
@@ -26,6 +26,7 @@ import OccName
 import Name                 ( nameOccName )
 import RdrName              ( rdrNameOcc )
 import FastString           ( unpackFS, unpackLitString, zString )
+import Outputable           ( panic)
 
 import qualified Data.Map as Map
 import System.Directory
@@ -676,8 +677,10 @@ ppSideBySideConstr subdocs unicode leader (L _ con) =
     forall  = con_explicit con
     -- don't use "con_doc con", in case it's reconstructed from a .hi file,
     -- or also because we want Haddock to do the doc-parsing, not GHC.
-    mbDoc = lookup (unLoc $ head $ con_names con) subdocs >>=
-            combineDocumentation . fst
+    mbDoc = case con_names con of
+              [] -> panic "empty con_names"
+              (cn:_) -> lookup (unLoc cn) subdocs >>=
+                        combineDocumentation . fst
     mkFunTy a b = noLoc (HsFunTy a b)
 
 



More information about the ghc-commits mailing list