Basically when I :load name.hs
the variables and bindings are gone.
Is there some option to tell ghci keep it all?
To load a new module, you can use
Prelude> :m + Mymodule
But reloading and keeping interactive bindings is not generally possible. Reloading is essentially forgetting all modules and loading them again. The bindings could depend on already loaded modules. The dependency logic dictates that when GHCI forgets a module, it also needs to forget everything that depends on it, including interactive bindings.
GHCI could e.g. store the text of commands that where used to create the bindings, and try to re-run those commands on reload, knowing that some of them might fail. But this can get hairy very quickly, so it's not being done.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With