Fix interface-file syntax wibble (when printing both rules and deprecations)
, pprFixities (mi_fixities iface) (dcl_tycl decls)
, pprIfaceDecls (vers_decls version_info) decls
, pprFixities (mi_fixities iface) (dcl_tycl decls)
, pprIfaceDecls (vers_decls version_info) decls
- , pprDeprecs (mi_deprecs iface)
+ , pprRulesAndDeprecs (dcl_rules decls) (mi_deprecs iface)
]
where
version_info = mi_version iface
]
where
version_info = mi_version iface
pprIfaceDecls version_map decls
= vcat [ vcat [ppr i <+> semi | i <- dcl_insts decls]
, vcat (map ppr_decl (dcl_tycl decls))
pprIfaceDecls version_map decls
= vcat [ vcat [ppr i <+> semi | i <- dcl_insts decls]
, vcat (map ppr_decl (dcl_tycl decls))
- , pprRules (dcl_rules decls)
]
where
ppr_decl d = ppr_vers d <+> ppr d <> semi
]
where
ppr_decl d = ppr_vers d <+> ppr d <> semi
(n,_) <- tyClDeclNames d,
Just fix <- [lookupNameEnv fixity_map n]] <> semi
(n,_) <- tyClDeclNames d,
Just fix <- [lookupNameEnv fixity_map n]] <> semi
-pprRules [] = empty
-pprRules rules = hsep [ptext SLIT("{-## __R"), vcat (map ppr rules), ptext SLIT("##-}")]
-
-pprDeprecs NoDeprecs = empty
-pprDeprecs deprecs = ptext SLIT("{-## __D") <+> guts <+> ptext SLIT("##-}")
- where
- guts = case deprecs of
- DeprecAll txt -> doubleQuotes (ptext txt)
- DeprecSome env -> pp_deprecs env
+-- Disgusting to print these two together, but that's
+-- the way the interface parser currently expects them.
+pprRulesAndDeprecs [] NoDeprecs = empty
+pprRules rules deprecs
+ = ptext SLIT("{-##") <+> (pp_rules rules $$ pp_deprecs deprecs) <+> ptext SLIT("##-}")
+ where
+ pp_rules [] = empty
+ pp_rules rules = ptext SLIT("__R") <+> vcat (map ppr rules)
+
+ ppr_deprecs NoDeprecs = empty
+ ppr_deprecs deprecs = ptext SLIT("__D") <+> guts
+ where
+ guts = case deprecs of
+ DeprecAll txt -> doubleQuotes (ptext txt)
+ DeprecSome env -> pp_deprecs env
pp_deprecs env = vcat (punctuate semi (map pp_deprec (nameEnvElts env)))
where
pp_deprecs env = vcat (punctuate semi (map pp_deprec (nameEnvElts env)))
where