[Haskell-cafe] How can I use MACID in my existing application?

Dupont Corentin corentin.dupont at gmail.com
Thu Nov 4 13:48:46 EDT 2010


Hello,
I'm wondering how can I use Happstack's MACID in my application without
breaking everything.

I have a monad like that:

type Comm = StateT Communication IO

type GameState a = StateT Game Comm a

and many functions like:
foo :: GameState ()
foo = do
   lift $ putComm <some message to player's channel>
   modify <someAction>

The state of the game is stored in Game.
Comm is used as an abstraction to communicate over several channels with
players.

Whereas MACID asks to use:

type *Update* state =
Ev<http://happstack.com/docs/0.5.0/happstack-state/Happstack-State.html#t%3AEv>(
StateT<http://happstack.com/docs/0.5.0/mtl/Control-Monad-State-Lazy.html#t%3AStateT>state
STM <http://happstack.com/docs/0.5.0/base/GHC-Conc.html#t%3ASTM>)

How can I use this without modifying everything??
I understand that MACID must record the <someAction> from above but the
message should not.

Thanks for help!

Corentin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20101104/e607b771/attachment.html


More information about the Haskell-Cafe mailing list