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

Corentin Dupont corentin.dupont at gmail.com
Sun Nov 7 11:02:02 EST 2010


Hello Jeremy,
thanks for your mail.

I am in despair on this problem since days, I would really help your help.
I can't figure out how I can add MACID into my program.
Here's the problem:
I already have monads in my program like that:

> type Comm = StateT Communication IO
>
> type GameState a = StateT Game Comm a

Many functions make use of GameState.
The only type that need to be serialized is Game.
The type Communication contains TChans used for players communication.
The IO in Comm is necessary to make some print outs and to use an
interpretor when needed (Hint).

How can this match with the Update type in Happstack?

Thanks a lot for your help.
Corentin


On Fri, Nov 5, 2010 at 3:50 AM, Jeremy Shaw <jeremy at n-heptane.com> wrote:

> Hello,
>
> I added a brief section to the happstack crash course on using MACID:
>
> http://www.happstack.com/docs/crashcourse/HappstackState.html
>
> That should hopefully get you started.
>
> The example uses happstack state with happstack server. But there is
> really no connection between the two.
>
> Hope this helps! If you have additional questions, feel free to ask!
>
> - j
>
>
> On Thu, Nov 4, 2010 at 12:48 PM, Dupont Corentin
> <corentin.dupont at gmail.com> wrote:
> > 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 (StateT state STM)
> >
> > 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
> >
> >
> >
> >
> > _______________________________________________
> > Haskell-Cafe mailing list
> > Haskell-Cafe at haskell.org
> > http://www.haskell.org/mailman/listinfo/haskell-cafe
> >
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20101107/3bd8ff17/attachment-0001.html


More information about the Haskell-Cafe mailing list