[Haskell-cafe] Simple game: a monad for each player
limestrael at gmail.com
Sat Apr 10 16:59:48 EDT 2010
Okay for IA, which doesn't need any special monad, but what if I want to make
a network player ?
It would have to run in a State monad, accessing to IO, storing a
For instance, (Monad m) => StateT ByteString m.
The ByteString is a lazy one, we read from it to get the data sent by the
real player through the network.
Then, if I want to have a human an a network player playing sequentially,
how can I do this without stacking each player's monad? (See my first mail)
Philippa Cowderoy wrote:
> On 10/04/2010 13:57, Yves Parès wrote:
>> I answered my own question by reading this monad-prompt example:
>> But one issue remains: those examples show how to make play EITHER a
>> or an AI. I don't see how to make a human player and an AI play
>> (to a TicTacToe, for instance).
> Make them polymorphic - the human player in any MonadIO, the AI player
> in any monad. Then run them both in the same monad, with some kind of
> wrapping function around the calls setting a context for the appropriate
> flippa at flippac.org
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
Live long and prosper
View this message in context: http://old.nabble.com/Simple-game%3A-a-monad-for-each-player-tp28183930p28204685.html
Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.
More information about the Haskell-Cafe