- (tyvars, theta, argTypes) = GHC.dataConSig dataCon
- tyCon = GHC.dataConTyCon dataCon
- labels = GHC.dataConFieldLabels dataCon
- res_tys = dataConResTys dataCon
- qualVars = filter (flip notElem (GHC.tyConTyVars tyCon)) tyvars
- stricts = GHC.dataConStrictMarks dataCon
- tys_w_strs = zip stricts argTypes
-
- ppr_tvs
- | null qualVars = empty
- | otherwise = ptext SLIT("forall") <+>
- hsep (map ppr qualVars) <> dot
-
- -- printing out the dataCon as a type signature, in GADT style
- pp_tau = foldr add pp_res_ty tys_w_strs
- pp_res_ty = GHC.pprTypeApp (ppr_bndr tyCon) res_tys
- add (str,ty) pp_ty = pprBangTy str ty <+> arrow <+> pp_ty
-
- pprParendBangTy (strict,ty)
- | GHC.isMarkedStrict strict = char '!' <> GHC.pprParendType ty
- | otherwise = GHC.pprParendType ty
-
- pprBangTy strict ty
- | GHC.isMarkedStrict strict = char '!' <> ppr ty
- | otherwise = ppr ty
+ (forall_tvs, theta, tau) = tcSplitSigmaTy (GHC.dataConUserType dataCon)
+ (arg_tys, res_ty) = tcSplitFunTys tau
+ labels = GHC.dataConFieldLabels dataCon
+ stricts = GHC.dataConStrictMarks dataCon
+ tys_w_strs = zip stricts arg_tys
+ pp_foralls | pefas = GHC.pprForAll forall_tvs
+ | otherwise = empty
+
+ pp_tau = foldr add (ppr res_ty) tys_w_strs
+ add str_ty pp_ty = pprParendBangTy str_ty <+> arrow <+> pp_ty
+
+ pprParendBangTy (bang,ty) = ppr bang <> GHC.pprParendType ty
+
+ pprBangTy bang ty = ppr bang <> ppr ty