From 43e82c0b4ca4b12674c26953793cf9924a972edc Mon Sep 17 00:00:00 2001 From: Joachim Breitner Date: Tue, 7 Oct 2014 11:12:22 +0000 Subject: [PATCH] Adjust Demo.hs --- Demo.hs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Demo.hs b/Demo.hs index 3618d86..2558984 100644 --- a/Demo.hs +++ b/Demo.hs @@ -31,7 +31,6 @@ main = do putStrLn "> args <- map length `fmap` getArgs" putStrLn $ "gives us at " ++ show (asBox args) ++ " a static, but at compile time unknown list:" getClosureData args >>= printInd - getClosureData [] >>= printInd putStrLn $ "And now we have, at " ++ show (asBox x) ++ ", the concatenation of them, but unevaluated:" putStrLn "> let x = l ++ l2 ++ args" putStrLn "The thunk keeps a reference to l2 and args, but not l, as that is at a static address, unless you are running this in GHCi:" @@ -59,7 +58,7 @@ main = do x `seq` return () putStrLn $ "So it is unevaluated. Let us evaluate it using seq. Now we have, still at " ++ show (asBox x) ++ ":" getClosureData x >>= printInd - IndClosure {indirectee = target} <- getClosureData x + target <- indirectee `fmap` getClosureData x putStrLn $ "The thunk was replaced by an indirection. If we look at the target, " ++ show target ++ ", we see that it is a newly created cons-cell referencing the original location of x:" getBoxedClosureData target >>= printInd performGC -- 2.20.1