From 8613e525f7cb0b1d669be383dd4b18f70af9a5f4 Mon Sep 17 00:00:00 2001
From: sheaf <sam.derbyshire@gmail.com>
Date: Fri, 7 Jul 2023 13:45:12 +0200
Subject: [PATCH] Avoid incomplete record update in Haddock Hoogle

This commit avoids running into an incomplete record update warning
in the Hoogle backend of Haddock.

This was only noticed now, because incomplete record updates were broken
in GHC 9.6. Now that they are fixed, we have to avoid running into them!

(cherry picked from commit b96241bad1cd59c65a89dab74e6cba114129e521)
---
 haddock-api/src/Haddock/Backends/Hoogle.hs | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/haddock-api/src/Haddock/Backends/Hoogle.hs b/haddock-api/src/Haddock/Backends/Hoogle.hs
index 4db3eaa57c..05e4b9e45b 100644
--- a/haddock-api/src/Haddock/Backends/Hoogle.hs
+++ b/haddock-api/src/Haddock/Backends/Hoogle.hs
@@ -178,7 +178,7 @@ pp_sig dflags names (L _ typ)  =
 
 -- note: does not yet output documentation for class methods
 ppClass :: DynFlags -> TyClDecl GhcRn -> [(Name, DocForDecl Name)] -> [String]
-ppClass dflags decl subdocs =
+ppClass dflags decl@(ClassDecl {}) subdocs =
   (out dflags decl{tcdSigs=[], tcdATs=[], tcdATDefs=[], tcdMeths=emptyLHsBinds}
     ++ ppTyFams) :  ppMethods
     where
@@ -204,7 +204,7 @@ ppClass dflags decl subdocs =
             , nest 4 . vcat . map (Outputable.<> semi) $ elems
             , rbrace
             ]
-
+ppClass _ _non_cls_decl _ = []
 ppFam :: DynFlags -> FamilyDecl GhcRn -> [String]
 ppFam dflags decl@(FamilyDecl { fdInfo = info })
   = [out dflags decl']
-- 
GitLab