[Haskell-cafe] GHCi and State

Matthias Görgens matthias.goergens at googlemail.com
Fri Jul 2 11:33:06 EDT 2010


Hi Corentin,

Interesting.  Have you thought about following the example of XMonad instead?

The analogy could goes as follows:
XMonad's configuration file (~/.xmonad/xmonad.hs) <=> Your rules.
XMonad's state <=> Your state.
Editing the config file <=> Changing the rules.

Of course you normally edit the config file while XMonad is running,
and in theory XMonad could do funny things to your Emacs, i.e. require
you to vote before letting any edit-command through.

When you change your configuration file, you send a specific
key-sequence to XMonad (Alt-q is the default), and XMonad serializes
it's state into a string, compiles the new config file, and then
replaces itself with the new instance, handing over it's state.

No mutable-state-in-IO trickery necessary.

Matthias.


More information about the Haskell-Cafe mailing list