summaryrefslogtreecommitdiff
path: root/ghc/compiler/hsSyn/HsExpr.lhs
diff options
context:
space:
mode:
authorsimonpj <unknown>2002-10-09 16:53:13 +0000
committersimonpj <unknown>2002-10-09 16:53:13 +0000
commitaadb64aa5644f2a3ad8a645e2c7a1e72c2f61e53 (patch)
tree9471c5ecb560e8b477183cb4ad893058e18c681a /ghc/compiler/hsSyn/HsExpr.lhs
parent316f8291d7a68c54f3ae235dad06f0e2eb33f0e5 (diff)
downloadhaskell-aadb64aa5644f2a3ad8a645e2c7a1e72c2f61e53.tar.gz
[project @ 2002-10-09 16:53:10 by simonpj]
Fix to mdo, plus SrcLocs on splices and brackets
Diffstat (limited to 'ghc/compiler/hsSyn/HsExpr.lhs')
-rw-r--r--ghc/compiler/hsSyn/HsExpr.lhs17
1 files changed, 11 insertions, 6 deletions
diff --git a/ghc/compiler/hsSyn/HsExpr.lhs b/ghc/compiler/hsSyn/HsExpr.lhs
index e295905961..0ff1823bef 100644
--- a/ghc/compiler/hsSyn/HsExpr.lhs
+++ b/ghc/compiler/hsSyn/HsExpr.lhs
@@ -164,13 +164,13 @@ data HsExpr id
(HsExpr id) -- expr whose cost is to be measured
-- MetaHaskell Extensions
- | HsBracket (HsBracket id)
+ | HsBracket (HsBracket id) SrcLoc
| HsBracketOut (HsBracket Name) -- Output of the type checker is the *original*
[PendingSplice] -- renamed expression, plus *typechecked* splices
-- to be pasted back in by the desugarer
- | HsSplice id (HsExpr id ) -- $z or $(f 4)
+ | HsSplice id (HsExpr id) SrcLoc -- $z or $(f 4)
-- The id is just a unique name to
-- identify this splice point
\end{code}
@@ -389,8 +389,8 @@ ppr_expr (DictApp expr dnames)
ppr_expr (HsType id) = ppr id
-ppr_expr (HsSplice n e) = char '$' <> brackets (ppr n) <> pprParendExpr e
-ppr_expr (HsBracket b) = pprHsBracket b
+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
-- add parallel array brackets around a document
@@ -585,8 +585,13 @@ data Stmt id
-- The ids are a subset of the variables bound by the stmts that
-- either (a) are used before they are bound in the stmts
-- or (b) are used in stmts that follow the RecStmt
- | RecStmt [id]
+ | RecStmt [id]
[Stmt id]
+ [HsExpr id] -- Post type-checking only; these expressions correspond
+ -- 1-to-1 with the [id], and are the expresions that should
+ -- be returned by the recursion. They may not quite be the
+ -- Ids themselves, because the Id may be polymorphic, but
+ -- the returned thing has to be monomorphic.
\end{code}
ExprStmts and ResultStmts are a bit tricky, because what they mean
@@ -644,7 +649,7 @@ pprStmt (ParStmt stmtss)
= hsep (map (\stmts -> ptext SLIT("| ") <> ppr stmts) stmtss)
pprStmt (ParStmtOut stmtss)
= hsep (map (\stmts -> ptext SLIT("| ") <> ppr stmts) stmtss)
-pprStmt (RecStmt _ segment) = vcat (map ppr segment)
+pprStmt (RecStmt _ segment _) = vcat (map ppr segment)
pprDo :: OutputableBndr id => HsStmtContext any -> [Stmt id] -> SDoc
pprDo DoExpr stmts = hang (ptext SLIT("do")) 2 (vcat (map ppr stmts))