[project @ 2003-07-24 14:41:48 by simonpj]
[ghc-hetmet.git] / ghc / compiler / hsSyn / HsExpr.lhs
index d34d4b9..5eff473 100644 (file)
@@ -195,7 +195,7 @@ data HsExpr id
                        -- False => left-to-right (arg >- f)
        SrcLoc
 
-  | HsArrForm  -- Command formation,  (| e |) cmd1 .. cmdn
+  | HsArrForm  -- Command formation,  (| e cmd1 .. cmdn |)
        (HsExpr id)     -- the operator
                        -- after type-checking, a type abstraction to be
                        -- applied to the type of the local environment tuple
@@ -286,7 +286,7 @@ ppr_expr (HsLam match) = pprMatch LambdaExpr match
 
 ppr_expr expr@(HsApp e1 e2)
   = let (fun, args) = collect_args expr [] in
-    (ppr_expr fun) <+> (sep (map ppr_expr args))
+    (ppr_expr fun) <+> (sep (map pprParendExpr args))
   where
     collect_args (HsApp fun arg) args = collect_args fun (arg:args)
     collect_args fun            args = (fun, args)
@@ -447,8 +447,8 @@ ppr_expr (HsArrApp arrow arg _ HsHigherOrderApp False _)
 ppr_expr (HsArrForm (HsVar v) (Just _) [arg1, arg2] _)
   = sep [pprCmdArg arg1, hsep [pprInfix v, pprCmdArg arg2]]
 ppr_expr (HsArrForm op _ args _)
-  = hang (ptext SLIT("(|") <> pprExpr op <> ptext SLIT("|)"))
-        4 (sep (map pprCmdArg args))
+  = hang (ptext SLIT("(|") <> pprExpr op)
+        4 (sep (map pprCmdArg args) <> ptext SLIT("|)"))
 
 pprCmdArg :: OutputableBndr id => HsCmdTop id -> SDoc
 pprCmdArg (HsCmdTop cmd@(HsArrForm _ Nothing [] _) _ _ _) = pprExpr cmd
@@ -509,6 +509,9 @@ The legal constructors for commands are:
 
   | HsArrForm ...              -- as above
 
+  | HsApp      (HsCmd id)
+               (HsExpr id)
+
   | HsLam      (Match  id)     -- kappa
 
   -- the renamer turns this one into HsArrForm