From: Matthijs Kooijman Date: Sun, 21 Jun 2009 16:09:20 +0000 (+0200) Subject: Add an empty let before starting normalization. X-Git-Url: https://git.stderr.nl/gitweb?a=commitdiff_plain;h=17852552fb024c01f8f8d76c8668c5327c32d4ff;p=matthijs%2Fmaster-project%2Fc%CE%BBash.git Add an empty let before starting normalization. This ensures that every expression will always contain a let at the top level, since none of the transforms will remove the last let (lets are only merged when two are nested). --- diff --git a/Normalize.hs b/Normalize.hs index 93e89b6..57af912 100644 --- a/Normalize.hs +++ b/Normalize.hs @@ -442,6 +442,10 @@ normalizeBind bndr = do expr_maybe <- getGlobalBind bndr case expr_maybe of Just expr -> do + -- Introduce an empty Let at the top level, so there will always be + -- a let in the expression (none of the transformations will remove + -- the last let). + let expr' = Let (Rec []) expr -- Normalize this expression trace ("Transforming " ++ (show bndr) ++ "\nBefore:\n\n" ++ showSDoc ( ppr expr ) ++ "\n") $ return () expr' <- dotransforms transforms expr