-- The id is just a unique name to
-- identify this splice point
- | HsReify (HsReify id) -- reifyType t, reifyDecl i, reifyFixity
-
-----------------------------------------------------------
-- Arrow notation extension
ppr_expr (HsSplice n e _) = char '$' <> brackets (ppr n) <> pprParendExpr e
ppr_expr (HsBracket b _) = pprHsBracket b
ppr_expr (HsBracketOut e ps) = ppr e $$ ptext SLIT("where") <+> ppr ps
-ppr_expr (HsReify r) = ppr r
ppr_expr (HsProc pat (HsCmdTop cmd _ _ _) _)
= hsep [ptext SLIT("proc"), ppr pat, ptext SLIT("->"), pprExpr cmd]
%************************************************************************
\begin{code}
-data HsBracket id = ExpBr (HsExpr id)
- | PatBr (Pat id)
- | DecBr (HsGroup id)
- | TypBr (HsType id)
+data HsBracket id = ExpBr (HsExpr id) -- [| expr |]
+ | PatBr (Pat id) -- [p| pat |]
+ | DecBr (HsGroup id) -- [d| decls |]
+ | TypBr (HsType id) -- [t| type |]
+ | VarBr id -- 'x, ''T
instance OutputableBndr id => Outputable (HsBracket id) where
ppr = pprHsBracket
pprHsBracket (PatBr p) = thBrackets (char 'p') (ppr p)
pprHsBracket (DecBr d) = thBrackets (char 'd') (ppr d)
pprHsBracket (TypBr t) = thBrackets (char 't') (ppr t)
-
+pprHsBracket (VarBr n) = char '\'' <> ppr n
+ -- Infelicity: can't show ' vs '', because
+ -- we can't ask n what its OccName is, because the
+ -- pretty-printer for HsExpr doesn't ask for NamedThings
+ -- But the pretty-printer for names will show the OccName class
thBrackets pp_kind pp_body = char '[' <> pp_kind <> char '|' <+>
pp_body <+> ptext SLIT("|]")
-
-data HsReify id = Reify ReifyFlavour id -- Pre typechecking
- | ReifyOut ReifyFlavour Name -- Post typechecking
- -- The Name could be the name of
- -- an Id, TyCon, or Class
-
-data ReifyFlavour = ReifyDecl | ReifyType | ReifyFixity
-
-instance Outputable id => Outputable (HsReify id) where
- ppr (Reify flavour id) = ppr flavour <+> ppr id
- ppr (ReifyOut flavour thing) = ppr flavour <+> ppr thing
-
-instance Outputable ReifyFlavour where
- ppr ReifyDecl = ptext SLIT("reifyDecl")
- ppr ReifyType = ptext SLIT("reifyType")
- ppr ReifyFixity = ptext SLIT("reifyFixity")
\end{code}
%************************************************************************