GHCI :reload module without erasing previous data

Simon Marlow marlowsd at gmail.com
Wed Nov 11 06:46:40 EST 2009


On 09/11/2009 18:28, Michael Serdar wrote:
> I have a module that loads several dozen megabytes of static data into
> memory. This module is working properly. I have another module that I'm
> developing to analyze that data. As I make iterations on the analysis
> module, I would like it if the data loaded by the data module could stay
> in memory.
>
> In GHCI, every time I reload a module, it clears whatever data I have
> set with the "let" command. Is there a way to persist that data across
> calls to :reload, or is there an altogether different workflow I should
> be using for this?

GHCi always discards the current bindings when you :reload.  The way to 
make them persistent is to put them in a module and :load it.  Top-level 
bindings in interpreted modules will not be reverted, as long as the 
module itself is not recompiled, or depends (indirectly) on a module 
that has been recompiled.

Cheers,
	Simon


More information about the Glasgow-haskell-users mailing list