Skip to content

Commit

Permalink
Fix thunk leak in CoreM's CoreWriter
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrew Farmer authored and Ian Lynagh committed Jun 4, 2013
1 parent cef115f commit d43d63f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion compiler/simplCore/CoreMonad.lhs
Expand Up @@ -762,7 +762,8 @@ instance Monad CoreM where
mx >>= f = CoreM $ \s -> do
(x, s', w1) <- unCoreM mx s
(y, s'', w2) <- unCoreM (f x) s'
return (y, s'', w1 `plusWriter` w2)
let w = w1 `plusWriter` w2 -- forcing w before returning avoids a space leak (Trac #7702)
return $ seq w (y, s'', w)
instance Applicative CoreM where
pure = return
Expand Down

0 comments on commit d43d63f

Please sign in to comment.