<div dir="ltr">Yes, thank you Simon, my test works if I wait at least 1 second before the two loads, so I'd say I run exactly into that issue. So I can adapt my code to only remove the target if the files do not give me a time difference.<div>
<br></div><div style>Thanks a million!</div><div style><br></div><div style>JP</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Jan 25, 2013 at 5:29 PM, Simon Marlow <span dir="ltr"><<a href="mailto:marlowsd@gmail.com" target="_blank">marlowsd@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Has the file's modification time changed? If you're doing this very quickly (within 1 second) then you might run into this:<br>
<br>
<a href="http://hackage.haskell.org/trac/ghc/ticket/7473" target="_blank">http://hackage.haskell.org/<u></u>trac/ghc/ticket/7473</a><br>
<br>
Cheers,<br>
Simon<div class="im"><br>
<br>
On 25/01/13 16:02, JP Moresmau wrote:<br>
</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">
When I do that (only adding the target once and just doing load after<br>
the file has changed) the changes in the file are not taken into account<br>
(getNamesInScope for example doesn't give me the name of a type added<br>
inside the file). I probably have my stupid hat on (friday<br>
afternoon...), but when I do remove/load in between it works...<br>
<br>
Thanks<br>
<br>
<br>
On Fri, Jan 25, 2013 at 4:33 PM, Simon Marlow <<a href="mailto:marlowsd@gmail.com" target="_blank">marlowsd@gmail.com</a><br></div><div><div class="h5">
<mailto:<a href="mailto:marlowsd@gmail.com" target="_blank">marlowsd@gmail.com</a>>> wrote:<br>
<br>
On 25/01/13 14:30, JP Moresmau wrote:<br>
<br>
Hello, I just want to be sure of what's the fastest way to reload a<br>
module with the GHC API.<br>
I have a file whose path is fp<br>
I load the module with:<br>
addTarget Target { targetId = TargetFile fp Nothing,<br>
targetAllowObjCode<br>
= True, targetContents = Nothing }<br>
Then I load the module<br>
load LoadAllTargets<br>
And when I want to reload the module (the contents of fp have<br>
changed) I do:<br>
removeTarget (TargetFile fp Nothing)<br>
load LoadAllTargets<br>
and then I rerun my initial code (addTarget, load)<br>
<br>
<br>
You should be able to just invoke 'load LoadAllTargets' and omit the<br>
intermediate remove/load step. Or is there a reason you want to<br>
remove the target?<br>
<br>
Cheers,<br>
Simon<br>
<br>
<br>
<br>
<br>
--<br>
JP Moresmau<br>
<a href="http://jpmoresmau.blogspot.com/" target="_blank">http://jpmoresmau.blogspot.<u></u>com/</a><br>
</div></div></blockquote>
<br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br>JP Moresmau<br><a href="http://jpmoresmau.blogspot.com/">http://jpmoresmau.blogspot.com/</a>
</div>