From 34a994d64a3e1efd1fc4342202b55cfa99268de7 Mon Sep 17 00:00:00 2001
From: "sven.panne" <sven.panne@aedion.de>
Date: Thu, 20 Apr 2006 12:39:23 +0000
Subject: [PATCH] Avoid pattern guards

Due to the use of pattern guards in Haddock, GHC was called with
-fglasgow-exts. This in turn enables bang patterns, too, which broke the
Haddock build. Removing some unnecessary pattern guards seemed to be the
better way of fixing this instead of using a pragma to disable pattern
guards.
---
 haddock.cabal      |  2 +-
 src/HaddockHtml.hs | 21 ++++++++++-----------
 2 files changed, 11 insertions(+), 12 deletions(-)

diff --git a/haddock.cabal b/haddock.cabal
index daca969395..344bb0e40a 100644
--- a/haddock.cabal
+++ b/haddock.cabal
@@ -56,7 +56,7 @@ extra-source-files:
 executable: haddock
 hs-source-dirs: src
 main-is: Main.hs
-extensions: CPP, PatternGuards
+extensions: CPP
 other-modules:
 	Binary
 	BlockTable
diff --git a/src/HaddockHtml.hs b/src/HaddockHtml.hs
index c856149198..5c6bd89245 100644
--- a/src/HaddockHtml.hs
+++ b/src/HaddockHtml.hs
@@ -554,11 +554,10 @@ ifaceToHtml maybe_source_url maybe_wiki_url iface
 	contents = td << vanillaTable << ppModuleContents exports
 
 	description
-         | Just doc <- iface_doc iface
-         = (tda [theclass "section1"] << toHtml "Description") </>
-	   docBox (docToHtml doc)
-	 | otherwise
-	 = Html.emptyTable
+          = case iface_doc iface of
+              Nothing -> Html.emptyTable
+              Just doc -> (tda [theclass "section1"] << toHtml "Description") </>
+                          docBox (docToHtml doc)
 
 	-- omit the synopsis if there are no documentation annotations at all
 	synopsis
@@ -910,9 +909,9 @@ ppHsClassDecl summary links instances orig_c
 
 	hdr = ppClassHdr summary ctxt nm tvs fds
 
-	classdoc
-	   | Just d <- doc = ndocBox (docToHtml d)
-	   | otherwise     = Html.emptyTable
+	classdoc = case doc of
+                     Nothing -> Html.emptyTable
+                     Just d -> ndocBox (docToHtml d)
 
 	methods_bit
 	   | null decls = Html.emptyTable
@@ -1057,9 +1056,9 @@ ppHsQName n@(Qual mdl str)
   | otherwise		= linkId mdl (Just str) << ppHsName str
 
 isSpecial :: HsName -> Bool
-isSpecial (HsTyClsName id0) | HsSpecial _ <- id0 = True
-isSpecial (HsVarName id0)   | HsSpecial _ <- id0 = True
-isSpecial _                                      = False
+isSpecial (HsTyClsName (HsSpecial _)) = True
+isSpecial (HsVarName   (HsSpecial _)) = True
+isSpecial _                           = False
 
 ppHsName :: HsName -> Html
 ppHsName nm = toHtml (hsNameStr nm)
-- 
GitLab