
On 18 Jul 2009, at 10:21, Wolfgang Jeltsch wrote:
Am Freitag, 17. Juli 2009 21:57 schrieb Edward Kmett:
The main concern with generalizing (++) is that it was once generalized -- completely differently! -- for mplus in MonadPlus. So whether Monoid's mappend is the natural generalization of (++) or MonadPlus's mplus is, is not entirely clear. Neither one can completely subsume all of the use-cases of the other.
I hope that in the long run, we will be able to drop Alternative and MonadPlus. This will be possible once we allow universal quantification in contexts. Instead of writing (MonadPlus m), we can write (Monad m, forall a. Monoid (m a)) then. This makes it rather clear that Monoid (mappend) would be the better generalization of (++). MonadPlus (mplus) is a bit of a hack.
Until that joyous day, I'd like to hope we might consider ensuring that MonadPlus m, Alternative m, and Monoid (m a) functionalities do at least coincide. I'm thinking in particular of Maybe, which behaves splendidly as an implementation of an exception monad, until you start using foldMap as a control operator. Cheers Conor