Fastest way to reload module with GHC API

JP Moresmau jpmoresmau at gmail.com
Fri Jan 25 15:30:49 CET 2013


Hello, I just want to be sure of what's the fastest way to reload a module
with the GHC API.
I have a file whose path is fp
I load the module with:
addTarget Target { targetId = TargetFile fp Nothing, targetAllowObjCode =
True, targetContents = Nothing }
Then I load the module
load LoadAllTargets
And when I want to reload the module (the contents of fp have changed) I do:
removeTarget (TargetFile fp Nothing)
load LoadAllTargets
and then I rerun my initial code (addTarget, load)

This works well, I don't get any errors about duplicates, the information I
extract from the module is updated properly. But is it the most efficient,
or can I achieve the same thing faster (I'm looking at improving the
performance of my BuildWrapper code and by consequence of EclipseFP)?

Thanks!

-- 
JP Moresmau
http://jpmoresmau.blogspot.com/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/glasgow-haskell-users/attachments/20130125/70685205/attachment.htm>


More information about the Glasgow-haskell-users mailing list