[Haskell-cafe] AT solution: rebinding >>= for restricted monads

Jacques Carette carette at mcmaster.ca
Tue Dec 19 10:08:12 EST 2006


David Roundy wrote:
> The trouble is that your solution doesn't allow you to use do-notation with
> the IxMonad.  And if you did allow yourself to use do-notation by rebinding
> (>>=), etc, then you wouldn't be able to use ordinary monads with
> do-notation in the same module.  That's what makes things tricky, since an
> IxMonad is different-kinded from Monad, so you can't make a monad an
> instance of IxMonad.
>   
Seems to me that this screams for camlp4.  Oops, wrong language ;-)

But seriously, this kind of thing seems to arise often enough that 
having a standard method for doing "syntax extensions" for Haskell seems 
like a good idea.

And as far as making Monad instances for IxMonad, this is where partial 
application at the class level would come in rather handy.  Seems to be 
that (at least) IxMonad m () () should be a Monad.

Jacques


More information about the Haskell-Cafe mailing list