X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2FhsSyn%2FHsExpr.lhs;h=bbb271204237627537b49ca55e0c76717fcfc46d;hb=3444b48ef7644c235d7f164f8837090dc30c23bb;hp=e5d85ca08e58d801b62b44e2f4a8312fbb8d6a98;hpb=f098cfb236c17bcb3c46e39f9b1d7d8d8ca86003;p=ghc-hetmet.git diff --git a/compiler/hsSyn/HsExpr.lhs b/compiler/hsSyn/HsExpr.lhs index e5d85ca..bbb2712 100644 --- a/compiler/hsSyn/HsExpr.lhs +++ b/compiler/hsSyn/HsExpr.lhs @@ -378,8 +378,8 @@ ppr_expr exprType@(HsLam matches) where idType :: HsExpr id -> HsMatchContext id; idType = undefined ppr_expr exprType@(HsCase expr matches) - = sep [ sep [ptext (sLit "case"), nest 4 (ppr expr), ptext (sLit "of")], - nest 2 (pprMatches (CaseAlt `asTypeOf` idType exprType) matches) ] + = sep [ sep [ptext (sLit "case"), nest 4 (ppr expr), ptext (sLit "of {")], + nest 2 (pprMatches (CaseAlt `asTypeOf` idType exprType) matches <+> char '}') ] where idType :: HsExpr id -> HsMatchContext id; idType = undefined ppr_expr (HsIf e1 e2 e3) @@ -663,9 +663,12 @@ data Match id -- Nothing after typechecking (GRHSs id) +isEmptyMatchGroup :: MatchGroup id -> Bool +isEmptyMatchGroup (MatchGroup ms _) = null ms + matchGroupArity :: MatchGroup id -> Arity matchGroupArity (MatchGroup [] _) - = panic "matchGroupArity" -- MatchGroup is never empty + = panic "matchGroupArity" -- Precondition: MatchGroup is non-empty matchGroupArity (MatchGroup (match:matches) _) = ASSERT( all ((== n_pats) . length . hsLMatchPats) matches ) -- Assertion just checks that all the matches have the same number of pats