[Haskell-cafe] Re: Hot-Swap with Haskell

Martin Hilbig martin at mhilbig.de
Fri Jul 16 02:47:10 EDT 2010


if been thinking about an haskell interpreter to, because of erlang's 
otp. its syntax is a mess, but its scalability is win.

since erlang runs in its vm ("interpreted") is there a need for a real 
haskell interpreter, or can there be a compiled haskell/otp with 
hotswapping, scaling and stuff?

now back on topic, i wrote "real" haskell interpreter because there is 
the hint[1] package, which wrappes the ghc api.

now i dont know what more the plugin package provides, but i thought 
hint is like is successor (since lambdabot used plugins and now uses 
mueval, which in turn uses hint ;). please correct me.

have fun

[1]: http://hackage.haskell.org/package/hint

On 16.07.2010 06:06, Andy Stewart wrote:
> Don Stewart<dons at galois.com>  writes:
>> lazycat.manatee:
>>> 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.
> Thanks for your reply.
> I have read your papers : "Dynamic Application From the Group Up" and  "Plugging Haskell In"
> In "Dynamic Application From the Group Up", you introduction how to use
> re-compile technology implement source-code level hot-swapping.
> In "Plugging Haskell In", you introduction to how to buld hot-swapping
> with object-code level.
> Yes, Dynamic linking can add new code to a running program, but how to
> replace existing binding with new ones?
> Looks you still need some reboot when you do *replace* and not just *add*.
> Infact, reboot is okay, only problem is *keep state*, some *static state*
> is easier to re-build, example, if you want restore editor buffer state, you
> just need save (filepath, cursorPosition), you can re-open file and
> restore cursor position after reboot process.
> Difficult is *Stream State*, such as:
>    delete operation in file-manager
>    command running in temrinal
>    network communications in browser
> It's really difficult to restore those state, and re-execute is
> un-acceptable sometimes.
> You can found the screenshot of my project at http://www.flickr.com/photos/48809572@N02/
> Currently, the closest library to implement dynamic linking is your
> plugins package (http://hackage.haskell.org/package/plugins-1.4.1),
> i really want to write some code to test it, unfortunately, it's
> broken with Cabal- that can't compile with ghc-6.12.x/ghc-6.12.3,
> can you fix it if you have time? It's so great package...
> I'm looking for some paper about "Haskell and hot-swapping".
> Any paper or suggestion are welcome!
>    -- Andy
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe

More information about the Haskell-Cafe mailing list