<div dir="ltr">For anyone interested, here's a complete list of all foreign imports at the STG level from base and integer-simple:<div><br></div><div><a href="https://gist.github.com/chrisdone/24b476862b678a3665fbf9b833a9905f">https://gist.github.com/chrisdone/24b476862b678a3665fbf9b833a9905f</a><br></div><div><br></div><div>They all have type <span style="color:rgb(36,41,46);font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,monospace;font-size:12px;white-space:pre">(</span><span class="gmail-pl-k" style="box-sizing:border-box;color:rgb(215,58,73);font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,monospace;font-size:12px;white-space:pre">#</span><span style="color:rgb(36,41,46);font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,monospace;font-size:12px;white-space:pre"> </span><span class="gmail-pl-ent" style="box-sizing:border-box;color:rgb(34,134,58);font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,monospace;font-size:12px;white-space:pre">State</span><span class="gmail-pl-k" style="box-sizing:border-box;color:rgb(215,58,73);font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,monospace;font-size:12px;white-space:pre">#</span><span style="color:rgb(36,41,46);font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,monospace;font-size:12px;white-space:pre"> </span><span class="gmail-pl-ent" style="box-sizing:border-box;color:rgb(34,134,58);font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,monospace;font-size:12px;white-space:pre">RealWorld</span><span style="color:rgb(36,41,46);font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,monospace;font-size:12px;white-space:pre"> </span><span class="gmail-pl-k" style="box-sizing:border-box;color:rgb(215,58,73);font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,monospace;font-size:12px;white-space:pre">#</span><span style="color:rgb(36,41,46);font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,monospace;font-size:12px;white-space:pre">) or </span><span style="color:rgb(36,41,46);font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,monospace;font-size:12px;white-space:pre">(</span><span class="gmail-pl-k" style="box-sizing:border-box;color:rgb(215,58,73);font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,monospace;font-size:12px;white-space:pre">#</span><span style="color:rgb(36,41,46);font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,monospace;font-size:12px;white-space:pre"> </span><span class="gmail-pl-ent" style="box-sizing:border-box;color:rgb(34,134,58);font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,monospace;font-size:12px;white-space:pre">State</span><span class="gmail-pl-k" style="box-sizing:border-box;color:rgb(215,58,73);font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,monospace;font-size:12px;white-space:pre">#</span><span style="color:rgb(36,41,46);font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,monospace;font-size:12px;white-space:pre"> </span><span class="gmail-pl-ent" style="box-sizing:border-box;color:rgb(34,134,58);font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,monospace;font-size:12px;white-space:pre">RealWorld, <something></span><span style="color:rgb(36,41,46);font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,monospace;font-size:12px;white-space:pre"> </span><span class="gmail-pl-k" style="box-sizing:border-box;color:rgb(215,58,73);font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,monospace;font-size:12px;white-space:pre">#</span><span style="color:rgb(36,41,46);font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,monospace;font-size:12px;white-space:pre">).</span></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, 5 Nov 2019 at 15:18, Christopher Done <<a href="mailto:chrisdone@gmail.com">chrisdone@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div><p style="margin:0px 0px 1.2em">Aha, thanks Csaba. So I’m not losing my marbles. The AST has a type<br>signature of the “initial” but implements the “lowered”. So with<br><code style="font-size:0.85em;font-family:Consolas,Inconsolata,Courier,monospace;margin:0px 0.15em;padding:0px 0.3em;white-space:pre-wrap;border:1px solid rgb(234,234,234);background-color:rgb(248,248,248);border-radius:3px;display:inline">-ddump-stg</code> we can observe it:</p>
<p style="margin:0px 0px 1.2em">The version claimed in the type signature (returning a tuple):</p>
<pre style="font-family:Consolas,Inconsolata,Courier,monospace;font-size:1em;line-height:1.2em;margin:1.2em 0px"><code style="font-size:0.85em;font-family:Consolas,Inconsolata,Courier,monospace;margin:0px 0.15em;white-space:pre-wrap;overflow:auto;border-radius:3px;border:1px solid rgb(204,204,204);padding:0.5em;color:rgb(51,51,51);background:rgb(248,248,248);display:block"><span style="color:rgb(68,85,136);font-weight:bold">Foreign</span>.it :: <span style="color:rgb(68,85,136);font-weight:bold">Foreign</span>.<span style="color:rgb(68,85,136);font-weight:bold">C</span>.<span style="color:rgb(68,85,136);font-weight:bold">Types</span>.<span style="color:rgb(68,85,136);font-weight:bold">CDouble</span>
[<span style="color:rgb(68,85,136);font-weight:bold">GblId</span>] =
    [] \u []
        <span style="color:rgb(51,51,51);font-weight:bold">case</span> ds_r1HA <span style="color:rgb(51,51,51);font-weight:bold">of</span> {
          <span style="color:rgb(68,85,136);font-weight:bold">GHC</span>.<span style="color:rgb(68,85,136);font-weight:bold">Types</span>.<span style="color:rgb(68,85,136);font-weight:bold">D</span># ds2_s1HW [<span style="color:rgb(68,85,136);font-weight:bold">Occ</span>=<span style="color:rgb(68,85,136);font-weight:bold">Once</span>] ->
              <span style="color:rgb(51,51,51);font-weight:bold">case</span> __pkg_ccall_GC main [ds2_s1HW <span style="color:rgb(68,85,136);font-weight:bold">GHC</span>.<span style="color:rgb(68,85,136);font-weight:bold">Prim</span>.realWorld#] <span style="color:rgb(51,51,51);font-weight:bold">of</span> {
                (#,#) _ [<span style="color:rgb(68,85,136);font-weight:bold">Occ</span>=<span style="color:rgb(68,85,136);font-weight:bold">Dead</span>] ds4_s1I0 [<span style="color:rgb(68,85,136);font-weight:bold">Occ</span>=<span style="color:rgb(68,85,136);font-weight:bold">Once</span>] -> <span style="color:rgb(68,85,136);font-weight:bold">GHC</span>.<span style="color:rgb(68,85,136);font-weight:bold">Types</span>.<span style="color:rgb(68,85,136);font-weight:bold">D</span># [ds4_s1I0];
              };
        };
</code></pre>
<p style="margin:0px 0px 1.2em">The final “lowered” version:</p>
<pre style="font-family:Consolas,Inconsolata,Courier,monospace;font-size:1em;line-height:1.2em;margin:1.2em 0px"><code style="font-size:0.85em;font-family:Consolas,Inconsolata,Courier,monospace;margin:0px 0.15em;white-space:pre-wrap;overflow:auto;border-radius:3px;border:1px solid rgb(204,204,204);padding:0.5em;color:rgb(51,51,51);background:rgb(248,248,248);display:block"><span style="color:rgb(68,85,136);font-weight:bold">Foreign</span>.it :: <span style="color:rgb(68,85,136);font-weight:bold">Foreign</span>.<span style="color:rgb(68,85,136);font-weight:bold">C</span>.<span style="color:rgb(68,85,136);font-weight:bold">Types</span>.<span style="color:rgb(68,85,136);font-weight:bold">CDouble</span>
[<span style="color:rgb(68,85,136);font-weight:bold">GblId</span>] =
    [] \u []
        <span style="color:rgb(51,51,51);font-weight:bold">case</span> ds_r1HA <span style="color:rgb(51,51,51);font-weight:bold">of</span> {
          <span style="color:rgb(68,85,136);font-weight:bold">GHC</span>.<span style="color:rgb(68,85,136);font-weight:bold">Types</span>.<span style="color:rgb(68,85,136);font-weight:bold">D</span># ds2_s1HW [<span style="color:rgb(68,85,136);font-weight:bold">Occ</span>=<span style="color:rgb(68,85,136);font-weight:bold">Once</span>] ->
              <span style="color:rgb(51,51,51);font-weight:bold">case</span> __pkg_ccall_GC main [ds2_s1HW <span style="color:rgb(68,85,136);font-weight:bold">GHC</span>.<span style="color:rgb(68,85,136);font-weight:bold">Prim</span>.realWorld#] <span style="color:rgb(51,51,51);font-weight:bold">of</span> {
                <span style="color:rgb(68,85,136);font-weight:bold">Unit</span># ds4_s1I0 [<span style="color:rgb(68,85,136);font-weight:bold">Occ</span>=<span style="color:rgb(68,85,136);font-weight:bold">Once</span>] -> <span style="color:rgb(68,85,136);font-weight:bold">GHC</span>.<span style="color:rgb(68,85,136);font-weight:bold">Types</span>.<span style="color:rgb(68,85,136);font-weight:bold">D</span># [ds4_s1I0];
              };
        };
</code></pre>
<p style="margin:0px 0px 1.2em">Cheers!</p>
<p style="margin:0px 0px 1.2em">Chris</p>
<div title="MDH:QWhhLCB0aGFua3MgQ3NhYmEuIFNvIEknbSBub3QgbG9zaW5nIG15IG1hcmJsZXMuIFRoZSBBU1Qg
aGFzIGEgdHlwZTxicj5zaWduYXR1cmUgb2YgdGhlICJpbml0aWFsIiBidXQgaW1wbGVtZW50cyB0
aGUgImxvd2VyZWQiLiBTbyB3aXRoPGJyPmAtZGR1bXAtc3RnYCB3ZSBjYW4gb2JzZXJ2ZSBpdDo8
YnI+PGJyPlRoZSB2ZXJzaW9uIGNsYWltZWQgaW4gdGhlIHR5cGUgc2lnbmF0dXJlIChyZXR1cm5p
bmcgYSB0dXBsZSk6PGJyPjxicj5gYGAgaGFza2VsbDxicj5Gb3JlaWduLml0IDo6IEZvcmVpZ24u
Qy5UeXBlcy5DRG91YmxlPGJyPltHYmxJZF0gPTxicj7CoCDCoCBbXSBcdSBbXTxicj7CoCDCoCDC
oCDCoCBjYXNlIGRzX3IxSEEgb2Ygezxicj7CoCDCoCDCoCDCoCDCoCBHSEMuVHlwZXMuRCMgZHMy
X3MxSFcgW09jYz1PbmNlXSAtJmd0Ozxicj7CoCDCoCDCoCDCoCDCoCDCoCDCoCBjYXNlIF9fcGtn
X2NjYWxsX0dDIG1haW4gW2RzMl9zMUhXIEdIQy5QcmltLnJlYWxXb3JsZCNdIG9mIHs8YnI+wqAg
wqAgwqAgwqAgwqAgwqAgwqAgwqAgKCMsIykgXyBbT2NjPURlYWRdIGRzNF9zMUkwIFtPY2M9T25j
ZV0gLSZndDsgR0hDLlR5cGVzLkQjIFtkczRfczFJMF07PGJyPsKgIMKgIMKgIMKgIMKgIMKgIMKg
IH07PGJyPsKgIMKgIMKgIMKgIH07PGJyPmBgYDxicj48YnI+VGhlIGZpbmFsICJsb3dlcmVkIiB2
ZXJzaW9uOjxicj48YnI+YGBgIGhhc2tlbGw8YnI+Rm9yZWlnbi5pdCA6OiBGb3JlaWduLkMuVHlw
ZXMuQ0RvdWJsZTxicj5bR2JsSWRdID08YnI+wqAgwqAgW10gXHUgW108YnI+wqAgwqAgwqAgwqAg
Y2FzZSBkc19yMUhBIG9mIHs8YnI+wqAgwqAgwqAgwqAgwqAgR0hDLlR5cGVzLkQjIGRzMl9zMUhX
IFtPY2M9T25jZV0gLSZndDs8YnI+wqAgwqAgwqAgwqAgwqAgwqAgwqAgY2FzZSBfX3BrZ19jY2Fs
bF9HQyBtYWluIFtkczJfczFIVyBHSEMuUHJpbS5yZWFsV29ybGQjXSBvZiB7PGJyPsKgIMKgIMKg
IMKgIMKgIMKgIMKgIMKgIFVuaXQjIGRzNF9zMUkwIFtPY2M9T25jZV0gLSZndDsgR0hDLlR5cGVz
LkQjIFtkczRfczFJMF07PGJyPsKgIMKgIMKgIMKgIMKgIMKgIMKgIH07PGJyPsKgIMKgIMKgIMKg
IH07PGJyPmBgYDxicj48YnI+Q2hlZXJzITxicj48YnI+Q2hyaXM=" style="height:0px;width:0px;max-height:0px;max-width:0px;overflow:hidden;font-size:0em;padding:0px;margin:0px"></div></div></div>
</blockquote></div>