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

Reid Barton rwbarton at math.harvard.edu
Wed Apr 14 19:48:40 EDT 2010

On Wed, Apr 14, 2010 at 04:43:20PM +0200, Limestraël wrote:
> Yves, that is exactly how I designed my program so far.
> Human player needs a monad IO, AI needs just a monad, whatever it is, and I
> make both run in IO.
> And, as you said, the type of the ai (bot :: Monad m => Player m) contains
> no IO, so I know that, even if I make it run in IO, it won't make any
> side-effect.
> My problem was, for example, if I want a player to run in its OWN monad.
> Human uses IO, which is unique and shared by all the human players in the
> program.
> But what if I want an AI that remember every former opponent's move, so that
> it could adapt its reflexion all along the game?
> Then this AI would have to run in its own State monad, for instance.

Perhaps the techniques of this recent draft paper would be useful:
(click the link "draft")

Reid Barton

More information about the Haskell-Cafe mailing list