[Haskell-cafe] rebinding >>= for restricted monads

ihope ihope127 at gmail.com
Sun Dec 17 18:19:00 EST 2006

On 12/17/06, David Roundy <droundy at darcs.net> wrote:
> Hello fellow haskellers,
> I am wondering if anyone has an idea whether I'd run into trouble if I
> rebound >>= in order to provide a more restricted monad.  My idea is to
> define a class:

. . .

> which seems rather heavy.  Can anyone think of syntax-light way to allow my
> hypothesized rebound do-notation to also work with ordinary monads?

You could try something like this:

> import Prelude hiding (Monad (..))
> import qualified Prelude (Monad (..)) as P
> class WitnessMonad wm where ...
> data M m w w' c = M (m c)
> instance P.Monad m => WitnessMonad (M m) where ...

Then if everything works out, you should end up with M IO and such as

More information about the Haskell-Cafe mailing list