<br><br><div class="gmail_quote">On Thu, Oct 14, 2010 at 1:53 PM, Mihai Maruseac <span dir="ltr">&lt;<a href="mailto:mihai.maruseac@gmail.com">mihai.maruseac@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Hi,<br>
<br>
Is there a way to determine the order in which thunks are created and<br>
expanded/evaluated in Haskell (GHC)? I&#39;m looking mainly at some<br>
existing interface but if there is only something in the GHC source it<br>
will suffice.<br></blockquote><div><br></div><div>You&#39;ll want to look at STG (spineless tagless G-Machine).  See here and the linked paper:</div><div><a href="http://www.haskell.org/haskellwiki/Ministg">http://www.haskell.org/haskellwiki/Ministg</a></div>
<div><br></div><div>I don&#39;t know of any way to examine this for a running program.  You can get GHC to spit out core and STG using -ddump-core and -ddump-stg flags:</div><div><a href="http://www.haskell.org/ghc/docs/6.12.2/html/users_guide/options-debugging.html#id595218">http://www.haskell.org/ghc/docs/6.12.2/html/users_guide/options-debugging.html#id595218</a></div>
<div><br></div><div>I hope that helps,</div><div>Jason</div></div>