summaryrefslogtreecommitdiff
path: root/ST.hs
diff options
context:
space:
mode:
Diffstat (limited to 'ST.hs')
-rw-r--r--ST.hs20
1 files changed, 20 insertions, 0 deletions
diff --git a/ST.hs b/ST.hs
new file mode 100644
index 0000000000..6a235bcf1e
--- /dev/null
+++ b/ST.hs
@@ -0,0 +1,20 @@
+module Main where
+
+import GHC.Exts.Heap
+import System.Mem
+
+main = foo 100
+
+loop 0 = foo 0
+loop n = print ("ITERATION", n) >> foo n >> loop (n-1)
+
+{-# NOINLINE foo #-}
+foo 0 = () <$ getStack
+foo n = print "x" >> foo (n - 1) >> print "x"
+
+getStack = do
+ fs <- getCurrentStackData
+ print fs
+ getLine
+ print (length fs)
+ getLine