[Haskell-cafe] Hot-Swap with Haskell

Thomas Schilling nominolo at googlemail.com
Fri Jul 16 06:02:25 EDT 2010

What would be the semantics of hot-swapping?  For, example, somewhere
in memory you have a thunk of expression e.  Now the user wants to
upgrade e to e'.  Would you require all thunks to be modified?  A
similar problem occurs with stack frames.

You'd also have to make sure that e and e' have the same (or
compatible types).  e' most likely has different free variables than
e, how can you translate thunk one to the other?

Now assuming you don't try to do this, how would you handle the case
when something goes wrong?

On 16 July 2010 04:05, Andy Stewart <lazycat.manatee at gmail.com> wrote:
> Hi all,
> I'm research to build a hot-swap Haskell program to developing itself in
> Runtime, like Emacs.
> Essentially, Yi/Xmonad/dyre solution is "replace currently executing"
> technology:
>   re-compile new code with new binary entry
>   when re-compile success
>      $ do
>          save state before re-launch new entry
>          replace current entry with new binary entry (executeFile)
>          store state after re-launch new entry
> There are some problems with re-compile solution:
> 1) You can't save *all* state with some FFI code, such as gtk2hs, you
> can't save state of GTK+ widget. You will lost some state after
> re-launch new entry.
> 2) Sometimes re-execute is un-acceptable, example, you running some command
> in temrinal before you re-compile, you need re-execute command to
> restore state after re-launch, in this situation re-execute command is un-acceptable.
> I wonder have a better way that hot-swapping new code without
> re-compile/reboot.
> Thanks,
>  -- Andy
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe

If it looks like a duck, and quacks like a duck, we have at least to
consider the possibility that we have a small aquatic bird of the
family Anatidae on our hands.

More information about the Haskell-Cafe mailing list