From f1b1d5f0d4d26794e76a10703d0b646269e41c87 Mon Sep 17 00:00:00 2001 From: simonmar Date: Fri, 25 Feb 2000 10:49:30 +0000 Subject: [PATCH] [project @ 2000-02-25 10:49:30 by simonmar] Make the desugarer a little more liberal about the class of case expressions which get the special unboxed tuple treatment. --- ghc/compiler/deSugar/DsExpr.lhs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/ghc/compiler/deSugar/DsExpr.lhs b/ghc/compiler/deSugar/DsExpr.lhs index 7b1a96e..036fea8 100644 --- a/ghc/compiler/deSugar/DsExpr.lhs +++ b/ghc/compiler/deSugar/DsExpr.lhs @@ -301,8 +301,8 @@ dsExpr (HsSCC cc expr) -- special case to handle unboxed tuple patterns. -dsExpr (HsCase discrim matches@[Match _ [TuplePat ps boxed] _ _] src_loc) - | not boxed && all var_pat ps +dsExpr (HsCase discrim matches src_loc) + | all ubx_tuple_match matches = putSrcLocDs src_loc $ dsExpr discrim `thenDs` \ core_discrim -> matchWrapper CaseMatch matches "case" `thenDs` \ ([discrim_var], matching_code) -> @@ -310,6 +310,9 @@ dsExpr (HsCase discrim matches@[Match _ [TuplePat ps boxed] _ _] src_loc) Case (Var x) bndr alts | x == discrim_var -> returnDs (Case core_discrim bndr alts) _ -> panic ("dsExpr: tuple pattern:\n" ++ showSDoc (ppr matching_code)) + where + ubx_tuple_match (Match _ [TuplePat ps False{-unboxed-}] _ _) = True + ubx_tuple_match _ = False dsExpr (HsCase discrim matches src_loc) = putSrcLocDs src_loc $ -- 1.7.10.4