
Am Sonntag, 23. Januar 2005 15:58 schrieb Jorge Adriano Aires:
I'm not arguing that definition would be "wrong". It is a monoid. This is the instance for ():
instance MonadPlus() where mzero = () mplus a b = ()
Maybe I'm stupid, but:
class Monad m => MonadPlus m where mzero :: m a mplus :: m a -> m a -> m a
How does () fit into this, () isn't of kind * -> *, as far as I know () Int is meaningless -- just checked, gives Kind Error.
Nope, I am. Sorry! I was alternating between monoids and monadplus, and came up with that nonsense. I was obviously thinking about Monoid () and not MonadPlus ().
And this would be "correct" too:
instance MonadPlus Maybe where mzero = Nothing mplus a b = Nothing
instance MonadPlus [] where
mzero = [] mplus a b = []
Both aren't correct, since mzero `mplus` x == x doesn't hold (they're syntactically correct, though).
Yeap. You are right again. Sorry for this terrible example, please ignore it. J.A.