[project @ 2001-09-12 11:05:34 by qrczak]
[ghc-hetmet.git] / ghc / compiler / hsSyn / HsExpr.lhs
index b7d4573..ad3a25d 100644 (file)
@@ -17,6 +17,7 @@ import HsTypes                ( HsType )
 import HsImpExp                ( isOperator )
 
 -- others:
+import Name            ( Name )
 import ForeignCall     ( Safety )
 import Outputable      
 import PprType         ( pprParendType )
@@ -60,6 +61,7 @@ data HsExpr id pat
   -- They are eventually removed by the type checker.
 
   | NegApp     (HsExpr id pat) -- negated expr
+               Name            -- Name of 'negate' (see RnEnv.lookupSyntaxName)
 
   | HsPar      (HsExpr id pat) -- parenthesised expr
 
@@ -248,7 +250,7 @@ ppr_expr (OpApp e1 op fixity e2)
                | otherwise    = char '`' <> ppr v <> char '`'
                -- Put it in backquotes if it's not an operator already
 
-ppr_expr (NegApp e) = char '-' <+> pprParendExpr e
+ppr_expr (NegApp e _) = char '-' <+> pprParendExpr e
 
 ppr_expr (HsPar e) = parens (ppr_expr e)
 
@@ -295,7 +297,7 @@ ppr_expr (HsLet binds expr)
         hang (ptext SLIT("in"))  2 (ppr expr)]
 
 ppr_expr (HsWith expr binds)
-  = hsep [ppr expr, ptext SLIT("with"), ppr binds]
+  = hsep [ppr expr, ptext SLIT("with"), pp_ipbinds binds]
 
 ppr_expr (HsDo do_or_list_comp stmts _)            = pprDo do_or_list_comp stmts
 ppr_expr (HsDoOut do_or_list_comp stmts _ _ _ _ _) = pprDo do_or_list_comp stmts
@@ -409,6 +411,13 @@ pp_rbinds thing rbinds
           hsep [ppr v, char '=', ppr e]
 \end{code}
 
+\begin{code}
+pp_ipbinds :: (Outputable id, Outputable pat)
+          => [(id, HsExpr id pat)] -> SDoc
+pp_ipbinds pairs = hsep (punctuate semi (map pp_item pairs))
+                where
+                  pp_item (id,rhs) = char '?' <> ppr id <+> equals <+> ppr_expr rhs
+\end{code}
 
 
 %************************************************************************