[Haskell-cafe] Hot-Swap with Haskell

Don Stewart dons at galois.com
Thu Jul 15 23:17:24 EDT 2010

> 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.

Well, the other approach to reloadable modules, using either object code
plugins, or bytecode plugins, giving you module-level granularity.

-- Don

More information about the Haskell-Cafe mailing list