exprIsHNF should "look through" lets
authorsimonpj@microsoft.com <unknown>
Tue, 17 Nov 2009 12:55:26 +0000 (12:55 +0000)
committersimonpj@microsoft.com <unknown>
Tue, 17 Nov 2009 12:55:26 +0000 (12:55 +0000)
I can't quite remember when I spotted this, but exprIsHNF (and
similarly exprIsConLike) should ignore enclosing let-bindings,
since they don't affect termination.

compiler/coreSyn/CoreUtils.lhs

index 58beaf0..d200f81 100644 (file)
@@ -736,6 +736,7 @@ exprIsHNFlike is_con is_con_unf = is_hnf_like
     is_hnf_like (Cast e _)       = is_hnf_like e
     is_hnf_like (App e (Type _)) = is_hnf_like e
     is_hnf_like (App e a)        = app_is_value e [a]
+    is_hnf_like (Let _ e)        = is_hnf_like e  -- Lazy let(rec)s don't affect us
     is_hnf_like _                = False
 
     -- There is at least one value argument