On Tue, 20060620 at 18:43 0300, Maur=C3=ADcio wrote:
> Hi,
>=20
> Which class does Render monad instanciates: Monad or MonadPlus=20
> (beginner question: how would I know that for myself)?
If you start ghci and load Graphics.Rendering.Cairo you can ask ghci to
give you info on any named thing:
> ghci
> :module Graphics.Rendering.Cairo
> :info Render
And in this case it'll tell you that it's an instance of the Monad and
Functor classes.
> If Monad is the answer, wouldn't it be nice to use MonadPlus instead?=20
> I think things like guard, unless etc. would be nice inside a Render.
You can use 'unless' because it only needs a Monad instance.
As for guard, I'm not sure what it would mean for the Render monad, or
the other MonadPlus functions, mzero, mplus. The Render monad is rather
like the State or IO monads and you'll note that neither of them are
instances of MonadPlus.
Can think of what the definitions of mzero and mplus would be?
Duncan
