Thanks a lot! Althaugh I have some understanding of the Haskell basics and the most important monads, I feel that I have to see more well designed code in order to become a good Haskeller. Can somebody make suggestions what materials are best to work through in order to achieve this? Are there easy research papers about Haskell programming? Or should I try the Monad.Reader? I'm looking for topics that either can be used directly in many situations or that show some functional principles that boost my creativity and functional thinking.

Regards,
Tim

2011/11/19 Felipe Almeida Lessa <felipe.lessa@gmail.com>
On Sat, Nov 19, 2011 at 6:08 PM, Tim Baumgartner
<baumgartner.tim@googlemail.com> wrote:
> I have not yet gained a good understanding of the continuation monad, but I
> wonder if it could be used here. What would a clean solution look like?
> Perhaps there are other things that need to be changed as well?

Your 'Interaction' data type is actually an instance of the more
general "operational monad" (as named by Heinrich Apfelmus) or "prompt
monad" (as named by Ryan Ingram).  You will ready-to-use
implementations on the packages MonadPrompt [1] and operational [2,3].
 Reading their documentation you'll find some links about the
development of these concepts.  MonadPrompt uses a Cont-style
implementation, while operational uses a simple abstract data type
together with a viewing function that avoids O(nČ) behavior.

If you find it hard to describe your 'Interaction' using operational
(easiest to use package, IMO), please send us another e-mail.

Cheers!

[1] http://hackage.haskell.org/package/MonadPrompt
[2] http://hackage.haskell.org/package/operational
[3] http://heinrichapfelmus.github.com/operational/Documentation.html

--
Felipe.