Andrei Borzenkov pushed to branch wip/sand-witch/gadt-layout-refact at Glasgow Haskell Compiler / GHC Commits: 561d459e by Andrei Borzenkov at 2026-11-18T17:16:54+04:00 Refactor ConDeclGADT to allow nested foralls and contexts (27425) This patch refactors GADT prefix constructor layout, allowing interleaved `forall`s, contexts, and value arguments. The main change: ```diff data ConDecl pass = ConDeclGADT { ... - , con_inner_bndrs :: [LHsGadtTelescope pass] - , con_cxts :: [LHsContext pass] , con_g_args :: HsConDeclGADTDetails pass ... } | .... ``` Telescopes and contexts were moved into `HsConDeclGADTDetails` and are now represented by `HsGadtArg`: ```haskell data HsConDeclGADTDetails pass = PrefixConGADT !(XPrefixConGADT pass) [LHsGadtArg pass] -- new! | RecConGADT !(XRecConGADT pass) (Maybe (LHsContext pass)) -- new! (XRec pass [LHsConDeclRecField pass]) ``` The RecConGADT constructor now has a `Maybe LHsContext` field to enforce the distinction between prefix constructors and record constructors. `HsGadtTelescope` was renamed to `HsGadtArg` because it can now represent contexts and value arguments in addition to previously supported parentheses and telescopes. Compiler subsystems that assume the old signature ordering: typechecking template-haskell (both ways) HIE generation check-exact several places in Haddock no-changelog - - - - - 43 changed files: - compiler/GHC/Hs/Decls.hs - compiler/GHC/Hs/Instances.hs - compiler/GHC/Hs/Type.hs - compiler/GHC/Hs/Utils.hs - compiler/GHC/HsToCore/Docs.hs - compiler/GHC/HsToCore/Errors/Ppr.hs - compiler/GHC/HsToCore/Errors/Types.hs - compiler/GHC/HsToCore/Quote.hs - compiler/GHC/Iface/Ext/Ast.hs - compiler/GHC/Parser/PostProcess.hs - compiler/GHC/Parser/PostProcess/Haddock.hs - compiler/GHC/Rename/HsType.hs - compiler/GHC/Rename/Module.hs - compiler/GHC/Tc/Gen/HsType.hs - compiler/GHC/Tc/TyCl.hs - compiler/GHC/ThToHs.hs - compiler/Language/Haskell/Syntax/Decls.hs - compiler/Language/Haskell/Syntax/Type.hs - testsuite/tests/gadt/T12087b.stderr - testsuite/tests/gadt/T16427.stderr - testsuite/tests/gadt/T27423b.stderr - testsuite/tests/haddock/should_compile_flag_haddock/T17544.stderr - testsuite/tests/haddock/should_compile_flag_haddock/T17544_kw.stderr - testsuite/tests/parser/should_compile/DumpParsedAst.stderr - testsuite/tests/parser/should_compile/DumpRenamedAst.stderr - testsuite/tests/parser/should_compile/T15323.stderr - testsuite/tests/printer/T18791.stderr - + testsuite/tests/th/GadtConSigs_th_contextAfterValue.hs - + testsuite/tests/th/GadtConSigs_th_contextAfterValue.stderr - + testsuite/tests/th/GadtConSigs_th_forallAfterContext.hs - + testsuite/tests/th/GadtConSigs_th_forallAfterContext.stderr - + testsuite/tests/th/GadtConSigs_th_forallAfterValue.hs - + testsuite/tests/th/GadtConSigs_th_forallAfterValue.stderr - testsuite/tests/th/all.T - utils/check-exact/ExactPrint.hs - utils/haddock/haddock-api/src/Haddock/Backends/Hoogle.hs - utils/haddock/haddock-api/src/Haddock/Backends/LaTeX.hs - utils/haddock/haddock-api/src/Haddock/Backends/Xhtml/Decl.hs - utils/haddock/haddock-api/src/Haddock/Convert.hs - utils/haddock/haddock-api/src/Haddock/GhcUtils.hs - utils/haddock/haddock-api/src/Haddock/Interface/Create.hs - utils/haddock/haddock-api/src/Haddock/Interface/Rename.hs - utils/haddock/haddock-api/src/Haddock/Types.hs The diff was not included because it is too large. View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/561d459e338cedd61cf9b20cd9c8129e... -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/561d459e338cedd61cf9b20cd9c8129e... You're receiving this email because of your account on gitlab.haskell.org. Manage all notifications: https://gitlab.haskell.org/-/profile/notifications | Help: https://gitlab.haskell.org/help
participants (1)
-
Andrei Borzenkov (@sand-witch)