bound_exprs = map snd binds
-- For each bind check if the bind is used by res or any of the bound
-- expressions
- dobind (bndr, _) = not $ any (expr_uses_binders [bndr]) (res:bound_exprs)
+ dobind (bndr, _) = any (expr_uses_binders [bndr]) (res:bound_exprs)
-- Leave all other expressions unchanged
letremoveunused expr = return expr
letremoveunusedtop = everywhere ("letremoveunused", letremoveunused)
-- Normalize this expression
trace ("Transforming " ++ what ++ "\nBefore:\n\n" ++ showSDoc ( ppr expr' ) ++ "\n") $ return ()
expr'' <- dotransforms transforms expr'
- trace ("\nAfter:\n\n" ++ showSDoc ( ppr expr')) $ return ()
+ trace ("\nAfter:\n\n" ++ showSDoc ( ppr expr'')) $ return ()
return expr''
-- | Get the value that is bound to the given binder at top level. Fails when