<div dir="ltr"><div style>This is an exciting effort! Just a quick reaction to Simon&#39;s comments on CoreM.</div><div><br></div><div>On Tue, Jul 2, 2013 at 9:11 AM, Simon Peyton-Jones <span dir="ltr">&lt;<a href="mailto:simonpj@microsoft.com" target="_blank">simonpj@microsoft.com</a>&gt;</span> wrote:<br>

</div><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">





<div lang="EN-GB" link="blue" vlink="purple">
<div>
<p>To your questions:<br></p><p><u></u></p>
<p style="margin-left:36pt">
<u></u><span style="font-family:Symbol"><span>·<span style="font-style:normal;font-variant:normal;font-weight:normal;font-size:7pt;line-height:normal;font-family:&#39;Times New Roman&#39;">       
</span></span></span><u></u>To do these kind of things, CoreM will need more reader stuff.  In particular:<u></u><u></u></p>
<p style="margin-left:72pt">
<u></u><span style="font-family:&#39;Courier New&#39;"><span>o<span style="font-style:normal;font-variant:normal;font-weight:normal;font-size:7pt;line-height:normal;font-family:&#39;Times New Roman&#39;">  
</span></span></span><u></u>The global TypeEnv<u></u><u></u></p>
<p style="margin-left:72pt">
<u></u><span style="font-family:&#39;Courier New&#39;"><span>o<span style="font-style:normal;font-variant:normal;font-weight:normal;font-size:7pt;line-height:normal;font-family:&#39;Times New Roman&#39;">  
</span></span></span><u></u>The GlobalRdrEnv</p></div></div></blockquote><div style>For my light experimentation, I have recovered these two values from the ModGuts that all plugins receive. Hopefully someone will shout out if there&#39;s pitfalls to avoid.</div>

<div style><br></div><div style>  * The mg_rdr_env field is of type GlobalRdrEnv.</div><div style><br></div><div style>  * compiler/main/GHC.hs defines a function compileCore with a local definition that rebuilds a TypeEnv. I extracted this:</div>

<div style><br></div><div style>&gt; \guts -&gt; HscTypes.typeEnvFromEntities (CoreSyn.bindersOfBinds (mg_binds guts))</div><div>&gt;                                            (mg_tcs guts)</div><div>&gt;                                            (mg_fam_insts guts)</div>

<div><br></div><div style>and it has worked so far.</div><div style><br></div><div style>HTH and good luck!</div></div></div></div>