IMPORT_DELOOPER(HsLoop) ( pprMatches, pprGRHSsAndBinds,
Match, GRHSsAndBinds,
pprExpr, HsExpr )
-#else
-import {-# SOURCE #-} HsMatches ( pprMatches, Match, pprGRHSsAndBinds, GRHSsAndBinds )
-import {-# SOURCE #-} HsExpr ( pprExpr, HsExpr )
#endif
import HsPragmas ( GenPragmas, ClassOpPragmas )
import SrcLoc ( SrcLoc{-instances-} )
import TyVar ( GenTyVar{-instances-} )
import Unique ( Unique {- instance Eq -} )
+
+#if __GLASGOW_HASKELL__ >= 202
+import {-# SOURCE #-} HsExpr ( pprExpr, HsExpr )
+import {-# SOURCE #-} HsMatches ( pprMatches, Match, pprGRHSsAndBinds, GRHSsAndBinds )
+#endif
+
\end{code}
%************************************************************************
= ($$) (ppr_monobind sty binds1) (ppr_monobind sty binds2)
ppr_monobind sty (PatMonoBind pat grhss_n_binds locn)
- = hang (ppr sty pat) 4 (pprGRHSsAndBinds sty False grhss_n_binds)
+ = sep [ppr sty pat, nest 4 (pprGRHSsAndBinds sty False grhss_n_binds)]
ppr_monobind sty (FunMonoBind fun inf matches locn)
= pprMatches sty (False, ppr sty fun) matches
-- ToDo: print infix if appropriate
ppr_monobind sty (VarMonoBind name expr)
- = hang (hsep [ppr sty name, equals]) 4 (pprExpr sty expr)
+ = sep [ppr sty name <+> equals, nest 4 (pprExpr sty expr)]
ppr_monobind sty (CoreMonoBind name expr)
- = hang (hsep [ppr sty name, equals]) 4 (ppr sty expr)
+ = sep [ppr sty name <+> equals, nest 4 (ppr sty expr)]
ppr_monobind sty (AbsBinds tyvars dictvars exports val_binds)
= ($$) (sep [ptext SLIT("AbsBinds"),
SrcLoc
| ClassOpSig name -- Selector name
- name -- Default-method name
+ (Maybe name) -- Default-method name (if any)
(HsType name)
SrcLoc
ppr_sig sty (Sig var ty _)
- = hang (hsep [ppr sty var, ptext SLIT("::")])
- 4 (ppr sty ty)
+ = sep [ppr sty var <+> ptext SLIT("::"),
+ nest 4 (ppr sty ty)]
ppr_sig sty (ClassOpSig var _ ty _)
- = hang (hsep [ppr sty (getOccName var), ptext SLIT("::")])
- 4 (ppr sty ty)
+ = sep [ppr sty (getOccName var) <+> ptext SLIT("::"),
+ nest 4 (ppr sty ty)]
ppr_sig sty (DeforestSig var _)
- = hang (hsep [text "{-# DEFOREST", ppr sty var])
- 4 (text "#-")
+ = hsep [text "{-# DEFOREST", ppr sty var, text "#-}"]
ppr_sig sty (SpecSig var ty using _)
- = hang (hsep [text "{-# SPECIALIZE", ppr sty var, ptext SLIT("::")])
- 4 (hsep [ppr sty ty, pp_using using, text "#-}"])
-
+ = sep [ hsep [text "{-# SPECIALIZE", ppr sty var, ptext SLIT("::")],
+ nest 4 (hsep [ppr sty ty, pp_using using, text "#-}"])
+ ]
where
pp_using Nothing = empty
pp_using (Just me) = hsep [char '=', ppr sty me]
ppr_sig sty (InlineSig var _)
-
= hsep [text "{-# INLINE", ppr sty var, text "#-}"]
ppr_sig sty (MagicUnfoldingSig var str _)