Draft: Introduce and use ConGadtSigBody (preparatory refactor for #18389)
This patch removes the con_g_args :: HsConDeclGADTDetails pass
and
con_res_ty :: LHsType pass
fields of ConDeclGADT
in favor of a unified
con_body :: ConGadtSigBody pass
field. There are two major differences
between HsConDeclGADTDetails
and ConGadtSigBody
:
-
HsConDeclGADTDetails
only contains the argument type, whileConGadtSigBody
contains both the argument and result types. - The
PrefixConGADT
constructor ofConGadtSigBody
now uses a newPrefixConGadtSigBody
data type.PrefixConGadtSigBody
closely mirrors the structure ofHsType
, but with minor, data constructor–specific tweaks. This will become vital in a future patch which implements nestedforall
s and contexts in prefix GADT constructor types (see #18389).
Besides the refactoring in the GHC API (and some minor changes in GHC AST–related test cases) this does not introduce any user-visible changes in behavior.