
G'day all.
Quoting Josef Svenningsson
You're of course absolutely right that it doesn't make sense to talk about mzero being a right-identity for bind if the monad doesn't support mzero. I should have been more clear. Let me have another try at explaining myself.
OK.
Let's consider a specific monad transformer, say (ReaderT r). What I hope to convince you of is that (ReaderT r) cannot be said break the mzero-is-right-identity-for-bind law.
Yep, I'd agree with that. The important thing is this instance: instance (MonadPlus m) => MonadPlus (ReaderT r m) This says that if m is a MonadPlus (we'll assume for a moment that this includes the "mzero is a right zero for bind" law), then ReaderT r m is a MonadPlus (including the same law). I was thinking more along the lines of Ralf Hinze's nondeterminism transformer monad: http://haskell.org/hawiki/NonDeterminism The relevant instance is this: instance (Monad m) => MonadPlus (NondetT m) That is, if m is a Monad, then NondetT m is a MonadPlus. This is not true if a requirement for MonadPlus is that it include the "mzero is a right zero for bind" law. Indeed, such a transformer is impossible to write if that law is a requirement.
You claimed that monad transformers break the mzero-is-right-identity-for-bind law because they can be applied to IO. I say, it's not the monad transformers fault. They cannot possibly be expected to repair the law if they are given a faulty monad.
IO is not a faulty monad. It satisfies all of the laws that a monad is supposed to satisfy. Cheers, Andrew Bromage