On Wed, May 8, 2013 at 9:54 PM, Niklas Hambüchen <m...@nh2.me> wrote:

> If I run these steps one by one in ghci, garbage ends up in my handle as
> expected.
>
> However, if I "let main = do ..." this whole block in order to pack it
> in a test case, it does not happen, neither in ghci nor ghc.
>

ghci is in many ways like an endless (or at least until ":l"/":r")
do-block. In particular, the handle remains in scope after you run your
commands at the prompt, so it is not garbage collected.  If you enclose it
into its own do block, this introduces local scope and the handle goes out
of scope and is garbage collected at the end.

-- 
brandon s allbery kf8nh                               sine nomine associates
allber...@gmail.com                                  ballb...@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonad        http://sinenomine.net
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to