<div dir="ltr">P.S.<br>I'd like to emphasize that this is produced by GHC and GHC's codegen compiles it properly to a working executable.<br></div><br><div class="gmail_quote"><div dir="ltr">On Fri, Nov 2, 2018 at 10:18 PM Csaba Hruska <<a href="mailto:csaba.hruska@gmail.com">csaba.hruska@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div dir="ltr"><div>Hello,</div><div><br></div><div>I added an STG exporter to my modified GHC to do experiments with the STG representation of the program.</div><div>I noticed that there are multiple top-level binders for <b><span style="font-family:monospace,monospace">Main.main</span></b> function.</div><div>Is this a convention or a bug?</div><div><br></div><div>Regards,</div><div>Csaba Hruska<br></div><div><br></div><div>Here is an example code snippet of the exported STG of the Main module:<br><div style="margin-left:40px"><font size="1"><span style="font-family:monospace,monospace">Main.main2 =<br>  closure (F:) (B:) {<br>  case Main.$wupto 1# 10000000#<br>  of sat.s16537 {<br>    DEFAULT -><br>      case Main.$wxsum 0# sat.s16537<br>      of ww.s16538 {<br>        DEFAULT -><br>          case GHC.Show.$wshowSignedInt<br>                 0# ww.s16538 GHC.Types.[]<br>          of ww4.s16539 {<br>            GHC.Prim.(#,#) ww5.s16540 ww6.s16541 -><br>              GHC.Types.:<br>                ww5.s16540 ww6.s16541<br>          }<br>      }<br>  }}<br><br>Main.main1 =<br>  closure (F:) (B: void.040) {<br>  GHC.IO.Handle.Text.hPutStr2<br>    GHC.IO.Handle.FD.stdout<br>    Main.main2<br>    GHC.Types.True<br>    GHC.Prim.void#}<br><br><b>Main.main</b> =<br>  closure (F:) (B: void.040) {<br>  Main.main1 GHC.Prim.void#}<br><br>Main.main3 =<br>  closure (F:) (B: void.040) {<br>  GHC.TopHandler.runMainIO1<br>    Main.main1 GHC.Prim.void#}<br><br><b>Main.main</b> =<br>  closure (F:) (B: void.040) {<br>  Main.main3 GHC.Prim.void#}<br></span></font></div><br></div></div></div></blockquote></div>