Oleg,<br><br>I am using GHC 6.12.3<br><br>Here a reproduction:<br><br>in the file Template.hs<br><br>proc () = runIO $ do runQ [|1+1|]<br>proc&#39; () = [|1+1|]<br><br><br>In the file Main.hs<br><br><br>i1 = $(proc ())      -- fails at compile time with &quot;Segmentation fault/access violation in generated code&quot;. Maybe is it the expected behavior, I do not know.<br>

i2 = $(proc&#39; ())     -- sucessfull<br><br>i3 = proc() -- sucessful but proc is executed at &quot;runtime&quot; <br>
<br>main = ...<br><br>Hope it is clear enough otherwise let me know.<br><br>Regards<br><br>J-C<br><br><br><div class="gmail_quote">On Mon, Nov 29, 2010 at 4:45 AM,  <span dir="ltr">&lt;<a href="mailto:oleg@okmij.org">oleg@okmij.org</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br>
Hello!<br>
<div class="im"><br>
&gt; But, please, correct me if I am wrong, in your example, the splicer are<br>
&gt; executed at run time and not at compile time.<br>
<br>
</div>With TH, it becomes a bit difficult to tell what is exactly `compile<br>
time&#39;. One can say however that when the code is ready to be spliced<br>
in at the top level, the IO actions in its splices must have been<br>
completed.<br>
<div class="im"><br>
&gt; I have modified your example to make it run at compile time and I get a<br>
&gt; (compile time) segmentation fault.<br>
<br>
</div>As I mentioned, the code was specifically designed to cause something<br>
like segmentation fault. Sneaking out free variables is definitely the<br>
bad thing. The principle of exchanging data between splices (using<br>
runQ/runIO) is valid and could be used for good things, too.<br>
<br>
I am wondering though what GHC version and command-line parameters are<br>
you using? On my system. with GHC 6.10.3, I tried running the original<br>
and modified code in GHCi and GHC (with and without -O2) and did not<br>
get segmentation fault. Could you provide more details about your<br>
system so to reproduce the segfault? I think Simon Peyton-Jones would<br>
really like to know all that.<br>
<br>
        Cheers,<br>
        Oleg<br>
</blockquote></div><br>