-- friends:
import HsTypes ( HsType )
import CoreSyn ( CoreExpr )
+import PprCore ( {- instance Outputable (Expr a) -} )
--others:
-import Name ( Name, isUnboundName )
+import Name ( Name )
+import PrelNames ( isUnboundName )
import NameSet ( NameSet, elemNameSet, nameSetToList )
import BasicTypes ( RecFlag(..), Fixity )
import Outputable
import SrcLoc ( SrcLoc )
import Var ( TyVar )
+import Class ( DefMeth (..) )
\end{code}
%************************************************************************
ppr_binds EmptyBinds = empty
ppr_binds (ThenBinds binds1 binds2)
- = ($$) (ppr_binds binds1) (ppr_binds binds2)
+ = ppr_binds binds1 $$ ppr_binds binds2
ppr_binds (MonoBind bind sigs is_rec)
- = vcat [ifNotPprForUser (ptext rec_str),
+ = vcat [ppr_isrec,
vcat (map ppr sigs),
ppr bind
]
where
- rec_str = case is_rec of
- Recursive -> SLIT("{- rec -}")
- NonRecursive -> SLIT("{- nonrec -}")
+ ppr_isrec = getPprStyle $ \ sty ->
+ if userStyle sty then empty else
+ case is_rec of
+ Recursive -> ptext SLIT("{- rec -}")
+ NonRecursive -> ptext SLIT("{- nonrec -}")
\end{code}
%************************************************************************
SrcLoc
| ClassOpSig name -- Selector name
- (Maybe -- Nothing for source-file class signatures
- (name, -- Default-method name (if any)
- Bool)) -- True <=> there is an explicit, programmer-supplied
- -- default declaration in the class decl
+ (DefMeth name) -- (Just dm_name) for source-file class signatures
+ -- The name may not be used, if there isn't a
+ -- generic default method, but it's there if we
+ -- need it
+ -- Gives DefMeth info for interface files sigs
(HsType name)
SrcLoc
= sep [ppr var <+> pp_dm <+> dcolon, nest 4 (ppr ty)]
where
pp_dm = case dm of
- Just (_, True) -> equals -- Default-method indicator
- other -> empty
+ DefMeth _ -> equals -- Default method indicator
+ GenDefMeth -> semi -- Generic method indicator
+ NoDefMeth -> empty -- No Method at all
ppr_sig (SpecSig var ty _)
= sep [ hsep [text "{-# SPECIALIZE", ppr var, dcolon],