Fwd: [Haskell-cafe] Re: Simple game: a monad for each player

Limestraël limestrael at gmail.com
Wed Apr 14 12:12:18 EDT 2010


Okay, I just understood that 'Prompt' was just a sort of view for 'Program'.


>I'd like to make it very accessible, so please don't hesitate to report
>any difficulties with finding and understanding documentation and examples!

Then I think the name 'Prompt' may be misleading for those who doesn't know
the MonadPrompt package. Maybe something like 'ProgramView' ?


>> What have we achieved? Both players still can only access functions from
>> whatever monad m turns out to be. But now each strategy can pile its own
>> custom monad stack on the  Player m  monad! And of course, the use of
>> the m Monad is completely optional.
>
>Of course, the custom monad stack has to provide a projection back to
>the  Player m a  type
>
>   runMyStackT :: MyStackT (Player m) a -> Player m a

According to what Bertram said, "each strategy can pile its own custom monad
stack ON the (Player m) monad".
Here, you are stacking the (Player m) monad ON the custom monad stack.
What is then the use of the 'm', in (Player *m*)? Is it not supposed to be a
custom monad? (MonadIO for human, Identity for AI, etc.)

But then, I don't see how the game function could work:

> game :: Monad m => Player m () -> Player m () -> m ()
As it is written, it requires both players to run in the SAME monad.
And if have a network player ( e.g.* Player (StateT Handle IO)* ) and an AI
storing former opponent's moves ( e.g. *(Monad m) => Player (StateT [Move]
m)* ), then they can't be in the same monad...
*
*
2010/4/14 Heinrich Apfelmus <apfelmus at quantentunnel.de>

> Limestraël wrote:
>
> > I have some difficulties to see the use of PromptT, because in the
> tutorial,
> > this type is never mentioned, and its operations (Return and :>>=) are
> > instead constructors of ProgramT...
> >
> > Would you have some concrete examples? Because there I'm a bit lost
> (since
> > the tutorial doesn't match the operational package as it is, because of
> the
> > type PromptT)...
>
> The project page
>
>    http://projects.haskell.org/operational/
>
> links to documentation that describes the differences to "The
> Operational Monad Tutorial", in particular the new  Prompt  and  PromptT
>  types. It also links to several examples. Two small examples are also
> included in the Haddock documentation.
>
>
> I'd like to make it very accessible, so please don't hesitate to report
> any difficulties with finding and understanding documentation and examples!
>
>
> Regards,
> Heinrich Apfelmus
>
> --
> http://apfelmus.nfshost.com
>
> _______________________________________________
> 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/20100414/24749aef/attachment.html


More information about the Haskell-Cafe mailing list