Jeff Wheeler <[EMAIL PROTECTED]> wrote:
> I suspect I should be using some sort of monad to represent the commands,
> but I don't fully understand monads, and am not sure how it would apply in
> this context.
>
> Should I be using a monad here, and if so, how?
At risk of stating the obvious, you will need to us the IO
monad...
When you say "use a monad to represent" the commands, that is
perhaps not necessary. You can represent the commands as data,
for example:
data MyLanguage = Go | Stop | Left | Right
runMyLanguage :: MyLanguage -> IO ()
The `runMyLanguage` function serves to transform commands
as pure data into real IO actions.
--
_jsn
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe