pprTyThingHdr exts (AClass cls) = pprClassHdr exts cls
pprTyConHdr exts tyCon =
- ptext keyword <+> ppr_bndr tyCon <+> hsep (map ppr vars)
+ addFamily (ptext keyword) <+> ppr_bndr tyCon <+> hsep (map ppr vars)
where
vars | GHC.isPrimTyCon tyCon ||
GHC.isFunTyCon tyCon = take (GHC.tyConArity tyCon) GHC.alphaTyVars
| GHC.isNewTyCon tyCon = SLIT("newtype")
| otherwise = SLIT("data")
+ addFamily keytext
+ | GHC.isOpenTyCon tyCon = keytext <> ptext SLIT(" family")
+ | otherwise = keytext
+
pprDataConSig exts dataCon =
ppr_bndr dataCon <+> dcolon <+> pprType exts (GHC.dataConType dataCon)
pprTyCon exts tyCon
| GHC.isSynTyCon tyCon
- = let rhs_type = GHC.synTyConRhs tyCon
- in hang (pprTyConHdr exts tyCon <+> equals) 2 (pprType exts rhs_type)
+ = if GHC.isOpenTyCon tyCon
+ then pprTyConHdr exts tyCon <+> dcolon <+>
+ pprType exts (GHC.synTyConResKind tyCon)
+ else
+ let rhs_type = GHC.synTyConType tyCon
+ in hang (pprTyConHdr exts tyCon <+> equals) 2 (pprType exts rhs_type)
| otherwise
= pprAlgTyCon exts tyCon (const True) (const True)