import Name ( Name )
import PrelNames ( isUnboundName )
import NameSet ( NameSet, elemNameSet, nameSetToList )
-import BasicTypes ( RecFlag(..), Fixity, Activation(..), pprPhase )
+import BasicTypes ( RecFlag(..), Fixity, Activation(..) )
import Outputable
import SrcLoc ( SrcLoc )
import Var ( TyVar )
-- and variables f = \x -> e
-- Reason: the Match stuff lets us have an optional
-- result type sig f :: a->a = ...mentions a...
+ --
+ -- This also means that instance decls can only have
+ -- FunMonoBinds, so if you change this, you'll need to
+ -- change e.g. rnMethodBinds
Bool -- True => infix declaration
[Match id pat]
SrcLoc
(fm,gm) -> fm
..ditto for gp..
- p = /\ [a,b] -> \ [d1,d2] -> letrec DBINDS and BIND
- in (fm,gm)
+ tp = /\ [a,b] -> \ [d1,d2] -> letrec DBINDS and BIND
+ in (fm,gm)
\begin{code}
-- We keep the invariant that a MonoBinds is only empty
\end{code}
\begin{code}
-hsSigDoc (Sig _ _ loc) = (SLIT("type signature"),loc)
-hsSigDoc (ClassOpSig _ _ _ loc) = (SLIT("class-method type signature"), loc)
-hsSigDoc (SpecSig _ _ loc) = (SLIT("SPECIALISE pragma"),loc)
-hsSigDoc (InlineSig True _ _ loc) = (SLIT("INLINE pragma"),loc)
-hsSigDoc (InlineSig False _ _ loc) = (SLIT("NOINLINE pragma"),loc)
-hsSigDoc (SpecInstSig _ loc) = (SLIT("SPECIALISE instance pragma"),loc)
-hsSigDoc (FixSig (FixitySig _ _ loc)) = (SLIT("fixity declaration"), loc)
+hsSigDoc (Sig _ _ loc) = (ptext SLIT("type signature"),loc)
+hsSigDoc (ClassOpSig _ _ _ loc) = (ptext SLIT("class-method type signature"), loc)
+hsSigDoc (SpecSig _ _ loc) = (ptext SLIT("SPECIALISE pragma"),loc)
+hsSigDoc (InlineSig True _ _ loc) = (ptext SLIT("INLINE pragma"),loc)
+hsSigDoc (InlineSig False _ _ loc) = (ptext SLIT("NOINLINE pragma"),loc)
+hsSigDoc (SpecInstSig _ loc) = (ptext SLIT("SPECIALISE instance pragma"),loc)
+hsSigDoc (FixSig (FixitySig _ _ loc)) = (ptext SLIT("fixity declaration"), loc)
\end{code}
\begin{code}
= sep [ppr var <+> dcolon, nest 4 (ppr ty)]
ppr_sig (ClassOpSig var dm ty _)
- = getPprStyle $ \ sty ->
- if ifaceStyle sty
- then sep [ ppr var <+> pp_dm <+> dcolon, nest 4 (ppr ty) ]
- else sep [ ppr_var var <+> dcolon,
- nest 4 (ppr ty),
- nest 4 (pp_dm_comment) ]
+ = sep [ ppr_var var <+> dcolon,
+ nest 4 (ppr ty),
+ nest 4 (pp_dm_comment) ]
where
pp_dm = case dm of
DefMeth _ -> equals -- Default method indicator
= hsep [text "{-# INLINE", ppr phase, ppr var, text "#-}"]
ppr_sig (InlineSig False var phase _)
- = hsep [text "{-# NOINLINE", pp_phase phase, ppr var, text "#-}"]
- where
- pp_phase NeverActive = empty -- NOINLINE f
- pp_phase (ActiveAfter n) = pprPhase n -- NOINLINE [2] f
- pp_phase AlwaysActive = text "ALWAYS?" -- Unexpected
+ = hsep [text "{-# NOINLINE", ppr phase, ppr var, text "#-}"]
ppr_sig (SpecInstSig ty _)
= hsep [text "{-# SPECIALIZE instance", ppr ty, text "#-}"]