hot-refreshing a package (same version number, new content)
marlowsd at gmail.com
Mon Jul 19 09:21:39 EDT 2010
On 15/07/2010 23:41, Albert Y. C. Lai wrote:
> Suppose I start ghci, use a value from a package, causing it to be
> linked, then I modify the package and reinstall, same version number,
> without quitting my ghci session. Is there a way to tell the ghci
> session to refresh and use the modified package?
GHCi keeps track of which packages are loaded, and will not load the
same package twice; currently there's no way to make it forget which
packages are loaded. I think this applies even if you make a package
with a different ABI hash, because internally GHC discards the ABI
hashes on package IDs.
Even if you managed to make GHC forget about the package, the linker
will currently refuse to load the same object file twice, so that's
So I think it might be possible in principle, but some hacking is required.
> Suppose I do something similar with the GHC API (6.12.3, linux, x86, 32
> bit). The attachment g.hs is my program to get a value from the package
> (called watermelon-0.1), print it, wait for me to press return, (at this
> point I modify the source code of the package, rebuild, reinstall), then
> loop back to get a value from the package again... how should I refresh
> so I get the new value?
> Or I am supposed to forget this and just bump the version number of the
That would probably work, yes.
More information about the Glasgow-haskell-users