
29 Nov
2009
29 Nov
'09
11:07 a.m.
On Sun, Nov 29, 2009 at 03:11:23PM +0100, papa.eric@free.fr wrote:
However, I wonder how to do it reusing the "pure" versions, runGame and Strategy?
There's a nice approach to this problem which is described and implemented in the MonadPrompt package[1]. Basically you have prompt :: MonadPrompt p m => p a -> m a which allows you to interact with the outside world. The beauty here is that the interection is generic, you may write a pure simulator (like yours), an IO-heavy game (like what you're trying) and possibly more, like unit tests and property checks. Cheers, [1] http://hackage.haskell.org/package/MonadPrompt -- Felipe.