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

Heinrich Apfelmus apfelmus at quantentunnel.de
Thu Apr 15 13:18:59 EDT 2010

Limestraël wrote:
>> 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' ?

Very good point. I'll change that in a future version.

> Ok, but there is no function such as mapMonad in the operational package?

No, not yet, but I'll probably add it, or at least its lesser cousin

    liftT :: Program instr a -> ProgramT instr m a

to a future version of the library. Still pondering.

> By the way, I noticed that ProgramT is not automatically made instance of
> MonadIO when possible. It could be:
> instance (MonadIO m) => MonadIO (ProgramT r m) where
>     liftIO = lift . liftIO
> Is that intentional?

Yes and no. I refrained from making instances for the  mtl  classes
because I have not clearly thought about the design consequences yet.

I think that monad transformers are not the last word on modular
computational effects yet and I don't want to paint myself into a
corner. For example, as you note, the MonadIO instance could be deduced
automatically from the  MonadTrans  instance.

Of course, if I make  operational  interoperable with the  mtl , then I
better adhere to its style even if I'm not entirely happy with it.

> By the way, I finally managed to use operational to modify my TicTacToe
> game.

Yay! :D

> (One shot, by the way, I had no bugs ^^. Very nice when it happens...)
> Human player and AI are working. I'm currently fixing the Network player.
> If you are interested, I could upload my code (it can be another example of
> how to use the operational package).

Sending me / uploading your TicTacToe code would be great! I probably
won't use it verbatim, but try to simplify it a bit to turn it into
another easy to understand example of how to use  operational .

Heinrich Apfelmus


More information about the Haskell-Cafe mailing list