[commit: haddock] wip/ast-prepare-annotations-final6: Replace head with case/panic (e5c8fda)

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


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

On branch  : wip/ast-prepare-annotations-final6
Link       : http://git.haskell.org/haddock.git/commitdiff/e5c8fdab729c98527d132f4a68760430e1f59141

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

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

    Replace head with case/panic


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

e5c8fdab729c98527d132f4a68760430e1f59141
 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