- ddump_deriving :: [InstInfo Name] -> HsValBinds Name -> SDoc
- ddump_deriving inst_infos extra_binds
- = hang (ptext (sLit "Derived instances"))
- 2 (vcat (map (\i -> pprInstInfoDetails i $$ text "") inst_infos)
- $$ ppr extra_binds)
+ ddump_deriving :: [InstInfo Name] -> HsValBinds Name
+ -> [MetaTyCons] -- ^ Empty data constructors
+ -> [TyCon] -- ^ Rep type family instances
+ -> [[(InstInfo RdrName, DerivAuxBinds)]]
+ -- ^ Instances for the repMetaTys
+ -> SDoc
+ ddump_deriving inst_infos extra_binds repMetaTys repTyCons metaInsts
+ = hang (ptext (sLit "Derived instances"))
+ 2 (vcat (map (\i -> pprInstInfoDetails i $$ text "") inst_infos)
+ $$ ppr extra_binds)
+ $$ hangP "Generic representation" (
+ hangP "Generated datatypes for meta-information"
+ (vcat (map ppr repMetaTys))
+ -- The Outputable instance for TyCon unfortunately only prints the name...
+ $$ hangP "Representation types"
+ (vcat (map ppr repTyCons))
+ $$ hangP "Meta-information instances"
+ (vcat (map (pprInstInfoDetails . fst) (concat metaInsts))))
+
+ hangP s x = text "" $$ hang (ptext (sLit s)) 2 x