- = ConDecl (Located name) -- Constructor name; this is used for the
- -- DataCon itself, and for the user-callable wrapper Id
-
- [LHsTyVarBndr name] -- Existentially quantified type variables
- (LHsContext name) -- ...and context
- -- If both are empty then there are no existentials
- (HsConDetails name (LBangType name))
-
- | GadtDecl (Located name) -- Constructor name; this is used for the
- -- DataCon itself, and for the user-callable wrapper Id
- (LHsType name) -- Constructor type; it may have HsBangs on the
- -- argument types
+ = ConDecl
+ { con_name :: Located name -- Constructor name; this is used for the
+ -- DataCon itself, and for the user-callable wrapper Id
+
+ , con_explicit :: HsExplicitForAll -- Is there an user-written forall? (cf. HStypes.HsForAllTy)
+
+ , con_qvars :: [LHsTyVarBndr name] -- ResTyH98: the constructor's existential type variables
+ -- ResTyGADT: all the constructor's quantified type variables
+
+ , con_cxt :: LHsContext name -- The context. This *does not* include the
+ -- "stupid theta" which lives only in the TyData decl
+
+ , con_details :: HsConDetails name (LBangType name) -- The main payload
+
+ , con_res :: ResType name -- Result type of the constructor
+ }
+
+data ResType name
+ = ResTyH98 -- Constructor was declared using Haskell 98 syntax
+ | ResTyGADT (LHsType name) -- Constructor was declared using GADT-style syntax,
+ -- and here is its result type