24 Jun 19:17 2013

## MonadPlus instance for ContT

Ross Paterson <R.Paterson <at> city.ac.uk>

2013-06-24 17:17:58 GMT

2013-06-24 17:17:58 GMT

Alistair Lynn has proposed the following instance: instance (Monoid r, Monad m) => MonadPlus (ContT r m) where mzero = ContT $ const $ return mempty m `mplus` n = ContT $ \ c -> liftM2 mappend (runContT m c) (runContT n c) but this would also be possible: instance (MonadPlus m) => MonadPlus (ContT r m) where mzero = ContT $ const mzero m `mplus` n = ContT $ \ c -> runContT m c `mplus` runContT n c Is one of them better?