This module provides alternatives to the Functor, Monad and MonadPlus classes,
allowing for constraints on the contained type (a restricted monad).
It makes use of associated datatypes (available in GHC 6.8).

To make your own type instances of these classes, first define
the Constraints datatype and the Suitable type class for it. For example,

data instance Constraints Set a = Ord a => SetConstraints
instance Ord a => Suitable Set a where
constraints _ = SetConstraints

You need to change Set to your own type, Ord a to your own
constraints, and SetConstraints to some distinguished name (this name
will not normally be visible to users of your type)

Next you can make an instance of RMonad and if appropriate RMonadPlus
by defining the members in the usual way. When you need to make use of the
constraint on the contained type, you will need to get hold of the constraint
wrapped up in the Constraints datatype. For example here are the instances
for Set:

Once you have made your type an instance of RMonad, you can
use it in two ways.
Firstly, import this module directly and use the NoImplicitPrelude extension
so that do-syntax is rebound.
Secondly, use the wrapper type in Control.RMonad.AsMonad which supports
the normal Monad operations.