[commit: haddock] wip/ast-prepare-annotations-final3: Replace head with case/panic (044ac2a)

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


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

On branch  : wip/ast-prepare-annotations-final3
Link       : http://git.haskell.org/haddock.git/commitdiff/044ac2a9f2b93069f9031c2912269b30350010a9

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

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

    Replace head with case/panic


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

044ac2a9f2b93069f9031c2912269b30350010a9
 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 09e99d4..ac9f3ac 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
@@ -680,8 +681,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