From 2c5337d3f05b1cfb70e2fa63818c453cfc09eb42 Mon Sep 17 00:00:00 2001 From: "simonpj@microsoft.com" Date: Fri, 22 Sep 2006 19:04:36 +0000 Subject: [PATCH] Improve specialisation in SpecConstr This patch enables argToPat to look through let expressions e.g. f (let v = rhs in \y -> ...v...) Here we can specialise for f (\y -> ...) because the rule-matcher will look through the let. --- compiler/specialise/SpecConstr.lhs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/compiler/specialise/SpecConstr.lhs b/compiler/specialise/SpecConstr.lhs index 8bba247..e5583e1 100644 --- a/compiler/specialise/SpecConstr.lhs +++ b/compiler/specialise/SpecConstr.lhs @@ -875,6 +875,13 @@ argToPat in_scope con_env (Var v) arg_occ then return (True, Var v) else wildCardPat (idType v) +argToPat in_scope con_env (Let _ arg) arg_occ + = argToPat in_scope con_env arg arg_occ + -- Look through let expressions + -- e.g. f (let v = rhs in \y -> ...v...) + -- Here we can specialise for f (\y -> ...) + -- because the rule-matcher will look through the let. + argToPat in_scope con_env arg arg_occ | is_value_lam arg = return (True, arg) -- 1.7.10.4