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

Yves Parès limestrael at gmail.com
Sat Apr 10 07:43:14 EDT 2010

I looked at the operational package (since it seemed simpler).
I see its interest when building sets of operations.
I think I see how I could apply it to my current problem. I saw in the
tutorial the sentence: "The ability to write multiple interpreters is also
very useful for implementing games, specifically to account for both human
and computer opponents as well as replaying a game from a script."
So I'm supposed to write 2 functions, one interpretHuman (running in IO, and
prompting the user), and one interpretAI (running in Identity)?

Are there examples of such games using operational?

Heinrich Apfelmus wrote:
> Gwern Branwen wrote:
>> Yves Parès <limestrael at gmail.com> wrote:
>>> [...]
>>> But when running the game, the program cannot "switch" from a player's
>>> monad
>>> to another.
>>> Do you have any suggestion?
>> Your desires remind me of the MonadPrompt package
>> <http://hackage.haskell.org/package/MonadPrompt>, which IIRC, has been
>> used in some game demos to provide abstraction from IO/test
>> harness/pure AI etc.
> The game demo can be found by chasing links from the package
> documentation:
>    http://int-e.home.tlink.de/haskell/solitaire.tar.gz
> There's also my package "operational"
>    http://hackage.haskell.org/package/operational
> which implements the same concept. It's throughly explained here:
>    http://apfelmus.nfshost.com/articles/operational-monad.html
>    http://projects.haskell.org/operational/
> Regards,
> Heinrich Apfelmus
> --
> http://apfelmus.nfshost.com
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe

Yves Parès

Live long and prosper
View this message in context: http://old.nabble.com/Simple-game%3A-a-monad-for-each-player-tp28183930p28201466.html
Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.

More information about the Haskell-Cafe mailing list