[Haskell-cafe] How to reload module that package has linked in memory?

Andy Stewart lazycat.manatee at gmail.com
Sun Dec 26 04:07:07 CET 2010

Hi Albert,

Thanks for reply!

"Albert Y. C. Lai" <trebla at vex.net> writes:

> On 10-12-25 10:47 AM, Andy Stewart wrote:
>> I use Linker.linkPackages and Linker.getHValue to get symbol value, but
>> looks Linker.getHValue can't get *update* value once current package has
>> linked in memory.
>> So how to make Linker.getHValue can get *update* value and don't need
>> install *new* package in Cabal/GHC database?
>> How to *reload* module with current version package?
> Cannot be done. 
Unfortunately, my library just miss this part.
But i think reload same package must be can work, in principle.
> I suggest using no packages if you want a module refreshed. This is means using
> GHC.setTargets and GHC.load (I personally use loadWithLogger for improved error handling). You can
> still use Linker.getHValue at the end.
If not use package, we need handle depend problem self.
Example, same module name exist in two different depend package, we need pass
-package information myself, and no those problems if use cabal package. 

> See also http://thread.gmane.org/gmane.comp.lang.haskell.glasgow.user/18742/focus=18749
Do you have any improve code than above? :)

Thanks for help!

  -- Andy

More information about the Haskell-Cafe mailing list